summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <copr-devel@lists.fedorahosted.org>2023-03-07 13:17:01 +0000
committerCoprDistGit <copr-devel@lists.fedorahosted.org>2023-03-07 13:17:01 +0000
commit6ca636f50244c839bd063032f04146037fc16347 (patch)
treeeba1a24df168f50c4a8b8b40cd359c107d352594
parentfb51dc8f9a2f204ce6dcc0892205e0c81f45e67a (diff)
automatic import of python-amico
-rw-r--r--.gitignore1
-rw-r--r--python-amico.spec708
-rw-r--r--sources1
3 files changed, 710 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..eef7a70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/amico-1.0.1.tar.gz
diff --git a/python-amico.spec b/python-amico.spec
new file mode 100644
index 0000000..d3fcd92
--- /dev/null
+++ b/python-amico.spec
@@ -0,0 +1,708 @@
+%global _empty_manifest_terminate_build 0
+Name: python-amico
+Version: 1.0.1
+Release: 1
+Summary: Relationships (e.g. friendships) backed by Redis.
+License: LICENSE.txt
+URL: https://github.com/agoragames/amico-python
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/37/96/0f30e738994ae9f4fd9ebcab5f4c5e9ffad6ec0387239a4cf33c222b7cd9/amico-1.0.1.tar.gz
+BuildArch: noarch
+
+
+%description
+# amico
+
+Relationships (e.g. friendships) backed by Redis. This is a port of the [amico gem](https://github.com/agoragames/amico).
+
+## Installation
+
+`pip install amico`
+
+Make sure your redis server is running! Redis configuration is outside the scope of this README, but
+check out the [Redis documentation](http://redis.io/documentation).
+
+## Usage
+
+Be sure to import the Amico library:
+
+```python
+from amico import Amico
+```
+
+Amico is configured with a number of defaults:
+
+```python
+>>> Amico.DEFAULTS
+{'namespace': 'amico', 'pending_follow': False, 'reciprocated_key': 'reciprocated', 'followers_key': 'followers', 'pending_with_key': 'pending_with', 'following_key': 'following', 'page_size': 25, 'pending_key': 'pending', 'blocked_by_key': 'blocked_by', 'default_scope_key': 'default', 'blocked_key': 'blocked'}
+```
+
+The initializer for Amico takes two optional parameters:
+
+* `options` : Dictionary of updated defaults
+* `redis_connection` : Connection to Redis
+
+```python
+>>> amico = Amico(redis_connection = redis)
+```
+
+```python
+>>> amico.follow(1, 11)
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+False
+>>> amico.follow(11, 1)
+>>> amico.is_following(11, 1)
+True
+>>> amico.following_count(1)
+1
+>>> amico.followers_count(1)
+1
+>>> amico.unfollow(11, 1)
+>>> amico.following_count(11)
+0
+>>> amico.following_count(1)
+1
+>>> amico.is_follower(1, 11)
+False
+>>> amico.following(1)
+['11']
+>>> amico.block(1, 11)
+>>> amico.is_following(11, 1)
+False
+>>> amico.is_blocked(1, 11)
+True
+>>> amico.is_blocked_by(11, 1)
+True
+>>> amico.unblock(1, 11)
+>>> amico.is_blocked(1, 11)
+False
+>>> amico.is_blocked_by(11, 1)
+False
+>>> amico.follow(11, 1)
+>>> amico.follow(1, 11)
+>>> amico.is_reciprocated(1, 11)
+True
+>>> amico.reciprocated(1)
+['11']
+```
+
+Use amico (with pending relationships for follow):
+
+```python
+>>> amico = Amico(options = {'pending_follow': True}, redis_connection = redis)
+>>> amico.follow(1, 11)
+>>> amico.follow(11, 1)
+>>> amico.is_pending(1, 11)
+True
+>>> amico.is_pending_with(11, 1)
+True
+>>> amico.is_pending(11, 1)
+True
+>>> amico.is_pending_with(1, 11)
+True
+>>> amico.accept(1, 11)
+>>> amico.is_pending(1, 11)
+False
+>>> amico.is_pending_with(11, 1)
+False
+>>> amico.is_pending(11, 1)
+True
+>>> amico.is_pending_with(1, 11)
+True
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+False
+>>> amico.is_follower(11, 1)
+True
+>>> amico.is_follower(1, 11)
+False
+>>> amico.accept(11, 1)
+>>> amico.is_pending(1, 11)
+False
+>>> amico.is_pending_with(11, 1)
+False
+>>> amico.is_pending(11, 1)
+False
+>>> amico.is_pending_with(1, 11)
+False
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+True
+>>> amico.is_follower(11, 1)
+True
+>>> amico.is_follower(1, 11)
+True
+>>> amico.is_reciprocated(1, 11)
+True
+>>> amico.follow(1, 12)
+>>> amico.is_following(1, 12)
+False
+>>> amico.is_pending(1, 12)
+True
+>>> amico.deny(1, 12)
+>>> amico.is_following(1, 12)
+False
+>>> amico.is_pending(1, 12)
+False
+```
+
+All of the calls support a `scope` parameter to allow you to scope the calls to express relationships for different types of things. For example:
+
+```python
+>>> amico = Amico(options = {'default_scope_key': 'user'}, redis_connection = redis)
+>>> amico.follow(1, 11)
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(1, 11, scope = 'user')
+True
+>>> amico.following(1)
+['11']
+>>> amico.following(1, scope = 'user')
+['11']
+>>> amico.is_following(1, 11, scope = 'project')
+False
+>>> amico.follow(1, 11, scope = 'project')
+>>> amico.is_following(1, 11, scope = 'project')
+True
+>>> amico.following(1, scope = 'project')
+['11']
+```
+
+You can retrieve all of a particular type of relationship using the `all(id, type, scope)` call. For example:
+
+```python
+>>> amico.follow(1, 11)
+>>> amico.follow(1, 12)
+>>> amico.all(1, 'following')
+['12', '11']
+```
+
+`type` can be one of 'following', 'followers', 'blocked', 'blocked_by', reciprocated', 'pending' and 'pending_with'. Use this with caution as there may potentially be a large number of items that could be returned from this call.
+
+You can clear all relationships that have been set for an ID by calling `clear(id, scope)`. You may wish to do this if you allow records to be deleted and you wish to prevent orphaned IDs and inaccurate follower/following counts. Note that this clears *all* relationships in either direction - including blocked and pending. An example:
+
+```python
+>>> amico.follow(11, 1)
+>>> amico.block(12, 1)
+>>> amico.following(11)
+['1']
+>>> amico.blocked(12)
+['1']
+>>> amico.clear(1)
+>>> amico.following(11)
+[]
+>>> amico.blocked(12)
+[]
+```
+
+## FAQ?
+
+### Why use Redis sorted sets and not Redis sets?
+
+Based on the work I did in developing [leaderboard](https://github.com/agoragames/leaderboard),
+leaderboards backed by Redis, I know I wanted to be able to page through the various relationships.
+This does not seem to be possible given the current set of commands for Redis sets.
+
+Also, by using the "score" in Redis sorted sets that is based on the time of when a relationship
+is established, we can get our "recent friends". It is possible that the scoring function may be
+user-defined in the future to allow for some specific ordering.
+
+## Contributing to amico
+
+* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
+* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
+* Fork the project
+* Start a feature/bugfix branch
+* Commit and push until you are happy with your contribution
+* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
+* Please try not to mess with the version or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
+
+## Copyright
+
+Copyright (c) 2013 David Czarnecki. See LICENSE.txt for further details.
+
+%package -n python3-amico
+Summary: Relationships (e.g. friendships) backed by Redis.
+Provides: python-amico
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-amico
+# amico
+
+Relationships (e.g. friendships) backed by Redis. This is a port of the [amico gem](https://github.com/agoragames/amico).
+
+## Installation
+
+`pip install amico`
+
+Make sure your redis server is running! Redis configuration is outside the scope of this README, but
+check out the [Redis documentation](http://redis.io/documentation).
+
+## Usage
+
+Be sure to import the Amico library:
+
+```python
+from amico import Amico
+```
+
+Amico is configured with a number of defaults:
+
+```python
+>>> Amico.DEFAULTS
+{'namespace': 'amico', 'pending_follow': False, 'reciprocated_key': 'reciprocated', 'followers_key': 'followers', 'pending_with_key': 'pending_with', 'following_key': 'following', 'page_size': 25, 'pending_key': 'pending', 'blocked_by_key': 'blocked_by', 'default_scope_key': 'default', 'blocked_key': 'blocked'}
+```
+
+The initializer for Amico takes two optional parameters:
+
+* `options` : Dictionary of updated defaults
+* `redis_connection` : Connection to Redis
+
+```python
+>>> amico = Amico(redis_connection = redis)
+```
+
+```python
+>>> amico.follow(1, 11)
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+False
+>>> amico.follow(11, 1)
+>>> amico.is_following(11, 1)
+True
+>>> amico.following_count(1)
+1
+>>> amico.followers_count(1)
+1
+>>> amico.unfollow(11, 1)
+>>> amico.following_count(11)
+0
+>>> amico.following_count(1)
+1
+>>> amico.is_follower(1, 11)
+False
+>>> amico.following(1)
+['11']
+>>> amico.block(1, 11)
+>>> amico.is_following(11, 1)
+False
+>>> amico.is_blocked(1, 11)
+True
+>>> amico.is_blocked_by(11, 1)
+True
+>>> amico.unblock(1, 11)
+>>> amico.is_blocked(1, 11)
+False
+>>> amico.is_blocked_by(11, 1)
+False
+>>> amico.follow(11, 1)
+>>> amico.follow(1, 11)
+>>> amico.is_reciprocated(1, 11)
+True
+>>> amico.reciprocated(1)
+['11']
+```
+
+Use amico (with pending relationships for follow):
+
+```python
+>>> amico = Amico(options = {'pending_follow': True}, redis_connection = redis)
+>>> amico.follow(1, 11)
+>>> amico.follow(11, 1)
+>>> amico.is_pending(1, 11)
+True
+>>> amico.is_pending_with(11, 1)
+True
+>>> amico.is_pending(11, 1)
+True
+>>> amico.is_pending_with(1, 11)
+True
+>>> amico.accept(1, 11)
+>>> amico.is_pending(1, 11)
+False
+>>> amico.is_pending_with(11, 1)
+False
+>>> amico.is_pending(11, 1)
+True
+>>> amico.is_pending_with(1, 11)
+True
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+False
+>>> amico.is_follower(11, 1)
+True
+>>> amico.is_follower(1, 11)
+False
+>>> amico.accept(11, 1)
+>>> amico.is_pending(1, 11)
+False
+>>> amico.is_pending_with(11, 1)
+False
+>>> amico.is_pending(11, 1)
+False
+>>> amico.is_pending_with(1, 11)
+False
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+True
+>>> amico.is_follower(11, 1)
+True
+>>> amico.is_follower(1, 11)
+True
+>>> amico.is_reciprocated(1, 11)
+True
+>>> amico.follow(1, 12)
+>>> amico.is_following(1, 12)
+False
+>>> amico.is_pending(1, 12)
+True
+>>> amico.deny(1, 12)
+>>> amico.is_following(1, 12)
+False
+>>> amico.is_pending(1, 12)
+False
+```
+
+All of the calls support a `scope` parameter to allow you to scope the calls to express relationships for different types of things. For example:
+
+```python
+>>> amico = Amico(options = {'default_scope_key': 'user'}, redis_connection = redis)
+>>> amico.follow(1, 11)
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(1, 11, scope = 'user')
+True
+>>> amico.following(1)
+['11']
+>>> amico.following(1, scope = 'user')
+['11']
+>>> amico.is_following(1, 11, scope = 'project')
+False
+>>> amico.follow(1, 11, scope = 'project')
+>>> amico.is_following(1, 11, scope = 'project')
+True
+>>> amico.following(1, scope = 'project')
+['11']
+```
+
+You can retrieve all of a particular type of relationship using the `all(id, type, scope)` call. For example:
+
+```python
+>>> amico.follow(1, 11)
+>>> amico.follow(1, 12)
+>>> amico.all(1, 'following')
+['12', '11']
+```
+
+`type` can be one of 'following', 'followers', 'blocked', 'blocked_by', reciprocated', 'pending' and 'pending_with'. Use this with caution as there may potentially be a large number of items that could be returned from this call.
+
+You can clear all relationships that have been set for an ID by calling `clear(id, scope)`. You may wish to do this if you allow records to be deleted and you wish to prevent orphaned IDs and inaccurate follower/following counts. Note that this clears *all* relationships in either direction - including blocked and pending. An example:
+
+```python
+>>> amico.follow(11, 1)
+>>> amico.block(12, 1)
+>>> amico.following(11)
+['1']
+>>> amico.blocked(12)
+['1']
+>>> amico.clear(1)
+>>> amico.following(11)
+[]
+>>> amico.blocked(12)
+[]
+```
+
+## FAQ?
+
+### Why use Redis sorted sets and not Redis sets?
+
+Based on the work I did in developing [leaderboard](https://github.com/agoragames/leaderboard),
+leaderboards backed by Redis, I know I wanted to be able to page through the various relationships.
+This does not seem to be possible given the current set of commands for Redis sets.
+
+Also, by using the "score" in Redis sorted sets that is based on the time of when a relationship
+is established, we can get our "recent friends". It is possible that the scoring function may be
+user-defined in the future to allow for some specific ordering.
+
+## Contributing to amico
+
+* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
+* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
+* Fork the project
+* Start a feature/bugfix branch
+* Commit and push until you are happy with your contribution
+* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
+* Please try not to mess with the version or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
+
+## Copyright
+
+Copyright (c) 2013 David Czarnecki. See LICENSE.txt for further details.
+
+%package help
+Summary: Development documents and examples for amico
+Provides: python3-amico-doc
+%description help
+# amico
+
+Relationships (e.g. friendships) backed by Redis. This is a port of the [amico gem](https://github.com/agoragames/amico).
+
+## Installation
+
+`pip install amico`
+
+Make sure your redis server is running! Redis configuration is outside the scope of this README, but
+check out the [Redis documentation](http://redis.io/documentation).
+
+## Usage
+
+Be sure to import the Amico library:
+
+```python
+from amico import Amico
+```
+
+Amico is configured with a number of defaults:
+
+```python
+>>> Amico.DEFAULTS
+{'namespace': 'amico', 'pending_follow': False, 'reciprocated_key': 'reciprocated', 'followers_key': 'followers', 'pending_with_key': 'pending_with', 'following_key': 'following', 'page_size': 25, 'pending_key': 'pending', 'blocked_by_key': 'blocked_by', 'default_scope_key': 'default', 'blocked_key': 'blocked'}
+```
+
+The initializer for Amico takes two optional parameters:
+
+* `options` : Dictionary of updated defaults
+* `redis_connection` : Connection to Redis
+
+```python
+>>> amico = Amico(redis_connection = redis)
+```
+
+```python
+>>> amico.follow(1, 11)
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+False
+>>> amico.follow(11, 1)
+>>> amico.is_following(11, 1)
+True
+>>> amico.following_count(1)
+1
+>>> amico.followers_count(1)
+1
+>>> amico.unfollow(11, 1)
+>>> amico.following_count(11)
+0
+>>> amico.following_count(1)
+1
+>>> amico.is_follower(1, 11)
+False
+>>> amico.following(1)
+['11']
+>>> amico.block(1, 11)
+>>> amico.is_following(11, 1)
+False
+>>> amico.is_blocked(1, 11)
+True
+>>> amico.is_blocked_by(11, 1)
+True
+>>> amico.unblock(1, 11)
+>>> amico.is_blocked(1, 11)
+False
+>>> amico.is_blocked_by(11, 1)
+False
+>>> amico.follow(11, 1)
+>>> amico.follow(1, 11)
+>>> amico.is_reciprocated(1, 11)
+True
+>>> amico.reciprocated(1)
+['11']
+```
+
+Use amico (with pending relationships for follow):
+
+```python
+>>> amico = Amico(options = {'pending_follow': True}, redis_connection = redis)
+>>> amico.follow(1, 11)
+>>> amico.follow(11, 1)
+>>> amico.is_pending(1, 11)
+True
+>>> amico.is_pending_with(11, 1)
+True
+>>> amico.is_pending(11, 1)
+True
+>>> amico.is_pending_with(1, 11)
+True
+>>> amico.accept(1, 11)
+>>> amico.is_pending(1, 11)
+False
+>>> amico.is_pending_with(11, 1)
+False
+>>> amico.is_pending(11, 1)
+True
+>>> amico.is_pending_with(1, 11)
+True
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+False
+>>> amico.is_follower(11, 1)
+True
+>>> amico.is_follower(1, 11)
+False
+>>> amico.accept(11, 1)
+>>> amico.is_pending(1, 11)
+False
+>>> amico.is_pending_with(11, 1)
+False
+>>> amico.is_pending(11, 1)
+False
+>>> amico.is_pending_with(1, 11)
+False
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(11, 1)
+True
+>>> amico.is_follower(11, 1)
+True
+>>> amico.is_follower(1, 11)
+True
+>>> amico.is_reciprocated(1, 11)
+True
+>>> amico.follow(1, 12)
+>>> amico.is_following(1, 12)
+False
+>>> amico.is_pending(1, 12)
+True
+>>> amico.deny(1, 12)
+>>> amico.is_following(1, 12)
+False
+>>> amico.is_pending(1, 12)
+False
+```
+
+All of the calls support a `scope` parameter to allow you to scope the calls to express relationships for different types of things. For example:
+
+```python
+>>> amico = Amico(options = {'default_scope_key': 'user'}, redis_connection = redis)
+>>> amico.follow(1, 11)
+>>> amico.is_following(1, 11)
+True
+>>> amico.is_following(1, 11, scope = 'user')
+True
+>>> amico.following(1)
+['11']
+>>> amico.following(1, scope = 'user')
+['11']
+>>> amico.is_following(1, 11, scope = 'project')
+False
+>>> amico.follow(1, 11, scope = 'project')
+>>> amico.is_following(1, 11, scope = 'project')
+True
+>>> amico.following(1, scope = 'project')
+['11']
+```
+
+You can retrieve all of a particular type of relationship using the `all(id, type, scope)` call. For example:
+
+```python
+>>> amico.follow(1, 11)
+>>> amico.follow(1, 12)
+>>> amico.all(1, 'following')
+['12', '11']
+```
+
+`type` can be one of 'following', 'followers', 'blocked', 'blocked_by', reciprocated', 'pending' and 'pending_with'. Use this with caution as there may potentially be a large number of items that could be returned from this call.
+
+You can clear all relationships that have been set for an ID by calling `clear(id, scope)`. You may wish to do this if you allow records to be deleted and you wish to prevent orphaned IDs and inaccurate follower/following counts. Note that this clears *all* relationships in either direction - including blocked and pending. An example:
+
+```python
+>>> amico.follow(11, 1)
+>>> amico.block(12, 1)
+>>> amico.following(11)
+['1']
+>>> amico.blocked(12)
+['1']
+>>> amico.clear(1)
+>>> amico.following(11)
+[]
+>>> amico.blocked(12)
+[]
+```
+
+## FAQ?
+
+### Why use Redis sorted sets and not Redis sets?
+
+Based on the work I did in developing [leaderboard](https://github.com/agoragames/leaderboard),
+leaderboards backed by Redis, I know I wanted to be able to page through the various relationships.
+This does not seem to be possible given the current set of commands for Redis sets.
+
+Also, by using the "score" in Redis sorted sets that is based on the time of when a relationship
+is established, we can get our "recent friends". It is possible that the scoring function may be
+user-defined in the future to allow for some specific ordering.
+
+## Contributing to amico
+
+* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
+* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
+* Fork the project
+* Start a feature/bugfix branch
+* Commit and push until you are happy with your contribution
+* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
+* Please try not to mess with the version or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
+
+## Copyright
+
+Copyright (c) 2013 David Czarnecki. See LICENSE.txt for further details.
+
+%prep
+%autosetup -n amico-1.0.1
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-amico -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Mar 07 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..6d4530f
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+ed201e0e9adb30221ab25801c708f3f8 amico-1.0.1.tar.gz