Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
1,500
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_items_of_reminder
def get_all_items_of_reminder(self, reminder_id): """ Get all items of reminder This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param reminder_id: the reminder id :return: lis...
python
def get_all_items_of_reminder(self, reminder_id): """ Get all items of reminder This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param reminder_id: the reminder id :return: lis...
['def', 'get_all_items_of_reminder', '(', 'self', ',', 'reminder_id', ')', ':', 'return', 'self', '.', '_iterate_through_pages', '(', 'get_function', '=', 'self', '.', 'get_items_of_reminder_per_page', ',', 'resource', '=', 'REMINDER_ITEMS', ',', '*', '*', '{', "'reminder_id'", ':', 'reminder_id', '}', ')']
Get all items of reminder This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param reminder_id: the reminder id :return: list
['Get', 'all', 'items', 'of', 'reminder', 'This', 'will', 'iterate', 'over', 'all', 'pages', 'until', 'it', 'gets', 'all', 'elements', '.', 'So', 'if', 'the', 'rate', 'limit', 'exceeded', 'it', 'will', 'throw', 'an', 'Exception', 'and', 'you', 'will', 'get', 'nothing']
train
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3368-L3381
1,501
cltl/KafNafParserPy
KafNafParserPy/KafNafParserMod.py
KafNafParser.remove_properties
def remove_properties(self): """ Removes the property layer (if exists) of the object (in memory) """ if self.features_layer is not None: self.features_layer.remove_properties() if self.header is not None: self.header.remove_lp('features')
python
def remove_properties(self): """ Removes the property layer (if exists) of the object (in memory) """ if self.features_layer is not None: self.features_layer.remove_properties() if self.header is not None: self.header.remove_lp('features')
['def', 'remove_properties', '(', 'self', ')', ':', 'if', 'self', '.', 'features_layer', 'is', 'not', 'None', ':', 'self', '.', 'features_layer', '.', 'remove_properties', '(', ')', 'if', 'self', '.', 'header', 'is', 'not', 'None', ':', 'self', '.', 'header', '.', 'remove_lp', '(', "'features'", ')']
Removes the property layer (if exists) of the object (in memory)
['Removes', 'the', 'property', 'layer', '(', 'if', 'exists', ')', 'of', 'the', 'object', '(', 'in', 'memory', ')']
train
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/KafNafParserMod.py#L828-L836
1,502
ninuxorg/nodeshot
nodeshot/interop/oldimporter/management/commands/import_old_nodeshot.py
Command.import_users
def import_users(self): """ save users to local DB """ self.message('saving users into local DB') saved_users = self.saved_admins # loop over all extracted unique email addresses for email in self.email_set: owner = self.users_dict[email].get('owner') #...
python
def import_users(self): """ save users to local DB """ self.message('saving users into local DB') saved_users = self.saved_admins # loop over all extracted unique email addresses for email in self.email_set: owner = self.users_dict[email].get('owner') #...
['def', 'import_users', '(', 'self', ')', ':', 'self', '.', 'message', '(', "'saving users into local DB'", ')', 'saved_users', '=', 'self', '.', 'saved_admins', '# loop over all extracted unique email addresses', 'for', 'email', 'in', 'self', '.', 'email_set', ':', 'owner', '=', 'self', '.', 'users_dict', '[', 'email'...
save users to local DB
['save', 'users', 'to', 'local', 'DB']
train
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/interop/oldimporter/management/commands/import_old_nodeshot.py#L392-L486
1,503
materialsproject/pymatgen
pymatgen/analysis/structure_prediction/dopant_predictor.py
get_dopants_from_shannon_radii
def get_dopants_from_shannon_radii(bonded_structure, num_dopants=5, match_oxi_sign=False): """ Get dopant suggestions based on Shannon radii differences. Args: bonded_structure (StructureGraph): A pymatgen structure graph decorated with oxidation state...
python
def get_dopants_from_shannon_radii(bonded_structure, num_dopants=5, match_oxi_sign=False): """ Get dopant suggestions based on Shannon radii differences. Args: bonded_structure (StructureGraph): A pymatgen structure graph decorated with oxidation state...
['def', 'get_dopants_from_shannon_radii', '(', 'bonded_structure', ',', 'num_dopants', '=', '5', ',', 'match_oxi_sign', '=', 'False', ')', ':', '# get a list of all Specie for all elements in all their common oxid states', 'all_species', '=', '[', 'Specie', '(', 'el', ',', 'oxi', ')', 'for', 'el', 'in', 'Element', 'for...
Get dopant suggestions based on Shannon radii differences. Args: bonded_structure (StructureGraph): A pymatgen structure graph decorated with oxidation states. For example, generated using the CrystalNN.get_bonded_structure() method. num_dopants (int): The nummber of suggest...
['Get', 'dopant', 'suggestions', 'based', 'on', 'Shannon', 'radii', 'differences', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_prediction/dopant_predictor.py#L54-L114
1,504
DataDog/integrations-core
network/datadog_checks/network/network.py
Network._add_conntrack_stats_metrics
def _add_conntrack_stats_metrics(self, conntrack_path, tags): """ Parse the output of conntrack -S Add the parsed metrics """ try: output, _, _ = get_subprocess_output(["sudo", conntrack_path, "-S"], self.log) # conntrack -S sample: # cpu=0 fou...
python
def _add_conntrack_stats_metrics(self, conntrack_path, tags): """ Parse the output of conntrack -S Add the parsed metrics """ try: output, _, _ = get_subprocess_output(["sudo", conntrack_path, "-S"], self.log) # conntrack -S sample: # cpu=0 fou...
['def', '_add_conntrack_stats_metrics', '(', 'self', ',', 'conntrack_path', ',', 'tags', ')', ':', 'try', ':', 'output', ',', '_', ',', '_', '=', 'get_subprocess_output', '(', '[', '"sudo"', ',', 'conntrack_path', ',', '"-S"', ']', ',', 'self', '.', 'log', ')', '# conntrack -S sample:', '# cpu=0 found=27644 invalid=190...
Parse the output of conntrack -S Add the parsed metrics
['Parse', 'the', 'output', 'of', 'conntrack', '-', 'S', 'Add', 'the', 'parsed', 'metrics']
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/network/datadog_checks/network/network.py#L462-L487
1,505
pyBookshelf/bookshelf
bookshelf/api_v1.py
enable_mesos_basic_authentication
def enable_mesos_basic_authentication(principal, password): """ enables and adds a new authorized principal """ restart = False secrets_file = '/etc/mesos/secrets' secrets_entry = '%s %s' % (principal, password) if not file_contains(filename=secrets_file, text=secrets_entry,...
python
def enable_mesos_basic_authentication(principal, password): """ enables and adds a new authorized principal """ restart = False secrets_file = '/etc/mesos/secrets' secrets_entry = '%s %s' % (principal, password) if not file_contains(filename=secrets_file, text=secrets_entry,...
['def', 'enable_mesos_basic_authentication', '(', 'principal', ',', 'password', ')', ':', 'restart', '=', 'False', 'secrets_file', '=', "'/etc/mesos/secrets'", 'secrets_entry', '=', "'%s %s'", '%', '(', 'principal', ',', 'password', ')', 'if', 'not', 'file_contains', '(', 'filename', '=', 'secrets_file', ',', 'text', '...
enables and adds a new authorized principal
['enables', 'and', 'adds', 'a', 'new', 'authorized', 'principal']
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v1.py#L965-L990
1,506
titusjan/argos
argos/config/abstractcti.py
jsonAsCti
def jsonAsCti(dct): """ Config tree item JSON decoding function. Returns a CTI given a dictionary of attributes. The full class name of desired CTI class should be in dct['_class_'']. """ if '_class_'in dct: full_class_name = dct['_class_'] # TODO: how to handle the full_class_name? ...
python
def jsonAsCti(dct): """ Config tree item JSON decoding function. Returns a CTI given a dictionary of attributes. The full class name of desired CTI class should be in dct['_class_'']. """ if '_class_'in dct: full_class_name = dct['_class_'] # TODO: how to handle the full_class_name? ...
['def', 'jsonAsCti', '(', 'dct', ')', ':', 'if', "'_class_'", 'in', 'dct', ':', 'full_class_name', '=', 'dct', '[', "'_class_'", ']', '# TODO: how to handle the full_class_name?', 'cls', '=', 'import_symbol', '(', 'full_class_name', ')', 'return', 'cls', '.', 'createFromJsonDict', '(', 'dct', ')', 'else', ':', 'return'...
Config tree item JSON decoding function. Returns a CTI given a dictionary of attributes. The full class name of desired CTI class should be in dct['_class_''].
['Config', 'tree', 'item', 'JSON', 'decoding', 'function', '.', 'Returns', 'a', 'CTI', 'given', 'a', 'dictionary', 'of', 'attributes', '.', 'The', 'full', 'class', 'name', 'of', 'desired', 'CTI', 'class', 'should', 'be', 'in', 'dct', '[', '_class_', ']', '.']
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/abstractcti.py#L64-L73
1,507
openpermissions/perch
perch/migrations/user_22e76f4ff8bd41e19aa52839fc8f13a1.py
migrate_user
def migrate_user(instance): """ Move User.organisations['global']['role'] to top-level property and remove verified flag """ instance._resource.pop('verified', None) if 'role' in instance._resource: return instance global_org = instance.organisations.pop('global', {}) instance....
python
def migrate_user(instance): """ Move User.organisations['global']['role'] to top-level property and remove verified flag """ instance._resource.pop('verified', None) if 'role' in instance._resource: return instance global_org = instance.organisations.pop('global', {}) instance....
['def', 'migrate_user', '(', 'instance', ')', ':', 'instance', '.', '_resource', '.', 'pop', '(', "'verified'", ',', 'None', ')', 'if', "'role'", 'in', 'instance', '.', '_resource', ':', 'return', 'instance', 'global_org', '=', 'instance', '.', 'organisations', '.', 'pop', '(', "'global'", ',', '{', '}', ')', 'instance...
Move User.organisations['global']['role'] to top-level property and remove verified flag
['Move', 'User', '.', 'organisations', '[', 'global', ']', '[', 'role', ']', 'to', 'top', '-', 'level', 'property', 'and', 'remove', 'verified', 'flag']
train
https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/migrations/user_22e76f4ff8bd41e19aa52839fc8f13a1.py#L10-L23
1,508
hazelcast/hazelcast-python-client
hazelcast/proxy/multi_map.py
MultiMap.contains_key
def contains_key(self, key): """ Determines whether this multimap contains an entry with the key. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (obje...
python
def contains_key(self, key): """ Determines whether this multimap contains an entry with the key. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (obje...
['def', 'contains_key', '(', 'self', ',', 'key', ')', ':', 'check_not_none', '(', 'key', ',', '"key can\'t be None"', ')', 'key_data', '=', 'self', '.', '_to_data', '(', 'key', ')', 'return', 'self', '.', '_encode_invoke_on_key', '(', 'multi_map_contains_key_codec', ',', 'key_data', ',', 'key', '=', 'key_data', ',', 't...
Determines whether this multimap contains an entry with the key. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's class.** :param key: (object), the specified key. :return: (bool), ...
['Determines', 'whether', 'this', 'multimap', 'contains', 'an', 'entry', 'with', 'the', 'key', '.']
train
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/proxy/multi_map.py#L55-L68
1,509
morpframework/morpfw
morpfw/interfaces.py
IStorageBase.search
def search(self, query: Optional[dict] = None, offset: Optional[int] = None, limit: Optional[int] = None, order_by: Union[None, list, tuple] = None) -> Sequence['IModel']: """return search result based on specified rulez query""" raise NotImplementedError
python
def search(self, query: Optional[dict] = None, offset: Optional[int] = None, limit: Optional[int] = None, order_by: Union[None, list, tuple] = None) -> Sequence['IModel']: """return search result based on specified rulez query""" raise NotImplementedError
['def', 'search', '(', 'self', ',', 'query', ':', 'Optional', '[', 'dict', ']', '=', 'None', ',', 'offset', ':', 'Optional', '[', 'int', ']', '=', 'None', ',', 'limit', ':', 'Optional', '[', 'int', ']', '=', 'None', ',', 'order_by', ':', 'Union', '[', 'None', ',', 'list', ',', 'tuple', ']', '=', 'None', ')', '->', 'Seq...
return search result based on specified rulez query
['return', 'search', 'result', 'based', 'on', 'specified', 'rulez', 'query']
train
https://github.com/morpframework/morpfw/blob/803fbf29714e6f29456482f1cfbdbd4922b020b0/morpfw/interfaces.py#L137-L141
1,510
ninuxorg/nodeshot
nodeshot/community/mailing/models/outward.py
Outward.get_recipients
def get_recipients(self): """ Determine recipients depending on selected filtering which can be either: * group based * layer based * user based Choosing "group" and "layer" filtering together has the effect of sending the message only to users for wh...
python
def get_recipients(self): """ Determine recipients depending on selected filtering which can be either: * group based * layer based * user based Choosing "group" and "layer" filtering together has the effect of sending the message only to users for wh...
['def', 'get_recipients', '(', 'self', ')', ':', '# user model', 'User', '=', 'get_user_model', '(', ')', '# prepare email list', 'emails', '=', '[', ']', '# the following code is a bit ugly. Considering the titanic amount of work required to build all', "# the cools functionalities that I have in my mind, I can't be b...
Determine recipients depending on selected filtering which can be either: * group based * layer based * user based Choosing "group" and "layer" filtering together has the effect of sending the message only to users for which the following conditions are both true: ...
['Determine', 'recipients', 'depending', 'on', 'selected', 'filtering', 'which', 'can', 'be', 'either', ':', '*', 'group', 'based', '*', 'layer', 'based', '*', 'user', 'based']
train
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/community/mailing/models/outward.py#L67-L166
1,511
Rapptz/discord.py
discord/guild.py
Guild.create_text_channel
async def create_text_channel(self, name, *, overwrites=None, category=None, reason=None, **options): """|coro| Creates a :class:`TextChannel` for the guild. Note that you need the :attr:`~Permissions.manage_channels` permission to create the channel. The ``overwrites`` parame...
python
async def create_text_channel(self, name, *, overwrites=None, category=None, reason=None, **options): """|coro| Creates a :class:`TextChannel` for the guild. Note that you need the :attr:`~Permissions.manage_channels` permission to create the channel. The ``overwrites`` parame...
['async', 'def', 'create_text_channel', '(', 'self', ',', 'name', ',', '*', ',', 'overwrites', '=', 'None', ',', 'category', '=', 'None', ',', 'reason', '=', 'None', ',', '*', '*', 'options', ')', ':', 'data', '=', 'await', 'self', '.', '_create_channel', '(', 'name', ',', 'overwrites', ',', 'ChannelType', '.', 'text',...
|coro| Creates a :class:`TextChannel` for the guild. Note that you need the :attr:`~Permissions.manage_channels` permission to create the channel. The ``overwrites`` parameter can be used to create a 'secret' channel upon creation. This parameter expects a :class:`dict` of ...
['|coro|']
train
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L622-L705
1,512
ipinfo/python
ipinfo/handler.py
Handler.getDetails
def getDetails(self, ip_address=None): """Get details for specified IP address as a Details object.""" raw_details = self._requestDetails(ip_address) raw_details['country_name'] = self.countries.get(raw_details.get('country')) raw_details['ip_address'] = ipaddress.ip_address(raw_details....
python
def getDetails(self, ip_address=None): """Get details for specified IP address as a Details object.""" raw_details = self._requestDetails(ip_address) raw_details['country_name'] = self.countries.get(raw_details.get('country')) raw_details['ip_address'] = ipaddress.ip_address(raw_details....
['def', 'getDetails', '(', 'self', ',', 'ip_address', '=', 'None', ')', ':', 'raw_details', '=', 'self', '.', '_requestDetails', '(', 'ip_address', ')', 'raw_details', '[', "'country_name'", ']', '=', 'self', '.', 'countries', '.', 'get', '(', 'raw_details', '.', 'get', '(', "'country'", ')', ')', 'raw_details', '[', "...
Get details for specified IP address as a Details object.
['Get', 'details', 'for', 'specified', 'IP', 'address', 'as', 'a', 'Details', 'object', '.']
train
https://github.com/ipinfo/python/blob/62fef9136069eab280806cc772dc578d3f1d8d63/ipinfo/handler.py#L44-L50
1,513
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py
MAVLink.simstate_encode
def simstate_encode(self, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lng): ''' Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) ...
python
def simstate_encode(self, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lng): ''' Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) ...
['def', 'simstate_encode', '(', 'self', ',', 'roll', ',', 'pitch', ',', 'yaw', ',', 'xacc', ',', 'yacc', ',', 'zacc', ',', 'xgyro', ',', 'ygyro', ',', 'zgyro', ',', 'lat', ',', 'lng', ')', ':', 'return', 'MAVLink_simstate_message', '(', 'roll', ',', 'pitch', ',', 'yaw', ',', 'xacc', ',', 'yacc', ',', 'zacc', ',', 'xgyr...
Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) xacc : X acceleration m/s/s (floa...
['Status', 'of', 'simulation', 'environment', 'if', 'used']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py#L10072-L10089
1,514
ceph/ceph-deploy
ceph_deploy/util/net.py
get_chacra_repo
def get_chacra_repo(shaman_url): """ From a Shaman URL, get the chacra url for a repository, read the contents that point to the repo and return it as a string. """ shaman_response = get_request(shaman_url) chacra_url = shaman_response.geturl() chacra_response = get_request(chacra_url) ...
python
def get_chacra_repo(shaman_url): """ From a Shaman URL, get the chacra url for a repository, read the contents that point to the repo and return it as a string. """ shaman_response = get_request(shaman_url) chacra_url = shaman_response.geturl() chacra_response = get_request(chacra_url) ...
['def', 'get_chacra_repo', '(', 'shaman_url', ')', ':', 'shaman_response', '=', 'get_request', '(', 'shaman_url', ')', 'chacra_url', '=', 'shaman_response', '.', 'geturl', '(', ')', 'chacra_response', '=', 'get_request', '(', 'chacra_url', ')', 'return', 'chacra_response', '.', 'read', '(', ')']
From a Shaman URL, get the chacra url for a repository, read the contents that point to the repo and return it as a string.
['From', 'a', 'Shaman', 'URL', 'get', 'the', 'chacra', 'url', 'for', 'a', 'repository', 'read', 'the', 'contents', 'that', 'point', 'to', 'the', 'repo', 'and', 'return', 'it', 'as', 'a', 'string', '.']
train
https://github.com/ceph/ceph-deploy/blob/86943fcc454cd4c99a86e3493e9e93a59c661fef/ceph_deploy/util/net.py#L390-L399
1,515
astropy/photutils
photutils/segmentation/core.py
SegmentationImage.segments
def segments(self): """ A list of `Segment` objects. The list starts with the *non-zero* label. The returned list has a length equal to the number of labels and matches the order of the ``labels`` attribute. """ segments = [] for label, slc in zip(self....
python
def segments(self): """ A list of `Segment` objects. The list starts with the *non-zero* label. The returned list has a length equal to the number of labels and matches the order of the ``labels`` attribute. """ segments = [] for label, slc in zip(self....
['def', 'segments', '(', 'self', ')', ':', 'segments', '=', '[', ']', 'for', 'label', ',', 'slc', 'in', 'zip', '(', 'self', '.', 'labels', ',', 'self', '.', 'slices', ')', ':', 'segments', '.', 'append', '(', 'Segment', '(', 'self', '.', 'data', ',', 'label', ',', 'slc', ',', 'self', '.', 'get_area', '(', 'label', ')',...
A list of `Segment` objects. The list starts with the *non-zero* label. The returned list has a length equal to the number of labels and matches the order of the ``labels`` attribute.
['A', 'list', 'of', 'Segment', 'objects', '.']
train
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L258-L271
1,516
zeroSteiner/AdvancedHTTPServer
advancedhttpserver.py
RequestHandler.guess_mime_type
def guess_mime_type(self, path): """ Guess an appropriate MIME type based on the extension of the provided path. :param str path: The of the file to analyze. :return: The guessed MIME type of the default if non are found. :rtype: str """ _, ext = posixpath.splitext(path) if ext in self.extensions_map...
python
def guess_mime_type(self, path): """ Guess an appropriate MIME type based on the extension of the provided path. :param str path: The of the file to analyze. :return: The guessed MIME type of the default if non are found. :rtype: str """ _, ext = posixpath.splitext(path) if ext in self.extensions_map...
['def', 'guess_mime_type', '(', 'self', ',', 'path', ')', ':', '_', ',', 'ext', '=', 'posixpath', '.', 'splitext', '(', 'path', ')', 'if', 'ext', 'in', 'self', '.', 'extensions_map', ':', 'return', 'self', '.', 'extensions_map', '[', 'ext', ']', 'ext', '=', 'ext', '.', 'lower', '(', ')', 'return', 'self', '.', 'extensi...
Guess an appropriate MIME type based on the extension of the provided path. :param str path: The of the file to analyze. :return: The guessed MIME type of the default if non are found. :rtype: str
['Guess', 'an', 'appropriate', 'MIME', 'type', 'based', 'on', 'the', 'extension', 'of', 'the', 'provided', 'path', '.']
train
https://github.com/zeroSteiner/AdvancedHTTPServer/blob/8c53cf7e1ddbf7ae9f573c82c5fe5f6992db7b5a/advancedhttpserver.py#L1135-L1148
1,517
pixelogik/NearPy
nearpy/engine.py
Engine._get_candidates
def _get_candidates(self, v): """ Collect candidates from all buckets from all hashes """ candidates = [] for lshash in self.lshashes: for bucket_key in lshash.hash_vector(v, querying=True): bucket_content = self.storage.get_bucket( lshash.hash_nam...
python
def _get_candidates(self, v): """ Collect candidates from all buckets from all hashes """ candidates = [] for lshash in self.lshashes: for bucket_key in lshash.hash_vector(v, querying=True): bucket_content = self.storage.get_bucket( lshash.hash_nam...
['def', '_get_candidates', '(', 'self', ',', 'v', ')', ':', 'candidates', '=', '[', ']', 'for', 'lshash', 'in', 'self', '.', 'lshashes', ':', 'for', 'bucket_key', 'in', 'lshash', '.', 'hash_vector', '(', 'v', ',', 'querying', '=', 'True', ')', ':', 'bucket_content', '=', 'self', '.', 'storage', '.', 'get_bucket', '(', ...
Collect candidates from all buckets from all hashes
['Collect', 'candidates', 'from', 'all', 'buckets', 'from', 'all', 'hashes']
train
https://github.com/pixelogik/NearPy/blob/1b534b864d320d875508e95cd2b76b6d8c07a90b/nearpy/engine.py#L180-L191
1,518
mongodb/mongo-python-driver
pymongo/mongo_client.py
MongoClient.start_session
def start_session(self, causal_consistency=True, default_transaction_options=None): """Start a logical session. This method takes the same parameters as :class:`~pymongo.client_session.SessionOptions`. See the :mod:`~pymongo.client_session` mo...
python
def start_session(self, causal_consistency=True, default_transaction_options=None): """Start a logical session. This method takes the same parameters as :class:`~pymongo.client_session.SessionOptions`. See the :mod:`~pymongo.client_session` mo...
['def', 'start_session', '(', 'self', ',', 'causal_consistency', '=', 'True', ',', 'default_transaction_options', '=', 'None', ')', ':', 'return', 'self', '.', '__start_session', '(', 'False', ',', 'causal_consistency', '=', 'causal_consistency', ',', 'default_transaction_options', '=', 'default_transaction_options', '...
Start a logical session. This method takes the same parameters as :class:`~pymongo.client_session.SessionOptions`. See the :mod:`~pymongo.client_session` module for details and examples. Requires MongoDB 3.6. It is an error to call :meth:`start_session` if this client has been ...
['Start', 'a', 'logical', 'session', '.']
train
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/mongo_client.py#L1736-L1760
1,519
Schwanksta/python-arcgis-rest-query
arcgis/arcgis.py
ArcGIS.get_descriptor_for_layer
def get_descriptor_for_layer(self, layer): """ Returns the standard JSON descriptor for the layer. There is a lot of usefule information in there. """ if not layer in self._layer_descriptor_cache: params = {'f': 'pjson'} if self.token: para...
python
def get_descriptor_for_layer(self, layer): """ Returns the standard JSON descriptor for the layer. There is a lot of usefule information in there. """ if not layer in self._layer_descriptor_cache: params = {'f': 'pjson'} if self.token: para...
['def', 'get_descriptor_for_layer', '(', 'self', ',', 'layer', ')', ':', 'if', 'not', 'layer', 'in', 'self', '.', '_layer_descriptor_cache', ':', 'params', '=', '{', "'f'", ':', "'pjson'", '}', 'if', 'self', '.', 'token', ':', 'params', '[', "'token'", ']', '=', 'self', '.', 'token', 'response', '=', 'requests', '.', '...
Returns the standard JSON descriptor for the layer. There is a lot of usefule information in there.
['Returns', 'the', 'standard', 'JSON', 'descriptor', 'for', 'the', 'layer', '.', 'There', 'is', 'a', 'lot', 'of', 'usefule', 'information', 'in', 'there', '.']
train
https://github.com/Schwanksta/python-arcgis-rest-query/blob/020d17f5dfb63d7be4e2e245771453f2ae9410aa/arcgis/arcgis.py#L106-L117
1,520
flowroute/txjason
txjason/handler.py
Handler.addToService
def addToService(self, service, namespace=None, seperator='.'): """ Add this Handler's exported methods to an RPC Service instance. """ if namespace is None: namespace = [] if isinstance(namespace, basestring): namespace = [namespace] for n, m in ...
python
def addToService(self, service, namespace=None, seperator='.'): """ Add this Handler's exported methods to an RPC Service instance. """ if namespace is None: namespace = [] if isinstance(namespace, basestring): namespace = [namespace] for n, m in ...
['def', 'addToService', '(', 'self', ',', 'service', ',', 'namespace', '=', 'None', ',', 'seperator', '=', "'.'", ')', ':', 'if', 'namespace', 'is', 'None', ':', 'namespace', '=', '[', ']', 'if', 'isinstance', '(', 'namespace', ',', 'basestring', ')', ':', 'namespace', '=', '[', 'namespace', ']', 'for', 'n', ',', 'm', ...
Add this Handler's exported methods to an RPC Service instance.
['Add', 'this', 'Handler', 's', 'exported', 'methods', 'to', 'an', 'RPC', 'Service', 'instance', '.']
train
https://github.com/flowroute/txjason/blob/4865bd716847dcbab99acc69daa0c44ae3cc5b89/txjason/handler.py#L44-L59
1,521
materialsproject/pymatgen
pymatgen/analysis/surface_analysis.py
NanoscaleStability.wulff_gform_and_r
def wulff_gform_and_r(self, wulffshape, bulk_entry, r, from_sphere_area=False, r_units="nanometers", e_units="keV", normalize=False, scale_per_atom=False): """ Calculates the formation energy of the particle with arbitrary radius r. Args: ...
python
def wulff_gform_and_r(self, wulffshape, bulk_entry, r, from_sphere_area=False, r_units="nanometers", e_units="keV", normalize=False, scale_per_atom=False): """ Calculates the formation energy of the particle with arbitrary radius r. Args: ...
['def', 'wulff_gform_and_r', '(', 'self', ',', 'wulffshape', ',', 'bulk_entry', ',', 'r', ',', 'from_sphere_area', '=', 'False', ',', 'r_units', '=', '"nanometers"', ',', 'e_units', '=', '"keV"', ',', 'normalize', '=', 'False', ',', 'scale_per_atom', '=', 'False', ')', ':', '# Set up', 'miller_se_dict', '=', 'wulffshap...
Calculates the formation energy of the particle with arbitrary radius r. Args: wulffshape (WulffShape): Initial, unscaled WulffShape bulk_entry (ComputedStructureEntry): Entry of the corresponding bulk. r (float (Ang)): Arbitrary effective radius of the WulffShape ...
['Calculates', 'the', 'formation', 'energy', 'of', 'the', 'particle', 'with', 'arbitrary', 'radius', 'r', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/surface_analysis.py#L1657-L1711
1,522
log2timeline/plaso
plaso/analyzers/hashers/manager.py
HashersManager.GetHasherNamesFromString
def GetHasherNamesFromString(cls, hasher_names_string): """Retrieves a list of a hasher names from a comma separated string. Takes a string of comma separated hasher names transforms it to a list of hasher names. Args: hasher_names_string (str): comma separated names of hashers to enable, ...
python
def GetHasherNamesFromString(cls, hasher_names_string): """Retrieves a list of a hasher names from a comma separated string. Takes a string of comma separated hasher names transforms it to a list of hasher names. Args: hasher_names_string (str): comma separated names of hashers to enable, ...
['def', 'GetHasherNamesFromString', '(', 'cls', ',', 'hasher_names_string', ')', ':', 'hasher_names', '=', '[', ']', 'if', 'not', 'hasher_names_string', 'or', 'hasher_names_string', '.', 'strip', '(', ')', '==', "'none'", ':', 'return', 'hasher_names', 'if', 'hasher_names_string', '.', 'strip', '(', ')', '==', "'all'",...
Retrieves a list of a hasher names from a comma separated string. Takes a string of comma separated hasher names transforms it to a list of hasher names. Args: hasher_names_string (str): comma separated names of hashers to enable, the string 'all' to enable all hashers or 'none' to disable...
['Retrieves', 'a', 'list', 'of', 'a', 'hasher', 'names', 'from', 'a', 'comma', 'separated', 'string', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/analyzers/hashers/manager.py#L33-L65
1,523
msiedlarek/wiring
wiring/graph.py
Graph.acquire
def acquire(self, specification, arguments=None): """ Returns an object for `specification` injecting its provider with a mix of its :term:`dependencies <dependency>` and given `arguments`. If there is a conflict between the injectable dependencies and `arguments`, the value from...
python
def acquire(self, specification, arguments=None): """ Returns an object for `specification` injecting its provider with a mix of its :term:`dependencies <dependency>` and given `arguments`. If there is a conflict between the injectable dependencies and `arguments`, the value from...
['def', 'acquire', '(', 'self', ',', 'specification', ',', 'arguments', '=', 'None', ')', ':', 'if', 'arguments', 'is', 'None', ':', 'realized_dependencies', '=', '{', '}', 'else', ':', 'realized_dependencies', '=', 'copy', '.', 'copy', '(', 'arguments', ')', 'provider', '=', 'self', '.', 'providers', '[', 'specificati...
Returns an object for `specification` injecting its provider with a mix of its :term:`dependencies <dependency>` and given `arguments`. If there is a conflict between the injectable dependencies and `arguments`, the value from `arguments` is used. When one of `arguments` keys is...
['Returns', 'an', 'object', 'for', 'specification', 'injecting', 'its', 'provider', 'with', 'a', 'mix', 'of', 'its', ':', 'term', ':', 'dependencies', '<dependency', '>', 'and', 'given', 'arguments', '.', 'If', 'there', 'is', 'a', 'conflict', 'between', 'the', 'injectable', 'dependencies', 'and', 'arguments', 'the', 'v...
train
https://github.com/msiedlarek/wiring/blob/c32165b680356fe9f1e422a1d11127f867065f94/wiring/graph.py#L150-L222
1,524
fastai/fastai
fastai/tabular/data.py
tabular_learner
def tabular_learner(data:DataBunch, layers:Collection[int], emb_szs:Dict[str,int]=None, metrics=None, ps:Collection[float]=None, emb_drop:float=0., y_range:OptRange=None, use_bn:bool=True, **learn_kwargs): "Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining ...
python
def tabular_learner(data:DataBunch, layers:Collection[int], emb_szs:Dict[str,int]=None, metrics=None, ps:Collection[float]=None, emb_drop:float=0., y_range:OptRange=None, use_bn:bool=True, **learn_kwargs): "Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining ...
['def', 'tabular_learner', '(', 'data', ':', 'DataBunch', ',', 'layers', ':', 'Collection', '[', 'int', ']', ',', 'emb_szs', ':', 'Dict', '[', 'str', ',', 'int', ']', '=', 'None', ',', 'metrics', '=', 'None', ',', 'ps', ':', 'Collection', '[', 'float', ']', '=', 'None', ',', 'emb_drop', ':', 'float', '=', '0.', ',', 'y...
Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining params.
['Get', 'a', 'Learner', 'using', 'data', 'with', 'metrics', 'including', 'a', 'TabularModel', 'created', 'using', 'the', 'remaining', 'params', '.']
train
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L170-L176
1,525
dhermes/bezier
src/bezier/_surface_helpers.py
_jacobian_det
def _jacobian_det(nodes, degree, st_vals): r"""Compute :math:`\det(D B)` at a set of values. This requires that :math:`B \in \mathbf{R}^2`. .. note:: This assumes but does not check that each ``(s, t)`` in ``st_vals`` is inside the reference triangle. .. warning:: This relies o...
python
def _jacobian_det(nodes, degree, st_vals): r"""Compute :math:`\det(D B)` at a set of values. This requires that :math:`B \in \mathbf{R}^2`. .. note:: This assumes but does not check that each ``(s, t)`` in ``st_vals`` is inside the reference triangle. .. warning:: This relies o...
['def', '_jacobian_det', '(', 'nodes', ',', 'degree', ',', 'st_vals', ')', ':', 'jac_nodes', '=', 'jacobian_both', '(', 'nodes', ',', 'degree', ',', '2', ')', 'if', 'degree', '==', '1', ':', 'num_vals', ',', '_', '=', 'st_vals', '.', 'shape', 'bs_bt_vals', '=', 'np', '.', 'repeat', '(', 'jac_nodes', ',', 'num_vals', ',...
r"""Compute :math:`\det(D B)` at a set of values. This requires that :math:`B \in \mathbf{R}^2`. .. note:: This assumes but does not check that each ``(s, t)`` in ``st_vals`` is inside the reference triangle. .. warning:: This relies on helpers in :mod:`bezier` for computing the ...
['r', 'Compute', ':', 'math', ':', '\\', 'det', '(', 'D', 'B', ')', 'at', 'a', 'set', 'of', 'values', '.']
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L1276-L1356
1,526
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.dragDropFilter
def dragDropFilter( self ): """ Returns a drag and drop filter method. If set, the method should \ accept 2 arguments: a QWidget and a drag/drop event and process it. :usage |from projexui.qt.QtCore import QEvent | |class MyWi...
python
def dragDropFilter( self ): """ Returns a drag and drop filter method. If set, the method should \ accept 2 arguments: a QWidget and a drag/drop event and process it. :usage |from projexui.qt.QtCore import QEvent | |class MyWi...
['def', 'dragDropFilter', '(', 'self', ')', ':', 'filt', '=', 'None', 'if', '(', 'self', '.', '_dragDropFilterRef', ')', ':', 'filt', '=', 'self', '.', '_dragDropFilterRef', '(', ')', 'if', '(', 'not', 'filt', ')', ':', 'self', '.', '_dragDropFilterRef', '=', 'None', 'return', 'filt']
Returns a drag and drop filter method. If set, the method should \ accept 2 arguments: a QWidget and a drag/drop event and process it. :usage |from projexui.qt.QtCore import QEvent | |class MyWidget(QWidget): | def __init...
['Returns', 'a', 'drag', 'and', 'drop', 'filter', 'method', '.', 'If', 'set', 'the', 'method', 'should', '\\', 'accept', '2', 'arguments', ':', 'a', 'QWidget', 'and', 'a', 'drag', '/', 'drop', 'event', 'and', 'process', 'it', '.', ':', 'usage', '|from', 'projexui', '.', 'qt', '.', 'QtCore', 'import', 'QEvent', '|', '|c...
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L121-L151
1,527
linode/linode_api4-python
linode_api4/paginated_list.py
PaginatedList.make_paginated_list
def make_paginated_list(json, client, cls, parent_id=None, page_url=None, filters=None): """ Returns a PaginatedList populated with the first page of data provided, and the ability to load additional pages. This should not be called outside of the :any:`LinodeClient` class. ...
python
def make_paginated_list(json, client, cls, parent_id=None, page_url=None, filters=None): """ Returns a PaginatedList populated with the first page of data provided, and the ability to load additional pages. This should not be called outside of the :any:`LinodeClient` class. ...
['def', 'make_paginated_list', '(', 'json', ',', 'client', ',', 'cls', ',', 'parent_id', '=', 'None', ',', 'page_url', '=', 'None', ',', 'filters', '=', 'None', ')', ':', 'l', '=', 'PaginatedList', '.', 'make_list', '(', 'json', '[', '"data"', ']', ',', 'client', ',', 'cls', ',', 'parent_id', '=', 'parent_id', ')', 'p'...
Returns a PaginatedList populated with the first page of data provided, and the ability to load additional pages. This should not be called outside of the :any:`LinodeClient` class. :param json: The JSON list to use as the first page :param client: A LinodeClient to use to load additio...
['Returns', 'a', 'PaginatedList', 'populated', 'with', 'the', 'first', 'page', 'of', 'data', 'provided', 'and', 'the', 'ability', 'to', 'load', 'additional', 'pages', '.', 'This', 'should', 'not', 'be', 'called', 'outside', 'of', 'the', ':', 'any', ':', 'LinodeClient', 'class', '.']
train
https://github.com/linode/linode_api4-python/blob/1dd7318d2aed014c746d48c7957464c57af883ca/linode_api4/paginated_list.py#L197-L219
1,528
wearpants/instrument
instrument/__init__.py
first
def first(iterable = None, *, name = None, metric = call_default): """Measure time elapsed to produce first item of an iterable :arg iterable: any iterable :arg function metric: f(name, 1, time) :arg str name: name for the metric """ if iterable is None: return _first_decorator(name, me...
python
def first(iterable = None, *, name = None, metric = call_default): """Measure time elapsed to produce first item of an iterable :arg iterable: any iterable :arg function metric: f(name, 1, time) :arg str name: name for the metric """ if iterable is None: return _first_decorator(name, me...
['def', 'first', '(', 'iterable', '=', 'None', ',', '*', ',', 'name', '=', 'None', ',', 'metric', '=', 'call_default', ')', ':', 'if', 'iterable', 'is', 'None', ':', 'return', '_first_decorator', '(', 'name', ',', 'metric', ')', 'else', ':', 'return', '_do_first', '(', 'iterable', ',', 'name', ',', 'metric', ')']
Measure time elapsed to produce first item of an iterable :arg iterable: any iterable :arg function metric: f(name, 1, time) :arg str name: name for the metric
['Measure', 'time', 'elapsed', 'to', 'produce', 'first', 'item', 'of', 'an', 'iterable']
train
https://github.com/wearpants/instrument/blob/a0f6103574ab58a82361a951e5e56b69aedfe294/instrument/__init__.py#L137-L147
1,529
saltstack/salt
salt/modules/disk.py
iostat
def iostat(interval=1, count=5, disks=None): ''' Gather and return (averaged) IO stats. .. versionadded:: 2016.3.0 .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' disk.iostat 1 5 disks=sda ''' if salt.utils.platform.is_l...
python
def iostat(interval=1, count=5, disks=None): ''' Gather and return (averaged) IO stats. .. versionadded:: 2016.3.0 .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' disk.iostat 1 5 disks=sda ''' if salt.utils.platform.is_l...
['def', 'iostat', '(', 'interval', '=', '1', ',', 'count', '=', '5', ',', 'disks', '=', 'None', ')', ':', 'if', 'salt', '.', 'utils', '.', 'platform', '.', 'is_linux', '(', ')', ':', 'return', '_iostat_linux', '(', 'interval', ',', 'count', ',', 'disks', ')', 'elif', 'salt', '.', 'utils', '.', 'platform', '.', 'is_free...
Gather and return (averaged) IO stats. .. versionadded:: 2016.3.0 .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' disk.iostat 1 5 disks=sda
['Gather', 'and', 'return', '(', 'averaged', ')', 'IO', 'stats', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L773-L793
1,530
senaite/senaite.core
bika/lims/browser/analysisrequest/resultsinterpretation.py
ARResultsInterpretationView.handle_form_submit
def handle_form_submit(self): """Handle form submission """ protect.CheckAuthenticator(self.request) logger.info("Handle ResultsInterpration Submit") # Save the results interpretation res = self.request.form.get("ResultsInterpretationDepts", []) self.context.setRe...
python
def handle_form_submit(self): """Handle form submission """ protect.CheckAuthenticator(self.request) logger.info("Handle ResultsInterpration Submit") # Save the results interpretation res = self.request.form.get("ResultsInterpretationDepts", []) self.context.setRe...
['def', 'handle_form_submit', '(', 'self', ')', ':', 'protect', '.', 'CheckAuthenticator', '(', 'self', '.', 'request', ')', 'logger', '.', 'info', '(', '"Handle ResultsInterpration Submit"', ')', '# Save the results interpretation', 'res', '=', 'self', '.', 'request', '.', 'form', '.', 'get', '(', '"ResultsInterpretat...
Handle form submission
['Handle', 'form', 'submission']
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/analysisrequest/resultsinterpretation.py#L47-L59
1,531
ethereum/py-evm
eth/vm/opcode.py
Opcode.as_opcode
def as_opcode(cls: Type[T], logic_fn: Callable[..., Any], mnemonic: str, gas_cost: int) -> Type[T]: """ Class factory method for turning vanilla functions into Opcode classes. """ if gas_cost: @functools.wraps(logic_fn) ...
python
def as_opcode(cls: Type[T], logic_fn: Callable[..., Any], mnemonic: str, gas_cost: int) -> Type[T]: """ Class factory method for turning vanilla functions into Opcode classes. """ if gas_cost: @functools.wraps(logic_fn) ...
['def', 'as_opcode', '(', 'cls', ':', 'Type', '[', 'T', ']', ',', 'logic_fn', ':', 'Callable', '[', '...', ',', 'Any', ']', ',', 'mnemonic', ':', 'str', ',', 'gas_cost', ':', 'int', ')', '->', 'Type', '[', 'T', ']', ':', 'if', 'gas_cost', ':', '@', 'functools', '.', 'wraps', '(', 'logic_fn', ')', 'def', 'wrapped_logic_...
Class factory method for turning vanilla functions into Opcode classes.
['Class', 'factory', 'method', 'for', 'turning', 'vanilla', 'functions', 'into', 'Opcode', 'classes', '.']
train
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/vm/opcode.py#L52-L80
1,532
haikuginger/beekeeper
beekeeper/api.py
API.from_hive_file
def from_hive_file(cls, fname, *args, **kwargs): """ Open a local JSON hive file and initialize from the hive contained in that file, paying attention to the version keyword argument. """ version = kwargs.pop('version', None) require = kwargs.pop('require_https', True) ...
python
def from_hive_file(cls, fname, *args, **kwargs): """ Open a local JSON hive file and initialize from the hive contained in that file, paying attention to the version keyword argument. """ version = kwargs.pop('version', None) require = kwargs.pop('require_https', True) ...
['def', 'from_hive_file', '(', 'cls', ',', 'fname', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'version', '=', 'kwargs', '.', 'pop', '(', "'version'", ',', 'None', ')', 'require', '=', 'kwargs', '.', 'pop', '(', "'require_https'", ',', 'True', ')', 'return', 'cls', '(', 'Hive', '.', 'from_file', '(', 'fname',...
Open a local JSON hive file and initialize from the hive contained in that file, paying attention to the version keyword argument.
['Open', 'a', 'local', 'JSON', 'hive', 'file', 'and', 'initialize', 'from', 'the', 'hive', 'contained', 'in', 'that', 'file', 'paying', 'attention', 'to', 'the', 'version', 'keyword', 'argument', '.']
train
https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L244-L251
1,533
emory-libraries/eulcommon
eulcommon/binfile/eudora.py
Toc.messages
def messages(self): '''a generator yielding the :class:`Message` structures in the index''' # the file contains the fixed-size file header followed by # fixed-size message structures. start after the file header and # then simply return the message structures in sequence until the ...
python
def messages(self): '''a generator yielding the :class:`Message` structures in the index''' # the file contains the fixed-size file header followed by # fixed-size message structures. start after the file header and # then simply return the message structures in sequence until the ...
['def', 'messages', '(', 'self', ')', ':', '# the file contains the fixed-size file header followed by', '# fixed-size message structures. start after the file header and', '# then simply return the message structures in sequence until the', '# end of the file.', 'offset', '=', 'self', '.', 'LENGTH', 'while', 'offset',...
a generator yielding the :class:`Message` structures in the index
['a', 'generator', 'yielding', 'the', ':', 'class', ':', 'Message', 'structures', 'in', 'the', 'index']
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/binfile/eudora.py#L85-L96
1,534
log2timeline/dfvfs
dfvfs/analyzer/analyzer.py
Analyzer.GetCompressedStreamTypeIndicators
def GetCompressedStreamTypeIndicators(cls, path_spec, resolver_context=None): """Determines if a file contains a supported compressed stream types. Args: path_spec (PathSpec): path specification. resolver_context (Optional[Context]): resolver context, where None represents the built-in co...
python
def GetCompressedStreamTypeIndicators(cls, path_spec, resolver_context=None): """Determines if a file contains a supported compressed stream types. Args: path_spec (PathSpec): path specification. resolver_context (Optional[Context]): resolver context, where None represents the built-in co...
['def', 'GetCompressedStreamTypeIndicators', '(', 'cls', ',', 'path_spec', ',', 'resolver_context', '=', 'None', ')', ':', 'if', '(', 'cls', '.', '_compressed_stream_remainder_list', 'is', 'None', 'or', 'cls', '.', '_compressed_stream_store', 'is', 'None', ')', ':', 'specification_store', ',', 'remainder_list', '=', 'c...
Determines if a file contains a supported compressed stream types. Args: path_spec (PathSpec): path specification. resolver_context (Optional[Context]): resolver context, where None represents the built-in context which is not multi process safe. Returns: list[str]: supported forma...
['Determines', 'if', 'a', 'file', 'contains', 'a', 'supported', 'compressed', 'stream', 'types', '.']
train
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/analyzer/analyzer.py#L257-L282
1,535
GoogleCloudPlatform/appengine-gcs-client
python/src/cloudstorage/rest_api.py
_make_token_async
def _make_token_async(scopes, service_account_id): """Get a fresh authentication token. Args: scopes: A list of scopes. service_account_id: Internal-use only. Raises: An ndb.Return with a tuple (token, expiration_time) where expiration_time is seconds since the epoch. """ rpc = app_identity....
python
def _make_token_async(scopes, service_account_id): """Get a fresh authentication token. Args: scopes: A list of scopes. service_account_id: Internal-use only. Raises: An ndb.Return with a tuple (token, expiration_time) where expiration_time is seconds since the epoch. """ rpc = app_identity....
['def', '_make_token_async', '(', 'scopes', ',', 'service_account_id', ')', ':', 'rpc', '=', 'app_identity', '.', 'create_rpc', '(', ')', 'app_identity', '.', 'make_get_access_token_call', '(', 'rpc', ',', 'scopes', ',', 'service_account_id', ')', 'token', ',', 'expires_at', '=', 'yield', 'rpc', 'raise', 'ndb', '.', 'R...
Get a fresh authentication token. Args: scopes: A list of scopes. service_account_id: Internal-use only. Raises: An ndb.Return with a tuple (token, expiration_time) where expiration_time is seconds since the epoch.
['Get', 'a', 'fresh', 'authentication', 'token', '.']
train
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/python/src/cloudstorage/rest_api.py#L42-L56
1,536
vint21h/django-opensearch
opensearch/views.py
opensearch
def opensearch(request): """ Return opensearch.xml. """ contact_email = settings.CONTACT_EMAIL short_name = settings.SHORT_NAME description = settings.DESCRIPTION favicon_width = settings.FAVICON_WIDTH favicon_height = settings.FAVICON_HEIGHT favicon_type = settings.FAVICON_TYPE ...
python
def opensearch(request): """ Return opensearch.xml. """ contact_email = settings.CONTACT_EMAIL short_name = settings.SHORT_NAME description = settings.DESCRIPTION favicon_width = settings.FAVICON_WIDTH favicon_height = settings.FAVICON_HEIGHT favicon_type = settings.FAVICON_TYPE ...
['def', 'opensearch', '(', 'request', ')', ':', 'contact_email', '=', 'settings', '.', 'CONTACT_EMAIL', 'short_name', '=', 'settings', '.', 'SHORT_NAME', 'description', '=', 'settings', '.', 'DESCRIPTION', 'favicon_width', '=', 'settings', '.', 'FAVICON_WIDTH', 'favicon_height', '=', 'settings', '.', 'FAVICON_HEIGHT', ...
Return opensearch.xml.
['Return', 'opensearch', '.', 'xml', '.']
train
https://github.com/vint21h/django-opensearch/blob/4da3fa80b36f29e4ce350b3d689cda577b35421d/opensearch/views.py#L23-L41
1,537
helixyte/everest
everest/representers/traversal.py
ResourceDataVisitor.visit_member
def visit_member(self, attribute_key, attribute, member_node, member_data, is_link_node, parent_data, index=None): """ Visits a member node in a resource data tree. :param tuple attribute_key: tuple containing the attribute tokens identifying the member node's pos...
python
def visit_member(self, attribute_key, attribute, member_node, member_data, is_link_node, parent_data, index=None): """ Visits a member node in a resource data tree. :param tuple attribute_key: tuple containing the attribute tokens identifying the member node's pos...
['def', 'visit_member', '(', 'self', ',', 'attribute_key', ',', 'attribute', ',', 'member_node', ',', 'member_data', ',', 'is_link_node', ',', 'parent_data', ',', 'index', '=', 'None', ')', ':', 'raise', 'NotImplementedError', '(', "'Abstract method.'", ')']
Visits a member node in a resource data tree. :param tuple attribute_key: tuple containing the attribute tokens identifying the member node's position in the resource data tree. :param attribute: mapped attribute holding information about the member node's name (in the parent) and t...
['Visits', 'a', 'member', 'node', 'in', 'a', 'resource', 'data', 'tree', '.']
train
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/representers/traversal.py#L53-L76
1,538
angr/angr
angr/knowledge_plugins/functions/function.py
Function._get_initial_name
def _get_initial_name(self): """ Determine the most suitable name of the function. :return: The initial function name. :rtype: string """ name = None addr = self.addr # Try to get a name from existing labels if self._function_manager is n...
python
def _get_initial_name(self): """ Determine the most suitable name of the function. :return: The initial function name. :rtype: string """ name = None addr = self.addr # Try to get a name from existing labels if self._function_manager is n...
['def', '_get_initial_name', '(', 'self', ')', ':', 'name', '=', 'None', 'addr', '=', 'self', '.', 'addr', '# Try to get a name from existing labels', 'if', 'self', '.', '_function_manager', 'is', 'not', 'None', ':', 'if', 'addr', 'in', 'self', '.', '_function_manager', '.', '_kb', '.', 'labels', ':', 'name', '=', 'sel...
Determine the most suitable name of the function. :return: The initial function name. :rtype: string
['Determine', 'the', 'most', 'suitable', 'name', 'of', 'the', 'function', '.']
train
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/functions/function.py#L687-L717
1,539
tanghaibao/jcvi
jcvi/apps/cap3.py
prepare
def prepare(args): """ %prog prepare --rearray_lib=<rearraylibrary> --orig_lib_file=<origlibfile> Inferred file names --------------------------------------------- `lookuptblfile` : rearraylibrary.lookup `rearraylibfile`: rearraylibrary.fasta Pick sequences from the original library file a...
python
def prepare(args): """ %prog prepare --rearray_lib=<rearraylibrary> --orig_lib_file=<origlibfile> Inferred file names --------------------------------------------- `lookuptblfile` : rearraylibrary.lookup `rearraylibfile`: rearraylibrary.fasta Pick sequences from the original library file a...
['def', 'prepare', '(', 'args', ')', ':', 'from', 'operator', 'import', 'itemgetter', 'from', 'jcvi', '.', 'formats', '.', 'fasta', 'import', 'Fasta', ',', 'SeqIO', 'p', '=', 'OptionParser', '(', 'prepare', '.', '__doc__', ')', 'p', '.', 'add_option', '(', '"--rearray_lib"', ',', 'default', '=', 'None', ',', 'help', '=...
%prog prepare --rearray_lib=<rearraylibrary> --orig_lib_file=<origlibfile> Inferred file names --------------------------------------------- `lookuptblfile` : rearraylibrary.lookup `rearraylibfile`: rearraylibrary.fasta Pick sequences from the original library file and the rearrayed library file ...
['%prog', 'prepare', '--', 'rearray_lib', '=', '<rearraylibrary', '>', '--', 'orig_lib_file', '=', '<origlibfile', '>']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/apps/cap3.py#L32-L121
1,540
DistrictDataLabs/yellowbrick
yellowbrick/utils/helpers.py
prop_to_size
def prop_to_size(vals, mi=0.0, ma=5.0, power=0.5, log=False): """ Converts an array of property values (e.g. a metric or score) to values that are more useful for marker sizes, line widths, or other visual sizes. The new sizes are computed as: y = mi + (ma -mi)(\frac{x_i - min(x){max(x) - min(x...
python
def prop_to_size(vals, mi=0.0, ma=5.0, power=0.5, log=False): """ Converts an array of property values (e.g. a metric or score) to values that are more useful for marker sizes, line widths, or other visual sizes. The new sizes are computed as: y = mi + (ma -mi)(\frac{x_i - min(x){max(x) - min(x...
['def', 'prop_to_size', '(', 'vals', ',', 'mi', '=', '0.0', ',', 'ma', '=', '5.0', ',', 'power', '=', '0.5', ',', 'log', '=', 'False', ')', ':', '# ensure that prop is an array', 'vals', '=', 'np', '.', 'asarray', '(', 'vals', ')', '# apply natural log if specified', 'if', 'log', ':', 'vals', '=', 'np', '.', 'log', '('...
Converts an array of property values (e.g. a metric or score) to values that are more useful for marker sizes, line widths, or other visual sizes. The new sizes are computed as: y = mi + (ma -mi)(\frac{x_i - min(x){max(x) - min(x)})^{power} If ``log=True``, the natural logarithm of the property va...
['Converts', 'an', 'array', 'of', 'property', 'values', '(', 'e', '.', 'g', '.', 'a', 'metric', 'or', 'score', ')', 'to', 'values', 'that', 'are', 'more', 'useful', 'for', 'marker', 'sizes', 'line', 'widths', 'or', 'other', 'visual', 'sizes', '.', 'The', 'new', 'sizes', 'are', 'computed', 'as', ':']
train
https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/helpers.py#L135-L179
1,541
ivanlei/threatbutt
threatbutt/threatbutt.py
ThreatButt.bespoke_md5
def bespoke_md5(self, md5): """Performs Bespoke MD5 lookup on an MD5. Args: md5 - A hash. """ r = requests.post('http://threatbutt.io/api/md5/{0}'.format(md5)) self._output(r.text)
python
def bespoke_md5(self, md5): """Performs Bespoke MD5 lookup on an MD5. Args: md5 - A hash. """ r = requests.post('http://threatbutt.io/api/md5/{0}'.format(md5)) self._output(r.text)
['def', 'bespoke_md5', '(', 'self', ',', 'md5', ')', ':', 'r', '=', 'requests', '.', 'post', '(', "'http://threatbutt.io/api/md5/{0}'", '.', 'format', '(', 'md5', ')', ')', 'self', '.', '_output', '(', 'r', '.', 'text', ')']
Performs Bespoke MD5 lookup on an MD5. Args: md5 - A hash.
['Performs', 'Bespoke', 'MD5', 'lookup', 'on', 'an', 'MD5', '.']
train
https://github.com/ivanlei/threatbutt/blob/faff507a4bebfa585d3044427111418c257c34ec/threatbutt/threatbutt.py#L29-L36
1,542
uyar/pygenstub
pygenstub.py
main
def main(argv=None): """Start the command line interface.""" parser = ArgumentParser(prog="pygenstub") parser.add_argument("--version", action="version", version="%(prog)s " + __version__) parser.add_argument("files", nargs="*", help="generate stubs for given files") parser.add_argument( "-m...
python
def main(argv=None): """Start the command line interface.""" parser = ArgumentParser(prog="pygenstub") parser.add_argument("--version", action="version", version="%(prog)s " + __version__) parser.add_argument("files", nargs="*", help="generate stubs for given files") parser.add_argument( "-m...
['def', 'main', '(', 'argv', '=', 'None', ')', ':', 'parser', '=', 'ArgumentParser', '(', 'prog', '=', '"pygenstub"', ')', 'parser', '.', 'add_argument', '(', '"--version"', ',', 'action', '=', '"version"', ',', 'version', '=', '"%(prog)s "', '+', '__version__', ')', 'parser', '.', 'add_argument', '(', '"files"', ',', ...
Start the command line interface.
['Start', 'the', 'command', 'line', 'interface', '.']
train
https://github.com/uyar/pygenstub/blob/a6b18a823382d3c6be29c411fb33c58b6090d22c/pygenstub.py#L888-L951
1,543
NVIDIA/pynvrtc
pynvrtc/interface.py
NVRTCInterface.nvrtcGetLoweredName
def nvrtcGetLoweredName(self, prog, name_expression): """ Notes the given name expression denoting a __global__ function or function template instantiation. """ lowered_name = c_char_p() code = self._lib.nvrtcGetLoweredName(prog, ...
python
def nvrtcGetLoweredName(self, prog, name_expression): """ Notes the given name expression denoting a __global__ function or function template instantiation. """ lowered_name = c_char_p() code = self._lib.nvrtcGetLoweredName(prog, ...
['def', 'nvrtcGetLoweredName', '(', 'self', ',', 'prog', ',', 'name_expression', ')', ':', 'lowered_name', '=', 'c_char_p', '(', ')', 'code', '=', 'self', '.', '_lib', '.', 'nvrtcGetLoweredName', '(', 'prog', ',', 'c_char_p', '(', 'encode_str', '(', 'name_expression', ')', ')', ',', 'byref', '(', 'lowered_name', ')', '...
Notes the given name expression denoting a __global__ function or function template instantiation.
['Notes', 'the', 'given', 'name', 'expression', 'denoting', 'a', '__global__', 'function', 'or', 'function', 'template', 'instantiation', '.']
train
https://github.com/NVIDIA/pynvrtc/blob/fffa9f6f4a7ee1d452346cbdf68b84b5246ccffb/pynvrtc/interface.py#L265-L275
1,544
benfred/implicit
implicit/als.py
least_squares
def least_squares(Cui, X, Y, regularization, num_threads=0): """ For each user in Cui, calculate factors Xu for them using least squares on Y. Note: this is at least 10 times slower than the cython version included here. """ users, n_factors = X.shape YtY = Y.T.dot(Y) for u in range(us...
python
def least_squares(Cui, X, Y, regularization, num_threads=0): """ For each user in Cui, calculate factors Xu for them using least squares on Y. Note: this is at least 10 times slower than the cython version included here. """ users, n_factors = X.shape YtY = Y.T.dot(Y) for u in range(us...
['def', 'least_squares', '(', 'Cui', ',', 'X', ',', 'Y', ',', 'regularization', ',', 'num_threads', '=', '0', ')', ':', 'users', ',', 'n_factors', '=', 'X', '.', 'shape', 'YtY', '=', 'Y', '.', 'T', '.', 'dot', '(', 'Y', ')', 'for', 'u', 'in', 'range', '(', 'users', ')', ':', 'X', '[', 'u', ']', '=', 'user_factor', '(',...
For each user in Cui, calculate factors Xu for them using least squares on Y. Note: this is at least 10 times slower than the cython version included here.
['For', 'each', 'user', 'in', 'Cui', 'calculate', 'factors', 'Xu', 'for', 'them', 'using', 'least', 'squares', 'on', 'Y', '.']
train
https://github.com/benfred/implicit/blob/6b16c50d1d514a814f2e5b8cf2a829ff23dbba63/implicit/als.py#L311-L322
1,545
apache/incubator-mxnet
python/mxnet/name.py
NameManager.get
def get(self, name, hint): """Get the canonical name for a symbol. This is the default implementation. If the user specifies a name, the user-specified name will be used. When user does not specify a name, we automatically generate a name based on the hint string. ...
python
def get(self, name, hint): """Get the canonical name for a symbol. This is the default implementation. If the user specifies a name, the user-specified name will be used. When user does not specify a name, we automatically generate a name based on the hint string. ...
['def', 'get', '(', 'self', ',', 'name', ',', 'hint', ')', ':', 'if', 'name', ':', 'return', 'name', 'if', 'hint', 'not', 'in', 'self', '.', '_counter', ':', 'self', '.', '_counter', '[', 'hint', ']', '=', '0', 'name', '=', "'%s%d'", '%', '(', 'hint', ',', 'self', '.', '_counter', '[', 'hint', ']', ')', 'self', '.', '_...
Get the canonical name for a symbol. This is the default implementation. If the user specifies a name, the user-specified name will be used. When user does not specify a name, we automatically generate a name based on the hint string. Parameters ---------- ...
['Get', 'the', 'canonical', 'name', 'for', 'a', 'symbol', '.']
train
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/name.py#L36-L65
1,546
hobson/pug-dj
pug/dj/crawlnmine/management/__init__.py
ManagementUtility.execute
def execute(self): """ Given the command-line arguments, this figures out which subcommand is being run, creates a parser appropriate to that command, and runs it. """ try: subcommand = self.argv[1] except IndexError: subcommand = 'help' # Display...
python
def execute(self): """ Given the command-line arguments, this figures out which subcommand is being run, creates a parser appropriate to that command, and runs it. """ try: subcommand = self.argv[1] except IndexError: subcommand = 'help' # Display...
['def', 'execute', '(', 'self', ')', ':', 'try', ':', 'subcommand', '=', 'self', '.', 'argv', '[', '1', ']', 'except', 'IndexError', ':', 'subcommand', '=', "'help'", '# Display help if no arguments were given.', '# Preprocess options to extract --settings and --pythonpath.', '# These options could affect the commands ...
Given the command-line arguments, this figures out which subcommand is being run, creates a parser appropriate to that command, and runs it.
['Given', 'the', 'command', '-', 'line', 'arguments', 'this', 'figures', 'out', 'which', 'subcommand', 'is', 'being', 'run', 'creates', 'a', 'parser', 'appropriate', 'to', 'that', 'command', 'and', 'runs', 'it', '.']
train
https://github.com/hobson/pug-dj/blob/55678b08755a55366ce18e7d3b8ea8fa4491ab04/pug/dj/crawlnmine/management/__init__.py#L269-L325
1,547
econ-ark/HARK
HARK/utilities.py
approxLognormal
def approxLognormal(N, mu=0.0, sigma=1.0, tail_N=0, tail_bound=[0.02,0.98], tail_order=np.e): ''' Construct a discrete approximation to a lognormal distribution with underlying normal distribution N(mu,sigma). Makes an equiprobable distribution by default, but user can optionally request augmented tail...
python
def approxLognormal(N, mu=0.0, sigma=1.0, tail_N=0, tail_bound=[0.02,0.98], tail_order=np.e): ''' Construct a discrete approximation to a lognormal distribution with underlying normal distribution N(mu,sigma). Makes an equiprobable distribution by default, but user can optionally request augmented tail...
['def', 'approxLognormal', '(', 'N', ',', 'mu', '=', '0.0', ',', 'sigma', '=', '1.0', ',', 'tail_N', '=', '0', ',', 'tail_bound', '=', '[', '0.02', ',', '0.98', ']', ',', 'tail_order', '=', 'np', '.', 'e', ')', ':', '# Find the CDF boundaries of each segment', 'if', 'sigma', '>', '0.0', ':', 'if', 'tail_N', '>', '0', '...
Construct a discrete approximation to a lognormal distribution with underlying normal distribution N(mu,sigma). Makes an equiprobable distribution by default, but user can optionally request augmented tails with exponentially sized point masses. This can improve solution accuracy in some models. Para...
['Construct', 'a', 'discrete', 'approximation', 'to', 'a', 'lognormal', 'distribution', 'with', 'underlying', 'normal', 'distribution', 'N', '(', 'mu', 'sigma', ')', '.', 'Makes', 'an', 'equiprobable', 'distribution', 'by', 'default', 'but', 'user', 'can', 'optionally', 'request', 'augmented', 'tails', 'with', 'exponen...
train
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/utilities.py#L435-L521
1,548
jalanb/pysyte
pysyte/paths.py
cd
def cd(path_to): # pylint: disable=invalid-name """cd to the given path If the path is a file, then cd to its parent directory Remember current directory before the cd so that we can cd back there with cd('-') """ if path_to == '-': if not cd.previous: raise PathError(...
python
def cd(path_to): # pylint: disable=invalid-name """cd to the given path If the path is a file, then cd to its parent directory Remember current directory before the cd so that we can cd back there with cd('-') """ if path_to == '-': if not cd.previous: raise PathError(...
['def', 'cd', '(', 'path_to', ')', ':', '# pylint: disable=invalid-name', 'if', 'path_to', '==', "'-'", ':', 'if', 'not', 'cd', '.', 'previous', ':', 'raise', 'PathError', '(', "'No previous directory to return to'", ')', 'return', 'cd', '(', 'cd', '.', 'previous', ')', 'if', 'not', 'hasattr', '(', 'path_to', ',', "'cd...
cd to the given path If the path is a file, then cd to its parent directory Remember current directory before the cd so that we can cd back there with cd('-')
['cd', 'to', 'the', 'given', 'path']
train
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/paths.py#L622-L651
1,549
taskcluster/taskcluster-client.py
taskcluster/queueevents.py
QueueEvents.taskException
def taskException(self, *args, **kwargs): """ Task Exception Messages Whenever Taskcluster fails to run a message is posted to this exchange. This happens if the task isn't completed before its `deadlìne`, all retries failed (i.e. workers stopped responding), the task was ...
python
def taskException(self, *args, **kwargs): """ Task Exception Messages Whenever Taskcluster fails to run a message is posted to this exchange. This happens if the task isn't completed before its `deadlìne`, all retries failed (i.e. workers stopped responding), the task was ...
['def', 'taskException', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'ref', '=', '{', "'exchange'", ':', "'task-exception'", ',', "'name'", ':', "'taskException'", ',', "'routingKey'", ':', '[', '{', "'constant'", ':', "'primary'", ',', "'multipleWords'", ':', 'False', ',', "'name'", ':', "'routin...
Task Exception Messages Whenever Taskcluster fails to run a message is posted to this exchange. This happens if the task isn't completed before its `deadlìne`, all retries failed (i.e. workers stopped responding), the task was canceled by another entity, or the task carried a malformed ...
['Task', 'Exception', 'Messages']
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/queueevents.py#L582-L665
1,550
vallis/libstempo
libstempo/spharmORFbasis.py
rotated_Gamma_ml
def rotated_Gamma_ml(m,l,phi1,phi2,theta1,theta2,gamma_ml): """ This function takes any gamma in the computational frame and rotates it to the cosmic frame. """ rotated_gamma = 0 for ii in range(2*l+1): rotated_gamma += Dlmk(l,m,ii-l,phi1,phi2,theta1,theta2).conjugate()*g...
python
def rotated_Gamma_ml(m,l,phi1,phi2,theta1,theta2,gamma_ml): """ This function takes any gamma in the computational frame and rotates it to the cosmic frame. """ rotated_gamma = 0 for ii in range(2*l+1): rotated_gamma += Dlmk(l,m,ii-l,phi1,phi2,theta1,theta2).conjugate()*g...
['def', 'rotated_Gamma_ml', '(', 'm', ',', 'l', ',', 'phi1', ',', 'phi2', ',', 'theta1', ',', 'theta2', ',', 'gamma_ml', ')', ':', 'rotated_gamma', '=', '0', 'for', 'ii', 'in', 'range', '(', '2', '*', 'l', '+', '1', ')', ':', 'rotated_gamma', '+=', 'Dlmk', '(', 'l', ',', 'm', ',', 'ii', '-', 'l', ',', 'phi1', ',', 'phi...
This function takes any gamma in the computational frame and rotates it to the cosmic frame.
['This', 'function', 'takes', 'any', 'gamma', 'in', 'the', 'computational', 'frame', 'and', 'rotates', 'it', 'to', 'the', 'cosmic', 'frame', '.']
train
https://github.com/vallis/libstempo/blob/0b19300a9b24d64c9ddc25cd6ddbfd12b6231990/libstempo/spharmORFbasis.py#L266-L278
1,551
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._operation_speak_as_literal_punctuation
def _operation_speak_as_literal_punctuation( self, content, index, children ): """ The operation method of _speak_as method for literal-punctuation. :param content: The text content of element. :type content: str :param index: The index of pat...
python
def _operation_speak_as_literal_punctuation( self, content, index, children ): """ The operation method of _speak_as method for literal-punctuation. :param content: The text content of element. :type content: str :param index: The index of pat...
['def', '_operation_speak_as_literal_punctuation', '(', 'self', ',', 'content', ',', 'index', ',', 'children', ')', ':', 'data_property_value', '=', "'literal-punctuation'", 'if', 'index', '!=', '0', ':', 'children', '.', 'append', '(', 'self', '.', '_create_content_element', '(', 'content', '[', '0', ':', 'index', ']'...
The operation method of _speak_as method for literal-punctuation. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int :param children: The children of element. :type children: lis...
['The', 'operation', 'method', 'of', '_speak_as', 'method', 'for', 'literal', '-', 'punctuation', '.']
train
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L229-L266
1,552
gebn/nibble
nibble/util.py
log_level_from_vebosity
def log_level_from_vebosity(verbosity): """ Get the `logging` module log level from a verbosity. :param verbosity: The number of times the `-v` option was specified. :return: The corresponding log level. """ if verbosity == 0: return logging.WARNING if verbosity == 1: return...
python
def log_level_from_vebosity(verbosity): """ Get the `logging` module log level from a verbosity. :param verbosity: The number of times the `-v` option was specified. :return: The corresponding log level. """ if verbosity == 0: return logging.WARNING if verbosity == 1: return...
['def', 'log_level_from_vebosity', '(', 'verbosity', ')', ':', 'if', 'verbosity', '==', '0', ':', 'return', 'logging', '.', 'WARNING', 'if', 'verbosity', '==', '1', ':', 'return', 'logging', '.', 'INFO', 'return', 'logging', '.', 'DEBUG']
Get the `logging` module log level from a verbosity. :param verbosity: The number of times the `-v` option was specified. :return: The corresponding log level.
['Get', 'the', 'logging', 'module', 'log', 'level', 'from', 'a', 'verbosity', '.']
train
https://github.com/gebn/nibble/blob/e82a2c43509ed38f3d039040591cc630fa676cb0/nibble/util.py#L35-L46
1,553
vijayvarma392/surfinBH
surfinBH/_fit_evaluators/fit_7dq2.py
Fit7dq2._load_fits
def _load_fits(self, h5file): """ Loads fits from h5file and returns a dictionary of fits. """ fits = {} for key in ['mf']: fits[key] = self._load_scalar_fit(fit_key=key, h5file=h5file) for key in ['chif', 'vf']: fits[key] = self._load_vector_fit(key, h5file) ...
python
def _load_fits(self, h5file): """ Loads fits from h5file and returns a dictionary of fits. """ fits = {} for key in ['mf']: fits[key] = self._load_scalar_fit(fit_key=key, h5file=h5file) for key in ['chif', 'vf']: fits[key] = self._load_vector_fit(key, h5file) ...
['def', '_load_fits', '(', 'self', ',', 'h5file', ')', ':', 'fits', '=', '{', '}', 'for', 'key', 'in', '[', "'mf'", ']', ':', 'fits', '[', 'key', ']', '=', 'self', '.', '_load_scalar_fit', '(', 'fit_key', '=', 'key', ',', 'h5file', '=', 'h5file', ')', 'for', 'key', 'in', '[', "'chif'", ',', "'vf'", ']', ':', 'fits', '[...
Loads fits from h5file and returns a dictionary of fits.
['Loads', 'fits', 'from', 'h5file', 'and', 'returns', 'a', 'dictionary', 'of', 'fits', '.']
train
https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/_fit_evaluators/fit_7dq2.py#L149-L156
1,554
cloudendpoints/endpoints-python
endpoints/openapi_generator.py
OpenApiGenerator.__api_openapi_descriptor
def __api_openapi_descriptor(self, services, hostname=None, x_google_api_name=False): """Builds an OpenAPI description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the ...
python
def __api_openapi_descriptor(self, services, hostname=None, x_google_api_name=False): """Builds an OpenAPI description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the ...
['def', '__api_openapi_descriptor', '(', 'self', ',', 'services', ',', 'hostname', '=', 'None', ',', 'x_google_api_name', '=', 'False', ')', ':', 'merged_api_info', '=', 'self', '.', '__get_merged_api_info', '(', 'services', ')', 'descriptor', '=', 'self', '.', 'get_descriptor_defaults', '(', 'merged_api_info', ',', 'h...
Builds an OpenAPI description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dictionary that can be deseria...
['Builds', 'an', 'OpenAPI', 'description', 'of', 'an', 'API', '.']
train
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/openapi_generator.py#L883-L993
1,555
kennethreitz/grequests
grequests.py
imap
def imap(requests, stream=False, size=2, exception_handler=None): """Concurrently converts a generator object of Requests to a generator of Responses. :param requests: a generator of Request objects. :param stream: If True, the content will not be downloaded immediately. :param size: Specifies the ...
python
def imap(requests, stream=False, size=2, exception_handler=None): """Concurrently converts a generator object of Requests to a generator of Responses. :param requests: a generator of Request objects. :param stream: If True, the content will not be downloaded immediately. :param size: Specifies the ...
['def', 'imap', '(', 'requests', ',', 'stream', '=', 'False', ',', 'size', '=', '2', ',', 'exception_handler', '=', 'None', ')', ':', 'pool', '=', 'Pool', '(', 'size', ')', 'def', 'send', '(', 'r', ')', ':', 'return', 'r', '.', 'send', '(', 'stream', '=', 'stream', ')', 'for', 'request', 'in', 'pool', '.', 'imap_unorde...
Concurrently converts a generator object of Requests to a generator of Responses. :param requests: a generator of Request objects. :param stream: If True, the content will not be downloaded immediately. :param size: Specifies the number of requests to make at a time. default is 2 :param exception_h...
['Concurrently', 'converts', 'a', 'generator', 'object', 'of', 'Requests', 'to', 'a', 'generator', 'of', 'Responses', '.']
train
https://github.com/kennethreitz/grequests/blob/ba25872510e06af213b0c209d204cdc913e3a429/grequests.py#L132-L155
1,556
99designs/colorific
colorific/palette.py
color_stream_st
def color_stream_st(istream=sys.stdin, save_palette=False, **kwargs): """ Read filenames from the input stream and detect their palette. """ for line in istream: filename = line.strip() try: palette = extract_colors(filename, **kwargs) except Exception as e: ...
python
def color_stream_st(istream=sys.stdin, save_palette=False, **kwargs): """ Read filenames from the input stream and detect their palette. """ for line in istream: filename = line.strip() try: palette = extract_colors(filename, **kwargs) except Exception as e: ...
['def', 'color_stream_st', '(', 'istream', '=', 'sys', '.', 'stdin', ',', 'save_palette', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'for', 'line', 'in', 'istream', ':', 'filename', '=', 'line', '.', 'strip', '(', ')', 'try', ':', 'palette', '=', 'extract_colors', '(', 'filename', ',', '*', '*', 'kwargs', ')', 'e...
Read filenames from the input stream and detect their palette.
['Read', 'filenames', 'from', 'the', 'input', 'stream', 'and', 'detect', 'their', 'palette', '.']
train
https://github.com/99designs/colorific/blob/f83e59f61295500f5527dee5894207f2f033cf35/colorific/palette.py#L37-L52
1,557
bram85/topydo
topydo/lib/Importance.py
importance
def importance(p_todo, p_ignore_weekend=config().ignore_weekends()): """ Calculates the importance of the given task. Returns an importance of zero when the task has been completed. If p_ignore_weekend is True, the importance value of the due date will be calculated as if Friday is immediately foll...
python
def importance(p_todo, p_ignore_weekend=config().ignore_weekends()): """ Calculates the importance of the given task. Returns an importance of zero when the task has been completed. If p_ignore_weekend is True, the importance value of the due date will be calculated as if Friday is immediately foll...
['def', 'importance', '(', 'p_todo', ',', 'p_ignore_weekend', '=', 'config', '(', ')', '.', 'ignore_weekends', '(', ')', ')', ':', 'result', '=', '2', 'priority', '=', 'p_todo', '.', 'priority', '(', ')', 'result', '+=', 'IMPORTANCE_VALUE', '[', 'priority', ']', 'if', 'priority', 'in', 'IMPORTANCE_VALUE', 'else', '0', ...
Calculates the importance of the given task. Returns an importance of zero when the task has been completed. If p_ignore_weekend is True, the importance value of the due date will be calculated as if Friday is immediately followed by Monday. This in case of a todo list at the office and you don't work ...
['Calculates', 'the', 'importance', 'of', 'the', 'given', 'task', '.', 'Returns', 'an', 'importance', 'of', 'zero', 'when', 'the', 'task', 'has', 'been', 'completed', '.']
train
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/Importance.py#L44-L79
1,558
PyHDI/Pyverilog
pyverilog/vparser/parser.py
VerilogParser.p_single_statement_systemcall
def p_single_statement_systemcall(self, p): 'single_statement : systemcall SEMICOLON' p[0] = SingleStatement(p[1], lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
python
def p_single_statement_systemcall(self, p): 'single_statement : systemcall SEMICOLON' p[0] = SingleStatement(p[1], lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
['def', 'p_single_statement_systemcall', '(', 'self', ',', 'p', ')', ':', 'p', '[', '0', ']', '=', 'SingleStatement', '(', 'p', '[', '1', ']', ',', 'lineno', '=', 'p', '.', 'lineno', '(', '1', ')', ')', 'p', '.', 'set_lineno', '(', '0', ',', 'p', '.', 'lineno', '(', '1', ')', ')']
single_statement : systemcall SEMICOLON
['single_statement', ':', 'systemcall', 'SEMICOLON']
train
https://github.com/PyHDI/Pyverilog/blob/b852cc5ed6a7a2712e33639f9d9782d0d1587a53/pyverilog/vparser/parser.py#L2177-L2180
1,559
espressif/esptool
esptool.py
ESPLoader.flash_spi_attach
def flash_spi_attach(self, hspi_arg): """Send SPI attach command to enable the SPI flash pins ESP8266 ROM does this when you send flash_begin, ESP32 ROM has it as a SPI command. """ # last 3 bytes in ESP_SPI_ATTACH argument are reserved values arg = struct.pack('<I', hsp...
python
def flash_spi_attach(self, hspi_arg): """Send SPI attach command to enable the SPI flash pins ESP8266 ROM does this when you send flash_begin, ESP32 ROM has it as a SPI command. """ # last 3 bytes in ESP_SPI_ATTACH argument are reserved values arg = struct.pack('<I', hsp...
['def', 'flash_spi_attach', '(', 'self', ',', 'hspi_arg', ')', ':', '# last 3 bytes in ESP_SPI_ATTACH argument are reserved values', 'arg', '=', 'struct', '.', 'pack', '(', "'<I'", ',', 'hspi_arg', ')', 'if', 'not', 'self', '.', 'IS_STUB', ':', "# ESP32 ROM loader takes additional 'is legacy' arg, which is not", "# cur...
Send SPI attach command to enable the SPI flash pins ESP8266 ROM does this when you send flash_begin, ESP32 ROM has it as a SPI command.
['Send', 'SPI', 'attach', 'command', 'to', 'enable', 'the', 'SPI', 'flash', 'pins']
train
https://github.com/espressif/esptool/blob/c583756c118039cfcfe256f7a3285618914d16a5/esptool.py#L759-L772
1,560
cloudsmith-io/cloudsmith-cli
cloudsmith_cli/cli/utils.py
maybe_print_as_json
def maybe_print_as_json(opts, data, page_info=None): """Maybe print data as JSON.""" if opts.output not in ("json", "pretty_json"): return False root = {"data": data} if page_info is not None and page_info.is_valid: meta = root["meta"] = {} meta["pagination"] = page_info.as_dic...
python
def maybe_print_as_json(opts, data, page_info=None): """Maybe print data as JSON.""" if opts.output not in ("json", "pretty_json"): return False root = {"data": data} if page_info is not None and page_info.is_valid: meta = root["meta"] = {} meta["pagination"] = page_info.as_dic...
['def', 'maybe_print_as_json', '(', 'opts', ',', 'data', ',', 'page_info', '=', 'None', ')', ':', 'if', 'opts', '.', 'output', 'not', 'in', '(', '"json"', ',', '"pretty_json"', ')', ':', 'return', 'False', 'root', '=', '{', '"data"', ':', 'data', '}', 'if', 'page_info', 'is', 'not', 'None', 'and', 'page_info', '.', 'is...
Maybe print data as JSON.
['Maybe', 'print', 'data', 'as', 'JSON', '.']
train
https://github.com/cloudsmith-io/cloudsmith-cli/blob/5bc245ca5d0bfa85380be48e7c206b4c86cc6c8e/cloudsmith_cli/cli/utils.py#L107-L124
1,561
ahmontero/dop
dop/client.py
Client.destroy_domain_record
def destroy_domain_record(self, domain_id, record_id): """ This method deletes the specified domain record. Required parameters domain_id: Integer or Domain Name (e.g. domain.com), specifies the domain for which to destroy a record. reco...
python
def destroy_domain_record(self, domain_id, record_id): """ This method deletes the specified domain record. Required parameters domain_id: Integer or Domain Name (e.g. domain.com), specifies the domain for which to destroy a record. reco...
['def', 'destroy_domain_record', '(', 'self', ',', 'domain_id', ',', 'record_id', ')', ':', 'json', '=', 'self', '.', 'request', '(', "'/domains/%s/records/%s/destroy'", '%', '(', 'domain_id', ',', 'record_id', ')', ',', 'method', '=', "'GET'", ')', 'status', '=', 'json', '.', 'get', '(', "'status'", ')', 'return', 'st...
This method deletes the specified domain record. Required parameters domain_id: Integer or Domain Name (e.g. domain.com), specifies the domain for which to destroy a record. record_id: Integer, specifies the record_id to destroy.
['This', 'method', 'deletes', 'the', 'specified', 'domain', 'record', '.']
train
https://github.com/ahmontero/dop/blob/40354ac6feefe92a7555fe2d1834138c9a03e518/dop/client.py#L877-L893
1,562
saxix/django-concurrency
src/concurrency/utils.py
flatten
def flatten(iterable): """ flatten(sequence) -> list Returns a single, flat list which contains all elements retrieved from the sequence and all recursively contained sub-sequences (iterables). :param sequence: any object that implements iterable protocol (see: :ref:`typeiter`) :return: li...
python
def flatten(iterable): """ flatten(sequence) -> list Returns a single, flat list which contains all elements retrieved from the sequence and all recursively contained sub-sequences (iterables). :param sequence: any object that implements iterable protocol (see: :ref:`typeiter`) :return: li...
['def', 'flatten', '(', 'iterable', ')', ':', 'result', '=', 'list', '(', ')', 'for', 'el', 'in', 'iterable', ':', 'if', 'hasattr', '(', 'el', ',', '"__iter__"', ')', 'and', 'not', 'isinstance', '(', 'el', ',', 'str', ')', ':', 'result', '.', 'extend', '(', 'flatten', '(', 'el', ')', ')', 'else', ':', 'result', '.', 'a...
flatten(sequence) -> list Returns a single, flat list which contains all elements retrieved from the sequence and all recursively contained sub-sequences (iterables). :param sequence: any object that implements iterable protocol (see: :ref:`typeiter`) :return: list Examples: >>> from adm...
['flatten', '(', 'sequence', ')', '-', '>', 'list']
train
https://github.com/saxix/django-concurrency/blob/9a289dc007b1cdf609b7dfb77a6d2868abc8097f/src/concurrency/utils.py#L188-L214
1,563
ubernostrum/django-flashpolicies
flashpolicies/policies.py
Policy.allow_headers
def allow_headers(self, domain, headers, secure=True): """ Allows ``domain`` to push data via the HTTP headers named in ``headers``. As with ``allow_domain``, ``domain`` may be either a full domain name or a wildcard. Again, use of wildcards is discouraged for security r...
python
def allow_headers(self, domain, headers, secure=True): """ Allows ``domain`` to push data via the HTTP headers named in ``headers``. As with ``allow_domain``, ``domain`` may be either a full domain name or a wildcard. Again, use of wildcards is discouraged for security r...
['def', 'allow_headers', '(', 'self', ',', 'domain', ',', 'headers', ',', 'secure', '=', 'True', ')', ':', 'if', 'self', '.', 'site_control', '==', 'SITE_CONTROL_NONE', ':', 'raise', 'TypeError', '(', 'METAPOLICY_ERROR', '.', 'format', '(', '"allow headers from a domain"', ')', ')', 'self', '.', 'header_domains', '[', ...
Allows ``domain`` to push data via the HTTP headers named in ``headers``. As with ``allow_domain``, ``domain`` may be either a full domain name or a wildcard. Again, use of wildcards is discouraged for security reasons. The value for ``headers`` should be a list of header names...
['Allows', 'domain', 'to', 'push', 'data', 'via', 'the', 'HTTP', 'headers', 'named', 'in', 'headers', '.']
train
https://github.com/ubernostrum/django-flashpolicies/blob/fb04693504186dde859cce97bad6e83d2b380dc6/flashpolicies/policies.py#L140-L163
1,564
mikedh/trimesh
trimesh/path/polygons.py
edges_to_polygons
def edges_to_polygons(edges, vertices): """ Given an edge list of indices and associated vertices representing lines, generate a list of polygons. Parameters ----------- edges : (n, 2) int Indexes of vertices which represent lines vertices : (m, 2) float Vertices in 2D space ...
python
def edges_to_polygons(edges, vertices): """ Given an edge list of indices and associated vertices representing lines, generate a list of polygons. Parameters ----------- edges : (n, 2) int Indexes of vertices which represent lines vertices : (m, 2) float Vertices in 2D space ...
['def', 'edges_to_polygons', '(', 'edges', ',', 'vertices', ')', ':', '# create closed polygon objects', 'polygons', '=', '[', ']', '# loop through a sequence of ordered traversals', 'for', 'dfs', 'in', 'graph', '.', 'traversals', '(', 'edges', ',', 'mode', '=', "'dfs'", ')', ':', 'try', ':', '# try to recover polygons...
Given an edge list of indices and associated vertices representing lines, generate a list of polygons. Parameters ----------- edges : (n, 2) int Indexes of vertices which represent lines vertices : (m, 2) float Vertices in 2D space Returns ---------- polygons : (p,) shapely...
['Given', 'an', 'edge', 'list', 'of', 'indices', 'and', 'associated', 'vertices', 'representing', 'lines', 'generate', 'a', 'list', 'of', 'polygons', '.']
train
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/polygons.py#L99-L142
1,565
saltstack/salt
salt/cloud/clouds/joyent.py
reformat_node
def reformat_node(item=None, full=False): ''' Reformat the returned data from joyent, determine public/private IPs and strip out fields if necessary to provide either full or brief content. :param item: node dictionary :param full: full or brief output :return: dict ''' desired_keys = [...
python
def reformat_node(item=None, full=False): ''' Reformat the returned data from joyent, determine public/private IPs and strip out fields if necessary to provide either full or brief content. :param item: node dictionary :param full: full or brief output :return: dict ''' desired_keys = [...
['def', 'reformat_node', '(', 'item', '=', 'None', ',', 'full', '=', 'False', ')', ':', 'desired_keys', '=', '[', "'id'", ',', "'name'", ',', "'state'", ',', "'public_ips'", ',', "'private_ips'", ',', "'size'", ',', "'image'", ',', "'location'", ']', 'item', '[', "'private_ips'", ']', '=', '[', ']', 'item', '[', "'publ...
Reformat the returned data from joyent, determine public/private IPs and strip out fields if necessary to provide either full or brief content. :param item: node dictionary :param full: full or brief output :return: dict
['Reformat', 'the', 'returned', 'data', 'from', 'joyent', 'determine', 'public', '/', 'private', 'IPs', 'and', 'strip', 'out', 'fields', 'if', 'necessary', 'to', 'provide', 'either', 'full', 'or', 'brief', 'content', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/joyent.py#L674-L714
1,566
ranaroussi/ezibpy
ezibpy/ezibpy.py
ezIBpy.createCashContract
def createCashContract(self, symbol, currency="USD", exchange="IDEALPRO"): """ Used for FX, etc: createCashContract("EUR", currency="USD") """ contract_tuple = (symbol, "CASH", exchange, currency, "", 0.0, "") contract = self.createContract(contract_tuple) return contract
python
def createCashContract(self, symbol, currency="USD", exchange="IDEALPRO"): """ Used for FX, etc: createCashContract("EUR", currency="USD") """ contract_tuple = (symbol, "CASH", exchange, currency, "", 0.0, "") contract = self.createContract(contract_tuple) return contract
['def', 'createCashContract', '(', 'self', ',', 'symbol', ',', 'currency', '=', '"USD"', ',', 'exchange', '=', '"IDEALPRO"', ')', ':', 'contract_tuple', '=', '(', 'symbol', ',', '"CASH"', ',', 'exchange', ',', 'currency', ',', '""', ',', '0.0', ',', '""', ')', 'contract', '=', 'self', '.', 'createContract', '(', 'contr...
Used for FX, etc: createCashContract("EUR", currency="USD")
['Used', 'for', 'FX', 'etc', ':', 'createCashContract', '(', 'EUR', 'currency', '=', 'USD', ')']
train
https://github.com/ranaroussi/ezibpy/blob/1a9d4bf52018abd2a01af7c991d7cf00cda53e0c/ezibpy/ezibpy.py#L1520-L1526
1,567
tensorflow/tensor2tensor
tensor2tensor/utils/metrics.py
image_summary
def image_summary(predictions, targets, hparams): """Reshapes predictions and passes it to tensorboard. Args: predictions : The predicted image (logits). targets : The ground truth. hparams: model hparams. Returns: summary_proto: containing the summary images. weights: A Tensor of zeros of t...
python
def image_summary(predictions, targets, hparams): """Reshapes predictions and passes it to tensorboard. Args: predictions : The predicted image (logits). targets : The ground truth. hparams: model hparams. Returns: summary_proto: containing the summary images. weights: A Tensor of zeros of t...
['def', 'image_summary', '(', 'predictions', ',', 'targets', ',', 'hparams', ')', ':', 'del', 'hparams', 'results', '=', 'tf', '.', 'cast', '(', 'tf', '.', 'argmax', '(', 'predictions', ',', 'axis', '=', '-', '1', ')', ',', 'tf', '.', 'uint8', ')', 'gold', '=', 'tf', '.', 'cast', '(', 'targets', ',', 'tf', '.', 'uint8'...
Reshapes predictions and passes it to tensorboard. Args: predictions : The predicted image (logits). targets : The ground truth. hparams: model hparams. Returns: summary_proto: containing the summary images. weights: A Tensor of zeros of the same shape as predictions.
['Reshapes', 'predictions', 'and', 'passes', 'it', 'to', 'tensorboard', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/metrics.py#L396-L414
1,568
numenta/htmresearch
projects/combined_sequences/combined_sequences.py
runExperiment4B
def runExperiment4B(dirName): """ This runs the second experiment in the section "Simulations with Pure Temporal Sequences". Here we check accuracy of the L2/L4 networks in classifying the sequences. This experiment averages over many parameter combinations and could take several minutes. """ # Results ar...
python
def runExperiment4B(dirName): """ This runs the second experiment in the section "Simulations with Pure Temporal Sequences". Here we check accuracy of the L2/L4 networks in classifying the sequences. This experiment averages over many parameter combinations and could take several minutes. """ # Results ar...
['def', 'runExperiment4B', '(', 'dirName', ')', ':', '# Results are put into a pkl file which can be used to generate the plots.', '# dirName is the absolute path where the pkl file will be placed.', 'resultsName', '=', 'os', '.', 'path', '.', 'join', '(', 'dirName', ',', '"sequence_batch_high_dec_normal_features.pkl"'...
This runs the second experiment in the section "Simulations with Pure Temporal Sequences". Here we check accuracy of the L2/L4 networks in classifying the sequences. This experiment averages over many parameter combinations and could take several minutes.
['This', 'runs', 'the', 'second', 'experiment', 'in', 'the', 'section', 'Simulations', 'with', 'Pure', 'Temporal', 'Sequences', '.', 'Here', 'we', 'check', 'accuracy', 'of', 'the', 'L2', '/', 'L4', 'networks', 'in', 'classifying', 'the', 'sequences', '.', 'This', 'experiment', 'averages', 'over', 'many', 'parameter', '...
train
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/combined_sequences/combined_sequences.py#L703-L728
1,569
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_arp.py
brocade_arp.hide_arp_holder_arp_entry_interfacetype_HundredGigabitEthernet_HundredGigabitEthernet
def hide_arp_holder_arp_entry_interfacetype_HundredGigabitEthernet_HundredGigabitEthernet(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") hide_arp_holder = ET.SubElement(config, "hide-arp-holder", xmlns="urn:brocade.com:mgmt:brocade-arp") arp_entry = ET....
python
def hide_arp_holder_arp_entry_interfacetype_HundredGigabitEthernet_HundredGigabitEthernet(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") hide_arp_holder = ET.SubElement(config, "hide-arp-holder", xmlns="urn:brocade.com:mgmt:brocade-arp") arp_entry = ET....
['def', 'hide_arp_holder_arp_entry_interfacetype_HundredGigabitEthernet_HundredGigabitEthernet', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'hide_arp_holder', '=', 'ET', '.', 'SubElement', '(', 'config', ',', '"hide-arp-holder"', ',', 'xmlns', '=', '"urn:b...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_arp.py#L128-L142
1,570
Geotab/mygeotab-python
mygeotab/api.py
server_call
def server_call(method, server, timeout=DEFAULT_TIMEOUT, verify_ssl=True, **parameters): """Makes a call to an un-authenticated method on a server :param method: The method name. :type method: str :param server: The MyGeotab server. :type server: str :param timeout: The timeout to make the call...
python
def server_call(method, server, timeout=DEFAULT_TIMEOUT, verify_ssl=True, **parameters): """Makes a call to an un-authenticated method on a server :param method: The method name. :type method: str :param server: The MyGeotab server. :type server: str :param timeout: The timeout to make the call...
['def', 'server_call', '(', 'method', ',', 'server', ',', 'timeout', '=', 'DEFAULT_TIMEOUT', ',', 'verify_ssl', '=', 'True', ',', '*', '*', 'parameters', ')', ':', 'if', 'method', 'is', 'None', ':', 'raise', 'Exception', '(', '"A method name must be specified"', ')', 'if', 'server', 'is', 'None', ':', 'raise', 'Excepti...
Makes a call to an un-authenticated method on a server :param method: The method name. :type method: str :param server: The MyGeotab server. :type server: str :param timeout: The timeout to make the call, in seconds. By default, this is 300 seconds (or 5 minutes). :type timeout: float :para...
['Makes', 'a', 'call', 'to', 'an', 'un', '-', 'authenticated', 'method', 'on', 'a', 'server']
train
https://github.com/Geotab/mygeotab-python/blob/baa678e7df90bdd15f5dc55c1374b5c048791a94/mygeotab/api.py#L336-L357
1,571
MacHu-GWU/dataIO-project
dataIO/zzz_manual_install.py
find_venv_DST
def find_venv_DST(): """Find where this package should be installed to in this virtualenv. For example: ``/path-to-venv/lib/python2.7/site-packages/package-name`` """ dir_path = os.path.dirname(SRC) if SYS_NAME == "Windows": DST = os.path.join(dir_path, "Lib", "site-packages", PKG_NAME) ...
python
def find_venv_DST(): """Find where this package should be installed to in this virtualenv. For example: ``/path-to-venv/lib/python2.7/site-packages/package-name`` """ dir_path = os.path.dirname(SRC) if SYS_NAME == "Windows": DST = os.path.join(dir_path, "Lib", "site-packages", PKG_NAME) ...
['def', 'find_venv_DST', '(', ')', ':', 'dir_path', '=', 'os', '.', 'path', '.', 'dirname', '(', 'SRC', ')', 'if', 'SYS_NAME', '==', '"Windows"', ':', 'DST', '=', 'os', '.', 'path', '.', 'join', '(', 'dir_path', ',', '"Lib"', ',', '"site-packages"', ',', 'PKG_NAME', ')', 'elif', 'SYS_NAME', 'in', '[', '"Darwin"', ',', ...
Find where this package should be installed to in this virtualenv. For example: ``/path-to-venv/lib/python2.7/site-packages/package-name``
['Find', 'where', 'this', 'package', 'should', 'be', 'installed', 'to', 'in', 'this', 'virtualenv', '.']
train
https://github.com/MacHu-GWU/dataIO-project/blob/7e1cc192b5e53426eed6dbd742918619b8fd60ab/dataIO/zzz_manual_install.py#L87-L100
1,572
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/mavproxy.py
unload_module
def unload_module(modname): '''unload a module''' for (m,pm) in mpstate.modules: if m.name == modname: if hasattr(m, 'unload'): m.unload() mpstate.modules.remove((m,pm)) print("Unloaded module %s" % modname) return True print("Unable to...
python
def unload_module(modname): '''unload a module''' for (m,pm) in mpstate.modules: if m.name == modname: if hasattr(m, 'unload'): m.unload() mpstate.modules.remove((m,pm)) print("Unloaded module %s" % modname) return True print("Unable to...
['def', 'unload_module', '(', 'modname', ')', ':', 'for', '(', 'm', ',', 'pm', ')', 'in', 'mpstate', '.', 'modules', ':', 'if', 'm', '.', 'name', '==', 'modname', ':', 'if', 'hasattr', '(', 'm', ',', "'unload'", ')', ':', 'm', '.', 'unload', '(', ')', 'mpstate', '.', 'modules', '.', 'remove', '(', '(', 'm', ',', 'pm', ...
unload a module
['unload', 'a', 'module']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/mavproxy.py#L313-L323
1,573
mushkevych/scheduler
synergy/mq/flopsy.py
PublishersPool._close
def _close(self, name, suppress_logging): """ closes one particular pool and all its amqp amqp connections """ try: pool_names = list(self.pools) if name in pool_names: self.pools[name].close() del self.pools[name] except Exception as e: ...
python
def _close(self, name, suppress_logging): """ closes one particular pool and all its amqp amqp connections """ try: pool_names = list(self.pools) if name in pool_names: self.pools[name].close() del self.pools[name] except Exception as e: ...
['def', '_close', '(', 'self', ',', 'name', ',', 'suppress_logging', ')', ':', 'try', ':', 'pool_names', '=', 'list', '(', 'self', '.', 'pools', ')', 'if', 'name', 'in', 'pool_names', ':', 'self', '.', 'pools', '[', 'name', ']', '.', 'close', '(', ')', 'del', 'self', '.', 'pools', '[', 'name', ']', 'except', 'Exception...
closes one particular pool and all its amqp amqp connections
['closes', 'one', 'particular', 'pool', 'and', 'all', 'its', 'amqp', 'amqp', 'connections']
train
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mq/flopsy.py#L263-L272
1,574
prompt-toolkit/pyvim
pyvim/layout.py
EditorLayout._create_window_frame
def _create_window_frame(self, editor_buffer): """ Create a Window for the buffer, with underneat a status bar. """ @Condition def wrap_lines(): return self.editor.wrap_lines window = Window( self._create_buffer_control(editor_buffer), ...
python
def _create_window_frame(self, editor_buffer): """ Create a Window for the buffer, with underneat a status bar. """ @Condition def wrap_lines(): return self.editor.wrap_lines window = Window( self._create_buffer_control(editor_buffer), ...
['def', '_create_window_frame', '(', 'self', ',', 'editor_buffer', ')', ':', '@', 'Condition', 'def', 'wrap_lines', '(', ')', ':', 'return', 'self', '.', 'editor', '.', 'wrap_lines', 'window', '=', 'Window', '(', 'self', '.', '_create_buffer_control', '(', 'editor_buffer', ')', ',', 'allow_scroll_beyond_bottom', '=', '...
Create a Window for the buffer, with underneat a status bar.
['Create', 'a', 'Window', 'for', 'the', 'buffer', 'with', 'underneat', 'a', 'status', 'bar', '.']
train
https://github.com/prompt-toolkit/pyvim/blob/5928b53b9d700863c1a06d2181a034a955f94594/pyvim/layout.py#L529-L564
1,575
Kortemme-Lab/klab
klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py
_compare_mp_alias
def _compare_mp_alias(br_i, br_j, analysis_set, analysis_set_subdir, unique_ajps, verbose): """ Alias for instance method that allows the method to be called in a multiprocessing pool. Needed as multiprocessing does not otherwise work on object instance methods. """ return br_i.compare(br_j, ana...
python
def _compare_mp_alias(br_i, br_j, analysis_set, analysis_set_subdir, unique_ajps, verbose): """ Alias for instance method that allows the method to be called in a multiprocessing pool. Needed as multiprocessing does not otherwise work on object instance methods. """ return br_i.compare(br_j, ana...
['def', '_compare_mp_alias', '(', 'br_i', ',', 'br_j', ',', 'analysis_set', ',', 'analysis_set_subdir', ',', 'unique_ajps', ',', 'verbose', ')', ':', 'return', 'br_i', '.', 'compare', '(', 'br_j', ',', 'analysis_set', ',', 'analysis_set_subdir', ',', 'unique_ajps', ',', 'verbose', '=', 'verbose', ',', 'compile_pdf', '=...
Alias for instance method that allows the method to be called in a multiprocessing pool. Needed as multiprocessing does not otherwise work on object instance methods.
['Alias', 'for', 'instance', 'method', 'that', 'allows', 'the', 'method', 'to', 'be', 'called', 'in', 'a', 'multiprocessing', 'pool', '.', 'Needed', 'as', 'multiprocessing', 'does', 'not', 'otherwise', 'work', 'on', 'object', 'instance', 'methods', '.']
train
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L2244-L2250
1,576
bokeh/bokeh
bokeh/client/session.py
push_session
def push_session(document, session_id=None, url='default', io_loop=None): ''' Create a session by pushing the given document to the server, overwriting any existing server-side document. ``session.document`` in the returned session will be your supplied document. While the connection to the server is o...
python
def push_session(document, session_id=None, url='default', io_loop=None): ''' Create a session by pushing the given document to the server, overwriting any existing server-side document. ``session.document`` in the returned session will be your supplied document. While the connection to the server is o...
['def', 'push_session', '(', 'document', ',', 'session_id', '=', 'None', ',', 'url', '=', "'default'", ',', 'io_loop', '=', 'None', ')', ':', 'coords', '=', '_SessionCoordinates', '(', 'session_id', '=', 'session_id', ',', 'url', '=', 'url', ')', 'session', '=', 'ClientSession', '(', 'session_id', '=', 'coords', '.', '...
Create a session by pushing the given document to the server, overwriting any existing server-side document. ``session.document`` in the returned session will be your supplied document. While the connection to the server is open, changes made on the server side will be applied to this document, and cha...
['Create', 'a', 'session', 'by', 'pushing', 'the', 'given', 'document', 'to', 'the', 'server', 'overwriting', 'any', 'existing', 'server', '-', 'side', 'document', '.']
train
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L127-L169
1,577
has2k1/plotnine
plotnine/geoms/geom_path.py
_draw_segments
def _draw_segments(data, ax, **params): """ Draw independent line segments between all the points """ color = to_rgba(data['color'], data['alpha']) # All we do is line-up all the points in a group # into segments, all in a single list. # Along the way the other parameters are put in ...
python
def _draw_segments(data, ax, **params): """ Draw independent line segments between all the points """ color = to_rgba(data['color'], data['alpha']) # All we do is line-up all the points in a group # into segments, all in a single list. # Along the way the other parameters are put in ...
['def', '_draw_segments', '(', 'data', ',', 'ax', ',', '*', '*', 'params', ')', ':', 'color', '=', 'to_rgba', '(', 'data', '[', "'color'", ']', ',', 'data', '[', "'alpha'", ']', ')', '# All we do is line-up all the points in a group', '# into segments, all in a single list.', '# Along the way the other parameters are p...
Draw independent line segments between all the points
['Draw', 'independent', 'line', 'segments', 'between', 'all', 'the', 'points']
train
https://github.com/has2k1/plotnine/blob/566e579af705367e584fb27a74e6c5199624ca89/plotnine/geoms/geom_path.py#L341-L375
1,578
sernst/cauldron
cauldron/cli/server/run.py
get_running_step_changes
def get_running_step_changes(write: bool = False) -> list: """...""" project = cd.project.get_internal_project() running_steps = list(filter( lambda step: step.is_running, project.steps )) def get_changes(step): step_data = writing.step_writer.serialize(step) if wr...
python
def get_running_step_changes(write: bool = False) -> list: """...""" project = cd.project.get_internal_project() running_steps = list(filter( lambda step: step.is_running, project.steps )) def get_changes(step): step_data = writing.step_writer.serialize(step) if wr...
['def', 'get_running_step_changes', '(', 'write', ':', 'bool', '=', 'False', ')', '->', 'list', ':', 'project', '=', 'cd', '.', 'project', '.', 'get_internal_project', '(', ')', 'running_steps', '=', 'list', '(', 'filter', '(', 'lambda', 'step', ':', 'step', '.', 'is_running', ',', 'project', '.', 'steps', ')', ')', 'd...
...
['...']
train
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/cli/server/run.py#L53-L75
1,579
ska-sa/purr
Purr/Plugins/local_pychart/text_box.py
T.add_arrow
def add_arrow(self, tipLoc, tail=None, arrow=arrow.default): """This method adds a straight arrow that points to @var{TIPLOC}, which is a tuple of integers. @var{TAIL} specifies the starting point of the arrow. It is either None or a string consisting of the following letters: 'l', 'c', ...
python
def add_arrow(self, tipLoc, tail=None, arrow=arrow.default): """This method adds a straight arrow that points to @var{TIPLOC}, which is a tuple of integers. @var{TAIL} specifies the starting point of the arrow. It is either None or a string consisting of the following letters: 'l', 'c', ...
['def', 'add_arrow', '(', 'self', ',', 'tipLoc', ',', 'tail', '=', 'None', ',', 'arrow', '=', 'arrow', '.', 'default', ')', ':', 'self', '.', '_arrows', '.', 'append', '(', '(', 'tipLoc', ',', 'tail', ',', 'arrow', ')', ')']
This method adds a straight arrow that points to @var{TIPLOC}, which is a tuple of integers. @var{TAIL} specifies the starting point of the arrow. It is either None or a string consisting of the following letters: 'l', 'c', 'r', 't', 'm,', and 'b'. Letters 'l', 'c', or 'r' means to ...
['This', 'method', 'adds', 'a', 'straight', 'arrow', 'that', 'points', 'to']
train
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/Plugins/local_pychart/text_box.py#L86-L99
1,580
odlgroup/odl
odl/contrib/mrc/uncompr_bin.py
FileWriterRawBinaryWithHeader.write_header
def write_header(self): """Write `header` to `file`. See Also -------- write_data """ for properties in self.header.values(): value = properties['value'] offset_bytes = int(properties['offset']) self.file.seek(offset_bytes) ...
python
def write_header(self): """Write `header` to `file`. See Also -------- write_data """ for properties in self.header.values(): value = properties['value'] offset_bytes = int(properties['offset']) self.file.seek(offset_bytes) ...
['def', 'write_header', '(', 'self', ')', ':', 'for', 'properties', 'in', 'self', '.', 'header', '.', 'values', '(', ')', ':', 'value', '=', 'properties', '[', "'value'", ']', 'offset_bytes', '=', 'int', '(', 'properties', '[', "'offset'", ']', ')', 'self', '.', 'file', '.', 'seek', '(', 'offset_bytes', ')', 'value', '...
Write `header` to `file`. See Also -------- write_data
['Write', 'header', 'to', 'file', '.']
train
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/contrib/mrc/uncompr_bin.py#L642-L653
1,581
buildbot/buildbot
worker/buildbot_worker/compat.py
bytes2NativeString
def bytes2NativeString(x, encoding='utf-8'): """ Convert C{bytes} to a native C{str}. On Python 3 and higher, str and bytes are not equivalent. In this case, decode the bytes, and return a native string. On Python 2 and lower, str and bytes are equivalent. In this case, just just ret...
python
def bytes2NativeString(x, encoding='utf-8'): """ Convert C{bytes} to a native C{str}. On Python 3 and higher, str and bytes are not equivalent. In this case, decode the bytes, and return a native string. On Python 2 and lower, str and bytes are equivalent. In this case, just just ret...
['def', 'bytes2NativeString', '(', 'x', ',', 'encoding', '=', "'utf-8'", ')', ':', 'if', 'isinstance', '(', 'x', ',', 'bytes', ')', 'and', 'str', '!=', 'bytes', ':', 'return', 'x', '.', 'decode', '(', 'encoding', ')', 'return', 'x']
Convert C{bytes} to a native C{str}. On Python 3 and higher, str and bytes are not equivalent. In this case, decode the bytes, and return a native string. On Python 2 and lower, str and bytes are equivalent. In this case, just just return the native string. @param x: a string of type C{...
['Convert', 'C', '{', 'bytes', '}', 'to', 'a', 'native', 'C', '{', 'str', '}', '.']
train
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/compat.py#L38-L56
1,582
frostming/atoml
atoml/decoder.py
Decoder.parse
def parse(self, data=None, table_name=None): """Parse the lines from index i :param data: optional, store the parsed result to it when specified :param table_name: when inside a table array, it is the table name """ temp = self.dict_() sub_table = None is_array =...
python
def parse(self, data=None, table_name=None): """Parse the lines from index i :param data: optional, store the parsed result to it when specified :param table_name: when inside a table array, it is the table name """ temp = self.dict_() sub_table = None is_array =...
['def', 'parse', '(', 'self', ',', 'data', '=', 'None', ',', 'table_name', '=', 'None', ')', ':', 'temp', '=', 'self', '.', 'dict_', '(', ')', 'sub_table', '=', 'None', 'is_array', '=', 'False', 'line', '=', "''", 'while', 'True', ':', 'line', '=', 'self', '.', '_readline', '(', ')', 'if', 'not', 'line', ':', 'self', '...
Parse the lines from index i :param data: optional, store the parsed result to it when specified :param table_name: when inside a table array, it is the table name
['Parse', 'the', 'lines', 'from', 'index', 'i']
train
https://github.com/frostming/atoml/blob/85414ef77777366887a819a05b496d5279296cd2/atoml/decoder.py#L323-L386
1,583
maxpumperla/elephas
elephas/utils/rdd_utils.py
lp_to_simple_rdd
def lp_to_simple_rdd(lp_rdd, categorical=False, nb_classes=None): """Convert a LabeledPoint RDD into an RDD of feature-label pairs :param lp_rdd: LabeledPoint RDD of features and labels :param categorical: boolean, if labels should be one-hot encode when returned :param nb_classes: int, number of total...
python
def lp_to_simple_rdd(lp_rdd, categorical=False, nb_classes=None): """Convert a LabeledPoint RDD into an RDD of feature-label pairs :param lp_rdd: LabeledPoint RDD of features and labels :param categorical: boolean, if labels should be one-hot encode when returned :param nb_classes: int, number of total...
['def', 'lp_to_simple_rdd', '(', 'lp_rdd', ',', 'categorical', '=', 'False', ',', 'nb_classes', '=', 'None', ')', ':', 'if', 'categorical', ':', 'if', 'not', 'nb_classes', ':', 'labels', '=', 'np', '.', 'asarray', '(', 'lp_rdd', '.', 'map', '(', 'lambda', 'lp', ':', 'lp', '.', 'label', ')', '.', 'collect', '(', ')', ',...
Convert a LabeledPoint RDD into an RDD of feature-label pairs :param lp_rdd: LabeledPoint RDD of features and labels :param categorical: boolean, if labels should be one-hot encode when returned :param nb_classes: int, number of total classes :return: Spark RDD with feature-label pairs
['Convert', 'a', 'LabeledPoint', 'RDD', 'into', 'an', 'RDD', 'of', 'feature', '-', 'label', 'pairs']
train
https://github.com/maxpumperla/elephas/blob/84605acdc9564673c487637dcb27f5def128bcc7/elephas/utils/rdd_utils.py#L104-L121
1,584
datastax/python-driver
cassandra/cluster.py
ResultSet.fetch_next_page
def fetch_next_page(self): """ Manually, synchronously fetch the next page. Supplied for manually retrieving pages and inspecting :meth:`~.current_page`. It is not necessary to call this when iterating through results; paging happens implicitly in iteration. """ if self.r...
python
def fetch_next_page(self): """ Manually, synchronously fetch the next page. Supplied for manually retrieving pages and inspecting :meth:`~.current_page`. It is not necessary to call this when iterating through results; paging happens implicitly in iteration. """ if self.r...
['def', 'fetch_next_page', '(', 'self', ')', ':', 'if', 'self', '.', 'response_future', '.', 'has_more_pages', ':', 'self', '.', 'response_future', '.', 'start_fetching_next_page', '(', ')', 'result', '=', 'self', '.', 'response_future', '.', 'result', '(', ')', 'self', '.', '_current_rows', '=', 'result', '.', '_curre...
Manually, synchronously fetch the next page. Supplied for manually retrieving pages and inspecting :meth:`~.current_page`. It is not necessary to call this when iterating through results; paging happens implicitly in iteration.
['Manually', 'synchronously', 'fetch', 'the', 'next', 'page', '.', 'Supplied', 'for', 'manually', 'retrieving', 'pages', 'and', 'inspecting', ':', 'meth', ':', '~', '.', 'current_page', '.', 'It', 'is', 'not', 'necessary', 'to', 'call', 'this', 'when', 'iterating', 'through', 'results', ';', 'paging', 'happens', 'impli...
train
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/cluster.py#L4424-L4435
1,585
ereOn/azmq
azmq/common.py
CompositeClosableAsyncObject.register_child
def register_child(self, child): """ Register a new child that will be closed whenever the current instance closes. :param child: The child instance. """ if self.closing: child.close() else: self._children.add(child) child.on_c...
python
def register_child(self, child): """ Register a new child that will be closed whenever the current instance closes. :param child: The child instance. """ if self.closing: child.close() else: self._children.add(child) child.on_c...
['def', 'register_child', '(', 'self', ',', 'child', ')', ':', 'if', 'self', '.', 'closing', ':', 'child', '.', 'close', '(', ')', 'else', ':', 'self', '.', '_children', '.', 'add', '(', 'child', ')', 'child', '.', 'on_closed', '.', 'connect', '(', 'self', '.', 'unregister_child', ')']
Register a new child that will be closed whenever the current instance closes. :param child: The child instance.
['Register', 'a', 'new', 'child', 'that', 'will', 'be', 'closed', 'whenever', 'the', 'current', 'instance', 'closes', '.']
train
https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L202-L213
1,586
zengbin93/zb
zb/base.py
ZbList.discrete_index
def discrete_index(self, indices): """get elements by discrete indices :param indices: list discrete indices :return: elements """ elements = [] for i in indices: elements.append(self[i]) return elements
python
def discrete_index(self, indices): """get elements by discrete indices :param indices: list discrete indices :return: elements """ elements = [] for i in indices: elements.append(self[i]) return elements
['def', 'discrete_index', '(', 'self', ',', 'indices', ')', ':', 'elements', '=', '[', ']', 'for', 'i', 'in', 'indices', ':', 'elements', '.', 'append', '(', 'self', '[', 'i', ']', ')', 'return', 'elements']
get elements by discrete indices :param indices: list discrete indices :return: elements
['get', 'elements', 'by', 'discrete', 'indices']
train
https://github.com/zengbin93/zb/blob/ccdb384a0b5801b459933220efcb71972c2b89a7/zb/base.py#L28-L38
1,587
chakki-works/seqeval
seqeval/callbacks.py
F1Metrics.get_length
def get_length(self, y): """Get true length of y. Args: y (list): padded list. Returns: lens: true length of y. Examples: >>> y = [[1, 0, 0], [1, 1, 0], [1, 1, 1]] >>> self.get_length(y) [1, 2, 3] """ lens = [...
python
def get_length(self, y): """Get true length of y. Args: y (list): padded list. Returns: lens: true length of y. Examples: >>> y = [[1, 0, 0], [1, 1, 0], [1, 1, 1]] >>> self.get_length(y) [1, 2, 3] """ lens = [...
['def', 'get_length', '(', 'self', ',', 'y', ')', ':', 'lens', '=', '[', 'self', '.', 'find_pad_index', '(', 'row', ')', 'for', 'row', 'in', 'y', ']', 'return', 'lens']
Get true length of y. Args: y (list): padded list. Returns: lens: true length of y. Examples: >>> y = [[1, 0, 0], [1, 1, 0], [1, 1, 1]] >>> self.get_length(y) [1, 2, 3]
['Get', 'true', 'length', 'of', 'y', '.']
train
https://github.com/chakki-works/seqeval/blob/f1e5ff1a94da11500c47fd11d4d72617f7f55911/seqeval/callbacks.py#L40-L55
1,588
pycontribs/pyrax
pyrax/__init__.py
connect_to_cloudfiles
def connect_to_cloudfiles(region=None, public=None): """Creates a client for working with CloudFiles/Swift.""" if public is None: is_public = not bool(get_setting("use_servicenet")) else: is_public = public ret = _create_client(ep_name="object_store", region=region, public=is...
python
def connect_to_cloudfiles(region=None, public=None): """Creates a client for working with CloudFiles/Swift.""" if public is None: is_public = not bool(get_setting("use_servicenet")) else: is_public = public ret = _create_client(ep_name="object_store", region=region, public=is...
['def', 'connect_to_cloudfiles', '(', 'region', '=', 'None', ',', 'public', '=', 'None', ')', ':', 'if', 'public', 'is', 'None', ':', 'is_public', '=', 'not', 'bool', '(', 'get_setting', '(', '"use_servicenet"', ')', ')', 'else', ':', 'is_public', '=', 'public', 'ret', '=', '_create_client', '(', 'ep_name', '=', '"obje...
Creates a client for working with CloudFiles/Swift.
['Creates', 'a', 'client', 'for', 'working', 'with', 'CloudFiles', '/', 'Swift', '.']
train
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/__init__.py#L730-L743
1,589
Midnighter/dependency-info
src/depinfo/info.py
get_sys_info
def get_sys_info(): """Return system information as a dict.""" blob = dict() blob["OS"] = platform.system() blob["OS-release"] = platform.release() blob["Python"] = platform.python_version() return blob
python
def get_sys_info(): """Return system information as a dict.""" blob = dict() blob["OS"] = platform.system() blob["OS-release"] = platform.release() blob["Python"] = platform.python_version() return blob
['def', 'get_sys_info', '(', ')', ':', 'blob', '=', 'dict', '(', ')', 'blob', '[', '"OS"', ']', '=', 'platform', '.', 'system', '(', ')', 'blob', '[', '"OS-release"', ']', '=', 'platform', '.', 'release', '(', ')', 'blob', '[', '"Python"', ']', '=', 'platform', '.', 'python_version', '(', ')', 'return', 'blob']
Return system information as a dict.
['Return', 'system', 'information', 'as', 'a', 'dict', '.']
train
https://github.com/Midnighter/dependency-info/blob/15bcada0a1d6c047cbe10b844d5bd909ea8cc752/src/depinfo/info.py#L38-L44
1,590
secdev/scapy
scapy/layers/tls/automaton.py
_TLSAutomaton.raise_on_packet
def raise_on_packet(self, pkt_cls, state, get_next_msg=True): """ If the next message to be processed has type 'pkt_cls', raise 'state'. If there is no message waiting to be processed, we try to get one with the default 'get_next_msg' parameters. """ # Maybe we already pa...
python
def raise_on_packet(self, pkt_cls, state, get_next_msg=True): """ If the next message to be processed has type 'pkt_cls', raise 'state'. If there is no message waiting to be processed, we try to get one with the default 'get_next_msg' parameters. """ # Maybe we already pa...
['def', 'raise_on_packet', '(', 'self', ',', 'pkt_cls', ',', 'state', ',', 'get_next_msg', '=', 'True', ')', ':', '# Maybe we already parsed the expected packet, maybe not.', 'if', 'get_next_msg', ':', 'self', '.', 'get_next_msg', '(', ')', 'if', '(', 'not', 'self', '.', 'buffer_in', 'or', 'not', 'isinstance', '(', 'se...
If the next message to be processed has type 'pkt_cls', raise 'state'. If there is no message waiting to be processed, we try to get one with the default 'get_next_msg' parameters.
['If', 'the', 'next', 'message', 'to', 'be', 'processed', 'has', 'type', 'pkt_cls', 'raise', 'state', '.', 'If', 'there', 'is', 'no', 'message', 'waiting', 'to', 'be', 'processed', 'we', 'try', 'to', 'get', 'one', 'with', 'the', 'default', 'get_next_msg', 'parameters', '.']
train
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton.py#L168-L182
1,591
hubo1016/aiogrpc
aiogrpc/channel.py
secure_channel
def secure_channel(target, credentials, options=None, *, loop=None, executor=None, standalone_pool_for_streaming=False): """Creates a secure Channel to a server. Args: target: The server address. credentials: A ChannelCredentials instance. options: An optional list of key-value pai...
python
def secure_channel(target, credentials, options=None, *, loop=None, executor=None, standalone_pool_for_streaming=False): """Creates a secure Channel to a server. Args: target: The server address. credentials: A ChannelCredentials instance. options: An optional list of key-value pai...
['def', 'secure_channel', '(', 'target', ',', 'credentials', ',', 'options', '=', 'None', ',', '*', ',', 'loop', '=', 'None', ',', 'executor', '=', 'None', ',', 'standalone_pool_for_streaming', '=', 'False', ')', ':', 'return', 'Channel', '(', '_grpc', '.', 'secure_channel', '(', 'target', ',', 'credentials', ',', 'opt...
Creates a secure Channel to a server. Args: target: The server address. credentials: A ChannelCredentials instance. options: An optional list of key-value pairs (channel args in gRPC runtime) to configure the channel. Returns: A Channel object.
['Creates', 'a', 'secure', 'Channel', 'to', 'a', 'server', '.']
train
https://github.com/hubo1016/aiogrpc/blob/5bc98bfbe9f2e11dd0eab8e93b8aeefbcc2ccd4b/aiogrpc/channel.py#L432-L446
1,592
sahilchinoy/django-irs-filings
irs/management/commands/loadIRS.py
Command.build_mappings
def build_mappings(self): """ Uses CSV files of field names and positions for different filing types to load mappings into memory, for use in parsing different types of rows. """ self.mappings = {} for record_type in ('sa', 'sb', 'F8872'): path = os.pa...
python
def build_mappings(self): """ Uses CSV files of field names and positions for different filing types to load mappings into memory, for use in parsing different types of rows. """ self.mappings = {} for record_type in ('sa', 'sb', 'F8872'): path = os.pa...
['def', 'build_mappings', '(', 'self', ')', ':', 'self', '.', 'mappings', '=', '{', '}', 'for', 'record_type', 'in', '(', "'sa'", ',', "'sb'", ',', "'F8872'", ')', ':', 'path', '=', 'os', '.', 'path', '.', 'join', '(', 'os', '.', 'path', '.', 'dirname', '(', 'os', '.', 'path', '.', 'dirname', '(', 'os', '.', 'path', '....
Uses CSV files of field names and positions for different filing types to load mappings into memory, for use in parsing different types of rows.
['Uses', 'CSV', 'files', 'of', 'field', 'names', 'and', 'positions', 'for', 'different', 'filing', 'types', 'to', 'load', 'mappings', 'into', 'memory', 'for', 'use', 'in', 'parsing', 'different', 'types', 'of', 'rows', '.']
train
https://github.com/sahilchinoy/django-irs-filings/blob/efe80cc57ce1d9d8488f4e9496cf2347e29b6d8b/irs/management/commands/loadIRS.py#L244-L266
1,593
pyblish/pyblish-qml
pyblish_qml/vendor/mock.py
NonCallableMock.attach_mock
def attach_mock(self, mock, attribute): """ Attach a mock as an attribute of this one, replacing its name and parent. Calls to the attached mock will be recorded in the `method_calls` and `mock_calls` attributes of this one.""" mock._mock_parent = None mock._mock_new_pare...
python
def attach_mock(self, mock, attribute): """ Attach a mock as an attribute of this one, replacing its name and parent. Calls to the attached mock will be recorded in the `method_calls` and `mock_calls` attributes of this one.""" mock._mock_parent = None mock._mock_new_pare...
['def', 'attach_mock', '(', 'self', ',', 'mock', ',', 'attribute', ')', ':', 'mock', '.', '_mock_parent', '=', 'None', 'mock', '.', '_mock_new_parent', '=', 'None', 'mock', '.', '_mock_name', '=', "''", 'mock', '.', '_mock_new_name', '=', 'None', 'setattr', '(', 'self', ',', 'attribute', ',', 'mock', ')']
Attach a mock as an attribute of this one, replacing its name and parent. Calls to the attached mock will be recorded in the `method_calls` and `mock_calls` attributes of this one.
['Attach', 'a', 'mock', 'as', 'an', 'attribute', 'of', 'this', 'one', 'replacing', 'its', 'name', 'and', 'parent', '.', 'Calls', 'to', 'the', 'attached', 'mock', 'will', 'be', 'recorded', 'in', 'the', 'method_calls', 'and', 'mock_calls', 'attributes', 'of', 'this', 'one', '.']
train
https://github.com/pyblish/pyblish-qml/blob/6095d18b2ec0afd0409a9b1a17e53b0658887283/pyblish_qml/vendor/mock.py#L518-L528
1,594
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._dump_variant
async def _dump_variant(self, writer, elem, elem_type=None, params=None): """ Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return: """ if isinstance(...
python
async def _dump_variant(self, writer, elem, elem_type=None, params=None): """ Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return: """ if isinstance(...
['async', 'def', '_dump_variant', '(', 'self', ',', 'writer', ',', 'elem', ',', 'elem_type', '=', 'None', ',', 'params', '=', 'None', ')', ':', 'if', 'isinstance', '(', 'elem', ',', 'VariantType', ')', 'or', 'elem_type', '.', 'WRAPS_VALUE', ':', 'await', 'dump_uint', '(', 'writer', ',', 'elem', '.', 'variant_elem_type'...
Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return:
['Dumps', 'variant', 'type', 'to', 'the', 'writer', '.', 'Supports', 'both', 'wrapped', 'and', 'raw', 'variant', '.']
train
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L686-L706
1,595
projectshift/shift-boiler
boiler/cli/colors.py
colour
def colour(colour, message, bold=False): """ Color a message """ return style(fg=colour, text=message, bold=bold)
python
def colour(colour, message, bold=False): """ Color a message """ return style(fg=colour, text=message, bold=bold)
['def', 'colour', '(', 'colour', ',', 'message', ',', 'bold', '=', 'False', ')', ':', 'return', 'style', '(', 'fg', '=', 'colour', ',', 'text', '=', 'message', ',', 'bold', '=', 'bold', ')']
Color a message
['Color', 'a', 'message']
train
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/cli/colors.py#L4-L6
1,596
twoolie/NBT
nbt/region.py
RegionFile.iter_chunks_class
def iter_chunks_class(self): """ Yield each readable chunk present in the region. Chunks that can not be read for whatever reason are silently skipped. This function returns a :class:`nbt.chunk.Chunk` instance. """ for m in self.get_metadata(): try: ...
python
def iter_chunks_class(self): """ Yield each readable chunk present in the region. Chunks that can not be read for whatever reason are silently skipped. This function returns a :class:`nbt.chunk.Chunk` instance. """ for m in self.get_metadata(): try: ...
['def', 'iter_chunks_class', '(', 'self', ')', ':', 'for', 'm', 'in', 'self', '.', 'get_metadata', '(', ')', ':', 'try', ':', 'yield', 'self', '.', 'chunkclass', '(', 'self', '.', 'get_chunk', '(', 'm', '.', 'x', ',', 'm', '.', 'z', ')', ')', 'except', 'RegionFileFormatError', ':', 'pass']
Yield each readable chunk present in the region. Chunks that can not be read for whatever reason are silently skipped. This function returns a :class:`nbt.chunk.Chunk` instance.
['Yield', 'each', 'readable', 'chunk', 'present', 'in', 'the', 'region', '.', 'Chunks', 'that', 'can', 'not', 'be', 'read', 'for', 'whatever', 'reason', 'are', 'silently', 'skipped', '.', 'This', 'function', 'returns', 'a', ':', 'class', ':', 'nbt', '.', 'chunk', '.', 'Chunk', 'instance', '.']
train
https://github.com/twoolie/NBT/blob/b06dd6cc8117d2788da1d8416e642d58bad45762/nbt/region.py#L486-L496
1,597
materialsproject/pymatgen
pymatgen/symmetry/analyzer.py
PointGroupAnalyzer._get_smallest_set_not_on_axis
def _get_smallest_set_not_on_axis(self, axis): """ Returns the smallest list of atoms with the same species and distance from origin AND does not lie on the specified axis. This maximal set limits the possible rotational symmetry operations, since atoms lying on a test axis is i...
python
def _get_smallest_set_not_on_axis(self, axis): """ Returns the smallest list of atoms with the same species and distance from origin AND does not lie on the specified axis. This maximal set limits the possible rotational symmetry operations, since atoms lying on a test axis is i...
['def', '_get_smallest_set_not_on_axis', '(', 'self', ',', 'axis', ')', ':', 'def', 'not_on_axis', '(', 'site', ')', ':', 'v', '=', 'np', '.', 'cross', '(', 'site', '.', 'coords', ',', 'axis', ')', 'return', 'np', '.', 'linalg', '.', 'norm', '(', 'v', ')', '>', 'self', '.', 'tol', 'valid_sets', '=', '[', ']', 'origin_s...
Returns the smallest list of atoms with the same species and distance from origin AND does not lie on the specified axis. This maximal set limits the possible rotational symmetry operations, since atoms lying on a test axis is irrelevant in testing rotational symmetryOperations.
['Returns', 'the', 'smallest', 'list', 'of', 'atoms', 'with', 'the', 'same', 'species', 'and', 'distance', 'from', 'origin', 'AND', 'does', 'not', 'lie', 'on', 'the', 'specified', 'axis', '.', 'This', 'maximal', 'set', 'limits', 'the', 'possible', 'rotational', 'symmetry', 'operations', 'since', 'atoms', 'lying', 'on',...
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1058-L1078
1,598
armstrong/armstrong.core.arm_sections
armstrong/core/arm_sections/models.py
BaseSection.toggle_item
def toggle_item(self, item, test_func, field_name=None): """ Toggles the section based on test_func. test_func takes an item and returns a boolean. If it returns True, the item will be added to the given section. It will be removed from the section otherwise. Intended f...
python
def toggle_item(self, item, test_func, field_name=None): """ Toggles the section based on test_func. test_func takes an item and returns a boolean. If it returns True, the item will be added to the given section. It will be removed from the section otherwise. Intended f...
['def', 'toggle_item', '(', 'self', ',', 'item', ',', 'test_func', ',', 'field_name', '=', 'None', ')', ':', 'if', 'test_func', '(', 'item', ')', ':', 'self', '.', 'add_item', '(', 'item', ',', 'field_name', ')', 'return', 'True', 'else', ':', 'self', '.', 'remove_item', '(', 'item', ',', 'field_name', ')', 'return', '...
Toggles the section based on test_func. test_func takes an item and returns a boolean. If it returns True, the item will be added to the given section. It will be removed from the section otherwise. Intended for use with items of settings.ARMSTRONG_SECTION_ITEM_MODEL. Behavior ...
['Toggles', 'the', 'section', 'based', 'on', 'test_func', '.']
train
https://github.com/armstrong/armstrong.core.arm_sections/blob/39c999c93771da909359e53b35afefe4846f77cb/armstrong/core/arm_sections/models.py#L153-L169
1,599
RedHatInsights/insights-core
insights/client/__init__.py
InsightsClient.fetch
def fetch(self, force=False): """ returns (dict): {'core': path to new egg, None if no update, 'gpg_sig': path to new sig, None if no update} """ tmpdir = tempfile.mkdtemp() fetch_results = { 'core': os.path.join(tmpdir, 'insights-core...
python
def fetch(self, force=False): """ returns (dict): {'core': path to new egg, None if no update, 'gpg_sig': path to new sig, None if no update} """ tmpdir = tempfile.mkdtemp() fetch_results = { 'core': os.path.join(tmpdir, 'insights-core...
['def', 'fetch', '(', 'self', ',', 'force', '=', 'False', ')', ':', 'tmpdir', '=', 'tempfile', '.', 'mkdtemp', '(', ')', 'fetch_results', '=', '{', "'core'", ':', 'os', '.', 'path', '.', 'join', '(', 'tmpdir', ',', "'insights-core.egg'", ')', ',', "'gpg_sig'", ':', 'os', '.', 'path', '.', 'join', '(', 'tmpdir', ',', "'...
returns (dict): {'core': path to new egg, None if no update, 'gpg_sig': path to new sig, None if no update}
['returns', '(', 'dict', ')', ':', '{', 'core', ':', 'path', 'to', 'new', 'egg', 'None', 'if', 'no', 'update', 'gpg_sig', ':', 'path', 'to', 'new', 'sig', 'None', 'if', 'no', 'update', '}']
train
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/client/__init__.py#L90-L131