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
6,000
nschloe/meshplex
meshplex/reader.py
read
def read(filename): """Reads an unstructured mesh with added data. :param filenames: The files to read from. :type filenames: str :returns mesh{2,3}d: The mesh data. :returns point_data: Point data read from file. :type point_data: dict :returns field_data: Field data read from file. :t...
python
def read(filename): """Reads an unstructured mesh with added data. :param filenames: The files to read from. :type filenames: str :returns mesh{2,3}d: The mesh data. :returns point_data: Point data read from file. :type point_data: dict :returns field_data: Field data read from file. :t...
['def', 'read', '(', 'filename', ')', ':', 'mesh', '=', 'meshio', '.', 'read', '(', 'filename', ')', '# make sure to include the used nodes only', 'if', '"tetra"', 'in', 'mesh', '.', 'cells', ':', 'points', ',', 'cells', '=', '_sanitize', '(', 'mesh', '.', 'points', ',', 'mesh', '.', 'cells', '[', '"tetra"', ']', ')', ...
Reads an unstructured mesh with added data. :param filenames: The files to read from. :type filenames: str :returns mesh{2,3}d: The mesh data. :returns point_data: Point data read from file. :type point_data: dict :returns field_data: Field data read from file. :type field_data: dict
['Reads', 'an', 'unstructured', 'mesh', 'with', 'added', 'data', '.']
train
https://github.com/nschloe/meshplex/blob/376cfe8ce7b9917e5398c5d60c87455ff5590913/meshplex/reader.py#L26-L57
6,001
arviz-devs/arviz
arviz/plots/violinplot.py
cat_hist
def cat_hist(val, shade, ax, **kwargs_shade): """Auxiliary function to plot discrete-violinplots.""" bins = get_bins(val) binned_d, _ = np.histogram(val, bins=bins, normed=True) bin_edges = np.linspace(np.min(val), np.max(val), len(bins)) centers = 0.5 * (bin_edges + np.roll(bin_edges, 1))[:-1] ...
python
def cat_hist(val, shade, ax, **kwargs_shade): """Auxiliary function to plot discrete-violinplots.""" bins = get_bins(val) binned_d, _ = np.histogram(val, bins=bins, normed=True) bin_edges = np.linspace(np.min(val), np.max(val), len(bins)) centers = 0.5 * (bin_edges + np.roll(bin_edges, 1))[:-1] ...
['def', 'cat_hist', '(', 'val', ',', 'shade', ',', 'ax', ',', '*', '*', 'kwargs_shade', ')', ':', 'bins', '=', 'get_bins', '(', 'val', ')', 'binned_d', ',', '_', '=', 'np', '.', 'histogram', '(', 'val', ',', 'bins', '=', 'bins', ',', 'normed', '=', 'True', ')', 'bin_edges', '=', 'np', '.', 'linspace', '(', 'np', '.', '...
Auxiliary function to plot discrete-violinplots.
['Auxiliary', 'function', 'to', 'plot', 'discrete', '-', 'violinplots', '.']
train
https://github.com/arviz-devs/arviz/blob/d04d8da07f029fd2931f48d2f7f324cf393e5277/arviz/plots/violinplot.py#L127-L137
6,002
MIT-LCP/wfdb-python
wfdb/io/record.py
check_np_array
def check_np_array(item, field_name, ndim, parent_class, channel_num=None): """ Check a numpy array's shape and dtype against required specifications. Parameters ---------- item : numpy array The numpy array to check field_name : str The name of the field to check ndim :...
python
def check_np_array(item, field_name, ndim, parent_class, channel_num=None): """ Check a numpy array's shape and dtype against required specifications. Parameters ---------- item : numpy array The numpy array to check field_name : str The name of the field to check ndim :...
['def', 'check_np_array', '(', 'item', ',', 'field_name', ',', 'ndim', ',', 'parent_class', ',', 'channel_num', '=', 'None', ')', ':', '# Check shape', 'if', 'item', '.', 'ndim', '!=', 'ndim', ':', 'error_msg', '=', "'Field `%s` must have ndim == %d'", '%', '(', 'field_name', ',', 'ndim', ')', 'if', 'channel_num', 'is'...
Check a numpy array's shape and dtype against required specifications. Parameters ---------- item : numpy array The numpy array to check field_name : str The name of the field to check ndim : int The required number of dimensions parent_class : type The paren...
['Check', 'a', 'numpy', 'array', 's', 'shape', 'and', 'dtype', 'against', 'required', 'specifications', '.']
train
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L912-L944
6,003
jhuapl-boss/intern
intern/service/boss/v1/project.py
ProjectService_1.delete
def delete(self, resource, url_prefix, auth, session, send_opts): """Deletes the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) url_prefix (string): Protocol + host such as https://api.theboss.io auth (string): Token to sen...
python
def delete(self, resource, url_prefix, auth, session, send_opts): """Deletes the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) url_prefix (string): Protocol + host such as https://api.theboss.io auth (string): Token to sen...
['def', 'delete', '(', 'self', ',', 'resource', ',', 'url_prefix', ',', 'auth', ',', 'session', ',', 'send_opts', ')', ':', 'req', '=', 'self', '.', 'get_request', '(', 'resource', ',', "'DELETE'", ',', "'application/json'", ',', 'url_prefix', ',', 'auth', ')', 'prep', '=', 'session', '.', 'prepare_request', '(', 'req'...
Deletes the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) url_prefix (string): Protocol + host such as https://api.theboss.io auth (string): Token to send in the request header. session (requests.Session): HTTP session...
['Deletes', 'the', 'entity', 'described', 'by', 'the', 'given', 'resource', '.']
train
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/project.py#L834-L856
6,004
moonso/loqusdb
loqusdb/commands/update.py
update
def update(ctx, variant_file, sv_variants, family_file, family_type, skip_case_id, gq_treshold, case_id, ensure_index, max_window): """Load the variants of a case A variant is loaded if it is observed in any individual of a case If no family file is provided all individuals in vcf file will be ...
python
def update(ctx, variant_file, sv_variants, family_file, family_type, skip_case_id, gq_treshold, case_id, ensure_index, max_window): """Load the variants of a case A variant is loaded if it is observed in any individual of a case If no family file is provided all individuals in vcf file will be ...
['def', 'update', '(', 'ctx', ',', 'variant_file', ',', 'sv_variants', ',', 'family_file', ',', 'family_type', ',', 'skip_case_id', ',', 'gq_treshold', ',', 'case_id', ',', 'ensure_index', ',', 'max_window', ')', ':', 'if', 'not', '(', 'family_file', 'or', 'case_id', ')', ':', 'LOG', '.', 'warning', '(', '"Please provi...
Load the variants of a case A variant is loaded if it is observed in any individual of a case If no family file is provided all individuals in vcf file will be considered.
['Load', 'the', 'variants', 'of', 'a', 'case']
train
https://github.com/moonso/loqusdb/blob/792dcd0d461aff5adc703c49eebf58964913a513/loqusdb/commands/update.py#L62-L114
6,005
PaulHancock/Aegean
AegeanTools/regions.py
Region.without
def without(self, other): """ Subtract another Region by performing a difference operation on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. ...
python
def without(self, other): """ Subtract another Region by performing a difference operation on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. ...
['def', 'without', '(', 'self', ',', 'other', ')', ':', '# work only on the lowest level', '# TODO: Allow this to be done for regions with different depths.', 'if', 'not', '(', 'self', '.', 'maxdepth', '==', 'other', '.', 'maxdepth', ')', ':', 'raise', 'AssertionError', '(', '"Regions must have the same maxdepth"', ')'...
Subtract another Region by performing a difference operation on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined.
['Subtract', 'another', 'Region', 'by', 'performing', 'a', 'difference', 'operation', 'on', 'their', 'pixlists', '.']
train
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L287-L305
6,006
etingof/pyasn1
pyasn1/type/univ.py
SequenceAndSetBase.setComponentByPosition
def setComponentByPosition(self, idx, value=noValue, verifyConstraints=True, matchTags=True, matchConstraints=True): """Assign |ASN.1| type component by position. Equivalent to Python sequence item assignment o...
python
def setComponentByPosition(self, idx, value=noValue, verifyConstraints=True, matchTags=True, matchConstraints=True): """Assign |ASN.1| type component by position. Equivalent to Python sequence item assignment o...
['def', 'setComponentByPosition', '(', 'self', ',', 'idx', ',', 'value', '=', 'noValue', ',', 'verifyConstraints', '=', 'True', ',', 'matchTags', '=', 'True', ',', 'matchConstraints', '=', 'True', ')', ':', 'componentType', '=', 'self', '.', 'componentType', 'componentTypeLen', '=', 'self', '.', '_componentTypeLen', 't...
Assign |ASN.1| type component by position. Equivalent to Python sequence item assignment operation (e.g. `[]`). Parameters ---------- idx : :class:`int` Component index (zero-based). Must either refer to existing component (if *componentType* is set) or to N+1 c...
['Assign', '|ASN', '.', '1|', 'type', 'component', 'by', 'position', '.']
train
https://github.com/etingof/pyasn1/blob/25cf116ef8d11bb0e08454c0f3635c9f4002c2d6/pyasn1/type/univ.py#L2299-L2401
6,007
bodylabs/lace
lace/geometry.py
MeshMixin.reorient
def reorient(self, up, look): ''' Reorient the mesh by specifying two vectors. up: The foot-to-head direction. look: The direction the body is facing. In the result, the up will end up along +y, and look along +z (i.e. facing towards a default OpenGL camera). '...
python
def reorient(self, up, look): ''' Reorient the mesh by specifying two vectors. up: The foot-to-head direction. look: The direction the body is facing. In the result, the up will end up along +y, and look along +z (i.e. facing towards a default OpenGL camera). '...
['def', 'reorient', '(', 'self', ',', 'up', ',', 'look', ')', ':', 'from', 'blmath', '.', 'geometry', '.', 'transform', 'import', 'rotation_from_up_and_look', 'from', 'blmath', '.', 'numerics', 'import', 'as_numeric_array', 'up', '=', 'as_numeric_array', '(', 'up', ',', '(', '3', ',', ')', ')', 'look', '=', 'as_numeric...
Reorient the mesh by specifying two vectors. up: The foot-to-head direction. look: The direction the body is facing. In the result, the up will end up along +y, and look along +z (i.e. facing towards a default OpenGL camera).
['Reorient', 'the', 'mesh', 'by', 'specifying', 'two', 'vectors', '.']
train
https://github.com/bodylabs/lace/blob/b68f4a60a4cac66c0607ffbae38ef9d07d37f459/lace/geometry.py#L80-L98
6,008
hydpy-dev/hydpy
hydpy/models/dam/dam_model.py
calc_requiredremotesupply_v1
def calc_requiredremotesupply_v1(self): """Calculate the required maximum supply from another location that can be discharged into the dam. Required control parameters: |HighestRemoteSupply| |WaterLevelSupplyThreshold| Required derived parameter: |WaterLevelSupplySmoothPar| Requ...
python
def calc_requiredremotesupply_v1(self): """Calculate the required maximum supply from another location that can be discharged into the dam. Required control parameters: |HighestRemoteSupply| |WaterLevelSupplyThreshold| Required derived parameter: |WaterLevelSupplySmoothPar| Requ...
['def', 'calc_requiredremotesupply_v1', '(', 'self', ')', ':', 'con', '=', 'self', '.', 'parameters', '.', 'control', '.', 'fastaccess', 'der', '=', 'self', '.', 'parameters', '.', 'derived', '.', 'fastaccess', 'flu', '=', 'self', '.', 'sequences', '.', 'fluxes', '.', 'fastaccess', 'aid', '=', 'self', '.', 'sequences',...
Calculate the required maximum supply from another location that can be discharged into the dam. Required control parameters: |HighestRemoteSupply| |WaterLevelSupplyThreshold| Required derived parameter: |WaterLevelSupplySmoothPar| Required aide sequence: |WaterLevel| Cal...
['Calculate', 'the', 'required', 'maximum', 'supply', 'from', 'another', 'location', 'that', 'can', 'be', 'discharged', 'into', 'the', 'dam', '.']
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/dam/dam_model.py#L296-L379
6,009
tkf/python-epc
epc/handler.py
EPCHandler.call
def call(self, name, *args, **kwds): """ Call method connected to this handler. :type name: str :arg name: Method name to call. :type args: list :arg args: Arguments for remote method to call. :type callback: callable :arg callback: A f...
python
def call(self, name, *args, **kwds): """ Call method connected to this handler. :type name: str :arg name: Method name to call. :type args: list :arg args: Arguments for remote method to call. :type callback: callable :arg callback: A f...
['def', 'call', '(', 'self', ',', 'name', ',', '*', 'args', ',', '*', '*', 'kwds', ')', ':', 'self', '.', 'callmanager', '.', 'call', '(', 'self', ',', 'name', ',', '*', 'args', ',', '*', '*', 'kwds', ')']
Call method connected to this handler. :type name: str :arg name: Method name to call. :type args: list :arg args: Arguments for remote method to call. :type callback: callable :arg callback: A function to be called with returned value of ...
['Call', 'method', 'connected', 'to', 'this', 'handler', '.']
train
https://github.com/tkf/python-epc/blob/f3673ae5c35f20a0f71546ab34c28e3dde3595c1/epc/handler.py#L362-L379
6,010
merll/docker-map
dockermap/map/state/base.py
AbstractDependencyStateGenerator.get_states
def get_states(self, config_ids): """ Generates state information for the selected container and its dependencies / dependents. :param config_ids: MapConfigId tuples. :type config_ids: list[dockermap.map.input.MapConfigId] :return: Iterable of configuration states. :rtyp...
python
def get_states(self, config_ids): """ Generates state information for the selected container and its dependencies / dependents. :param config_ids: MapConfigId tuples. :type config_ids: list[dockermap.map.input.MapConfigId] :return: Iterable of configuration states. :rtyp...
['def', 'get_states', '(', 'self', ',', 'config_ids', ')', ':', 'input_paths', '=', '[', '(', 'config_id', ',', 'list', '(', 'self', '.', 'get_dependency_path', '(', 'config_id', ')', ')', ')', 'for', 'config_id', 'in', 'config_ids', ']', 'log', '.', 'debug', '(', '"Dependency paths from input: %s"', ',', 'input_paths'...
Generates state information for the selected container and its dependencies / dependents. :param config_ids: MapConfigId tuples. :type config_ids: list[dockermap.map.input.MapConfigId] :return: Iterable of configuration states. :rtype: collections.Iterable[dockermap.map.state.ConfigStat...
['Generates', 'state', 'information', 'for', 'the', 'selected', 'container', 'and', 'its', 'dependencies', '/', 'dependents', '.']
train
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/state/base.py#L416-L433
6,011
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.hasChannelType
def hasChannelType(self, chan): """Returns True if chan is among the supported channel types. @param app: Module name. @return: Boolean """ if self._chantypes is None: self._initChannelTypesList() return chan in self._chantypes
python
def hasChannelType(self, chan): """Returns True if chan is among the supported channel types. @param app: Module name. @return: Boolean """ if self._chantypes is None: self._initChannelTypesList() return chan in self._chantypes
['def', 'hasChannelType', '(', 'self', ',', 'chan', ')', ':', 'if', 'self', '.', '_chantypes', 'is', 'None', ':', 'self', '.', '_initChannelTypesList', '(', ')', 'return', 'chan', 'in', 'self', '.', '_chantypes']
Returns True if chan is among the supported channel types. @param app: Module name. @return: Boolean
['Returns', 'True', 'if', 'chan', 'is', 'among', 'the', 'supported', 'channel', 'types', '.']
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L350-L359
6,012
paylogic/halogen
halogen/schema.py
Attr.deserialize
def deserialize(self, value, **kwargs): """Deserialize the attribute from a HAL structure. Get the value from the HAL structure from the attribute's compartment using the attribute's name as a key, convert it using the attribute's type. Schema will either return it to parent schema or ...
python
def deserialize(self, value, **kwargs): """Deserialize the attribute from a HAL structure. Get the value from the HAL structure from the attribute's compartment using the attribute's name as a key, convert it using the attribute's type. Schema will either return it to parent schema or ...
['def', 'deserialize', '(', 'self', ',', 'value', ',', '*', '*', 'kwargs', ')', ':', 'compartment', '=', 'value', 'if', 'self', '.', 'compartment', 'is', 'not', 'None', ':', 'compartment', '=', 'value', '[', 'self', '.', 'compartment', ']', 'try', ':', 'value', '=', 'self', '.', 'accessor', '.', 'get', '(', 'compartmen...
Deserialize the attribute from a HAL structure. Get the value from the HAL structure from the attribute's compartment using the attribute's name as a key, convert it using the attribute's type. Schema will either return it to parent schema or will assign to the output value if specifie...
['Deserialize', 'the', 'attribute', 'from', 'a', 'HAL', 'structure', '.']
train
https://github.com/paylogic/halogen/blob/2dec0a67c506d02d1f51915fa7163f59764a0bde/halogen/schema.py#L185-L209
6,013
Azure/azure-event-hubs-python
azure/eventprocessorhost/partition_manager.py
PartitionManager.attempt_renew_lease
def attempt_renew_lease(self, lease_task, owned_by_others_q, lease_manager): """ Make attempt_renew_lease async call sync. """ loop = asyncio.new_event_loop() loop.run_until_complete(self.attempt_renew_lease_async(lease_task, owned_by_others_q, lease_manager))
python
def attempt_renew_lease(self, lease_task, owned_by_others_q, lease_manager): """ Make attempt_renew_lease async call sync. """ loop = asyncio.new_event_loop() loop.run_until_complete(self.attempt_renew_lease_async(lease_task, owned_by_others_q, lease_manager))
['def', 'attempt_renew_lease', '(', 'self', ',', 'lease_task', ',', 'owned_by_others_q', ',', 'lease_manager', ')', ':', 'loop', '=', 'asyncio', '.', 'new_event_loop', '(', ')', 'loop', '.', 'run_until_complete', '(', 'self', '.', 'attempt_renew_lease_async', '(', 'lease_task', ',', 'owned_by_others_q', ',', 'lease_man...
Make attempt_renew_lease async call sync.
['Make', 'attempt_renew_lease', 'async', 'call', 'sync', '.']
train
https://github.com/Azure/azure-event-hubs-python/blob/737c5f966557ada2cf10fa0d8f3c19671ae96348/azure/eventprocessorhost/partition_manager.py#L320-L325
6,014
dariusbakunas/rawdisk
rawdisk/plugins/filesystems/ntfs/bootsector.py
BootSector.mft_mirror_offset
def mft_mirror_offset(self): """ Returns: int: Mirror MFT Table offset from the beginning of the partition \ in bytes """ return self.bpb.bytes_per_sector * \ self.bpb.sectors_per_cluster * self.extended_bpb.mft_mirror_cluster
python
def mft_mirror_offset(self): """ Returns: int: Mirror MFT Table offset from the beginning of the partition \ in bytes """ return self.bpb.bytes_per_sector * \ self.bpb.sectors_per_cluster * self.extended_bpb.mft_mirror_cluster
['def', 'mft_mirror_offset', '(', 'self', ')', ':', 'return', 'self', '.', 'bpb', '.', 'bytes_per_sector', '*', 'self', '.', 'bpb', '.', 'sectors_per_cluster', '*', 'self', '.', 'extended_bpb', '.', 'mft_mirror_cluster']
Returns: int: Mirror MFT Table offset from the beginning of the partition \ in bytes
['Returns', ':', 'int', ':', 'Mirror', 'MFT', 'Table', 'offset', 'from', 'the', 'beginning', 'of', 'the', 'partition', '\\', 'in', 'bytes']
train
https://github.com/dariusbakunas/rawdisk/blob/1dc9d0b377fe5da3c406ccec4abc238c54167403/rawdisk/plugins/filesystems/ntfs/bootsector.py#L72-L79
6,015
BlackEarth/bf
bf/css.py
CSS.selector_to_xpath
def selector_to_xpath(cls, selector, xmlns=None): """convert a css selector into an xpath expression. xmlns is option single-item dict with namespace prefix and href """ selector = selector.replace(' .', ' *.') if selector[0] == '.': selector = '*' + select...
python
def selector_to_xpath(cls, selector, xmlns=None): """convert a css selector into an xpath expression. xmlns is option single-item dict with namespace prefix and href """ selector = selector.replace(' .', ' *.') if selector[0] == '.': selector = '*' + select...
['def', 'selector_to_xpath', '(', 'cls', ',', 'selector', ',', 'xmlns', '=', 'None', ')', ':', 'selector', '=', 'selector', '.', 'replace', '(', "' .'", ',', "' *.'", ')', 'if', 'selector', '[', '0', ']', '==', "'.'", ':', 'selector', '=', "'*'", '+', 'selector', 'log', '.', 'debug', '(', 'selector', ')', 'if', "'#'", ...
convert a css selector into an xpath expression. xmlns is option single-item dict with namespace prefix and href
['convert', 'a', 'css', 'selector', 'into', 'an', 'xpath', 'expression', '.', 'xmlns', 'is', 'option', 'single', '-', 'item', 'dict', 'with', 'namespace', 'prefix', 'and', 'href']
train
https://github.com/BlackEarth/bf/blob/376041168874bbd6dee5ccfeece4a9e553223316/bf/css.py#L102-L131
6,016
projecthamster/hamster
src/hamster/lib/graphics.py
Scene.start_drag
def start_drag(self, sprite, cursor_x = None, cursor_y = None): """start dragging given sprite""" cursor_x, cursor_y = cursor_x or sprite.x, cursor_y or sprite.y self._mouse_down_sprite = self._drag_sprite = sprite sprite.drag_x, sprite.drag_y = self._drag_sprite.x, self._drag_sprite.y ...
python
def start_drag(self, sprite, cursor_x = None, cursor_y = None): """start dragging given sprite""" cursor_x, cursor_y = cursor_x or sprite.x, cursor_y or sprite.y self._mouse_down_sprite = self._drag_sprite = sprite sprite.drag_x, sprite.drag_y = self._drag_sprite.x, self._drag_sprite.y ...
['def', 'start_drag', '(', 'self', ',', 'sprite', ',', 'cursor_x', '=', 'None', ',', 'cursor_y', '=', 'None', ')', ':', 'cursor_x', ',', 'cursor_y', '=', 'cursor_x', 'or', 'sprite', '.', 'x', ',', 'cursor_y', 'or', 'sprite', '.', 'y', 'self', '.', '_mouse_down_sprite', '=', 'self', '.', '_drag_sprite', '=', 'sprite', '...
start dragging given sprite
['start', 'dragging', 'given', 'sprite']
train
https://github.com/projecthamster/hamster/blob/ca5254eff53172796ddafc72226c394ed1858245/src/hamster/lib/graphics.py#L2158-L2165
6,017
saltstack/salt
salt/states/rbenv.py
installed
def installed(name, default=False, user=None): ''' Verify that the specified ruby is installed with rbenv. Rbenv is installed if necessary. name The version of ruby to install default : False Whether to make this ruby the default. user: None The user to run rbenv as. ...
python
def installed(name, default=False, user=None): ''' Verify that the specified ruby is installed with rbenv. Rbenv is installed if necessary. name The version of ruby to install default : False Whether to make this ruby the default. user: None The user to run rbenv as. ...
['def', 'installed', '(', 'name', ',', 'default', '=', 'False', ',', 'user', '=', 'None', ')', ':', 'ret', '=', '{', "'name'", ':', 'name', ',', "'result'", ':', 'None', ',', "'comment'", ':', "''", ',', "'changes'", ':', '{', '}', '}', 'rbenv_installed_ret', '=', 'copy', '.', 'deepcopy', '(', 'ret', ')', 'if', 'name',...
Verify that the specified ruby is installed with rbenv. Rbenv is installed if necessary. name The version of ruby to install default : False Whether to make this ruby the default. user: None The user to run rbenv as. .. versionadded:: 0.17.0 .. versionadded:: 0.1...
['Verify', 'that', 'the', 'specified', 'ruby', 'is', 'installed', 'with', 'rbenv', '.', 'Rbenv', 'is', 'installed', 'if', 'necessary', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rbenv.py#L109-L147
6,018
WebarchivCZ/WA-KAT
src/wa_kat/templates/static/js/Lib/site-packages/components/input_controller.py
InputController._set_typeahead
def _set_typeahead(cls, el, value): """ Convert given `el` to typeahead input and set it to `value`. This method also sets the dropdown icons and descriptors. Args: el (obj): Element reference to the input you want to convert to typeahead. value ...
python
def _set_typeahead(cls, el, value): """ Convert given `el` to typeahead input and set it to `value`. This method also sets the dropdown icons and descriptors. Args: el (obj): Element reference to the input you want to convert to typeahead. value ...
['def', '_set_typeahead', '(', 'cls', ',', 'el', ',', 'value', ')', ':', 'PlaceholderHandler', '.', 'reset_placeholder_dropdown', '(', 'el', ')', '# if there is no elements, show alert icon in glyph', 'if', 'not', 'value', 'and', 'not', 'el', '.', 'value', ':', 'DropdownHandler', '.', 'set_dropdown_glyph', '(', 'el', '...
Convert given `el` to typeahead input and set it to `value`. This method also sets the dropdown icons and descriptors. Args: el (obj): Element reference to the input you want to convert to typeahead. value (list): List of dicts with two keys: ``source`` and ``va...
['Convert', 'given', 'el', 'to', 'typeahead', 'input', 'and', 'set', 'it', 'to', 'value', '.']
train
https://github.com/WebarchivCZ/WA-KAT/blob/16d064a3a775dc1d2713debda7847ded52dd2a06/src/wa_kat/templates/static/js/Lib/site-packages/components/input_controller.py#L65-L114
6,019
kpdyer/regex2dfa
third_party/re2/lib/codereview/codereview.py
EncodeMultipartFormData
def EncodeMultipartFormData(fields, files): """Encode form fields for multipart/form-data. Args: fields: A sequence of (name, value) elements for regular form fields. files: A sequence of (name, filename, value) elements for data to be uploaded as files. Returns: (content_type, body) ready for httplib.HT...
python
def EncodeMultipartFormData(fields, files): """Encode form fields for multipart/form-data. Args: fields: A sequence of (name, value) elements for regular form fields. files: A sequence of (name, filename, value) elements for data to be uploaded as files. Returns: (content_type, body) ready for httplib.HT...
['def', 'EncodeMultipartFormData', '(', 'fields', ',', 'files', ')', ':', 'BOUNDARY', '=', "'-M-A-G-I-C---B-O-U-N-D-A-R-Y-'", 'CRLF', '=', "'\\r\\n'", 'lines', '=', '[', ']', 'for', '(', 'key', ',', 'value', ')', 'in', 'fields', ':', 'typecheck', '(', 'key', ',', 'str', ')', 'typecheck', '(', 'value', ',', 'str', ')', ...
Encode form fields for multipart/form-data. Args: fields: A sequence of (name, value) elements for regular form fields. files: A sequence of (name, filename, value) elements for data to be uploaded as files. Returns: (content_type, body) ready for httplib.HTTP instance. Source: http://aspn.activestate...
['Encode', 'form', 'fields', 'for', 'multipart', '/', 'form', '-', 'data', '.']
train
https://github.com/kpdyer/regex2dfa/blob/109f877e60ef0dfcb430f11516d215930b7b9936/third_party/re2/lib/codereview/codereview.py#L3094-L3130
6,020
wright-group/WrightTools
WrightTools/diagrams/WMEL.py
Artist.label_rows
def label_rows(self, labels, font_size=15, text_buffer=1.5): """Label rows. Parameters ---------- labels : list of strings Labels. font_size : number (optional) Font size. Default is 15. text_buffer : number Buffer around text. Default...
python
def label_rows(self, labels, font_size=15, text_buffer=1.5): """Label rows. Parameters ---------- labels : list of strings Labels. font_size : number (optional) Font size. Default is 15. text_buffer : number Buffer around text. Default...
['def', 'label_rows', '(', 'self', ',', 'labels', ',', 'font_size', '=', '15', ',', 'text_buffer', '=', '1.5', ')', ':', 'for', 'i', 'in', 'range', '(', 'len', '(', 'self', '.', 'subplots', ')', ')', ':', 'plot', '=', 'self', '.', 'subplots', '[', 'i', ']', '[', '-', '1', ']', 'plot', '.', 'text', '(', 'text_buffer', '...
Label rows. Parameters ---------- labels : list of strings Labels. font_size : number (optional) Font size. Default is 15. text_buffer : number Buffer around text. Default is 1.5.
['Label', 'rows', '.']
train
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/diagrams/WMEL.py#L261-L282
6,021
Iotic-Labs/py-IoticAgent
src/IoticAgent/Core/RateLimiter.py
RateLimiter.throttle
def throttle(self): """Uses time.monotonic() (or time.sleep() if not available) to limit to the desired rate. Should be called once per iteration of action which is to be throttled. Returns None unless a custom wait_cmd was specified in the constructor in which case its return value is used if a...
python
def throttle(self): """Uses time.monotonic() (or time.sleep() if not available) to limit to the desired rate. Should be called once per iteration of action which is to be throttled. Returns None unless a custom wait_cmd was specified in the constructor in which case its return value is used if a...
['def', 'throttle', '(', 'self', ')', ':', 'iterations', '=', 'self', '.', '__iterations', 'timestamp', '=', 'monotonic', '(', ')', 'outdated_threshold', '=', 'timestamp', '-', 'self', '.', '__interval', 'with', 'self', '.', '__lock', ':', '# remove any iterations older than interval', 'try', ':', 'while', 'iterations'...
Uses time.monotonic() (or time.sleep() if not available) to limit to the desired rate. Should be called once per iteration of action which is to be throttled. Returns None unless a custom wait_cmd was specified in the constructor in which case its return value is used if a wait was required.
['Uses', 'time', '.', 'monotonic', '()', '(', 'or', 'time', '.', 'sleep', '()', 'if', 'not', 'available', ')', 'to', 'limit', 'to', 'the', 'desired', 'rate', '.', 'Should', 'be', 'called', 'once', 'per', 'iteration', 'of', 'action', 'which', 'is', 'to', 'be', 'throttled', '.', 'Returns', 'None', 'unless', 'a', 'custom'...
train
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/RateLimiter.py#L54-L85
6,022
DLR-RM/RAFCON
source/rafcon/gui/controllers/execution_history.py
ExecutionHistoryTreeController.notification_selected_sm_changed
def notification_selected_sm_changed(self, model, prop_name, info): """If a new state machine is selected, make sure expansion state is stored and tree updated""" selected_state_machine_id = self.model.selected_state_machine_id if selected_state_machine_id is None: return sel...
python
def notification_selected_sm_changed(self, model, prop_name, info): """If a new state machine is selected, make sure expansion state is stored and tree updated""" selected_state_machine_id = self.model.selected_state_machine_id if selected_state_machine_id is None: return sel...
['def', 'notification_selected_sm_changed', '(', 'self', ',', 'model', ',', 'prop_name', ',', 'info', ')', ':', 'selected_state_machine_id', '=', 'self', '.', 'model', '.', 'selected_state_machine_id', 'if', 'selected_state_machine_id', 'is', 'None', ':', 'return', 'self', '.', 'update', '(', ')']
If a new state machine is selected, make sure expansion state is stored and tree updated
['If', 'a', 'new', 'state', 'machine', 'is', 'selected', 'make', 'sure', 'expansion', 'state', 'is', 'stored', 'and', 'tree', 'updated']
train
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/execution_history.py#L325-L330
6,023
oczkers/pyllegro
pyllegro/core.py
Allegro.getOrders
def getOrders(self, auction_ids): """Return orders details.""" orders = {} # chunk list (only 25 auction_ids per request) for chunk in chunked(auction_ids, 25): # auctions = [{'item': auction_id} for auction_id in chunk] # TODO?: is it needed? auctions = self.Arr...
python
def getOrders(self, auction_ids): """Return orders details.""" orders = {} # chunk list (only 25 auction_ids per request) for chunk in chunked(auction_ids, 25): # auctions = [{'item': auction_id} for auction_id in chunk] # TODO?: is it needed? auctions = self.Arr...
['def', 'getOrders', '(', 'self', ',', 'auction_ids', ')', ':', 'orders', '=', '{', '}', '# chunk list (only 25 auction_ids per request)', 'for', 'chunk', 'in', 'chunked', '(', 'auction_ids', ',', '25', ')', ':', "# auctions = [{'item': auction_id} for auction_id in chunk] # TODO?: is it needed?", 'auctions', '=', 'se...
Return orders details.
['Return', 'orders', 'details', '.']
train
https://github.com/oczkers/pyllegro/blob/c6d7090560cb9e579f7f769a9eec131a3db2c258/pyllegro/core.py#L181-L217
6,024
stitchfix/pyxley
pyxley/charts/mg/graphic.py
Graphic.custom_line_color_map
def custom_line_color_map(self, values): """Set the custom line color map. Args: values (list): list of colors. Raises: TypeError: Custom line color map must be a list. """ if not isinstance(values, list): raise TypeError("cus...
python
def custom_line_color_map(self, values): """Set the custom line color map. Args: values (list): list of colors. Raises: TypeError: Custom line color map must be a list. """ if not isinstance(values, list): raise TypeError("cus...
['def', 'custom_line_color_map', '(', 'self', ',', 'values', ')', ':', 'if', 'not', 'isinstance', '(', 'values', ',', 'list', ')', ':', 'raise', 'TypeError', '(', '"custom_line_color_map must be a list"', ')', 'self', '.', 'options', '[', '"custom_line_color_map"', ']', '=', 'values']
Set the custom line color map. Args: values (list): list of colors. Raises: TypeError: Custom line color map must be a list.
['Set', 'the', 'custom', 'line', 'color', 'map', '.']
train
https://github.com/stitchfix/pyxley/blob/2dab00022d977d986169cd8a629b3a2f91be893f/pyxley/charts/mg/graphic.py#L89-L101
6,025
noahbenson/neuropythy
neuropythy/hcp/files.py
auto_download
def auto_download(status, credentials=None, subjects_path=None, overwrite=False, release='HCP_1200', database='hcp-openaccess', retinotopy_path=None, retinotopy_cache=True): ''' auto_download(True) enables automatic downloading of HCP subject data when the subject ID is...
python
def auto_download(status, credentials=None, subjects_path=None, overwrite=False, release='HCP_1200', database='hcp-openaccess', retinotopy_path=None, retinotopy_cache=True): ''' auto_download(True) enables automatic downloading of HCP subject data when the subject ID is...
['def', 'auto_download', '(', 'status', ',', 'credentials', '=', 'None', ',', 'subjects_path', '=', 'None', ',', 'overwrite', '=', 'False', ',', 'release', '=', "'HCP_1200'", ',', 'database', '=', "'hcp-openaccess'", ',', 'retinotopy_path', '=', 'None', ',', 'retinotopy_cache', '=', 'True', ')', ':', 'global', '_auto_d...
auto_download(True) enables automatic downloading of HCP subject data when the subject ID is requested. The optional arguments are identical to those required for the function download(), and they are passed to download() when auto-downloading occurs. auto_download(False) disables automatic downloading....
['auto_download', '(', 'True', ')', 'enables', 'automatic', 'downloading', 'of', 'HCP', 'subject', 'data', 'when', 'the', 'subject', 'ID', 'is', 'requested', '.', 'The', 'optional', 'arguments', 'are', 'identical', 'to', 'those', 'required', 'for', 'the', 'function', 'download', '()', 'and', 'they', 'are', 'passed', 't...
train
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/hcp/files.py#L1833-L1898
6,026
mjirik/imtools
imtools/tools.py
sliding_window_3d
def sliding_window_3d(image, step_size, window_size, mask=None, only_whole=True, include_last=False): """ Creates generator of sliding windows. :param image: input image :param step_size: number of pixels we are going to skip in both the (x, y) direction :param window_size: the width and height of t...
python
def sliding_window_3d(image, step_size, window_size, mask=None, only_whole=True, include_last=False): """ Creates generator of sliding windows. :param image: input image :param step_size: number of pixels we are going to skip in both the (x, y) direction :param window_size: the width and height of t...
['def', 'sliding_window_3d', '(', 'image', ',', 'step_size', ',', 'window_size', ',', 'mask', '=', 'None', ',', 'only_whole', '=', 'True', ',', 'include_last', '=', 'False', ')', ':', 'if', 'not', 'isinstance', '(', 'step_size', ',', 'tuple', ')', ':', 'step_size', '=', '(', 'step_size', ',', 'step_size', ',', 'step_si...
Creates generator of sliding windows. :param image: input image :param step_size: number of pixels we are going to skip in both the (x, y) direction :param window_size: the width and height of the window we are going to extract :param mask: region of interest, if None it will slide through the whole ima...
['Creates', 'generator', 'of', 'sliding', 'windows', '.', ':', 'param', 'image', ':', 'input', 'image', ':', 'param', 'step_size', ':', 'number', 'of', 'pixels', 'we', 'are', 'going', 'to', 'skip', 'in', 'both', 'the', '(', 'x', 'y', ')', 'direction', ':', 'param', 'window_size', ':', 'the', 'width', 'and', 'height', '...
train
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/tools.py#L1325-L1373
6,027
Karaage-Cluster/python-tldap
tldap/backend/fake_transactions.py
LDAPwrapper.rename
def rename(self, dn: str, new_rdn: str, new_base_dn: Optional[str] = None) -> None: """ rename a dn in the ldap database; see ldap module. doesn't return a result if transactions enabled. """ _debug("rename", self, dn, new_rdn, new_base_dn) # split up the parameters ...
python
def rename(self, dn: str, new_rdn: str, new_base_dn: Optional[str] = None) -> None: """ rename a dn in the ldap database; see ldap module. doesn't return a result if transactions enabled. """ _debug("rename", self, dn, new_rdn, new_base_dn) # split up the parameters ...
['def', 'rename', '(', 'self', ',', 'dn', ':', 'str', ',', 'new_rdn', ':', 'str', ',', 'new_base_dn', ':', 'Optional', '[', 'str', ']', '=', 'None', ')', '->', 'None', ':', '_debug', '(', '"rename"', ',', 'self', ',', 'dn', ',', 'new_rdn', ',', 'new_base_dn', ')', '# split up the parameters', 'split_dn', '=', 'tldap', ...
rename a dn in the ldap database; see ldap module. doesn't return a result if transactions enabled.
['rename', 'a', 'dn', 'in', 'the', 'ldap', 'database', ';', 'see', 'ldap', 'module', '.', 'doesn', 't', 'return', 'a', 'result', 'if', 'transactions', 'enabled', '.']
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/backend/fake_transactions.py#L349-L385
6,028
googleads/googleads-python-lib
examples/adwords/v201809/shopping/add_shopping_campaign_for_showcase_ads.py
ProductPartitionHelper.CreateUnit
def CreateUnit(self, parent=None, value=None, bid_amount=None): """Creates a unit node. Args: parent: The node that should be this node's parent. value: The value being partitioned on. bid_amount: The amount to bid for matching products, in micros. Returns: A new unit node. """ ...
python
def CreateUnit(self, parent=None, value=None, bid_amount=None): """Creates a unit node. Args: parent: The node that should be this node's parent. value: The value being partitioned on. bid_amount: The amount to bid for matching products, in micros. Returns: A new unit node. """ ...
['def', 'CreateUnit', '(', 'self', ',', 'parent', '=', 'None', ',', 'value', '=', 'None', ',', 'bid_amount', '=', 'None', ')', ':', 'unit', '=', '{', "'xsi_type'", ':', "'ProductPartition'", ',', "'partitionType'", ':', "'UNIT'", '}', '# The root node has neither a parent nor a value.', 'if', 'parent', 'is', 'not', 'No...
Creates a unit node. Args: parent: The node that should be this node's parent. value: The value being partitioned on. bid_amount: The amount to bid for matching products, in micros. Returns: A new unit node.
['Creates', 'a', 'unit', 'node', '.']
train
https://github.com/googleads/googleads-python-lib/blob/aa3b1b474b0f9789ca55ca46f4b2b57aeae38874/examples/adwords/v201809/shopping/add_shopping_campaign_for_showcase_ads.py#L91-L138
6,029
opendatateam/udata
udata/harvest/backends/base.py
BaseBackend.get_dataset
def get_dataset(self, remote_id): '''Get or create a dataset given its remote ID (and its source) We first try to match `source_id` to be source domain independent ''' dataset = Dataset.objects(__raw__={ 'extras.harvest:remote_id': remote_id, '$or': [ ...
python
def get_dataset(self, remote_id): '''Get or create a dataset given its remote ID (and its source) We first try to match `source_id` to be source domain independent ''' dataset = Dataset.objects(__raw__={ 'extras.harvest:remote_id': remote_id, '$or': [ ...
['def', 'get_dataset', '(', 'self', ',', 'remote_id', ')', ':', 'dataset', '=', 'Dataset', '.', 'objects', '(', '__raw__', '=', '{', "'extras.harvest:remote_id'", ':', 'remote_id', ',', "'$or'", ':', '[', '{', "'extras.harvest:domain'", ':', 'self', '.', 'source', '.', 'domain', '}', ',', '{', "'extras.harvest:source_i...
Get or create a dataset given its remote ID (and its source) We first try to match `source_id` to be source domain independent
['Get', 'or', 'create', 'a', 'dataset', 'given', 'its', 'remote', 'ID', '(', 'and', 'its', 'source', ')', 'We', 'first', 'try', 'to', 'match', 'source_id', 'to', 'be', 'source', 'domain', 'independent']
train
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/harvest/backends/base.py#L252-L263
6,030
saltstack/salt
salt/fileserver/hgfs.py
envs
def envs(ignore_cache=False): ''' Return a list of refs that can be used as environments ''' if not ignore_cache: env_cache = os.path.join(__opts__['cachedir'], 'hgfs/envs.p') cache_match = salt.fileserver.check_env_cache(__opts__, env_cache) if cache_match is not None: ...
python
def envs(ignore_cache=False): ''' Return a list of refs that can be used as environments ''' if not ignore_cache: env_cache = os.path.join(__opts__['cachedir'], 'hgfs/envs.p') cache_match = salt.fileserver.check_env_cache(__opts__, env_cache) if cache_match is not None: ...
['def', 'envs', '(', 'ignore_cache', '=', 'False', ')', ':', 'if', 'not', 'ignore_cache', ':', 'env_cache', '=', 'os', '.', 'path', '.', 'join', '(', '__opts__', '[', "'cachedir'", ']', ',', "'hgfs/envs.p'", ')', 'cache_match', '=', 'salt', '.', 'fileserver', '.', 'check_env_cache', '(', '__opts__', ',', 'env_cache', '...
Return a list of refs that can be used as environments
['Return', 'a', 'list', 'of', 'refs', 'that', 'can', 'be', 'used', 'as', 'environments']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L610-L636
6,031
thunder-project/thunder
thunder/series/series.py
Series.convolve
def convolve(self, signal, mode='full'): """ Convolve series data against another signal. Parameters ---------- signal : array Signal to convolve with (must be 1D) mode : str, optional, default='full' Mode of convolution, options are 'full', 'sam...
python
def convolve(self, signal, mode='full'): """ Convolve series data against another signal. Parameters ---------- signal : array Signal to convolve with (must be 1D) mode : str, optional, default='full' Mode of convolution, options are 'full', 'sam...
['def', 'convolve', '(', 'self', ',', 'signal', ',', 'mode', '=', "'full'", ')', ':', 'from', 'numpy', 'import', 'convolve', 's', '=', 'asarray', '(', 'signal', ')', 'n', '=', 'size', '(', 'self', '.', 'index', ')', 'm', '=', 'size', '(', 's', ')', '# use expected lengths to make a new index', 'if', 'mode', '==', "'sam...
Convolve series data against another signal. Parameters ---------- signal : array Signal to convolve with (must be 1D) mode : str, optional, default='full' Mode of convolution, options are 'full', 'same', and 'valid'
['Convolve', 'series', 'data', 'against', 'another', 'signal', '.']
train
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L914-L943
6,032
pyQode/pyqode.core
examples/notepad/notepad/main_window.py
MainWindow.on_save_as
def on_save_as(self): """ Save the current editor document as. """ self.tabWidget.save_current_as() self._update_status_bar(self.tabWidget.current_widget())
python
def on_save_as(self): """ Save the current editor document as. """ self.tabWidget.save_current_as() self._update_status_bar(self.tabWidget.current_widget())
['def', 'on_save_as', '(', 'self', ')', ':', 'self', '.', 'tabWidget', '.', 'save_current_as', '(', ')', 'self', '.', '_update_status_bar', '(', 'self', '.', 'tabWidget', '.', 'current_widget', '(', ')', ')']
Save the current editor document as.
['Save', 'the', 'current', 'editor', 'document', 'as', '.']
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/examples/notepad/notepad/main_window.py#L181-L186
6,033
saltstack/salt
salt/modules/nfs3.py
reload_exports
def reload_exports(): ''' Trigger a reload of the exports file to apply changes CLI Example: .. code-block:: bash salt '*' nfs3.reload_exports ''' ret = {} command = 'exportfs -r' output = __salt__['cmd.run_all'](command) ret['stdout'] = output['stdout'] ret['stderr'...
python
def reload_exports(): ''' Trigger a reload of the exports file to apply changes CLI Example: .. code-block:: bash salt '*' nfs3.reload_exports ''' ret = {} command = 'exportfs -r' output = __salt__['cmd.run_all'](command) ret['stdout'] = output['stdout'] ret['stderr'...
['def', 'reload_exports', '(', ')', ':', 'ret', '=', '{', '}', 'command', '=', "'exportfs -r'", 'output', '=', '__salt__', '[', "'cmd.run_all'", ']', '(', 'command', ')', 'ret', '[', "'stdout'", ']', '=', 'output', '[', "'stdout'", ']', 'ret', '[', "'stderr'", ']', '=', 'output', '[', "'stderr'", ']', '# exportfs alway...
Trigger a reload of the exports file to apply changes CLI Example: .. code-block:: bash salt '*' nfs3.reload_exports
['Trigger', 'a', 'reload', 'of', 'the', 'exports', 'file', 'to', 'apply', 'changes']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nfs3.py#L133-L154
6,034
Azure/azure-cosmos-python
azure/cosmos/consistent_hash_ring.py
_ConsistentHashRing._GetSerializedPartitionList
def _GetSerializedPartitionList(self): """Gets the serialized version of the ConsistentRing. Added this helper for the test code. """ partition_list = list() for part in self.partitions: partition_list.append((part.node, unpack("<L", part.hash_value)[0])) ...
python
def _GetSerializedPartitionList(self): """Gets the serialized version of the ConsistentRing. Added this helper for the test code. """ partition_list = list() for part in self.partitions: partition_list.append((part.node, unpack("<L", part.hash_value)[0])) ...
['def', '_GetSerializedPartitionList', '(', 'self', ')', ':', 'partition_list', '=', 'list', '(', ')', 'for', 'part', 'in', 'self', '.', 'partitions', ':', 'partition_list', '.', 'append', '(', '(', 'part', '.', 'node', ',', 'unpack', '(', '"<L"', ',', 'part', '.', 'hash_value', ')', '[', '0', ']', ')', ')', 'return', ...
Gets the serialized version of the ConsistentRing. Added this helper for the test code.
['Gets', 'the', 'serialized', 'version', 'of', 'the', 'ConsistentRing', '.', 'Added', 'this', 'helper', 'for', 'the', 'test', 'code', '.']
train
https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/consistent_hash_ring.py#L99-L108
6,035
jkwill87/mapi
mapi/providers.py
Provider._year_expand
def _year_expand(s): """ Parses a year or dash-delimeted year range """ regex = r"^((?:19|20)\d{2})?(\s*-\s*)?((?:19|20)\d{2})?$" try: start, dash, end = match(regex, ustr(s)).groups() start = start or 1900 end = end or 2099 except AttributeErr...
python
def _year_expand(s): """ Parses a year or dash-delimeted year range """ regex = r"^((?:19|20)\d{2})?(\s*-\s*)?((?:19|20)\d{2})?$" try: start, dash, end = match(regex, ustr(s)).groups() start = start or 1900 end = end or 2099 except AttributeErr...
['def', '_year_expand', '(', 's', ')', ':', 'regex', '=', 'r"^((?:19|20)\\d{2})?(\\s*-\\s*)?((?:19|20)\\d{2})?$"', 'try', ':', 'start', ',', 'dash', ',', 'end', '=', 'match', '(', 'regex', ',', 'ustr', '(', 's', ')', ')', '.', 'groups', '(', ')', 'start', '=', 'start', 'or', '1900', 'end', '=', 'end', 'or', '2099', 'ex...
Parses a year or dash-delimeted year range
['Parses', 'a', 'year', 'or', 'dash', '-', 'delimeted', 'year', 'range']
train
https://github.com/jkwill87/mapi/blob/730bf57c12aecaf49e18c15bf2b35af7f554b3cc/mapi/providers.py#L68-L78
6,036
hover2pi/svo_filters
svo_filters/svo.py
Filter.rsr
def rsr(self): """A getter for the relative spectral response (rsr) curve""" arr = np.array([self.wave.value, self.throughput]).swapaxes(0, 1) return arr
python
def rsr(self): """A getter for the relative spectral response (rsr) curve""" arr = np.array([self.wave.value, self.throughput]).swapaxes(0, 1) return arr
['def', 'rsr', '(', 'self', ')', ':', 'arr', '=', 'np', '.', 'array', '(', '[', 'self', '.', 'wave', '.', 'value', ',', 'self', '.', 'throughput', ']', ')', '.', 'swapaxes', '(', '0', ',', '1', ')', 'return', 'arr']
A getter for the relative spectral response (rsr) curve
['A', 'getter', 'for', 'the', 'relative', 'spectral', 'response', '(', 'rsr', ')', 'curve']
train
https://github.com/hover2pi/svo_filters/blob/f0587c4908baf636d4bdf030fa95029e8f31b975/svo_filters/svo.py#L680-L684
6,037
jopohl/urh
src/urh/controller/GeneratorTabController.py
GeneratorTabController.bootstrap_modulator
def bootstrap_modulator(self, protocol: ProtocolAnalyzer): """ Set initial parameters for default modulator if it was not edited by user previously :return: """ if len(self.modulators) != 1 or len(self.table_model.protocol.messages) == 0: return modulator = s...
python
def bootstrap_modulator(self, protocol: ProtocolAnalyzer): """ Set initial parameters for default modulator if it was not edited by user previously :return: """ if len(self.modulators) != 1 or len(self.table_model.protocol.messages) == 0: return modulator = s...
['def', 'bootstrap_modulator', '(', 'self', ',', 'protocol', ':', 'ProtocolAnalyzer', ')', ':', 'if', 'len', '(', 'self', '.', 'modulators', ')', '!=', '1', 'or', 'len', '(', 'self', '.', 'table_model', '.', 'protocol', '.', 'messages', ')', '==', '0', ':', 'return', 'modulator', '=', 'self', '.', 'modulators', '[', '0...
Set initial parameters for default modulator if it was not edited by user previously :return:
['Set', 'initial', 'parameters', 'for', 'default', 'modulator', 'if', 'it', 'was', 'not', 'edited', 'by', 'user', 'previously', ':', 'return', ':']
train
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/GeneratorTabController.py#L206-L224
6,038
KE-works/pykechain
pykechain/client.py
Client.activity
def activity(self, *args, **kwargs): # type: (*Any, **Any) -> Activity """Search for a single activity. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters....
python
def activity(self, *args, **kwargs): # type: (*Any, **Any) -> Activity """Search for a single activity. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters....
['def', 'activity', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', '# type: (*Any, **Any) -> Activity', '_activities', '=', 'self', '.', 'activities', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', 'if', 'len', '(', '_activities', ')', '==', '0', ':', 'raise', 'NotFoundError', '(', '"No activity fit...
Search for a single activity. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param pk: id (primary key) of the activity to retrieve :type pk: basest...
['Search', 'for', 'a', 'single', 'activity', '.']
train
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L427-L451
6,039
rosenbrockc/fortpy
fortpy/interop/converter.py
FileTemplate._line
def _line(self, element): """Parses the XML element as a single line entry in the input file.""" for v in _get_xml_version(element): if "id" in element.attrib: tline = TemplateLine(element, None, self.versions[v].comment) self.versions[v].entries[tline.identif...
python
def _line(self, element): """Parses the XML element as a single line entry in the input file.""" for v in _get_xml_version(element): if "id" in element.attrib: tline = TemplateLine(element, None, self.versions[v].comment) self.versions[v].entries[tline.identif...
['def', '_line', '(', 'self', ',', 'element', ')', ':', 'for', 'v', 'in', '_get_xml_version', '(', 'element', ')', ':', 'if', '"id"', 'in', 'element', '.', 'attrib', ':', 'tline', '=', 'TemplateLine', '(', 'element', ',', 'None', ',', 'self', '.', 'versions', '[', 'v', ']', '.', 'comment', ')', 'self', '.', 'versions',...
Parses the XML element as a single line entry in the input file.
['Parses', 'the', 'XML', 'element', 'as', 'a', 'single', 'line', 'entry', 'in', 'the', 'input', 'file', '.']
train
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L359-L367
6,040
Shapeways/coyote_framework
coyote_framework/mixins/URLValidator.py
validate_urls
def validate_urls(urls, allowed_response_codes=None): """Validates that a list of urls can be opened and each responds with an allowed response code urls -- the list of urls to ping allowed_response_codes -- a list of response codes that the validator will ignore """ for url in urls: valid...
python
def validate_urls(urls, allowed_response_codes=None): """Validates that a list of urls can be opened and each responds with an allowed response code urls -- the list of urls to ping allowed_response_codes -- a list of response codes that the validator will ignore """ for url in urls: valid...
['def', 'validate_urls', '(', 'urls', ',', 'allowed_response_codes', '=', 'None', ')', ':', 'for', 'url', 'in', 'urls', ':', 'validate_url', '(', 'url', ',', 'allowed_response_codes', '=', 'allowed_response_codes', ')', 'return', 'True']
Validates that a list of urls can be opened and each responds with an allowed response code urls -- the list of urls to ping allowed_response_codes -- a list of response codes that the validator will ignore
['Validates', 'that', 'a', 'list', 'of', 'urls', 'can', 'be', 'opened', 'and', 'each', 'responds', 'with', 'an', 'allowed', 'response', 'code']
train
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/mixins/URLValidator.py#L29-L38
6,041
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.getmember
def getmember(self, name): """Return a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. """ tarinfo...
python
def getmember(self, name): """Return a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. """ tarinfo...
['def', 'getmember', '(', 'self', ',', 'name', ')', ':', 'tarinfo', '=', 'self', '.', '_getmember', '(', 'name', ')', 'if', 'tarinfo', 'is', 'None', ':', 'raise', 'KeyError', '(', '"filename %r not found"', '%', 'name', ')', 'return', 'tarinfo']
Return a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version.
['Return', 'a', 'TarInfo', 'object', 'for', 'member', 'name', '.', 'If', 'name', 'can', 'not', 'be', 'found', 'in', 'the', 'archive', 'KeyError', 'is', 'raised', '.', 'If', 'a', 'member', 'occurs', 'more', 'than', 'once', 'in', 'the', 'archive', 'its', 'last', 'occurrence', 'is', 'assumed', 'to', 'be', 'the', 'most', '...
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1884-L1893
6,042
nerdvegas/rez
src/rez/utils/platform_.py
Platform.physical_cores
def physical_cores(self): """Return the number of physical cpu cores on the system.""" try: return self._physical_cores_base() except Exception as e: from rez.utils.logging_ import print_error print_error("Error detecting physical core count, defaulting to 1: ...
python
def physical_cores(self): """Return the number of physical cpu cores on the system.""" try: return self._physical_cores_base() except Exception as e: from rez.utils.logging_ import print_error print_error("Error detecting physical core count, defaulting to 1: ...
['def', 'physical_cores', '(', 'self', ')', ':', 'try', ':', 'return', 'self', '.', '_physical_cores_base', '(', ')', 'except', 'Exception', 'as', 'e', ':', 'from', 'rez', '.', 'utils', '.', 'logging_', 'import', 'print_error', 'print_error', '(', '"Error detecting physical core count, defaulting to 1: %s"', '%', 'str'...
Return the number of physical cpu cores on the system.
['Return', 'the', 'number', 'of', 'physical', 'cpu', 'cores', 'on', 'the', 'system', '.']
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/platform_.py#L82-L90
6,043
tensorflow/datasets
tensorflow_datasets/core/api_utils.py
disallow_positional_args
def disallow_positional_args(wrapped=None, allowed=None): """Requires function to be called using keyword arguments.""" # See # https://wrapt.readthedocs.io/en/latest/decorators.html#decorators-with-optional-arguments # for decorator pattern. if wrapped is None: return functools.partial(disallow_positiona...
python
def disallow_positional_args(wrapped=None, allowed=None): """Requires function to be called using keyword arguments.""" # See # https://wrapt.readthedocs.io/en/latest/decorators.html#decorators-with-optional-arguments # for decorator pattern. if wrapped is None: return functools.partial(disallow_positiona...
['def', 'disallow_positional_args', '(', 'wrapped', '=', 'None', ',', 'allowed', '=', 'None', ')', ':', '# See', '# https://wrapt.readthedocs.io/en/latest/decorators.html#decorators-with-optional-arguments', '# for decorator pattern.', 'if', 'wrapped', 'is', 'None', ':', 'return', 'functools', '.', 'partial', '(', 'dis...
Requires function to be called using keyword arguments.
['Requires', 'function', 'to', 'be', 'called', 'using', 'keyword', 'arguments', '.']
train
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/core/api_utils.py#L39-L54
6,044
Gandi/gandi.cli
gandi/cli/modules/network.py
Iface._detach
def _detach(cls, iface_id): """ Detach an iface from a vm. """ iface = cls._info(iface_id) opers = [] vm_id = iface.get('vm_id') if vm_id: cls.echo('The iface is still attached to the vm %s.' % vm_id) cls.echo('Will detach it.') opers.append(cl...
python
def _detach(cls, iface_id): """ Detach an iface from a vm. """ iface = cls._info(iface_id) opers = [] vm_id = iface.get('vm_id') if vm_id: cls.echo('The iface is still attached to the vm %s.' % vm_id) cls.echo('Will detach it.') opers.append(cl...
['def', '_detach', '(', 'cls', ',', 'iface_id', ')', ':', 'iface', '=', 'cls', '.', '_info', '(', 'iface_id', ')', 'opers', '=', '[', ']', 'vm_id', '=', 'iface', '.', 'get', '(', "'vm_id'", ')', 'if', 'vm_id', ':', 'cls', '.', 'echo', '(', "'The iface is still attached to the vm %s.'", '%', 'vm_id', ')', 'cls', '.', 'e...
Detach an iface from a vm.
['Detach', 'an', 'iface', 'from', 'a', 'vm', '.']
train
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/network.py#L390-L399
6,045
rootpy/rootpy
rootpy/context.py
thread_specific_tmprootdir
def thread_specific_tmprootdir(): """ Context manager which makes a thread specific gDirectory to avoid interfering with the current file. Use cases: A TTree Draw function which doesn't want to interfere with whatever gDirectory happens to be. Multi-threading where there are t...
python
def thread_specific_tmprootdir(): """ Context manager which makes a thread specific gDirectory to avoid interfering with the current file. Use cases: A TTree Draw function which doesn't want to interfere with whatever gDirectory happens to be. Multi-threading where there are t...
['def', 'thread_specific_tmprootdir', '(', ')', ':', 'with', 'preserve_current_directory', '(', ')', ':', 'dname', '=', '"rootpy-tmp/thread/{0}"', '.', 'format', '(', 'threading', '.', 'current_thread', '(', ')', '.', 'ident', ')', 'd', '=', 'ROOT', '.', 'gROOT', '.', 'mkdir', '(', 'dname', ')', 'if', 'not', 'd', ':', ...
Context manager which makes a thread specific gDirectory to avoid interfering with the current file. Use cases: A TTree Draw function which doesn't want to interfere with whatever gDirectory happens to be. Multi-threading where there are two threads creating objects with the s...
['Context', 'manager', 'which', 'makes', 'a', 'thread', 'specific', 'gDirectory', 'to', 'avoid', 'interfering', 'with', 'the', 'current', 'file', '.']
train
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/context.py#L120-L142
6,046
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xmlReg.regexpExec
def regexpExec(self, content): """Check if the regular expression generates the value """ ret = libxml2mod.xmlRegexpExec(self._o, content) return ret
python
def regexpExec(self, content): """Check if the regular expression generates the value """ ret = libxml2mod.xmlRegexpExec(self._o, content) return ret
['def', 'regexpExec', '(', 'self', ',', 'content', ')', ':', 'ret', '=', 'libxml2mod', '.', 'xmlRegexpExec', '(', 'self', '.', '_o', ',', 'content', ')', 'return', 'ret']
Check if the regular expression generates the value
['Check', 'if', 'the', 'regular', 'expression', 'generates', 'the', 'value']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L6196-L6199
6,047
rochacbruno/python-pagseguro
pagseguro/__init__.py
PagSeguro.check_notification
def check_notification(self, code): """ check a notification by its code """ response = self.get(url=self.config.NOTIFICATION_URL % code) return PagSeguroNotificationResponse(response.content, self.config)
python
def check_notification(self, code): """ check a notification by its code """ response = self.get(url=self.config.NOTIFICATION_URL % code) return PagSeguroNotificationResponse(response.content, self.config)
['def', 'check_notification', '(', 'self', ',', 'code', ')', ':', 'response', '=', 'self', '.', 'get', '(', 'url', '=', 'self', '.', 'config', '.', 'NOTIFICATION_URL', '%', 'code', ')', 'return', 'PagSeguroNotificationResponse', '(', 'response', '.', 'content', ',', 'self', '.', 'config', ')']
check a notification by its code
['check', 'a', 'notification', 'by', 'its', 'code']
train
https://github.com/rochacbruno/python-pagseguro/blob/18a9ca3301783cb323e838574b59f9ddffa9a593/pagseguro/__init__.py#L232-L235
6,048
ambitioninc/django-db-mutex
db_mutex/db_mutex.py
db_mutex.start
def start(self): """ Acquires the db mutex lock. Takes the necessary steps to delete any stale locks. Throws a DBMutexError if it can't acquire the lock. """ # Delete any expired locks first self.delete_expired_locks() try: with transaction.atomic(): ...
python
def start(self): """ Acquires the db mutex lock. Takes the necessary steps to delete any stale locks. Throws a DBMutexError if it can't acquire the lock. """ # Delete any expired locks first self.delete_expired_locks() try: with transaction.atomic(): ...
['def', 'start', '(', 'self', ')', ':', '# Delete any expired locks first', 'self', '.', 'delete_expired_locks', '(', ')', 'try', ':', 'with', 'transaction', '.', 'atomic', '(', ')', ':', 'self', '.', 'lock', '=', 'DBMutex', '.', 'objects', '.', 'create', '(', 'lock_id', '=', 'self', '.', 'lock_id', ')', 'except', 'Int...
Acquires the db mutex lock. Takes the necessary steps to delete any stale locks. Throws a DBMutexError if it can't acquire the lock.
['Acquires', 'the', 'db', 'mutex', 'lock', '.', 'Takes', 'the', 'necessary', 'steps', 'to', 'delete', 'any', 'stale', 'locks', '.', 'Throws', 'a', 'DBMutexError', 'if', 'it', 'can', 't', 'acquire', 'the', 'lock', '.']
train
https://github.com/ambitioninc/django-db-mutex/blob/7112ed202fa3135afbb280273c1bdc8dee4e8426/db_mutex/db_mutex.py#L98-L109
6,049
blockstack/virtualchain
virtualchain/lib/blockchain/bitcoin_blockchain/bits.py
btc_tx_get_hash
def btc_tx_get_hash( tx_serialized, hashcode=None ): """ Make a transaction hash (txid) from a hex tx, optionally along with a sighash. This DOES NOT WORK for segwit transactions """ if btc_tx_is_segwit(tx_serialized): raise ValueError('Segwit transaction: {}'.format(tx_serialized)) tx_...
python
def btc_tx_get_hash( tx_serialized, hashcode=None ): """ Make a transaction hash (txid) from a hex tx, optionally along with a sighash. This DOES NOT WORK for segwit transactions """ if btc_tx_is_segwit(tx_serialized): raise ValueError('Segwit transaction: {}'.format(tx_serialized)) tx_...
['def', 'btc_tx_get_hash', '(', 'tx_serialized', ',', 'hashcode', '=', 'None', ')', ':', 'if', 'btc_tx_is_segwit', '(', 'tx_serialized', ')', ':', 'raise', 'ValueError', '(', "'Segwit transaction: {}'", '.', 'format', '(', 'tx_serialized', ')', ')', 'tx_bin', '=', 'binascii', '.', 'unhexlify', '(', 'tx_serialized', ')'...
Make a transaction hash (txid) from a hex tx, optionally along with a sighash. This DOES NOT WORK for segwit transactions
['Make', 'a', 'transaction', 'hash', '(', 'txid', ')', 'from', 'a', 'hex', 'tx', 'optionally', 'along', 'with', 'a', 'sighash', '.', 'This', 'DOES', 'NOT', 'WORK', 'for', 'segwit', 'transactions']
train
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/blockchain/bitcoin_blockchain/bits.py#L509-L522
6,050
HumanCellAtlas/dcp-cli
hca/upload/lib/api_client.py
ApiClient.validation_statuses
def validation_statuses(self, area_uuid): """ Get count of validation statuses for all files in upload_area :param str area_uuid: A RFC4122-compliant ID for the upload area :return: a dict with key for each state and value being the count of files in that state :rtype: dict ...
python
def validation_statuses(self, area_uuid): """ Get count of validation statuses for all files in upload_area :param str area_uuid: A RFC4122-compliant ID for the upload area :return: a dict with key for each state and value being the count of files in that state :rtype: dict ...
['def', 'validation_statuses', '(', 'self', ',', 'area_uuid', ')', ':', 'path', '=', '"/area/{uuid}/validations"', '.', 'format', '(', 'uuid', '=', 'area_uuid', ')', 'result', '=', 'self', '.', '_make_request', '(', "'get'", ',', 'path', ')', 'return', 'result', '.', 'json', '(', ')']
Get count of validation statuses for all files in upload_area :param str area_uuid: A RFC4122-compliant ID for the upload area :return: a dict with key for each state and value being the count of files in that state :rtype: dict :raises UploadApiException: if information could not be ob...
['Get', 'count', 'of', 'validation', 'statuses', 'for', 'all', 'files', 'in', 'upload_area']
train
https://github.com/HumanCellAtlas/dcp-cli/blob/cc70817bc4e50944c709eaae160de0bf7a19f0f3/hca/upload/lib/api_client.py#L214-L225
6,051
gwastro/pycbc
pycbc/inference/models/gaussian_noise.py
GaussianNoise._lognl
def _lognl(self): """Computes the log likelihood assuming the data is noise. Since this is a constant for Gaussian noise, this is only computed once then stored. """ try: return self.__lognl except AttributeError: det_lognls = {} for (...
python
def _lognl(self): """Computes the log likelihood assuming the data is noise. Since this is a constant for Gaussian noise, this is only computed once then stored. """ try: return self.__lognl except AttributeError: det_lognls = {} for (...
['def', '_lognl', '(', 'self', ')', ':', 'try', ':', 'return', 'self', '.', '__lognl', 'except', 'AttributeError', ':', 'det_lognls', '=', '{', '}', 'for', '(', 'det', ',', 'd', ')', 'in', 'self', '.', '_data', '.', 'items', '(', ')', ':', 'kmin', '=', 'self', '.', '_kmin', 'kmax', '=', 'self', '.', '_kmax', 'det_lognl...
Computes the log likelihood assuming the data is noise. Since this is a constant for Gaussian noise, this is only computed once then stored.
['Computes', 'the', 'log', 'likelihood', 'assuming', 'the', 'data', 'is', 'noise', '.']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/inference/models/gaussian_noise.py#L284-L300
6,052
scikit-hep/uproot
uproot/rootio.py
TKey.get
def get(self, dismiss=True): """Extract the object this key points to. Objects are not read or decompressed until this function is explicitly called. """ try: return _classof(self._context, self._fClassName).read(self._source, self._cursor.copied(), self._context, self) ...
python
def get(self, dismiss=True): """Extract the object this key points to. Objects are not read or decompressed until this function is explicitly called. """ try: return _classof(self._context, self._fClassName).read(self._source, self._cursor.copied(), self._context, self) ...
['def', 'get', '(', 'self', ',', 'dismiss', '=', 'True', ')', ':', 'try', ':', 'return', '_classof', '(', 'self', '.', '_context', ',', 'self', '.', '_fClassName', ')', '.', 'read', '(', 'self', '.', '_source', ',', 'self', '.', '_cursor', '.', 'copied', '(', ')', ',', 'self', '.', '_context', ',', 'self', ')', 'finall...
Extract the object this key points to. Objects are not read or decompressed until this function is explicitly called.
['Extract', 'the', 'object', 'this', 'key', 'points', 'to', '.']
train
https://github.com/scikit-hep/uproot/blob/fc406827e36ed87cfb1062806e118f53fd3a3b0a/uproot/rootio.py#L883-L893
6,053
rytilahti/python-eq3bt
eq3bt/eq3cli.py
cli
def cli(ctx, mac, debug): """ Tool to query and modify the state of EQ3 BT smart thermostat. """ if debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) thermostat = Thermostat(mac) thermostat.update() ctx.obj = thermostat if ctx.inv...
python
def cli(ctx, mac, debug): """ Tool to query and modify the state of EQ3 BT smart thermostat. """ if debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) thermostat = Thermostat(mac) thermostat.update() ctx.obj = thermostat if ctx.inv...
['def', 'cli', '(', 'ctx', ',', 'mac', ',', 'debug', ')', ':', 'if', 'debug', ':', 'logging', '.', 'basicConfig', '(', 'level', '=', 'logging', '.', 'DEBUG', ')', 'else', ':', 'logging', '.', 'basicConfig', '(', 'level', '=', 'logging', '.', 'INFO', ')', 'thermostat', '=', 'Thermostat', '(', 'mac', ')', 'thermostat', '...
Tool to query and modify the state of EQ3 BT smart thermostat.
['Tool', 'to', 'query', 'and', 'modify', 'the', 'state', 'of', 'EQ3', 'BT', 'smart', 'thermostat', '.']
train
https://github.com/rytilahti/python-eq3bt/blob/595459d9885920cf13b7059a1edd2cf38cede1f0/eq3bt/eq3cli.py#L26-L38
6,054
cognitect/transit-python
transit/decoder.py
Decoder.decode_string
def decode_string(self, string, cache, as_map_key): """Decode a string - arguments follow the same convention as the top-level 'decode' function. """ if is_cache_key(string): return self.parse_string(cache.decode(string, as_map_key), cache...
python
def decode_string(self, string, cache, as_map_key): """Decode a string - arguments follow the same convention as the top-level 'decode' function. """ if is_cache_key(string): return self.parse_string(cache.decode(string, as_map_key), cache...
['def', 'decode_string', '(', 'self', ',', 'string', ',', 'cache', ',', 'as_map_key', ')', ':', 'if', 'is_cache_key', '(', 'string', ')', ':', 'return', 'self', '.', 'parse_string', '(', 'cache', '.', 'decode', '(', 'string', ',', 'as_map_key', ')', ',', 'cache', ',', 'as_map_key', ')', 'if', 'is_cacheable', '(', 'stri...
Decode a string - arguments follow the same convention as the top-level 'decode' function.
['Decode', 'a', 'string', '-', 'arguments', 'follow', 'the', 'same', 'convention', 'as', 'the', 'top', '-', 'level', 'decode', 'function', '.']
train
https://github.com/cognitect/transit-python/blob/59e27e7d322feaa3a7e8eb3de06ae96d8adb614f/transit/decoder.py#L123-L132
6,055
pygobject/pgi
pgi/overrides/__init__.py
strip_boolean_result
def strip_boolean_result(method, exc_type=None, exc_str=None, fail_ret=None): """Translate method's return value for stripping off success flag. There are a lot of methods which return a "success" boolean and have several out arguments. Translate such a method to return the out arguments on success and...
python
def strip_boolean_result(method, exc_type=None, exc_str=None, fail_ret=None): """Translate method's return value for stripping off success flag. There are a lot of methods which return a "success" boolean and have several out arguments. Translate such a method to return the out arguments on success and...
['def', 'strip_boolean_result', '(', 'method', ',', 'exc_type', '=', 'None', ',', 'exc_str', '=', 'None', ',', 'fail_ret', '=', 'None', ')', ':', '@', 'wraps', '(', 'method', ')', 'def', 'wrapped', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'ret', '=', 'method', '(', '*', 'args', ',', '*', '*', 'kwargs', ')',...
Translate method's return value for stripping off success flag. There are a lot of methods which return a "success" boolean and have several out arguments. Translate such a method to return the out arguments on success and None on failure.
['Translate', 'method', 's', 'return', 'value', 'for', 'stripping', 'off', 'success', 'flag', '.']
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/__init__.py#L308-L327
6,056
Azure/azure-cosmos-table-python
azure-cosmosdb-table/azure/cosmosdb/table/_request.py
_merge_entity
def _merge_entity(entity, if_match, require_encryption=False, key_encryption_key=None): ''' Constructs a merge entity request. ''' _validate_not_none('if_match', if_match) _validate_entity(entity) _validate_encryption_unsupported(require_encryption, key_encryption_key) request = HTTPRequest...
python
def _merge_entity(entity, if_match, require_encryption=False, key_encryption_key=None): ''' Constructs a merge entity request. ''' _validate_not_none('if_match', if_match) _validate_entity(entity) _validate_encryption_unsupported(require_encryption, key_encryption_key) request = HTTPRequest...
['def', '_merge_entity', '(', 'entity', ',', 'if_match', ',', 'require_encryption', '=', 'False', ',', 'key_encryption_key', '=', 'None', ')', ':', '_validate_not_none', '(', "'if_match'", ',', 'if_match', ')', '_validate_entity', '(', 'entity', ')', '_validate_encryption_unsupported', '(', 'require_encryption', ',', '...
Constructs a merge entity request.
['Constructs', 'a', 'merge', 'entity', 'request', '.']
train
https://github.com/Azure/azure-cosmos-table-python/blob/a7b618f6bddc465c9fdf899ea2971dfe4d04fcf0/azure-cosmosdb-table/azure/cosmosdb/table/_request.py#L121-L138
6,057
mishbahr/django-usersettings2
usersettings/shortcuts.py
get_usersettings_model
def get_usersettings_model(): """ Returns the ``UserSettings`` model that is active in this project. """ try: from django.apps import apps get_model = apps.get_model except ImportError: from django.db.models.loading import get_model try: app_label, model_name = s...
python
def get_usersettings_model(): """ Returns the ``UserSettings`` model that is active in this project. """ try: from django.apps import apps get_model = apps.get_model except ImportError: from django.db.models.loading import get_model try: app_label, model_name = s...
['def', 'get_usersettings_model', '(', ')', ':', 'try', ':', 'from', 'django', '.', 'apps', 'import', 'apps', 'get_model', '=', 'apps', '.', 'get_model', 'except', 'ImportError', ':', 'from', 'django', '.', 'db', '.', 'models', '.', 'loading', 'import', 'get_model', 'try', ':', 'app_label', ',', 'model_name', '=', 'set...
Returns the ``UserSettings`` model that is active in this project.
['Returns', 'the', 'UserSettings', 'model', 'that', 'is', 'active', 'in', 'this', 'project', '.']
train
https://github.com/mishbahr/django-usersettings2/blob/cbc2f4b2e01d5401bec8a3fa39151730cd2dcd2a/usersettings/shortcuts.py#L5-L24
6,058
AltSchool/dynamic-rest
dynamic_rest/fields/common.py
WithRelationalFieldMixin._get_request_fields_from_parent
def _get_request_fields_from_parent(self): """Get request fields from the parent serializer.""" if not self.parent: return None if not getattr(self.parent, 'request_fields'): return None if not isinstance(self.parent.request_fields, dict): return Non...
python
def _get_request_fields_from_parent(self): """Get request fields from the parent serializer.""" if not self.parent: return None if not getattr(self.parent, 'request_fields'): return None if not isinstance(self.parent.request_fields, dict): return Non...
['def', '_get_request_fields_from_parent', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'parent', ':', 'return', 'None', 'if', 'not', 'getattr', '(', 'self', '.', 'parent', ',', "'request_fields'", ')', ':', 'return', 'None', 'if', 'not', 'isinstance', '(', 'self', '.', 'parent', '.', 'request_fields', ',', 'dict',...
Get request fields from the parent serializer.
['Get', 'request', 'fields', 'from', 'the', 'parent', 'serializer', '.']
train
https://github.com/AltSchool/dynamic-rest/blob/5b0338c3dd8bc638d60c3bb92645857c5b89c920/dynamic_rest/fields/common.py#L6-L17
6,059
csparpa/pyowm
pyowm/weatherapi25/stationhistory.py
StationHistory.to_XML
def to_XML(self, xml_declaration=True, xmlns=True): """ Dumps object fields to an XML-formatted string. The 'xml_declaration' switch enables printing of a leading standard XML line containing XML version and encoding. The 'xmlns' switch enables printing of qualified XMLNS prefix...
python
def to_XML(self, xml_declaration=True, xmlns=True): """ Dumps object fields to an XML-formatted string. The 'xml_declaration' switch enables printing of a leading standard XML line containing XML version and encoding. The 'xmlns' switch enables printing of qualified XMLNS prefix...
['def', 'to_XML', '(', 'self', ',', 'xml_declaration', '=', 'True', ',', 'xmlns', '=', 'True', ')', ':', 'root_node', '=', 'self', '.', '_to_DOM', '(', ')', 'if', 'xmlns', ':', 'xmlutils', '.', 'annotate_with_XMLNS', '(', 'root_node', ',', 'STATION_HISTORY_XMLNS_PREFIX', ',', 'STATION_HISTORY_XMLNS_URL', ')', 'return',...
Dumps object fields to an XML-formatted string. The 'xml_declaration' switch enables printing of a leading standard XML line containing XML version and encoding. The 'xmlns' switch enables printing of qualified XMLNS prefixes. :param XML_declaration: if ``True`` (default) prints a lead...
['Dumps', 'object', 'fields', 'to', 'an', 'XML', '-', 'formatted', 'string', '.', 'The', 'xml_declaration', 'switch', 'enables', 'printing', 'of', 'a', 'leading', 'standard', 'XML', 'line', 'containing', 'XML', 'version', 'and', 'encoding', '.', 'The', 'xmlns', 'switch', 'enables', 'printing', 'of', 'qualified', 'XMLNS...
train
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/weatherapi25/stationhistory.py#L123-L143
6,060
ipfs/py-ipfs-api
ipfsapi/multipart.py
DirectoryStream._prepare
def _prepare(self): """Pre-formats the multipart HTTP request to transmit the directory.""" names = [] added_directories = set() def add_directory(short_path): # Do not continue if this directory has already been added if short_path in added_directories: ...
python
def _prepare(self): """Pre-formats the multipart HTTP request to transmit the directory.""" names = [] added_directories = set() def add_directory(short_path): # Do not continue if this directory has already been added if short_path in added_directories: ...
['def', '_prepare', '(', 'self', ')', ':', 'names', '=', '[', ']', 'added_directories', '=', 'set', '(', ')', 'def', 'add_directory', '(', 'short_path', ')', ':', '# Do not continue if this directory has already been added', 'if', 'short_path', 'in', 'added_directories', ':', 'return', '# Scan for first super-directory...
Pre-formats the multipart HTTP request to transmit the directory.
['Pre', '-', 'formats', 'the', 'multipart', 'HTTP', 'request', 'to', 'transmit', 'the', 'directory', '.']
train
https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L415-L528
6,061
c-w/gutenberg
gutenberg/acquire/metadata.py
MetadataCache.open
def open(self): """Opens an existing cache. """ try: self.graph.open(self.cache_uri, create=False) self._add_namespaces(self.graph) self.is_open = True except Exception: raise InvalidCacheException('The cache is invalid or not created')
python
def open(self): """Opens an existing cache. """ try: self.graph.open(self.cache_uri, create=False) self._add_namespaces(self.graph) self.is_open = True except Exception: raise InvalidCacheException('The cache is invalid or not created')
['def', 'open', '(', 'self', ')', ':', 'try', ':', 'self', '.', 'graph', '.', 'open', '(', 'self', '.', 'cache_uri', ',', 'create', '=', 'False', ')', 'self', '.', '_add_namespaces', '(', 'self', '.', 'graph', ')', 'self', '.', 'is_open', '=', 'True', 'except', 'Exception', ':', 'raise', 'InvalidCacheException', '(', "...
Opens an existing cache.
['Opens', 'an', 'existing', 'cache', '.']
train
https://github.com/c-w/gutenberg/blob/d1ef3da6fba6c3636d452479ed6bcb17c7d4d246/gutenberg/acquire/metadata.py#L61-L70
6,062
ArduPilot/MAVProxy
MAVProxy/modules/lib/grapher.py
MavGraph.show
def show(self, lenmavlist, block=True, xlim_pipe=None): '''show graph''' if xlim_pipe is not None: xlim_pipe[0].close() self.xlim_pipe = xlim_pipe if self.labels is not None: labels = self.labels.split(',') if len(labels) != len(fields)*lenmavlist: ...
python
def show(self, lenmavlist, block=True, xlim_pipe=None): '''show graph''' if xlim_pipe is not None: xlim_pipe[0].close() self.xlim_pipe = xlim_pipe if self.labels is not None: labels = self.labels.split(',') if len(labels) != len(fields)*lenmavlist: ...
['def', 'show', '(', 'self', ',', 'lenmavlist', ',', 'block', '=', 'True', ',', 'xlim_pipe', '=', 'None', ')', ':', 'if', 'xlim_pipe', 'is', 'not', 'None', ':', 'xlim_pipe', '[', '0', ']', '.', 'close', '(', ')', 'self', '.', 'xlim_pipe', '=', 'xlim_pipe', 'if', 'self', '.', 'labels', 'is', 'not', 'None', ':', 'labels'...
show graph
['show', 'graph']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/grapher.py#L482-L523
6,063
Cue/scales
src/greplin/scales/util.py
EWMA.tick
def tick(self): """Updates rates and decays""" count = self._uncounted.getAndSet(0) instantRate = float(count) / self.interval if self._initialized: self.rate += (self.alpha * (instantRate - self.rate)) else: self.rate = instantRate self._initialized = True
python
def tick(self): """Updates rates and decays""" count = self._uncounted.getAndSet(0) instantRate = float(count) / self.interval if self._initialized: self.rate += (self.alpha * (instantRate - self.rate)) else: self.rate = instantRate self._initialized = True
['def', 'tick', '(', 'self', ')', ':', 'count', '=', 'self', '.', '_uncounted', '.', 'getAndSet', '(', '0', ')', 'instantRate', '=', 'float', '(', 'count', ')', '/', 'self', '.', 'interval', 'if', 'self', '.', '_initialized', ':', 'self', '.', 'rate', '+=', '(', 'self', '.', 'alpha', '*', '(', 'instantRate', '-', 'self...
Updates rates and decays
['Updates', 'rates', 'and', 'decays']
train
https://github.com/Cue/scales/blob/0aced26eb050ceb98ee9d5d6cdca8db448666986/src/greplin/scales/util.py#L231-L240
6,064
saltstack/salt
salt/modules/file.py
get_sum
def get_sum(path, form='sha256'): ''' Return the checksum for the given file. The following checksum algorithms are supported: * md5 * sha1 * sha224 * sha256 **(default)** * sha384 * sha512 path path to the file or directory form desired sum format CLI...
python
def get_sum(path, form='sha256'): ''' Return the checksum for the given file. The following checksum algorithms are supported: * md5 * sha1 * sha224 * sha256 **(default)** * sha384 * sha512 path path to the file or directory form desired sum format CLI...
['def', 'get_sum', '(', 'path', ',', 'form', '=', "'sha256'", ')', ':', 'path', '=', 'os', '.', 'path', '.', 'expanduser', '(', 'path', ')', 'if', 'not', 'os', '.', 'path', '.', 'isfile', '(', 'path', ')', ':', 'return', "'File not found'", 'return', 'salt', '.', 'utils', '.', 'hashutils', '.', 'get_hash', '(', 'path',...
Return the checksum for the given file. The following checksum algorithms are supported: * md5 * sha1 * sha224 * sha256 **(default)** * sha384 * sha512 path path to the file or directory form desired sum format CLI Example: .. code-block:: bash s...
['Return', 'the', 'checksum', 'for', 'the', 'given', 'file', '.', 'The', 'following', 'checksum', 'algorithms', 'are', 'supported', ':']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L651-L679
6,065
pkgw/pwkit
pwkit/lmmin.py
Problem.p_side
def p_side(self, idx, sidedness): """Acceptable values for *sidedness* are "auto", "pos", "neg", and "two".""" dsideval = _dside_names.get(sidedness) if dsideval is None: raise ValueError('unrecognized sidedness "%s"' % sidedness) p = self._pinfob p[idx] = (p...
python
def p_side(self, idx, sidedness): """Acceptable values for *sidedness* are "auto", "pos", "neg", and "two".""" dsideval = _dside_names.get(sidedness) if dsideval is None: raise ValueError('unrecognized sidedness "%s"' % sidedness) p = self._pinfob p[idx] = (p...
['def', 'p_side', '(', 'self', ',', 'idx', ',', 'sidedness', ')', ':', 'dsideval', '=', '_dside_names', '.', 'get', '(', 'sidedness', ')', 'if', 'dsideval', 'is', 'None', ':', 'raise', 'ValueError', '(', '\'unrecognized sidedness "%s"\'', '%', 'sidedness', ')', 'p', '=', 'self', '.', '_pinfob', 'p', '[', 'idx', ']', '=...
Acceptable values for *sidedness* are "auto", "pos", "neg", and "two".
['Acceptable', 'values', 'for', '*', 'sidedness', '*', 'are', 'auto', 'pos', 'neg', 'and', 'two', '.']
train
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/lmmin.py#L1397-L1406
6,066
saltstack/salt
salt/modules/container_resource.py
_validate
def _validate(wrapped): ''' Decorator for common function argument validation ''' @functools.wraps(wrapped) def wrapper(*args, **kwargs): container_type = kwargs.get('container_type') exec_driver = kwargs.get('exec_driver') valid_driver = { 'docker': ('lxc-attach'...
python
def _validate(wrapped): ''' Decorator for common function argument validation ''' @functools.wraps(wrapped) def wrapper(*args, **kwargs): container_type = kwargs.get('container_type') exec_driver = kwargs.get('exec_driver') valid_driver = { 'docker': ('lxc-attach'...
['def', '_validate', '(', 'wrapped', ')', ':', '@', 'functools', '.', 'wraps', '(', 'wrapped', ')', 'def', 'wrapper', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'container_type', '=', 'kwargs', '.', 'get', '(', "'container_type'", ')', 'exec_driver', '=', 'kwargs', '.', 'get', '(', "'exec_driver'", ')', 'vali...
Decorator for common function argument validation
['Decorator', 'for', 'common', 'function', 'argument', 'validation']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/container_resource.py#L35-L64
6,067
google/grr
grr/server/grr_response_server/databases/mysql_hunts.py
MySQLDBHuntMixin.ReadHuntObjects
def ReadHuntObjects(self, offset, count, with_creator=None, created_after=None, with_description_match=None, cursor=None): """Reads multiple hunt objects from the database.""" quer...
python
def ReadHuntObjects(self, offset, count, with_creator=None, created_after=None, with_description_match=None, cursor=None): """Reads multiple hunt objects from the database.""" quer...
['def', 'ReadHuntObjects', '(', 'self', ',', 'offset', ',', 'count', ',', 'with_creator', '=', 'None', ',', 'created_after', '=', 'None', ',', 'with_description_match', '=', 'None', ',', 'cursor', '=', 'None', ')', ':', 'query', '=', '"SELECT {columns} FROM hunts "', '.', 'format', '(', 'columns', '=', '_HUNT_COLUMNS_S...
Reads multiple hunt objects from the database.
['Reads', 'multiple', 'hunt', 'objects', 'from', 'the', 'database', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_hunts.py#L222-L254
6,068
faucamp/python-gsmmodem
gsmmodem/modem.py
SentSms.status
def status(self): """ Status of this SMS. Can be ENROUTE, DELIVERED or FAILED The actual status report object may be accessed via the 'report' attribute if status is 'DELIVERED' or 'FAILED' """ if self.report == None: return SentSms.ENROUTE else: ...
python
def status(self): """ Status of this SMS. Can be ENROUTE, DELIVERED or FAILED The actual status report object may be accessed via the 'report' attribute if status is 'DELIVERED' or 'FAILED' """ if self.report == None: return SentSms.ENROUTE else: ...
['def', 'status', '(', 'self', ')', ':', 'if', 'self', '.', 'report', '==', 'None', ':', 'return', 'SentSms', '.', 'ENROUTE', 'else', ':', 'return', 'SentSms', '.', 'DELIVERED', 'if', 'self', '.', 'report', '.', 'deliveryStatus', '==', 'StatusReport', '.', 'DELIVERED', 'else', 'SentSms', '.', 'FAILED']
Status of this SMS. Can be ENROUTE, DELIVERED or FAILED The actual status report object may be accessed via the 'report' attribute if status is 'DELIVERED' or 'FAILED'
['Status', 'of', 'this', 'SMS', '.', 'Can', 'be', 'ENROUTE', 'DELIVERED', 'or', 'FAILED', 'The', 'actual', 'status', 'report', 'object', 'may', 'be', 'accessed', 'via', 'the', 'report', 'attribute', 'if', 'status', 'is', 'DELIVERED', 'or', 'FAILED']
train
https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L76-L85
6,069
iotile/coretools
iotilebuild/iotile/build/dev/resolverchain.py
DependencyResolverChain.update_dependency
def update_dependency(self, tile, depinfo, destdir=None): """Attempt to install or update a dependency to the latest version. Args: tile (IOTile): An IOTile object describing the tile that has the dependency depinfo (dict): a dictionary from tile.dependencies specifying the depe...
python
def update_dependency(self, tile, depinfo, destdir=None): """Attempt to install or update a dependency to the latest version. Args: tile (IOTile): An IOTile object describing the tile that has the dependency depinfo (dict): a dictionary from tile.dependencies specifying the depe...
['def', 'update_dependency', '(', 'self', ',', 'tile', ',', 'depinfo', ',', 'destdir', '=', 'None', ')', ':', 'if', 'destdir', 'is', 'None', ':', 'destdir', '=', 'os', '.', 'path', '.', 'join', '(', 'tile', '.', 'folder', ',', "'build'", ',', "'deps'", ',', 'depinfo', '[', "'unique_id'", ']', ')', 'has_version', '=', '...
Attempt to install or update a dependency to the latest version. Args: tile (IOTile): An IOTile object describing the tile that has the dependency depinfo (dict): a dictionary from tile.dependencies specifying the dependency destdir (string): An optional folder into which to...
['Attempt', 'to', 'install', 'or', 'update', 'a', 'dependency', 'to', 'the', 'latest', 'version', '.']
train
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/dev/resolverchain.py#L108-L176
6,070
mitsei/dlkit
dlkit/json_/osid/metadata.py
Metadata.supports_coordinate_type
def supports_coordinate_type(self, coordinate_type): """Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax i...
python
def supports_coordinate_type(self, coordinate_type): """Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax i...
['def', 'supports_coordinate_type', '(', 'self', ',', 'coordinate_type', ')', ':', '# Implemented from template for osid.Metadata.supports_coordinate_type', 'if', 'self', '.', '_kwargs', '[', "'syntax'", ']', 'not', 'in', '[', "'``COORDINATE``'", ']', ':', 'raise', 'errors', '.', 'IllegalState', '(', ')', 'return', 'co...
Tests if the given coordinate type is supported. arg: coordinate_type (osid.type.Type): a coordinate Type return: (boolean) - ``true`` if the type is supported, ``false`` otherwise raise: IllegalState - syntax is not a ``COORDINATE`` raise: NullArgument - ``coordina...
['Tests', 'if', 'the', 'given', 'coordinate', 'type', 'is', 'supported', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/metadata.py#L304-L318
6,071
wangsix/vmo
vmo/analysis/analysis.py
_query_init
def _query_init(k, oracle, query, method='all'): """A helper function for query-matching function initialization.""" if method == 'all': a = np.subtract(query, [oracle.f_array[t] for t in oracle.latent[oracle.data[k]]]) dvec = (a * a).sum(axis=1) # Could skip the sqrt _d = dvec.argmin()...
python
def _query_init(k, oracle, query, method='all'): """A helper function for query-matching function initialization.""" if method == 'all': a = np.subtract(query, [oracle.f_array[t] for t in oracle.latent[oracle.data[k]]]) dvec = (a * a).sum(axis=1) # Could skip the sqrt _d = dvec.argmin()...
['def', '_query_init', '(', 'k', ',', 'oracle', ',', 'query', ',', 'method', '=', "'all'", ')', ':', 'if', 'method', '==', "'all'", ':', 'a', '=', 'np', '.', 'subtract', '(', 'query', ',', '[', 'oracle', '.', 'f_array', '[', 't', ']', 'for', 't', 'in', 'oracle', '.', 'latent', '[', 'oracle', '.', 'data', '[', 'k', ']',...
A helper function for query-matching function initialization.
['A', 'helper', 'function', 'for', 'query', '-', 'matching', 'function', 'initialization', '.']
train
https://github.com/wangsix/vmo/blob/bb1cc4cf1f33f0bb49e38c91126c1be1a0cdd09d/vmo/analysis/analysis.py#L449-L460
6,072
chimera0/accel-brain-code
Reinforcement-Learning/pyqlearning/annealing_model.py
AnnealingModel.set_var_arr
def set_var_arr(self, value): ''' setter ''' if isinstance(value, np.ndarray): self.__var_arr = value else: raise TypeError()
python
def set_var_arr(self, value): ''' setter ''' if isinstance(value, np.ndarray): self.__var_arr = value else: raise TypeError()
['def', 'set_var_arr', '(', 'self', ',', 'value', ')', ':', 'if', 'isinstance', '(', 'value', ',', 'np', '.', 'ndarray', ')', ':', 'self', '.', '__var_arr', '=', 'value', 'else', ':', 'raise', 'TypeError', '(', ')']
setter
['setter']
train
https://github.com/chimera0/accel-brain-code/blob/03661f6f544bed656269fcd4b3c23c9061629daa/Reinforcement-Learning/pyqlearning/annealing_model.py#L92-L97
6,073
DLR-RM/RAFCON
source/rafcon/gui/mygaphas/items/state.py
StateView._calculate_port_pos_on_line
def _calculate_port_pos_on_line(self, port_num, side_length, port_width=None): """Calculate the position of a port on a line The position depends on the number of element. Elements are equally spaced. If the end of the line is reached, ports are stacked. :param int port_num: The number ...
python
def _calculate_port_pos_on_line(self, port_num, side_length, port_width=None): """Calculate the position of a port on a line The position depends on the number of element. Elements are equally spaced. If the end of the line is reached, ports are stacked. :param int port_num: The number ...
['def', '_calculate_port_pos_on_line', '(', 'self', ',', 'port_num', ',', 'side_length', ',', 'port_width', '=', 'None', ')', ':', 'if', 'port_width', 'is', 'None', ':', 'port_width', '=', '2', '*', 'self', '.', 'border_width', 'border_size', '=', 'self', '.', 'border_width', 'pos', '=', '0.5', '*', 'border_size', '+',...
Calculate the position of a port on a line The position depends on the number of element. Elements are equally spaced. If the end of the line is reached, ports are stacked. :param int port_num: The number of the port of that type :param float side_length: The length of the side the elem...
['Calculate', 'the', 'position', 'of', 'a', 'port', 'on', 'a', 'line']
train
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/items/state.py#L796-L813
6,074
yougov/pmxbot
pmxbot/core.py
Handler._set_implied_name
def _set_implied_name(self): "Allow the name of this handler to default to the function name." if getattr(self, 'name', None) is None: self.name = self.func.__name__ self.name = self.name.lower()
python
def _set_implied_name(self): "Allow the name of this handler to default to the function name." if getattr(self, 'name', None) is None: self.name = self.func.__name__ self.name = self.name.lower()
['def', '_set_implied_name', '(', 'self', ')', ':', 'if', 'getattr', '(', 'self', ',', "'name'", ',', 'None', ')', 'is', 'None', ':', 'self', '.', 'name', '=', 'self', '.', 'func', '.', '__name__', 'self', '.', 'name', '=', 'self', '.', 'name', '.', 'lower', '(', ')']
Allow the name of this handler to default to the function name.
['Allow', 'the', 'name', 'of', 'this', 'handler', 'to', 'default', 'to', 'the', 'function', 'name', '.']
train
https://github.com/yougov/pmxbot/blob/5da84a3258a0fd73cb35b60e39769a5d7bfb2ba7/pmxbot/core.py#L181-L185
6,075
senaite/senaite.core
bika/lims/browser/analyses/view.py
AnalysesView.is_analysis_instrument_valid
def is_analysis_instrument_valid(self, analysis_brain): """Return if the analysis has a valid instrument. If the analysis passed in is from ReferenceAnalysis type or does not have an instrument assigned, returns True :param analysis_brain: Brain that represents an analysis :ret...
python
def is_analysis_instrument_valid(self, analysis_brain): """Return if the analysis has a valid instrument. If the analysis passed in is from ReferenceAnalysis type or does not have an instrument assigned, returns True :param analysis_brain: Brain that represents an analysis :ret...
['def', 'is_analysis_instrument_valid', '(', 'self', ',', 'analysis_brain', ')', ':', 'if', 'analysis_brain', '.', 'meta_type', '==', "'ReferenceAnalysis'", ':', '# If this is a ReferenceAnalysis, there is no need to check the', '# validity of the instrument, because this is a QC analysis and by', '# definition, it has...
Return if the analysis has a valid instrument. If the analysis passed in is from ReferenceAnalysis type or does not have an instrument assigned, returns True :param analysis_brain: Brain that represents an analysis :return: True if the instrument assigned is valid or is None
['Return', 'if', 'the', 'analysis', 'has', 'a', 'valid', 'instrument', '.']
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/analyses/view.py#L348-L363
6,076
UCL-INGI/INGInious
inginious/common/tags.py
Tag.create_tags_from_dict
def create_tags_from_dict(cls, tag_dict): """ Build a tuple of list of Tag objects based on the tag_dict. The tuple contains 3 lists. - The first list contains skill tags - The second list contains misconception tags - The third list contains category...
python
def create_tags_from_dict(cls, tag_dict): """ Build a tuple of list of Tag objects based on the tag_dict. The tuple contains 3 lists. - The first list contains skill tags - The second list contains misconception tags - The third list contains category...
['def', 'create_tags_from_dict', '(', 'cls', ',', 'tag_dict', ')', ':', 'tag_list_common', '=', '[', ']', 'tag_list_misconception', '=', '[', ']', 'tag_list_organisational', '=', '[', ']', 'for', 'tag', 'in', 'tag_dict', ':', 'try', ':', 'id', '=', 'tag_dict', '[', 'tag', ']', '[', '"id"', ']', 'name', '=', 'tag_dict',...
Build a tuple of list of Tag objects based on the tag_dict. The tuple contains 3 lists. - The first list contains skill tags - The second list contains misconception tags - The third list contains category tags
['Build', 'a', 'tuple', 'of', 'list', 'of', 'Tag', 'objects', 'based', 'on', 'the', 'tag_dict', '.', 'The', 'tuple', 'contains', '3', 'lists', '.', '-', 'The', 'first', 'list', 'contains', 'skill', 'tags', '-', 'The', 'second', 'list', 'contains', 'misconception', 'tags', '-', 'The', 'third', 'list', 'contains', 'categ...
train
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/tags.py#L73-L100
6,077
Alignak-monitoring/alignak
alignak/daterange.py
AbstractDaterange.get_min_from_t
def get_min_from_t(self, timestamp): """Get next time from t where a timerange is valid (withing range) :param timestamp: base time to look for the next one :return: time where a timerange is valid :rtype: int """ if self.is_time_valid(timestamp): return time...
python
def get_min_from_t(self, timestamp): """Get next time from t where a timerange is valid (withing range) :param timestamp: base time to look for the next one :return: time where a timerange is valid :rtype: int """ if self.is_time_valid(timestamp): return time...
['def', 'get_min_from_t', '(', 'self', ',', 'timestamp', ')', ':', 'if', 'self', '.', 'is_time_valid', '(', 'timestamp', ')', ':', 'return', 'timestamp', 't_day_epoch', '=', 'get_day', '(', 'timestamp', ')', 'tr_mins', '=', 'self', '.', 'get_min_sec_from_morning', '(', ')', 'return', 't_day_epoch', '+', 'tr_mins']
Get next time from t where a timerange is valid (withing range) :param timestamp: base time to look for the next one :return: time where a timerange is valid :rtype: int
['Get', 'next', 'time', 'from', 't', 'where', 'a', 'timerange', 'is', 'valid', '(', 'withing', 'range', ')']
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daterange.py#L415-L426
6,078
sorgerlab/indra
indra/preassembler/hierarchy_manager.py
HierarchyManager.get_parents
def get_parents(self, uri, type='all'): """Return parents of a given entry. Parameters ---------- uri : str The URI of the entry whose parents are to be returned. See the get_uri method to construct this URI from a name space and id. type : str ...
python
def get_parents(self, uri, type='all'): """Return parents of a given entry. Parameters ---------- uri : str The URI of the entry whose parents are to be returned. See the get_uri method to construct this URI from a name space and id. type : str ...
['def', 'get_parents', '(', 'self', ',', 'uri', ',', 'type', '=', "'all'", ')', ':', '# First do a quick dict lookup to see if there are any parents', 'all_parents', '=', 'set', '(', 'self', '.', 'isa_or_partof_closure', '.', 'get', '(', 'uri', ',', '[', ']', ')', ')', '# If there are no parents or we are looking for a...
Return parents of a given entry. Parameters ---------- uri : str The URI of the entry whose parents are to be returned. See the get_uri method to construct this URI from a name space and id. type : str 'all': return all parents irrespective of level; ...
['Return', 'parents', 'of', 'a', 'given', 'entry', '.']
train
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L411-L439
6,079
cds-astro/mocpy
mocpy/tmoc/tmoc.py
TimeMOC.from_time_ranges
def from_time_ranges(cls, min_times, max_times, delta_t=DEFAULT_OBSERVATION_TIME): """ Create a TimeMOC from a range defined by two `astropy.time.Time` Parameters ---------- min_times : `astropy.time.Time` astropy times defining the left part of the intervals ...
python
def from_time_ranges(cls, min_times, max_times, delta_t=DEFAULT_OBSERVATION_TIME): """ Create a TimeMOC from a range defined by two `astropy.time.Time` Parameters ---------- min_times : `astropy.time.Time` astropy times defining the left part of the intervals ...
['def', 'from_time_ranges', '(', 'cls', ',', 'min_times', ',', 'max_times', ',', 'delta_t', '=', 'DEFAULT_OBSERVATION_TIME', ')', ':', 'min_times_arr', '=', 'np', '.', 'asarray', '(', 'min_times', '.', 'jd', '*', 'TimeMOC', '.', 'DAY_MICRO_SEC', ',', 'dtype', '=', 'int', ')', 'max_times_arr', '=', 'np', '.', 'asarray',...
Create a TimeMOC from a range defined by two `astropy.time.Time` Parameters ---------- min_times : `astropy.time.Time` astropy times defining the left part of the intervals max_times : `astropy.time.Time` astropy times defining the right part of the intervals ...
['Create', 'a', 'TimeMOC', 'from', 'a', 'range', 'defined', 'by', 'two', 'astropy', '.', 'time', '.', 'Time']
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/tmoc/tmoc.py#L56-L82
6,080
Genida/django-appsettings
src/appsettings/settings.py
Setting.default_value
def default_value(self): """ Property to return the default value. If the default value is callable and call_default is True, return the result of default(). Else return default. Returns: object: the default value. """ if callable(self.default) and s...
python
def default_value(self): """ Property to return the default value. If the default value is callable and call_default is True, return the result of default(). Else return default. Returns: object: the default value. """ if callable(self.default) and s...
['def', 'default_value', '(', 'self', ')', ':', 'if', 'callable', '(', 'self', '.', 'default', ')', 'and', 'self', '.', 'call_default', ':', 'return', 'self', '.', 'default', '(', ')', 'return', 'self', '.', 'default']
Property to return the default value. If the default value is callable and call_default is True, return the result of default(). Else return default. Returns: object: the default value.
['Property', 'to', 'return', 'the', 'default', 'value', '.']
train
https://github.com/Genida/django-appsettings/blob/f98867d133558af7dc067f12b44fc1ee4edd4239/src/appsettings/settings.py#L446-L458
6,081
diffeo/rejester
rejester/_task_master.py
TaskMaster.get_work_unit_status
def get_work_unit_status(self, work_spec_name, work_unit_key): '''Get a high-level status for some work unit. The return value is a dictionary. The only required key is ``status``, which could be any of: ``missing`` The work unit does not exist anywhere ``available``...
python
def get_work_unit_status(self, work_spec_name, work_unit_key): '''Get a high-level status for some work unit. The return value is a dictionary. The only required key is ``status``, which could be any of: ``missing`` The work unit does not exist anywhere ``available``...
['def', 'get_work_unit_status', '(', 'self', ',', 'work_spec_name', ',', 'work_unit_key', ')', ':', 'with', 'self', '.', 'registry', '.', 'lock', '(', 'identifier', '=', 'self', '.', 'worker_id', ')', 'as', 'session', ':', '# In the available list?', '(', 'unit', ',', 'priority', ')', '=', 'session', '.', 'get', '(', '...
Get a high-level status for some work unit. The return value is a dictionary. The only required key is ``status``, which could be any of: ``missing`` The work unit does not exist anywhere ``available`` The work unit is available for new workers; additional ...
['Get', 'a', 'high', '-', 'level', 'status', 'for', 'some', 'work', 'unit', '.']
train
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1249-L1319
6,082
gregmuellegger/django-superform
django_superform/fields.py
ModelFormField.shall_save
def shall_save(self, form, name, composite_form): """ Return ``True`` if the given ``composite_form`` (the nested form of this field) shall be saved. Return ``False`` if the form shall not be saved together with the super-form. By default it will return ``False`` if the form was...
python
def shall_save(self, form, name, composite_form): """ Return ``True`` if the given ``composite_form`` (the nested form of this field) shall be saved. Return ``False`` if the form shall not be saved together with the super-form. By default it will return ``False`` if the form was...
['def', 'shall_save', '(', 'self', ',', 'form', ',', 'name', ',', 'composite_form', ')', ':', 'if', 'composite_form', '.', 'empty_permitted', 'and', 'not', 'composite_form', '.', 'has_changed', '(', ')', ':', 'return', 'False', 'return', 'True']
Return ``True`` if the given ``composite_form`` (the nested form of this field) shall be saved. Return ``False`` if the form shall not be saved together with the super-form. By default it will return ``False`` if the form was not changed and the ``empty_permitted`` argument for the form...
['Return', 'True', 'if', 'the', 'given', 'composite_form', '(', 'the', 'nested', 'form', 'of', 'this', 'field', ')', 'shall', 'be', 'saved', '.', 'Return', 'False', 'if', 'the', 'form', 'shall', 'not', 'be', 'saved', 'together', 'with', 'the', 'super', '-', 'form', '.']
train
https://github.com/gregmuellegger/django-superform/blob/5f389911ad38932b6dad184cc7fa81f27db752f9/django_superform/fields.py#L253-L265
6,083
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
animate_2Dscatter
def animate_2Dscatter(x, y, NumAnimatedPoints=50, NTrailPoints=20, xlabel="", ylabel="", xlims=None, ylims=None, filename="testAnim.mp4", bitrate=1e5, dpi=5e2, fps=30, figsize = [6, 6]): """ Animates x and y - where x and y are 1d arrays of x and y positions and it plots x[i:i+NTrailPoints] a...
python
def animate_2Dscatter(x, y, NumAnimatedPoints=50, NTrailPoints=20, xlabel="", ylabel="", xlims=None, ylims=None, filename="testAnim.mp4", bitrate=1e5, dpi=5e2, fps=30, figsize = [6, 6]): """ Animates x and y - where x and y are 1d arrays of x and y positions and it plots x[i:i+NTrailPoints] a...
['def', 'animate_2Dscatter', '(', 'x', ',', 'y', ',', 'NumAnimatedPoints', '=', '50', ',', 'NTrailPoints', '=', '20', ',', 'xlabel', '=', '""', ',', 'ylabel', '=', '""', ',', 'xlims', '=', 'None', ',', 'ylims', '=', 'None', ',', 'filename', '=', '"testAnim.mp4"', ',', 'bitrate', '=', '1e5', ',', 'dpi', '=', '5e2', ',',...
Animates x and y - where x and y are 1d arrays of x and y positions and it plots x[i:i+NTrailPoints] and y[i:i+NTrailPoints] against each other and iterates through i.
['Animates', 'x', 'and', 'y', '-', 'where', 'x', 'and', 'y', 'are', '1d', 'arrays', 'of', 'x', 'and', 'y', 'positions', 'and', 'it', 'plots', 'x', '[', 'i', ':', 'i', '+', 'NTrailPoints', ']', 'and', 'y', '[', 'i', ':', 'i', '+', 'NTrailPoints', ']', 'against', 'each', 'other', 'and', 'iterates', 'through', 'i', '.']
train
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2605-L2651
6,084
Apitax/Apitax
apitax/api/controllers/migrations/scriptax_controller.py
get_driver_script
def get_driver_script(name, name2=None): # noqa: E501 """Retrieve the contents of a script Retrieve the contents of a script # noqa: E501 :param name2: Get status of a driver with this name :type name2: str :param name: The script name. :type name: str :rtype: Response """ respon...
python
def get_driver_script(name, name2=None): # noqa: E501 """Retrieve the contents of a script Retrieve the contents of a script # noqa: E501 :param name2: Get status of a driver with this name :type name2: str :param name: The script name. :type name: str :rtype: Response """ respon...
['def', 'get_driver_script', '(', 'name', ',', 'name2', '=', 'None', ')', ':', '# noqa: E501', 'response', '=', 'errorIfUnauthorized', '(', 'role', '=', "'user'", ')', 'if', 'response', ':', 'return', 'response', 'else', ':', 'response', '=', 'ApitaxResponse', '(', ')', 'print', '(', 'name', ')', 'print', '(', 'name2',...
Retrieve the contents of a script Retrieve the contents of a script # noqa: E501 :param name2: Get status of a driver with this name :type name2: str :param name: The script name. :type name: str :rtype: Response
['Retrieve', 'the', 'contents', 'of', 'a', 'script']
train
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/migrations/scriptax_controller.py#L76-L102
6,085
materialsproject/pymatgen
pymatgen/analysis/reaction_calculator.py
BalancedReaction.normalize_to
def normalize_to(self, comp, factor=1): """ Normalizes the reaction to one of the compositions. By default, normalizes such that the composition given has a coefficient of 1. Another factor can be specified. Args: comp (Composition): Composition to normalize to ...
python
def normalize_to(self, comp, factor=1): """ Normalizes the reaction to one of the compositions. By default, normalizes such that the composition given has a coefficient of 1. Another factor can be specified. Args: comp (Composition): Composition to normalize to ...
['def', 'normalize_to', '(', 'self', ',', 'comp', ',', 'factor', '=', '1', ')', ':', 'scale_factor', '=', 'abs', '(', '1', '/', 'self', '.', '_coeffs', '[', 'self', '.', '_all_comp', '.', 'index', '(', 'comp', ')', ']', '*', 'factor', ')', 'self', '.', '_coeffs', '=', '[', 'c', '*', 'scale_factor', 'for', 'c', 'in', 's...
Normalizes the reaction to one of the compositions. By default, normalizes such that the composition given has a coefficient of 1. Another factor can be specified. Args: comp (Composition): Composition to normalize to factor (float): Factor to normalize to. Defaults to 1...
['Normalizes', 'the', 'reaction', 'to', 'one', 'of', 'the', 'compositions', '.', 'By', 'default', 'normalizes', 'such', 'that', 'the', 'composition', 'given', 'has', 'a', 'coefficient', 'of', '1', '.', 'Another', 'factor', 'can', 'be', 'specified', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L94-L106
6,086
twisted/axiom
axiom/store.py
Store.createSQL
def createSQL(self, sql, args=()): """ For use with auto-committing statements such as CREATE TABLE or CREATE INDEX. """ before = time.time() self._execSQL(sql, args) after = time.time() if after - before > 2.0: log.msg('Extremely long CREATE: ...
python
def createSQL(self, sql, args=()): """ For use with auto-committing statements such as CREATE TABLE or CREATE INDEX. """ before = time.time() self._execSQL(sql, args) after = time.time() if after - before > 2.0: log.msg('Extremely long CREATE: ...
['def', 'createSQL', '(', 'self', ',', 'sql', ',', 'args', '=', '(', ')', ')', ':', 'before', '=', 'time', '.', 'time', '(', ')', 'self', '.', '_execSQL', '(', 'sql', ',', 'args', ')', 'after', '=', 'time', '.', 'time', '(', ')', 'if', 'after', '-', 'before', '>', '2.0', ':', 'log', '.', 'msg', '(', "'Extremely long CR...
For use with auto-committing statements such as CREATE TABLE or CREATE INDEX.
['For', 'use', 'with', 'auto', '-', 'committing', 'statements', 'such', 'as', 'CREATE', 'TABLE', 'or', 'CREATE', 'INDEX', '.']
train
https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2360-L2370
6,087
molmod/molmod
molmod/graphs.py
GraphSearch._iter_candidate_groups
def _iter_candidate_groups(self, init_match, edges0, edges1): """Divide the edges into groups""" # collect all end vertices0 and end vertices1 that belong to the same # group. sources = {} for start_vertex0, end_vertex0 in edges0: l = sources.setdefault(start_vertex0,...
python
def _iter_candidate_groups(self, init_match, edges0, edges1): """Divide the edges into groups""" # collect all end vertices0 and end vertices1 that belong to the same # group. sources = {} for start_vertex0, end_vertex0 in edges0: l = sources.setdefault(start_vertex0,...
['def', '_iter_candidate_groups', '(', 'self', ',', 'init_match', ',', 'edges0', ',', 'edges1', ')', ':', '# collect all end vertices0 and end vertices1 that belong to the same', '# group.', 'sources', '=', '{', '}', 'for', 'start_vertex0', ',', 'end_vertex0', 'in', 'edges0', ':', 'l', '=', 'sources', '.', 'setdefault'...
Divide the edges into groups
['Divide', 'the', 'edges', 'into', 'groups']
train
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/graphs.py#L1597-L1612
6,088
philgyford/django-spectator
spectator/core/utils.py
chartify
def chartify(qs, score_field, cutoff=0, ensure_chartiness=True): """ Given a QuerySet it will go through and add a `chart_position` property to each object returning a list of the objects. If adjacent objects have the same 'score' (based on `score_field`) then they will have the same `chart_positio...
python
def chartify(qs, score_field, cutoff=0, ensure_chartiness=True): """ Given a QuerySet it will go through and add a `chart_position` property to each object returning a list of the objects. If adjacent objects have the same 'score' (based on `score_field`) then they will have the same `chart_positio...
['def', 'chartify', '(', 'qs', ',', 'score_field', ',', 'cutoff', '=', '0', ',', 'ensure_chartiness', '=', 'True', ')', ':', 'chart', '=', '[', ']', 'position', '=', '0', 'prev_obj', '=', 'None', 'for', 'counter', ',', 'obj', 'in', 'enumerate', '(', 'qs', ')', ':', 'score', '=', 'getattr', '(', 'obj', ',', 'score_field...
Given a QuerySet it will go through and add a `chart_position` property to each object returning a list of the objects. If adjacent objects have the same 'score' (based on `score_field`) then they will have the same `chart_position`. This can then be used in templates for the `value` of <li> elements i...
['Given', 'a', 'QuerySet', 'it', 'will', 'go', 'through', 'and', 'add', 'a', 'chart_position', 'property', 'to', 'each', 'object', 'returning', 'a', 'list', 'of', 'the', 'objects', '.']
train
https://github.com/philgyford/django-spectator/blob/f3c72004f9caa1fde0f5a3b2f0d2bf285fc01ada/spectator/core/utils.py#L28-L71
6,089
openid/python-openid
openid/consumer/discover.py
findOPLocalIdentifier
def findOPLocalIdentifier(service_element, type_uris): """Find the OP-Local Identifier for this xrd:Service element. This considers openid:Delegate to be a synonym for xrd:LocalID if both OpenID 1.X and OpenID 2.0 types are present. If only OpenID 1.X is present, it returns the value of openid:Delegate...
python
def findOPLocalIdentifier(service_element, type_uris): """Find the OP-Local Identifier for this xrd:Service element. This considers openid:Delegate to be a synonym for xrd:LocalID if both OpenID 1.X and OpenID 2.0 types are present. If only OpenID 1.X is present, it returns the value of openid:Delegate...
['def', 'findOPLocalIdentifier', '(', 'service_element', ',', 'type_uris', ')', ':', '# XXX: Test this function on its own!', '# Build the list of tags that could contain the OP-Local Identifier', 'local_id_tags', '=', '[', ']', 'if', '(', 'OPENID_1_1_TYPE', 'in', 'type_uris', 'or', 'OPENID_1_0_TYPE', 'in', 'type_uris'...
Find the OP-Local Identifier for this xrd:Service element. This considers openid:Delegate to be a synonym for xrd:LocalID if both OpenID 1.X and OpenID 2.0 types are present. If only OpenID 1.X is present, it returns the value of openid:Delegate. If only OpenID 2.0 is present, it returns the value of x...
['Find', 'the', 'OP', '-', 'Local', 'Identifier', 'for', 'this', 'xrd', ':', 'Service', 'element', '.']
train
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/discover.py#L253-L301
6,090
DataBiosphere/toil
src/toil/__init__.py
lookupEnvVar
def lookupEnvVar(name, envName, defaultValue): """ Use this for looking up environment variables that control Toil and are important enough to log the result of that lookup. :param str name: the human readable name of the variable :param str envName: the name of the environment variable to lookup ...
python
def lookupEnvVar(name, envName, defaultValue): """ Use this for looking up environment variables that control Toil and are important enough to log the result of that lookup. :param str name: the human readable name of the variable :param str envName: the name of the environment variable to lookup ...
['def', 'lookupEnvVar', '(', 'name', ',', 'envName', ',', 'defaultValue', ')', ':', 'try', ':', 'value', '=', 'os', '.', 'environ', '[', 'envName', ']', 'except', 'KeyError', ':', 'log', '.', 'info', '(', "'Using default %s of %s as %s is not set.'", ',', 'name', ',', 'defaultValue', ',', 'envName', ')', 'return', 'def...
Use this for looking up environment variables that control Toil and are important enough to log the result of that lookup. :param str name: the human readable name of the variable :param str envName: the name of the environment variable to lookup :param str defaultValue: the fall-back value :return...
['Use', 'this', 'for', 'looking', 'up', 'environment', 'variables', 'that', 'control', 'Toil', 'and', 'are', 'important', 'enough', 'to', 'log', 'the', 'result', 'of', 'that', 'lookup', '.']
train
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/__init__.py#L236-L254
6,091
merll/docker-map
dockermap/client/docker_util.py
DockerUtilityMixin.build_from_file
def build_from_file(self, dockerfile, tag, **kwargs): """ Builds a docker image from the given :class:`~dockermap.build.dockerfile.DockerFile`. Use this as a shortcut to :meth:`build_from_context`, if no extra data is added to the context. :param dockerfile: An instance of :class:`~dock...
python
def build_from_file(self, dockerfile, tag, **kwargs): """ Builds a docker image from the given :class:`~dockermap.build.dockerfile.DockerFile`. Use this as a shortcut to :meth:`build_from_context`, if no extra data is added to the context. :param dockerfile: An instance of :class:`~dock...
['def', 'build_from_file', '(', 'self', ',', 'dockerfile', ',', 'tag', ',', '*', '*', 'kwargs', ')', ':', 'with', 'DockerContext', '(', 'dockerfile', ',', 'finalize', '=', 'True', ')', 'as', 'ctx', ':', 'return', 'self', '.', 'build_from_context', '(', 'ctx', ',', 'tag', ',', '*', '*', 'kwargs', ')']
Builds a docker image from the given :class:`~dockermap.build.dockerfile.DockerFile`. Use this as a shortcut to :meth:`build_from_context`, if no extra data is added to the context. :param dockerfile: An instance of :class:`~dockermap.build.dockerfile.DockerFile`. :type dockerfile: dockermap.bu...
['Builds', 'a', 'docker', 'image', 'from', 'the', 'given', ':', 'class', ':', '~dockermap', '.', 'build', '.', 'dockerfile', '.', 'DockerFile', '.', 'Use', 'this', 'as', 'a', 'shortcut', 'to', ':', 'meth', ':', 'build_from_context', 'if', 'no', 'extra', 'data', 'is', 'added', 'to', 'the', 'context', '.']
train
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/docker_util.py#L142-L156
6,092
quantmind/pulsar
pulsar/utils/config.py
Config.update
def update(self, data, default=False): """Update this :attr:`Config` with ``data``. :param data: must be a ``Mapping`` like object exposing the ``item`` method for iterating through key-value pairs. :param default: if ``True`` the updated :attr:`settings` will also set t...
python
def update(self, data, default=False): """Update this :attr:`Config` with ``data``. :param data: must be a ``Mapping`` like object exposing the ``item`` method for iterating through key-value pairs. :param default: if ``True`` the updated :attr:`settings` will also set t...
['def', 'update', '(', 'self', ',', 'data', ',', 'default', '=', 'False', ')', ':', 'for', 'name', ',', 'value', 'in', 'data', '.', 'items', '(', ')', ':', 'if', 'value', 'is', 'not', 'None', ':', 'self', '.', 'set', '(', 'name', ',', 'value', ',', 'default', ')']
Update this :attr:`Config` with ``data``. :param data: must be a ``Mapping`` like object exposing the ``item`` method for iterating through key-value pairs. :param default: if ``True`` the updated :attr:`settings` will also set their :attr:`~Setting.default` attribute with the ...
['Update', 'this', ':', 'attr', ':', 'Config', 'with', 'data', '.']
train
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/utils/config.py#L184-L195
6,093
miLibris/flask-rest-jsonapi
flask_rest_jsonapi/querystring.py
QueryStringManager.filters
def filters(self): """Return filters from query string. :return list: filter information """ results = [] filters = self.qs.get('filter') if filters is not None: try: results.extend(json.loads(filters)) except (ValueError, TypeErro...
python
def filters(self): """Return filters from query string. :return list: filter information """ results = [] filters = self.qs.get('filter') if filters is not None: try: results.extend(json.loads(filters)) except (ValueError, TypeErro...
['def', 'filters', '(', 'self', ')', ':', 'results', '=', '[', ']', 'filters', '=', 'self', '.', 'qs', '.', 'get', '(', "'filter'", ')', 'if', 'filters', 'is', 'not', 'None', ':', 'try', ':', 'results', '.', 'extend', '(', 'json', '.', 'loads', '(', 'filters', ')', ')', 'except', '(', 'ValueError', ',', 'TypeError', ')...
Return filters from query string. :return list: filter information
['Return', 'filters', 'from', 'query', 'string', '.']
train
https://github.com/miLibris/flask-rest-jsonapi/blob/ecc8f2cd2b54cc0bfae7acd6cffcda0ba1140c43/flask_rest_jsonapi/querystring.py#L77-L91
6,094
dmwm/DBS
Server/Python/src/dbs/web/DBSReaderModel.py
DBSReaderModel.listDatasets
def listDatasets(self, dataset="", parent_dataset="", is_dataset_valid=1, release_version="", pset_hash="", app_name="", output_module_label="", global_tag="", processing_version=0, acquisition_era_name="", run_num=-1, physics_group_name="", logical_file_name="", primary_ds_name="", primary_ds_t...
python
def listDatasets(self, dataset="", parent_dataset="", is_dataset_valid=1, release_version="", pset_hash="", app_name="", output_module_label="", global_tag="", processing_version=0, acquisition_era_name="", run_num=-1, physics_group_name="", logical_file_name="", primary_ds_name="", primary_ds_t...
['def', 'listDatasets', '(', 'self', ',', 'dataset', '=', '""', ',', 'parent_dataset', '=', '""', ',', 'is_dataset_valid', '=', '1', ',', 'release_version', '=', '""', ',', 'pset_hash', '=', '""', ',', 'app_name', '=', '""', ',', 'output_module_label', '=', '""', ',', 'global_tag', '=', '""', ',', 'processing_version',...
API to list dataset(s) in DBS * You can use ANY combination of these parameters in this API * In absence of parameters, all valid datasets known to the DBS instance will be returned :param dataset: Full dataset (path) of the dataset. :type dataset: str :param parent_dataset: Fu...
['API', 'to', 'list', 'dataset', '(', 's', ')', 'in', 'DBS', '*', 'You', 'can', 'use', 'ANY', 'combination', 'of', 'these', 'parameters', 'in', 'this', 'API', '*', 'In', 'absence', 'of', 'parameters', 'all', 'valid', 'datasets', 'known', 'to', 'the', 'DBS', 'instance', 'will', 'be', 'returned']
train
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/web/DBSReaderModel.py#L284-L488
6,095
crackinglandia/pype32
pype32/directories.py
NETDirectory.parse
def parse(readDataInstance): """ Returns a new L{NETDirectory} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{NETDirectory} object. @rtype: L{NETDirectory} @return: A new L{NETDirec...
python
def parse(readDataInstance): """ Returns a new L{NETDirectory} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{NETDirectory} object. @rtype: L{NETDirectory} @return: A new L{NETDirec...
['def', 'parse', '(', 'readDataInstance', ')', ':', 'nd', '=', 'NETDirectory', '(', ')', 'nd', '.', 'directory', '=', 'NetDirectory', '.', 'parse', '(', 'readDataInstance', ')', 'nd', '.', 'netMetaDataHeader', '=', 'NetMetaDataHeader', '.', 'parse', '(', 'readDataInstance', ')', 'nd', '.', 'netMetaDataStreams', '=', 'N...
Returns a new L{NETDirectory} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{NETDirectory} object. @rtype: L{NETDirectory} @return: A new L{NETDirectory} object.
['Returns', 'a', 'new', 'L', '{', 'NETDirectory', '}', 'object', '.']
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/directories.py#L945-L960
6,096
infothrill/python-dyndnsc
dyndnsc/detector/base.py
IPDetector.set_current_value
def set_current_value(self, value): """Set the detected IP in the current run (if any).""" self._oldvalue = self.get_current_value() self._currentvalue = value if self._oldvalue != value: # self.notify_observers("new_ip_detected", {"ip": value}) LOG.debug("%s.set_...
python
def set_current_value(self, value): """Set the detected IP in the current run (if any).""" self._oldvalue = self.get_current_value() self._currentvalue = value if self._oldvalue != value: # self.notify_observers("new_ip_detected", {"ip": value}) LOG.debug("%s.set_...
['def', 'set_current_value', '(', 'self', ',', 'value', ')', ':', 'self', '.', '_oldvalue', '=', 'self', '.', 'get_current_value', '(', ')', 'self', '.', '_currentvalue', '=', 'value', 'if', 'self', '.', '_oldvalue', '!=', 'value', ':', '# self.notify_observers("new_ip_detected", {"ip": value})', 'LOG', '.', 'debug', '...
Set the detected IP in the current run (if any).
['Set', 'the', 'detected', 'IP', 'in', 'the', 'current', 'run', '(', 'if', 'any', ')', '.']
train
https://github.com/infothrill/python-dyndnsc/blob/2196d48aa6098da9835a7611fbdb0b5f0fbf51e4/dyndnsc/detector/base.py#L75-L82
6,097
KieranWynn/pyquaternion
pyquaternion/quaternion.py
Quaternion.exp
def exp(cls, q): """Quaternion Exponential. Find the exponential of a quaternion amount. Params: q: the input quaternion/argument as a Quaternion object. Returns: A quaternion amount representing the exp(q). See [Source](https://math.stackexchange.com/questio...
python
def exp(cls, q): """Quaternion Exponential. Find the exponential of a quaternion amount. Params: q: the input quaternion/argument as a Quaternion object. Returns: A quaternion amount representing the exp(q). See [Source](https://math.stackexchange.com/questio...
['def', 'exp', '(', 'cls', ',', 'q', ')', ':', 'tolerance', '=', '1e-17', 'v_norm', '=', 'np', '.', 'linalg', '.', 'norm', '(', 'q', '.', 'vector', ')', 'vec', '=', 'q', '.', 'vector', 'if', 'v_norm', '>', 'tolerance', ':', 'vec', '=', 'vec', '/', 'v_norm', 'magnitude', '=', 'exp', '(', 'q', '.', 'scalar', ')', 'return...
Quaternion Exponential. Find the exponential of a quaternion amount. Params: q: the input quaternion/argument as a Quaternion object. Returns: A quaternion amount representing the exp(q). See [Source](https://math.stackexchange.com/questions/1030737/exponential-funct...
['Quaternion', 'Exponential', '.']
train
https://github.com/KieranWynn/pyquaternion/blob/d2aad7f3fb0d4b9cc23aa72b390e9b2e1273eae9/pyquaternion/quaternion.py#L625-L645
6,098
google/grr
grr/client/grr_response_client/windows/installers.py
CopyToSystemDir.StopPreviousService
def StopPreviousService(self): """Stops the Windows service hosting the GRR process.""" StopService( service_name=config.CONFIG["Nanny.service_name"], service_binary_name=config.CONFIG["Nanny.service_binary_name"]) if not config.CONFIG["Client.fleetspeak_enabled"]: return StopSer...
python
def StopPreviousService(self): """Stops the Windows service hosting the GRR process.""" StopService( service_name=config.CONFIG["Nanny.service_name"], service_binary_name=config.CONFIG["Nanny.service_binary_name"]) if not config.CONFIG["Client.fleetspeak_enabled"]: return StopSer...
['def', 'StopPreviousService', '(', 'self', ')', ':', 'StopService', '(', 'service_name', '=', 'config', '.', 'CONFIG', '[', '"Nanny.service_name"', ']', ',', 'service_binary_name', '=', 'config', '.', 'CONFIG', '[', '"Nanny.service_binary_name"', ']', ')', 'if', 'not', 'config', '.', 'CONFIG', '[', '"Client.fleetspeak...
Stops the Windows service hosting the GRR process.
['Stops', 'the', 'Windows', 'service', 'hosting', 'the', 'GRR', 'process', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/windows/installers.py#L141-L165
6,099
nilp0inter/cpe
cpe/comp/cpecomp2_3_uri.py
CPEComponent2_3_URI._decode
def _decode(self): """ Convert the characters of character in value of component to standard value (WFN value). This function scans the value of component and returns a copy with all percent-encoded characters decoded. :exception: ValueError - invalid character in value ...
python
def _decode(self): """ Convert the characters of character in value of component to standard value (WFN value). This function scans the value of component and returns a copy with all percent-encoded characters decoded. :exception: ValueError - invalid character in value ...
['def', '_decode', '(', 'self', ')', ':', 'result', '=', '[', ']', 'idx', '=', '0', 's', '=', 'self', '.', '_encoded_value', 'embedded', '=', 'False', 'errmsg', '=', '[', ']', 'errmsg', '.', 'append', '(', '"Invalid value: "', ')', 'while', '(', 'idx', '<', 'len', '(', 's', ')', ')', ':', 'errmsg', '.', 'append', '(', ...
Convert the characters of character in value of component to standard value (WFN value). This function scans the value of component and returns a copy with all percent-encoded characters decoded. :exception: ValueError - invalid character in value of component
['Convert', 'the', 'characters', 'of', 'character', 'in', 'value', 'of', 'component', 'to', 'standard', 'value', '(', 'WFN', 'value', ')', '.', 'This', 'function', 'scans', 'the', 'value', 'of', 'component', 'and', 'returns', 'a', 'copy', 'with', 'all', 'percent', '-', 'encoded', 'characters', 'decoded', '.']
train
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/comp/cpecomp2_3_uri.py#L163-L244