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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5,300 | bunq/sdk_python | bunq/sdk/model/generated/endpoint.py | RewardRecipient.is_all_field_none | def is_all_field_none(self):
"""
:rtype: bool
"""
if self._id_ is not None:
return False
if self._created is not None:
return False
if self._updated is not None:
return False
if self._status is not None:
return F... | python | def is_all_field_none(self):
"""
:rtype: bool
"""
if self._id_ is not None:
return False
if self._created is not None:
return False
if self._updated is not None:
return False
if self._status is not None:
return F... | ['def', 'is_all_field_none', '(', 'self', ')', ':', 'if', 'self', '.', '_id_', 'is', 'not', 'None', ':', 'return', 'False', 'if', 'self', '.', '_created', 'is', 'not', 'None', ':', 'return', 'False', 'if', 'self', '.', '_updated', 'is', 'not', 'None', ':', 'return', 'False', 'if', 'self', '.', '_status', 'is', 'not', '... | :rtype: bool | [':', 'rtype', ':', 'bool'] | train | https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/generated/endpoint.py#L13934-L13963 |
5,301 | StanfordVL/robosuite | robosuite/environments/base.py | MujocoEnv.reset_from_xml_string | def reset_from_xml_string(self, xml_string):
"""Reloads the environment from an XML description of the environment."""
# if there is an active viewer window, destroy it
self.close()
# load model from xml
self.mjpy_model = load_model_from_xml(xml_string)
self.sim = MjSi... | python | def reset_from_xml_string(self, xml_string):
"""Reloads the environment from an XML description of the environment."""
# if there is an active viewer window, destroy it
self.close()
# load model from xml
self.mjpy_model = load_model_from_xml(xml_string)
self.sim = MjSi... | ['def', 'reset_from_xml_string', '(', 'self', ',', 'xml_string', ')', ':', '# if there is an active viewer window, destroy it', 'self', '.', 'close', '(', ')', '# load model from xml', 'self', '.', 'mjpy_model', '=', 'load_model_from_xml', '(', 'xml_string', ')', 'self', '.', 'sim', '=', 'MjSim', '(', 'self', '.', 'mjp... | Reloads the environment from an XML description of the environment. | ['Reloads', 'the', 'environment', 'from', 'an', 'XML', 'description', 'of', 'the', 'environment', '.'] | train | https://github.com/StanfordVL/robosuite/blob/65cd16810e2ed647e3ec88746af3412065b7f278/robosuite/environments/base.py#L254-L288 |
5,302 | materialsproject/pymatgen | pymatgen/io/abinit/launcher.py | BatchLauncher.submit | def submit(self, **kwargs):
"""
Submit a job script that will run the schedulers with `abirun.py`.
Args:
verbose: Verbosity level
dry_run: Don't submit the script if dry_run. Default: False
Returns:
namedtuple with attributes:
retcode... | python | def submit(self, **kwargs):
"""
Submit a job script that will run the schedulers with `abirun.py`.
Args:
verbose: Verbosity level
dry_run: Don't submit the script if dry_run. Default: False
Returns:
namedtuple with attributes:
retcode... | ['def', 'submit', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'verbose', ',', 'dry_run', '=', 'kwargs', '.', 'pop', '(', '"verbose"', ',', '0', ')', ',', 'kwargs', '.', 'pop', '(', '"dry_run"', ',', 'False', ')', 'if', 'not', 'self', '.', 'flows', ':', 'print', '(', '"Cannot submit an empty list of flows!"', ')', '... | Submit a job script that will run the schedulers with `abirun.py`.
Args:
verbose: Verbosity level
dry_run: Don't submit the script if dry_run. Default: False
Returns:
namedtuple with attributes:
retcode: Return code as returned by the submission scri... | ['Submit', 'a', 'job', 'script', 'that', 'will', 'run', 'the', 'schedulers', 'with', 'abirun', '.', 'py', '.'] | train | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/launcher.py#L1167-L1252 |
5,303 | takaakiaoki/ofblockmeshdicthelper | ofblockmeshdicthelper/__init__.py | BlockMeshDict.merge_vertices | def merge_vertices(self):
"""call reduce_vertex on all vertices with identical values."""
# groupby expects sorted data
sorted_vertices = sorted(list(self.vertices.items()), key=lambda v: hash(v[1]))
groups = []
for k, g in groupby(sorted_vertices, lambda v: hash(v[1])):
... | python | def merge_vertices(self):
"""call reduce_vertex on all vertices with identical values."""
# groupby expects sorted data
sorted_vertices = sorted(list(self.vertices.items()), key=lambda v: hash(v[1]))
groups = []
for k, g in groupby(sorted_vertices, lambda v: hash(v[1])):
... | ['def', 'merge_vertices', '(', 'self', ')', ':', '# groupby expects sorted data', 'sorted_vertices', '=', 'sorted', '(', 'list', '(', 'self', '.', 'vertices', '.', 'items', '(', ')', ')', ',', 'key', '=', 'lambda', 'v', ':', 'hash', '(', 'v', '[', '1', ']', ')', ')', 'groups', '=', '[', ']', 'for', 'k', ',', 'g', 'in',... | call reduce_vertex on all vertices with identical values. | ['call', 'reduce_vertex', 'on', 'all', 'vertices', 'with', 'identical', 'values', '.'] | train | https://github.com/takaakiaoki/ofblockmeshdicthelper/blob/df99e6b0e4f0334c9afe075b4f3ceaccb5bac9fd/ofblockmeshdicthelper/__init__.py#L384-L396 |
5,304 | tradenity/python-sdk | tradenity/resources/brand.py | Brand.list_all_brands | def list_all_brands(cls, **kwargs):
"""List Brands
Return a list of Brands
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.list_all_brands(async=True)
>>> result = thread.get()
... | python | def list_all_brands(cls, **kwargs):
"""List Brands
Return a list of Brands
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.list_all_brands(async=True)
>>> result = thread.get()
... | ['def', 'list_all_brands', '(', 'cls', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'async'", ')', ':', 'return', 'cls', '.', '_list_all_brands_with_http_info', '(', '*', '*', 'kwargs', ')', 'else', ':', '(', 'data', ')', '=', 'cls', '... | List Brands
Return a list of Brands
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.list_all_brands(async=True)
>>> result = thread.get()
:param async bool
:param int page: pa... | ['List', 'Brands'] | train | https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/brand.py#L599-L621 |
5,305 | bitcraft/PyTMX | pytmx/pytmx.py | TiledImageLayer.parse_xml | def parse_xml(self, node):
""" Parse an Image Layer from ElementTree xml node
:param node: ElementTree xml node
:return: self
"""
self._set_properties(node)
self.name = node.get('name', None)
self.opacity = node.get('opacity', self.opacity)
self.visible =... | python | def parse_xml(self, node):
""" Parse an Image Layer from ElementTree xml node
:param node: ElementTree xml node
:return: self
"""
self._set_properties(node)
self.name = node.get('name', None)
self.opacity = node.get('opacity', self.opacity)
self.visible =... | ['def', 'parse_xml', '(', 'self', ',', 'node', ')', ':', 'self', '.', '_set_properties', '(', 'node', ')', 'self', '.', 'name', '=', 'node', '.', 'get', '(', "'name'", ',', 'None', ')', 'self', '.', 'opacity', '=', 'node', '.', 'get', '(', "'opacity'", ',', 'self', '.', 'opacity', ')', 'self', '.', 'visible', '=', 'nod... | Parse an Image Layer from ElementTree xml node
:param node: ElementTree xml node
:return: self | ['Parse', 'an', 'Image', 'Layer', 'from', 'ElementTree', 'xml', 'node'] | train | https://github.com/bitcraft/PyTMX/blob/3fb9788dd66ecfd0c8fa0e9f38c582337d89e1d9/pytmx/pytmx.py#L1216-L1229 |
5,306 | mlperf/training | reinforcement/tensorflow/minigo/gtp_cmd_handlers.py | MiniguiBasicCmdHandler._minigui_report_search_status | def _minigui_report_search_status(self, leaves):
"""Prints the current MCTS search status to stderr.
Reports the current search path, root node's child_Q, root node's
child_N, the most visited path in a format that can be parsed by
one of the STDERR_HANDLERS in minigui.ts.
Args... | python | def _minigui_report_search_status(self, leaves):
"""Prints the current MCTS search status to stderr.
Reports the current search path, root node's child_Q, root node's
child_N, the most visited path in a format that can be parsed by
one of the STDERR_HANDLERS in minigui.ts.
Args... | ['def', '_minigui_report_search_status', '(', 'self', ',', 'leaves', ')', ':', 'root', '=', 'self', '.', '_player', '.', 'get_root', '(', ')', 'msg', '=', '{', '"id"', ':', 'hex', '(', 'id', '(', 'root', ')', ')', ',', '"n"', ':', 'int', '(', 'root', '.', 'N', ')', ',', '"q"', ':', 'float', '(', 'root', '.', 'Q', ')', ... | Prints the current MCTS search status to stderr.
Reports the current search path, root node's child_Q, root node's
child_N, the most visited path in a format that can be parsed by
one of the STDERR_HANDLERS in minigui.ts.
Args:
leaves: list of leaf MCTSNodes returned by tree_... | ['Prints', 'the', 'current', 'MCTS', 'search', 'status', 'to', 'stderr', '.'] | train | https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/gtp_cmd_handlers.py#L315-L369 |
5,307 | Fantomas42/mots-vides | mots_vides/factory.py | StopWordFactory.get_collection_filename | def get_collection_filename(self, language):
"""
Returns the filename containing the stop words collection
for a specific language.
"""
filename = os.path.join(self.data_directory, '%s.txt' % language)
return filename | python | def get_collection_filename(self, language):
"""
Returns the filename containing the stop words collection
for a specific language.
"""
filename = os.path.join(self.data_directory, '%s.txt' % language)
return filename | ['def', 'get_collection_filename', '(', 'self', ',', 'language', ')', ':', 'filename', '=', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'data_directory', ',', "'%s.txt'", '%', 'language', ')', 'return', 'filename'] | Returns the filename containing the stop words collection
for a specific language. | ['Returns', 'the', 'filename', 'containing', 'the', 'stop', 'words', 'collection', 'for', 'a', 'specific', 'language', '.'] | train | https://github.com/Fantomas42/mots-vides/blob/eaeccf73bdb415d0c5559ccd74de360b37a2bbac/mots_vides/factory.py#L94-L100 |
5,308 | juju/charm-helpers | charmhelpers/contrib/openstack/utils.py | _check_running_services | def _check_running_services(services):
"""Check that the services dict provided is actually running and provide
a list of (service, boolean) tuples for each service.
Returns both a zipped list of (service, boolean) and a list of booleans
in the same order as the services.
@param services: OrderedD... | python | def _check_running_services(services):
"""Check that the services dict provided is actually running and provide
a list of (service, boolean) tuples for each service.
Returns both a zipped list of (service, boolean) and a list of booleans
in the same order as the services.
@param services: OrderedD... | ['def', '_check_running_services', '(', 'services', ')', ':', 'services_running', '=', '[', 'service_running', '(', 's', ')', 'for', 's', 'in', 'services', ']', 'return', 'list', '(', 'zip', '(', 'services', ',', 'services_running', ')', ')', ',', 'services_running'] | Check that the services dict provided is actually running and provide
a list of (service, boolean) tuples for each service.
Returns both a zipped list of (service, boolean) and a list of booleans
in the same order as the services.
@param services: OrderedDict of strings: [ports], one for each service ... | ['Check', 'that', 'the', 'services', 'dict', 'provided', 'is', 'actually', 'running', 'and', 'provide', 'a', 'list', 'of', '(', 'service', 'boolean', ')', 'tuples', 'for', 'each', 'service', '.'] | train | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/utils.py#L1077-L1090 |
5,309 | collectiveacuity/jsonModel | jsonmodel/_extensions.py | tabulate | def tabulate(self, format='html', syntax=''):
'''
a function to create a table from the class model keyMap
:param format: string with format for table output
:param syntax: [optional] string with linguistic syntax
:return: string with table
'''
from tabulate import tabulate as _tabula... | python | def tabulate(self, format='html', syntax=''):
'''
a function to create a table from the class model keyMap
:param format: string with format for table output
:param syntax: [optional] string with linguistic syntax
:return: string with table
'''
from tabulate import tabulate as _tabula... | ['def', 'tabulate', '(', 'self', ',', 'format', '=', "'html'", ',', 'syntax', '=', "''", ')', ':', 'from', 'tabulate', 'import', 'tabulate', 'as', '_tabulate', '# define headers', 'headers', '=', '[', "'Field'", ',', "'Datatype'", ',', "'Required'", ',', "'Default'", ',', "'Examples'", ',', "'Conditionals'", ',', "'Des... | a function to create a table from the class model keyMap
:param format: string with format for table output
:param syntax: [optional] string with linguistic syntax
:return: string with table | ['a', 'function', 'to', 'create', 'a', 'table', 'from', 'the', 'class', 'model', 'keyMap'] | train | https://github.com/collectiveacuity/jsonModel/blob/1ea64c36d78add3faa7b85ff82c5ec685458c940/jsonmodel/_extensions.py#L34-L209 |
5,310 | david-caro/python-autosemver | autosemver/packaging.py | get_releasenotes | def get_releasenotes(project_dir=os.curdir, bugtracker_url=''):
"""
Retrieves the release notes, from the RELEASE_NOTES file (if in a package)
or generates it from the git history.
Args:
project_dir(str): Path to the git repo of the project.
bugtracker_url(str): Url to the bug tracker f... | python | def get_releasenotes(project_dir=os.curdir, bugtracker_url=''):
"""
Retrieves the release notes, from the RELEASE_NOTES file (if in a package)
or generates it from the git history.
Args:
project_dir(str): Path to the git repo of the project.
bugtracker_url(str): Url to the bug tracker f... | ['def', 'get_releasenotes', '(', 'project_dir', '=', 'os', '.', 'curdir', ',', 'bugtracker_url', '=', "''", ')', ':', 'releasenotes', '=', "''", 'pkg_info_file', '=', 'os', '.', 'path', '.', 'join', '(', 'project_dir', ',', "'PKG-INFO'", ')', 'releasenotes_file', '=', 'os', '.', 'path', '.', 'join', '(', 'project_dir',... | Retrieves the release notes, from the RELEASE_NOTES file (if in a package)
or generates it from the git history.
Args:
project_dir(str): Path to the git repo of the project.
bugtracker_url(str): Url to the bug tracker for the issues.
Returns:
str: release notes
Raises:
... | ['Retrieves', 'the', 'release', 'notes', 'from', 'the', 'RELEASE_NOTES', 'file', '(', 'if', 'in', 'a', 'package', ')', 'or', 'generates', 'it', 'from', 'the', 'git', 'history', '.'] | train | https://github.com/david-caro/python-autosemver/blob/3bc0adb70c33e4bd3623ae4c1944d5ee37f4303d/autosemver/packaging.py#L149-L177 |
5,311 | tortoise/tortoise-orm | tortoise/queryset.py | QuerySet.count | def count(self) -> "CountQuery":
"""
Return count of objects in queryset instead of objects.
"""
return CountQuery(
db=self._db,
model=self.model,
q_objects=self._q_objects,
annotations=self._annotations,
custom_filters=self._cu... | python | def count(self) -> "CountQuery":
"""
Return count of objects in queryset instead of objects.
"""
return CountQuery(
db=self._db,
model=self.model,
q_objects=self._q_objects,
annotations=self._annotations,
custom_filters=self._cu... | ['def', 'count', '(', 'self', ')', '->', '"CountQuery"', ':', 'return', 'CountQuery', '(', 'db', '=', 'self', '.', '_db', ',', 'model', '=', 'self', '.', 'model', ',', 'q_objects', '=', 'self', '.', '_q_objects', ',', 'annotations', '=', 'self', '.', '_annotations', ',', 'custom_filters', '=', 'self', '.', '_custom_fil... | Return count of objects in queryset instead of objects. | ['Return', 'count', 'of', 'objects', 'in', 'queryset', 'instead', 'of', 'objects', '.'] | train | https://github.com/tortoise/tortoise-orm/blob/7d16457731905e19d4d06ccd5b4ea16d4a9447b2/tortoise/queryset.py#L332-L342 |
5,312 | spotify/luigi | luigi/contrib/hdfs/target.py | HdfsTarget.move | def move(self, path, raise_if_exists=False):
"""
Alias for ``rename()``
"""
self.rename(path, raise_if_exists=raise_if_exists) | python | def move(self, path, raise_if_exists=False):
"""
Alias for ``rename()``
"""
self.rename(path, raise_if_exists=raise_if_exists) | ['def', 'move', '(', 'self', ',', 'path', ',', 'raise_if_exists', '=', 'False', ')', ':', 'self', '.', 'rename', '(', 'path', ',', 'raise_if_exists', '=', 'raise_if_exists', ')'] | Alias for ``rename()`` | ['Alias', 'for', 'rename', '()'] | train | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hdfs/target.py#L134-L138 |
5,313 | expfactory/expfactory | expfactory/validator/experiments.py | ExperimentValidator._validate_config | def _validate_config(self, folder, validate_folder=True):
''' validate config is the primary validation function that checks
for presence and format of required fields.
Parameters
==========
:folder: full path to folder with config.json
:name: if provided, the folder... | python | def _validate_config(self, folder, validate_folder=True):
''' validate config is the primary validation function that checks
for presence and format of required fields.
Parameters
==========
:folder: full path to folder with config.json
:name: if provided, the folder... | ['def', '_validate_config', '(', 'self', ',', 'folder', ',', 'validate_folder', '=', 'True', ')', ':', 'config', '=', '"%s/config.json"', '%', 'folder', 'name', '=', 'os', '.', 'path', '.', 'basename', '(', 'folder', ')', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'config', ')', ':', 'return', 'notvalid', '(',... | validate config is the primary validation function that checks
for presence and format of required fields.
Parameters
==========
:folder: full path to folder with config.json
:name: if provided, the folder name to check against exp_id | ['validate', 'config', 'is', 'the', 'primary', 'validation', 'function', 'that', 'checks', 'for', 'presence', 'and', 'format', 'of', 'required', 'fields', '.'] | train | https://github.com/expfactory/expfactory/blob/27ce6cc93e17231df8a8024f18e631336afd3501/expfactory/validator/experiments.py#L93-L146 |
5,314 | ejeschke/ginga | ginga/BaseImage.py | BaseImage.get_shape_mask | def get_shape_mask(self, shape_obj):
"""
Return full mask where True marks pixels within the given shape.
"""
wd, ht = self.get_size()
yi = np.mgrid[:ht].reshape(-1, 1)
xi = np.mgrid[:wd].reshape(1, -1)
pts = np.asarray((xi, yi)).T
contains = shape_obj.con... | python | def get_shape_mask(self, shape_obj):
"""
Return full mask where True marks pixels within the given shape.
"""
wd, ht = self.get_size()
yi = np.mgrid[:ht].reshape(-1, 1)
xi = np.mgrid[:wd].reshape(1, -1)
pts = np.asarray((xi, yi)).T
contains = shape_obj.con... | ['def', 'get_shape_mask', '(', 'self', ',', 'shape_obj', ')', ':', 'wd', ',', 'ht', '=', 'self', '.', 'get_size', '(', ')', 'yi', '=', 'np', '.', 'mgrid', '[', ':', 'ht', ']', '.', 'reshape', '(', '-', '1', ',', '1', ')', 'xi', '=', 'np', '.', 'mgrid', '[', ':', 'wd', ']', '.', 'reshape', '(', '1', ',', '-', '1', ')', ... | Return full mask where True marks pixels within the given shape. | ['Return', 'full', 'mask', 'where', 'True', 'marks', 'pixels', 'within', 'the', 'given', 'shape', '.'] | train | https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/BaseImage.py#L348-L357 |
5,315 | pyviz/geoviews | geoviews/util.py | geom_length | def geom_length(geom):
"""
Calculates the length of coordinates in a shapely geometry.
"""
if geom.geom_type == 'Point':
return 1
if hasattr(geom, 'exterior'):
geom = geom.exterior
if not geom.geom_type.startswith('Multi') and hasattr(geom, 'array_interface_base'):
return... | python | def geom_length(geom):
"""
Calculates the length of coordinates in a shapely geometry.
"""
if geom.geom_type == 'Point':
return 1
if hasattr(geom, 'exterior'):
geom = geom.exterior
if not geom.geom_type.startswith('Multi') and hasattr(geom, 'array_interface_base'):
return... | ['def', 'geom_length', '(', 'geom', ')', ':', 'if', 'geom', '.', 'geom_type', '==', "'Point'", ':', 'return', '1', 'if', 'hasattr', '(', 'geom', ',', "'exterior'", ')', ':', 'geom', '=', 'geom', '.', 'exterior', 'if', 'not', 'geom', '.', 'geom_type', '.', 'startswith', '(', "'Multi'", ')', 'and', 'hasattr', '(', 'geom'... | Calculates the length of coordinates in a shapely geometry. | ['Calculates', 'the', 'length', 'of', 'coordinates', 'in', 'a', 'shapely', 'geometry', '.'] | train | https://github.com/pyviz/geoviews/blob/cc70ac2d5a96307769bc6192eaef8576c3d24b30/geoviews/util.py#L327-L341 |
5,316 | mitsei/dlkit | dlkit/json_/relationship/sessions.py | FamilyHierarchyDesignSession.remove_root_family | def remove_root_family(self, family_id):
"""Removes a root family.
arg: family_id (osid.id.Id): the ``Id`` of a family
raise: NotFound - ``family_id`` not a root
raise: NullArgument - ``family_id`` is ``null``
raise: OperationFailed - unable to complete request
rai... | python | def remove_root_family(self, family_id):
"""Removes a root family.
arg: family_id (osid.id.Id): the ``Id`` of a family
raise: NotFound - ``family_id`` not a root
raise: NullArgument - ``family_id`` is ``null``
raise: OperationFailed - unable to complete request
rai... | ['def', 'remove_root_family', '(', 'self', ',', 'family_id', ')', ':', '# Implemented from template for', '# osid.resource.BinHierarchyDesignSession.remove_root_bin_template', 'if', 'self', '.', '_catalog_session', 'is', 'not', 'None', ':', 'return', 'self', '.', '_catalog_session', '.', 'remove_root_catalog', '(', 'ca... | Removes a root family.
arg: family_id (osid.id.Id): the ``Id`` of a family
raise: NotFound - ``family_id`` not a root
raise: NullArgument - ``family_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
... | ['Removes', 'a', 'root', 'family', '.'] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2475-L2490 |
5,317 | broadinstitute/fiss | firecloud/workspace.py | Workspace.submissions | def submissions(self):
"""List job submissions in workspace."""
r = fapi.get_submissions(self.namespace, self.name, self.api_url)
fapi._check_response_code(r, 200)
return r.json() | python | def submissions(self):
"""List job submissions in workspace."""
r = fapi.get_submissions(self.namespace, self.name, self.api_url)
fapi._check_response_code(r, 200)
return r.json() | ['def', 'submissions', '(', 'self', ')', ':', 'r', '=', 'fapi', '.', 'get_submissions', '(', 'self', '.', 'namespace', ',', 'self', '.', 'name', ',', 'self', '.', 'api_url', ')', 'fapi', '.', '_check_response_code', '(', 'r', ',', '200', ')', 'return', 'r', '.', 'json', '(', ')'] | List job submissions in workspace. | ['List', 'job', 'submissions', 'in', 'workspace', '.'] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/workspace.py#L214-L218 |
5,318 | JNRowe/upoints | upoints/point.py | _dms_formatter | def _dms_formatter(latitude, longitude, mode, unistr=False):
"""Generate a human readable DM/DMS location string.
Args:
latitude (float): Location's latitude
longitude (float): Location's longitude
mode (str): Coordinate formatting system to use
unistr (bool): Whether to use ext... | python | def _dms_formatter(latitude, longitude, mode, unistr=False):
"""Generate a human readable DM/DMS location string.
Args:
latitude (float): Location's latitude
longitude (float): Location's longitude
mode (str): Coordinate formatting system to use
unistr (bool): Whether to use ext... | ['def', '_dms_formatter', '(', 'latitude', ',', 'longitude', ',', 'mode', ',', 'unistr', '=', 'False', ')', ':', 'if', 'unistr', ':', 'chars', '=', '(', "'°',", ' ', "′', '", '″', ')', '', 'else', ':', 'chars', '=', '(', "'°',", ' ', '\'",', ' ', '"\')', '', 'latitude_dms', '=', 'tuple', '(', 'map', '(', 'abs', ',', 'u... | Generate a human readable DM/DMS location string.
Args:
latitude (float): Location's latitude
longitude (float): Location's longitude
mode (str): Coordinate formatting system to use
unistr (bool): Whether to use extended character set | ['Generate', 'a', 'human', 'readable', 'DM', '/', 'DMS', 'location', 'string', '.'] | train | https://github.com/JNRowe/upoints/blob/1e4b7a53ed2a06cd854523d54c36aabdccea3830/upoints/point.py#L41-L68 |
5,319 | ray-project/ray | python/ray/tune/ray_trial_executor.py | RayTrialExecutor._train | def _train(self, trial):
"""Start one iteration of training and save remote id."""
assert trial.status == Trial.RUNNING, trial.status
remote = trial.runner.train.remote()
# Local Mode
if isinstance(remote, dict):
remote = _LocalWrapper(remote)
self._running... | python | def _train(self, trial):
"""Start one iteration of training and save remote id."""
assert trial.status == Trial.RUNNING, trial.status
remote = trial.runner.train.remote()
# Local Mode
if isinstance(remote, dict):
remote = _LocalWrapper(remote)
self._running... | ['def', '_train', '(', 'self', ',', 'trial', ')', ':', 'assert', 'trial', '.', 'status', '==', 'Trial', '.', 'RUNNING', ',', 'trial', '.', 'status', 'remote', '=', 'trial', '.', 'runner', '.', 'train', '.', 'remote', '(', ')', '# Local Mode', 'if', 'isinstance', '(', 'remote', ',', 'dict', ')', ':', 'remote', '=', '_Lo... | Start one iteration of training and save remote id. | ['Start', 'one', 'iteration', 'of', 'training', 'and', 'save', 'remote', 'id', '.'] | train | https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/ray_trial_executor.py#L107-L117 |
5,320 | zhanglab/psamm | psamm/importer.py | main_bigg | def main_bigg(args=None, urlopen=urlopen):
"""Entry point for BiGG import program.
If the ``args`` are provided, these should be a list of strings that will
be used instead of ``sys.argv[1:]``. This is mostly useful for testing.
"""
parser = argparse.ArgumentParser(
description='Import from... | python | def main_bigg(args=None, urlopen=urlopen):
"""Entry point for BiGG import program.
If the ``args`` are provided, these should be a list of strings that will
be used instead of ``sys.argv[1:]``. This is mostly useful for testing.
"""
parser = argparse.ArgumentParser(
description='Import from... | ['def', 'main_bigg', '(', 'args', '=', 'None', ',', 'urlopen', '=', 'urlopen', ')', ':', 'parser', '=', 'argparse', '.', 'ArgumentParser', '(', 'description', '=', "'Import from BiGG database'", ')', 'parser', '.', 'add_argument', '(', "'--dest'", ',', 'metavar', '=', "'path'", ',', 'default', '=', "'.'", ',', 'help', ... | Entry point for BiGG import program.
If the ``args`` are provided, these should be a list of strings that will
be used instead of ``sys.argv[1:]``. This is mostly useful for testing. | ['Entry', 'point', 'for', 'BiGG', 'import', 'program', '.'] | train | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/importer.py#L703-L813 |
5,321 | madprime/cgivar2gvcf | cgivar2gvcf/__init__.py | convert_to_file | def convert_to_file(cgi_input, output_file, twobit_ref, twobit_name, var_only=False):
"""Convert a CGI var file and output VCF-formatted data to file"""
if isinstance(output_file, str):
output_file = auto_zip_open(output_file, 'w')
conversion = convert(cgi_input=cgi_input, twobit_ref=twobit_ref, t... | python | def convert_to_file(cgi_input, output_file, twobit_ref, twobit_name, var_only=False):
"""Convert a CGI var file and output VCF-formatted data to file"""
if isinstance(output_file, str):
output_file = auto_zip_open(output_file, 'w')
conversion = convert(cgi_input=cgi_input, twobit_ref=twobit_ref, t... | ['def', 'convert_to_file', '(', 'cgi_input', ',', 'output_file', ',', 'twobit_ref', ',', 'twobit_name', ',', 'var_only', '=', 'False', ')', ':', 'if', 'isinstance', '(', 'output_file', ',', 'str', ')', ':', 'output_file', '=', 'auto_zip_open', '(', 'output_file', ',', "'w'", ')', 'conversion', '=', 'convert', '(', 'cgi... | Convert a CGI var file and output VCF-formatted data to file | ['Convert', 'a', 'CGI', 'var', 'file', 'and', 'output', 'VCF', '-', 'formatted', 'data', 'to', 'file'] | train | https://github.com/madprime/cgivar2gvcf/blob/13b4cd8da08669f7e4b0ceed77a7a17082f91037/cgivar2gvcf/__init__.py#L443-L452 |
5,322 | s1s1ty/py-jsonq | pyjsonq/matcher.py | Matcher._match | def _match(self, x, op, y):
"""Compare the given `x` and `y` based on `op`
:@param x, y, op
:@type x, y: mixed
:@type op: string
:@return bool
:@throws ValueError
"""
if (op not in self.condition_mapper):
raise ValueError('Invalid where condi... | python | def _match(self, x, op, y):
"""Compare the given `x` and `y` based on `op`
:@param x, y, op
:@type x, y: mixed
:@type op: string
:@return bool
:@throws ValueError
"""
if (op not in self.condition_mapper):
raise ValueError('Invalid where condi... | ['def', '_match', '(', 'self', ',', 'x', ',', 'op', ',', 'y', ')', ':', 'if', '(', 'op', 'not', 'in', 'self', '.', 'condition_mapper', ')', ':', 'raise', 'ValueError', '(', "'Invalid where condition given'", ')', 'func', '=', 'getattr', '(', 'self', ',', 'self', '.', 'condition_mapper', '.', 'get', '(', 'op', ')', ')',... | Compare the given `x` and `y` based on `op`
:@param x, y, op
:@type x, y: mixed
:@type op: string
:@return bool
:@throws ValueError | ['Compare', 'the', 'given', 'x', 'and', 'y', 'based', 'on', 'op'] | train | https://github.com/s1s1ty/py-jsonq/blob/9625597a2578bddcbed4e540174d5253b1fc3b75/pyjsonq/matcher.py#L162-L176 |
5,323 | pantsbuild/pants | src/python/pants/backend/jvm/tasks/jvm_platform_analysis.py | JvmPlatformAnalysisMixin._unfiltered_jvm_dependency_map | def _unfiltered_jvm_dependency_map(self, fully_transitive=False):
"""Jvm dependency map without filtering out non-JvmTarget keys, exposed for testing.
Unfiltered because the keys in the resulting map include non-JvmTargets.
See the explanation in the jvm_dependency_map() docs for what this method produces... | python | def _unfiltered_jvm_dependency_map(self, fully_transitive=False):
"""Jvm dependency map without filtering out non-JvmTarget keys, exposed for testing.
Unfiltered because the keys in the resulting map include non-JvmTargets.
See the explanation in the jvm_dependency_map() docs for what this method produces... | ['def', '_unfiltered_jvm_dependency_map', '(', 'self', ',', 'fully_transitive', '=', 'False', ')', ':', 'targets', '=', 'self', '.', 'jvm_targets', 'jvm_deps', '=', 'defaultdict', '(', 'set', ')', 'def', 'accumulate_jvm_deps', '(', 'target', ')', ':', 'for', 'dep', 'in', 'target', '.', 'dependencies', ':', 'if', 'self'... | Jvm dependency map without filtering out non-JvmTarget keys, exposed for testing.
Unfiltered because the keys in the resulting map include non-JvmTargets.
See the explanation in the jvm_dependency_map() docs for what this method produces.
:param fully_transitive: if true, the elements of the map will be ... | ['Jvm', 'dependency', 'map', 'without', 'filtering', 'out', 'non', '-', 'JvmTarget', 'keys', 'exposed', 'for', 'testing', '.'] | train | https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/jvm_platform_analysis.py#L39-L77 |
5,324 | sorgerlab/indra | indra/sources/eidos/processor.py | ref_context_from_geoloc | def ref_context_from_geoloc(geoloc):
"""Return a RefContext object given a geoloc entry."""
text = geoloc.get('text')
geoid = geoloc.get('geoID')
rc = RefContext(name=text, db_refs={'GEOID': geoid})
return rc | python | def ref_context_from_geoloc(geoloc):
"""Return a RefContext object given a geoloc entry."""
text = geoloc.get('text')
geoid = geoloc.get('geoID')
rc = RefContext(name=text, db_refs={'GEOID': geoid})
return rc | ['def', 'ref_context_from_geoloc', '(', 'geoloc', ')', ':', 'text', '=', 'geoloc', '.', 'get', '(', "'text'", ')', 'geoid', '=', 'geoloc', '.', 'get', '(', "'geoID'", ')', 'rc', '=', 'RefContext', '(', 'name', '=', 'text', ',', 'db_refs', '=', '{', "'GEOID'", ':', 'geoid', '}', ')', 'return', 'rc'] | Return a RefContext object given a geoloc entry. | ['Return', 'a', 'RefContext', 'object', 'given', 'a', 'geoloc', 'entry', '.'] | train | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L401-L406 |
5,325 | erdewit/ib_insync | ib_insync/ib.py | IB.accountSummary | def accountSummary(self, account: str = '') -> List[AccountValue]:
"""
List of account values for the given account,
or of all accounts if account is left blank.
This method is blocking on first run, non-blocking after that.
Args:
account: If specified, filter for t... | python | def accountSummary(self, account: str = '') -> List[AccountValue]:
"""
List of account values for the given account,
or of all accounts if account is left blank.
This method is blocking on first run, non-blocking after that.
Args:
account: If specified, filter for t... | ['def', 'accountSummary', '(', 'self', ',', 'account', ':', 'str', '=', "''", ')', '->', 'List', '[', 'AccountValue', ']', ':', 'if', 'not', 'self', '.', 'wrapper', '.', 'acctSummary', ':', '# loaded on demand since it takes ca. 250 ms', 'self', '.', 'reqAccountSummary', '(', ')', 'if', 'account', ':', 'return', '[', '... | List of account values for the given account,
or of all accounts if account is left blank.
This method is blocking on first run, non-blocking after that.
Args:
account: If specified, filter for this account name. | ['List', 'of', 'account', 'values', 'for', 'the', 'given', 'account', 'or', 'of', 'all', 'accounts', 'if', 'account', 'is', 'left', 'blank', '.'] | train | https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L343-L360 |
5,326 | mdickinson/bigfloat | bigfloat/core.py | agm | def agm(x, y, context=None):
"""
Return the arithmetic geometric mean of x and y.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_agm,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | python | def agm(x, y, context=None):
"""
Return the arithmetic geometric mean of x and y.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_agm,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | ['def', 'agm', '(', 'x', ',', 'y', ',', 'context', '=', 'None', ')', ':', 'return', '_apply_function_in_current_context', '(', 'BigFloat', ',', 'mpfr', '.', 'mpfr_agm', ',', '(', 'BigFloat', '.', '_implicit_convert', '(', 'x', ')', ',', 'BigFloat', '.', '_implicit_convert', '(', 'y', ')', ',', ')', ',', 'context', ',',... | Return the arithmetic geometric mean of x and y. | ['Return', 'the', 'arithmetic', 'geometric', 'mean', 'of', 'x', 'and', 'y', '.'] | train | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2210-L2223 |
5,327 | PSPC-SPAC-buyandsell/von_anchor | von_anchor/anchor/demo.py | OrgHubAnchor.close | async def close(self) -> None:
"""
Explicit exit. If so configured, populate cache to prove for any creds on schemata,
cred defs, and rev regs marked of interest in configuration at initialization,
archive cache, and purge prior cache archives.
:return: current object
""... | python | async def close(self) -> None:
"""
Explicit exit. If so configured, populate cache to prove for any creds on schemata,
cred defs, and rev regs marked of interest in configuration at initialization,
archive cache, and purge prior cache archives.
:return: current object
""... | ['async', 'def', 'close', '(', 'self', ')', '->', 'None', ':', 'LOGGER', '.', 'debug', '(', "'OrgHubAnchor.close >>>'", ')', 'archive_caches', '=', 'False', 'if', 'self', '.', 'config', '.', 'get', '(', "'archive-holder-prover-caches-on-close'", ',', 'False', ')', ':', 'archive_caches', '=', 'True', 'await', 'self', '.... | Explicit exit. If so configured, populate cache to prove for any creds on schemata,
cred defs, and rev regs marked of interest in configuration at initialization,
archive cache, and purge prior cache archives.
:return: current object | ['Explicit', 'exit', '.', 'If', 'so', 'configured', 'populate', 'cache', 'to', 'prove', 'for', 'any', 'creds', 'on', 'schemata', 'cred', 'defs', 'and', 'rev', 'regs', 'marked', 'of', 'interest', 'in', 'configuration', 'at', 'initialization', 'archive', 'cache', 'and', 'purge', 'prior', 'cache', 'archives', '.'] | train | https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/anchor/demo.py#L149-L182 |
5,328 | saltstack/salt | salt/modules/ssh.py | get_known_host_entries | def get_known_host_entries(user,
hostname,
config=None,
port=None,
fingerprint_hash_type=None):
'''
.. versionadded:: 2018.3.0
Return information about known host entries from the configfile, if any.... | python | def get_known_host_entries(user,
hostname,
config=None,
port=None,
fingerprint_hash_type=None):
'''
.. versionadded:: 2018.3.0
Return information about known host entries from the configfile, if any.... | ['def', 'get_known_host_entries', '(', 'user', ',', 'hostname', ',', 'config', '=', 'None', ',', 'port', '=', 'None', ',', 'fingerprint_hash_type', '=', 'None', ')', ':', 'full', '=', '_get_known_hosts_file', '(', 'config', '=', 'config', ',', 'user', '=', 'user', ')', 'if', 'isinstance', '(', 'full', ',', 'dict', ')',... | .. versionadded:: 2018.3.0
Return information about known host entries from the configfile, if any.
If there are no entries for a matching hostname, return None.
CLI Example:
.. code-block:: bash
salt '*' ssh.get_known_host_entries <user> <hostname> | ['..', 'versionadded', '::', '2018', '.', '3', '.', '0'] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L842-L873 |
5,329 | 10gen/mongo-orchestration | mongo_orchestration/apps/__init__.py | setup_versioned_routes | def setup_versioned_routes(routes, version=None):
"""Set up routes with a version prefix."""
prefix = '/' + version if version else ""
for r in routes:
path, method = r
route(prefix + path, method, routes[r]) | python | def setup_versioned_routes(routes, version=None):
"""Set up routes with a version prefix."""
prefix = '/' + version if version else ""
for r in routes:
path, method = r
route(prefix + path, method, routes[r]) | ['def', 'setup_versioned_routes', '(', 'routes', ',', 'version', '=', 'None', ')', ':', 'prefix', '=', "'/'", '+', 'version', 'if', 'version', 'else', '""', 'for', 'r', 'in', 'routes', ':', 'path', ',', 'method', '=', 'r', 'route', '(', 'prefix', '+', 'path', ',', 'method', ',', 'routes', '[', 'r', ']', ')'] | Set up routes with a version prefix. | ['Set', 'up', 'routes', 'with', 'a', 'version', 'prefix', '.'] | train | https://github.com/10gen/mongo-orchestration/blob/81fd2224205922ea2178b08190b53a33aec47261/mongo_orchestration/apps/__init__.py#L39-L44 |
5,330 | derpferd/little-python | littlepython/parser.py | Parser.control | def control(self):
"""
control : 'if' ctrl_exp block ('elif' ctrl_exp block)* ('else' block)
"""
self.eat(TokenTypes.IF)
ctrl = self.expression()
block = self.block()
ifs = [If(ctrl, block)]
else_block = Block()
while self.cur_token.type == Toke... | python | def control(self):
"""
control : 'if' ctrl_exp block ('elif' ctrl_exp block)* ('else' block)
"""
self.eat(TokenTypes.IF)
ctrl = self.expression()
block = self.block()
ifs = [If(ctrl, block)]
else_block = Block()
while self.cur_token.type == Toke... | ['def', 'control', '(', 'self', ')', ':', 'self', '.', 'eat', '(', 'TokenTypes', '.', 'IF', ')', 'ctrl', '=', 'self', '.', 'expression', '(', ')', 'block', '=', 'self', '.', 'block', '(', ')', 'ifs', '=', '[', 'If', '(', 'ctrl', ',', 'block', ')', ']', 'else_block', '=', 'Block', '(', ')', 'while', 'self', '.', 'cur_to... | control : 'if' ctrl_exp block ('elif' ctrl_exp block)* ('else' block) | ['control', ':', 'if', 'ctrl_exp', 'block', '(', 'elif', 'ctrl_exp', 'block', ')', '*', '(', 'else', 'block', ')'] | train | https://github.com/derpferd/little-python/blob/3f89c74cffb6532c12c5b40843bd8ff8605638ba/littlepython/parser.py#L99-L116 |
5,331 | GoogleCloudPlatform/appengine-mapreduce | python/src/mapreduce/output_writers.py | GoogleCloudStorageConsistentOutputWriter._try_to_clean_garbage | def _try_to_clean_garbage(self, writer_spec, exclude_list=()):
"""Tries to remove any files created by this shard that aren't needed.
Args:
writer_spec: writer_spec for the MR.
exclude_list: A list of filenames (strings) that should not be
removed.
"""
# Try to remove garbage (if an... | python | def _try_to_clean_garbage(self, writer_spec, exclude_list=()):
"""Tries to remove any files created by this shard that aren't needed.
Args:
writer_spec: writer_spec for the MR.
exclude_list: A list of filenames (strings) that should not be
removed.
"""
# Try to remove garbage (if an... | ['def', '_try_to_clean_garbage', '(', 'self', ',', 'writer_spec', ',', 'exclude_list', '=', '(', ')', ')', ':', '# Try to remove garbage (if any). Note that listbucket is not strongly', '# consistent so something might survive.', 'tmpl', '=', 'string', '.', 'Template', '(', 'self', '.', '_TMPFILE_PREFIX', ')', 'prefix'... | Tries to remove any files created by this shard that aren't needed.
Args:
writer_spec: writer_spec for the MR.
exclude_list: A list of filenames (strings) that should not be
removed. | ['Tries', 'to', 'remove', 'any', 'files', 'created', 'by', 'this', 'shard', 'that', 'aren', 't', 'needed', '.'] | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/output_writers.py#L1014-L1032 |
5,332 | inveniosoftware-attic/invenio-utils | invenio_utils/text.py | remove_line_breaks | def remove_line_breaks(text):
"""Remove line breaks from input.
Including unicode 'line separator', 'paragraph separator',
and 'next line' characters.
"""
return unicode(text, 'utf-8').replace('\f', '').replace('\n', '') \
.replace('\r', '').replace(u'\xe2\x80\xa8', '') \
.replace(u... | python | def remove_line_breaks(text):
"""Remove line breaks from input.
Including unicode 'line separator', 'paragraph separator',
and 'next line' characters.
"""
return unicode(text, 'utf-8').replace('\f', '').replace('\n', '') \
.replace('\r', '').replace(u'\xe2\x80\xa8', '') \
.replace(u... | ['def', 'remove_line_breaks', '(', 'text', ')', ':', 'return', 'unicode', '(', 'text', ',', "'utf-8'", ')', '.', 'replace', '(', "'\\f'", ',', "''", ')', '.', 'replace', '(', "'\\n'", ',', "''", ')', '.', 'replace', '(', "'\\r'", ',', "''", ')', '.', 'replace', '(', "u'\\xe2\\x80\\xa8'", ',', "''", ')', '.', 'replace',... | Remove line breaks from input.
Including unicode 'line separator', 'paragraph separator',
and 'next line' characters. | ['Remove', 'line', 'breaks', 'from', 'input', '.'] | train | https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/text.py#L486-L495 |
5,333 | ga4gh/ga4gh-server | ga4gh/server/datamodel/rna_quantification.py | SqliteRnaQuantificationSet.populateFromFile | def populateFromFile(self, dataUrl):
"""
Populates the instance variables of this RnaQuantificationSet from the
specified data URL.
"""
self._dbFilePath = dataUrl
self._db = SqliteRnaBackend(self._dbFilePath)
self.addRnaQuants() | python | def populateFromFile(self, dataUrl):
"""
Populates the instance variables of this RnaQuantificationSet from the
specified data URL.
"""
self._dbFilePath = dataUrl
self._db = SqliteRnaBackend(self._dbFilePath)
self.addRnaQuants() | ['def', 'populateFromFile', '(', 'self', ',', 'dataUrl', ')', ':', 'self', '.', '_dbFilePath', '=', 'dataUrl', 'self', '.', '_db', '=', 'SqliteRnaBackend', '(', 'self', '.', '_dbFilePath', ')', 'self', '.', 'addRnaQuants', '(', ')'] | Populates the instance variables of this RnaQuantificationSet from the
specified data URL. | ['Populates', 'the', 'instance', 'variables', 'of', 'this', 'RnaQuantificationSet', 'from', 'the', 'specified', 'data', 'URL', '.'] | train | https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/rna_quantification.py#L167-L174 |
5,334 | senaite/senaite.core | bika/lims/workflow/__init__.py | doActionFor | def doActionFor(instance, action_id, idxs=None):
"""Tries to perform the transition to the instance.
Object is reindexed after the transition takes place, but only if succeeds.
If idxs is set, only these indexes will be reindexed. Otherwise, will try
to use the indexes defined in ACTIONS_TO_INDEX mappin... | python | def doActionFor(instance, action_id, idxs=None):
"""Tries to perform the transition to the instance.
Object is reindexed after the transition takes place, but only if succeeds.
If idxs is set, only these indexes will be reindexed. Otherwise, will try
to use the indexes defined in ACTIONS_TO_INDEX mappin... | ['def', 'doActionFor', '(', 'instance', ',', 'action_id', ',', 'idxs', '=', 'None', ')', ':', 'if', 'not', 'instance', ':', 'return', 'False', ',', '""', 'if', 'isinstance', '(', 'instance', ',', 'list', ')', ':', '# TODO Workflow . Check if this is strictly necessary', '# This check is here because sometimes Plone cre... | Tries to perform the transition to the instance.
Object is reindexed after the transition takes place, but only if succeeds.
If idxs is set, only these indexes will be reindexed. Otherwise, will try
to use the indexes defined in ACTIONS_TO_INDEX mapping if any.
:param instance: Object to be transitioned... | ['Tries', 'to', 'perform', 'the', 'transition', 'to', 'the', 'instance', '.', 'Object', 'is', 'reindexed', 'after', 'the', 'transition', 'takes', 'place', 'but', 'only', 'if', 'succeeds', '.', 'If', 'idxs', 'is', 'set', 'only', 'these', 'indexes', 'will', 'be', 'reindexed', '.', 'Otherwise', 'will', 'try', 'to', 'use',... | train | https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/workflow/__init__.py#L70-L141 |
5,335 | PredixDev/predixpy | predix/security/uaa.py | UserAccountAuthentication.assert_has_permission | def assert_has_permission(self, scope_required):
"""
Warn that the required scope is not found in the scopes
granted to the currently authenticated user.
::
# The admin user should have client admin permissions
uaa.assert_has_permission('admin', 'clients.admin')... | python | def assert_has_permission(self, scope_required):
"""
Warn that the required scope is not found in the scopes
granted to the currently authenticated user.
::
# The admin user should have client admin permissions
uaa.assert_has_permission('admin', 'clients.admin')... | ['def', 'assert_has_permission', '(', 'self', ',', 'scope_required', ')', ':', 'if', 'not', 'self', '.', 'authenticated', ':', 'raise', 'ValueError', '(', '"Must first authenticate()"', ')', 'if', 'scope_required', 'not', 'in', 'self', '.', 'get_scopes', '(', ')', ':', 'logging', '.', 'warning', '(', '"Authenticated as... | Warn that the required scope is not found in the scopes
granted to the currently authenticated user.
::
# The admin user should have client admin permissions
uaa.assert_has_permission('admin', 'clients.admin') | ['Warn', 'that', 'the', 'required', 'scope', 'is', 'not', 'found', 'in', 'the', 'scopes', 'granted', 'to', 'the', 'currently', 'authenticated', 'user', '.'] | train | https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/security/uaa.py#L334-L355 |
5,336 | michaelpb/omnic | omnic/types/resource.py | Resource.cache_makedirs | def cache_makedirs(self, subdir=None):
'''
Make necessary directories to hold cache value
'''
if subdir is not None:
dirname = self.cache_path
if subdir:
dirname = os.path.join(dirname, subdir)
else:
dirname = os.path.dirname(se... | python | def cache_makedirs(self, subdir=None):
'''
Make necessary directories to hold cache value
'''
if subdir is not None:
dirname = self.cache_path
if subdir:
dirname = os.path.join(dirname, subdir)
else:
dirname = os.path.dirname(se... | ['def', 'cache_makedirs', '(', 'self', ',', 'subdir', '=', 'None', ')', ':', 'if', 'subdir', 'is', 'not', 'None', ':', 'dirname', '=', 'self', '.', 'cache_path', 'if', 'subdir', ':', 'dirname', '=', 'os', '.', 'path', '.', 'join', '(', 'dirname', ',', 'subdir', ')', 'else', ':', 'dirname', '=', 'os', '.', 'path', '.', ... | Make necessary directories to hold cache value | ['Make', 'necessary', 'directories', 'to', 'hold', 'cache', 'value'] | train | https://github.com/michaelpb/omnic/blob/1111cfd73c9dc1955afe42d9cf2a468c46f83cd6/omnic/types/resource.py#L63-L73 |
5,337 | fhamborg/news-please | newsplease/pipeline/extractor/comparer/comparer_date.py | ComparerDate.extract | def extract(self, item, list_article_candidate):
"""Compares the extracted publish dates.
:param item: The corresponding NewscrawlerItem
:param list_article_candidate: A list, the list of ArticleCandidate-Objects which have been extracted
:return: A string, the most likely publish date
... | python | def extract(self, item, list_article_candidate):
"""Compares the extracted publish dates.
:param item: The corresponding NewscrawlerItem
:param list_article_candidate: A list, the list of ArticleCandidate-Objects which have been extracted
:return: A string, the most likely publish date
... | ['def', 'extract', '(', 'self', ',', 'item', ',', 'list_article_candidate', ')', ':', 'list_publish_date', '=', '[', ']', 'for', 'article_candidate', 'in', 'list_article_candidate', ':', 'if', 'article_candidate', '.', 'publish_date', '!=', 'None', ':', 'list_publish_date', '.', 'append', '(', '(', 'article_candidate',... | Compares the extracted publish dates.
:param item: The corresponding NewscrawlerItem
:param list_article_candidate: A list, the list of ArticleCandidate-Objects which have been extracted
:return: A string, the most likely publish date | ['Compares', 'the', 'extracted', 'publish', 'dates', '.'] | train | https://github.com/fhamborg/news-please/blob/731837c2a6c223cfb3e1d7f5fdc4f4eced2310f9/newsplease/pipeline/extractor/comparer/comparer_date.py#L4-L28 |
5,338 | noxdafox/clipspy | clips/agenda.py | Agenda.agenda_changed | def agenda_changed(self):
"""True if any rule activation changes have occurred."""
value = bool(lib.EnvGetAgendaChanged(self._env))
lib.EnvSetAgendaChanged(self._env, int(False))
return value | python | def agenda_changed(self):
"""True if any rule activation changes have occurred."""
value = bool(lib.EnvGetAgendaChanged(self._env))
lib.EnvSetAgendaChanged(self._env, int(False))
return value | ['def', 'agenda_changed', '(', 'self', ')', ':', 'value', '=', 'bool', '(', 'lib', '.', 'EnvGetAgendaChanged', '(', 'self', '.', '_env', ')', ')', 'lib', '.', 'EnvSetAgendaChanged', '(', 'self', '.', '_env', ',', 'int', '(', 'False', ')', ')', 'return', 'value'] | True if any rule activation changes have occurred. | ['True', 'if', 'any', 'rule', 'activation', 'changes', 'have', 'occurred', '.'] | train | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/agenda.py#L64-L69 |
5,339 | cloudsigma/cgroupspy | cgroupspy/nodes.py | Node._get_controller_type | def _get_controller_type(self):
"""Returns the current node's controller type"""
if self.node_type == self.NODE_CONTROLLER_ROOT and self.name in self.CONTROLLERS:
return self.name
elif self.parent:
return self.parent.controller_type
else:
return None | python | def _get_controller_type(self):
"""Returns the current node's controller type"""
if self.node_type == self.NODE_CONTROLLER_ROOT and self.name in self.CONTROLLERS:
return self.name
elif self.parent:
return self.parent.controller_type
else:
return None | ['def', '_get_controller_type', '(', 'self', ')', ':', 'if', 'self', '.', 'node_type', '==', 'self', '.', 'NODE_CONTROLLER_ROOT', 'and', 'self', '.', 'name', 'in', 'self', '.', 'CONTROLLERS', ':', 'return', 'self', '.', 'name', 'elif', 'self', '.', 'parent', ':', 'return', 'self', '.', 'parent', '.', 'controller_type',... | Returns the current node's controller type | ['Returns', 'the', 'current', 'node', 's', 'controller', 'type'] | train | https://github.com/cloudsigma/cgroupspy/blob/e705ac4ccdfe33d8ecc700e9a35a9556084449ca/cgroupspy/nodes.py#L120-L128 |
5,340 | Erotemic/utool | utool/util_path.py | ancestor_paths | def ancestor_paths(start=None, limit={}):
"""
All paths above you
"""
import utool as ut
limit = ut.ensure_iterable(limit)
limit = {expanduser(p) for p in limit}.union(set(limit))
if start is None:
start = os.getcwd()
path = start
prev = None
while path != prev and prev n... | python | def ancestor_paths(start=None, limit={}):
"""
All paths above you
"""
import utool as ut
limit = ut.ensure_iterable(limit)
limit = {expanduser(p) for p in limit}.union(set(limit))
if start is None:
start = os.getcwd()
path = start
prev = None
while path != prev and prev n... | ['def', 'ancestor_paths', '(', 'start', '=', 'None', ',', 'limit', '=', '{', '}', ')', ':', 'import', 'utool', 'as', 'ut', 'limit', '=', 'ut', '.', 'ensure_iterable', '(', 'limit', ')', 'limit', '=', '{', 'expanduser', '(', 'p', ')', 'for', 'p', 'in', 'limit', '}', '.', 'union', '(', 'set', '(', 'limit', ')', ')', 'if'... | All paths above you | ['All', 'paths', 'above', 'you'] | train | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_path.py#L2436-L2450 |
5,341 | romanorac/discomll | discomll/regression/locally_weighted_linear_regression.py | fit_predict | def fit_predict(training_data, fitting_data, tau=1, samples_per_job=0, save_results=True, show=False):
from disco.worker.pipeline.worker import Worker, Stage
from disco.core import Job, result_iterator
from disco.core import Disco
"""
training_data - training samples
fitting_data - dataset to b... | python | def fit_predict(training_data, fitting_data, tau=1, samples_per_job=0, save_results=True, show=False):
from disco.worker.pipeline.worker import Worker, Stage
from disco.core import Job, result_iterator
from disco.core import Disco
"""
training_data - training samples
fitting_data - dataset to b... | ['def', 'fit_predict', '(', 'training_data', ',', 'fitting_data', ',', 'tau', '=', '1', ',', 'samples_per_job', '=', '0', ',', 'save_results', '=', 'True', ',', 'show', '=', 'False', ')', ':', 'from', 'disco', '.', 'worker', '.', 'pipeline', '.', 'worker', 'import', 'Worker', ',', 'Stage', 'from', 'disco', '.', 'core',... | training_data - training samples
fitting_data - dataset to be fitted to training data.
tau - controls how quickly the weight of a training sample falls off with distance of its x(i) from the query point x.
samples_per_job - define a number of samples that will be processed in single mapreduce job. If 0, alg... | ['training_data', '-', 'training', 'samples', 'fitting_data', '-', 'dataset', 'to', 'be', 'fitted', 'to', 'training', 'data', '.', 'tau', '-', 'controls', 'how', 'quickly', 'the', 'weight', 'of', 'a', 'training', 'sample', 'falls', 'off', 'with', 'distance', 'of', 'its', 'x', '(', 'i', ')', 'from', 'the', 'query', 'poi... | train | https://github.com/romanorac/discomll/blob/a4703daffb2ba3c9f614bc3dbe45ae55884aea00/discomll/regression/locally_weighted_linear_regression.py#L83-L139 |
5,342 | spyder-ide/spyder | spyder/plugins/editor/plugin.py | Editor.new | def new(self, fname=None, editorstack=None, text=None):
"""
Create a new file - Untitled
fname=None --> fname will be 'untitledXX.py' but do not create file
fname=<basestring> --> create file
"""
# If no text is provided, create default content
empty = Fa... | python | def new(self, fname=None, editorstack=None, text=None):
"""
Create a new file - Untitled
fname=None --> fname will be 'untitledXX.py' but do not create file
fname=<basestring> --> create file
"""
# If no text is provided, create default content
empty = Fa... | ['def', 'new', '(', 'self', ',', 'fname', '=', 'None', ',', 'editorstack', '=', 'None', ',', 'text', '=', 'None', ')', ':', '# If no text is provided, create default content\r', 'empty', '=', 'False', 'try', ':', 'if', 'text', 'is', 'None', ':', 'default_content', '=', 'True', 'text', ',', 'enc', '=', 'encoding', '.', ... | Create a new file - Untitled
fname=None --> fname will be 'untitledXX.py' but do not create file
fname=<basestring> --> create file | ['Create', 'a', 'new', 'file', '-', 'Untitled', 'fname', '=', 'None', '--', '>', 'fname', 'will', 'be', 'untitledXX', '.', 'py', 'but', 'do', 'not', 'create', 'file', 'fname', '=', '<basestring', '>', '--', '>', 'create', 'file'] | train | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1565-L1646 |
5,343 | guaix-ucm/numina | numina/array/interpolation.py | SteffenInterpolator._poly_eval_0 | def _poly_eval_0(self, u, ids):
"""Evaluate internal polynomial."""
return u * (u * (self._a[ids] * u + self._b[ids]) + self._c[ids]) + self._d[ids] | python | def _poly_eval_0(self, u, ids):
"""Evaluate internal polynomial."""
return u * (u * (self._a[ids] * u + self._b[ids]) + self._c[ids]) + self._d[ids] | ['def', '_poly_eval_0', '(', 'self', ',', 'u', ',', 'ids', ')', ':', 'return', 'u', '*', '(', 'u', '*', '(', 'self', '.', '_a', '[', 'ids', ']', '*', 'u', '+', 'self', '.', '_b', '[', 'ids', ']', ')', '+', 'self', '.', '_c', '[', 'ids', ']', ')', '+', 'self', '.', '_d', '[', 'ids', ']'] | Evaluate internal polynomial. | ['Evaluate', 'internal', 'polynomial', '.'] | train | https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/array/interpolation.py#L218-L220 |
5,344 | cggh/scikit-allel | allel/model/ndarray.py | FeatureTable.from_gff3 | def from_gff3(path, attributes=None, region=None, score_fill=-1, phase_fill=-1,
attributes_fill='.', dtype=None):
"""Read a feature table from a GFF3 format file.
Parameters
----------
path : string
File path.
attributes : list of strings, optional
... | python | def from_gff3(path, attributes=None, region=None, score_fill=-1, phase_fill=-1,
attributes_fill='.', dtype=None):
"""Read a feature table from a GFF3 format file.
Parameters
----------
path : string
File path.
attributes : list of strings, optional
... | ['def', 'from_gff3', '(', 'path', ',', 'attributes', '=', 'None', ',', 'region', '=', 'None', ',', 'score_fill', '=', '-', '1', ',', 'phase_fill', '=', '-', '1', ',', 'attributes_fill', '=', "'.'", ',', 'dtype', '=', 'None', ')', ':', 'a', '=', 'gff3_to_recarray', '(', 'path', ',', 'attributes', '=', 'attributes', ',',... | Read a feature table from a GFF3 format file.
Parameters
----------
path : string
File path.
attributes : list of strings, optional
List of columns to extract from the "attributes" field.
region : string, optional
Genome region to extract. If ... | ['Read', 'a', 'feature', 'table', 'from', 'a', 'GFF3', 'format', 'file', '.'] | train | https://github.com/cggh/scikit-allel/blob/3c979a57a100240ba959dd13f98839349530f215/allel/model/ndarray.py#L4760-L4795 |
5,345 | scopus-api/scopus | scopus/abstract_retrieval.py | AbstractRetrieval.confdate | def confdate(self):
"""Date range of the conference the abstract belongs to represented
by two tuples in the form (YYYY, MM, DD).
"""
date = self._confevent.get('confdate', {})
if len(date) > 0:
start = {k: int(v) for k, v in date['startdate'].items()}
end... | python | def confdate(self):
"""Date range of the conference the abstract belongs to represented
by two tuples in the form (YYYY, MM, DD).
"""
date = self._confevent.get('confdate', {})
if len(date) > 0:
start = {k: int(v) for k, v in date['startdate'].items()}
end... | ['def', 'confdate', '(', 'self', ')', ':', 'date', '=', 'self', '.', '_confevent', '.', 'get', '(', "'confdate'", ',', '{', '}', ')', 'if', 'len', '(', 'date', ')', '>', '0', ':', 'start', '=', '{', 'k', ':', 'int', '(', 'v', ')', 'for', 'k', ',', 'v', 'in', 'date', '[', "'startdate'", ']', '.', 'items', '(', ')', '}',... | Date range of the conference the abstract belongs to represented
by two tuples in the form (YYYY, MM, DD). | ['Date', 'range', 'of', 'the', 'conference', 'the', 'abstract', 'belongs', 'to', 'represented', 'by', 'two', 'tuples', 'in', 'the', 'form', '(', 'YYYY', 'MM', 'DD', ')', '.'] | train | https://github.com/scopus-api/scopus/blob/27ce02dd3095bfdab9d3e8475543d7c17767d1ab/scopus/abstract_retrieval.py#L153-L164 |
5,346 | Roastero/freshroastsr700 | freshroastsr700/__init__.py | freshroastsr700.heat_setting | def heat_setting(self, value):
"""Verifies that the heat setting is between 0 and 3."""
if value not in range(0, 4):
raise exceptions.RoasterValueError
self._heat_setting.value = value | python | def heat_setting(self, value):
"""Verifies that the heat setting is between 0 and 3."""
if value not in range(0, 4):
raise exceptions.RoasterValueError
self._heat_setting.value = value | ['def', 'heat_setting', '(', 'self', ',', 'value', ')', ':', 'if', 'value', 'not', 'in', 'range', '(', '0', ',', '4', ')', ':', 'raise', 'exceptions', '.', 'RoasterValueError', 'self', '.', '_heat_setting', '.', 'value', '=', 'value'] | Verifies that the heat setting is between 0 and 3. | ['Verifies', 'that', 'the', 'heat', 'setting', 'is', 'between', '0', 'and', '3', '.'] | train | https://github.com/Roastero/freshroastsr700/blob/49cf4961444c0f56d051d5ac5088ace480b54f02/freshroastsr700/__init__.py#L259-L264 |
5,347 | PythonCharmers/python-future | src/future/backports/email/encoders.py | encode_7or8bit | def encode_7or8bit(msg):
"""Set the Content-Transfer-Encoding header to 7bit or 8bit."""
orig = msg.get_payload()
if orig is None:
# There's no payload. For backwards compatibility we use 7bit
msg['Content-Transfer-Encoding'] = '7bit'
return
# We play a trick to make this go fas... | python | def encode_7or8bit(msg):
"""Set the Content-Transfer-Encoding header to 7bit or 8bit."""
orig = msg.get_payload()
if orig is None:
# There's no payload. For backwards compatibility we use 7bit
msg['Content-Transfer-Encoding'] = '7bit'
return
# We play a trick to make this go fas... | ['def', 'encode_7or8bit', '(', 'msg', ')', ':', 'orig', '=', 'msg', '.', 'get_payload', '(', ')', 'if', 'orig', 'is', 'None', ':', "# There's no payload. For backwards compatibility we use 7bit", 'msg', '[', "'Content-Transfer-Encoding'", ']', '=', "'7bit'", 'return', '# We play a trick to make this go fast. If encod... | Set the Content-Transfer-Encoding header to 7bit or 8bit. | ['Set', 'the', 'Content', '-', 'Transfer', '-', 'Encoding', 'header', 'to', '7bit', 'or', '8bit', '.'] | train | https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/email/encoders.py#L55-L80 |
5,348 | explosion/spaCy | spacy/util.py | compile_suffix_regex | def compile_suffix_regex(entries):
"""Compile a sequence of suffix rules into a regex object.
entries (tuple): The suffix rules, e.g. spacy.lang.punctuation.TOKENIZER_SUFFIXES.
RETURNS (regex object): The regex object. to be used for Tokenizer.suffix_search.
"""
expression = "|".join([piece + "$" f... | python | def compile_suffix_regex(entries):
"""Compile a sequence of suffix rules into a regex object.
entries (tuple): The suffix rules, e.g. spacy.lang.punctuation.TOKENIZER_SUFFIXES.
RETURNS (regex object): The regex object. to be used for Tokenizer.suffix_search.
"""
expression = "|".join([piece + "$" f... | ['def', 'compile_suffix_regex', '(', 'entries', ')', ':', 'expression', '=', '"|"', '.', 'join', '(', '[', 'piece', '+', '"$"', 'for', 'piece', 'in', 'entries', 'if', 'piece', '.', 'strip', '(', ')', ']', ')', 'return', 're', '.', 'compile', '(', 'expression', ')'] | Compile a sequence of suffix rules into a regex object.
entries (tuple): The suffix rules, e.g. spacy.lang.punctuation.TOKENIZER_SUFFIXES.
RETURNS (regex object): The regex object. to be used for Tokenizer.suffix_search. | ['Compile', 'a', 'sequence', 'of', 'suffix', 'rules', 'into', 'a', 'regex', 'object', '.'] | train | https://github.com/explosion/spaCy/blob/8ee4100f8ffb336886208a1ea827bf4c745e2709/spacy/util.py#L346-L353 |
5,349 | EnigmaBridge/client.py | ebclient/process_data.py | ProcessData.call | def call(self, input_data=None, *args, **kwargs):
"""
Calls the request with input data using given configuration (retry, timeout, ...).
:param input_data:
:param args:
:param kwargs:
:return:
"""
self.build_request(input_data)
self.caller = Reques... | python | def call(self, input_data=None, *args, **kwargs):
"""
Calls the request with input data using given configuration (retry, timeout, ...).
:param input_data:
:param args:
:param kwargs:
:return:
"""
self.build_request(input_data)
self.caller = Reques... | ['def', 'call', '(', 'self', ',', 'input_data', '=', 'None', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'build_request', '(', 'input_data', ')', 'self', '.', 'caller', '=', 'RequestCall', '(', 'self', '.', 'request', ')', 'self', '.', 'exception', '=', 'None', 'try', ':', 'self', '.', 'caller', '... | Calls the request with input data using given configuration (retry, timeout, ...).
:param input_data:
:param args:
:param kwargs:
:return: | ['Calls', 'the', 'request', 'with', 'input', 'data', 'using', 'given', 'configuration', '(', 'retry', 'timeout', '...', ')', '.', ':', 'param', 'input_data', ':', ':', 'param', 'args', ':', ':', 'param', 'kwargs', ':', ':', 'return', ':'] | train | https://github.com/EnigmaBridge/client.py/blob/0fafe3902da394da88e9f960751d695ca65bbabd/ebclient/process_data.py#L32-L53 |
5,350 | lrq3000/pyFileFixity | pyFileFixity/replication_repair.py | synchronize_files | def synchronize_files(inputpaths, outpath, database=None, tqdm_bar=None, report_file=None, ptee=None, verbose=False):
''' Main function to synchronize files contents by majority vote
The main job of this function is to walk through the input folders and align the files, so that we can compare every files across... | python | def synchronize_files(inputpaths, outpath, database=None, tqdm_bar=None, report_file=None, ptee=None, verbose=False):
''' Main function to synchronize files contents by majority vote
The main job of this function is to walk through the input folders and align the files, so that we can compare every files across... | ['def', 'synchronize_files', '(', 'inputpaths', ',', 'outpath', ',', 'database', '=', 'None', ',', 'tqdm_bar', '=', 'None', ',', 'report_file', '=', 'None', ',', 'ptee', '=', 'None', ',', 'verbose', '=', 'False', ')', ':', '# (Generator) Files Synchronization Algorithm:', '# Needs a function stable_dir_walking, which w... | Main function to synchronize files contents by majority vote
The main job of this function is to walk through the input folders and align the files, so that we can compare every files across every folders, one by one.
The whole trick here is to align files, so that we don't need to memorize all the files in mem... | ['Main', 'function', 'to', 'synchronize', 'files', 'contents', 'by', 'majority', 'vote', 'The', 'main', 'job', 'of', 'this', 'function', 'is', 'to', 'walk', 'through', 'the', 'input', 'folders', 'and', 'align', 'the', 'files', 'so', 'that', 'we', 'can', 'compare', 'every', 'files', 'across', 'every', 'folders', 'one', ... | train | https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/replication_repair.py#L232-L394 |
5,351 | jadolg/rocketchat_API | rocketchat_API/rocketchat.py | RocketChat.channels_archive | def channels_archive(self, room_id, **kwargs):
"""Archives a channel."""
return self.__call_api_post('channels.archive', roomId=room_id, kwargs=kwargs) | python | def channels_archive(self, room_id, **kwargs):
"""Archives a channel."""
return self.__call_api_post('channels.archive', roomId=room_id, kwargs=kwargs) | ['def', 'channels_archive', '(', 'self', ',', 'room_id', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', '__call_api_post', '(', "'channels.archive'", ',', 'roomId', '=', 'room_id', ',', 'kwargs', '=', 'kwargs', ')'] | Archives a channel. | ['Archives', 'a', 'channel', '.'] | train | https://github.com/jadolg/rocketchat_API/blob/f220d094434991cb9892418245f054ea06f28aad/rocketchat_API/rocketchat.py#L316-L318 |
5,352 | mitsei/dlkit | dlkit/json_/authorization/objects.py | Authorization.get_qualifier_id | def get_qualifier_id(self):
"""Gets the ``Qualifier Id`` for this authorization.
return: (osid.id.Id) - the qualifier ``Id``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.Activity.get_objective_id
if not bo... | python | def get_qualifier_id(self):
"""Gets the ``Qualifier Id`` for this authorization.
return: (osid.id.Id) - the qualifier ``Id``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.Activity.get_objective_id
if not bo... | ['def', 'get_qualifier_id', '(', 'self', ')', ':', '# Implemented from template for osid.learning.Activity.get_objective_id', 'if', 'not', 'bool', '(', 'self', '.', '_my_map', '[', "'qualifierId'", ']', ')', ':', 'raise', 'errors', '.', 'IllegalState', '(', "'qualifier empty'", ')', 'return', 'Id', '(', 'self', '.', '_... | Gets the ``Qualifier Id`` for this authorization.
return: (osid.id.Id) - the qualifier ``Id``
*compliance: mandatory -- This method must be implemented.* | ['Gets', 'the', 'Qualifier', 'Id', 'for', 'this', 'authorization', '.'] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/objects.py#L261-L271 |
5,353 | senaite/senaite.core | bika/lims/content/worksheet.py | Worksheet.add_duplicate_analysis | def add_duplicate_analysis(self, src_analysis, destination_slot,
ref_gid=None):
"""
Creates a duplicate of the src_analysis passed in. If the analysis
passed in is not an IRoutineAnalysis, is retracted or has dependent
services, returns None.If no reference... | python | def add_duplicate_analysis(self, src_analysis, destination_slot,
ref_gid=None):
"""
Creates a duplicate of the src_analysis passed in. If the analysis
passed in is not an IRoutineAnalysis, is retracted or has dependent
services, returns None.If no reference... | ['def', 'add_duplicate_analysis', '(', 'self', ',', 'src_analysis', ',', 'destination_slot', ',', 'ref_gid', '=', 'None', ')', ':', 'if', 'not', 'src_analysis', ':', 'return', 'None', 'if', 'not', 'IRoutineAnalysis', '.', 'providedBy', '(', 'src_analysis', ')', ':', 'logger', '.', 'warning', '(', "'Cannot create duplic... | Creates a duplicate of the src_analysis passed in. If the analysis
passed in is not an IRoutineAnalysis, is retracted or has dependent
services, returns None.If no reference analyses group id (ref_gid) is
set, the value will be generated automatically.
:param src_analysis: analysis to cr... | ['Creates', 'a', 'duplicate', 'of', 'the', 'src_analysis', 'passed', 'in', '.', 'If', 'the', 'analysis', 'passed', 'in', 'is', 'not', 'an', 'IRoutineAnalysis', 'is', 'retracted', 'or', 'has', 'dependent', 'services', 'returns', 'None', '.', 'If', 'no', 'reference', 'analyses', 'group', 'id', '(', 'ref_gid', ')', 'is', ... | train | https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/content/worksheet.py#L475-L530 |
5,354 | treycucco/bidon | bidon/util/transform.py | get_composition | def get_composition(source, *fxns):
"""Compose several extractors together, on a source."""
val = source
for fxn in fxns:
val = fxn(val)
return val | python | def get_composition(source, *fxns):
"""Compose several extractors together, on a source."""
val = source
for fxn in fxns:
val = fxn(val)
return val | ['def', 'get_composition', '(', 'source', ',', '*', 'fxns', ')', ':', 'val', '=', 'source', 'for', 'fxn', 'in', 'fxns', ':', 'val', '=', 'fxn', '(', 'val', ')', 'return', 'val'] | Compose several extractors together, on a source. | ['Compose', 'several', 'extractors', 'together', 'on', 'a', 'source', '.'] | train | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/transform.py#L65-L70 |
5,355 | pgjones/quart | quart/app.py | Quart.after_websocket | def after_websocket(self, func: Callable, name: AppOrBlueprintKey=None) -> Callable:
"""Add an after websocket function.
This is designed to be used as a decorator. An example usage,
.. code-block:: python
@app.after_websocket
def func(response):
return... | python | def after_websocket(self, func: Callable, name: AppOrBlueprintKey=None) -> Callable:
"""Add an after websocket function.
This is designed to be used as a decorator. An example usage,
.. code-block:: python
@app.after_websocket
def func(response):
return... | ['def', 'after_websocket', '(', 'self', ',', 'func', ':', 'Callable', ',', 'name', ':', 'AppOrBlueprintKey', '=', 'None', ')', '->', 'Callable', ':', 'handler', '=', 'ensure_coroutine', '(', 'func', ')', 'self', '.', 'after_websocket_funcs', '[', 'name', ']', '.', 'append', '(', 'handler', ')', 'return', 'func'] | Add an after websocket function.
This is designed to be used as a decorator. An example usage,
.. code-block:: python
@app.after_websocket
def func(response):
return response
Arguments:
func: The after websocket function itself.
... | ['Add', 'an', 'after', 'websocket', 'function', '.'] | train | https://github.com/pgjones/quart/blob/7cb2d3bd98e8746025764f2b933abc12041fa175/quart/app.py#L1104-L1121 |
5,356 | HazyResearch/fonduer | src/fonduer/features/feature_libs/table_features.py | tablelib_binary_features | def tablelib_binary_features(span1, span2):
"""
Table-/structure-related features for a pair of spans
"""
binary_features = settings["featurization"]["table"]["binary_features"]
if span1.sentence.is_tabular() and span2.sentence.is_tabular():
if span1.sentence.table == span2.sentence.table:
... | python | def tablelib_binary_features(span1, span2):
"""
Table-/structure-related features for a pair of spans
"""
binary_features = settings["featurization"]["table"]["binary_features"]
if span1.sentence.is_tabular() and span2.sentence.is_tabular():
if span1.sentence.table == span2.sentence.table:
... | ['def', 'tablelib_binary_features', '(', 'span1', ',', 'span2', ')', ':', 'binary_features', '=', 'settings', '[', '"featurization"', ']', '[', '"table"', ']', '[', '"binary_features"', ']', 'if', 'span1', '.', 'sentence', '.', 'is_tabular', '(', ')', 'and', 'span2', '.', 'sentence', '.', 'is_tabular', '(', ')', ':', '... | Table-/structure-related features for a pair of spans | ['Table', '-', '/', 'structure', '-', 'related', 'features', 'for', 'a', 'pair', 'of', 'spans'] | train | https://github.com/HazyResearch/fonduer/blob/4520f86a716f03dcca458a9f4bddac75b4e7068f/src/fonduer/features/feature_libs/table_features.py#L128-L181 |
5,357 | blockstack/blockstack-files | blockstack_file/blockstack_file.py | file_sign | def file_sign( blockchain_id, hostname, input_path, passphrase=None, config_path=CONFIG_PATH, wallet_keys=None ):
"""
Sign a file with the current blockchain ID's host's public key.
@config_path should be for the *client*, not blockstack-file
Return {'status': True, 'sender_key_id': ..., 'sig': ...} on ... | python | def file_sign( blockchain_id, hostname, input_path, passphrase=None, config_path=CONFIG_PATH, wallet_keys=None ):
"""
Sign a file with the current blockchain ID's host's public key.
@config_path should be for the *client*, not blockstack-file
Return {'status': True, 'sender_key_id': ..., 'sig': ...} on ... | ['def', 'file_sign', '(', 'blockchain_id', ',', 'hostname', ',', 'input_path', ',', 'passphrase', '=', 'None', ',', 'config_path', '=', 'CONFIG_PATH', ',', 'wallet_keys', '=', 'None', ')', ':', 'config_dir', '=', 'os', '.', 'path', '.', 'dirname', '(', 'config_path', ')', '# find our encryption key', 'key_info', '=', '... | Sign a file with the current blockchain ID's host's public key.
@config_path should be for the *client*, not blockstack-file
Return {'status': True, 'sender_key_id': ..., 'sig': ...} on success, and write ciphertext to output_path
Return {'error': ...} on error | ['Sign', 'a', 'file', 'with', 'the', 'current', 'blockchain', 'ID', 's', 'host', 's', 'public', 'key', '.'] | train | https://github.com/blockstack/blockstack-files/blob/8d88cc48bdf8ed57f17d4bba860e972bde321921/blockstack_file/blockstack_file.py#L419-L439 |
5,358 | twitterdev/twitter-python-ads-sdk | twitter_ads/cursor.py | Cursor.next | def next(self):
"""Returns the next item in the cursor."""
if self._current_index < len(self._collection):
value = self._collection[self._current_index]
self._current_index += 1
return value
elif self._next_cursor:
self.__fetch_next()
r... | python | def next(self):
"""Returns the next item in the cursor."""
if self._current_index < len(self._collection):
value = self._collection[self._current_index]
self._current_index += 1
return value
elif self._next_cursor:
self.__fetch_next()
r... | ['def', 'next', '(', 'self', ')', ':', 'if', 'self', '.', '_current_index', '<', 'len', '(', 'self', '.', '_collection', ')', ':', 'value', '=', 'self', '.', '_collection', '[', 'self', '.', '_current_index', ']', 'self', '.', '_current_index', '+=', '1', 'return', 'value', 'elif', 'self', '.', '_next_cursor', ':', 'se... | Returns the next item in the cursor. | ['Returns', 'the', 'next', 'item', 'in', 'the', 'cursor', '.'] | train | https://github.com/twitterdev/twitter-python-ads-sdk/blob/b4488333ac2a794b85b7f16ded71e98b60e51c74/twitter_ads/cursor.py#L62-L73 |
5,359 | Chilipp/psyplot | psyplot/data.py | InteractiveList.start_update | def start_update(self, draw=None, queues=None):
"""
Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`auto_update` attribute of this instance is True and the
... | python | def start_update(self, draw=None, queues=None):
"""
Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`auto_update` attribute of this instance is True and the
... | ['def', 'start_update', '(', 'self', ',', 'draw', '=', 'None', ',', 'queues', '=', 'None', ')', ':', 'if', 'queues', 'is', 'not', 'None', ':', 'queues', '[', '0', ']', '.', 'get', '(', ')', 'try', ':', 'for', 'arr', 'in', 'self', ':', 'arr', '.', 'psy', '.', 'start_update', '(', 'draw', '=', 'False', ')', 'self', '.', ... | Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`auto_update` attribute of this instance is True and the
`auto_update` parameter in the :meth:`update` method has been ... | ['Conduct', 'the', 'formerly', 'registered', 'updates'] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4616-L4649 |
5,360 | summa-tx/riemann | riemann/encoding/bech32.py | segwit_encode | def segwit_encode(hrp, witver, witprog):
"""Encode a segwit address."""
ret = bech32_encode(hrp, [witver] + convertbits(witprog, 8, 5))
if segwit_decode(hrp, ret) == (None, None):
return None
return ret | python | def segwit_encode(hrp, witver, witprog):
"""Encode a segwit address."""
ret = bech32_encode(hrp, [witver] + convertbits(witprog, 8, 5))
if segwit_decode(hrp, ret) == (None, None):
return None
return ret | ['def', 'segwit_encode', '(', 'hrp', ',', 'witver', ',', 'witprog', ')', ':', 'ret', '=', 'bech32_encode', '(', 'hrp', ',', '[', 'witver', ']', '+', 'convertbits', '(', 'witprog', ',', '8', ',', '5', ')', ')', 'if', 'segwit_decode', '(', 'hrp', ',', 'ret', ')', '==', '(', 'None', ',', 'None', ')', ':', 'return', 'None'... | Encode a segwit address. | ['Encode', 'a', 'segwit', 'address', '.'] | train | https://github.com/summa-tx/riemann/blob/04ae336dfd4007ceaed748daadc91cc32fa278ec/riemann/encoding/bech32.py#L69-L74 |
5,361 | curious-containers/cc-core | cc_core/commons/input_references.py | _partition_all_internal | def _partition_all_internal(s, sep):
"""
Uses str.partition() to split every occurrence of sep in s. The returned list does not contain empty strings.
:param s: The string to split.
:param sep: A separator string.
:return: A list of parts split by sep
"""
parts = list(s.partition(sep))
... | python | def _partition_all_internal(s, sep):
"""
Uses str.partition() to split every occurrence of sep in s. The returned list does not contain empty strings.
:param s: The string to split.
:param sep: A separator string.
:return: A list of parts split by sep
"""
parts = list(s.partition(sep))
... | ['def', '_partition_all_internal', '(', 's', ',', 'sep', ')', ':', 'parts', '=', 'list', '(', 's', '.', 'partition', '(', 'sep', ')', ')', '# if sep found', 'if', 'parts', '[', '1', ']', '==', 'sep', ':', 'new_parts', '=', 'partition_all', '(', 'parts', '[', '2', ']', ',', 'sep', ')', 'parts', '.', 'pop', '(', ')', 'pa... | Uses str.partition() to split every occurrence of sep in s. The returned list does not contain empty strings.
:param s: The string to split.
:param sep: A separator string.
:return: A list of parts split by sep | ['Uses', 'str', '.', 'partition', '()', 'to', 'split', 'every', 'occurrence', 'of', 'sep', 'in', 's', '.', 'The', 'returned', 'list', 'does', 'not', 'contain', 'empty', 'strings', '.'] | train | https://github.com/curious-containers/cc-core/blob/eaeb03a4366016aff54fcc6953d052ae12ed599b/cc_core/commons/input_references.py#L35-L55 |
5,362 | rsmuc/health_monitoring_plugins | health_monitoring_plugins/snmpSessionBaseClass.py | state_summary | def state_summary(value, name, state_list, helper, ok_value = 'ok', info = None):
"""
Always add the status to the long output, and if the status is not ok (or ok_value),
we show it in the summary and set the status to critical
"""
# translate the value (integer) we receive to a human readable valu... | python | def state_summary(value, name, state_list, helper, ok_value = 'ok', info = None):
"""
Always add the status to the long output, and if the status is not ok (or ok_value),
we show it in the summary and set the status to critical
"""
# translate the value (integer) we receive to a human readable valu... | ['def', 'state_summary', '(', 'value', ',', 'name', ',', 'state_list', ',', 'helper', ',', 'ok_value', '=', "'ok'", ',', 'info', '=', 'None', ')', ':', '# translate the value (integer) we receive to a human readable value (e.g. ok, critical etc.) with the given state_list', 'state_value', '=', 'state_list', '[', 'int',... | Always add the status to the long output, and if the status is not ok (or ok_value),
we show it in the summary and set the status to critical | ['Always', 'add', 'the', 'status', 'to', 'the', 'long', 'output', 'and', 'if', 'the', 'status', 'is', 'not', 'ok', '(', 'or', 'ok_value', ')', 'we', 'show', 'it', 'in', 'the', 'summary', 'and', 'set', 'the', 'status', 'to', 'critical'] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/snmpSessionBaseClass.py#L152-L167 |
5,363 | GNS3/gns3-server | gns3server/compute/qemu/qemu_vm.py | QemuVM._graphic | def _graphic(self):
"""
Adds the correct graphic options depending of the OS
"""
if sys.platform.startswith("win"):
return []
if len(os.environ.get("DISPLAY", "")) > 0:
return []
if "-nographic" not in self._options:
return ["-nographi... | python | def _graphic(self):
"""
Adds the correct graphic options depending of the OS
"""
if sys.platform.startswith("win"):
return []
if len(os.environ.get("DISPLAY", "")) > 0:
return []
if "-nographic" not in self._options:
return ["-nographi... | ['def', '_graphic', '(', 'self', ')', ':', 'if', 'sys', '.', 'platform', '.', 'startswith', '(', '"win"', ')', ':', 'return', '[', ']', 'if', 'len', '(', 'os', '.', 'environ', '.', 'get', '(', '"DISPLAY"', ',', '""', ')', ')', '>', '0', ':', 'return', '[', ']', 'if', '"-nographic"', 'not', 'in', 'self', '.', '_options'... | Adds the correct graphic options depending of the OS | ['Adds', 'the', 'correct', 'graphic', 'options', 'depending', 'of', 'the', 'OS'] | train | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1603-L1614 |
5,364 | bcbio/bcbio-nextgen | bcbio/broad/picardrun.py | picard_sort | def picard_sort(picard, align_bam, sort_order="coordinate",
out_file=None, compression_level=None, pipe=False):
"""Sort a BAM file by coordinates.
"""
base, ext = os.path.splitext(align_bam)
if out_file is None:
out_file = "%s-sort%s" % (base, ext)
if not file_exists(out_file... | python | def picard_sort(picard, align_bam, sort_order="coordinate",
out_file=None, compression_level=None, pipe=False):
"""Sort a BAM file by coordinates.
"""
base, ext = os.path.splitext(align_bam)
if out_file is None:
out_file = "%s-sort%s" % (base, ext)
if not file_exists(out_file... | ['def', 'picard_sort', '(', 'picard', ',', 'align_bam', ',', 'sort_order', '=', '"coordinate"', ',', 'out_file', '=', 'None', ',', 'compression_level', '=', 'None', ',', 'pipe', '=', 'False', ')', ':', 'base', ',', 'ext', '=', 'os', '.', 'path', '.', 'splitext', '(', 'align_bam', ')', 'if', 'out_file', 'is', 'None', ':... | Sort a BAM file by coordinates. | ['Sort', 'a', 'BAM', 'file', 'by', 'coordinates', '.'] | train | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/picardrun.py#L46-L63 |
5,365 | MillionIntegrals/vel | vel/rl/reinforcers/buffered_off_policy_iteration_reinforcer.py | BufferedOffPolicyIterationReinforcer.roll_out_and_store | def roll_out_and_store(self, batch_info):
""" Roll out environment and store result in the replay buffer """
self.model.train()
if self.env_roller.is_ready_for_sampling():
rollout = self.env_roller.rollout(batch_info, self.model, self.settings.rollout_steps).to_device(self.device)
... | python | def roll_out_and_store(self, batch_info):
""" Roll out environment and store result in the replay buffer """
self.model.train()
if self.env_roller.is_ready_for_sampling():
rollout = self.env_roller.rollout(batch_info, self.model, self.settings.rollout_steps).to_device(self.device)
... | ['def', 'roll_out_and_store', '(', 'self', ',', 'batch_info', ')', ':', 'self', '.', 'model', '.', 'train', '(', ')', 'if', 'self', '.', 'env_roller', '.', 'is_ready_for_sampling', '(', ')', ':', 'rollout', '=', 'self', '.', 'env_roller', '.', 'rollout', '(', 'batch_info', ',', 'self', '.', 'model', ',', 'self', '.', '... | Roll out environment and store result in the replay buffer | ['Roll', 'out', 'environment', 'and', 'store', 'result', 'in', 'the', 'replay', 'buffer'] | train | https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/rl/reinforcers/buffered_off_policy_iteration_reinforcer.py#L109-L135 |
5,366 | GNS3/gns3-server | gns3server/compute/vpcs/__init__.py | VPCS.close_node | def close_node(self, node_id, *args, **kwargs):
"""
Closes a VPCS VM.
:returns: VPCSVM instance
"""
node = self.get_node(node_id)
if node_id in self._used_mac_ids:
i = self._used_mac_ids[node_id]
self._free_mac_ids[node.project.id].insert(0, i)
... | python | def close_node(self, node_id, *args, **kwargs):
"""
Closes a VPCS VM.
:returns: VPCSVM instance
"""
node = self.get_node(node_id)
if node_id in self._used_mac_ids:
i = self._used_mac_ids[node_id]
self._free_mac_ids[node.project.id].insert(0, i)
... | ['def', 'close_node', '(', 'self', ',', 'node_id', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'node', '=', 'self', '.', 'get_node', '(', 'node_id', ')', 'if', 'node_id', 'in', 'self', '.', '_used_mac_ids', ':', 'i', '=', 'self', '.', '_used_mac_ids', '[', 'node_id', ']', 'self', '.', '_free_mac_ids', '[', 'no... | Closes a VPCS VM.
:returns: VPCSVM instance | ['Closes', 'a', 'VPCS', 'VM', '.'] | train | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vpcs/__init__.py#L57-L70 |
5,367 | reichlab/pymmwr | pymmwr.py | date_to_epiweek | def date_to_epiweek(date=datetime.date.today()) -> Epiweek:
"""
Convert python date to Epiweek
"""
year = date.year
start_dates = list(map(_start_date_of_year, [year - 1, year, year + 1]))
start_date = start_dates[1]
if start_dates[1] > date:
start_date = start_dates[0]
elif da... | python | def date_to_epiweek(date=datetime.date.today()) -> Epiweek:
"""
Convert python date to Epiweek
"""
year = date.year
start_dates = list(map(_start_date_of_year, [year - 1, year, year + 1]))
start_date = start_dates[1]
if start_dates[1] > date:
start_date = start_dates[0]
elif da... | ['def', 'date_to_epiweek', '(', 'date', '=', 'datetime', '.', 'date', '.', 'today', '(', ')', ')', '->', 'Epiweek', ':', 'year', '=', 'date', '.', 'year', 'start_dates', '=', 'list', '(', 'map', '(', '_start_date_of_year', ',', '[', 'year', '-', '1', ',', 'year', ',', 'year', '+', '1', ']', ')', ')', 'start_date', '=',... | Convert python date to Epiweek | ['Convert', 'python', 'date', 'to', 'Epiweek'] | train | https://github.com/reichlab/pymmwr/blob/98216bd5081998ca63db89003c4ef397fe905755/pymmwr.py#L62-L80 |
5,368 | inasafe/inasafe | safe/gui/widgets/message_viewer.py | MessageViewer.impact_path | def impact_path(self, value):
"""Setter to impact path.
:param value: The impact path.
:type value: str
"""
self._impact_path = value
if value is None:
self.action_show_report.setEnabled(False)
self.action_show_log.setEnabled(False)
se... | python | def impact_path(self, value):
"""Setter to impact path.
:param value: The impact path.
:type value: str
"""
self._impact_path = value
if value is None:
self.action_show_report.setEnabled(False)
self.action_show_log.setEnabled(False)
se... | ['def', 'impact_path', '(', 'self', ',', 'value', ')', ':', 'self', '.', '_impact_path', '=', 'value', 'if', 'value', 'is', 'None', ':', 'self', '.', 'action_show_report', '.', 'setEnabled', '(', 'False', ')', 'self', '.', 'action_show_log', '.', 'setEnabled', '(', 'False', ')', 'self', '.', 'report_path', '=', 'None',... | Setter to impact path.
:param value: The impact path.
:type value: str | ['Setter', 'to', 'impact', 'path', '.'] | train | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/message_viewer.py#L103-L123 |
5,369 | anayjoshi/cronus | cronus/beat.py | set_rate | def set_rate(rate):
"""Defines the ideal rate at which computation is to be performed
:arg rate: the frequency in Hertz
:type rate: int or float
:raises: TypeError: if argument 'rate' is not int or float
"""
if not (isinstance(rate, int) or isinstance(rate, float)):
raise TypeError("a... | python | def set_rate(rate):
"""Defines the ideal rate at which computation is to be performed
:arg rate: the frequency in Hertz
:type rate: int or float
:raises: TypeError: if argument 'rate' is not int or float
"""
if not (isinstance(rate, int) or isinstance(rate, float)):
raise TypeError("a... | ['def', 'set_rate', '(', 'rate', ')', ':', 'if', 'not', '(', 'isinstance', '(', 'rate', ',', 'int', ')', 'or', 'isinstance', '(', 'rate', ',', 'float', ')', ')', ':', 'raise', 'TypeError', '(', '"argument to set_rate is expected to be int or float"', ')', 'global', 'loop_duration', 'loop_duration', '=', '1.0', '/', 'ra... | Defines the ideal rate at which computation is to be performed
:arg rate: the frequency in Hertz
:type rate: int or float
:raises: TypeError: if argument 'rate' is not int or float | ['Defines', 'the', 'ideal', 'rate', 'at', 'which', 'computation', 'is', 'to', 'be', 'performed'] | train | https://github.com/anayjoshi/cronus/blob/52544e63913f37d7fca570168b878737f16fe39c/cronus/beat.py#L13-L24 |
5,370 | gr33ndata/dysl | dysl/social.py | SocialLM.classify | def classify(self, text=u''):
""" Predicts the Language of a given text.
:param text: Unicode text to be classified.
"""
result = self.calculate(doc_terms=self.tokenize(text))
#return (result['calc_id'], result)
return (result['calc_id'], self.karbasa(result)) | python | def classify(self, text=u''):
""" Predicts the Language of a given text.
:param text: Unicode text to be classified.
"""
result = self.calculate(doc_terms=self.tokenize(text))
#return (result['calc_id'], result)
return (result['calc_id'], self.karbasa(result)) | ['def', 'classify', '(', 'self', ',', 'text', '=', "u''", ')', ':', 'result', '=', 'self', '.', 'calculate', '(', 'doc_terms', '=', 'self', '.', 'tokenize', '(', 'text', ')', ')', "#return (result['calc_id'], result)", 'return', '(', 'result', '[', "'calc_id'", ']', ',', 'self', '.', 'karbasa', '(', 'result', ')', ')'] | Predicts the Language of a given text.
:param text: Unicode text to be classified. | ['Predicts', 'the', 'Language', 'of', 'a', 'given', 'text', '.'] | train | https://github.com/gr33ndata/dysl/blob/649c1d6a1761f47d49a9842e7389f6df52039155/dysl/social.py#L37-L44 |
5,371 | limix/limix-core | limix_core/mean/mean_base.py | MeanBase.W | def W(self,value):
""" set fixed effect design """
if value is None: value = sp.zeros((self._N, 0))
assert value.shape[0]==self._N, 'Dimension mismatch'
self._K = value.shape[1]
self._W = value
self._notify()
self.clear_cache('predict_in_sample','Yres') | python | def W(self,value):
""" set fixed effect design """
if value is None: value = sp.zeros((self._N, 0))
assert value.shape[0]==self._N, 'Dimension mismatch'
self._K = value.shape[1]
self._W = value
self._notify()
self.clear_cache('predict_in_sample','Yres') | ['def', 'W', '(', 'self', ',', 'value', ')', ':', 'if', 'value', 'is', 'None', ':', 'value', '=', 'sp', '.', 'zeros', '(', '(', 'self', '.', '_N', ',', '0', ')', ')', 'assert', 'value', '.', 'shape', '[', '0', ']', '==', 'self', '.', '_N', ',', "'Dimension mismatch'", 'self', '.', '_K', '=', 'value', '.', 'shape', '[',... | set fixed effect design | ['set', 'fixed', 'effect', 'design'] | train | https://github.com/limix/limix-core/blob/5c590b4d351409f83ca320844b4897ce92203814/limix_core/mean/mean_base.py#L102-L109 |
5,372 | saulpw/visidata | visidata/canvas.py | Canvas.render_sync | def render_sync(self):
'plots points and lines and text onto the Plotter'
self.setZoom()
bb = self.visibleBox
xmin, ymin, xmax, ymax = bb.xmin, bb.ymin, bb.xmax, bb.ymax
xfactor, yfactor = self.xScaler, self.yScaler
plotxmin, plotymin = self.plotviewBox.xmin, self.plotvi... | python | def render_sync(self):
'plots points and lines and text onto the Plotter'
self.setZoom()
bb = self.visibleBox
xmin, ymin, xmax, ymax = bb.xmin, bb.ymin, bb.xmax, bb.ymax
xfactor, yfactor = self.xScaler, self.yScaler
plotxmin, plotymin = self.plotviewBox.xmin, self.plotvi... | ['def', 'render_sync', '(', 'self', ')', ':', 'self', '.', 'setZoom', '(', ')', 'bb', '=', 'self', '.', 'visibleBox', 'xmin', ',', 'ymin', ',', 'xmax', ',', 'ymax', '=', 'bb', '.', 'xmin', ',', 'bb', '.', 'ymin', ',', 'bb', '.', 'xmax', ',', 'bb', '.', 'ymax', 'xfactor', ',', 'yfactor', '=', 'self', '.', 'xScaler', ','... | plots points and lines and text onto the Plotter | ['plots', 'points', 'and', 'lines', 'and', 'text', 'onto', 'the', 'Plotter'] | train | https://github.com/saulpw/visidata/blob/32771e0cea6c24fc7902683d14558391395c591f/visidata/canvas.py#L594-L626 |
5,373 | ewels/MultiQC | multiqc/modules/featureCounts/feature_counts.py | MultiqcModule.parse_featurecounts_report | def parse_featurecounts_report (self, f):
""" Parse the featureCounts log file. """
file_names = list()
parsed_data = dict()
for l in f['f'].splitlines():
thisrow = list()
s = l.split("\t")
if len(s) < 2:
continue
if s[0] =... | python | def parse_featurecounts_report (self, f):
""" Parse the featureCounts log file. """
file_names = list()
parsed_data = dict()
for l in f['f'].splitlines():
thisrow = list()
s = l.split("\t")
if len(s) < 2:
continue
if s[0] =... | ['def', 'parse_featurecounts_report', '(', 'self', ',', 'f', ')', ':', 'file_names', '=', 'list', '(', ')', 'parsed_data', '=', 'dict', '(', ')', 'for', 'l', 'in', 'f', '[', "'f'", ']', '.', 'splitlines', '(', ')', ':', 'thisrow', '=', 'list', '(', ')', 's', '=', 'l', '.', 'split', '(', '"\\t"', ')', 'if', 'len', '(', ... | Parse the featureCounts log file. | ['Parse', 'the', 'featureCounts', 'log', 'file', '.'] | train | https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/featureCounts/feature_counts.py#L52-L103 |
5,374 | noahbenson/pimms | pimms/util.py | lazy_map | def lazy_map(initial={}, pre_size=0):
'''
lazy_map is a blatant copy of the pyrsistent.pmap function, and is used to create lazy maps.
'''
if is_lazy_map(initial): return initial
if not initial: return _EMPTY_LMAP
return _lazy_turbo_mapping(initial, pre_size) | python | def lazy_map(initial={}, pre_size=0):
'''
lazy_map is a blatant copy of the pyrsistent.pmap function, and is used to create lazy maps.
'''
if is_lazy_map(initial): return initial
if not initial: return _EMPTY_LMAP
return _lazy_turbo_mapping(initial, pre_size) | ['def', 'lazy_map', '(', 'initial', '=', '{', '}', ',', 'pre_size', '=', '0', ')', ':', 'if', 'is_lazy_map', '(', 'initial', ')', ':', 'return', 'initial', 'if', 'not', 'initial', ':', 'return', '_EMPTY_LMAP', 'return', '_lazy_turbo_mapping', '(', 'initial', ',', 'pre_size', ')'] | lazy_map is a blatant copy of the pyrsistent.pmap function, and is used to create lazy maps. | ['lazy_map', 'is', 'a', 'blatant', 'copy', 'of', 'the', 'pyrsistent', '.', 'pmap', 'function', 'and', 'is', 'used', 'to', 'create', 'lazy', 'maps', '.'] | train | https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L702-L708 |
5,375 | ohenrik/tabs | tabs/tabs.py | Tabs.get | def get(self, table_name):
"""Load table class by name, class not yet initialized"""
assert table_name in self.tabs, \
"Table not avaiable. Avaiable tables: {}".format(
", ".join(self.tabs.keys())
)
return self.tabs[table_name] | python | def get(self, table_name):
"""Load table class by name, class not yet initialized"""
assert table_name in self.tabs, \
"Table not avaiable. Avaiable tables: {}".format(
", ".join(self.tabs.keys())
)
return self.tabs[table_name] | ['def', 'get', '(', 'self', ',', 'table_name', ')', ':', 'assert', 'table_name', 'in', 'self', '.', 'tabs', ',', '"Table not avaiable. Avaiable tables: {}"', '.', 'format', '(', '", "', '.', 'join', '(', 'self', '.', 'tabs', '.', 'keys', '(', ')', ')', ')', 'return', 'self', '.', 'tabs', '[', 'table_name', ']'] | Load table class by name, class not yet initialized | ['Load', 'table', 'class', 'by', 'name', 'class', 'not', 'yet', 'initialized'] | train | https://github.com/ohenrik/tabs/blob/039ced6c5612ecdd551aeaac63789862aba05711/tabs/tabs.py#L70-L76 |
5,376 | jaraco/irc | irc/client.py | Reactor.process_once | def process_once(self, timeout=0):
"""Process data from connections once.
Arguments:
timeout -- How long the select() call should wait if no
data is available.
This method should be called periodically to check and process
incoming data, if there are... | python | def process_once(self, timeout=0):
"""Process data from connections once.
Arguments:
timeout -- How long the select() call should wait if no
data is available.
This method should be called periodically to check and process
incoming data, if there are... | ['def', 'process_once', '(', 'self', ',', 'timeout', '=', '0', ')', ':', 'log', '.', 'log', '(', 'logging', '.', 'DEBUG', '-', '2', ',', '"process_once()"', ')', 'sockets', '=', 'self', '.', 'sockets', 'if', 'sockets', ':', 'in_', ',', 'out', ',', 'err', '=', 'select', '.', 'select', '(', 'sockets', ',', '[', ']', ',',... | Process data from connections once.
Arguments:
timeout -- How long the select() call should wait if no
data is available.
This method should be called periodically to check and process
incoming data, if there are any. If that seems boring, look
at t... | ['Process', 'data', 'from', 'connections', 'once', '.'] | train | https://github.com/jaraco/irc/blob/571c1f448d5d5bb92bbe2605c33148bf6e698413/irc/client.py#L807-L826 |
5,377 | Microsoft/nni | src/sdk/pynni/nni/networkmorphism_tuner/graph.py | Graph._add_node | def _add_node(self, node):
"""Add a new node to node_list and give the node an ID.
Args:
node: An instance of Node.
Returns:
node_id: An integer.
"""
node_id = len(self.node_list)
self.node_to_id[node] = node_id
self.node_list.append(node)
... | python | def _add_node(self, node):
"""Add a new node to node_list and give the node an ID.
Args:
node: An instance of Node.
Returns:
node_id: An integer.
"""
node_id = len(self.node_list)
self.node_to_id[node] = node_id
self.node_list.append(node)
... | ['def', '_add_node', '(', 'self', ',', 'node', ')', ':', 'node_id', '=', 'len', '(', 'self', '.', 'node_list', ')', 'self', '.', 'node_to_id', '[', 'node', ']', '=', 'node_id', 'self', '.', 'node_list', '.', 'append', '(', 'node', ')', 'self', '.', 'adj_list', '[', 'node_id', ']', '=', '[', ']', 'self', '.', 'reverse_a... | Add a new node to node_list and give the node an ID.
Args:
node: An instance of Node.
Returns:
node_id: An integer. | ['Add', 'a', 'new', 'node', 'to', 'node_list', 'and', 'give', 'the', 'node', 'an', 'ID', '.', 'Args', ':', 'node', ':', 'An', 'instance', 'of', 'Node', '.', 'Returns', ':', 'node_id', ':', 'An', 'integer', '.'] | train | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/graph.py#L200-L212 |
5,378 | jut-io/jut-python-tools | jut/api/data_engine.py | run | def run(juttle,
deployment_name,
program_name=None,
persist=False,
token_manager=None,
app_url=defaults.APP_URL):
"""
run a juttle program through the juttle streaming API and return the
various events that are part of running a Juttle program which include:
... | python | def run(juttle,
deployment_name,
program_name=None,
persist=False,
token_manager=None,
app_url=defaults.APP_URL):
"""
run a juttle program through the juttle streaming API and return the
various events that are part of running a Juttle program which include:
... | ['def', 'run', '(', 'juttle', ',', 'deployment_name', ',', 'program_name', '=', 'None', ',', 'persist', '=', 'False', ',', 'token_manager', '=', 'None', ',', 'app_url', '=', 'defaults', '.', 'APP_URL', ')', ':', 'headers', '=', 'token_manager', '.', 'get_access_token_headers', '(', ')', 'data_url', '=', 'get_juttle_dat... | run a juttle program through the juttle streaming API and return the
various events that are part of running a Juttle program which include:
* Initial job status details including information to associate
multiple flowgraphs with their individual outputs (sinks):
{
"status":... | ['run', 'a', 'juttle', 'program', 'through', 'the', 'juttle', 'streaming', 'API', 'and', 'return', 'the', 'various', 'events', 'that', 'are', 'part', 'of', 'running', 'a', 'Juttle', 'program', 'which', 'include', ':'] | train | https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L263-L392 |
5,379 | spyder-ide/spyder | spyder/otherplugins.py | _get_spyderplugins | def _get_spyderplugins(plugin_path, is_io, modnames, modlist):
"""Scan the directory `plugin_path` for plugin packages and loads them."""
if not osp.isdir(plugin_path):
return
for name in os.listdir(plugin_path):
# This is needed in order to register the spyder_io_hdf5 plugin.
... | python | def _get_spyderplugins(plugin_path, is_io, modnames, modlist):
"""Scan the directory `plugin_path` for plugin packages and loads them."""
if not osp.isdir(plugin_path):
return
for name in os.listdir(plugin_path):
# This is needed in order to register the spyder_io_hdf5 plugin.
... | ['def', '_get_spyderplugins', '(', 'plugin_path', ',', 'is_io', ',', 'modnames', ',', 'modlist', ')', ':', 'if', 'not', 'osp', '.', 'isdir', '(', 'plugin_path', ')', ':', 'return', 'for', 'name', 'in', 'os', '.', 'listdir', '(', 'plugin_path', ')', ':', '# This is needed in order to register the spyder_io_hdf5 plugin.\... | Scan the directory `plugin_path` for plugin packages and loads them. | ['Scan', 'the', 'directory', 'plugin_path', 'for', 'plugin', 'packages', 'and', 'loads', 'them', '.'] | train | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L46-L69 |
5,380 | fermiPy/fermipy | fermipy/scripts/cluster_sources.py | make_reverse_dict | def make_reverse_dict(in_dict, warn=True):
""" Build a reverse dictionary from a cluster dictionary
Parameters
----------
in_dict : dict(int:[int,])
A dictionary of clusters. Each cluster is a source index and
the list of other source in the cluster.
Returns
-------
ou... | python | def make_reverse_dict(in_dict, warn=True):
""" Build a reverse dictionary from a cluster dictionary
Parameters
----------
in_dict : dict(int:[int,])
A dictionary of clusters. Each cluster is a source index and
the list of other source in the cluster.
Returns
-------
ou... | ['def', 'make_reverse_dict', '(', 'in_dict', ',', 'warn', '=', 'True', ')', ':', 'out_dict', '=', '{', '}', 'for', 'k', ',', 'v', 'in', 'in_dict', '.', 'items', '(', ')', ':', 'for', 'vv', 'in', 'v', ':', 'if', 'vv', 'in', 'out_dict', ':', 'if', 'warn', ':', 'print', '(', '"Dictionary collision %i"', '%', 'vv', ')', 'o... | Build a reverse dictionary from a cluster dictionary
Parameters
----------
in_dict : dict(int:[int,])
A dictionary of clusters. Each cluster is a source index and
the list of other source in the cluster.
Returns
-------
out_dict : dict(int:int)
A single valued d... | ['Build', 'a', 'reverse', 'dictionary', 'from', 'a', 'cluster', 'dictionary'] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/scripts/cluster_sources.py#L420-L443 |
5,381 | openstack/horizon | openstack_dashboard/api/keystone.py | remove_domain_user_role | def remove_domain_user_role(request, user, role, domain=None):
"""Removes a given single role for a user from a domain."""
manager = keystoneclient(request, admin=True).roles
return manager.revoke(role, user=user, domain=domain) | python | def remove_domain_user_role(request, user, role, domain=None):
"""Removes a given single role for a user from a domain."""
manager = keystoneclient(request, admin=True).roles
return manager.revoke(role, user=user, domain=domain) | ['def', 'remove_domain_user_role', '(', 'request', ',', 'user', ',', 'role', ',', 'domain', '=', 'None', ')', ':', 'manager', '=', 'keystoneclient', '(', 'request', ',', 'admin', '=', 'True', ')', '.', 'roles', 'return', 'manager', '.', 'revoke', '(', 'role', ',', 'user', '=', 'user', ',', 'domain', '=', 'domain', ')'] | Removes a given single role for a user from a domain. | ['Removes', 'a', 'given', 'single', 'role', 'for', 'a', 'user', 'from', 'a', 'domain', '.'] | train | https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L798-L801 |
5,382 | projectshift/shift-schema | shiftschema/property.py | SimpleProperty.validate | def validate(self, value=None, model=None, context=None):
"""
Sequentially apply each validator to value and collect errors.
:param value: a value to validate
:param model: parent entity
:param context: validation context, usually parent entity
:return: list of errors (i... | python | def validate(self, value=None, model=None, context=None):
"""
Sequentially apply each validator to value and collect errors.
:param value: a value to validate
:param model: parent entity
:param context: validation context, usually parent entity
:return: list of errors (i... | ['def', 'validate', '(', 'self', ',', 'value', '=', 'None', ',', 'model', '=', 'None', ',', 'context', '=', 'None', ')', ':', 'errors', '=', '[', ']', 'for', 'validator', 'in', 'self', '.', 'validators', ':', 'if', 'value', 'is', 'None', 'and', 'not', 'isinstance', '(', 'validator', ',', 'Required', ')', ':', 'continue... | Sequentially apply each validator to value and collect errors.
:param value: a value to validate
:param model: parent entity
:param context: validation context, usually parent entity
:return: list of errors (if any) | ['Sequentially', 'apply', 'each', 'validator', 'to', 'value', 'and', 'collect', 'errors', '.'] | train | https://github.com/projectshift/shift-schema/blob/07787b540d3369bb37217ffbfbe629118edaf0eb/shiftschema/property.py#L75-L97 |
5,383 | ternaris/marv | docs/tutorial/code/marv_tutorial/__init__.py | gallery_section | def gallery_section(images, title):
"""Create detail section with gallery.
Args:
title (str): Title to be displayed for detail section.
images: stream of marv image files
Returns
One detail section.
"""
# pull all images
imgs = []
while True:
img = yield mar... | python | def gallery_section(images, title):
"""Create detail section with gallery.
Args:
title (str): Title to be displayed for detail section.
images: stream of marv image files
Returns
One detail section.
"""
# pull all images
imgs = []
while True:
img = yield mar... | ['def', 'gallery_section', '(', 'images', ',', 'title', ')', ':', '# pull all images', 'imgs', '=', '[', ']', 'while', 'True', ':', 'img', '=', 'yield', 'marv', '.', 'pull', '(', 'images', ')', 'if', 'img', 'is', 'None', ':', 'break', 'imgs', '.', 'append', '(', '{', "'src'", ':', 'img', '.', 'relpath', '}', ')', 'if',... | Create detail section with gallery.
Args:
title (str): Title to be displayed for detail section.
images: stream of marv image files
Returns
One detail section. | ['Create', 'detail', 'section', 'with', 'gallery', '.'] | train | https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/docs/tutorial/code/marv_tutorial/__init__.py#L124-L147 |
5,384 | PythonCharmers/python-future | src/future/backports/urllib/request.py | URLopener.open_unknown_proxy | def open_unknown_proxy(self, proxy, fullurl, data=None):
"""Overridable interface to open unknown URL type."""
type, url = splittype(fullurl)
raise IOError('url error', 'invalid proxy for %s' % type, proxy) | python | def open_unknown_proxy(self, proxy, fullurl, data=None):
"""Overridable interface to open unknown URL type."""
type, url = splittype(fullurl)
raise IOError('url error', 'invalid proxy for %s' % type, proxy) | ['def', 'open_unknown_proxy', '(', 'self', ',', 'proxy', ',', 'fullurl', ',', 'data', '=', 'None', ')', ':', 'type', ',', 'url', '=', 'splittype', '(', 'fullurl', ')', 'raise', 'IOError', '(', "'url error'", ',', "'invalid proxy for %s'", '%', 'type', ',', 'proxy', ')'] | Overridable interface to open unknown URL type. | ['Overridable', 'interface', 'to', 'open', 'unknown', 'URL', 'type', '.'] | train | https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/urllib/request.py#L1710-L1713 |
5,385 | gem/oq-engine | openquake/hmtk/plotting/seismicity/completeness/cumulative_rate_analysis.py | SimpleCumulativeRate._get_magnitudes_from_spacing | def _get_magnitudes_from_spacing(self, magnitudes, delta_m):
'''If a single magnitude spacing is input then create the bins
:param numpy.ndarray magnitudes:
Vector of earthquake magnitudes
:param float delta_m:
Magnitude bin width
:returns: Vector of magnitude ... | python | def _get_magnitudes_from_spacing(self, magnitudes, delta_m):
'''If a single magnitude spacing is input then create the bins
:param numpy.ndarray magnitudes:
Vector of earthquake magnitudes
:param float delta_m:
Magnitude bin width
:returns: Vector of magnitude ... | ['def', '_get_magnitudes_from_spacing', '(', 'self', ',', 'magnitudes', ',', 'delta_m', ')', ':', 'min_mag', '=', 'np', '.', 'min', '(', 'magnitudes', ')', 'max_mag', '=', 'np', '.', 'max', '(', 'magnitudes', ')', 'if', '(', 'max_mag', '-', 'min_mag', ')', '<', 'delta_m', ':', 'raise', 'ValueError', '(', "'Bin width gr... | If a single magnitude spacing is input then create the bins
:param numpy.ndarray magnitudes:
Vector of earthquake magnitudes
:param float delta_m:
Magnitude bin width
:returns: Vector of magnitude bin edges (numpy.ndarray) | ['If', 'a', 'single', 'magnitude', 'spacing', 'is', 'input', 'then', 'create', 'the', 'bins'] | train | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/plotting/seismicity/completeness/cumulative_rate_analysis.py#L132-L152 |
5,386 | Numigi/gitoo | src/core.py | force_move | def force_move(source, destination):
""" Force the move of the source inside the destination even if the destination has already a folder with the
name inside. In the case, the folder will be replaced.
:param string source: path of the source to move.
:param string destination: path of the folder to mo... | python | def force_move(source, destination):
""" Force the move of the source inside the destination even if the destination has already a folder with the
name inside. In the case, the folder will be replaced.
:param string source: path of the source to move.
:param string destination: path of the folder to mo... | ['def', 'force_move', '(', 'source', ',', 'destination', ')', ':', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'destination', ')', ':', 'raise', 'RuntimeError', '(', "'The code could not be moved to {destination} '", "'because the folder does not exist'", '.', 'format', '(', 'destination', '=', 'destination', '... | Force the move of the source inside the destination even if the destination has already a folder with the
name inside. In the case, the folder will be replaced.
:param string source: path of the source to move.
:param string destination: path of the folder to move the source to. | ['Force', 'the', 'move', 'of', 'the', 'source', 'inside', 'the', 'destination', 'even', 'if', 'the', 'destination', 'has', 'already', 'a', 'folder', 'with', 'the', 'name', 'inside', '.', 'In', 'the', 'case', 'the', 'folder', 'will', 'be', 'replaced', '.'] | train | https://github.com/Numigi/gitoo/blob/0921f5fb8a948021760bb0373a40f9fbe8a4a2e5/src/core.py#L38-L54 |
5,387 | veripress/veripress | veripress/model/toc.py | HtmlTocParser.toc_html | def toc_html(self, depth=6, lowest_level=6):
"""
Get TOC of currently fed HTML string in form of HTML string.
:param depth: the depth of TOC
:param lowest_level: the allowed lowest level of header tag
:return: an HTML string
"""
toc = self.toc(depth=depth, lowest... | python | def toc_html(self, depth=6, lowest_level=6):
"""
Get TOC of currently fed HTML string in form of HTML string.
:param depth: the depth of TOC
:param lowest_level: the allowed lowest level of header tag
:return: an HTML string
"""
toc = self.toc(depth=depth, lowest... | ['def', 'toc_html', '(', 'self', ',', 'depth', '=', '6', ',', 'lowest_level', '=', '6', ')', ':', 'toc', '=', 'self', '.', 'toc', '(', 'depth', '=', 'depth', ',', 'lowest_level', '=', 'lowest_level', ')', 'if', 'not', 'toc', ':', 'return', "''", 'def', 'map_toc_list', '(', 'toc_list', ')', ':', 'result', '=', "''", 'if... | Get TOC of currently fed HTML string in form of HTML string.
:param depth: the depth of TOC
:param lowest_level: the allowed lowest level of header tag
:return: an HTML string | ['Get', 'TOC', 'of', 'currently', 'fed', 'HTML', 'string', 'in', 'form', 'of', 'HTML', 'string', '.'] | train | https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/toc.py#L92-L119 |
5,388 | andymccurdy/redis-py | redis/connection.py | PythonParser.on_connect | def on_connect(self, connection):
"Called when the socket connects"
self._sock = connection._sock
self._buffer = SocketBuffer(self._sock, self.socket_read_size)
self.encoder = connection.encoder | python | def on_connect(self, connection):
"Called when the socket connects"
self._sock = connection._sock
self._buffer = SocketBuffer(self._sock, self.socket_read_size)
self.encoder = connection.encoder | ['def', 'on_connect', '(', 'self', ',', 'connection', ')', ':', 'self', '.', '_sock', '=', 'connection', '.', '_sock', 'self', '.', '_buffer', '=', 'SocketBuffer', '(', 'self', '.', '_sock', ',', 'self', '.', 'socket_read_size', ')', 'self', '.', 'encoder', '=', 'connection', '.', 'encoder'] | Called when the socket connects | ['Called', 'when', 'the', 'socket', 'connects'] | train | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L265-L269 |
5,389 | Kozea/cairocffi | cairocffi/surfaces.py | SVGSurface.set_document_unit | def set_document_unit(self, unit):
"""Use specified unit for width and height of generated SVG file.
See ``SVG_UNIT_*`` enumerated values for a list of available unit
values that can be used here.
This function can be called at any time before generating the SVG file.
However ... | python | def set_document_unit(self, unit):
"""Use specified unit for width and height of generated SVG file.
See ``SVG_UNIT_*`` enumerated values for a list of available unit
values that can be used here.
This function can be called at any time before generating the SVG file.
However ... | ['def', 'set_document_unit', '(', 'self', ',', 'unit', ')', ':', 'cairo', '.', 'cairo_svg_surface_set_document_unit', '(', 'self', '.', '_pointer', ',', 'unit', ')', 'self', '.', '_check_status', '(', ')'] | Use specified unit for width and height of generated SVG file.
See ``SVG_UNIT_*`` enumerated values for a list of available unit
values that can be used here.
This function can be called at any time before generating the SVG file.
However to minimize the risk of ambiguities it's recom... | ['Use', 'specified', 'unit', 'for', 'width', 'and', 'height', 'of', 'generated', 'SVG', 'file', '.'] | train | https://github.com/Kozea/cairocffi/blob/450853add7e32eea20985b6aa5f54d9cb3cd04fe/cairocffi/surfaces.py#L1309-L1336 |
5,390 | inasafe/inasafe | safe/gui/tools/batch/batch_dialog.py | BatchDialog.save_state | def save_state(self):
"""Save current state of GUI to configuration file."""
set_setting('lastSourceDir', self.source_directory.text())
set_setting('lastOutputDir', self.output_directory.text())
set_setting(
'useDefaultOutputDir', self.scenario_directory_radio.isChecked()) | python | def save_state(self):
"""Save current state of GUI to configuration file."""
set_setting('lastSourceDir', self.source_directory.text())
set_setting('lastOutputDir', self.output_directory.text())
set_setting(
'useDefaultOutputDir', self.scenario_directory_radio.isChecked()) | ['def', 'save_state', '(', 'self', ')', ':', 'set_setting', '(', "'lastSourceDir'", ',', 'self', '.', 'source_directory', '.', 'text', '(', ')', ')', 'set_setting', '(', "'lastOutputDir'", ',', 'self', '.', 'output_directory', '.', 'text', '(', ')', ')', 'set_setting', '(', "'useDefaultOutputDir'", ',', 'self', '.', 's... | Save current state of GUI to configuration file. | ['Save', 'current', 'state', 'of', 'GUI', 'to', 'configuration', 'file', '.'] | train | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L187-L192 |
5,391 | kedpter/secret_miner | pjutils.py | Sphinx.gen_code_api | def gen_code_api(self):
"""TODO: Docstring for gen_code_api."""
# edit config file
conf_editor = Editor(self.conf_fpath)
# insert code path for searching
conf_editor.editline_with_regex(r'^# import os', 'import os')
conf_editor.editline_with_regex(r'^# import sys', 'im... | python | def gen_code_api(self):
"""TODO: Docstring for gen_code_api."""
# edit config file
conf_editor = Editor(self.conf_fpath)
# insert code path for searching
conf_editor.editline_with_regex(r'^# import os', 'import os')
conf_editor.editline_with_regex(r'^# import sys', 'im... | ['def', 'gen_code_api', '(', 'self', ')', ':', '# edit config file', 'conf_editor', '=', 'Editor', '(', 'self', '.', 'conf_fpath', ')', '# insert code path for searching', 'conf_editor', '.', 'editline_with_regex', '(', "r'^# import os'", ',', "'import os'", ')', 'conf_editor', '.', 'editline_with_regex', '(', "r'^# im... | TODO: Docstring for gen_code_api. | ['TODO', ':', 'Docstring', 'for', 'gen_code_api', '.'] | train | https://github.com/kedpter/secret_miner/blob/3b4ebe58e11fb688d7e8928ebaa2871fc43717e4/pjutils.py#L257-L281 |
5,392 | DataKitchen/DKCloudCommand | DKCloudCommand/cli/__main__.py | delete_orderrun | def delete_orderrun(backend, orderrun_id):
"""
Delete the orderrun specified by the argument.
"""
click.secho('%s - Deleting orderrun %s' % (get_datetime(), orderrun_id), fg='green')
check_and_print(DKCloudCommandRunner.delete_orderrun(backend.dki, orderrun_id.strip())) | python | def delete_orderrun(backend, orderrun_id):
"""
Delete the orderrun specified by the argument.
"""
click.secho('%s - Deleting orderrun %s' % (get_datetime(), orderrun_id), fg='green')
check_and_print(DKCloudCommandRunner.delete_orderrun(backend.dki, orderrun_id.strip())) | ['def', 'delete_orderrun', '(', 'backend', ',', 'orderrun_id', ')', ':', 'click', '.', 'secho', '(', "'%s - Deleting orderrun %s'", '%', '(', 'get_datetime', '(', ')', ',', 'orderrun_id', ')', ',', 'fg', '=', "'green'", ')', 'check_and_print', '(', 'DKCloudCommandRunner', '.', 'delete_orderrun', '(', 'backend', '.', 'd... | Delete the orderrun specified by the argument. | ['Delete', 'the', 'orderrun', 'specified', 'by', 'the', 'argument', '.'] | train | https://github.com/DataKitchen/DKCloudCommand/blob/1cf9cb08ab02f063eef6b5c4b327af142991daa3/DKCloudCommand/cli/__main__.py#L822-L827 |
5,393 | ensime/ensime-vim | ensime_shared/protocol.py | ProtocolHandlerV1.handle_string_response | def handle_string_response(self, call_id, payload):
"""Handler for response `StringResponse`.
This is the response for the following requests:
1. `DocUriAtPointReq` or `DocUriForSymbolReq`
2. `DebugToStringReq`
"""
self.log.debug('handle_string_response: in [typehint... | python | def handle_string_response(self, call_id, payload):
"""Handler for response `StringResponse`.
This is the response for the following requests:
1. `DocUriAtPointReq` or `DocUriForSymbolReq`
2. `DebugToStringReq`
"""
self.log.debug('handle_string_response: in [typehint... | ['def', 'handle_string_response', '(', 'self', ',', 'call_id', ',', 'payload', ')', ':', 'self', '.', 'log', '.', 'debug', '(', "'handle_string_response: in [typehint: %s, call ID: %s]'", ',', 'payload', '[', "'typehint'", ']', ',', 'call_id', ')', '# :EnDocBrowse or :EnDocUri', 'url', '=', 'payload', '[', "'text'", ']... | Handler for response `StringResponse`.
This is the response for the following requests:
1. `DocUriAtPointReq` or `DocUriForSymbolReq`
2. `DebugToStringReq` | ['Handler', 'for', 'response', 'StringResponse', '.'] | train | https://github.com/ensime/ensime-vim/blob/caa734e84f002b25446c615706283a74edd4ecfe/ensime_shared/protocol.py#L203-L226 |
5,394 | yvesalexandre/bandicoot | bandicoot/io.py | _parse_record | def _parse_record(data, duration_format='seconds'):
"""
Parse a raw data dictionary and return a Record object.
"""
def _map_duration(s):
if s == '':
return None
elif duration_format.lower() == 'seconds':
return int(s)
else:
t = time.strptime(... | python | def _parse_record(data, duration_format='seconds'):
"""
Parse a raw data dictionary and return a Record object.
"""
def _map_duration(s):
if s == '':
return None
elif duration_format.lower() == 'seconds':
return int(s)
else:
t = time.strptime(... | ['def', '_parse_record', '(', 'data', ',', 'duration_format', '=', "'seconds'", ')', ':', 'def', '_map_duration', '(', 's', ')', ':', 'if', 's', '==', "''", ':', 'return', 'None', 'elif', 'duration_format', '.', 'lower', '(', ')', '==', "'seconds'", ':', 'return', 'int', '(', 's', ')', 'else', ':', 't', '=', 'time', '.... | Parse a raw data dictionary and return a Record object. | ['Parse', 'a', 'raw', 'data', 'dictionary', 'and', 'return', 'a', 'Record', 'object', '.'] | train | https://github.com/yvesalexandre/bandicoot/blob/73a658f6f17331541cf0b1547028db9b70e8d58a/bandicoot/io.py#L147-L187 |
5,395 | MisterY/pydatum | pydatum/datum.py | Datum.subtract_months | def subtract_months(self, months: int) -> datetime:
""" Subtracts a number of months from the current value """
self.value = self.value - relativedelta(months=months)
return self.value | python | def subtract_months(self, months: int) -> datetime:
""" Subtracts a number of months from the current value """
self.value = self.value - relativedelta(months=months)
return self.value | ['def', 'subtract_months', '(', 'self', ',', 'months', ':', 'int', ')', '->', 'datetime', ':', 'self', '.', 'value', '=', 'self', '.', 'value', '-', 'relativedelta', '(', 'months', '=', 'months', ')', 'return', 'self', '.', 'value'] | Subtracts a number of months from the current value | ['Subtracts', 'a', 'number', 'of', 'months', 'from', 'the', 'current', 'value'] | train | https://github.com/MisterY/pydatum/blob/4b39f43040e31a95bcf219603b6429078a9ba3c2/pydatum/datum.py#L172-L175 |
5,396 | materialsproject/pymatgen | pymatgen/ext/matproj.py | MPRester.get_reaction | def get_reaction(self, reactants, products):
"""
Gets a reaction from the Materials Project.
Args:
reactants ([str]): List of formulas
products ([str]): List of formulas
Returns:
rxn
"""
return self._make_request("/reaction",
... | python | def get_reaction(self, reactants, products):
"""
Gets a reaction from the Materials Project.
Args:
reactants ([str]): List of formulas
products ([str]): List of formulas
Returns:
rxn
"""
return self._make_request("/reaction",
... | ['def', 'get_reaction', '(', 'self', ',', 'reactants', ',', 'products', ')', ':', 'return', 'self', '.', '_make_request', '(', '"/reaction"', ',', 'payload', '=', '{', '"reactants[]"', ':', 'reactants', ',', '"products[]"', ':', 'products', '}', ',', 'mp_decode', '=', 'False', ')'] | Gets a reaction from the Materials Project.
Args:
reactants ([str]): List of formulas
products ([str]): List of formulas
Returns:
rxn | ['Gets', 'a', 'reaction', 'from', 'the', 'Materials', 'Project', '.'] | train | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/ext/matproj.py#L1089-L1102 |
5,397 | saltstack/salt | salt/modules/chocolatey.py | install_gem | def install_gem(name, version=None, install_args=None, override_args=False):
'''
Instructs Chocolatey to install a package via Ruby's Gems.
name
The name of the package to be installed. Only accepts a single argument.
version
Install a specific version of the package. Defaults to lates... | python | def install_gem(name, version=None, install_args=None, override_args=False):
'''
Instructs Chocolatey to install a package via Ruby's Gems.
name
The name of the package to be installed. Only accepts a single argument.
version
Install a specific version of the package. Defaults to lates... | ['def', 'install_gem', '(', 'name', ',', 'version', '=', 'None', ',', 'install_args', '=', 'None', ',', 'override_args', '=', 'False', ')', ':', 'return', 'install', '(', 'name', ',', 'version', '=', 'version', ',', 'source', '=', "'ruby'", ',', 'install_args', '=', 'install_args', ',', 'override_args', '=', 'override_... | Instructs Chocolatey to install a package via Ruby's Gems.
name
The name of the package to be installed. Only accepts a single argument.
version
Install a specific version of the package. Defaults to latest version
available.
install_args
A list of install arguments you wa... | ['Instructs', 'Chocolatey', 'to', 'install', 'a', 'package', 'via', 'Ruby', 's', 'Gems', '.'] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chocolatey.py#L526-L560 |
5,398 | globus/globus-cli | globus_cli/commands/endpoint/show.py | endpoint_show | def endpoint_show(endpoint_id):
"""
Executor for `globus endpoint show`
"""
client = get_client()
res = client.get_endpoint(endpoint_id)
formatted_print(
res,
text_format=FORMAT_TEXT_RECORD,
fields=GCP_FIELDS if res["is_globus_connect"] else STANDARD_FIELDS,
) | python | def endpoint_show(endpoint_id):
"""
Executor for `globus endpoint show`
"""
client = get_client()
res = client.get_endpoint(endpoint_id)
formatted_print(
res,
text_format=FORMAT_TEXT_RECORD,
fields=GCP_FIELDS if res["is_globus_connect"] else STANDARD_FIELDS,
) | ['def', 'endpoint_show', '(', 'endpoint_id', ')', ':', 'client', '=', 'get_client', '(', ')', 'res', '=', 'client', '.', 'get_endpoint', '(', 'endpoint_id', ')', 'formatted_print', '(', 'res', ',', 'text_format', '=', 'FORMAT_TEXT_RECORD', ',', 'fields', '=', 'GCP_FIELDS', 'if', 'res', '[', '"is_globus_connect"', ']', ... | Executor for `globus endpoint show` | ['Executor', 'for', 'globus', 'endpoint', 'show'] | train | https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/show.py#L11-L23 |
5,399 | pennersr/django-allauth | allauth/socialaccount/providers/oauth/client.py | OAuth.query | def query(self, url, method="GET", params=dict(), headers=dict()):
"""
Request a API endpoint at ``url`` with ``params`` being either the
POST or GET data.
"""
access_token = self._get_at_from_session()
oauth = OAuth1(
self.consumer_key,
client_sec... | python | def query(self, url, method="GET", params=dict(), headers=dict()):
"""
Request a API endpoint at ``url`` with ``params`` being either the
POST or GET data.
"""
access_token = self._get_at_from_session()
oauth = OAuth1(
self.consumer_key,
client_sec... | ['def', 'query', '(', 'self', ',', 'url', ',', 'method', '=', '"GET"', ',', 'params', '=', 'dict', '(', ')', ',', 'headers', '=', 'dict', '(', ')', ')', ':', 'access_token', '=', 'self', '.', '_get_at_from_session', '(', ')', 'oauth', '=', 'OAuth1', '(', 'self', '.', 'consumer_key', ',', 'client_secret', '=', 'self', '... | Request a API endpoint at ``url`` with ``params`` being either the
POST or GET data. | ['Request', 'a', 'API', 'endpoint', 'at', 'url', 'with', 'params', 'being', 'either', 'the', 'POST', 'or', 'GET', 'data', '.'] | train | https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/providers/oauth/client.py#L180-L200 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.