partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
JqueryMediaMixin.media
Media defined as a dynamic property instead of an inner class.
smart_selects/widgets.py
def media(self): """Media defined as a dynamic property instead of an inner class.""" media = super(JqueryMediaMixin, self).media js = [] if JQUERY_URL: js.append(JQUERY_URL) elif JQUERY_URL is not False: vendor = '' if django.VERSION < (1, 9, 0) else 'v...
def media(self): """Media defined as a dynamic property instead of an inner class.""" media = super(JqueryMediaMixin, self).media js = [] if JQUERY_URL: js.append(JQUERY_URL) elif JQUERY_URL is not False: vendor = '' if django.VERSION < (1, 9, 0) else 'v...
[ "Media", "defined", "as", "a", "dynamic", "property", "instead", "of", "an", "inner", "class", "." ]
digi604/django-smart-selects
python
https://github.com/digi604/django-smart-selects/blob/05dcc4a3de2874499ff3b9a3dfac5c623206e3e5/smart_selects/widgets.py#L29-L52
[ "def", "media", "(", "self", ")", ":", "media", "=", "super", "(", "JqueryMediaMixin", ",", "self", ")", ".", "media", "js", "=", "[", "]", "if", "JQUERY_URL", ":", "js", ".", "append", "(", "JQUERY_URL", ")", "elif", "JQUERY_URL", "is", "not", "Fals...
05dcc4a3de2874499ff3b9a3dfac5c623206e3e5
valid
ChainedSelect.media
Media defined as a dynamic property instead of an inner class.
smart_selects/widgets.py
def media(self): """Media defined as a dynamic property instead of an inner class.""" media = super(ChainedSelect, self).media js = ['smart-selects/admin/js/chainedfk.js', 'smart-selects/admin/js/bindfields.js'] media += Media(js=js) return media
def media(self): """Media defined as a dynamic property instead of an inner class.""" media = super(ChainedSelect, self).media js = ['smart-selects/admin/js/chainedfk.js', 'smart-selects/admin/js/bindfields.js'] media += Media(js=js) return media
[ "Media", "defined", "as", "a", "dynamic", "property", "instead", "of", "an", "inner", "class", "." ]
digi604/django-smart-selects
python
https://github.com/digi604/django-smart-selects/blob/05dcc4a3de2874499ff3b9a3dfac5c623206e3e5/smart_selects/widgets.py#L74-L80
[ "def", "media", "(", "self", ")", ":", "media", "=", "super", "(", "ChainedSelect", ",", "self", ")", ".", "media", "js", "=", "[", "'smart-selects/admin/js/chainedfk.js'", ",", "'smart-selects/admin/js/bindfields.js'", "]", "media", "+=", "Media", "(", "js", ...
05dcc4a3de2874499ff3b9a3dfac5c623206e3e5
valid
ChainedSelect._get_available_choices
get possible choices for selection
smart_selects/widgets.py
def _get_available_choices(self, queryset, value): """ get possible choices for selection """ item = queryset.filter(pk=value).first() if item: try: pk = getattr(item, self.chained_model_field + "_id") filter = {self.chained_model_field...
def _get_available_choices(self, queryset, value): """ get possible choices for selection """ item = queryset.filter(pk=value).first() if item: try: pk = getattr(item, self.chained_model_field + "_id") filter = {self.chained_model_field...
[ "get", "possible", "choices", "for", "selection" ]
digi604/django-smart-selects
python
https://github.com/digi604/django-smart-selects/blob/05dcc4a3de2874499ff3b9a3dfac5c623206e3e5/smart_selects/widgets.py#L157-L183
[ "def", "_get_available_choices", "(", "self", ",", "queryset", ",", "value", ")", ":", "item", "=", "queryset", ".", "filter", "(", "pk", "=", "value", ")", ".", "first", "(", ")", "if", "item", ":", "try", ":", "pk", "=", "getattr", "(", "item", "...
05dcc4a3de2874499ff3b9a3dfac5c623206e3e5
valid
ChainedSelectMultiple.media
Media defined as a dynamic property instead of an inner class.
smart_selects/widgets.py
def media(self): """Media defined as a dynamic property instead of an inner class.""" media = super(ChainedSelectMultiple, self).media js = ['smart-selects/admin/js/chainedm2m.js', 'smart-selects/admin/js/bindfields.js'] if self.horizontal: # For horizontal mode...
def media(self): """Media defined as a dynamic property instead of an inner class.""" media = super(ChainedSelectMultiple, self).media js = ['smart-selects/admin/js/chainedm2m.js', 'smart-selects/admin/js/bindfields.js'] if self.horizontal: # For horizontal mode...
[ "Media", "defined", "as", "a", "dynamic", "property", "instead", "of", "an", "inner", "class", "." ]
digi604/django-smart-selects
python
https://github.com/digi604/django-smart-selects/blob/05dcc4a3de2874499ff3b9a3dfac5c623206e3e5/smart_selects/widgets.py#L204-L215
[ "def", "media", "(", "self", ")", ":", "media", "=", "super", "(", "ChainedSelectMultiple", ",", "self", ")", ".", "media", "js", "=", "[", "'smart-selects/admin/js/chainedm2m.js'", ",", "'smart-selects/admin/js/bindfields.js'", "]", "if", "self", ".", "horizontal...
05dcc4a3de2874499ff3b9a3dfac5c623206e3e5
valid
unicode_sorter
This function implements sort keys for the german language according to DIN 5007.
smart_selects/utils.py
def unicode_sorter(input): """ This function implements sort keys for the german language according to DIN 5007.""" # key1: compare words lowercase and replace umlauts according to DIN 5007 key1 = input.lower() key1 = key1.replace(u"ä", u"a") key1 = key1.replace(u"ö", u"o") key1 = key1.repl...
def unicode_sorter(input): """ This function implements sort keys for the german language according to DIN 5007.""" # key1: compare words lowercase and replace umlauts according to DIN 5007 key1 = input.lower() key1 = key1.replace(u"ä", u"a") key1 = key1.replace(u"ö", u"o") key1 = key1.repl...
[ "This", "function", "implements", "sort", "keys", "for", "the", "german", "language", "according", "to", "DIN", "5007", "." ]
digi604/django-smart-selects
python
https://github.com/digi604/django-smart-selects/blob/05dcc4a3de2874499ff3b9a3dfac5c623206e3e5/smart_selects/utils.py#L9-L26
[ "def", "unicode_sorter", "(", "input", ")", ":", "# key1: compare words lowercase and replace umlauts according to DIN 5007", "key1", "=", "input", ".", "lower", "(", ")", "key1", "=", "key1", ".", "replace", "(", "u\"ä\",", " ", "\"a\")", "", "key1", "=", "key1",...
05dcc4a3de2874499ff3b9a3dfac5c623206e3e5
valid
AlgoliaIndex.get_raw_record
Gets the raw record. If `update_fields` is set, the raw record will be build with only the objectID and the given fields. Also, `_geoloc` and `_tags` will not be included.
algoliasearch_django/models.py
def get_raw_record(self, instance, update_fields=None): """ Gets the raw record. If `update_fields` is set, the raw record will be build with only the objectID and the given fields. Also, `_geoloc` and `_tags` will not be included. """ tmp = {'objectID': self.obj...
def get_raw_record(self, instance, update_fields=None): """ Gets the raw record. If `update_fields` is set, the raw record will be build with only the objectID and the given fields. Also, `_geoloc` and `_tags` will not be included. """ tmp = {'objectID': self.obj...
[ "Gets", "the", "raw", "record", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L197-L238
[ "def", "get_raw_record", "(", "self", ",", "instance", ",", "update_fields", "=", "None", ")", ":", "tmp", "=", "{", "'objectID'", ":", "self", ".", "objectID", "(", "instance", ")", "}", "if", "update_fields", ":", "if", "isinstance", "(", "update_fields"...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaIndex._should_really_index
Return True if according to should_index the object should be indexed.
algoliasearch_django/models.py
def _should_really_index(self, instance): """Return True if according to should_index the object should be indexed.""" if self._should_index_is_method: is_method = inspect.ismethod(self.should_index) try: count_args = len(inspect.signature(self.should_index).param...
def _should_really_index(self, instance): """Return True if according to should_index the object should be indexed.""" if self._should_index_is_method: is_method = inspect.ismethod(self.should_index) try: count_args = len(inspect.signature(self.should_index).param...
[ "Return", "True", "if", "according", "to", "should_index", "the", "object", "should", "be", "indexed", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L251-L282
[ "def", "_should_really_index", "(", "self", ",", "instance", ")", ":", "if", "self", ".", "_should_index_is_method", ":", "is_method", "=", "inspect", ".", "ismethod", "(", "self", ".", "should_index", ")", "try", ":", "count_args", "=", "len", "(", "inspect...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaIndex.save_record
Saves the record. If `update_fields` is set, this method will use partial_update_object() and will update only the given fields (never `_geoloc` and `_tags`). For more information about partial_update_object: https://github.com/algolia/algoliasearch-client-python#update-an-existing-obj...
algoliasearch_django/models.py
def save_record(self, instance, update_fields=None, **kwargs): """Saves the record. If `update_fields` is set, this method will use partial_update_object() and will update only the given fields (never `_geoloc` and `_tags`). For more information about partial_update_object: htt...
def save_record(self, instance, update_fields=None, **kwargs): """Saves the record. If `update_fields` is set, this method will use partial_update_object() and will update only the given fields (never `_geoloc` and `_tags`). For more information about partial_update_object: htt...
[ "Saves", "the", "record", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L284-L315
[ "def", "save_record", "(", "self", ",", "instance", ",", "update_fields", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_should_index", "(", "instance", ")", ":", "# Should not index, but since we don't now the state of the", "# instan...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaIndex.delete_record
Deletes the record.
algoliasearch_django/models.py
def delete_record(self, instance): """Deletes the record.""" objectID = self.objectID(instance) try: self.__index.delete_object(objectID) logger.info('DELETE %s FROM %s', objectID, self.model) except AlgoliaException as e: if DEBUG: rai...
def delete_record(self, instance): """Deletes the record.""" objectID = self.objectID(instance) try: self.__index.delete_object(objectID) logger.info('DELETE %s FROM %s', objectID, self.model) except AlgoliaException as e: if DEBUG: rai...
[ "Deletes", "the", "record", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L317-L328
[ "def", "delete_record", "(", "self", ",", "instance", ")", ":", "objectID", "=", "self", ".", "objectID", "(", "instance", ")", "try", ":", "self", ".", "__index", ".", "delete_object", "(", "objectID", ")", "logger", ".", "info", "(", "'DELETE %s FROM %s'...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaIndex.update_records
Updates multiple records. This method is optimized for speed. It takes a QuerySet and the same arguments as QuerySet.update(). Optionnaly, you can specify the size of the batch send to Algolia with batch_size (default to 1000). >>> from algoliasearch_django import update_records ...
algoliasearch_django/models.py
def update_records(self, qs, batch_size=1000, **kwargs): """ Updates multiple records. This method is optimized for speed. It takes a QuerySet and the same arguments as QuerySet.update(). Optionnaly, you can specify the size of the batch send to Algolia with batch_size (default ...
def update_records(self, qs, batch_size=1000, **kwargs): """ Updates multiple records. This method is optimized for speed. It takes a QuerySet and the same arguments as QuerySet.update(). Optionnaly, you can specify the size of the batch send to Algolia with batch_size (default ...
[ "Updates", "multiple", "records", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L330-L361
[ "def", "update_records", "(", "self", ",", "qs", ",", "batch_size", "=", "1000", ",", "*", "*", "kwargs", ")", ":", "tmp", "=", "{", "}", "for", "key", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "name", "=", "self", ".", "__transl...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaIndex.raw_search
Performs a search query and returns the parsed JSON.
algoliasearch_django/models.py
def raw_search(self, query='', params=None): """Performs a search query and returns the parsed JSON.""" if params is None: params = {} try: return self.__index.search(query, params) except AlgoliaException as e: if DEBUG: raise e ...
def raw_search(self, query='', params=None): """Performs a search query and returns the parsed JSON.""" if params is None: params = {} try: return self.__index.search(query, params) except AlgoliaException as e: if DEBUG: raise e ...
[ "Performs", "a", "search", "query", "and", "returns", "the", "parsed", "JSON", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L363-L374
[ "def", "raw_search", "(", "self", ",", "query", "=", "''", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "try", ":", "return", "self", ".", "__index", ".", "search", "(", "query", ",", "params", ...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaIndex.get_settings
Returns the settings of the index.
algoliasearch_django/models.py
def get_settings(self): """Returns the settings of the index.""" try: logger.info('GET SETTINGS ON %s', self.index_name) return self.__index.get_settings() except AlgoliaException as e: if DEBUG: raise e else: logger...
def get_settings(self): """Returns the settings of the index.""" try: logger.info('GET SETTINGS ON %s', self.index_name) return self.__index.get_settings() except AlgoliaException as e: if DEBUG: raise e else: logger...
[ "Returns", "the", "settings", "of", "the", "index", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L376-L386
[ "def", "get_settings", "(", "self", ")", ":", "try", ":", "logger", ".", "info", "(", "'GET SETTINGS ON %s'", ",", "self", ".", "index_name", ")", "return", "self", ".", "__index", ".", "get_settings", "(", ")", "except", "AlgoliaException", "as", "e", ":"...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaIndex.set_settings
Applies the settings to the index.
algoliasearch_django/models.py
def set_settings(self): """Applies the settings to the index.""" if not self.settings: return try: self.__index.set_settings(self.settings) logger.info('APPLY SETTINGS ON %s', self.index_name) except AlgoliaException as e: if DEBUG: ...
def set_settings(self): """Applies the settings to the index.""" if not self.settings: return try: self.__index.set_settings(self.settings) logger.info('APPLY SETTINGS ON %s', self.index_name) except AlgoliaException as e: if DEBUG: ...
[ "Applies", "the", "settings", "to", "the", "index", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L388-L401
[ "def", "set_settings", "(", "self", ")", ":", "if", "not", "self", ".", "settings", ":", "return", "try", ":", "self", ".", "__index", ".", "set_settings", "(", "self", ".", "settings", ")", "logger", ".", "info", "(", "'APPLY SETTINGS ON %s'", ",", "sel...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaIndex.reindex_all
Reindex all the records. By default, this method use Model.objects.all() but you can implement a method `get_queryset` in your subclass. This can be used to optimize the performance (for example with select_related or prefetch_related).
algoliasearch_django/models.py
def reindex_all(self, batch_size=1000): """ Reindex all the records. By default, this method use Model.objects.all() but you can implement a method `get_queryset` in your subclass. This can be used to optimize the performance (for example with select_related or prefetch_related)...
def reindex_all(self, batch_size=1000): """ Reindex all the records. By default, this method use Model.objects.all() but you can implement a method `get_queryset` in your subclass. This can be used to optimize the performance (for example with select_related or prefetch_related)...
[ "Reindex", "all", "the", "records", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/models.py#L424-L530
[ "def", "reindex_all", "(", "self", ",", "batch_size", "=", "1000", ")", ":", "should_keep_synonyms", "=", "False", "should_keep_rules", "=", "False", "try", ":", "if", "not", "self", ".", "settings", ":", "self", ".", "settings", "=", "self", ".", "get_set...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
register
Register the given model class and wrapped AlgoliaIndex class with the Algolia engine: @register(Author) class AuthorIndex(AlgoliaIndex): pass
algoliasearch_django/decorators.py
def register(model): """ Register the given model class and wrapped AlgoliaIndex class with the Algolia engine: @register(Author) class AuthorIndex(AlgoliaIndex): pass """ from algoliasearch_django import AlgoliaIndex, register def _algolia_engine_wrapper(index_class): if ...
def register(model): """ Register the given model class and wrapped AlgoliaIndex class with the Algolia engine: @register(Author) class AuthorIndex(AlgoliaIndex): pass """ from algoliasearch_django import AlgoliaIndex, register def _algolia_engine_wrapper(index_class): if ...
[ "Register", "the", "given", "model", "class", "and", "wrapped", "AlgoliaIndex", "class", "with", "the", "Algolia", "engine", ":" ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/decorators.py#L37-L55
[ "def", "register", "(", "model", ")", ":", "from", "algoliasearch_django", "import", "AlgoliaIndex", ",", "register", "def", "_algolia_engine_wrapper", "(", "index_class", ")", ":", "if", "not", "issubclass", "(", "index_class", ",", "AlgoliaIndex", ")", ":", "r...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
Command.handle
Run the management command.
algoliasearch_django/management/commands/algolia_applysettings.py
def handle(self, *args, **options): """Run the management command.""" self.stdout.write('Apply settings to index:') for model in get_registered_model(): if options.get('model', None) and not (model.__name__ in options['model']): ...
def handle(self, *args, **options): """Run the management command.""" self.stdout.write('Apply settings to index:') for model in get_registered_model(): if options.get('model', None) and not (model.__name__ in options['model']): ...
[ "Run", "the", "management", "command", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/management/commands/algolia_applysettings.py#L13-L22
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "self", ".", "stdout", ".", "write", "(", "'Apply settings to index:'", ")", "for", "model", "in", "get_registered_model", "(", ")", ":", "if", "options", ".", "get", "...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.register
Registers the given model with Algolia engine. If the given model is already registered with Algolia engine, a RegistrationError will be raised.
algoliasearch_django/registration.py
def register(self, model, index_cls=AlgoliaIndex, auto_indexing=None): """ Registers the given model with Algolia engine. If the given model is already registered with Algolia engine, a RegistrationError will be raised. """ # Check for existing registration. if s...
def register(self, model, index_cls=AlgoliaIndex, auto_indexing=None): """ Registers the given model with Algolia engine. If the given model is already registered with Algolia engine, a RegistrationError will be raised. """ # Check for existing registration. if s...
[ "Registers", "the", "given", "model", "with", "Algolia", "engine", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L50-L74
[ "def", "register", "(", "self", ",", "model", ",", "index_cls", "=", "AlgoliaIndex", ",", "auto_indexing", "=", "None", ")", ":", "# Check for existing registration.", "if", "self", ".", "is_registered", "(", "model", ")", ":", "raise", "RegistrationError", "(",...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.unregister
Unregisters the given model with Algolia engine. If the given model is not registered with Algolia engine, a RegistrationError will be raised.
algoliasearch_django/registration.py
def unregister(self, model): """ Unregisters the given model with Algolia engine. If the given model is not registered with Algolia engine, a RegistrationError will be raised. """ if not self.is_registered(model): raise RegistrationError( '{} ...
def unregister(self, model): """ Unregisters the given model with Algolia engine. If the given model is not registered with Algolia engine, a RegistrationError will be raised. """ if not self.is_registered(model): raise RegistrationError( '{} ...
[ "Unregisters", "the", "given", "model", "with", "Algolia", "engine", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L76-L92
[ "def", "unregister", "(", "self", ",", "model", ")", ":", "if", "not", "self", ".", "is_registered", "(", "model", ")", ":", "raise", "RegistrationError", "(", "'{} is not registered with Algolia engine'", ".", "format", "(", "model", ")", ")", "# Perform the un...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.get_adapter
Returns the adapter associated with the given model.
algoliasearch_django/registration.py
def get_adapter(self, model): """Returns the adapter associated with the given model.""" if not self.is_registered(model): raise RegistrationError( '{} is not registered with Algolia engine'.format(model)) return self.__registered_models[model]
def get_adapter(self, model): """Returns the adapter associated with the given model.""" if not self.is_registered(model): raise RegistrationError( '{} is not registered with Algolia engine'.format(model)) return self.__registered_models[model]
[ "Returns", "the", "adapter", "associated", "with", "the", "given", "model", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L101-L107
[ "def", "get_adapter", "(", "self", ",", "model", ")", ":", "if", "not", "self", ".", "is_registered", "(", "model", ")", ":", "raise", "RegistrationError", "(", "'{} is not registered with Algolia engine'", ".", "format", "(", "model", ")", ")", "return", "sel...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.save_record
Saves the record. If `update_fields` is set, this method will use partial_update_object() and will update only the given fields (never `_geoloc` and `_tags`). For more information about partial_update_object: https://github.com/algolia/algoliasearch-client-python#update-an-existing-obj...
algoliasearch_django/registration.py
def save_record(self, instance, **kwargs): """Saves the record. If `update_fields` is set, this method will use partial_update_object() and will update only the given fields (never `_geoloc` and `_tags`). For more information about partial_update_object: https://github.com/algo...
def save_record(self, instance, **kwargs): """Saves the record. If `update_fields` is set, this method will use partial_update_object() and will update only the given fields (never `_geoloc` and `_tags`). For more information about partial_update_object: https://github.com/algo...
[ "Saves", "the", "record", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L116-L126
[ "def", "save_record", "(", "self", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "adapter", "=", "self", ".", "get_adapter_from_instance", "(", "instance", ")", "adapter", ".", "save_record", "(", "instance", ",", "*", "*", "kwargs", ")" ]
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.delete_record
Deletes the record.
algoliasearch_django/registration.py
def delete_record(self, instance): """Deletes the record.""" adapter = self.get_adapter_from_instance(instance) adapter.delete_record(instance)
def delete_record(self, instance): """Deletes the record.""" adapter = self.get_adapter_from_instance(instance) adapter.delete_record(instance)
[ "Deletes", "the", "record", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L128-L131
[ "def", "delete_record", "(", "self", ",", "instance", ")", ":", "adapter", "=", "self", ".", "get_adapter_from_instance", "(", "instance", ")", "adapter", ".", "delete_record", "(", "instance", ")" ]
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.update_records
Updates multiple records. This method is optimized for speed. It takes a QuerySet and the same arguments as QuerySet.update(). Optionally, you can specify the size of the batch send to Algolia with batch_size (default to 1000). >>> from algoliasearch_django import update_records ...
algoliasearch_django/registration.py
def update_records(self, model, qs, batch_size=1000, **kwargs): """ Updates multiple records. This method is optimized for speed. It takes a QuerySet and the same arguments as QuerySet.update(). Optionally, you can specify the size of the batch send to Algolia with batch_size (d...
def update_records(self, model, qs, batch_size=1000, **kwargs): """ Updates multiple records. This method is optimized for speed. It takes a QuerySet and the same arguments as QuerySet.update(). Optionally, you can specify the size of the batch send to Algolia with batch_size (d...
[ "Updates", "multiple", "records", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L133-L147
[ "def", "update_records", "(", "self", ",", "model", ",", "qs", ",", "batch_size", "=", "1000", ",", "*", "*", "kwargs", ")", ":", "adapter", "=", "self", ".", "get_adapter", "(", "model", ")", "adapter", ".", "update_records", "(", "qs", ",", "batch_si...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.raw_search
Performs a search query and returns the parsed JSON.
algoliasearch_django/registration.py
def raw_search(self, model, query='', params=None): """Performs a search query and returns the parsed JSON.""" if params is None: params = {} adapter = self.get_adapter(model) return adapter.raw_search(query, params)
def raw_search(self, model, query='', params=None): """Performs a search query and returns the parsed JSON.""" if params is None: params = {} adapter = self.get_adapter(model) return adapter.raw_search(query, params)
[ "Performs", "a", "search", "query", "and", "returns", "the", "parsed", "JSON", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L149-L155
[ "def", "raw_search", "(", "self", ",", "model", ",", "query", "=", "''", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "adapter", "=", "self", ".", "get_adapter", "(", "model", ")", "return", "ada...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.reindex_all
Reindex all the records. By default, this method use Model.objects.all() but you can implement a method `get_queryset` in your subclass. This can be used to optimize the performance (for example with select_related or prefetch_related).
algoliasearch_django/registration.py
def reindex_all(self, model, batch_size=1000): """ Reindex all the records. By default, this method use Model.objects.all() but you can implement a method `get_queryset` in your subclass. This can be used to optimize the performance (for example with select_related or prefetch_r...
def reindex_all(self, model, batch_size=1000): """ Reindex all the records. By default, this method use Model.objects.all() but you can implement a method `get_queryset` in your subclass. This can be used to optimize the performance (for example with select_related or prefetch_r...
[ "Reindex", "all", "the", "records", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L162-L171
[ "def", "reindex_all", "(", "self", ",", "model", ",", "batch_size", "=", "1000", ")", ":", "adapter", "=", "self", ".", "get_adapter", "(", "model", ")", "return", "adapter", ".", "reindex_all", "(", "batch_size", ")" ]
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.__post_save_receiver
Signal handler for when a registered model has been saved.
algoliasearch_django/registration.py
def __post_save_receiver(self, instance, **kwargs): """Signal handler for when a registered model has been saved.""" logger.debug('RECEIVE post_save FOR %s', instance.__class__) self.save_record(instance, **kwargs)
def __post_save_receiver(self, instance, **kwargs): """Signal handler for when a registered model has been saved.""" logger.debug('RECEIVE post_save FOR %s', instance.__class__) self.save_record(instance, **kwargs)
[ "Signal", "handler", "for", "when", "a", "registered", "model", "has", "been", "saved", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L181-L184
[ "def", "__post_save_receiver", "(", "self", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "debug", "(", "'RECEIVE post_save FOR %s'", ",", "instance", ".", "__class__", ")", "self", ".", "save_record", "(", "instance", ",", "*", "*", "...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
AlgoliaEngine.__pre_delete_receiver
Signal handler for when a registered model has been deleted.
algoliasearch_django/registration.py
def __pre_delete_receiver(self, instance, **kwargs): """Signal handler for when a registered model has been deleted.""" logger.debug('RECEIVE pre_delete FOR %s', instance.__class__) self.delete_record(instance)
def __pre_delete_receiver(self, instance, **kwargs): """Signal handler for when a registered model has been deleted.""" logger.debug('RECEIVE pre_delete FOR %s', instance.__class__) self.delete_record(instance)
[ "Signal", "handler", "for", "when", "a", "registered", "model", "has", "been", "deleted", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/registration.py#L186-L189
[ "def", "__pre_delete_receiver", "(", "self", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "debug", "(", "'RECEIVE pre_delete FOR %s'", ",", "instance", ".", "__class__", ")", "self", ".", "delete_record", "(", "instance", ")" ]
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
Command.handle
Run the management command.
algoliasearch_django/management/commands/algolia_reindex.py
def handle(self, *args, **options): """Run the management command.""" batch_size = options.get('batchsize', None) if not batch_size: # py34-django18: batchsize is set to None if the user don't set # the value, instead of not be present in the dict batch_size =...
def handle(self, *args, **options): """Run the management command.""" batch_size = options.get('batchsize', None) if not batch_size: # py34-django18: batchsize is set to None if the user don't set # the value, instead of not be present in the dict batch_size =...
[ "Run", "the", "management", "command", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/management/commands/algolia_reindex.py#L14-L29
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "batch_size", "=", "options", ".", "get", "(", "'batchsize'", ",", "None", ")", "if", "not", "batch_size", ":", "# py34-django18: batchsize is set to None if the user don't set",...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
Command.handle
Run the management command.
algoliasearch_django/management/commands/algolia_clearindex.py
def handle(self, *args, **options): """Run the management command.""" self.stdout.write('Clear index:') for model in get_registered_model(): if options.get('model', None) and not (model.__name__ in options['model']): ...
def handle(self, *args, **options): """Run the management command.""" self.stdout.write('Clear index:') for model in get_registered_model(): if options.get('model', None) and not (model.__name__ in options['model']): ...
[ "Run", "the", "management", "command", "." ]
algolia/algoliasearch-django
python
https://github.com/algolia/algoliasearch-django/blob/ca219db41eb56bdd1c0389cdc1508a41698958d7/algoliasearch_django/management/commands/algolia_clearindex.py#L13-L22
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "self", ".", "stdout", ".", "write", "(", "'Clear index:'", ")", "for", "model", "in", "get_registered_model", "(", ")", ":", "if", "options", ".", "get", "(", "'mode...
ca219db41eb56bdd1c0389cdc1508a41698958d7
valid
decode_exactly
Decode the geohash to its exact values, including the error margins of the result. Returns four float values: latitude, longitude, the plus/minus error for latitude (as a positive number) and the plus/minus error for longitude (as a positive number).
Geohash/geohash.py
def decode_exactly(geohash): """ Decode the geohash to its exact values, including the error margins of the result. Returns four float values: latitude, longitude, the plus/minus error for latitude (as a positive number) and the plus/minus error for longitude (as a positive number). """ ...
def decode_exactly(geohash): """ Decode the geohash to its exact values, including the error margins of the result. Returns four float values: latitude, longitude, the plus/minus error for latitude (as a positive number) and the plus/minus error for longitude (as a positive number). """ ...
[ "Decode", "the", "geohash", "to", "its", "exact", "values", "including", "the", "error", "margins", "of", "the", "result", ".", "Returns", "four", "float", "values", ":", "latitude", "longitude", "the", "plus", "/", "minus", "error", "for", "latitude", "(", ...
vinsci/geohash
python
https://github.com/vinsci/geohash/blob/f31e613e1d2cf97c5e99e78dc2a88383c919b2f0/Geohash/geohash.py#L32-L61
[ "def", "decode_exactly", "(", "geohash", ")", ":", "lat_interval", ",", "lon_interval", "=", "(", "-", "90.0", ",", "90.0", ")", ",", "(", "-", "180.0", ",", "180.0", ")", "lat_err", ",", "lon_err", "=", "90.0", ",", "180.0", "is_even", "=", "True", ...
f31e613e1d2cf97c5e99e78dc2a88383c919b2f0
valid
decode
Decode geohash, returning two strings with latitude and longitude containing only relevant digits and with trailing zeroes removed.
Geohash/geohash.py
def decode(geohash): """ Decode geohash, returning two strings with latitude and longitude containing only relevant digits and with trailing zeroes removed. """ lat, lon, lat_err, lon_err = decode_exactly(geohash) # Format to the number of decimals that are known lats = "%.*f" % (max(1, int(...
def decode(geohash): """ Decode geohash, returning two strings with latitude and longitude containing only relevant digits and with trailing zeroes removed. """ lat, lon, lat_err, lon_err = decode_exactly(geohash) # Format to the number of decimals that are known lats = "%.*f" % (max(1, int(...
[ "Decode", "geohash", "returning", "two", "strings", "with", "latitude", "and", "longitude", "containing", "only", "relevant", "digits", "and", "with", "trailing", "zeroes", "removed", "." ]
vinsci/geohash
python
https://github.com/vinsci/geohash/blob/f31e613e1d2cf97c5e99e78dc2a88383c919b2f0/Geohash/geohash.py#L63-L74
[ "def", "decode", "(", "geohash", ")", ":", "lat", ",", "lon", ",", "lat_err", ",", "lon_err", "=", "decode_exactly", "(", "geohash", ")", "# Format to the number of decimals that are known", "lats", "=", "\"%.*f\"", "%", "(", "max", "(", "1", ",", "int", "("...
f31e613e1d2cf97c5e99e78dc2a88383c919b2f0
valid
encode
Encode a position given in float arguments latitude, longitude to a geohash which will have the character count precision.
Geohash/geohash.py
def encode(latitude, longitude, precision=12): """ Encode a position given in float arguments latitude, longitude to a geohash which will have the character count precision. """ lat_interval, lon_interval = (-90.0, 90.0), (-180.0, 180.0) geohash = [] bits = [ 16, 8, 4, 2, 1 ] bit = 0 ...
def encode(latitude, longitude, precision=12): """ Encode a position given in float arguments latitude, longitude to a geohash which will have the character count precision. """ lat_interval, lon_interval = (-90.0, 90.0), (-180.0, 180.0) geohash = [] bits = [ 16, 8, 4, 2, 1 ] bit = 0 ...
[ "Encode", "a", "position", "given", "in", "float", "arguments", "latitude", "longitude", "to", "a", "geohash", "which", "will", "have", "the", "character", "count", "precision", "." ]
vinsci/geohash
python
https://github.com/vinsci/geohash/blob/f31e613e1d2cf97c5e99e78dc2a88383c919b2f0/Geohash/geohash.py#L76-L109
[ "def", "encode", "(", "latitude", ",", "longitude", ",", "precision", "=", "12", ")", ":", "lat_interval", ",", "lon_interval", "=", "(", "-", "90.0", ",", "90.0", ")", ",", "(", "-", "180.0", ",", "180.0", ")", "geohash", "=", "[", "]", "bits", "=...
f31e613e1d2cf97c5e99e78dc2a88383c919b2f0
valid
pad_to
Pad a string to the target length in characters, or return the original string if it's longer than the target length.
csvtomd/csvtomd.py
def pad_to(unpadded, target_len): """ Pad a string to the target length in characters, or return the original string if it's longer than the target length. """ under = target_len - len(unpadded) if under <= 0: return unpadded return unpadded + (' ' * under)
def pad_to(unpadded, target_len): """ Pad a string to the target length in characters, or return the original string if it's longer than the target length. """ under = target_len - len(unpadded) if under <= 0: return unpadded return unpadded + (' ' * under)
[ "Pad", "a", "string", "to", "the", "target", "length", "in", "characters", "or", "return", "the", "original", "string", "if", "it", "s", "longer", "than", "the", "target", "length", "." ]
mplewis/csvtomd
python
https://github.com/mplewis/csvtomd/blob/1a23a5b37a973a1dc69ad4c69e81edea5d096ac9/csvtomd/csvtomd.py#L31-L39
[ "def", "pad_to", "(", "unpadded", ",", "target_len", ")", ":", "under", "=", "target_len", "-", "len", "(", "unpadded", ")", "if", "under", "<=", "0", ":", "return", "unpadded", "return", "unpadded", "+", "(", "' '", "*", "under", ")" ]
1a23a5b37a973a1dc69ad4c69e81edea5d096ac9
valid
normalize_cols
Pad short rows to the length of the longest row to help render "jagged" CSV files
csvtomd/csvtomd.py
def normalize_cols(table): """ Pad short rows to the length of the longest row to help render "jagged" CSV files """ longest_row_len = max([len(row) for row in table]) for row in table: while len(row) < longest_row_len: row.append('') return table
def normalize_cols(table): """ Pad short rows to the length of the longest row to help render "jagged" CSV files """ longest_row_len = max([len(row) for row in table]) for row in table: while len(row) < longest_row_len: row.append('') return table
[ "Pad", "short", "rows", "to", "the", "length", "of", "the", "longest", "row", "to", "help", "render", "jagged", "CSV", "files" ]
mplewis/csvtomd
python
https://github.com/mplewis/csvtomd/blob/1a23a5b37a973a1dc69ad4c69e81edea5d096ac9/csvtomd/csvtomd.py#L42-L51
[ "def", "normalize_cols", "(", "table", ")", ":", "longest_row_len", "=", "max", "(", "[", "len", "(", "row", ")", "for", "row", "in", "table", "]", ")", "for", "row", "in", "table", ":", "while", "len", "(", "row", ")", "<", "longest_row_len", ":", ...
1a23a5b37a973a1dc69ad4c69e81edea5d096ac9
valid
pad_cells
Pad each cell to the size of the largest cell in its column.
csvtomd/csvtomd.py
def pad_cells(table): """Pad each cell to the size of the largest cell in its column.""" col_sizes = [max(map(len, col)) for col in zip(*table)] for row in table: for cell_num, cell in enumerate(row): row[cell_num] = pad_to(cell, col_sizes[cell_num]) return table
def pad_cells(table): """Pad each cell to the size of the largest cell in its column.""" col_sizes = [max(map(len, col)) for col in zip(*table)] for row in table: for cell_num, cell in enumerate(row): row[cell_num] = pad_to(cell, col_sizes[cell_num]) return table
[ "Pad", "each", "cell", "to", "the", "size", "of", "the", "largest", "cell", "in", "its", "column", "." ]
mplewis/csvtomd
python
https://github.com/mplewis/csvtomd/blob/1a23a5b37a973a1dc69ad4c69e81edea5d096ac9/csvtomd/csvtomd.py#L54-L60
[ "def", "pad_cells", "(", "table", ")", ":", "col_sizes", "=", "[", "max", "(", "map", "(", "len", ",", "col", ")", ")", "for", "col", "in", "zip", "(", "*", "table", ")", "]", "for", "row", "in", "table", ":", "for", "cell_num", ",", "cell", "i...
1a23a5b37a973a1dc69ad4c69e81edea5d096ac9
valid
horiz_div
Create the column dividers for a table with given column widths. col_widths: list of column widths horiz: the character to use for a horizontal divider vert: the character to use for a vertical divider padding: amount of padding to add to each side of a column
csvtomd/csvtomd.py
def horiz_div(col_widths, horiz, vert, padding): """ Create the column dividers for a table with given column widths. col_widths: list of column widths horiz: the character to use for a horizontal divider vert: the character to use for a vertical divider padding: amount of padding to add to eac...
def horiz_div(col_widths, horiz, vert, padding): """ Create the column dividers for a table with given column widths. col_widths: list of column widths horiz: the character to use for a horizontal divider vert: the character to use for a vertical divider padding: amount of padding to add to eac...
[ "Create", "the", "column", "dividers", "for", "a", "table", "with", "given", "column", "widths", "." ]
mplewis/csvtomd
python
https://github.com/mplewis/csvtomd/blob/1a23a5b37a973a1dc69ad4c69e81edea5d096ac9/csvtomd/csvtomd.py#L63-L74
[ "def", "horiz_div", "(", "col_widths", ",", "horiz", ",", "vert", ",", "padding", ")", ":", "horizs", "=", "[", "horiz", "*", "w", "for", "w", "in", "col_widths", "]", "div", "=", "''", ".", "join", "(", "[", "padding", "*", "horiz", ",", "vert", ...
1a23a5b37a973a1dc69ad4c69e81edea5d096ac9
valid
add_dividers
Add dividers and padding to a row of cells and return a string.
csvtomd/csvtomd.py
def add_dividers(row, divider, padding): """Add dividers and padding to a row of cells and return a string.""" div = ''.join([padding * ' ', divider, padding * ' ']) return div.join(row)
def add_dividers(row, divider, padding): """Add dividers and padding to a row of cells and return a string.""" div = ''.join([padding * ' ', divider, padding * ' ']) return div.join(row)
[ "Add", "dividers", "and", "padding", "to", "a", "row", "of", "cells", "and", "return", "a", "string", "." ]
mplewis/csvtomd
python
https://github.com/mplewis/csvtomd/blob/1a23a5b37a973a1dc69ad4c69e81edea5d096ac9/csvtomd/csvtomd.py#L77-L80
[ "def", "add_dividers", "(", "row", ",", "divider", ",", "padding", ")", ":", "div", "=", "''", ".", "join", "(", "[", "padding", "*", "' '", ",", "divider", ",", "padding", "*", "' '", "]", ")", "return", "div", ".", "join", "(", "row", ")" ]
1a23a5b37a973a1dc69ad4c69e81edea5d096ac9
valid
md_table
Convert a 2D array of items into a Markdown table. padding: the number of padding spaces on either side of each divider divider: the vertical divider to place between columns header_div: the horizontal divider to place between the header row and body cells
csvtomd/csvtomd.py
def md_table(table, *, padding=DEFAULT_PADDING, divider='|', header_div='-'): """ Convert a 2D array of items into a Markdown table. padding: the number of padding spaces on either side of each divider divider: the vertical divider to place between columns header_div: the horizontal divider to plac...
def md_table(table, *, padding=DEFAULT_PADDING, divider='|', header_div='-'): """ Convert a 2D array of items into a Markdown table. padding: the number of padding spaces on either side of each divider divider: the vertical divider to place between columns header_div: the horizontal divider to plac...
[ "Convert", "a", "2D", "array", "of", "items", "into", "a", "Markdown", "table", "." ]
mplewis/csvtomd
python
https://github.com/mplewis/csvtomd/blob/1a23a5b37a973a1dc69ad4c69e81edea5d096ac9/csvtomd/csvtomd.py#L83-L106
[ "def", "md_table", "(", "table", ",", "*", ",", "padding", "=", "DEFAULT_PADDING", ",", "divider", "=", "'|'", ",", "header_div", "=", "'-'", ")", ":", "table", "=", "normalize_cols", "(", "table", ")", "table", "=", "pad_cells", "(", "table", ")", "he...
1a23a5b37a973a1dc69ad4c69e81edea5d096ac9
valid
baseId
Calculate base id and version from a resource id. :params resource_id: Resource id. :params return_version: (optional) True if You need version, returns (resource_id, version).
fut/core.py
def baseId(resource_id, return_version=False): """Calculate base id and version from a resource id. :params resource_id: Resource id. :params return_version: (optional) True if You need version, returns (resource_id, version). """ version = 0 resource_id = resource_id + 0xC4000000 # 3288334336...
def baseId(resource_id, return_version=False): """Calculate base id and version from a resource id. :params resource_id: Resource id. :params return_version: (optional) True if You need version, returns (resource_id, version). """ version = 0 resource_id = resource_id + 0xC4000000 # 3288334336...
[ "Calculate", "base", "id", "and", "version", "from", "a", "resource", "id", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L52-L74
[ "def", "baseId", "(", "resource_id", ",", "return_version", "=", "False", ")", ":", "version", "=", "0", "resource_id", "=", "resource_id", "+", "0xC4000000", "# 3288334336", "# TODO: version is broken due ^^, needs refactoring", "while", "resource_id", ">", "0x01000000...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
itemParse
Parser for item data. Returns nice dictionary. :params item_data: Item data received from ea servers. :params full: (optional) False if you're sniping and don't need extended info. Anyone really use this?
fut/core.py
def itemParse(item_data, full=True): """Parser for item data. Returns nice dictionary. :params item_data: Item data received from ea servers. :params full: (optional) False if you're sniping and don't need extended info. Anyone really use this? """ # TODO: object # TODO: dynamically parse all d...
def itemParse(item_data, full=True): """Parser for item data. Returns nice dictionary. :params item_data: Item data received from ea servers. :params full: (optional) False if you're sniping and don't need extended info. Anyone really use this? """ # TODO: object # TODO: dynamically parse all d...
[ "Parser", "for", "item", "data", ".", "Returns", "nice", "dictionary", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L77-L176
[ "def", "itemParse", "(", "item_data", ",", "full", "=", "True", ")", ":", "# TODO: object", "# TODO: dynamically parse all data", "# TODO: make it less ugly", "# ItemRareType={NONE:0,RARE:1,LOCK:2,TOTW:3,PURPLE:4,TOTY:5,RB:6,GREEN:7,ORANGE:8,PINK:9,TEAL:10,TOTS:11,LEGEND:12,WC:13,UNICEF:14...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
nations
Return all nations in dict {id0: nation0, id1: nation1}. :params year: Year.
fut/core.py
def nations(timeout=timeout): """Return all nations in dict {id0: nation0, id1: nation1}. :params year: Year. """ rc = requests.get(messages_url, timeout=timeout) rc.encoding = 'utf-8' # guessing takes huge amount of cpu time rc = rc.text data = re.findall('"search.nationName.nation([0-9]+...
def nations(timeout=timeout): """Return all nations in dict {id0: nation0, id1: nation1}. :params year: Year. """ rc = requests.get(messages_url, timeout=timeout) rc.encoding = 'utf-8' # guessing takes huge amount of cpu time rc = rc.text data = re.findall('"search.nationName.nation([0-9]+...
[ "Return", "all", "nations", "in", "dict", "{", "id0", ":", "nation0", "id1", ":", "nation1", "}", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L189-L201
[ "def", "nations", "(", "timeout", "=", "timeout", ")", ":", "rc", "=", "requests", ".", "get", "(", "messages_url", ",", "timeout", "=", "timeout", ")", "rc", ".", "encoding", "=", "'utf-8'", "# guessing takes huge amount of cpu time", "rc", "=", "rc", ".", ...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
players
Return all players in dict {id: c, f, l, n, r}. id, rank, nationality(?), first name, last name.
fut/core.py
def players(timeout=timeout): """Return all players in dict {id: c, f, l, n, r}. id, rank, nationality(?), first name, last name. """ rc = requests.get('{0}{1}.json'.format(card_info_url, 'players'), timeout=timeout).json() players = {} for i in rc['Players'] + rc['LegendsPlayers']: play...
def players(timeout=timeout): """Return all players in dict {id: c, f, l, n, r}. id, rank, nationality(?), first name, last name. """ rc = requests.get('{0}{1}.json'.format(card_info_url, 'players'), timeout=timeout).json() players = {} for i in rc['Players'] + rc['LegendsPlayers']: play...
[ "Return", "all", "players", "in", "dict", "{", "id", ":", "c", "f", "l", "n", "r", "}", ".", "id", "rank", "nationality", "(", "?", ")", "first", "name", "last", "name", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L261-L273
[ "def", "players", "(", "timeout", "=", "timeout", ")", ":", "rc", "=", "requests", ".", "get", "(", "'{0}{1}.json'", ".", "format", "(", "card_info_url", ",", "'players'", ")", ",", "timeout", "=", "timeout", ")", ".", "json", "(", ")", "players", "=",...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
playstyles
Return all playstyles in dict {id0: playstyle0, id1: playstyle1}. :params year: Year.
fut/core.py
def playstyles(year=2019, timeout=timeout): """Return all playstyles in dict {id0: playstyle0, id1: playstyle1}. :params year: Year. """ rc = requests.get(messages_url, timeout=timeout) rc.encoding = 'utf-8' # guessing takes huge amount of cpu time rc = rc.text data = re.findall('"playstyl...
def playstyles(year=2019, timeout=timeout): """Return all playstyles in dict {id0: playstyle0, id1: playstyle1}. :params year: Year. """ rc = requests.get(messages_url, timeout=timeout) rc.encoding = 'utf-8' # guessing takes huge amount of cpu time rc = rc.text data = re.findall('"playstyl...
[ "Return", "all", "playstyles", "in", "dict", "{", "id0", ":", "playstyle0", "id1", ":", "playstyle1", "}", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L276-L288
[ "def", "playstyles", "(", "year", "=", "2019", ",", "timeout", "=", "timeout", ")", ":", "rc", "=", "requests", ".", "get", "(", "messages_url", ",", "timeout", "=", "timeout", ")", "rc", ".", "encoding", "=", "'utf-8'", "# guessing takes huge amount of cpu ...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.logout
Log out nicely (like clicking on logout button). :params save: False if You don't want to save cookies.
fut/core.py
def logout(self, save=True): """Log out nicely (like clicking on logout button). :params save: False if You don't want to save cookies. """ # self.r.get('https://www.easports.com/signout', params={'ct': self._}) # self.r.get('https://accounts.ea.com/connect/clearsid', params={'c...
def logout(self, save=True): """Log out nicely (like clicking on logout button). :params save: False if You don't want to save cookies. """ # self.r.get('https://www.easports.com/signout', params={'ct': self._}) # self.r.get('https://accounts.ea.com/connect/clearsid', params={'c...
[ "Log", "out", "nicely", "(", "like", "clicking", "on", "logout", "button", ")", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L863-L876
[ "def", "logout", "(", "self", ",", "save", "=", "True", ")", ":", "# self.r.get('https://www.easports.com/signout', params={'ct': self._})", "# self.r.get('https://accounts.ea.com/connect/clearsid', params={'ct': self._})", "# self.r.get('https://beta.www.origin.com/views/logout.html', param...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.playstyles
Return all playstyles in dict {id0: playstyle0, id1: playstyle1}. :params year: Year.
fut/core.py
def playstyles(self, year=2019): """Return all playstyles in dict {id0: playstyle0, id1: playstyle1}. :params year: Year. """ if not self._playstyles: self._playstyles = playstyles() return self._playstyles
def playstyles(self, year=2019): """Return all playstyles in dict {id0: playstyle0, id1: playstyle1}. :params year: Year. """ if not self._playstyles: self._playstyles = playstyles() return self._playstyles
[ "Return", "all", "playstyles", "in", "dict", "{", "id0", ":", "playstyle0", "id1", ":", "playstyle1", "}", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L886-L893
[ "def", "playstyles", "(", "self", ",", "year", "=", "2019", ")", ":", "if", "not", "self", ".", "_playstyles", ":", "self", ".", "_playstyles", "=", "playstyles", "(", ")", "return", "self", ".", "_playstyles" ]
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.leagues
Return all leagues in dict {id0: league0, id1: league1}. :params year: Year.
fut/core.py
def leagues(self, year=2019): """Return all leagues in dict {id0: league0, id1: league1}. :params year: Year. """ if year not in self._leagues: self._leagues[year] = leagues(year) return self._leagues[year]
def leagues(self, year=2019): """Return all leagues in dict {id0: league0, id1: league1}. :params year: Year. """ if year not in self._leagues: self._leagues[year] = leagues(year) return self._leagues[year]
[ "Return", "all", "leagues", "in", "dict", "{", "id0", ":", "league0", "id1", ":", "league1", "}", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L906-L913
[ "def", "leagues", "(", "self", ",", "year", "=", "2019", ")", ":", "if", "year", "not", "in", "self", ".", "_leagues", ":", "self", ".", "_leagues", "[", "year", "]", "=", "leagues", "(", "year", ")", "return", "self", ".", "_leagues", "[", "year",...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.teams
Return all teams in dict {id0: team0, id1: team1}. :params year: Year.
fut/core.py
def teams(self, year=2019): """Return all teams in dict {id0: team0, id1: team1}. :params year: Year. """ if year not in self._teams: self._teams[year] = teams(year) return self._teams[year]
def teams(self, year=2019): """Return all teams in dict {id0: team0, id1: team1}. :params year: Year. """ if year not in self._teams: self._teams[year] = teams(year) return self._teams[year]
[ "Return", "all", "teams", "in", "dict", "{", "id0", ":", "team0", "id1", ":", "team1", "}", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L916-L923
[ "def", "teams", "(", "self", ",", "year", "=", "2019", ")", ":", "if", "year", "not", "in", "self", ".", "_teams", ":", "self", ".", "_teams", "[", "year", "]", "=", "teams", "(", "year", ")", "return", "self", ".", "_teams", "[", "year", "]" ]
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.saveSession
Save cookies/session.
fut/core.py
def saveSession(self): """Save cookies/session.""" if self.cookies_file: self.r.cookies.save(ignore_discard=True) with open(self.token_file, 'w') as f: f.write('%s %s' % (self.token_type, self.access_token))
def saveSession(self): """Save cookies/session.""" if self.cookies_file: self.r.cookies.save(ignore_discard=True) with open(self.token_file, 'w') as f: f.write('%s %s' % (self.token_type, self.access_token))
[ "Save", "cookies", "/", "session", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L938-L943
[ "def", "saveSession", "(", "self", ")", ":", "if", "self", ".", "cookies_file", ":", "self", ".", "r", ".", "cookies", ".", "save", "(", "ignore_discard", "=", "True", ")", "with", "open", "(", "self", ".", "token_file", ",", "'w'", ")", "as", "f", ...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.cardInfo
Return card info. :params resource_id: Resource id.
fut/core.py
def cardInfo(self, resource_id): """Return card info. :params resource_id: Resource id. """ # TODO: add referer to headers (futweb) base_id = baseId(resource_id) if base_id in self.players: return self.players[base_id] else: # not a player? ...
def cardInfo(self, resource_id): """Return card info. :params resource_id: Resource id. """ # TODO: add referer to headers (futweb) base_id = baseId(resource_id) if base_id in self.players: return self.players[base_id] else: # not a player? ...
[ "Return", "card", "info", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L949-L960
[ "def", "cardInfo", "(", "self", ",", "resource_id", ")", ":", "# TODO: add referer to headers (futweb)", "base_id", "=", "baseId", "(", "resource_id", ")", "if", "base_id", "in", "self", ".", "players", ":", "return", "self", ".", "players", "[", "base_id", "]...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.searchDefinition
Return variations of the given asset id, e.g. IF cards. :param asset_id: Asset id / Definition id. :param start: (optional) Start page. :param count: (optional) Number of definitions you want to request.
fut/core.py
def searchDefinition(self, asset_id, start=0, page_size=itemsPerPage['transferMarket'], count=None): """Return variations of the given asset id, e.g. IF cards. :param asset_id: Asset id / Definition id. :param start: (optional) Start page. :param count: (optional) Number of definitions ...
def searchDefinition(self, asset_id, start=0, page_size=itemsPerPage['transferMarket'], count=None): """Return variations of the given asset id, e.g. IF cards. :param asset_id: Asset id / Definition id. :param start: (optional) Start page. :param count: (optional) Number of definitions ...
[ "Return", "variations", "of", "the", "given", "asset", "id", "e", ".", "g", ".", "IF", "cards", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L962-L992
[ "def", "searchDefinition", "(", "self", ",", "asset_id", ",", "start", "=", "0", ",", "page_size", "=", "itemsPerPage", "[", "'transferMarket'", "]", ",", "count", "=", "None", ")", ":", "method", "=", "'GET'", "url", "=", "'defid'", "if", "count", ":", ...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.search
Prepare search request, send and return parsed data as a dict. :param ctype: [development / ? / ?] Card type. :param level: (optional) [?/?/gold] Card level. :param category: (optional) [fitness/?/?] Card category. :param assetId: (optional) Asset id. :param defId: (optional) De...
fut/core.py
def search(self, ctype, level=None, category=None, assetId=None, defId=None, min_price=None, max_price=None, min_buy=None, max_buy=None, league=None, club=None, position=None, zone=None, nationality=None, rare=False, playStyle=None, start=0, page_size=itemsPerPage['transferM...
def search(self, ctype, level=None, category=None, assetId=None, defId=None, min_price=None, max_price=None, min_buy=None, max_buy=None, league=None, club=None, position=None, zone=None, nationality=None, rare=False, playStyle=None, start=0, page_size=itemsPerPage['transferM...
[ "Prepare", "search", "request", "send", "and", "return", "parsed", "data", "as", "a", "dict", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L994-L1072
[ "def", "search", "(", "self", ",", "ctype", ",", "level", "=", "None", ",", "category", "=", "None", ",", "assetId", "=", "None", ",", "defId", "=", "None", ",", "min_price", "=", "None", ",", "max_price", "=", "None", ",", "min_buy", "=", "None", ...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.bid
Make a bid. :params trade_id: Trade id. :params bid: Amount of credits You want to spend. :params fast: True for fastest bidding (skips trade status & credits check).
fut/core.py
def bid(self, trade_id, bid, fast=False): """Make a bid. :params trade_id: Trade id. :params bid: Amount of credits You want to spend. :params fast: True for fastest bidding (skips trade status & credits check). """ method = 'PUT' url = 'trade/%s/bid' % trade_id ...
def bid(self, trade_id, bid, fast=False): """Make a bid. :params trade_id: Trade id. :params bid: Amount of credits You want to spend. :params fast: True for fastest bidding (skips trade status & credits check). """ method = 'PUT' url = 'trade/%s/bid' % trade_id ...
[ "Make", "a", "bid", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1090-L1115
[ "def", "bid", "(", "self", ",", "trade_id", ",", "bid", ",", "fast", "=", "False", ")", ":", "method", "=", "'PUT'", "url", "=", "'trade/%s/bid'", "%", "trade_id", "if", "not", "fast", ":", "rc", "=", "self", ".", "tradeStatus", "(", "trade_id", ")",...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.club
Return items in your club, excluding consumables. :param ctype: [development / ? / ?] Card type. :param level: (optional) [?/?/gold] Card level. :param category: (optional) [fitness/?/?] Card category. :param assetId: (optional) Asset id. :param defId: (optional) Definition id. ...
fut/core.py
def club(self, sort='desc', ctype='player', defId='', start=0, count=None, page_size=itemsPerPage['club'], level=None, category=None, assetId=None, league=None, club=None, position=None, zone=None, nationality=None, rare=False, playStyle=None): """Return items in your club, excluding c...
def club(self, sort='desc', ctype='player', defId='', start=0, count=None, page_size=itemsPerPage['club'], level=None, category=None, assetId=None, league=None, club=None, position=None, zone=None, nationality=None, rare=False, playStyle=None): """Return items in your club, excluding c...
[ "Return", "items", "in", "your", "club", "excluding", "consumables", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1117-L1184
[ "def", "club", "(", "self", ",", "sort", "=", "'desc'", ",", "ctype", "=", "'player'", ",", "defId", "=", "''", ",", "start", "=", "0", ",", "count", "=", "None", ",", "page_size", "=", "itemsPerPage", "[", "'club'", "]", ",", "level", "=", "None",...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.clubStaff
Return staff in your club.
fut/core.py
def clubStaff(self): """Return staff in your club.""" method = 'GET' url = 'club/stats/staff' rc = self.__request__(method, url) return rc
def clubStaff(self): """Return staff in your club.""" method = 'GET' url = 'club/stats/staff' rc = self.__request__(method, url) return rc
[ "Return", "staff", "in", "your", "club", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1186-L1192
[ "def", "clubStaff", "(", "self", ")", ":", "method", "=", "'GET'", "url", "=", "'club/stats/staff'", "rc", "=", "self", ".", "__request__", "(", "method", ",", "url", ")", "return", "rc" ]
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.clubConsumables
Return all consumables from club.
fut/core.py
def clubConsumables(self, fast=False): """Return all consumables from club.""" method = 'GET' url = 'club/consumables/development' rc = self.__request__(method, url) events = [self.pin.event('page_view', 'Hub - Club')] self.pin.send(events, fast=fast) events = [...
def clubConsumables(self, fast=False): """Return all consumables from club.""" method = 'GET' url = 'club/consumables/development' rc = self.__request__(method, url) events = [self.pin.event('page_view', 'Hub - Club')] self.pin.send(events, fast=fast) events = [...
[ "Return", "all", "consumables", "from", "club", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1194-L1208
[ "def", "clubConsumables", "(", "self", ",", "fast", "=", "False", ")", ":", "method", "=", "'GET'", "url", "=", "'club/consumables/development'", "rc", "=", "self", ".", "__request__", "(", "method", ",", "url", ")", "events", "=", "[", "self", ".", "pin...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.squad
Return a squad. :params squad_id: Squad id.
fut/core.py
def squad(self, squad_id=0, persona_id=None): """Return a squad. :params squad_id: Squad id. """ method = 'GET' url = 'squad/%s/user/%s' % (squad_id, persona_id or self.persona_id) # pinEvents events = [self.pin.event('page_view', 'Hub - Squads')] self.p...
def squad(self, squad_id=0, persona_id=None): """Return a squad. :params squad_id: Squad id. """ method = 'GET' url = 'squad/%s/user/%s' % (squad_id, persona_id or self.persona_id) # pinEvents events = [self.pin.event('page_view', 'Hub - Squads')] self.p...
[ "Return", "a", "squad", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1210-L1229
[ "def", "squad", "(", "self", ",", "squad_id", "=", "0", ",", "persona_id", "=", "None", ")", ":", "method", "=", "'GET'", "url", "=", "'squad/%s/user/%s'", "%", "(", "squad_id", ",", "persona_id", "or", "self", ".", "persona_id", ")", "# pinEvents", "eve...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.tradeStatus
Return trade status. :params trade_id: Trade id.
fut/core.py
def tradeStatus(self, trade_id): """Return trade status. :params trade_id: Trade id. """ method = 'GET' url = 'trade/status' if not isinstance(trade_id, (list, tuple)): trade_id = (trade_id,) trade_id = (str(i) for i in trade_id) params = {'t...
def tradeStatus(self, trade_id): """Return trade status. :params trade_id: Trade id. """ method = 'GET' url = 'trade/status' if not isinstance(trade_id, (list, tuple)): trade_id = (trade_id,) trade_id = (str(i) for i in trade_id) params = {'t...
[ "Return", "trade", "status", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1238-L1251
[ "def", "tradeStatus", "(", "self", ",", "trade_id", ")", ":", "method", "=", "'GET'", "url", "=", "'trade/status'", "if", "not", "isinstance", "(", "trade_id", ",", "(", "list", ",", "tuple", ")", ")", ":", "trade_id", "=", "(", "trade_id", ",", ")", ...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.tradepile
Return items in tradepile.
fut/core.py
def tradepile(self): """Return items in tradepile.""" method = 'GET' url = 'tradepile' rc = self.__request__(method, url) # pinEvents events = [self.pin.event('page_view', 'Hub - Transfers'), self.pin.event('page_view', 'Transfer List - List View')] if rc.get('a...
def tradepile(self): """Return items in tradepile.""" method = 'GET' url = 'tradepile' rc = self.__request__(method, url) # pinEvents events = [self.pin.event('page_view', 'Hub - Transfers'), self.pin.event('page_view', 'Transfer List - List View')] if rc.get('a...
[ "Return", "items", "in", "tradepile", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1253-L1266
[ "def", "tradepile", "(", "self", ")", ":", "method", "=", "'GET'", "url", "=", "'tradepile'", "rc", "=", "self", ".", "__request__", "(", "method", ",", "url", ")", "# pinEvents", "events", "=", "[", "self", ".", "pin", ".", "event", "(", "'page_view'"...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.sell
Start auction. Returns trade_id. :params item_id: Item id. :params bid: Stard bid. :params buy_now: Buy now price. :params duration: Auction duration in seconds (Default: 3600).
fut/core.py
def sell(self, item_id, bid, buy_now, duration=3600, fast=False): """Start auction. Returns trade_id. :params item_id: Item id. :params bid: Stard bid. :params buy_now: Buy now price. :params duration: Auction duration in seconds (Default: 3600). """ method = 'PO...
def sell(self, item_id, bid, buy_now, duration=3600, fast=False): """Start auction. Returns trade_id. :params item_id: Item id. :params bid: Stard bid. :params buy_now: Buy now price. :params duration: Auction duration in seconds (Default: 3600). """ method = 'PO...
[ "Start", "auction", ".", "Returns", "trade_id", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1298-L1314
[ "def", "sell", "(", "self", ",", "item_id", ",", "bid", ",", "buy_now", ",", "duration", "=", "3600", ",", "fast", "=", "False", ")", ":", "method", "=", "'POST'", "url", "=", "'auctionhouse'", "# TODO: auto send to tradepile", "data", "=", "{", "'buyNowPr...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.quickSell
Quick sell. :params item_id: Item id.
fut/core.py
def quickSell(self, item_id): """Quick sell. :params item_id: Item id. """ method = 'DELETE' url = 'item' if not isinstance(item_id, (list, tuple)): item_id = (item_id,) item_id = (str(i) for i in item_id) params = {'itemIds': ','.join(item_i...
def quickSell(self, item_id): """Quick sell. :params item_id: Item id. """ method = 'DELETE' url = 'item' if not isinstance(item_id, (list, tuple)): item_id = (item_id,) item_id = (str(i) for i in item_id) params = {'itemIds': ','.join(item_i...
[ "Quick", "sell", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1316-L1329
[ "def", "quickSell", "(", "self", ",", "item_id", ")", ":", "method", "=", "'DELETE'", "url", "=", "'item'", "if", "not", "isinstance", "(", "item_id", ",", "(", "list", ",", "tuple", ")", ")", ":", "item_id", "=", "(", "item_id", ",", ")", "item_id",...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.watchlistDelete
Remove cards from watchlist. :params trade_id: Trade id.
fut/core.py
def watchlistDelete(self, trade_id): """Remove cards from watchlist. :params trade_id: Trade id. """ method = 'DELETE' url = 'watchlist' if not isinstance(trade_id, (list, tuple)): trade_id = (trade_id,) trade_id = (str(i) for i in trade_id) ...
def watchlistDelete(self, trade_id): """Remove cards from watchlist. :params trade_id: Trade id. """ method = 'DELETE' url = 'watchlist' if not isinstance(trade_id, (list, tuple)): trade_id = (trade_id,) trade_id = (str(i) for i in trade_id) ...
[ "Remove", "cards", "from", "watchlist", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1331-L1344
[ "def", "watchlistDelete", "(", "self", ",", "trade_id", ")", ":", "method", "=", "'DELETE'", "url", "=", "'watchlist'", "if", "not", "isinstance", "(", "trade_id", ",", "(", "list", ",", "tuple", ")", ")", ":", "trade_id", "=", "(", "trade_id", ",", ")...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.tradepileDelete
Remove card from tradepile. :params trade_id: Trade id.
fut/core.py
def tradepileDelete(self, trade_id): # item_id instead of trade_id? """Remove card from tradepile. :params trade_id: Trade id. """ method = 'DELETE' url = 'trade/%s' % trade_id self.__request__(method, url) # returns nothing # TODO: validate status code ...
def tradepileDelete(self, trade_id): # item_id instead of trade_id? """Remove card from tradepile. :params trade_id: Trade id. """ method = 'DELETE' url = 'trade/%s' % trade_id self.__request__(method, url) # returns nothing # TODO: validate status code ...
[ "Remove", "card", "from", "tradepile", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1346-L1356
[ "def", "tradepileDelete", "(", "self", ",", "trade_id", ")", ":", "# item_id instead of trade_id?", "method", "=", "'DELETE'", "url", "=", "'trade/%s'", "%", "trade_id", "self", ".", "__request__", "(", "method", ",", "url", ")", "# returns nothing", "# TODO: vali...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.sendToTradepile
Send to tradepile (alias for __sendToPile__). :params item_id: Item id. :params safe: (optional) False to disable tradepile free space check.
fut/core.py
def sendToTradepile(self, item_id, safe=True): """Send to tradepile (alias for __sendToPile__). :params item_id: Item id. :params safe: (optional) False to disable tradepile free space check. """ if safe and len( self.tradepile()) >= self.tradepile_size: # TODO?...
def sendToTradepile(self, item_id, safe=True): """Send to tradepile (alias for __sendToPile__). :params item_id: Item id. :params safe: (optional) False to disable tradepile free space check. """ if safe and len( self.tradepile()) >= self.tradepile_size: # TODO?...
[ "Send", "to", "tradepile", "(", "alias", "for", "__sendToPile__", ")", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1366-L1375
[ "def", "sendToTradepile", "(", "self", ",", "item_id", ",", "safe", "=", "True", ")", ":", "if", "safe", "and", "len", "(", "self", ".", "tradepile", "(", ")", ")", ">=", "self", ".", "tradepile_size", ":", "# TODO?: optimization (don't parse items in tradepil...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.sendToWatchlist
Send to watchlist. :params trade_id: Trade id.
fut/core.py
def sendToWatchlist(self, trade_id): """Send to watchlist. :params trade_id: Trade id. """ method = 'PUT' url = 'watchlist' data = {'auctionInfo': [{'id': trade_id}]} return self.__request__(method, url, data=json.dumps(data))
def sendToWatchlist(self, trade_id): """Send to watchlist. :params trade_id: Trade id. """ method = 'PUT' url = 'watchlist' data = {'auctionInfo': [{'id': trade_id}]} return self.__request__(method, url, data=json.dumps(data))
[ "Send", "to", "watchlist", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1384-L1393
[ "def", "sendToWatchlist", "(", "self", ",", "trade_id", ")", ":", "method", "=", "'PUT'", "url", "=", "'watchlist'", "data", "=", "{", "'auctionInfo'", ":", "[", "{", "'id'", ":", "trade_id", "}", "]", "}", "return", "self", ".", "__request__", "(", "m...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.sendToSbs
Send card FROM CLUB to first free slot in sbs squad.
fut/core.py
def sendToSbs(self, challenge_id, item_id): """Send card FROM CLUB to first free slot in sbs squad.""" # TODO?: multiple item_ids method = 'PUT' url = 'sbs/challenge/%s/squad' % challenge_id squad = self.sbsSquad(challenge_id) players = [] moved = False n...
def sendToSbs(self, challenge_id, item_id): """Send card FROM CLUB to first free slot in sbs squad.""" # TODO?: multiple item_ids method = 'PUT' url = 'sbs/challenge/%s/squad' % challenge_id squad = self.sbsSquad(challenge_id) players = [] moved = False n...
[ "Send", "card", "FROM", "CLUB", "to", "first", "free", "slot", "in", "sbs", "squad", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1395-L1421
[ "def", "sendToSbs", "(", "self", ",", "challenge_id", ",", "item_id", ")", ":", "# TODO?: multiple item_ids", "method", "=", "'PUT'", "url", "=", "'sbs/challenge/%s/squad'", "%", "challenge_id", "squad", "=", "self", ".", "sbsSquad", "(", "challenge_id", ")", "p...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.applyConsumable
Apply consumable on player. :params item_id: Item id of player. :params resource_id: Resource id of consumable.
fut/core.py
def applyConsumable(self, item_id, resource_id): """Apply consumable on player. :params item_id: Item id of player. :params resource_id: Resource id of consumable. """ # TODO: catch exception when consumable is not found etc. # TODO: multiple players like in quickSell ...
def applyConsumable(self, item_id, resource_id): """Apply consumable on player. :params item_id: Item id of player. :params resource_id: Resource id of consumable. """ # TODO: catch exception when consumable is not found etc. # TODO: multiple players like in quickSell ...
[ "Apply", "consumable", "on", "player", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1447-L1459
[ "def", "applyConsumable", "(", "self", ",", "item_id", ",", "resource_id", ")", ":", "# TODO: catch exception when consumable is not found etc.", "# TODO: multiple players like in quickSell", "method", "=", "'POST'", "url", "=", "'item/resource/%s'", "%", "resource_id", "data...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.messages
Return active messages.
fut/core.py
def messages(self): """Return active messages.""" method = 'GET' url = 'activeMessage' rc = self.__request__(method, url) # try: # return rc['activeMessage'] # except: # raise UnknownError('Invalid activeMessage response') # is it even possible? ...
def messages(self): """Return active messages.""" method = 'GET' url = 'activeMessage' rc = self.__request__(method, url) # try: # return rc['activeMessage'] # except: # raise UnknownError('Invalid activeMessage response') # is it even possible? ...
[ "Return", "active", "messages", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1515-L1525
[ "def", "messages", "(", "self", ")", ":", "method", "=", "'GET'", "url", "=", "'activeMessage'", "rc", "=", "self", ".", "__request__", "(", "method", ",", "url", ")", "# try:", "# return rc['activeMessage']", "# except:", "# raise UnknownError('Invalid acti...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
Core.packs
List all (currently?) available packs.
fut/core.py
def packs(self): """List all (currently?) available packs.""" method = 'GET' url = 'store/purchaseGroup/cardpack' params = {'ppInfo': True} return self.__request__(method, url, params=params)
def packs(self): """List all (currently?) available packs.""" method = 'GET' url = 'store/purchaseGroup/cardpack' params = {'ppInfo': True} return self.__request__(method, url, params=params)
[ "List", "all", "(", "currently?", ")", "available", "packs", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/core.py#L1536-L1542
[ "def", "packs", "(", "self", ")", ":", "method", "=", "'GET'", "url", "=", "'store/purchaseGroup/cardpack'", "params", "=", "{", "'ppInfo'", ":", "True", "}", "return", "self", ".", "__request__", "(", "method", ",", "url", ",", "params", "=", "params", ...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
EAHashingAlgorithm.num2hex
Convert a decimal number to hexadecimal
fut/EAHashingAlgorithm.py
def num2hex(self, num): ''' Convert a decimal number to hexadecimal ''' temp = '' for i in range(0, 4): x = self.hexChars[ ( num >> (i * 8 + 4) ) & 0x0F ] y = self.hexChars[ ( num >> (i * 8) ) & 0x0F ] temp += (x + y) return temp
def num2hex(self, num): ''' Convert a decimal number to hexadecimal ''' temp = '' for i in range(0, 4): x = self.hexChars[ ( num >> (i * 8 + 4) ) & 0x0F ] y = self.hexChars[ ( num >> (i * 8) ) & 0x0F ] temp += (x + y) return temp
[ "Convert", "a", "decimal", "number", "to", "hexadecimal" ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/EAHashingAlgorithm.py#L26-L36
[ "def", "num2hex", "(", "self", ",", "num", ")", ":", "temp", "=", "''", "for", "i", "in", "range", "(", "0", ",", "4", ")", ":", "x", "=", "self", ".", "hexChars", "[", "(", "num", ">>", "(", "i", "*", "8", "+", "4", ")", ")", "&", "0x0F"...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
logger
Init and configure logger.
fut/log.py
def logger(name=None, save=False): """Init and configure logger.""" logger = logging.getLogger(name) if save: logformat = '%(asctime)s [%(levelname)s] [%(name)s] %(funcName)s: %(message)s (line %(lineno)d)' log_file_path = 'fut.log' # TODO: define logpath open(log_file_path, 'w').w...
def logger(name=None, save=False): """Init and configure logger.""" logger = logging.getLogger(name) if save: logformat = '%(asctime)s [%(levelname)s] [%(name)s] %(funcName)s: %(message)s (line %(lineno)d)' log_file_path = 'fut.log' # TODO: define logpath open(log_file_path, 'w').w...
[ "Init", "and", "configure", "logger", "." ]
futapi/fut
python
https://github.com/futapi/fut/blob/3792c9eee8f5884f38a02210e649c46c6c7a756d/fut/log.py#L20-L36
[ "def", "logger", "(", "name", "=", "None", ",", "save", "=", "False", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "name", ")", "if", "save", ":", "logformat", "=", "'%(asctime)s [%(levelname)s] [%(name)s] %(funcName)s: %(message)s (line %(lineno)d)'",...
3792c9eee8f5884f38a02210e649c46c6c7a756d
valid
get_bits_per_pixel
Returns the number of (used) bits per pixel. So without padding. Returns None if format is not known.
src/harvesters/util/pfnc.py
def get_bits_per_pixel(data_format): """ Returns the number of (used) bits per pixel. So without padding. Returns None if format is not known. """ if data_format in component_8bit_formats: return 8 elif data_format in component_10bit_formats: return 10 elif data_format in...
def get_bits_per_pixel(data_format): """ Returns the number of (used) bits per pixel. So without padding. Returns None if format is not known. """ if data_format in component_8bit_formats: return 8 elif data_format in component_10bit_formats: return 10 elif data_format in...
[ "Returns", "the", "number", "of", "(", "used", ")", "bits", "per", "pixel", ".", "So", "without", "padding", ".", "Returns", "None", "if", "format", "is", "not", "known", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/util/pfnc.py#L70-L87
[ "def", "get_bits_per_pixel", "(", "data_format", ")", ":", "if", "data_format", "in", "component_8bit_formats", ":", "return", "8", "elif", "data_format", "in", "component_10bit_formats", ":", "return", "10", "elif", "data_format", "in", "component_12bit_formats", ":"...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
_ThreadImpl.run
Runs its worker method. This method will be terminated once its parent's is_running property turns False.
src/harvesters/core.py
def run(self): """ Runs its worker method. This method will be terminated once its parent's is_running property turns False. """ while self._base.is_running: if self._worker: self._worker() time.sleep(self._sleep_duration)
def run(self): """ Runs its worker method. This method will be terminated once its parent's is_running property turns False. """ while self._base.is_running: if self._worker: self._worker() time.sleep(self._sleep_duration)
[ "Runs", "its", "worker", "method", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L409-L419
[ "def", "run", "(", "self", ")", ":", "while", "self", ".", "_base", ".", "is_running", ":", "if", "self", ".", "_worker", ":", "self", ".", "_worker", "(", ")", "time", ".", "sleep", "(", "self", ".", "_sleep_duration", ")" ]
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Component2DImage.represent_pixel_location
Returns a NumPy array that represents the 2D pixel location, which is defined by PFNC, of the original image data. You may use the returned NumPy array for a calculation to map the original image to another format. :return: A NumPy array that represents the 2D pixel location.
src/harvesters/core.py
def represent_pixel_location(self): """ Returns a NumPy array that represents the 2D pixel location, which is defined by PFNC, of the original image data. You may use the returned NumPy array for a calculation to map the original image to another format. :return: A NumP...
def represent_pixel_location(self): """ Returns a NumPy array that represents the 2D pixel location, which is defined by PFNC, of the original image data. You may use the returned NumPy array for a calculation to map the original image to another format. :return: A NumP...
[ "Returns", "a", "NumPy", "array", "that", "represents", "the", "2D", "pixel", "location", "which", "is", "defined", "by", "PFNC", "of", "the", "original", "image", "data", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L615-L632
[ "def", "represent_pixel_location", "(", "self", ")", ":", "if", "self", ".", "data", "is", "None", ":", "return", "None", "#", "return", "self", ".", "_data", ".", "reshape", "(", "self", ".", "height", "+", "self", ".", "y_padding", ",", "int", "(", ...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Component2DImage.width
:return: The width of the data component in the buffer in number of pixels.
src/harvesters/core.py
def width(self): """ :return: The width of the data component in the buffer in number of pixels. """ try: if self._part: value = self._part.width else: value = self._buffer.width except InvalidParameterException: ...
def width(self): """ :return: The width of the data component in the buffer in number of pixels. """ try: if self._part: value = self._part.width else: value = self._buffer.width except InvalidParameterException: ...
[ ":", "return", ":", "The", "width", "of", "the", "data", "component", "in", "the", "buffer", "in", "number", "of", "pixels", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L651-L662
[ "def", "width", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_part", ":", "value", "=", "self", ".", "_part", ".", "width", "else", ":", "value", "=", "self", ".", "_buffer", ".", "width", "except", "InvalidParameterException", ":", "value", ...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Component2DImage.height
:return: The height of the data component in the buffer in number of pixels.
src/harvesters/core.py
def height(self): """ :return: The height of the data component in the buffer in number of pixels. """ try: if self._part: value = self._part.height else: value = self._buffer.height except InvalidParameterException: ...
def height(self): """ :return: The height of the data component in the buffer in number of pixels. """ try: if self._part: value = self._part.height else: value = self._buffer.height except InvalidParameterException: ...
[ ":", "return", ":", "The", "height", "of", "the", "data", "component", "in", "the", "buffer", "in", "number", "of", "pixels", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L665-L676
[ "def", "height", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_part", ":", "value", "=", "self", ".", "_part", ".", "height", "else", ":", "value", "=", "self", ".", "_buffer", ".", "height", "except", "InvalidParameterException", ":", "value...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Component2DImage.data_format_value
:return: The data type of the data component as integer value.
src/harvesters/core.py
def data_format_value(self): """ :return: The data type of the data component as integer value. """ try: if self._part: value = self._part.data_format else: value = self._buffer.pixel_format except InvalidParameterException:...
def data_format_value(self): """ :return: The data type of the data component as integer value. """ try: if self._part: value = self._part.data_format else: value = self._buffer.pixel_format except InvalidParameterException:...
[ ":", "return", ":", "The", "data", "type", "of", "the", "data", "component", "as", "integer", "value", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L679-L690
[ "def", "data_format_value", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_part", ":", "value", "=", "self", ".", "_part", ".", "data_format", "else", ":", "value", "=", "self", ".", "_buffer", ".", "pixel_format", "except", "InvalidParameterExcep...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Component2DImage.delivered_image_height
:return: The image height of the data component.
src/harvesters/core.py
def delivered_image_height(self): """ :return: The image height of the data component. """ try: if self._part: value = self._part.delivered_image_height else: value = self._buffer.delivered_image_height except InvalidParamet...
def delivered_image_height(self): """ :return: The image height of the data component. """ try: if self._part: value = self._part.delivered_image_height else: value = self._buffer.delivered_image_height except InvalidParamet...
[ ":", "return", ":", "The", "image", "height", "of", "the", "data", "component", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L700-L711
[ "def", "delivered_image_height", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_part", ":", "value", "=", "self", ".", "_part", ".", "delivered_image_height", "else", ":", "value", "=", "self", ".", "_buffer", ".", "delivered_image_height", "except"...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Component2DImage.x_offset
:return: The X offset of the data in the buffer in number of pixels from the image origin to handle areas of interest.
src/harvesters/core.py
def x_offset(self): # TODO: Check the naming convention. """ :return: The X offset of the data in the buffer in number of pixels from the image origin to handle areas of interest. """ try: if self._part: value = self._part.x_offset else: ...
def x_offset(self): # TODO: Check the naming convention. """ :return: The X offset of the data in the buffer in number of pixels from the image origin to handle areas of interest. """ try: if self._part: value = self._part.x_offset else: ...
[ ":", "return", ":", "The", "X", "offset", "of", "the", "data", "in", "the", "buffer", "in", "number", "of", "pixels", "from", "the", "image", "origin", "to", "handle", "areas", "of", "interest", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L714-L725
[ "def", "x_offset", "(", "self", ")", ":", "# TODO: Check the naming convention.", "try", ":", "if", "self", ".", "_part", ":", "value", "=", "self", ".", "_part", ".", "x_offset", "else", ":", "value", "=", "self", ".", "_buffer", ".", "offset_x", "except"...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Component2DImage.y_offset
:return: The Y offset of the data in the buffer in number of pixels from the image origin to handle areas of interest.
src/harvesters/core.py
def y_offset(self): """ :return: The Y offset of the data in the buffer in number of pixels from the image origin to handle areas of interest. """ try: if self._part: value = self._part.y_offset else: value = self._buffer.offset_y ...
def y_offset(self): """ :return: The Y offset of the data in the buffer in number of pixels from the image origin to handle areas of interest. """ try: if self._part: value = self._part.y_offset else: value = self._buffer.offset_y ...
[ ":", "return", ":", "The", "Y", "offset", "of", "the", "data", "in", "the", "buffer", "in", "number", "of", "pixels", "from", "the", "image", "origin", "to", "handle", "areas", "of", "interest", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L728-L739
[ "def", "y_offset", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_part", ":", "value", "=", "self", ".", "_part", ".", "y_offset", "else", ":", "value", "=", "self", ".", "_buffer", ".", "offset_y", "except", "InvalidParameterException", ":", ...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Component2DImage.x_padding
Returns :return: The X padding of the data component in the buffer in number of pixels.
src/harvesters/core.py
def x_padding(self): """ Returns :return: The X padding of the data component in the buffer in number of pixels. """ try: if self._part: value = self._part.x_padding else: value = self._buffer.padding_x except Invali...
def x_padding(self): """ Returns :return: The X padding of the data component in the buffer in number of pixels. """ try: if self._part: value = self._part.x_padding else: value = self._buffer.padding_x except Invali...
[ "Returns", ":", "return", ":", "The", "X", "padding", "of", "the", "data", "component", "in", "the", "buffer", "in", "number", "of", "pixels", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L742-L754
[ "def", "x_padding", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_part", ":", "value", "=", "self", ".", "_part", ".", "x_padding", "else", ":", "value", "=", "self", ".", "_buffer", ".", "padding_x", "except", "InvalidParameterException", ":",...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Buffer.queue
Queues the buffer to prepare for the upcoming image acquisition. Once the buffer is queued, the :class:`Buffer` object will be obsolete. You'll have nothing to do with it. Note that you have to return the ownership of the fetched buffers to the :class:`ImageAcquirer` object before stopp...
src/harvesters/core.py
def queue(self): """ Queues the buffer to prepare for the upcoming image acquisition. Once the buffer is queued, the :class:`Buffer` object will be obsolete. You'll have nothing to do with it. Note that you have to return the ownership of the fetched buffers to the :clas...
def queue(self): """ Queues the buffer to prepare for the upcoming image acquisition. Once the buffer is queued, the :class:`Buffer` object will be obsolete. You'll have nothing to do with it. Note that you have to return the ownership of the fetched buffers to the :clas...
[ "Queues", "the", "buffer", "to", "prepare", "for", "the", "upcoming", "image", "acquisition", ".", "Once", "the", "buffer", "is", "queued", "the", ":", "class", ":", "Buffer", "object", "will", "be", "obsolete", ".", "You", "ll", "have", "nothing", "to", ...
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L883-L909
[ "def", "queue", "(", "self", ")", ":", "#", "if", "_is_logging_buffer_manipulation", ":", "self", ".", "_logger", ".", "debug", "(", "'Queued Buffer module #{0}'", "' containing frame #{1}'", "' to DataStream module {2}'", "' of Device module {3}'", "'.'", ".", "format", ...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
ImageAcquirer.start_image_acquisition
Starts image acquisition. :return: None.
src/harvesters/core.py
def start_image_acquisition(self): """ Starts image acquisition. :return: None. """ if not self._create_ds_at_connection: self._setup_data_streams() # num_required_buffers = self._num_buffers for data_stream in self._data_streams: ...
def start_image_acquisition(self): """ Starts image acquisition. :return: None. """ if not self._create_ds_at_connection: self._setup_data_streams() # num_required_buffers = self._num_buffers for data_stream in self._data_streams: ...
[ "Starts", "image", "acquisition", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L1579-L1667
[ "def", "start_image_acquisition", "(", "self", ")", ":", "if", "not", "self", ".", "_create_ds_at_connection", ":", "self", ".", "_setup_data_streams", "(", ")", "#", "num_required_buffers", "=", "self", ".", "_num_buffers", "for", "data_stream", "in", "self", "...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
ImageAcquirer.fetch_buffer
Fetches the latest :class:`Buffer` object and returns it. :param timeout: Set timeout value in second. :param is_raw: Set :const:`True` if you need a raw GenTL Buffer module. :return: A :class:`Buffer` object.
src/harvesters/core.py
def fetch_buffer(self, *, timeout=0, is_raw=False): """ Fetches the latest :class:`Buffer` object and returns it. :param timeout: Set timeout value in second. :param is_raw: Set :const:`True` if you need a raw GenTL Buffer module. :return: A :class:`Buffer` object. """ ...
def fetch_buffer(self, *, timeout=0, is_raw=False): """ Fetches the latest :class:`Buffer` object and returns it. :param timeout: Set timeout value in second. :param is_raw: Set :const:`True` if you need a raw GenTL Buffer module. :return: A :class:`Buffer` object. """ ...
[ "Fetches", "the", "latest", ":", "class", ":", "Buffer", "object", "and", "returns", "it", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L1812-L1861
[ "def", "fetch_buffer", "(", "self", ",", "*", ",", "timeout", "=", "0", ",", "is_raw", "=", "False", ")", ":", "if", "not", "self", ".", "is_acquiring_images", ":", "raise", "TimeoutException", "watch_timeout", "=", "True", "if", "timeout", ">", "0", "el...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
ImageAcquirer.stop_image_acquisition
Stops image acquisition. :return: None.
src/harvesters/core.py
def stop_image_acquisition(self): """ Stops image acquisition. :return: None. """ if self.is_acquiring_images: # self._is_acquiring_images = False # if self.thread_image_acquisition.is_running: # TODO self.thread_...
def stop_image_acquisition(self): """ Stops image acquisition. :return: None. """ if self.is_acquiring_images: # self._is_acquiring_images = False # if self.thread_image_acquisition.is_running: # TODO self.thread_...
[ "Stops", "image", "acquisition", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L1950-L2010
[ "def", "stop_image_acquisition", "(", "self", ")", ":", "if", "self", ".", "is_acquiring_images", ":", "#", "self", ".", "_is_acquiring_images", "=", "False", "#", "if", "self", ".", "thread_image_acquisition", ".", "is_running", ":", "# TODO", "self", ".", "t...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Harvester.add_cti_file
Adds a CTI file to work with to the CTI file list. :param file_path: Set a file path to the target CTI file. :return: None.
src/harvesters/core.py
def add_cti_file(self, file_path: str): """ Adds a CTI file to work with to the CTI file list. :param file_path: Set a file path to the target CTI file. :return: None. """ if not os.path.exists(file_path): self._logger.warning( 'Attempted to ...
def add_cti_file(self, file_path: str): """ Adds a CTI file to work with to the CTI file list. :param file_path: Set a file path to the target CTI file. :return: None. """ if not os.path.exists(file_path): self._logger.warning( 'Attempted to ...
[ "Adds", "a", "CTI", "file", "to", "work", "with", "to", "the", "CTI", "file", "list", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L2402-L2419
[ "def", "add_cti_file", "(", "self", ",", "file_path", ":", "str", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "file_path", ")", ":", "self", ".", "_logger", ".", "warning", "(", "'Attempted to add {0} which does not exist.'", ".", "format",...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Harvester.remove_cti_file
Removes the specified CTI file from the CTI file list. :param file_path: Set a file path to the target CTI file. :return: None.
src/harvesters/core.py
def remove_cti_file(self, file_path: str): """ Removes the specified CTI file from the CTI file list. :param file_path: Set a file path to the target CTI file. :return: None. """ if file_path in self._cti_files: self._cti_files.remove(file_path) ...
def remove_cti_file(self, file_path: str): """ Removes the specified CTI file from the CTI file list. :param file_path: Set a file path to the target CTI file. :return: None. """ if file_path in self._cti_files: self._cti_files.remove(file_path) ...
[ "Removes", "the", "specified", "CTI", "file", "from", "the", "CTI", "file", "list", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L2421-L2433
[ "def", "remove_cti_file", "(", "self", ",", "file_path", ":", "str", ")", ":", "if", "file_path", "in", "self", ".", "_cti_files", ":", "self", ".", "_cti_files", ".", "remove", "(", "file_path", ")", "self", ".", "_logger", ".", "info", "(", "'Removed {...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Harvester._reset
Initializes the :class:`Harvester` object. Once you reset the :class:`Harvester` object, all allocated resources, including buffers and remote device, will be released. :return: None.
src/harvesters/core.py
def _reset(self): """ Initializes the :class:`Harvester` object. Once you reset the :class:`Harvester` object, all allocated resources, including buffers and remote device, will be released. :return: None. """ # for ia in self._ias: ia._destro...
def _reset(self): """ Initializes the :class:`Harvester` object. Once you reset the :class:`Harvester` object, all allocated resources, including buffers and remote device, will be released. :return: None. """ # for ia in self._ias: ia._destro...
[ "Initializes", "the", ":", "class", ":", "Harvester", "object", ".", "Once", "you", "reset", "the", ":", "class", ":", "Harvester", "object", "all", "allocated", "resources", "including", "buffers", "and", "remote", "device", "will", "be", "released", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L2486-L2509
[ "def", "_reset", "(", "self", ")", ":", "#", "for", "ia", "in", "self", ".", "_ias", ":", "ia", ".", "_destroy", "(", ")", "self", ".", "_ias", ".", "clear", "(", ")", "#", "self", ".", "_logger", ".", "info", "(", "'Started resetting the Harvester o...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Harvester.update_device_info_list
Updates the device information list. You'll have to call this method every time you added CTI files or plugged/unplugged devices. :return: None.
src/harvesters/core.py
def update_device_info_list(self): """ Updates the device information list. You'll have to call this method every time you added CTI files or plugged/unplugged devices. :return: None. """ # self._release_gentl_producers() try: self._open_gent...
def update_device_info_list(self): """ Updates the device information list. You'll have to call this method every time you added CTI files or plugged/unplugged devices. :return: None. """ # self._release_gentl_producers() try: self._open_gent...
[ "Updates", "the", "device", "information", "list", ".", "You", "ll", "have", "to", "call", "this", "method", "every", "time", "you", "added", "CTI", "files", "or", "plugged", "/", "unplugged", "devices", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L2564-L2609
[ "def", "update_device_info_list", "(", "self", ")", ":", "#", "self", ".", "_release_gentl_producers", "(", ")", "try", ":", "self", ".", "_open_gentl_producers", "(", ")", "self", ".", "_open_systems", "(", ")", "#", "for", "system", "in", "self", ".", "_...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
Harvester._destroy_image_acquirer
Releases all external resources including the controlling device.
src/harvesters/core.py
def _destroy_image_acquirer(self, ia): """ Releases all external resources including the controlling device. """ id_ = None if ia.device: # ia.stop_image_acquisition() # ia._release_data_streams() # id_ = ...
def _destroy_image_acquirer(self, ia): """ Releases all external resources including the controlling device. """ id_ = None if ia.device: # ia.stop_image_acquisition() # ia._release_data_streams() # id_ = ...
[ "Releases", "all", "external", "resources", "including", "the", "controlling", "device", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/core.py#L2611-L2669
[ "def", "_destroy_image_acquirer", "(", "self", ",", "ia", ")", ":", "id_", "=", "None", "if", "ia", ".", "device", ":", "#", "ia", ".", "stop_image_acquisition", "(", ")", "#", "ia", ".", "_release_data_streams", "(", ")", "#", "id_", "=", "ia", ".", ...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
is_running_on_macos
Returns a truth value for a proposition: "the program is running on a macOS machine". :rtype: bool
src/harvesters/_private/core/helper/system.py
def is_running_on_macos(): """ Returns a truth value for a proposition: "the program is running on a macOS machine". :rtype: bool """ pattern = re.compile('darwin', re.IGNORECASE) return False if not pattern.search(platform.platform()) else True
def is_running_on_macos(): """ Returns a truth value for a proposition: "the program is running on a macOS machine". :rtype: bool """ pattern = re.compile('darwin', re.IGNORECASE) return False if not pattern.search(platform.platform()) else True
[ "Returns", "a", "truth", "value", "for", "a", "proposition", ":", "the", "program", "is", "running", "on", "a", "macOS", "machine", "." ]
genicam/harvesters
python
https://github.com/genicam/harvesters/blob/c3314a7f9d320bbf943e599aabac02521cd8e80b/src/harvesters/_private/core/helper/system.py#L30-L38
[ "def", "is_running_on_macos", "(", ")", ":", "pattern", "=", "re", ".", "compile", "(", "'darwin'", ",", "re", ".", "IGNORECASE", ")", "return", "False", "if", "not", "pattern", ".", "search", "(", "platform", ".", "platform", "(", ")", ")", "else", "T...
c3314a7f9d320bbf943e599aabac02521cd8e80b
valid
get_sha1_signature
用 SHA1 算法生成安全签名 @param token: 票据 @param timestamp: 时间戳 @param encrypt: 密文 @param nonce: 随机字符串 @return: 安全签名
wechat_sdk/lib/crypto/utils.py
def get_sha1_signature(token, timestamp, nonce, encrypt): """ 用 SHA1 算法生成安全签名 @param token: 票据 @param timestamp: 时间戳 @param encrypt: 密文 @param nonce: 随机字符串 @return: 安全签名 """ try: sortlist = [token, timestamp, nonce, to_binary(encrypt)] sortlist.sort() sha = h...
def get_sha1_signature(token, timestamp, nonce, encrypt): """ 用 SHA1 算法生成安全签名 @param token: 票据 @param timestamp: 时间戳 @param encrypt: 密文 @param nonce: 随机字符串 @return: 安全签名 """ try: sortlist = [token, timestamp, nonce, to_binary(encrypt)] sortlist.sort() sha = h...
[ "用", "SHA1", "算法生成安全签名" ]
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/lib/crypto/utils.py#L9-L26
[ "def", "get_sha1_signature", "(", "token", ",", "timestamp", ",", "nonce", ",", "encrypt", ")", ":", "try", ":", "sortlist", "=", "[", "token", ",", "timestamp", ",", "nonce", ",", "to_binary", "(", "encrypt", ")", "]", "sortlist", ".", "sort", "(", ")...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.login
登录微信公众平台 注意在实例化 ``WechatExt`` 的时候,如果没有传入 ``token`` 及 ``cookies`` ,将会自动调用该方法,无需手动调用 当且仅当捕获到 ``NeedLoginError`` 异常时才需要调用此方法进行登录重试 :param verify_code: 验证码, 不传入则为无验证码 :raises LoginVerifyCodeError: 需要验证码或验证码出错,该异常为 ``LoginError`` 的子类 :raises LoginError: 登录出错异常,异常内容为微信服务器响应的内容,可作为日志记录下...
wechat_sdk/ext.py
def login(self, verify_code=''): """ 登录微信公众平台 注意在实例化 ``WechatExt`` 的时候,如果没有传入 ``token`` 及 ``cookies`` ,将会自动调用该方法,无需手动调用 当且仅当捕获到 ``NeedLoginError`` 异常时才需要调用此方法进行登录重试 :param verify_code: 验证码, 不传入则为无验证码 :raises LoginVerifyCodeError: 需要验证码或验证码出错,该异常为 ``LoginError`` 的子类 ...
def login(self, verify_code=''): """ 登录微信公众平台 注意在实例化 ``WechatExt`` 的时候,如果没有传入 ``token`` 及 ``cookies`` ,将会自动调用该方法,无需手动调用 当且仅当捕获到 ``NeedLoginError`` 异常时才需要调用此方法进行登录重试 :param verify_code: 验证码, 不传入则为无验证码 :raises LoginVerifyCodeError: 需要验证码或验证码出错,该异常为 ``LoginError`` 的子类 ...
[ "登录微信公众平台", "注意在实例化", "WechatExt", "的时候,如果没有传入", "token", "及", "cookies", ",将会自动调用该方法,无需手动调用", "当且仅当捕获到", "NeedLoginError", "异常时才需要调用此方法进行登录重试", ":", "param", "verify_code", ":", "验证码", "不传入则为无验证码", ":", "raises", "LoginVerifyCodeError", ":", "需要验证码或验证码出错,该异常为", "LoginErr...
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L62-L102
[ "def", "login", "(", "self", ",", "verify_code", "=", "''", ")", ":", "url", "=", "'https://mp.weixin.qq.com/cgi-bin/login'", "payload", "=", "{", "'username'", ":", "self", ".", "__username", ",", "'pwd'", ":", "self", ".", "__password", ",", "'imgcode'", "...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.get_verify_code
获取登录验证码并存储 :param file_path: 将验证码图片保存的文件路径
wechat_sdk/ext.py
def get_verify_code(self, file_path): """ 获取登录验证码并存储 :param file_path: 将验证码图片保存的文件路径 """ url = 'https://mp.weixin.qq.com/cgi-bin/verifycode' payload = { 'username': self.__username, 'r': int(random.random() * 10000000000000), } head...
def get_verify_code(self, file_path): """ 获取登录验证码并存储 :param file_path: 将验证码图片保存的文件路径 """ url = 'https://mp.weixin.qq.com/cgi-bin/verifycode' payload = { 'username': self.__username, 'r': int(random.random() * 10000000000000), } head...
[ "获取登录验证码并存储", ":", "param", "file_path", ":", "将验证码图片保存的文件路径" ]
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L104-L125
[ "def", "get_verify_code", "(", "self", ",", "file_path", ")", ":", "url", "=", "'https://mp.weixin.qq.com/cgi-bin/verifycode'", "payload", "=", "{", "'username'", ":", "self", ".", "__username", ",", "'r'", ":", "int", "(", "random", ".", "random", "(", ")", ...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.send_message
主动发送文本消息 :param fakeid: 用户的 UID (即 fakeid ) :param content: 发送的内容 :raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 :raises ValueError: 参数出错, 具体内容有 ``fake id not exist``
wechat_sdk/ext.py
def send_message(self, fakeid, content): """ 主动发送文本消息 :param fakeid: 用户的 UID (即 fakeid ) :param content: 发送的内容 :raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 :raises ValueError: 参数出错, 具体内容有 ``fake id not exist`` """ url = 'https://mp.weixin.qq....
def send_message(self, fakeid, content): """ 主动发送文本消息 :param fakeid: 用户的 UID (即 fakeid ) :param content: 发送的内容 :raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 :raises ValueError: 参数出错, 具体内容有 ``fake id not exist`` """ url = 'https://mp.weixin.qq....
[ "主动发送文本消息", ":", "param", "fakeid", ":", "用户的", "UID", "(", "即", "fakeid", ")", ":", "param", "content", ":", "发送的内容", ":", "raises", "NeedLoginError", ":", "操作未执行成功", "需要再次尝试登录", "异常内容为服务器返回的错误数据", ":", "raises", "ValueError", ":", "参数出错", "具体内容有", "fake", ...
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L165-L201
[ "def", "send_message", "(", "self", ",", "fakeid", ",", "content", ")", ":", "url", "=", "'https://mp.weixin.qq.com/cgi-bin/singlesend?t=ajax-response'", "payload", "=", "{", "'tofakeid'", ":", "fakeid", ",", "'type'", ":", "1", ",", "'token'", ":", "self", ".",...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.get_user_list
获取用户列表 返回JSON示例 :: { "contacts": [ { "id": 2431798261, "nick_name": "Doraemonext", "remark_name": "", "group_id": 0 }, { ...
wechat_sdk/ext.py
def get_user_list(self, page=0, pagesize=10, groupid=0): """ 获取用户列表 返回JSON示例 :: { "contacts": [ { "id": 2431798261, "nick_name": "Doraemonext", "remark_name": "", ...
def get_user_list(self, page=0, pagesize=10, groupid=0): """ 获取用户列表 返回JSON示例 :: { "contacts": [ { "id": 2431798261, "nick_name": "Doraemonext", "remark_name": "", ...
[ "获取用户列表" ]
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L203-L254
[ "def", "get_user_list", "(", "self", ",", "page", "=", "0", ",", "pagesize", "=", "10", ",", "groupid", "=", "0", ")", ":", "url", "=", "'https://mp.weixin.qq.com/cgi-bin/contactmanage?t=user/index&pagesize={pagesize}&pageidx={page}&type=0&groupid={groupid}&lang=zh_CN&f=json&...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.stat_article_detail_list
获取图文分析数据 返回JSON示例 :: { "hasMore": true, // 说明是否可以增加 page 页码来获取数据 "data": [ { "index": [ "20,816", // 送达人数 "1,944", // 图文页阅读人数 "2,554", ...
wechat_sdk/ext.py
def stat_article_detail_list(self, page=1, start_date=str(date.today()+timedelta(days=-30)), end_date=str(date.today())): """ 获取图文分析数据 返回JSON示例 :: { "hasMore": true, // 说明是否可以增加 page 页码来获取数据 "data": [ { "i...
def stat_article_detail_list(self, page=1, start_date=str(date.today()+timedelta(days=-30)), end_date=str(date.today())): """ 获取图文分析数据 返回JSON示例 :: { "hasMore": true, // 说明是否可以增加 page 页码来获取数据 "data": [ { "i...
[ "获取图文分析数据" ]
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L256-L364
[ "def", "stat_article_detail_list", "(", "self", ",", "page", "=", "1", ",", "start_date", "=", "str", "(", "date", ".", "today", "(", ")", "+", "timedelta", "(", "days", "=", "-", "30", ")", ")", ",", "end_date", "=", "str", "(", "date", ".", "toda...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.get_group_list
获取分组列表 返回JSON示例:: { "groups": [ { "cnt": 8, "id": 0, "name": "未分组" }, { "cnt": 0, "id": 1, ...
wechat_sdk/ext.py
def get_group_list(self): """ 获取分组列表 返回JSON示例:: { "groups": [ { "cnt": 8, "id": 0, "name": "未分组" }, { "cnt": 0...
def get_group_list(self): """ 获取分组列表 返回JSON示例:: { "groups": [ { "cnt": 8, "id": 0, "name": "未分组" }, { "cnt": 0...
[ "获取分组列表" ]
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L366-L412
[ "def", "get_group_list", "(", "self", ")", ":", "url", "=", "'https://mp.weixin.qq.com/cgi-bin/contactmanage?t=user/index&pagesize=10&pageidx=0&type=0&groupid=0&lang=zh_CN&f=json&token={token}'", ".", "format", "(", "token", "=", "self", ".", "__token", ",", ")", "headers", "...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.get_news_list
获取图文信息列表 返回JSON示例:: [ { "multi_item": [ { "seq": 0, "title": "98路公交线路", "show_cover_pic": 1, "author": "", ...
wechat_sdk/ext.py
def get_news_list(self, page, pagesize=10): """ 获取图文信息列表 返回JSON示例:: [ { "multi_item": [ { "seq": 0, "title": "98路公交线路", "show_cover_pic": ...
def get_news_list(self, page, pagesize=10): """ 获取图文信息列表 返回JSON示例:: [ { "multi_item": [ { "seq": 0, "title": "98路公交线路", "show_cover_pic": ...
[ "获取图文信息列表" ]
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L414-L532
[ "def", "get_news_list", "(", "self", ",", "page", ",", "pagesize", "=", "10", ")", ":", "begin", "=", "page", "*", "pagesize", "url", "=", "\"https://mp.weixin.qq.com/cgi-bin/appmsg?token={token}&lang=zh_CN&type=10&action=list&begin={begin}&count={pagesize}&f=json&random={rando...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.get_dialog_message
获取与指定用户的对话内容, 获取的内容由 ``last_msgid`` (需要获取的对话中时间最早的 **公众号发送给用户** 的消息ID) 和 ``create_time`` (需要获取的对话中时间最早的消息时间戳) 进行过滤 消息过滤规则: 1. 首先按照 ``last_msgid`` 过滤 (不需要按照 ``last_msgid`` 过滤则不需要传入此参数) a. ``fakeid`` 为用户 UID b. 通过 ``last_msgid`` 去匹配公众号过去发送给用户的某一条消息 c. 如果匹配成功, 则返回这条消息...
wechat_sdk/ext.py
def get_dialog_message(self, fakeid, last_msgid=0, create_time=0): """ 获取与指定用户的对话内容, 获取的内容由 ``last_msgid`` (需要获取的对话中时间最早的 **公众号发送给用户** 的消息ID) 和 ``create_time`` (需要获取的对话中时间最早的消息时间戳) 进行过滤 消息过滤规则: 1. 首先按照 ``last_msgid`` 过滤 (不需要按照 ``last_msgid`` 过滤则不需要传入此参数) a. ``fakeid`` 为用户 ...
def get_dialog_message(self, fakeid, last_msgid=0, create_time=0): """ 获取与指定用户的对话内容, 获取的内容由 ``last_msgid`` (需要获取的对话中时间最早的 **公众号发送给用户** 的消息ID) 和 ``create_time`` (需要获取的对话中时间最早的消息时间戳) 进行过滤 消息过滤规则: 1. 首先按照 ``last_msgid`` 过滤 (不需要按照 ``last_msgid`` 过滤则不需要传入此参数) a. ``fakeid`` 为用户 ...
[ "获取与指定用户的对话内容", "获取的内容由", "last_msgid", "(", "需要获取的对话中时间最早的", "**", "公众号发送给用户", "**", "的消息ID", ")", "和", "create_time", "(", "需要获取的对话中时间最早的消息时间戳", ")", "进行过滤" ]
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L534-L645
[ "def", "get_dialog_message", "(", "self", ",", "fakeid", ",", "last_msgid", "=", "0", ",", "create_time", "=", "0", ")", ":", "self", ".", "_init_fakeid", "(", ")", "url", "=", "'https://mp.weixin.qq.com/cgi-bin/singlesendpage?tofakeid={fakeid}&action=sync&lastmsgfromfa...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.send_news
向指定用户发送图文消息 (必须从图文库里选取消息ID传入) :param fakeid: 用户的 UID (即 fakeid) :param msgid: 图文消息 ID :raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 :raises ValueError: 参数出错, 具体内容有 ``fake id not exist`` 及 ``message id not exist``
wechat_sdk/ext.py
def send_news(self, fakeid, msgid): """ 向指定用户发送图文消息 (必须从图文库里选取消息ID传入) :param fakeid: 用户的 UID (即 fakeid) :param msgid: 图文消息 ID :raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 :raises ValueError: 参数出错, 具体内容有 ``fake id not exist`` 及 ``message id not exist`` ...
def send_news(self, fakeid, msgid): """ 向指定用户发送图文消息 (必须从图文库里选取消息ID传入) :param fakeid: 用户的 UID (即 fakeid) :param msgid: 图文消息 ID :raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据 :raises ValueError: 参数出错, 具体内容有 ``fake id not exist`` 及 ``message id not exist`` ...
[ "向指定用户发送图文消息", "(必须从图文库里选取消息ID传入", ")", ":", "param", "fakeid", ":", "用户的", "UID", "(", "即", "fakeid", ")", ":", "param", "msgid", ":", "图文消息", "ID", ":", "raises", "NeedLoginError", ":", "操作未执行成功", "需要再次尝试登录", "异常内容为服务器返回的错误数据", ":", "raises", "ValueError", ...
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L647-L689
[ "def", "send_news", "(", "self", ",", "fakeid", ",", "msgid", ")", ":", "url", "=", "'https://mp.weixin.qq.com/cgi-bin/singlesend?t=ajax-response'", "payload", "=", "{", "'lang'", ":", "'zh_CN'", ",", "'f'", ":", "'json'", ",", "'tofakeid'", ":", "fakeid", ",", ...
bf6f6f3d4a5440feb73a51937059d7feddc335a0
valid
WechatExt.add_news
在素材库中创建图文消息 :param news: list 对象, 其中的每个元素为一个 dict 对象, 代表一条图文, key 值分别为 ``title``, ``author``, ``summary``, ``content``, ``picture_id``, ``from_url``, 对应内容为标题, 作者, 摘要, 内容, 素材库里的 图片ID(可通过 ``upload_file`` 函数上传获取), 来源链接。 其中必须提供的 key 值为 ``title`` 和 ``c...
wechat_sdk/ext.py
def add_news(self, news): """ 在素材库中创建图文消息 :param news: list 对象, 其中的每个元素为一个 dict 对象, 代表一条图文, key 值分别为 ``title``, ``author``, ``summary``, ``content``, ``picture_id``, ``from_url``, 对应内容为标题, 作者, 摘要, 内容, 素材库里的 图片ID(可通过 ``upload_file`` 函数上传获取), 来源链接。 ...
def add_news(self, news): """ 在素材库中创建图文消息 :param news: list 对象, 其中的每个元素为一个 dict 对象, 代表一条图文, key 值分别为 ``title``, ``author``, ``summary``, ``content``, ``picture_id``, ``from_url``, 对应内容为标题, 作者, 摘要, 内容, 素材库里的 图片ID(可通过 ``upload_file`` 函数上传获取), 来源链接。 ...
[ "在素材库中创建图文消息" ]
doraemonext/wechat-python-sdk
python
https://github.com/doraemonext/wechat-python-sdk/blob/bf6f6f3d4a5440feb73a51937059d7feddc335a0/wechat_sdk/ext.py#L691-L764
[ "def", "add_news", "(", "self", ",", "news", ")", ":", "if", "not", "news", ":", "raise", "ValueError", "(", "'The news cannot be empty'", ")", "for", "item", "in", "news", ":", "if", "'title'", "not", "in", "item", "or", "'content'", "not", "in", "item"...
bf6f6f3d4a5440feb73a51937059d7feddc335a0