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
4,600
SatelliteQE/nailgun
nailgun/config.py
BaseServerConfig.delete
def delete(cls, label='default', path=None): """Delete a server configuration. This method is thread safe. :param label: A string. The configuration identified by ``label`` is deleted. :param path: A string. The configuration file to be manipulated. Defaults to ...
python
def delete(cls, label='default', path=None): """Delete a server configuration. This method is thread safe. :param label: A string. The configuration identified by ``label`` is deleted. :param path: A string. The configuration file to be manipulated. Defaults to ...
['def', 'delete', '(', 'cls', ',', 'label', '=', "'default'", ',', 'path', '=', 'None', ')', ':', 'if', 'path', 'is', 'None', ':', 'path', '=', '_get_config_file_path', '(', 'cls', '.', '_xdg_config_dir', ',', 'cls', '.', '_xdg_config_file', ')', 'cls', '.', '_file_lock', '.', 'acquire', '(', ')', 'try', ':', 'with', '...
Delete a server configuration. This method is thread safe. :param label: A string. The configuration identified by ``label`` is deleted. :param path: A string. The configuration file to be manipulated. Defaults to what is returned by :func:`nailgun.config._g...
['Delete', 'a', 'server', 'configuration', '.']
train
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/config.py#L125-L151
4,601
houtianze/bypy
bypy/bypy.py
main
def main(argv=None): # IGNORE:C0111 ''' Main Entry ''' by = None reqres = check_requirements() if reqres == CheckResult.Error: perr("Requirement checking failed") sys.exit(const.EFatal) try: result = const.ENoError if argv is None: argv = sys.argv else: sys.argv.extend(argv) setuphandlers() ...
python
def main(argv=None): # IGNORE:C0111 ''' Main Entry ''' by = None reqres = check_requirements() if reqres == CheckResult.Error: perr("Requirement checking failed") sys.exit(const.EFatal) try: result = const.ENoError if argv is None: argv = sys.argv else: sys.argv.extend(argv) setuphandlers() ...
['def', 'main', '(', 'argv', '=', 'None', ')', ':', '# IGNORE:C0111', 'by', '=', 'None', 'reqres', '=', 'check_requirements', '(', ')', 'if', 'reqres', '==', 'CheckResult', '.', 'Error', ':', 'perr', '(', '"Requirement checking failed"', ')', 'sys', '.', 'exit', '(', 'const', '.', 'EFatal', ')', 'try', ':', 'result', '...
Main Entry
['Main', 'Entry']
train
https://github.com/houtianze/bypy/blob/c59b6183e2fca45f11138bbcdec6247449b2eaad/bypy/bypy.py#L3573-L3705
4,602
ktbyers/netmiko
netmiko/snmp_autodetect.py
SNMPDetect.autodetect
def autodetect(self): """ Try to guess the device_type using SNMP GET based on the SNMP_MAPPER dict. The type which is returned is directly matching the name in *netmiko.ssh_dispatcher.CLASS_MAPPER_BASE* dict. Thus you can use this name to retrieve automatically the right Connec...
python
def autodetect(self): """ Try to guess the device_type using SNMP GET based on the SNMP_MAPPER dict. The type which is returned is directly matching the name in *netmiko.ssh_dispatcher.CLASS_MAPPER_BASE* dict. Thus you can use this name to retrieve automatically the right Connec...
['def', 'autodetect', '(', 'self', ')', ':', '# Convert SNMP_MAPPER to a list and sort by priority', 'snmp_mapper_list', '=', '[', ']', 'for', 'k', ',', 'v', 'in', 'SNMP_MAPPER', '.', 'items', '(', ')', ':', 'snmp_mapper_list', '.', 'append', '(', '{', 'k', ':', 'v', '}', ')', 'snmp_mapper_list', '=', 'sorted', '(', 's...
Try to guess the device_type using SNMP GET based on the SNMP_MAPPER dict. The type which is returned is directly matching the name in *netmiko.ssh_dispatcher.CLASS_MAPPER_BASE* dict. Thus you can use this name to retrieve automatically the right ConnectionClass Returns -------...
['Try', 'to', 'guess', 'the', 'device_type', 'using', 'SNMP', 'GET', 'based', 'on', 'the', 'SNMP_MAPPER', 'dict', '.', 'The', 'type', 'which', 'is', 'returned', 'is', 'directly', 'matching', 'the', 'name', 'in', '*', 'netmiko', '.', 'ssh_dispatcher', '.', 'CLASS_MAPPER_BASE', '*', 'dict', '.']
train
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/snmp_autodetect.py#L304-L342
4,603
wonambi-python/wonambi
wonambi/attr/chan.py
find_channel_groups
def find_channel_groups(chan): """Channels are often organized in groups (different grids / strips or channels in different brain locations), so we use a simple heuristic to get these channel groups. Parameters ---------- chan : instance of Channels channels to group Returns --...
python
def find_channel_groups(chan): """Channels are often organized in groups (different grids / strips or channels in different brain locations), so we use a simple heuristic to get these channel groups. Parameters ---------- chan : instance of Channels channels to group Returns --...
['def', 'find_channel_groups', '(', 'chan', ')', ':', 'labels', '=', 'chan', '.', 'return_label', '(', ')', 'group_names', '=', '{', 'match', '(', "'([A-Za-z ]+)\\d+'", ',', 'label', ')', '.', 'group', '(', '1', ')', 'for', 'label', 'in', 'labels', '}', 'groups', '=', '{', '}', 'for', 'group_name', 'in', 'group_names',...
Channels are often organized in groups (different grids / strips or channels in different brain locations), so we use a simple heuristic to get these channel groups. Parameters ---------- chan : instance of Channels channels to group Returns ------- groups : dict channe...
['Channels', 'are', 'often', 'organized', 'in', 'groups', '(', 'different', 'grids', '/', 'strips', 'or', 'channels', 'in', 'different', 'brain', 'locations', ')', 'so', 'we', 'use', 'a', 'simple', 'heuristic', 'to', 'get', 'these', 'channel', 'groups', '.']
train
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/chan.py#L427-L450
4,604
ska-sa/purr
Purr/Plugins/local_pychart/area.py
T.draw
def draw(self, can=None): "Draw the charts." if can == None: can = canvas.default_canvas() assert self.check_integrity() for plot in self.__plots: plot.check_integrity() self.x_range, self.x_grid_interval = \ self.__get_data_range(self.x_ra...
python
def draw(self, can=None): "Draw the charts." if can == None: can = canvas.default_canvas() assert self.check_integrity() for plot in self.__plots: plot.check_integrity() self.x_range, self.x_grid_interval = \ self.__get_data_range(self.x_ra...
['def', 'draw', '(', 'self', ',', 'can', '=', 'None', ')', ':', 'if', 'can', '==', 'None', ':', 'can', '=', 'canvas', '.', 'default_canvas', '(', ')', 'assert', 'self', '.', 'check_integrity', '(', ')', 'for', 'plot', 'in', 'self', '.', '__plots', ':', 'plot', '.', 'check_integrity', '(', ')', 'self', '.', 'x_range', '...
Draw the charts.
['Draw', 'the', 'charts', '.']
train
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/Plugins/local_pychart/area.py#L193-L255
4,605
databio/pypiper
pypiper/manager.py
PipelineManager._attend_process
def _attend_process(self, proc, sleeptime): """ Waits on a process for a given time to see if it finishes, returns True if it's still running after the given time or False as soon as it returns. :param psutil.Popen proc: Process object opened by psutil.Popen() :param fl...
python
def _attend_process(self, proc, sleeptime): """ Waits on a process for a given time to see if it finishes, returns True if it's still running after the given time or False as soon as it returns. :param psutil.Popen proc: Process object opened by psutil.Popen() :param fl...
['def', '_attend_process', '(', 'self', ',', 'proc', ',', 'sleeptime', ')', ':', '# print("attend:{}".format(proc.pid))', 'try', ':', 'proc', '.', 'wait', '(', 'timeout', '=', 'sleeptime', ')', 'except', 'psutil', '.', 'TimeoutExpired', ':', 'return', 'True', 'return', 'False']
Waits on a process for a given time to see if it finishes, returns True if it's still running after the given time or False as soon as it returns. :param psutil.Popen proc: Process object opened by psutil.Popen() :param float sleeptime: Time to wait :return bool: True if proces...
['Waits', 'on', 'a', 'process', 'for', 'a', 'given', 'time', 'to', 'see', 'if', 'it', 'finishes', 'returns', 'True', 'if', 'it', 's', 'still', 'running', 'after', 'the', 'given', 'time', 'or', 'False', 'as', 'soon', 'as', 'it', 'returns', '.']
train
https://github.com/databio/pypiper/blob/00e6c2b94033c4187d47ff14c5580bbfc2ff097f/pypiper/manager.py#L810-L825
4,606
nschloe/optimesh
optimesh/odt.py
energy
def energy(mesh, uniform_density=False): """The mesh energy is defined as E = int_Omega |u_l(x) - u(x)| rho(x) dx where u(x) = ||x||^2 and u_l is its piecewise linearization on the mesh. """ # E = 1/(d+1) sum_i ||x_i||^2 |omega_i| - int_Omega_i ||x||^2 dim = mesh.cells["nodes"].shape[1] - 1 ...
python
def energy(mesh, uniform_density=False): """The mesh energy is defined as E = int_Omega |u_l(x) - u(x)| rho(x) dx where u(x) = ||x||^2 and u_l is its piecewise linearization on the mesh. """ # E = 1/(d+1) sum_i ||x_i||^2 |omega_i| - int_Omega_i ||x||^2 dim = mesh.cells["nodes"].shape[1] - 1 ...
['def', 'energy', '(', 'mesh', ',', 'uniform_density', '=', 'False', ')', ':', '# E = 1/(d+1) sum_i ||x_i||^2 |omega_i| - int_Omega_i ||x||^2', 'dim', '=', 'mesh', '.', 'cells', '[', '"nodes"', ']', '.', 'shape', '[', '1', ']', '-', '1', 'star_volume', '=', 'numpy', '.', 'zeros', '(', 'mesh', '.', 'node_coords', '.', '...
The mesh energy is defined as E = int_Omega |u_l(x) - u(x)| rho(x) dx where u(x) = ||x||^2 and u_l is its piecewise linearization on the mesh.
['The', 'mesh', 'energy', 'is', 'defined', 'as']
train
https://github.com/nschloe/optimesh/blob/b85f48d1559a51a01cc3df6214c61ca8ad5ed786/optimesh/odt.py#L28-L70
4,607
brian-rose/climlab
climlab/process/process.py
Process.lon
def lon(self): """Longitude of grid centers (degrees) :getter: Returns the points of axis ``'lon'`` if availible in the process's domains. :type: array :raises: :exc:`ValueError` if no ``'lon'`` axis can be found. """ try:...
python
def lon(self): """Longitude of grid centers (degrees) :getter: Returns the points of axis ``'lon'`` if availible in the process's domains. :type: array :raises: :exc:`ValueError` if no ``'lon'`` axis can be found. """ try:...
['def', 'lon', '(', 'self', ')', ':', 'try', ':', 'for', 'domname', ',', 'dom', 'in', 'self', '.', 'domains', '.', 'items', '(', ')', ':', 'try', ':', 'thislon', '=', 'dom', '.', 'axes', '[', "'lon'", ']', '.', 'points', 'except', ':', 'pass', 'return', 'thislon', 'except', ':', 'raise', 'ValueError', '(', "'Can\\'t re...
Longitude of grid centers (degrees) :getter: Returns the points of axis ``'lon'`` if availible in the process's domains. :type: array :raises: :exc:`ValueError` if no ``'lon'`` axis can be found.
['Longitude', 'of', 'grid', 'centers', '(', 'degrees', ')']
train
https://github.com/brian-rose/climlab/blob/eae188a2ae9308229b8cbb8fe0b65f51b50ee1e6/climlab/process/process.py#L662-L680
4,608
django-auth-ldap/django-auth-ldap
django_auth_ldap/config.py
_LDAPConfig.get_logger
def get_logger(cls): """ Initializes and returns our logger instance. """ if cls.logger is None: cls.logger = logging.getLogger("django_auth_ldap") cls.logger.addHandler(logging.NullHandler()) return cls.logger
python
def get_logger(cls): """ Initializes and returns our logger instance. """ if cls.logger is None: cls.logger = logging.getLogger("django_auth_ldap") cls.logger.addHandler(logging.NullHandler()) return cls.logger
['def', 'get_logger', '(', 'cls', ')', ':', 'if', 'cls', '.', 'logger', 'is', 'None', ':', 'cls', '.', 'logger', '=', 'logging', '.', 'getLogger', '(', '"django_auth_ldap"', ')', 'cls', '.', 'logger', '.', 'addHandler', '(', 'logging', '.', 'NullHandler', '(', ')', ')', 'return', 'cls', '.', 'logger']
Initializes and returns our logger instance.
['Initializes', 'and', 'returns', 'our', 'logger', 'instance', '.']
train
https://github.com/django-auth-ldap/django-auth-ldap/blob/9ce3c2825527f8faa1793958b041816e63d839af/django_auth_ldap/config.py#L68-L76
4,609
dcaune/perseus-lib-python-common
majormode/perseus/utils/cast.py
string_to_macaddr
def string_to_macaddr(value, strict=False): """ Return a tuple corresponding to the string representation of a Media Access Control address (MAC address) of a device, which is a unique identifier assigned to a network interface controller (NIC) for communications at the data link layer of a network ...
python
def string_to_macaddr(value, strict=False): """ Return a tuple corresponding to the string representation of a Media Access Control address (MAC address) of a device, which is a unique identifier assigned to a network interface controller (NIC) for communications at the data link layer of a network ...
['def', 'string_to_macaddr', '(', 'value', ',', 'strict', '=', 'False', ')', ':', 'if', 'is_undefined', '(', 'value', ')', ':', 'if', 'strict', ':', 'raise', 'ValueError', '(', "'The value cannot be null'", ')', 'return', 'None', 'match', '=', 'REGEX_MAC_ADDRESS', '.', 'match', '(', 'value', '.', 'lower', '(', ')', ')'...
Return a tuple corresponding to the string representation of a Media Access Control address (MAC address) of a device, which is a unique identifier assigned to a network interface controller (NIC) for communications at the data link layer of a network segment. The standard (IEEE 802) format for printin...
['Return', 'a', 'tuple', 'corresponding', 'to', 'the', 'string', 'representation', 'of', 'a', 'Media', 'Access', 'Control', 'address', '(', 'MAC', 'address', ')', 'of', 'a', 'device', 'which', 'is', 'a', 'unique', 'identifier', 'assigned', 'to', 'a', 'network', 'interface', 'controller', '(', 'NIC', ')', 'for', 'commun...
train
https://github.com/dcaune/perseus-lib-python-common/blob/ba48fe0fd9bb4a75b53e7d10c41ada36a72d4496/majormode/perseus/utils/cast.py#L386-L420
4,610
riccardocagnasso/useless
src/useless/common/__init__.py
parse_cstring
def parse_cstring(stream, offset): """ parse_cstring will parse a null-terminated string in a bytestream. The string will be decoded with UTF-8 decoder, of course since we are doing this byte-a-byte, it won't really work for all Unicode strings. TODO: add proper Unicode support ...
python
def parse_cstring(stream, offset): """ parse_cstring will parse a null-terminated string in a bytestream. The string will be decoded with UTF-8 decoder, of course since we are doing this byte-a-byte, it won't really work for all Unicode strings. TODO: add proper Unicode support ...
['def', 'parse_cstring', '(', 'stream', ',', 'offset', ')', ':', 'stream', '.', 'seek', '(', 'offset', ')', 'string', '=', '""', 'while', 'True', ':', 'char', '=', 'struct', '.', 'unpack', '(', "'c'", ',', 'stream', '.', 'read', '(', '1', ')', ')', '[', '0', ']', 'if', 'char', '==', "b'\\x00'", ':', 'return', 'string',...
parse_cstring will parse a null-terminated string in a bytestream. The string will be decoded with UTF-8 decoder, of course since we are doing this byte-a-byte, it won't really work for all Unicode strings. TODO: add proper Unicode support
['parse_cstring', 'will', 'parse', 'a', 'null', '-', 'terminated', 'string', 'in', 'a', 'bytestream', '.']
train
https://github.com/riccardocagnasso/useless/blob/5167aab82958f653148e3689c9a7e548d4fa2cba/src/useless/common/__init__.py#L29-L48
4,611
facelessuser/soupsieve
soupsieve/__init__.py
match
def match(select, tag, namespaces=None, flags=0, **kwargs): """Match node.""" return compile(select, namespaces, flags, **kwargs).match(tag)
python
def match(select, tag, namespaces=None, flags=0, **kwargs): """Match node.""" return compile(select, namespaces, flags, **kwargs).match(tag)
['def', 'match', '(', 'select', ',', 'tag', ',', 'namespaces', '=', 'None', ',', 'flags', '=', '0', ',', '*', '*', 'kwargs', ')', ':', 'return', 'compile', '(', 'select', ',', 'namespaces', ',', 'flags', ',', '*', '*', 'kwargs', ')', '.', 'match', '(', 'tag', ')']
Match node.
['Match', 'node', '.']
train
https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/__init__.py#L78-L81
4,612
ibis-project/ibis
ibis/expr/api.py
cross_join
def cross_join(*tables, **kwargs): """ Perform a cross join (cartesian product) amongst a list of tables, with optional set of prefixes to apply to overlapping column names Parameters ---------- tables : ibis.expr.types.TableExpr Returns ------- joined : TableExpr Examples ...
python
def cross_join(*tables, **kwargs): """ Perform a cross join (cartesian product) amongst a list of tables, with optional set of prefixes to apply to overlapping column names Parameters ---------- tables : ibis.expr.types.TableExpr Returns ------- joined : TableExpr Examples ...
['def', 'cross_join', '(', '*', 'tables', ',', '*', '*', 'kwargs', ')', ':', '# TODO(phillipc): Implement prefix keyword argument', 'op', '=', 'ops', '.', 'CrossJoin', '(', '*', 'tables', ',', '*', '*', 'kwargs', ')', 'return', 'op', '.', 'to_expr', '(', ')']
Perform a cross join (cartesian product) amongst a list of tables, with optional set of prefixes to apply to overlapping column names Parameters ---------- tables : ibis.expr.types.TableExpr Returns ------- joined : TableExpr Examples -------- >>> import ibis >>> schemas =...
['Perform', 'a', 'cross', 'join', '(', 'cartesian', 'product', ')', 'amongst', 'a', 'list', 'of', 'tables', 'with', 'optional', 'set', 'of', 'prefixes', 'to', 'apply', 'to', 'overlapping', 'column', 'names']
train
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/expr/api.py#L2981-L3048
4,613
jobovy/galpy
galpy/df/streamdf.py
streamdf._progenitor_setup
def _progenitor_setup(self,progenitor,leading,useTMHessian): """The part of the setup relating to the progenitor's orbit""" #Progenitor orbit: Calculate actions, frequencies, and angles for the progenitor self._progenitor= progenitor() #call to get new Orbit # Make sure we do not use phy...
python
def _progenitor_setup(self,progenitor,leading,useTMHessian): """The part of the setup relating to the progenitor's orbit""" #Progenitor orbit: Calculate actions, frequencies, and angles for the progenitor self._progenitor= progenitor() #call to get new Orbit # Make sure we do not use phy...
['def', '_progenitor_setup', '(', 'self', ',', 'progenitor', ',', 'leading', ',', 'useTMHessian', ')', ':', '#Progenitor orbit: Calculate actions, frequencies, and angles for the progenitor', 'self', '.', '_progenitor', '=', 'progenitor', '(', ')', '#call to get new Orbit', '# Make sure we do not use physical coordinat...
The part of the setup relating to the progenitor's orbit
['The', 'part', 'of', 'the', 'setup', 'relating', 'to', 'the', 'progenitor', 's', 'orbit']
train
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/streamdf.py#L218-L257
4,614
paylogic/halogen
halogen/validators.py
Length.validate
def validate(self, value): """Validate the length of a list. :param value: List of values. :raises: :class:`halogen.exception.ValidationError` exception when length of the list is less than minimum or greater than maximum. """ try: length = len(value) ...
python
def validate(self, value): """Validate the length of a list. :param value: List of values. :raises: :class:`halogen.exception.ValidationError` exception when length of the list is less than minimum or greater than maximum. """ try: length = len(value) ...
['def', 'validate', '(', 'self', ',', 'value', ')', ':', 'try', ':', 'length', '=', 'len', '(', 'value', ')', 'except', 'TypeError', ':', 'length', '=', '0', 'if', 'self', '.', 'min_length', 'is', 'not', 'None', ':', 'min_length', '=', 'self', '.', 'min_length', '(', ')', 'if', 'callable', '(', 'self', '.', 'min_length...
Validate the length of a list. :param value: List of values. :raises: :class:`halogen.exception.ValidationError` exception when length of the list is less than minimum or greater than maximum.
['Validate', 'the', 'length', 'of', 'a', 'list', '.']
train
https://github.com/paylogic/halogen/blob/2dec0a67c506d02d1f51915fa7163f59764a0bde/halogen/validators.py#L92-L113
4,615
pypa/pipenv
pipenv/vendor/vistir/path.py
is_valid_url
def is_valid_url(url): """Checks if a given string is an url""" from .misc import to_text if not url: return url pieces = urllib_parse.urlparse(to_text(url)) return all([pieces.scheme, pieces.netloc])
python
def is_valid_url(url): """Checks if a given string is an url""" from .misc import to_text if not url: return url pieces = urllib_parse.urlparse(to_text(url)) return all([pieces.scheme, pieces.netloc])
['def', 'is_valid_url', '(', 'url', ')', ':', 'from', '.', 'misc', 'import', 'to_text', 'if', 'not', 'url', ':', 'return', 'url', 'pieces', '=', 'urllib_parse', '.', 'urlparse', '(', 'to_text', '(', 'url', ')', ')', 'return', 'all', '(', '[', 'pieces', '.', 'scheme', ',', 'pieces', '.', 'netloc', ']', ')']
Checks if a given string is an url
['Checks', 'if', 'a', 'given', 'string', 'is', 'an', 'url']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L188-L195
4,616
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_help.py
HelpModule.idle_task
def idle_task(self): '''called on idle''' if self.module('console') is not None and not self.menu_added_console: self.menu_added_console = True self.module('console').add_menu(self.menu)
python
def idle_task(self): '''called on idle''' if self.module('console') is not None and not self.menu_added_console: self.menu_added_console = True self.module('console').add_menu(self.menu)
['def', 'idle_task', '(', 'self', ')', ':', 'if', 'self', '.', 'module', '(', "'console'", ')', 'is', 'not', 'None', 'and', 'not', 'self', '.', 'menu_added_console', ':', 'self', '.', 'menu_added_console', '=', 'True', 'self', '.', 'module', '(', "'console'", ')', '.', 'add_menu', '(', 'self', '.', 'menu', ')']
called on idle
['called', 'on', 'idle']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_help.py#L90-L94
4,617
lreis2415/PyGeoC
examples/ex07_handling_raster_with_numpy.py
main
def main(): """Read GeoTiff raster data and perform log transformation. """ input_tif = "../tests/data/Jamaica_dem.tif" output_tif = "../tests/data/tmp_results/log_dem.tif" rst = RasterUtilClass.read_raster(input_tif) # raster data (with noDataValue as numpy.nan) as numpy array rst_valid = r...
python
def main(): """Read GeoTiff raster data and perform log transformation. """ input_tif = "../tests/data/Jamaica_dem.tif" output_tif = "../tests/data/tmp_results/log_dem.tif" rst = RasterUtilClass.read_raster(input_tif) # raster data (with noDataValue as numpy.nan) as numpy array rst_valid = r...
['def', 'main', '(', ')', ':', 'input_tif', '=', '"../tests/data/Jamaica_dem.tif"', 'output_tif', '=', '"../tests/data/tmp_results/log_dem.tif"', 'rst', '=', 'RasterUtilClass', '.', 'read_raster', '(', 'input_tif', ')', '# raster data (with noDataValue as numpy.nan) as numpy array', 'rst_valid', '=', 'rst', '.', 'valid...
Read GeoTiff raster data and perform log transformation.
['Read', 'GeoTiff', 'raster', 'data', 'and', 'perform', 'log', 'transformation', '.']
train
https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/examples/ex07_handling_raster_with_numpy.py#L10-L21
4,618
Celeo/Pycord
pycord/__init__.py
Pycord._setup_logger
def _setup_logger(self, logging_level: int, log_to_console: bool): """Sets up the internal logger Args: logging_level: what logging level to use log_to_console: whether or not to log to the console """ self.logger = logging.getLogger('discord') self.logge...
python
def _setup_logger(self, logging_level: int, log_to_console: bool): """Sets up the internal logger Args: logging_level: what logging level to use log_to_console: whether or not to log to the console """ self.logger = logging.getLogger('discord') self.logge...
['def', '_setup_logger', '(', 'self', ',', 'logging_level', ':', 'int', ',', 'log_to_console', ':', 'bool', ')', ':', 'self', '.', 'logger', '=', 'logging', '.', 'getLogger', '(', "'discord'", ')', 'self', '.', 'logger', '.', 'handlers', '=', '[', ']', 'self', '.', 'logger', '.', 'setLevel', '(', 'logging_level', ')', ...
Sets up the internal logger Args: logging_level: what logging level to use log_to_console: whether or not to log to the console
['Sets', 'up', 'the', 'internal', 'logger']
train
https://github.com/Celeo/Pycord/blob/15c38e39b508c89c35f7f6d7009fe8e9f161a94e/pycord/__init__.py#L181-L200
4,619
jaredLunde/redis_structures
redis_structures/__init__.py
RedisSortedSet.decr
def decr(self, member, by=1): """ Decrements @member by @by within the sorted set """ return self._client.zincrby( self.key_prefix, self._dumps(member), by * -1)
python
def decr(self, member, by=1): """ Decrements @member by @by within the sorted set """ return self._client.zincrby( self.key_prefix, self._dumps(member), by * -1)
['def', 'decr', '(', 'self', ',', 'member', ',', 'by', '=', '1', ')', ':', 'return', 'self', '.', '_client', '.', 'zincrby', '(', 'self', '.', 'key_prefix', ',', 'self', '.', '_dumps', '(', 'member', ')', ',', 'by', '*', '-', '1', ')']
Decrements @member by @by within the sorted set
['Decrements']
train
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L2047-L2050
4,620
Azure/azure-event-hubs-python
azure/eventhub/sender.py
Sender.send
def send(self, event_data): """ Sends an event data and blocks until acknowledgement is received or operation times out. :param event_data: The event to be sent. :type event_data: ~azure.eventhub.common.EventData :raises: ~azure.eventhub.common.EventHubError if the messa...
python
def send(self, event_data): """ Sends an event data and blocks until acknowledgement is received or operation times out. :param event_data: The event to be sent. :type event_data: ~azure.eventhub.common.EventData :raises: ~azure.eventhub.common.EventHubError if the messa...
['def', 'send', '(', 'self', ',', 'event_data', ')', ':', 'if', 'self', '.', 'error', ':', 'raise', 'self', '.', 'error', 'if', 'not', 'self', '.', 'running', ':', 'raise', 'ValueError', '(', '"Unable to send until client has been started."', ')', 'if', 'event_data', '.', 'partition_key', 'and', 'self', '.', 'partition...
Sends an event data and blocks until acknowledgement is received or operation times out. :param event_data: The event to be sent. :type event_data: ~azure.eventhub.common.EventData :raises: ~azure.eventhub.common.EventHubError if the message fails to send. :return: The ...
['Sends', 'an', 'event', 'data', 'and', 'blocks', 'until', 'acknowledgement', 'is', 'received', 'or', 'operation', 'times', 'out', '.']
train
https://github.com/Azure/azure-event-hubs-python/blob/737c5f966557ada2cf10fa0d8f3c19671ae96348/azure/eventhub/sender.py#L211-L265
4,621
PredixDev/predixpy
predix/admin/cf/spaces.py
Space.create_space
def create_space(self, space_name, add_users=True): """ Create a new space with the given name in the current target organization. """ body = { 'name': space_name, 'organization_guid': self.api.config.get_organization_guid() } # MAINT: may...
python
def create_space(self, space_name, add_users=True): """ Create a new space with the given name in the current target organization. """ body = { 'name': space_name, 'organization_guid': self.api.config.get_organization_guid() } # MAINT: may...
['def', 'create_space', '(', 'self', ',', 'space_name', ',', 'add_users', '=', 'True', ')', ':', 'body', '=', '{', "'name'", ':', 'space_name', ',', "'organization_guid'", ':', 'self', '.', 'api', '.', 'config', '.', 'get_organization_guid', '(', ')', '}', '# MAINT: may need to do this more generally later', 'if', 'add...
Create a new space with the given name in the current target organization.
['Create', 'a', 'new', 'space', 'with', 'the', 'given', 'name', 'in', 'the', 'current', 'target', 'organization', '.']
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L83-L104
4,622
PrefPy/prefpy
prefpy/gmmra.py
GMMPLAggregator._pos
def _pos(self, k): """ Description: Position k breaking Parameters: k: position k is used for the breaking """ if k < 2: raise ValueError("k smaller than 2") G = np.zeros((self.m, self.m)) for i in range(self.m): ...
python
def _pos(self, k): """ Description: Position k breaking Parameters: k: position k is used for the breaking """ if k < 2: raise ValueError("k smaller than 2") G = np.zeros((self.m, self.m)) for i in range(self.m): ...
['def', '_pos', '(', 'self', ',', 'k', ')', ':', 'if', 'k', '<', '2', ':', 'raise', 'ValueError', '(', '"k smaller than 2"', ')', 'G', '=', 'np', '.', 'zeros', '(', '(', 'self', '.', 'm', ',', 'self', '.', 'm', ')', ')', 'for', 'i', 'in', 'range', '(', 'self', '.', 'm', ')', ':', 'for', 'j', 'in', 'range', '(', 'self',...
Description: Position k breaking Parameters: k: position k is used for the breaking
['Description', ':', 'Position', 'k', 'breaking', 'Parameters', ':', 'k', ':', 'position', 'k', 'is', 'used', 'for', 'the', 'breaking']
train
https://github.com/PrefPy/prefpy/blob/f395ba3782f05684fa5de0cece387a6da9391d02/prefpy/gmmra.py#L80-L98
4,623
openstack/networking-cisco
networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py
CiscoUcsmDriver._create_port_profile
def _create_port_profile(self, handle, profile_name, vlan_id, vnic_type, ucsm_ip, trunk_vlans, qos_policy): """Creates a Port Profile on the UCS Manager. Significant parameters set in the port profile are: 1. Port profile name - Should match what was set in vif_deta...
python
def _create_port_profile(self, handle, profile_name, vlan_id, vnic_type, ucsm_ip, trunk_vlans, qos_policy): """Creates a Port Profile on the UCS Manager. Significant parameters set in the port profile are: 1. Port profile name - Should match what was set in vif_deta...
['def', '_create_port_profile', '(', 'self', ',', 'handle', ',', 'profile_name', ',', 'vlan_id', ',', 'vnic_type', ',', 'ucsm_ip', ',', 'trunk_vlans', ',', 'qos_policy', ')', ':', 'port_profile_dest', '=', '(', 'const', '.', 'PORT_PROFILESETDN', '+', 'const', '.', 'VNIC_PATH_PREFIX', '+', 'profile_name', ')', 'vlan_nam...
Creates a Port Profile on the UCS Manager. Significant parameters set in the port profile are: 1. Port profile name - Should match what was set in vif_details 2. High performance mode - For VM-FEX to be enabled/configured on the port using this port profile, this mode should be enabled....
['Creates', 'a', 'Port', 'Profile', 'on', 'the', 'UCS', 'Manager', '.']
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L306-L432
4,624
atmos-python/atmos
atmos/util.py
doc_paragraph
def doc_paragraph(s, indent=0): '''Takes in a string without wrapping corresponding to a paragraph, and returns a version of that string wrapped to be at most 80 characters in length on each line. If indent is given, ensures each line is indented to that number of spaces. ''' ret...
python
def doc_paragraph(s, indent=0): '''Takes in a string without wrapping corresponding to a paragraph, and returns a version of that string wrapped to be at most 80 characters in length on each line. If indent is given, ensures each line is indented to that number of spaces. ''' ret...
['def', 'doc_paragraph', '(', 's', ',', 'indent', '=', '0', ')', ':', 'return', "'\\n'", '.', 'join', '(', '[', "' '", '*', 'indent', '+', 'l', 'for', 'l', 'in', 'wrap', '(', 's', ',', 'width', '=', '80', '-', 'indent', ')', ']', ')']
Takes in a string without wrapping corresponding to a paragraph, and returns a version of that string wrapped to be at most 80 characters in length on each line. If indent is given, ensures each line is indented to that number of spaces.
['Takes', 'in', 'a', 'string', 'without', 'wrapping', 'corresponding', 'to', 'a', 'paragraph', 'and', 'returns', 'a', 'version', 'of', 'that', 'string', 'wrapped', 'to', 'be', 'at', 'most', '80', 'characters', 'in', 'length', 'on', 'each', 'line', '.', 'If', 'indent', 'is', 'given', 'ensures', 'each', 'line', 'is', 'in...
train
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L133-L140
4,625
honzajavorek/redis-collections
redis_collections/lists.py
Deque.appendleft
def appendleft(self, value): """Add *value* to the left side of the collection.""" def appendleft_trans(pipe): self._appendleft_helper(value, pipe) self._transaction(appendleft_trans)
python
def appendleft(self, value): """Add *value* to the left side of the collection.""" def appendleft_trans(pipe): self._appendleft_helper(value, pipe) self._transaction(appendleft_trans)
['def', 'appendleft', '(', 'self', ',', 'value', ')', ':', 'def', 'appendleft_trans', '(', 'pipe', ')', ':', 'self', '.', '_appendleft_helper', '(', 'value', ',', 'pipe', ')', 'self', '.', '_transaction', '(', 'appendleft_trans', ')']
Add *value* to the left side of the collection.
['Add', '*', 'value', '*', 'to', 'the', 'left', 'side', 'of', 'the', 'collection', '.']
train
https://github.com/honzajavorek/redis-collections/blob/07ca8efe88fb128f7dc7319dfa6a26cd39b3776b/redis_collections/lists.py#L764-L769
4,626
xray7224/PyPump
pypump/models/__init__.py
PumpObject._verb
def _verb(self, verb): """ Posts minimal activity with verb and bare self object. :param verb: verb to be used. """ activity = { "verb": verb, "object": { "id": self.id, "objectType": self.object_type, } } ...
python
def _verb(self, verb): """ Posts minimal activity with verb and bare self object. :param verb: verb to be used. """ activity = { "verb": verb, "object": { "id": self.id, "objectType": self.object_type, } } ...
['def', '_verb', '(', 'self', ',', 'verb', ')', ':', 'activity', '=', '{', '"verb"', ':', 'verb', ',', '"object"', ':', '{', '"id"', ':', 'self', '.', 'id', ',', '"objectType"', ':', 'self', '.', 'object_type', ',', '}', '}', 'self', '.', '_post_activity', '(', 'activity', ')']
Posts minimal activity with verb and bare self object. :param verb: verb to be used.
['Posts', 'minimal', 'activity', 'with', 'verb', 'and', 'bare', 'self', 'object', '.', ':', 'param', 'verb', ':', 'verb', 'to', 'be', 'used', '.']
train
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L85-L98
4,627
meejah/txtorcon
txtorcon/torconfig.py
EphemeralHiddenService.remove_from_tor
def remove_from_tor(self, protocol): ''' Returns a Deferred which fires with None ''' r = yield protocol.queue_command('DEL_ONION %s' % self.hostname[:-6]) if r.strip() != 'OK': raise RuntimeError('Failed to remove hidden service: "%s".' % r)
python
def remove_from_tor(self, protocol): ''' Returns a Deferred which fires with None ''' r = yield protocol.queue_command('DEL_ONION %s' % self.hostname[:-6]) if r.strip() != 'OK': raise RuntimeError('Failed to remove hidden service: "%s".' % r)
['def', 'remove_from_tor', '(', 'self', ',', 'protocol', ')', ':', 'r', '=', 'yield', 'protocol', '.', 'queue_command', '(', "'DEL_ONION %s'", '%', 'self', '.', 'hostname', '[', ':', '-', '6', ']', ')', 'if', 'r', '.', 'strip', '(', ')', '!=', "'OK'", ':', 'raise', 'RuntimeError', '(', '\'Failed to remove hidden servic...
Returns a Deferred which fires with None
['Returns', 'a', 'Deferred', 'which', 'fires', 'with', 'None']
train
https://github.com/meejah/txtorcon/blob/14053b95adf0b4bd9dd9c317bece912a26578a93/txtorcon/torconfig.py#L488-L494
4,628
pysathq/pysat
pysat/solvers.py
Lingeling.get_model
def get_model(self): """ Get a model if the formula was previously satisfied. """ if self.lingeling and self.status == True: model = pysolvers.lingeling_model(self.lingeling) return model if model != None else []
python
def get_model(self): """ Get a model if the formula was previously satisfied. """ if self.lingeling and self.status == True: model = pysolvers.lingeling_model(self.lingeling) return model if model != None else []
['def', 'get_model', '(', 'self', ')', ':', 'if', 'self', '.', 'lingeling', 'and', 'self', '.', 'status', '==', 'True', ':', 'model', '=', 'pysolvers', '.', 'lingeling_model', '(', 'self', '.', 'lingeling', ')', 'return', 'model', 'if', 'model', '!=', 'None', 'else', '[', ']']
Get a model if the formula was previously satisfied.
['Get', 'a', 'model', 'if', 'the', 'formula', 'was', 'previously', 'satisfied', '.']
train
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/solvers.py#L1651-L1658
4,629
astroswego/plotypus
src/plotypus/preprocessing.py
Fourier.transform
def transform(self, X, y=None, **params): """ Transforms *X* from phase-space to Fourier-space, returning the design matrix produced by :func:`Fourier.design_matrix` for input to a regressor. **Parameters** X : array-like, shape = [n_samples, 1] Column vecto...
python
def transform(self, X, y=None, **params): """ Transforms *X* from phase-space to Fourier-space, returning the design matrix produced by :func:`Fourier.design_matrix` for input to a regressor. **Parameters** X : array-like, shape = [n_samples, 1] Column vecto...
['def', 'transform', '(', 'self', ',', 'X', ',', 'y', '=', 'None', ',', '*', '*', 'params', ')', ':', 'data', '=', 'numpy', '.', 'dstack', '(', '(', 'numpy', '.', 'array', '(', 'X', ')', '.', 'T', '[', '0', ']', ',', 'range', '(', 'len', '(', 'X', ')', ')', ')', ')', '[', '0', ']', 'phase', ',', 'order', '=', 'data', '...
Transforms *X* from phase-space to Fourier-space, returning the design matrix produced by :func:`Fourier.design_matrix` for input to a regressor. **Parameters** X : array-like, shape = [n_samples, 1] Column vector of phases. y : None, optional Unused arg...
['Transforms', '*', 'X', '*', 'from', 'phase', '-', 'space', 'to', 'Fourier', '-', 'space', 'returning', 'the', 'design', 'matrix', 'produced', 'by', ':', 'func', ':', 'Fourier', '.', 'design_matrix', 'for', 'input', 'to', 'a', 'regressor', '.']
train
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/preprocessing.py#L96-L117
4,630
fastai/fastai
fastai/gen_doc/gen_notebooks.py
execute_nb
def execute_nb(fname, metadata=None, save=True, show_doc_only=False): "Execute notebook `fname` with `metadata` for preprocessing." # Any module used in the notebook that isn't inside must be in the same directory as this script with open(fname) as f: nb = nbformat.read(f, as_version=4) ep_class = Execu...
python
def execute_nb(fname, metadata=None, save=True, show_doc_only=False): "Execute notebook `fname` with `metadata` for preprocessing." # Any module used in the notebook that isn't inside must be in the same directory as this script with open(fname) as f: nb = nbformat.read(f, as_version=4) ep_class = Execu...
['def', 'execute_nb', '(', 'fname', ',', 'metadata', '=', 'None', ',', 'save', '=', 'True', ',', 'show_doc_only', '=', 'False', ')', ':', "# Any module used in the notebook that isn't inside must be in the same directory as this script", 'with', 'open', '(', 'fname', ')', 'as', 'f', ':', 'nb', '=', 'nbformat', '.', 're...
Execute notebook `fname` with `metadata` for preprocessing.
['Execute', 'notebook', 'fname', 'with', 'metadata', 'for', 'preprocessing', '.']
train
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/gen_doc/gen_notebooks.py#L79-L89
4,631
flatangle/flatlib
flatlib/ephem/ephem.py
nextSolarReturn
def nextSolarReturn(date, lon): """ Returns the next date when sun is at longitude 'lon'. """ jd = eph.nextSolarReturn(date.jd, lon) return Datetime.fromJD(jd, date.utcoffset)
python
def nextSolarReturn(date, lon): """ Returns the next date when sun is at longitude 'lon'. """ jd = eph.nextSolarReturn(date.jd, lon) return Datetime.fromJD(jd, date.utcoffset)
['def', 'nextSolarReturn', '(', 'date', ',', 'lon', ')', ':', 'jd', '=', 'eph', '.', 'nextSolarReturn', '(', 'date', '.', 'jd', ',', 'lon', ')', 'return', 'Datetime', '.', 'fromJD', '(', 'jd', ',', 'date', '.', 'utcoffset', ')']
Returns the next date when sun is at longitude 'lon'.
['Returns', 'the', 'next', 'date', 'when', 'sun', 'is', 'at', 'longitude', 'lon', '.']
train
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/ephem/ephem.py#L77-L80
4,632
praw-dev/prawtools
prawtools/stats.py
SubredditStats.basic_stats
def basic_stats(self): """Return a markdown representation of simple statistics.""" comment_score = sum(comment.score for comment in self.comments) if self.comments: comment_duration = (self.comments[-1].created_utc - self.comments[0].created_utc) ...
python
def basic_stats(self): """Return a markdown representation of simple statistics.""" comment_score = sum(comment.score for comment in self.comments) if self.comments: comment_duration = (self.comments[-1].created_utc - self.comments[0].created_utc) ...
['def', 'basic_stats', '(', 'self', ')', ':', 'comment_score', '=', 'sum', '(', 'comment', '.', 'score', 'for', 'comment', 'in', 'self', '.', 'comments', ')', 'if', 'self', '.', 'comments', ':', 'comment_duration', '=', '(', 'self', '.', 'comments', '[', '-', '1', ']', '.', 'created_utc', '-', 'self', '.', 'comments', ...
Return a markdown representation of simple statistics.
['Return', 'a', 'markdown', 'representation', 'of', 'simple', 'statistics', '.']
train
https://github.com/praw-dev/prawtools/blob/571d5c28c2222f6f8dbbca8c815b8da0a776ab85/prawtools/stats.py#L112-L138
4,633
pandas-dev/pandas
pandas/core/generic.py
NDFrame._get_label_or_level_values
def _get_label_or_level_values(self, key, axis=0): """ Return a 1-D array of values associated with `key`, a label or level from the given `axis`. Retrieval logic: - (axis=0): Return column values if `key` matches a column label. Otherwise return index level values...
python
def _get_label_or_level_values(self, key, axis=0): """ Return a 1-D array of values associated with `key`, a label or level from the given `axis`. Retrieval logic: - (axis=0): Return column values if `key` matches a column label. Otherwise return index level values...
['def', '_get_label_or_level_values', '(', 'self', ',', 'key', ',', 'axis', '=', '0', ')', ':', 'if', 'self', '.', 'ndim', '>', '2', ':', 'raise', 'NotImplementedError', '(', '"_get_label_or_level_values is not implemented for {type}"', '.', 'format', '(', 'type', '=', 'type', '(', 'self', ')', ')', ')', 'axis', '=', '...
Return a 1-D array of values associated with `key`, a label or level from the given `axis`. Retrieval logic: - (axis=0): Return column values if `key` matches a column label. Otherwise return index level values if `key` matches an index level. - (axis=1): Ret...
['Return', 'a', '1', '-', 'D', 'array', 'of', 'values', 'associated', 'with', 'key', 'a', 'label', 'or', 'level', 'from', 'the', 'given', 'axis', '.']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L1688-L1757
4,634
log2timeline/plaso
plaso/parsers/presets.py
ParserPresetsManager.GetPresetsByOperatingSystem
def GetPresetsByOperatingSystem(self, operating_system): """Retrieves preset definitions for a specific operating system. Args: operating_system (OperatingSystemArtifact): an operating system artifact attribute container. Returns: list[PresetDefinition]: preset definition that corres...
python
def GetPresetsByOperatingSystem(self, operating_system): """Retrieves preset definitions for a specific operating system. Args: operating_system (OperatingSystemArtifact): an operating system artifact attribute container. Returns: list[PresetDefinition]: preset definition that corres...
['def', 'GetPresetsByOperatingSystem', '(', 'self', ',', 'operating_system', ')', ':', 'preset_definitions', '=', '[', ']', 'for', 'preset_definition', 'in', 'self', '.', '_definitions', '.', 'values', '(', ')', ':', 'for', 'preset_operating_system', 'in', 'preset_definition', '.', 'operating_systems', ':', 'if', 'pres...
Retrieves preset definitions for a specific operating system. Args: operating_system (OperatingSystemArtifact): an operating system artifact attribute container. Returns: list[PresetDefinition]: preset definition that correspond with the operating system.
['Retrieves', 'preset', 'definitions', 'for', 'a', 'specific', 'operating', 'system', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/presets.py#L159-L176
4,635
gem/oq-engine
openquake/engine/engine.py
poll_queue
def poll_queue(job_id, pid, poll_time): """ Check the queue of executing/submitted jobs and exit when there is a free slot. """ if config.distribution.serialize_jobs: first_time = True while True: jobs = logs.dbcmd(GET_JOBS) failed = [job.id for job in jobs if...
python
def poll_queue(job_id, pid, poll_time): """ Check the queue of executing/submitted jobs and exit when there is a free slot. """ if config.distribution.serialize_jobs: first_time = True while True: jobs = logs.dbcmd(GET_JOBS) failed = [job.id for job in jobs if...
['def', 'poll_queue', '(', 'job_id', ',', 'pid', ',', 'poll_time', ')', ':', 'if', 'config', '.', 'distribution', '.', 'serialize_jobs', ':', 'first_time', '=', 'True', 'while', 'True', ':', 'jobs', '=', 'logs', '.', 'dbcmd', '(', 'GET_JOBS', ')', 'failed', '=', '[', 'job', '.', 'id', 'for', 'job', 'in', 'jobs', 'if', ...
Check the queue of executing/submitted jobs and exit when there is a free slot.
['Check', 'the', 'queue', 'of', 'executing', '/', 'submitted', 'jobs', 'and', 'exit', 'when', 'there', 'is', 'a', 'free', 'slot', '.']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/engine/engine.py#L269-L291
4,636
helixyte/everest
everest/utils.py
generative
def generative(func): """ Marks an instance method as generative. """ def wrap(inst, *args, **kw): clone = type(inst).__new__(type(inst)) clone.__dict__ = inst.__dict__.copy() return func(clone, *args, **kw) return update_wrapper(wrap, func)
python
def generative(func): """ Marks an instance method as generative. """ def wrap(inst, *args, **kw): clone = type(inst).__new__(type(inst)) clone.__dict__ = inst.__dict__.copy() return func(clone, *args, **kw) return update_wrapper(wrap, func)
['def', 'generative', '(', 'func', ')', ':', 'def', 'wrap', '(', 'inst', ',', '*', 'args', ',', '*', '*', 'kw', ')', ':', 'clone', '=', 'type', '(', 'inst', ')', '.', '__new__', '(', 'type', '(', 'inst', ')', ')', 'clone', '.', '__dict__', '=', 'inst', '.', '__dict__', '.', 'copy', '(', ')', 'return', 'func', '(', 'clo...
Marks an instance method as generative.
['Marks', 'an', 'instance', 'method', 'as', 'generative', '.']
train
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/utils.py#L506-L514
4,637
titusjan/argos
argos/inspector/qtplugins/table.py
TableInspectorModel.setFont
def setFont(self, font): """ Sets the font that will be returned when data() is called with the Qt.FontRole. Can be a QFont or None if no font is set. """ check_class(font, QtGui.QFont, allow_none=True) self._font = font
python
def setFont(self, font): """ Sets the font that will be returned when data() is called with the Qt.FontRole. Can be a QFont or None if no font is set. """ check_class(font, QtGui.QFont, allow_none=True) self._font = font
['def', 'setFont', '(', 'self', ',', 'font', ')', ':', 'check_class', '(', 'font', ',', 'QtGui', '.', 'QFont', ',', 'allow_none', '=', 'True', ')', 'self', '.', '_font', '=', 'font']
Sets the font that will be returned when data() is called with the Qt.FontRole. Can be a QFont or None if no font is set.
['Sets', 'the', 'font', 'that', 'will', 'be', 'returned', 'when', 'data', '()', 'is', 'called', 'with', 'the', 'Qt', '.', 'FontRole', '.', 'Can', 'be', 'a', 'QFont', 'or', 'None', 'if', 'no', 'font', 'is', 'set', '.']
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/qtplugins/table.py#L601-L606
4,638
crocs-muni/roca
roca/detect.py
RocaFingerprinter.has_fingerprint_moduli
def has_fingerprint_moduli(self, modulus): """ Returns true if the fingerprint was detected in the key :param modulus: :return: """ if not self.is_acceptable_modulus(modulus): return False self.tested += 1 for i in range(0, len(self.primes)): ...
python
def has_fingerprint_moduli(self, modulus): """ Returns true if the fingerprint was detected in the key :param modulus: :return: """ if not self.is_acceptable_modulus(modulus): return False self.tested += 1 for i in range(0, len(self.primes)): ...
['def', 'has_fingerprint_moduli', '(', 'self', ',', 'modulus', ')', ':', 'if', 'not', 'self', '.', 'is_acceptable_modulus', '(', 'modulus', ')', ':', 'return', 'False', 'self', '.', 'tested', '+=', '1', 'for', 'i', 'in', 'range', '(', '0', ',', 'len', '(', 'self', '.', 'primes', ')', ')', ':', 'if', '(', '1', '<<', '('...
Returns true if the fingerprint was detected in the key :param modulus: :return:
['Returns', 'true', 'if', 'the', 'fingerprint', 'was', 'detected', 'in', 'the', 'key', ':', 'param', 'modulus', ':', ':', 'return', ':']
train
https://github.com/crocs-muni/roca/blob/74ad6ce63c428d83dcffce9c5e26ef7b9e30faa5/roca/detect.py#L937-L952
4,639
yyuu/botornado
boto/storage_uri.py
FileStorageUri.names_singleton
def names_singleton(self): """Returns True if this URI names a file or if URI represents input/output stream. """ if self.stream: return True else: return os.path.isfile(self.object_name)
python
def names_singleton(self): """Returns True if this URI names a file or if URI represents input/output stream. """ if self.stream: return True else: return os.path.isfile(self.object_name)
['def', 'names_singleton', '(', 'self', ')', ':', 'if', 'self', '.', 'stream', ':', 'return', 'True', 'else', ':', 'return', 'os', '.', 'path', '.', 'isfile', '(', 'self', '.', 'object_name', ')']
Returns True if this URI names a file or if URI represents input/output stream.
['Returns', 'True', 'if', 'this', 'URI', 'names', 'a', 'file', 'or', 'if', 'URI', 'represents', 'input', '/', 'output', 'stream', '.']
train
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/storage_uri.py#L493-L500
4,640
StackStorm/pybind
pybind/slxos/v17s_1_02/mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_refresh_reduction/__init__.py
interface_refresh_reduction._set_bundle_message
def _set_bundle_message(self, v, load=False): """ Setter method for bundle_message, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_refresh_reduction/bundle_message (container) If this variable is read-only (config: false) in the source YANG file, then _...
python
def _set_bundle_message(self, v, load=False): """ Setter method for bundle_message, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_refresh_reduction/bundle_message (container) If this variable is read-only (config: false) in the source YANG file, then _...
['def', '_set_bundle_message', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'bundle_message', '.', 'bundle_message', ',', 'is_container', '=...
Setter method for bundle_message, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_refresh_reduction/bundle_message (container) If this variable is read-only (config: false) in the source YANG file, then _set_bundle_message is considered as a private method. ...
['Setter', 'method', 'for', 'bundle_message', 'mapped', 'from', 'YANG', 'variable', '/', 'mpls_config', '/', 'router', '/', 'mpls', '/', 'mpls_cmds_holder', '/', 'mpls_interface', '/', 'rsvp', '/', 'interface_refresh_reduction', '/', 'bundle_message', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', ...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_refresh_reduction/__init__.py#L161-L182
4,641
tanghaibao/goatools
goatools/gosubdag/rpt/write_hierarchy.py
WrHierGO._get_namespace2go2term
def _get_namespace2go2term(go2terms): """Group GO IDs by namespace.""" namespace2go2term = cx.defaultdict(dict) for goid, goterm in go2terms.items(): namespace2go2term[goterm.namespace][goid] = goterm return namespace2go2term
python
def _get_namespace2go2term(go2terms): """Group GO IDs by namespace.""" namespace2go2term = cx.defaultdict(dict) for goid, goterm in go2terms.items(): namespace2go2term[goterm.namespace][goid] = goterm return namespace2go2term
['def', '_get_namespace2go2term', '(', 'go2terms', ')', ':', 'namespace2go2term', '=', 'cx', '.', 'defaultdict', '(', 'dict', ')', 'for', 'goid', ',', 'goterm', 'in', 'go2terms', '.', 'items', '(', ')', ':', 'namespace2go2term', '[', 'goterm', '.', 'namespace', ']', '[', 'goid', ']', '=', 'goterm', 'return', 'namespace...
Group GO IDs by namespace.
['Group', 'GO', 'IDs', 'by', 'namespace', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/write_hierarchy.py#L71-L76
4,642
aws/aws-iot-device-sdk-python
AWSIoTPythonSDK/MQTTLib.py
AWSIoTMQTTClient.configureEndpoint
def configureEndpoint(self, hostName, portNumber): """ **Description** Used to configure the host name and port number the client tries to connect to. Should be called before connect. **Syntax** .. code:: python myAWSIoTMQTTClient.configureEndpoint("random.i...
python
def configureEndpoint(self, hostName, portNumber): """ **Description** Used to configure the host name and port number the client tries to connect to. Should be called before connect. **Syntax** .. code:: python myAWSIoTMQTTClient.configureEndpoint("random.i...
['def', 'configureEndpoint', '(', 'self', ',', 'hostName', ',', 'portNumber', ')', ':', 'endpoint_provider', '=', 'EndpointProvider', '(', ')', 'endpoint_provider', '.', 'set_host', '(', 'hostName', ')', 'endpoint_provider', '.', 'set_port', '(', 'portNumber', ')', 'self', '.', '_mqtt_core', '.', 'configure_endpoint', ...
**Description** Used to configure the host name and port number the client tries to connect to. Should be called before connect. **Syntax** .. code:: python myAWSIoTMQTTClient.configureEndpoint("random.iot.region.amazonaws.com", 8883) **Parameters** *hostN...
['**', 'Description', '**']
train
https://github.com/aws/aws-iot-device-sdk-python/blob/f0aa2ce34b21dd2e44f4fb7e1d058656aaf2fc62/AWSIoTPythonSDK/MQTTLib.py#L140-L171
4,643
aio-libs/aiohttp
aiohttp/multipart.py
BodyPartReader.get_charset
def get_charset(self, default: str) -> str: """Returns charset parameter from Content-Type header or default.""" ctype = self.headers.get(CONTENT_TYPE, '') mimetype = parse_mimetype(ctype) return mimetype.parameters.get('charset', default)
python
def get_charset(self, default: str) -> str: """Returns charset parameter from Content-Type header or default.""" ctype = self.headers.get(CONTENT_TYPE, '') mimetype = parse_mimetype(ctype) return mimetype.parameters.get('charset', default)
['def', 'get_charset', '(', 'self', ',', 'default', ':', 'str', ')', '->', 'str', ':', 'ctype', '=', 'self', '.', 'headers', '.', 'get', '(', 'CONTENT_TYPE', ',', "''", ')', 'mimetype', '=', 'parse_mimetype', '(', 'ctype', ')', 'return', 'mimetype', '.', 'parameters', '.', 'get', '(', "'charset'", ',', 'default', ')']
Returns charset parameter from Content-Type header or default.
['Returns', 'charset', 'parameter', 'from', 'Content', '-', 'Type', 'header', 'or', 'default', '.']
train
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L470-L474
4,644
juju/python-libjuju
juju/client/connector.py
Connector.connect_controller
async def connect_controller(self, controller_name=None): """Connect to a controller by name. If the name is empty, it connect to the current controller. """ if not controller_name: controller_name = self.jujudata.current_controller() if not controller_name: ...
python
async def connect_controller(self, controller_name=None): """Connect to a controller by name. If the name is empty, it connect to the current controller. """ if not controller_name: controller_name = self.jujudata.current_controller() if not controller_name: ...
['async', 'def', 'connect_controller', '(', 'self', ',', 'controller_name', '=', 'None', ')', ':', 'if', 'not', 'controller_name', ':', 'controller_name', '=', 'self', '.', 'jujudata', '.', 'current_controller', '(', ')', 'if', 'not', 'controller_name', ':', 'raise', 'JujuConnectionError', '(', "'No current controller'...
Connect to a controller by name. If the name is empty, it connect to the current controller.
['Connect', 'to', 'a', 'controller', 'by', 'name', '.', 'If', 'the', 'name', 'is', 'empty', 'it', 'connect', 'to', 'the', 'current', 'controller', '.']
train
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/client/connector.py#L78-L101
4,645
noahbenson/pimms
pimms/util.py
LazyPMap.is_normal
def is_normal(self, k): ''' lmap.is_normal(k) yields True if k is a key in the given lazy map lmap that is neither lazy nor a formerly-lazy memoized key. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)) or [] != getargspec_py27like(...
python
def is_normal(self, k): ''' lmap.is_normal(k) yields True if k is a key in the given lazy map lmap that is neither lazy nor a formerly-lazy memoized key. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)) or [] != getargspec_py27like(...
['def', 'is_normal', '(', 'self', ',', 'k', ')', ':', 'v', '=', 'ps', '.', 'PMap', '.', '__getitem__', '(', 'self', ',', 'k', ')', 'if', 'not', 'isinstance', '(', 'v', ',', '(', 'types', '.', 'FunctionType', ',', 'partial', ')', ')', 'or', '[', ']', '!=', 'getargspec_py27like', '(', 'v', ')', '[', '0', ']', ':', 'retur...
lmap.is_normal(k) yields True if k is a key in the given lazy map lmap that is neither lazy nor a formerly-lazy memoized key.
['lmap', '.', 'is_normal', '(', 'k', ')', 'yields', 'True', 'if', 'k', 'is', 'a', 'key', 'in', 'the', 'given', 'lazy', 'map', 'lmap', 'that', 'is', 'neither', 'lazy', 'nor', 'a', 'formerly', '-', 'lazy', 'memoized', 'key', '.']
train
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L674-L683
4,646
pdkit/pdkit
pdkit/utils.py
plot_segmentation
def plot_segmentation(data, peaks, segment_indexes, figsize=(10, 5)): """ Will plot the data and segmentation based on the peaks and segment indexes. :param 1d-array data: The orginal axis of the data that was segmented into sections. :param 1d-array peaks: Peaks of the data. :param 1d-...
python
def plot_segmentation(data, peaks, segment_indexes, figsize=(10, 5)): """ Will plot the data and segmentation based on the peaks and segment indexes. :param 1d-array data: The orginal axis of the data that was segmented into sections. :param 1d-array peaks: Peaks of the data. :param 1d-...
['def', 'plot_segmentation', '(', 'data', ',', 'peaks', ',', 'segment_indexes', ',', 'figsize', '=', '(', '10', ',', '5', ')', ')', ':', 'fig', ',', 'ax', '=', 'plt', '.', 'subplots', '(', 'figsize', '=', 'figsize', ')', 'plt', '.', 'plot', '(', 'data', ')', 'for', 'segment', 'in', 'np', '.', 'unique', '(', 'segment_in...
Will plot the data and segmentation based on the peaks and segment indexes. :param 1d-array data: The orginal axis of the data that was segmented into sections. :param 1d-array peaks: Peaks of the data. :param 1d-array segment_indexes: These are the different classes, corresponding to each ...
['Will', 'plot', 'the', 'data', 'and', 'segmentation', 'based', 'on', 'the', 'peaks', 'and', 'segment', 'indexes', '.', ':', 'param', '1d', '-', 'array', 'data', ':', 'The', 'orginal', 'axis', 'of', 'the', 'data', 'that', 'was', 'segmented', 'into', 'sections', '.', ':', 'param', '1d', '-', 'array', 'peaks', ':', 'Peak...
train
https://github.com/pdkit/pdkit/blob/c7120263da2071bb139815fbdb56ca77b544f340/pdkit/utils.py#L717-L733
4,647
ilevkivskyi/typing_inspect
typing_inspect.py
is_callable_type
def is_callable_type(tp): """Test if the type is a generic callable type, including subclasses excluding non-generic types and callables. Examples:: is_callable_type(int) == False is_callable_type(type) == False is_callable_type(Callable) == True is_callable_type(Callable[.....
python
def is_callable_type(tp): """Test if the type is a generic callable type, including subclasses excluding non-generic types and callables. Examples:: is_callable_type(int) == False is_callable_type(type) == False is_callable_type(Callable) == True is_callable_type(Callable[.....
['def', 'is_callable_type', '(', 'tp', ')', ':', 'if', 'NEW_TYPING', ':', 'return', '(', 'tp', 'is', 'Callable', 'or', 'isinstance', '(', 'tp', ',', '_GenericAlias', ')', 'and', 'tp', '.', '__origin__', 'is', 'collections', '.', 'abc', '.', 'Callable', 'or', 'isinstance', '(', 'tp', ',', 'type', ')', 'and', 'issubclass...
Test if the type is a generic callable type, including subclasses excluding non-generic types and callables. Examples:: is_callable_type(int) == False is_callable_type(type) == False is_callable_type(Callable) == True is_callable_type(Callable[..., int]) == True is_calla...
['Test', 'if', 'the', 'type', 'is', 'a', 'generic', 'callable', 'type', 'including', 'subclasses', 'excluding', 'non', '-', 'generic', 'types', 'and', 'callables', '.', 'Examples', '::']
train
https://github.com/ilevkivskyi/typing_inspect/blob/fd81278cc440b6003f8298bcb22d5bc0f82ee3cd/typing_inspect.py#L66-L90
4,648
inasafe/inasafe
safe/impact_function/impact_function.py
ImpactFunction.intersect_exposure_and_aggregate_hazard
def intersect_exposure_and_aggregate_hazard(self): """This function intersects the exposure with the aggregate hazard. If the the exposure is a continuous raster exposure, this function will set the aggregate hazard layer. However, this function will set the impact layer. ""...
python
def intersect_exposure_and_aggregate_hazard(self): """This function intersects the exposure with the aggregate hazard. If the the exposure is a continuous raster exposure, this function will set the aggregate hazard layer. However, this function will set the impact layer. ""...
['def', 'intersect_exposure_and_aggregate_hazard', '(', 'self', ')', ':', 'LOGGER', '.', 'info', '(', "'ANALYSIS : Intersect Exposure and Aggregate Hazard'", ')', 'if', 'is_raster_layer', '(', 'self', '.', 'exposure', ')', ':', 'self', '.', 'set_state_process', '(', "'impact function'", ',', "'Zonal stats between expos...
This function intersects the exposure with the aggregate hazard. If the the exposure is a continuous raster exposure, this function will set the aggregate hazard layer. However, this function will set the impact layer.
['This', 'function', 'intersects', 'the', 'exposure', 'with', 'the', 'aggregate', 'hazard', '.']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L2310-L2400
4,649
wiheto/teneto
teneto/timeseries/postprocess.py
postpro_fisher
def postpro_fisher(data, report=None): """ Performs fisher transform on everything in data. If report variable is passed, this is added to the report. """ if not report: report = {} # Due to rounding errors data[data < -0.99999999999999] = -1 data[data > 0.99999999999999] = 1 ...
python
def postpro_fisher(data, report=None): """ Performs fisher transform on everything in data. If report variable is passed, this is added to the report. """ if not report: report = {} # Due to rounding errors data[data < -0.99999999999999] = -1 data[data > 0.99999999999999] = 1 ...
['def', 'postpro_fisher', '(', 'data', ',', 'report', '=', 'None', ')', ':', 'if', 'not', 'report', ':', 'report', '=', '{', '}', '# Due to rounding errors', 'data', '[', 'data', '<', '-', '0.99999999999999', ']', '=', '-', '1', 'data', '[', 'data', '>', '0.99999999999999', ']', '=', '1', 'fisher_data', '=', '0.5', '*'...
Performs fisher transform on everything in data. If report variable is passed, this is added to the report.
['Performs', 'fisher', 'transform', 'on', 'everything', 'in', 'data', '.']
train
https://github.com/wiheto/teneto/blob/80d7a83a9adc1714589b020627c45bd5b66248ab/teneto/timeseries/postprocess.py#L10-L25
4,650
nerdvegas/rez
src/rez/package_serialise.py
dump_package_data
def dump_package_data(data, buf, format_=FileFormat.py, skip_attributes=None): """Write package data to `buf`. Args: data (dict): Data source - must conform to `package_serialise_schema`. buf (file-like object): Destination stream. format_ (`FileFormat`): Format to dump data in. ...
python
def dump_package_data(data, buf, format_=FileFormat.py, skip_attributes=None): """Write package data to `buf`. Args: data (dict): Data source - must conform to `package_serialise_schema`. buf (file-like object): Destination stream. format_ (`FileFormat`): Format to dump data in. ...
['def', 'dump_package_data', '(', 'data', ',', 'buf', ',', 'format_', '=', 'FileFormat', '.', 'py', ',', 'skip_attributes', '=', 'None', ')', ':', 'if', 'format_', '==', 'FileFormat', '.', 'txt', ':', 'raise', 'ValueError', '(', '"\'txt\' format not supported for packages."', ')', 'data_', '=', 'dict', '(', '(', 'k', '...
Write package data to `buf`. Args: data (dict): Data source - must conform to `package_serialise_schema`. buf (file-like object): Destination stream. format_ (`FileFormat`): Format to dump data in. skip_attributes (list of str): List of attributes to not print.
['Write', 'package', 'data', 'to', 'buf', '.']
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/package_serialise.py#L97-L126
4,651
The-Politico/politico-civic-election
election/models/election_type.py
ElectionType.save
def save(self, *args, **kwargs): """ **uid**: :code:`electiontype:{name}` """ self.uid = 'electiontype:{}'.format(self.slug) super(ElectionType, self).save(*args, **kwargs)
python
def save(self, *args, **kwargs): """ **uid**: :code:`electiontype:{name}` """ self.uid = 'electiontype:{}'.format(self.slug) super(ElectionType, self).save(*args, **kwargs)
['def', 'save', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'uid', '=', "'electiontype:{}'", '.', 'format', '(', 'self', '.', 'slug', ')', 'super', '(', 'ElectionType', ',', 'self', ')', '.', 'save', '(', '*', 'args', ',', '*', '*', 'kwargs', ')']
**uid**: :code:`electiontype:{name}`
['**', 'uid', '**', ':', ':', 'code', ':', 'electiontype', ':', '{', 'name', '}']
train
https://github.com/The-Politico/politico-civic-election/blob/44c6872c419909df616e997e1990c4d295b25eda/election/models/election_type.py#L42-L47
4,652
biocore/burrito-fillings
bfillings/uclust.py
uclust_cluster_from_sorted_fasta_filepath
def uclust_cluster_from_sorted_fasta_filepath( fasta_filepath, uc_save_filepath=None, percent_ID=0.97, max_accepts=1, max_rejects=8, stepwords=8, word_length=8, optimal=False, exact=False, suppress_sort=False, enable_rev_strand_matc...
python
def uclust_cluster_from_sorted_fasta_filepath( fasta_filepath, uc_save_filepath=None, percent_ID=0.97, max_accepts=1, max_rejects=8, stepwords=8, word_length=8, optimal=False, exact=False, suppress_sort=False, enable_rev_strand_matc...
['def', 'uclust_cluster_from_sorted_fasta_filepath', '(', 'fasta_filepath', ',', 'uc_save_filepath', '=', 'None', ',', 'percent_ID', '=', '0.97', ',', 'max_accepts', '=', '1', ',', 'max_rejects', '=', '8', ',', 'stepwords', '=', '8', ',', 'word_length', '=', '8', ',', 'optimal', '=', 'False', ',', 'exact', '=', 'False'...
Returns clustered uclust file from sorted fasta
['Returns', 'clustered', 'uclust', 'file', 'from', 'sorted', 'fasta']
train
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/uclust.py#L433-L482
4,653
facelessuser/wcmatch
wcmatch/_wcparse.py
translate
def translate(patterns, flags): """Translate patterns.""" positive = [] negative = [] if isinstance(patterns, (str, bytes)): patterns = [patterns] flags |= _TRANSLATE for pattern in patterns: for expanded in expand_braces(pattern, flags): (negative if is_negative(e...
python
def translate(patterns, flags): """Translate patterns.""" positive = [] negative = [] if isinstance(patterns, (str, bytes)): patterns = [patterns] flags |= _TRANSLATE for pattern in patterns: for expanded in expand_braces(pattern, flags): (negative if is_negative(e...
['def', 'translate', '(', 'patterns', ',', 'flags', ')', ':', 'positive', '=', '[', ']', 'negative', '=', '[', ']', 'if', 'isinstance', '(', 'patterns', ',', '(', 'str', ',', 'bytes', ')', ')', ':', 'patterns', '=', '[', 'patterns', ']', 'flags', '|=', '_TRANSLATE', 'for', 'pattern', 'in', 'patterns', ':', 'for', 'expa...
Translate patterns.
['Translate', 'patterns', '.']
train
https://github.com/facelessuser/wcmatch/blob/d153e7007cc73b994ae1ba553dc4584039f5c212/wcmatch/_wcparse.py#L203-L222
4,654
ensime/ensime-vim
ensime_shared/editor.py
Editor.split_window
def split_window(self, fpath, vertical=False, size=None, bufopts=None): """Open file in a new split window. Args: fpath (str): Path of the file to open. If ``None``, a new empty split is created. vertical (bool): Whether to open a vertical split. size...
python
def split_window(self, fpath, vertical=False, size=None, bufopts=None): """Open file in a new split window. Args: fpath (str): Path of the file to open. If ``None``, a new empty split is created. vertical (bool): Whether to open a vertical split. size...
['def', 'split_window', '(', 'self', ',', 'fpath', ',', 'vertical', '=', 'False', ',', 'size', '=', 'None', ',', 'bufopts', '=', 'None', ')', ':', 'command', '=', "'split {}'", '.', 'format', '(', 'fpath', ')', 'if', 'fpath', 'else', "'new'", 'if', 'vertical', ':', 'command', '=', "'v'", '+', 'command', 'if', 'size', '...
Open file in a new split window. Args: fpath (str): Path of the file to open. If ``None``, a new empty split is created. vertical (bool): Whether to open a vertical split. size (Optional[int]): The height (or width) to set for the new window. bufo...
['Open', 'file', 'in', 'a', 'new', 'split', 'window', '.']
train
https://github.com/ensime/ensime-vim/blob/caa734e84f002b25446c615706283a74edd4ecfe/ensime_shared/editor.py#L165-L185
4,655
mlperf/training
translation/tensorflow/transformer/utils/tokenizer.py
Subtokenizer.decode
def decode(self, subtokens): """Converts list of int subtokens ids into a string.""" if isinstance(subtokens, np.ndarray): # Note that list(subtokens) converts subtokens to a python list, but the # items remain as np.int32. This converts both the array and its items. subtokens = subtokens.toli...
python
def decode(self, subtokens): """Converts list of int subtokens ids into a string.""" if isinstance(subtokens, np.ndarray): # Note that list(subtokens) converts subtokens to a python list, but the # items remain as np.int32. This converts both the array and its items. subtokens = subtokens.toli...
['def', 'decode', '(', 'self', ',', 'subtokens', ')', ':', 'if', 'isinstance', '(', 'subtokens', ',', 'np', '.', 'ndarray', ')', ':', '# Note that list(subtokens) converts subtokens to a python list, but the', '# items remain as np.int32. This converts both the array and its items.', 'subtokens', '=', 'subtokens', '.',...
Converts list of int subtokens ids into a string.
['Converts', 'list', 'of', 'int', 'subtokens', 'ids', 'into', 'a', 'string', '.']
train
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/utils/tokenizer.py#L153-L167
4,656
diging/tethne
tethne/classes/corpus.py
Corpus.top_features
def top_features(self, featureset_name, topn=20, by='counts', perslice=False, slice_kwargs={}): """ Retrieves the top ``topn`` most numerous features in the corpus. Parameters ---------- featureset_name : str Name of a :class:`.FeatureSet` in the...
python
def top_features(self, featureset_name, topn=20, by='counts', perslice=False, slice_kwargs={}): """ Retrieves the top ``topn`` most numerous features in the corpus. Parameters ---------- featureset_name : str Name of a :class:`.FeatureSet` in the...
['def', 'top_features', '(', 'self', ',', 'featureset_name', ',', 'topn', '=', '20', ',', 'by', '=', "'counts'", ',', 'perslice', '=', 'False', ',', 'slice_kwargs', '=', '{', '}', ')', ':', 'if', 'perslice', ':', 'return', '[', '(', 'k', ',', 'subcorpus', '.', 'features', '[', 'featureset_name', ']', '.', 'top', '(', '...
Retrieves the top ``topn`` most numerous features in the corpus. Parameters ---------- featureset_name : str Name of a :class:`.FeatureSet` in the :class:`.Corpus`\. topn : int (default: ``20``) Number of features to return. by : str (default:...
['Retrieves', 'the', 'top', 'topn', 'most', 'numerous', 'features', 'in', 'the', 'corpus', '.']
train
https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/classes/corpus.py#L687-L713
4,657
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.change_text
def change_text(self, text, fname, pattern=None, before=False, force=False, delete=False, note=None, replace=False, line_oriented=True, create=True, ...
python
def change_text(self, text, fname, pattern=None, before=False, force=False, delete=False, note=None, replace=False, line_oriented=True, create=True, ...
['def', 'change_text', '(', 'self', ',', 'text', ',', 'fname', ',', 'pattern', '=', 'None', ',', 'before', '=', 'False', ',', 'force', '=', 'False', ',', 'delete', '=', 'False', ',', 'note', '=', 'None', ',', 'replace', '=', 'False', ',', 'line_oriented', '=', 'True', ',', 'create', '=', 'True', ',', 'loglevel', '=', '...
Change text in a file. Returns None if there was no match for the regexp, True if it was matched and replaced, and False if the file did not exist or there was some other problem. @param text: Text to insert. @param fname: Filename to insert text to @param pattern: Regexp for a line...
['Change', 'text', 'in', 'a', 'file', '.']
train
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L2340-L2563
4,658
StevenMaude/bbc-radio-tracklisting-downloader
bbc_tracklist.py
save_tag_to_audio_file
def save_tag_to_audio_file(audio_file, tracklisting): """ Saves tag to audio file. """ print("Trying to tag {}".format(audio_file)) f = mediafile.MediaFile(audio_file) if not f.lyrics: print("No tracklisting present. Creating lyrics tag.") f.lyrics = 'Tracklisting' + '\n' + trac...
python
def save_tag_to_audio_file(audio_file, tracklisting): """ Saves tag to audio file. """ print("Trying to tag {}".format(audio_file)) f = mediafile.MediaFile(audio_file) if not f.lyrics: print("No tracklisting present. Creating lyrics tag.") f.lyrics = 'Tracklisting' + '\n' + trac...
['def', 'save_tag_to_audio_file', '(', 'audio_file', ',', 'tracklisting', ')', ':', 'print', '(', '"Trying to tag {}"', '.', 'format', '(', 'audio_file', ')', ')', 'f', '=', 'mediafile', '.', 'MediaFile', '(', 'audio_file', ')', 'if', 'not', 'f', '.', 'lyrics', ':', 'print', '(', '"No tracklisting present. Creating lyr...
Saves tag to audio file.
['Saves', 'tag', 'to', 'audio', 'file', '.']
train
https://github.com/StevenMaude/bbc-radio-tracklisting-downloader/blob/9fe9096b4d889888f65756444e4fd71352b92458/bbc_tracklist.py#L157-L175
4,659
YosaiProject/yosai
yosai/core/realm/realm.py
AccountStoreRealm.get_authentication_info
def get_authentication_info(self, identifier): """ The default authentication caching policy is to cache an account's credentials that are queried from an account store, for a specific user, so to facilitate any subsequent authentication attempts for that user. Naturally, in orde...
python
def get_authentication_info(self, identifier): """ The default authentication caching policy is to cache an account's credentials that are queried from an account store, for a specific user, so to facilitate any subsequent authentication attempts for that user. Naturally, in orde...
['def', 'get_authentication_info', '(', 'self', ',', 'identifier', ')', ':', 'account_info', '=', 'None', 'ch', '=', 'self', '.', 'cache_handler', 'def', 'query_authc_info', '(', 'self', ')', ':', 'msg', '=', '(', '"Could not obtain cached credentials for [{0}]. "', '"Will try to acquire credentials from account store...
The default authentication caching policy is to cache an account's credentials that are queried from an account store, for a specific user, so to facilitate any subsequent authentication attempts for that user. Naturally, in order to cache one must have a CacheHandler. If a user were to ...
['The', 'default', 'authentication', 'caching', 'policy', 'is', 'to', 'cache', 'an', 'account', 's', 'credentials', 'that', 'are', 'queried', 'from', 'an', 'account', 'store', 'for', 'a', 'specific', 'user', 'so', 'to', 'facilitate', 'any', 'subsequent', 'authentication', 'attempts', 'for', 'that', 'user', '.', 'Natura...
train
https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/core/realm/realm.py#L145-L199
4,660
rackerlabs/txkazoo
txkazoo/recipe/watchers.py
watch_children
def watch_children(kzclient, path, func, allow_session_lost=True, send_event=False, ChildrenWatch=ChildrenWatch): """ Install a Kazoo :obj:`ChildrenWatch` on the given path. The given `func` will be called in the reactor thread when any children are created or dele...
python
def watch_children(kzclient, path, func, allow_session_lost=True, send_event=False, ChildrenWatch=ChildrenWatch): """ Install a Kazoo :obj:`ChildrenWatch` on the given path. The given `func` will be called in the reactor thread when any children are created or dele...
['def', 'watch_children', '(', 'kzclient', ',', 'path', ',', 'func', ',', 'allow_session_lost', '=', 'True', ',', 'send_event', '=', 'False', ',', 'ChildrenWatch', '=', 'ChildrenWatch', ')', ':', 'def', 'wrapped_func', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'blockingCallFromThread', '(', 'kzclie...
Install a Kazoo :obj:`ChildrenWatch` on the given path. The given `func` will be called in the reactor thread when any children are created or deleted, or if the node itself is deleted. Returns a Deferred which usually has no result, but may fail with an exception if e.g. the path does not exist.
['Install', 'a', 'Kazoo', ':', 'obj', ':', 'ChildrenWatch', 'on', 'the', 'given', 'path', '.']
train
https://github.com/rackerlabs/txkazoo/blob/a0989138cc08df7acd1d410f7e48708553839f46/txkazoo/recipe/watchers.py#L22-L45
4,661
alefnula/tea
tea/console/format.py
table
def table(text): """Format the text as a table. Text in format: first | second row 2 col 1 | 4 Will be formatted as:: +-------------+--------+ | first | second | +-------------+--------+ | row 2 col 1 | 4 | +-------------+--------+...
python
def table(text): """Format the text as a table. Text in format: first | second row 2 col 1 | 4 Will be formatted as:: +-------------+--------+ | first | second | +-------------+--------+ | row 2 col 1 | 4 | +-------------+--------+...
['def', 'table', '(', 'text', ')', ':', 'def', 'table_bar', '(', 'col_lengths', ')', ':', 'return', '"+-%s-+%s"', '%', '(', '"-+-"', '.', 'join', '(', '[', '"-"', '*', 'length', 'for', 'length', 'in', 'col_lengths', ']', ')', ',', 'os', '.', 'linesep', ',', ')', 'rows', '=', '[', ']', 'for', 'line', 'in', 'text', '.', ...
Format the text as a table. Text in format: first | second row 2 col 1 | 4 Will be formatted as:: +-------------+--------+ | first | second | +-------------+--------+ | row 2 col 1 | 4 | +-------------+--------+ Args: te...
['Format', 'the', 'text', 'as', 'a', 'table', '.', 'Text', 'in', 'format', ':', 'first', '|', 'second', 'row', '2', 'col', '1', '|', '4', 'Will', 'be', 'formatted', 'as', '::', '+', '-------------', '+', '--------', '+', '|', 'first', '|', 'second', '|', '+', '-------------', '+', '--------', '+', '|', 'row', '2', 'col...
train
https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/console/format.py#L33-L82
4,662
sloria/doitlive
doitlive/keyboard.py
magicrun
def magicrun( text, shell, prompt_template="default", aliases=None, envvars=None, extra_commands=None, speed=1, test_mode=False, commentecho=False, ): """Echo out each character in ``text`` as keyboard characters are pressed, wait for a RETURN keypress, then run the ``text`` ...
python
def magicrun( text, shell, prompt_template="default", aliases=None, envvars=None, extra_commands=None, speed=1, test_mode=False, commentecho=False, ): """Echo out each character in ``text`` as keyboard characters are pressed, wait for a RETURN keypress, then run the ``text`` ...
['def', 'magicrun', '(', 'text', ',', 'shell', ',', 'prompt_template', '=', '"default"', ',', 'aliases', '=', 'None', ',', 'envvars', '=', 'None', ',', 'extra_commands', '=', 'None', ',', 'speed', '=', '1', ',', 'test_mode', '=', 'False', ',', 'commentecho', '=', 'False', ',', ')', ':', 'goto_regulartype', '=', 'magict...
Echo out each character in ``text`` as keyboard characters are pressed, wait for a RETURN keypress, then run the ``text`` in a shell context.
['Echo', 'out', 'each', 'character', 'in', 'text', 'as', 'keyboard', 'characters', 'are', 'pressed', 'wait', 'for', 'a', 'RETURN', 'keypress', 'then', 'run', 'the', 'text', 'in', 'a', 'shell', 'context', '.']
train
https://github.com/sloria/doitlive/blob/baf43f8ad3f2e4593fe21f6af42aedd34ef1efee/doitlive/keyboard.py#L202-L227
4,663
gmr/rejected
rejected/mcp.py
MasterControlProgram.check_process_counts
def check_process_counts(self): """Check for the minimum consumer process levels and start up new processes needed. """ LOGGER.debug('Checking minimum consumer process levels') for name in self.consumers: processes_needed = self.process_spawn_qty(name) if...
python
def check_process_counts(self): """Check for the minimum consumer process levels and start up new processes needed. """ LOGGER.debug('Checking minimum consumer process levels') for name in self.consumers: processes_needed = self.process_spawn_qty(name) if...
['def', 'check_process_counts', '(', 'self', ')', ':', 'LOGGER', '.', 'debug', '(', "'Checking minimum consumer process levels'", ')', 'for', 'name', 'in', 'self', '.', 'consumers', ':', 'processes_needed', '=', 'self', '.', 'process_spawn_qty', '(', 'name', ')', 'if', 'processes_needed', ':', 'LOGGER', '.', 'info', '(...
Check for the minimum consumer process levels and start up new processes needed.
['Check', 'for', 'the', 'minimum', 'consumer', 'process', 'levels', 'and', 'start', 'up', 'new', 'processes', 'needed', '.']
train
https://github.com/gmr/rejected/blob/610a3e1401122ecb98d891b6795cca0255e5b044/rejected/mcp.py#L183-L194
4,664
volfpeter/graphscraper
src/graphscraper/base.py
NodeList.get_node
def get_node(self, index: int) -> Optional[Node]: """ Returns the node with the given index if such a node currently exists in the node list. Arguments: index (int): The index of the queried node. Returns: The node with the given index if such a node cur...
python
def get_node(self, index: int) -> Optional[Node]: """ Returns the node with the given index if such a node currently exists in the node list. Arguments: index (int): The index of the queried node. Returns: The node with the given index if such a node cur...
['def', 'get_node', '(', 'self', ',', 'index', ':', 'int', ')', '->', 'Optional', '[', 'Node', ']', ':', 'return', 'self', '.', '_nodes', '.', 'get', '(', 'index', ')']
Returns the node with the given index if such a node currently exists in the node list. Arguments: index (int): The index of the queried node. Returns: The node with the given index if such a node currently exists in the node list, `None` otherwise.
['Returns', 'the', 'node', 'with', 'the', 'given', 'index', 'if', 'such', 'a', 'node', 'currently', 'exists', 'in', 'the', 'node', 'list', '.', 'Arguments', ':', 'index', '(', 'int', ')', ':', 'The', 'index', 'of', 'the', 'queried', 'node', '.', 'Returns', ':', 'The', 'node', 'with', 'the', 'given', 'index', 'if', 'suc...
train
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/base.py#L317-L328
4,665
KelSolaar/Oncilla
oncilla/reStructuredText_to_html.py
main
def main(): """ Starts the Application. :return: Definition success. :rtype: bool """ args = get_command_line_arguments() args.css_file = args.css_file if foundations.common.path_exists(args.css_file) else CSS_FILE return reStructuredText_to_html(args.input, ...
python
def main(): """ Starts the Application. :return: Definition success. :rtype: bool """ args = get_command_line_arguments() args.css_file = args.css_file if foundations.common.path_exists(args.css_file) else CSS_FILE return reStructuredText_to_html(args.input, ...
['def', 'main', '(', ')', ':', 'args', '=', 'get_command_line_arguments', '(', ')', 'args', '.', 'css_file', '=', 'args', '.', 'css_file', 'if', 'foundations', '.', 'common', '.', 'path_exists', '(', 'args', '.', 'css_file', ')', 'else', 'CSS_FILE', 'return', 'reStructuredText_to_html', '(', 'args', '.', 'input', ',', ...
Starts the Application. :return: Definition success. :rtype: bool
['Starts', 'the', 'Application', '.']
train
https://github.com/KelSolaar/Oncilla/blob/2b4db3704cf2c22a09a207681cb041fff555a994/oncilla/reStructuredText_to_html.py#L130-L142
4,666
buildbot/buildbot
master/buildbot/www/hooks/github.py
GitHubEventHandler._get_commit_msg
def _get_commit_msg(self, repo, sha): ''' :param repo: the repo full name, ``{owner}/{project}``. e.g. ``buildbot/buildbot`` ''' headers = { 'User-Agent': 'Buildbot' } if self._token: headers['Authorization'] = 'token ' + self._token ...
python
def _get_commit_msg(self, repo, sha): ''' :param repo: the repo full name, ``{owner}/{project}``. e.g. ``buildbot/buildbot`` ''' headers = { 'User-Agent': 'Buildbot' } if self._token: headers['Authorization'] = 'token ' + self._token ...
['def', '_get_commit_msg', '(', 'self', ',', 'repo', ',', 'sha', ')', ':', 'headers', '=', '{', "'User-Agent'", ':', "'Buildbot'", '}', 'if', 'self', '.', '_token', ':', 'headers', '[', "'Authorization'", ']', '=', "'token '", '+', 'self', '.', '_token', 'url', '=', "'/repos/{}/commits/{}'", '.', 'format', '(', 'repo',...
:param repo: the repo full name, ``{owner}/{project}``. e.g. ``buildbot/buildbot``
[':', 'param', 'repo', ':', 'the', 'repo', 'full', 'name', '{', 'owner', '}', '/', '{', 'project', '}', '.', 'e', '.', 'g', '.', 'buildbot', '/', 'buildbot']
train
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/hooks/github.py#L225-L243
4,667
flatangle/flatlib
flatlib/dignities/accidental.py
AccidentalDignity.isAuxilied
def isAuxilied(self): """ Returns if the object is separating and applying to a benefic considering good aspects. """ benefics = [const.VENUS, const.JUPITER] return self.__sepApp(benefics, aspList=[0, 60, 120])
python
def isAuxilied(self): """ Returns if the object is separating and applying to a benefic considering good aspects. """ benefics = [const.VENUS, const.JUPITER] return self.__sepApp(benefics, aspList=[0, 60, 120])
['def', 'isAuxilied', '(', 'self', ')', ':', 'benefics', '=', '[', 'const', '.', 'VENUS', ',', 'const', '.', 'JUPITER', ']', 'return', 'self', '.', '__sepApp', '(', 'benefics', ',', 'aspList', '=', '[', '0', ',', '60', ',', '120', ']', ')']
Returns if the object is separating and applying to a benefic considering good aspects.
['Returns', 'if', 'the', 'object', 'is', 'separating', 'and', 'applying', 'to', 'a', 'benefic', 'considering', 'good', 'aspects', '.']
train
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/dignities/accidental.py#L324-L330
4,668
materialsproject/pymatgen
pymatgen/io/abinit/tasks.py
Task.ipath_from_ext
def ipath_from_ext(self, ext): """ Returns the path of the input file with extension ext. Use it when the file does not exist yet. """ return os.path.join(self.workdir, self.prefix.idata + "_" + ext)
python
def ipath_from_ext(self, ext): """ Returns the path of the input file with extension ext. Use it when the file does not exist yet. """ return os.path.join(self.workdir, self.prefix.idata + "_" + ext)
['def', 'ipath_from_ext', '(', 'self', ',', 'ext', ')', ':', 'return', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'workdir', ',', 'self', '.', 'prefix', '.', 'idata', '+', '"_"', '+', 'ext', ')']
Returns the path of the input file with extension ext. Use it when the file does not exist yet.
['Returns', 'the', 'path', 'of', 'the', 'input', 'file', 'with', 'extension', 'ext', '.', 'Use', 'it', 'when', 'the', 'file', 'does', 'not', 'exist', 'yet', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L1482-L1487
4,669
hydraplatform/hydra-base
hydra_base/lib/sharing.py
set_project_permission
def set_project_permission(project_id, usernames, read, write, share,**kwargs): """ Set permissions on a project to a list of users, identifed by their usernames. The read flag ('Y' or 'N') sets read access, the write flag sets write access. If the read flag is 'N', then there is ...
python
def set_project_permission(project_id, usernames, read, write, share,**kwargs): """ Set permissions on a project to a list of users, identifed by their usernames. The read flag ('Y' or 'N') sets read access, the write flag sets write access. If the read flag is 'N', then there is ...
['def', 'set_project_permission', '(', 'project_id', ',', 'usernames', ',', 'read', ',', 'write', ',', 'share', ',', '*', '*', 'kwargs', ')', ':', 'user_id', '=', 'kwargs', '.', 'get', '(', "'user_id'", ')', 'proj_i', '=', '_get_project', '(', 'project_id', ')', '#Is the sharing user allowed to share this project?', 'p...
Set permissions on a project to a list of users, identifed by their usernames. The read flag ('Y' or 'N') sets read access, the write flag sets write access. If the read flag is 'N', then there is automatically no write access or share access.
['Set', 'permissions', 'on', 'a', 'project', 'to', 'a', 'list', 'of', 'users', 'identifed', 'by', 'their', 'usernames', '.']
train
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/sharing.py#L172-L207
4,670
razorpay/razorpay-python
razorpay/resources/addon.py
Addon.fetch
def fetch(self, addon_id, data={}, **kwargs): """" Fetch addon for given Id Args: addon_id : Id for which addon object has to be retrieved Returns: addon dict for given subscription Id """ return super(Addon, self).fetch(addon_id, data, **kwargs)
python
def fetch(self, addon_id, data={}, **kwargs): """" Fetch addon for given Id Args: addon_id : Id for which addon object has to be retrieved Returns: addon dict for given subscription Id """ return super(Addon, self).fetch(addon_id, data, **kwargs)
['def', 'fetch', '(', 'self', ',', 'addon_id', ',', 'data', '=', '{', '}', ',', '*', '*', 'kwargs', ')', ':', 'return', 'super', '(', 'Addon', ',', 'self', ')', '.', 'fetch', '(', 'addon_id', ',', 'data', ',', '*', '*', 'kwargs', ')']
Fetch addon for given Id Args: addon_id : Id for which addon object has to be retrieved Returns: addon dict for given subscription Id
['Fetch', 'addon', 'for', 'given', 'Id']
train
https://github.com/razorpay/razorpay-python/blob/5bc63fd8452165a4b54556888492e555222c8afe/razorpay/resources/addon.py#L10-L20
4,671
gem/oq-engine
openquake/hazardlib/gsim/frankel_1996.py
FrankelEtAl1996MblgAB1987NSHMP2008.get_mean_and_stddevs
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. :raises ValueError: if imt is instance of :class:`openquake.hazardlib...
python
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. :raises ValueError: if imt is instance of :class:`openquake.hazardlib...
['def', 'get_mean_and_stddevs', '(', 'self', ',', 'sites', ',', 'rup', ',', 'dists', ',', 'imt', ',', 'stddev_types', ')', ':', 'assert', 'all', '(', 'stddev_type', 'in', 'self', '.', 'DEFINED_FOR_STANDARD_DEVIATION_TYPES', 'for', 'stddev_type', 'in', 'stddev_types', ')', 'if', 'imt', 'not', 'in', 'self', '.', 'IMTS_TA...
See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. :raises ValueError: if imt is instance of :class:`openquake.hazardlib.imt.SA` with unsupported period.
['See', ':', 'meth', ':', 'superclass', 'method', '<', '.', 'base', '.', 'GroundShakingIntensityModel', '.', 'get_mean_and_stddevs', '>', 'for', 'spec', 'of', 'input', 'and', 'result', 'values', '.']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/frankel_1996.py#L102-L127
4,672
sorgerlab/indra
indra/databases/ndex_client.py
set_style
def set_style(network_id, ndex_cred=None, template_id=None): """Set the style of the network to a given template network's style Parameters ---------- network_id : str The UUID of the NDEx network whose style is to be changed. ndex_cred : dict A dictionary of NDEx credentials. t...
python
def set_style(network_id, ndex_cred=None, template_id=None): """Set the style of the network to a given template network's style Parameters ---------- network_id : str The UUID of the NDEx network whose style is to be changed. ndex_cred : dict A dictionary of NDEx credentials. t...
['def', 'set_style', '(', 'network_id', ',', 'ndex_cred', '=', 'None', ',', 'template_id', '=', 'None', ')', ':', 'if', 'not', 'template_id', ':', 'template_id', '=', '"ea4ea3b7-6903-11e7-961c-0ac135e8bacf"', 'server', '=', "'http://public.ndexbio.org'", 'username', ',', 'password', '=', 'get_default_ndex_cred', '(', '...
Set the style of the network to a given template network's style Parameters ---------- network_id : str The UUID of the NDEx network whose style is to be changed. ndex_cred : dict A dictionary of NDEx credentials. template_id : Optional[str] The UUID of the NDEx network whos...
['Set', 'the', 'style', 'of', 'the', 'network', 'to', 'a', 'given', 'template', 'network', 's', 'style']
train
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/ndex_client.py#L192-L219
4,673
inveniosoftware/invenio-files-rest
invenio_files_rest/models.py
BucketTag.get_value
def get_value(cls, bucket, key): """Get tag value.""" obj = cls.get(bucket, key) return obj.value if obj else None
python
def get_value(cls, bucket, key): """Get tag value.""" obj = cls.get(bucket, key) return obj.value if obj else None
['def', 'get_value', '(', 'cls', ',', 'bucket', ',', 'key', ')', ':', 'obj', '=', 'cls', '.', 'get', '(', 'bucket', ',', 'key', ')', 'return', 'obj', '.', 'value', 'if', 'obj', 'else', 'None']
Get tag value.
['Get', 'tag', 'value', '.']
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/models.py#L623-L626
4,674
mandiant/ioc_writer
ioc_writer/ioc_api.py
IOC.update_link_rel_based
def update_link_rel_based(self, old_rel, new_rel=None, new_text=None, single_link=False): """ Update link nodes, based on the existing link/@rel values. This requires specifying a link/@rel value to update, and either a new link/@rel value, or a new link/text() value for all links which...
python
def update_link_rel_based(self, old_rel, new_rel=None, new_text=None, single_link=False): """ Update link nodes, based on the existing link/@rel values. This requires specifying a link/@rel value to update, and either a new link/@rel value, or a new link/text() value for all links which...
['def', 'update_link_rel_based', '(', 'self', ',', 'old_rel', ',', 'new_rel', '=', 'None', ',', 'new_text', '=', 'None', ',', 'single_link', '=', 'False', ')', ':', 'links', '=', 'self', '.', 'metadata', '.', 'xpath', '(', '\'./links/link[@rel="{}"]\'', '.', 'format', '(', 'old_rel', ')', ')', 'if', 'len', '(', 'links'...
Update link nodes, based on the existing link/@rel values. This requires specifying a link/@rel value to update, and either a new link/@rel value, or a new link/text() value for all links which match the link/@rel value. Optionally, only the first link which matches the link/@rel value...
['Update', 'link', 'nodes', 'based', 'on', 'the', 'existing', 'link', '/', '@rel', 'values', '.']
train
https://github.com/mandiant/ioc_writer/blob/712247f3a10bdc2584fa18ac909fc763f71df21a/ioc_writer/ioc_api.py#L313-L350
4,675
aio-libs/yarl
yarl/__init__.py
URL.human_repr
def human_repr(self): """Return decoded human readable string for URL representation.""" return urlunsplit( SplitResult( self.scheme, self._make_netloc( self.user, self.password, self.host, self._val.port, encode=False ), ...
python
def human_repr(self): """Return decoded human readable string for URL representation.""" return urlunsplit( SplitResult( self.scheme, self._make_netloc( self.user, self.password, self.host, self._val.port, encode=False ), ...
['def', 'human_repr', '(', 'self', ')', ':', 'return', 'urlunsplit', '(', 'SplitResult', '(', 'self', '.', 'scheme', ',', 'self', '.', '_make_netloc', '(', 'self', '.', 'user', ',', 'self', '.', 'password', ',', 'self', '.', 'host', ',', 'self', '.', '_val', '.', 'port', ',', 'encode', '=', 'False', ')', ',', 'self', '...
Return decoded human readable string for URL representation.
['Return', 'decoded', 'human', 'readable', 'string', 'for', 'URL', 'representation', '.']
train
https://github.com/aio-libs/yarl/blob/e47da02c00ad764e030ca7647a9565548c97d362/yarl/__init__.py#L968-L981
4,676
saltstack/salt
salt/modules/csf.py
deny
def deny(ip, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='d', ttl=None, comment=''): ''' Add an rule to csf denied hosts See :func:`_access_rule`. 1- Deny an IP: CLI Example: .. code-block:: bash salt '*' cs...
python
def deny(ip, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='d', ttl=None, comment=''): ''' Add an rule to csf denied hosts See :func:`_access_rule`. 1- Deny an IP: CLI Example: .. code-block:: bash salt '*' cs...
['def', 'deny', '(', 'ip', ',', 'port', '=', 'None', ',', 'proto', '=', "'tcp'", ',', 'direction', '=', "'in'", ',', 'port_origin', '=', "'d'", ',', 'ip_origin', '=', "'d'", ',', 'ttl', '=', 'None', ',', 'comment', '=', "''", ')', ':', 'return', '_access_rule', '(', "'deny'", ',', 'ip', ',', 'port', ',', 'proto', ',', ...
Add an rule to csf denied hosts See :func:`_access_rule`. 1- Deny an IP: CLI Example: .. code-block:: bash salt '*' csf.deny 127.0.0.1 salt '*' csf.deny 127.0.0.1 comment="Too localhosty"
['Add', 'an', 'rule', 'to', 'csf', 'denied', 'hosts', 'See', ':', 'func', ':', '_access_rule', '.', '1', '-', 'Deny', 'an', 'IP', ':', 'CLI', 'Example', ':']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/csf.py#L450-L469
4,677
MAVENSDC/cdflib
cdflib/cdfwrite.py
CDF._update_vdr_vxrheadtail
def _update_vdr_vxrheadtail(self, f, vdr_offset, VXRoffset): ''' This sets a VXR to be the first and last VXR in the VDR ''' # VDR's VXRhead self._update_offset_value(f, vdr_offset+28, 8, VXRoffset) # VDR's VXRtail self._update_offset_value(f, vdr_offset+36, 8, VX...
python
def _update_vdr_vxrheadtail(self, f, vdr_offset, VXRoffset): ''' This sets a VXR to be the first and last VXR in the VDR ''' # VDR's VXRhead self._update_offset_value(f, vdr_offset+28, 8, VXRoffset) # VDR's VXRtail self._update_offset_value(f, vdr_offset+36, 8, VX...
['def', '_update_vdr_vxrheadtail', '(', 'self', ',', 'f', ',', 'vdr_offset', ',', 'VXRoffset', ')', ':', "# VDR's VXRhead", 'self', '.', '_update_offset_value', '(', 'f', ',', 'vdr_offset', '+', '28', ',', '8', ',', 'VXRoffset', ')', "# VDR's VXRtail", 'self', '.', '_update_offset_value', '(', 'f', ',', 'vdr_offset', '...
This sets a VXR to be the first and last VXR in the VDR
['This', 'sets', 'a', 'VXR', 'to', 'be', 'the', 'first', 'and', 'last', 'VXR', 'in', 'the', 'VDR']
train
https://github.com/MAVENSDC/cdflib/blob/d237c60e5db67db0f92d96054209c25c4042465c/cdflib/cdfwrite.py#L1286-L1293
4,678
MisterWil/abodepy
abodepy/devices/sensor.py
AbodeSensor._get_numeric_status
def _get_numeric_status(self, key): """Extract the numeric value from the statuses object.""" value = self._get_status(key) if value and any(i.isdigit() for i in value): return float(re.sub("[^0-9.]", "", value)) return None
python
def _get_numeric_status(self, key): """Extract the numeric value from the statuses object.""" value = self._get_status(key) if value and any(i.isdigit() for i in value): return float(re.sub("[^0-9.]", "", value)) return None
['def', '_get_numeric_status', '(', 'self', ',', 'key', ')', ':', 'value', '=', 'self', '.', '_get_status', '(', 'key', ')', 'if', 'value', 'and', 'any', '(', 'i', '.', 'isdigit', '(', ')', 'for', 'i', 'in', 'value', ')', ':', 'return', 'float', '(', 're', '.', 'sub', '(', '"[^0-9.]"', ',', '""', ',', 'value', ')', ')'...
Extract the numeric value from the statuses object.
['Extract', 'the', 'numeric', 'value', 'from', 'the', 'statuses', 'object', '.']
train
https://github.com/MisterWil/abodepy/blob/6f84bb428fd1da98855f55083cd427bebbcc57ae/abodepy/devices/sensor.py#L14-L20
4,679
HumanCellAtlas/dcp-cli
hca/dss/__init__.py
DSSClient.download_manifest_v2
def download_manifest_v2(self, manifest, replica, num_retries=10, min_delay_seconds=0.25, download_dir='.'): """ Process the given manifest file in TSV (tab-separated values) format and download the files referenced b...
python
def download_manifest_v2(self, manifest, replica, num_retries=10, min_delay_seconds=0.25, download_dir='.'): """ Process the given manifest file in TSV (tab-separated values) format and download the files referenced b...
['def', 'download_manifest_v2', '(', 'self', ',', 'manifest', ',', 'replica', ',', 'num_retries', '=', '10', ',', 'min_delay_seconds', '=', '0.25', ',', 'download_dir', '=', "'.'", ')', ':', 'fieldnames', ',', 'rows', '=', 'self', '.', '_parse_manifest', '(', 'manifest', ')', 'errors', '=', '0', 'with', 'concurrent', '...
Process the given manifest file in TSV (tab-separated values) format and download the files referenced by it. The files are downloaded in the version 2 format. This download format will serve as the main storage format for downloaded files. If a user specifies a different format for download (c...
['Process', 'the', 'given', 'manifest', 'file', 'in', 'TSV', '(', 'tab', '-', 'separated', 'values', ')', 'format', 'and', 'download', 'the', 'files', 'referenced', 'by', 'it', '.', 'The', 'files', 'are', 'downloaded', 'in', 'the', 'version', '2', 'format', '.']
train
https://github.com/HumanCellAtlas/dcp-cli/blob/cc70817bc4e50944c709eaae160de0bf7a19f0f3/hca/dss/__init__.py#L352-L405
4,680
cackharot/suds-py3
suds/servicedefinition.py
ServiceDefinition.nextprefix
def nextprefix(self): """ Get the next available prefix. This means a prefix starting with 'ns' with a number appended as (ns0, ns1, ..) that is not already defined on the wsdl document. """ used = [ns[0] for ns in self.prefixes] used += [ns[0] for ns in self.wsd...
python
def nextprefix(self): """ Get the next available prefix. This means a prefix starting with 'ns' with a number appended as (ns0, ns1, ..) that is not already defined on the wsdl document. """ used = [ns[0] for ns in self.prefixes] used += [ns[0] for ns in self.wsd...
['def', 'nextprefix', '(', 'self', ')', ':', 'used', '=', '[', 'ns', '[', '0', ']', 'for', 'ns', 'in', 'self', '.', 'prefixes', ']', 'used', '+=', '[', 'ns', '[', '0', ']', 'for', 'ns', 'in', 'self', '.', 'wsdl', '.', 'root', '.', 'nsprefixes', '.', 'items', '(', ')', ']', 'for', 'n', 'in', 'range', '(', '0', ',', '102...
Get the next available prefix. This means a prefix starting with 'ns' with a number appended as (ns0, ns1, ..) that is not already defined on the wsdl document.
['Get', 'the', 'next', 'available', 'prefix', '.', 'This', 'means', 'a', 'prefix', 'starting', 'with', 'ns', 'with', 'a', 'number', 'appended', 'as', '(', 'ns0', 'ns1', '..', ')', 'that', 'is', 'not', 'already', 'defined', 'on', 'the', 'wsdl', 'document', '.']
train
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/servicedefinition.py#L158-L170
4,681
rongcloud/server-sdk-python
rongcloud/message.py
Message.deleteMessage
def deleteMessage(self, date): """ 消息历史记录删除方法(删除 APP 内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5-10分钟内被永久删除。) 方法 @param date:指定北京时间某天某小时,格式为2014010101,表示:2014年1月1日凌晨1点。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { ...
python
def deleteMessage(self, date): """ 消息历史记录删除方法(删除 APP 内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5-10分钟内被永久删除。) 方法 @param date:指定北京时间某天某小时,格式为2014010101,表示:2014年1月1日凌晨1点。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { ...
['def', 'deleteMessage', '(', 'self', ',', 'date', ')', ':', 'desc', '=', '{', '"name"', ':', '"CodeSuccessReslut"', ',', '"desc"', ':', '" http 成功返回结果",', '', '"fields"', ':', '[', '{', '"name"', ':', '"code"', ',', '"type"', ':', '"Integer"', ',', '"desc"', ':', '"返回码,200 为正常。"', '}', ',', '{', '"name"', ':', '"error...
消息历史记录删除方法(删除 APP 内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5-10分钟内被永久删除。) 方法 @param date:指定北京时间某天某小时,格式为2014010101,表示:2014年1月1日凌晨1点。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
['消息历史记录删除方法(删除', 'APP', '内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5', '-', '10分钟内被永久删除。)', '方法']
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/message.py#L402-L428
4,682
Cito/DBUtils
DBUtils/PersistentPg.py
PersistentPg.steady_connection
def steady_connection(self): """Get a steady, non-persistent PyGreSQL connection.""" return SteadyPgConnection( self._maxusage, self._setsession, self._closeable, *self._args, **self._kwargs)
python
def steady_connection(self): """Get a steady, non-persistent PyGreSQL connection.""" return SteadyPgConnection( self._maxusage, self._setsession, self._closeable, *self._args, **self._kwargs)
['def', 'steady_connection', '(', 'self', ')', ':', 'return', 'SteadyPgConnection', '(', 'self', '.', '_maxusage', ',', 'self', '.', '_setsession', ',', 'self', '.', '_closeable', ',', '*', 'self', '.', '_args', ',', '*', '*', 'self', '.', '_kwargs', ')']
Get a steady, non-persistent PyGreSQL connection.
['Get', 'a', 'steady', 'non', '-', 'persistent', 'PyGreSQL', 'connection', '.']
train
https://github.com/Cito/DBUtils/blob/90e8825e038f08c82044b8e50831480175fa026a/DBUtils/PersistentPg.py#L160-L164
4,683
SBRG/ssbio
ssbio/utils.py
flatlist_dropdup
def flatlist_dropdup(list_of_lists): """Make a single list out of a list of lists, and drop all duplicates. Args: list_of_lists: List of lists. Returns: list: List of single objects. """ return list(set([str(item) for sublist in list_of_lists for item in sublist]))
python
def flatlist_dropdup(list_of_lists): """Make a single list out of a list of lists, and drop all duplicates. Args: list_of_lists: List of lists. Returns: list: List of single objects. """ return list(set([str(item) for sublist in list_of_lists for item in sublist]))
['def', 'flatlist_dropdup', '(', 'list_of_lists', ')', ':', 'return', 'list', '(', 'set', '(', '[', 'str', '(', 'item', ')', 'for', 'sublist', 'in', 'list_of_lists', 'for', 'item', 'in', 'sublist', ']', ')', ')']
Make a single list out of a list of lists, and drop all duplicates. Args: list_of_lists: List of lists. Returns: list: List of single objects.
['Make', 'a', 'single', 'list', 'out', 'of', 'a', 'list', 'of', 'lists', 'and', 'drop', 'all', 'duplicates', '.']
train
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L788-L798
4,684
davidemoro/play_mqtt
play_mqtt/providers.py
MQTTProvider.command_publish
def command_publish(self, command, **kwargs): """ Publish a MQTT message """ mqttc = mqtt.Client() mqttc.connect( command['host'], port=int(command['port'])) mqttc.loop_start() try: mqttc.publish( command['endpoint'], ...
python
def command_publish(self, command, **kwargs): """ Publish a MQTT message """ mqttc = mqtt.Client() mqttc.connect( command['host'], port=int(command['port'])) mqttc.loop_start() try: mqttc.publish( command['endpoint'], ...
['def', 'command_publish', '(', 'self', ',', 'command', ',', '*', '*', 'kwargs', ')', ':', 'mqttc', '=', 'mqtt', '.', 'Client', '(', ')', 'mqttc', '.', 'connect', '(', 'command', '[', "'host'", ']', ',', 'port', '=', 'int', '(', 'command', '[', "'port'", ']', ')', ')', 'mqttc', '.', 'loop_start', '(', ')', 'try', ':', ...
Publish a MQTT message
['Publish', 'a', 'MQTT', 'message']
train
https://github.com/davidemoro/play_mqtt/blob/4994074c20ab8a5abd221f8b8088e5fc44ba2a5e/play_mqtt/providers.py#L8-L22
4,685
indico/indico-plugins
livesync/indico_livesync/cli.py
available_backends
def available_backends(): """Lists the currently available backend types""" print 'The following LiveSync agents are available:' for name, backend in current_plugin.backend_classes.iteritems(): print cformat(' - %{white!}{}%{reset}: {} ({})').format(name, backend.title, backend.description)
python
def available_backends(): """Lists the currently available backend types""" print 'The following LiveSync agents are available:' for name, backend in current_plugin.backend_classes.iteritems(): print cformat(' - %{white!}{}%{reset}: {} ({})').format(name, backend.title, backend.description)
['def', 'available_backends', '(', ')', ':', 'print', "'The following LiveSync agents are available:'", 'for', 'name', ',', 'backend', 'in', 'current_plugin', '.', 'backend_classes', '.', 'iteritems', '(', ')', ':', 'print', 'cformat', '(', "' - %{white!}{}%{reset}: {} ({})'", ')', '.', 'format', '(', 'name', ',', 'ba...
Lists the currently available backend types
['Lists', 'the', 'currently', 'available', 'backend', 'types']
train
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/cli.py#L37-L41
4,686
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/util.py
get_queue_name
def get_queue_name(queue_name): """Determine which queue MR should run on. How to choose the queue: 1. If user provided one, use that. 2. If we are starting a mr from taskqueue, inherit that queue. If it's a special queue, fall back to the default queue. 3. Default queue. If user is using any MR pipe...
python
def get_queue_name(queue_name): """Determine which queue MR should run on. How to choose the queue: 1. If user provided one, use that. 2. If we are starting a mr from taskqueue, inherit that queue. If it's a special queue, fall back to the default queue. 3. Default queue. If user is using any MR pipe...
['def', 'get_queue_name', '(', 'queue_name', ')', ':', 'if', 'queue_name', ':', 'return', 'queue_name', 'queue_name', '=', 'os', '.', 'environ', '.', 'get', '(', '"HTTP_X_APPENGINE_QUEUENAME"', ',', 'parameters', '.', 'config', '.', 'QUEUE_NAME', ')', 'if', 'len', '(', 'queue_name', ')', '>', '1', 'and', 'queue_name', ...
Determine which queue MR should run on. How to choose the queue: 1. If user provided one, use that. 2. If we are starting a mr from taskqueue, inherit that queue. If it's a special queue, fall back to the default queue. 3. Default queue. If user is using any MR pipeline interface, pipeline.start takes ...
['Determine', 'which', 'queue', 'MR', 'should', 'run', 'on', '.']
train
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/util.py#L127-L154
4,687
QuantEcon/QuantEcon.py
quantecon/lqnash.py
nnash
def nnash(A, B1, B2, R1, R2, Q1, Q2, S1, S2, W1, W2, M1, M2, beta=1.0, tol=1e-8, max_iter=1000, random_state=None): r""" Compute the limit of a Nash linear quadratic dynamic game. In this problem, player i minimizes .. math:: \sum_{t=0}^{\infty} \left\{ x_t' r_i x_...
python
def nnash(A, B1, B2, R1, R2, Q1, Q2, S1, S2, W1, W2, M1, M2, beta=1.0, tol=1e-8, max_iter=1000, random_state=None): r""" Compute the limit of a Nash linear quadratic dynamic game. In this problem, player i minimizes .. math:: \sum_{t=0}^{\infty} \left\{ x_t' r_i x_...
['def', 'nnash', '(', 'A', ',', 'B1', ',', 'B2', ',', 'R1', ',', 'R2', ',', 'Q1', ',', 'Q2', ',', 'S1', ',', 'S2', ',', 'W1', ',', 'W2', ',', 'M1', ',', 'M2', ',', 'beta', '=', '1.0', ',', 'tol', '=', '1e-8', ',', 'max_iter', '=', '1000', ',', 'random_state', '=', 'None', ')', ':', '# == Unload parameters and make sure...
r""" Compute the limit of a Nash linear quadratic dynamic game. In this problem, player i minimizes .. math:: \sum_{t=0}^{\infty} \left\{ x_t' r_i x_t + 2 x_t' w_i u_{it} +u_{it}' q_i u_{it} + u_{jt}' s_i u_{jt} + 2 u_{jt}' m_i u_{it} \right\} ...
['r', 'Compute', 'the', 'limit', 'of', 'a', 'Nash', 'linear', 'quadratic', 'dynamic', 'game', '.', 'In', 'this', 'problem', 'player', 'i', 'minimizes']
train
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/lqnash.py#L7-L154
4,688
ryanjdillon/pyotelem
pyotelem/physio_seal.py
dens2lip
def dens2lip(dens_gcm3, dens_lipid=0.9007, dens_prot=1.34, dens_water=0.994, dens_ash=2.3): '''Get percent composition of animal from body density The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in t...
python
def dens2lip(dens_gcm3, dens_lipid=0.9007, dens_prot=1.34, dens_water=0.994, dens_ash=2.3): '''Get percent composition of animal from body density The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in t...
['def', 'dens2lip', '(', 'dens_gcm3', ',', 'dens_lipid', '=', '0.9007', ',', 'dens_prot', '=', '1.34', ',', 'dens_water', '=', '0.994', ',', 'dens_ash', '=', '2.3', ')', ':', 'import', 'numpy', '# Cast iterables to numpy array', 'if', 'numpy', '.', 'iterable', '(', 'dens_gcm3', ')', ':', 'dens_gcm3', '=', 'numpy', '.',...
Get percent composition of animal from body density The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in the book by Moore et al. (1963). Args ---- dens_gcm3: float or ndarray An array of seal...
['Get', 'percent', 'composition', 'of', 'animal', 'from', 'body', 'density']
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/physio_seal.py#L257-L315
4,689
holmes-app/holmes-alf
holmesalf/wrapper.py
AlfAuthNZWrapper.sync_client
def sync_client(self): """Synchronous OAuth 2.0 Bearer client""" if not self._sync_client: self._sync_client = AlfSyncClient( token_endpoint=self.config.get('OAUTH_TOKEN_ENDPOINT'), client_id=self.config.get('OAUTH_CLIENT_ID'), client_secret=se...
python
def sync_client(self): """Synchronous OAuth 2.0 Bearer client""" if not self._sync_client: self._sync_client = AlfSyncClient( token_endpoint=self.config.get('OAUTH_TOKEN_ENDPOINT'), client_id=self.config.get('OAUTH_CLIENT_ID'), client_secret=se...
['def', 'sync_client', '(', 'self', ')', ':', 'if', 'not', 'self', '.', '_sync_client', ':', 'self', '.', '_sync_client', '=', 'AlfSyncClient', '(', 'token_endpoint', '=', 'self', '.', 'config', '.', 'get', '(', "'OAUTH_TOKEN_ENDPOINT'", ')', ',', 'client_id', '=', 'self', '.', 'config', '.', 'get', '(', "'OAUTH_CLIENT...
Synchronous OAuth 2.0 Bearer client
['Synchronous', 'OAuth', '2', '.', '0', 'Bearer', 'client']
train
https://github.com/holmes-app/holmes-alf/blob/4bf891831390ecfae818cf37d8ffc3a76fe9f1ec/holmesalf/wrapper.py#L26-L34
4,690
pudo/normality
normality/encoding.py
normalize_encoding
def normalize_encoding(encoding, default=DEFAULT_ENCODING): """Normalize the encoding name, replace ASCII w/ UTF-8.""" if encoding is None: return default encoding = encoding.lower().strip() if encoding in ['', 'ascii']: return default try: codecs.lookup(encoding) ret...
python
def normalize_encoding(encoding, default=DEFAULT_ENCODING): """Normalize the encoding name, replace ASCII w/ UTF-8.""" if encoding is None: return default encoding = encoding.lower().strip() if encoding in ['', 'ascii']: return default try: codecs.lookup(encoding) ret...
['def', 'normalize_encoding', '(', 'encoding', ',', 'default', '=', 'DEFAULT_ENCODING', ')', ':', 'if', 'encoding', 'is', 'None', ':', 'return', 'default', 'encoding', '=', 'encoding', '.', 'lower', '(', ')', '.', 'strip', '(', ')', 'if', 'encoding', 'in', '[', "''", ',', "'ascii'", ']', ':', 'return', 'default', 'try'...
Normalize the encoding name, replace ASCII w/ UTF-8.
['Normalize', 'the', 'encoding', 'name', 'replace', 'ASCII', 'w', '/', 'UTF', '-', '8', '.']
train
https://github.com/pudo/normality/blob/b53cc2c6e5c6205573d2010f72d90808710a4b58/normality/encoding.py#L8-L19
4,691
avihad/twistes
twistes/utilities.py
EsUtils.is_get_query_with_results
def is_get_query_with_results(results): """ :param results: the response from Elasticsearch :return: true if the get query returned a result, false otherwise """ return results and EsConst.FOUND in results and results[EsConst.FOUND] and EsConst.FIELDS in results
python
def is_get_query_with_results(results): """ :param results: the response from Elasticsearch :return: true if the get query returned a result, false otherwise """ return results and EsConst.FOUND in results and results[EsConst.FOUND] and EsConst.FIELDS in results
['def', 'is_get_query_with_results', '(', 'results', ')', ':', 'return', 'results', 'and', 'EsConst', '.', 'FOUND', 'in', 'results', 'and', 'results', '[', 'EsConst', '.', 'FOUND', ']', 'and', 'EsConst', '.', 'FIELDS', 'in', 'results']
:param results: the response from Elasticsearch :return: true if the get query returned a result, false otherwise
[':', 'param', 'results', ':', 'the', 'response', 'from', 'Elasticsearch', ':', 'return', ':', 'true', 'if', 'the', 'get', 'query', 'returned', 'a', 'result', 'false', 'otherwise']
train
https://github.com/avihad/twistes/blob/9ab8f5aa088b8886aefe3dec85a400e5035e034a/twistes/utilities.py#L39-L44
4,692
prompt-toolkit/pymux
pymux/commands/commands.py
unbind_key
def unbind_key(pymux, variables): """ Remove key binding. """ key = variables['<key>'] needs_prefix = not variables['-n'] pymux.key_bindings_manager.remove_custom_binding( key, needs_prefix=needs_prefix)
python
def unbind_key(pymux, variables): """ Remove key binding. """ key = variables['<key>'] needs_prefix = not variables['-n'] pymux.key_bindings_manager.remove_custom_binding( key, needs_prefix=needs_prefix)
['def', 'unbind_key', '(', 'pymux', ',', 'variables', ')', ':', 'key', '=', 'variables', '[', "'<key>'", ']', 'needs_prefix', '=', 'not', 'variables', '[', "'-n'", ']', 'pymux', '.', 'key_bindings_manager', '.', 'remove_custom_binding', '(', 'key', ',', 'needs_prefix', '=', 'needs_prefix', ')']
Remove key binding.
['Remove', 'key', 'binding', '.']
train
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/commands/commands.py#L496-L504
4,693
splunk/splunk-sdk-python
splunklib/searchcommands/external_search_command.py
execute
def execute(path, argv=None, environ=None, command_class=ExternalSearchCommand): """ :param path: :type path: basestring :param argv: :type: argv: list, tuple, or None :param environ: :type environ: dict :param command_class: External search command class to instantiate and execute. ...
python
def execute(path, argv=None, environ=None, command_class=ExternalSearchCommand): """ :param path: :type path: basestring :param argv: :type: argv: list, tuple, or None :param environ: :type environ: dict :param command_class: External search command class to instantiate and execute. ...
['def', 'execute', '(', 'path', ',', 'argv', '=', 'None', ',', 'environ', '=', 'None', ',', 'command_class', '=', 'ExternalSearchCommand', ')', ':', 'assert', 'issubclass', '(', 'command_class', ',', 'ExternalSearchCommand', ')', 'command_class', '(', 'path', ',', 'argv', ',', 'environ', ')', '.', 'execute', '(', ')']
:param path: :type path: basestring :param argv: :type: argv: list, tuple, or None :param environ: :type environ: dict :param command_class: External search command class to instantiate and execute. :type command_class: type :return: :rtype: None
[':', 'param', 'path', ':', ':', 'type', 'path', ':', 'basestring', ':', 'param', 'argv', ':', ':', 'type', ':', 'argv', ':', 'list', 'tuple', 'or', 'None', ':', 'param', 'environ', ':', ':', 'type', 'environ', ':', 'dict', ':', 'param', 'command_class', ':', 'External', 'search', 'command', 'class', 'to', 'instantiate...
train
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/searchcommands/external_search_command.py#L214-L228
4,694
tensorflow/tensor2tensor
tensor2tensor/data_generators/multinli.py
_maybe_download_corpora
def _maybe_download_corpora(tmp_dir): """Download corpora for multinli. Args: tmp_dir: a string Returns: a string """ mnli_filename = "MNLI.zip" mnli_finalpath = os.path.join(tmp_dir, "MNLI") if not tf.gfile.Exists(mnli_finalpath): zip_filepath = generator_utils.maybe_download( tmp_di...
python
def _maybe_download_corpora(tmp_dir): """Download corpora for multinli. Args: tmp_dir: a string Returns: a string """ mnli_filename = "MNLI.zip" mnli_finalpath = os.path.join(tmp_dir, "MNLI") if not tf.gfile.Exists(mnli_finalpath): zip_filepath = generator_utils.maybe_download( tmp_di...
['def', '_maybe_download_corpora', '(', 'tmp_dir', ')', ':', 'mnli_filename', '=', '"MNLI.zip"', 'mnli_finalpath', '=', 'os', '.', 'path', '.', 'join', '(', 'tmp_dir', ',', '"MNLI"', ')', 'if', 'not', 'tf', '.', 'gfile', '.', 'Exists', '(', 'mnli_finalpath', ')', ':', 'zip_filepath', '=', 'generator_utils', '.', 'maybe...
Download corpora for multinli. Args: tmp_dir: a string Returns: a string
['Download', 'corpora', 'for', 'multinli', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multinli.py#L42-L59
4,695
f3at/feat
tools/pep8.py
expand_indent
def expand_indent(line): """ Return the amount of indentation. Tabs are expanded to the next multiple of 8. >>> expand_indent(' ') 4 >>> expand_indent('\\t') 8 >>> expand_indent(' \\t') 8 >>> expand_indent(' \\t') 8 >>> expand_indent(' \\t') 16 ...
python
def expand_indent(line): """ Return the amount of indentation. Tabs are expanded to the next multiple of 8. >>> expand_indent(' ') 4 >>> expand_indent('\\t') 8 >>> expand_indent(' \\t') 8 >>> expand_indent(' \\t') 8 >>> expand_indent(' \\t') 16 ...
['def', 'expand_indent', '(', 'line', ')', ':', 'result', '=', '0', 'for', 'char', 'in', 'line', ':', 'if', 'char', '==', "'\\t'", ':', 'result', '=', 'result', '/', '8', '*', '8', '+', '8', 'elif', 'char', '==', "' '", ':', 'result', '+=', '1', 'else', ':', 'break', 'return', 'result']
Return the amount of indentation. Tabs are expanded to the next multiple of 8. >>> expand_indent(' ') 4 >>> expand_indent('\\t') 8 >>> expand_indent(' \\t') 8 >>> expand_indent(' \\t') 8 >>> expand_indent(' \\t') 16
['Return', 'the', 'amount', 'of', 'indentation', '.', 'Tabs', 'are', 'expanded', 'to', 'the', 'next', 'multiple', 'of', '8', '.']
train
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/tools/pep8.py#L408-L432
4,696
MisterY/asset-allocation
asset_allocation/formatters.py
AsciiFormatter.__format_row
def __format_row(self, row: AssetAllocationViewModel): """ display-format one row Formats one Asset Class record """ output = "" index = 0 # Name value = row.name # Indent according to depth. for _ in range(0, row.depth): value = f" {value}"...
python
def __format_row(self, row: AssetAllocationViewModel): """ display-format one row Formats one Asset Class record """ output = "" index = 0 # Name value = row.name # Indent according to depth. for _ in range(0, row.depth): value = f" {value}"...
['def', '__format_row', '(', 'self', ',', 'row', ':', 'AssetAllocationViewModel', ')', ':', 'output', '=', '""', 'index', '=', '0', '# Name', 'value', '=', 'row', '.', 'name', '# Indent according to depth.', 'for', '_', 'in', 'range', '(', '0', ',', 'row', '.', 'depth', ')', ':', 'value', '=', 'f" {value}"', 'output'...
display-format one row Formats one Asset Class record
['display', '-', 'format', 'one', 'row', 'Formats', 'one', 'Asset', 'Class', 'record']
train
https://github.com/MisterY/asset-allocation/blob/72239aa20762cda67c091f27b86e65d61bf3b613/asset_allocation/formatters.py#L52-L122
4,697
tcalmant/ipopo
pelix/utilities.py
SynchronizedClassMethod
def SynchronizedClassMethod(*locks_attr_names, **kwargs): # pylint: disable=C1801 """ A synchronizer decorator for class methods. An AttributeError can be raised at runtime if the given lock attribute doesn't exist or if it is None. If a parameter ``sorted`` is found in ``kwargs`` and its value is ...
python
def SynchronizedClassMethod(*locks_attr_names, **kwargs): # pylint: disable=C1801 """ A synchronizer decorator for class methods. An AttributeError can be raised at runtime if the given lock attribute doesn't exist or if it is None. If a parameter ``sorted`` is found in ``kwargs`` and its value is ...
['def', 'SynchronizedClassMethod', '(', '*', 'locks_attr_names', ',', '*', '*', 'kwargs', ')', ':', '# pylint: disable=C1801', '# Filter the names (remove empty ones)', 'locks_attr_names', '=', '[', 'lock_name', 'for', 'lock_name', 'in', 'locks_attr_names', 'if', 'lock_name', ']', 'if', 'not', 'locks_attr_names', ':', ...
A synchronizer decorator for class methods. An AttributeError can be raised at runtime if the given lock attribute doesn't exist or if it is None. If a parameter ``sorted`` is found in ``kwargs`` and its value is True, then the list of locks names will be sorted before locking. :param locks_attr_names...
['A', 'synchronizer', 'decorator', 'for', 'class', 'methods', '.', 'An', 'AttributeError', 'can', 'be', 'raised', 'at', 'runtime', 'if', 'the', 'given', 'lock', 'attribute', 'doesn', 't', 'exist', 'or', 'if', 'it', 'is', 'None', '.']
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L250-L326
4,698
molmod/molmod
molmod/ic.py
dot
def dot(r1, r2): """Compute the dot product Arguments: | ``r1``, ``r2`` -- two :class:`Vector3` objects (Returns a Scalar) """ if r1.size != r2.size: raise ValueError("Both arguments must have the same input size.") if r1.deriv != r2.deriv: raise ValueError("Both...
python
def dot(r1, r2): """Compute the dot product Arguments: | ``r1``, ``r2`` -- two :class:`Vector3` objects (Returns a Scalar) """ if r1.size != r2.size: raise ValueError("Both arguments must have the same input size.") if r1.deriv != r2.deriv: raise ValueError("Both...
['def', 'dot', '(', 'r1', ',', 'r2', ')', ':', 'if', 'r1', '.', 'size', '!=', 'r2', '.', 'size', ':', 'raise', 'ValueError', '(', '"Both arguments must have the same input size."', ')', 'if', 'r1', '.', 'deriv', '!=', 'r2', '.', 'deriv', ':', 'raise', 'ValueError', '(', '"Both arguments must have the same deriv."', ')'...
Compute the dot product Arguments: | ``r1``, ``r2`` -- two :class:`Vector3` objects (Returns a Scalar)
['Compute', 'the', 'dot', 'product']
train
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/ic.py#L283-L295
4,699
mgagne/wafflehaus.iweb
wafflehaus/iweb/keystone/user_filter/blacklist.py
filter_factory
def filter_factory(global_conf, **local_conf): """Returns a WSGI filter app for use with paste.deploy.""" conf = global_conf.copy() conf.update(local_conf) def blacklist(app): return BlacklistFilter(app, conf) return blacklist
python
def filter_factory(global_conf, **local_conf): """Returns a WSGI filter app for use with paste.deploy.""" conf = global_conf.copy() conf.update(local_conf) def blacklist(app): return BlacklistFilter(app, conf) return blacklist
['def', 'filter_factory', '(', 'global_conf', ',', '*', '*', 'local_conf', ')', ':', 'conf', '=', 'global_conf', '.', 'copy', '(', ')', 'conf', '.', 'update', '(', 'local_conf', ')', 'def', 'blacklist', '(', 'app', ')', ':', 'return', 'BlacklistFilter', '(', 'app', ',', 'conf', ')', 'return', 'blacklist']
Returns a WSGI filter app for use with paste.deploy.
['Returns', 'a', 'WSGI', 'filter', 'app', 'for', 'use', 'with', 'paste', '.', 'deploy', '.']
train
https://github.com/mgagne/wafflehaus.iweb/blob/8ac625582c1180391fe022d1db19f70a2dfb376a/wafflehaus/iweb/keystone/user_filter/blacklist.py#L89-L96