Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
6,900
twilio/twilio-python
twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py
AssignedAddOnExtensionPage.get_instance
def get_instance(self, payload): """ Build an instance of AssignedAddOnExtensionInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance :rt...
python
def get_instance(self, payload): """ Build an instance of AssignedAddOnExtensionInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance :rt...
['def', 'get_instance', '(', 'self', ',', 'payload', ')', ':', 'return', 'AssignedAddOnExtensionInstance', '(', 'self', '.', '_version', ',', 'payload', ',', 'account_sid', '=', 'self', '.', '_solution', '[', "'account_sid'", ']', ',', 'resource_sid', '=', 'self', '.', '_solution', '[', "'resource_sid'", ']', ',', 'ass...
Build an instance of AssignedAddOnExtensionInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance :rtype: twilio.rest.api.v2010.account.incoming_phone_num...
['Build', 'an', 'instance', 'of', 'AssignedAddOnExtensionInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py#L189-L204
6,901
nerdvegas/rez
src/rez/resolved_context.py
ResolvedContext.requested_packages
def requested_packages(self, include_implicit=False): """Get packages in the request. Args: include_implicit (bool): If True, implicit packages are appended to the result. Returns: List of `PackageRequest` objects. """ if include_implicit...
python
def requested_packages(self, include_implicit=False): """Get packages in the request. Args: include_implicit (bool): If True, implicit packages are appended to the result. Returns: List of `PackageRequest` objects. """ if include_implicit...
['def', 'requested_packages', '(', 'self', ',', 'include_implicit', '=', 'False', ')', ':', 'if', 'include_implicit', ':', 'return', 'self', '.', '_package_requests', '+', 'self', '.', 'implicit_packages', 'else', ':', 'return', 'self', '.', '_package_requests']
Get packages in the request. Args: include_implicit (bool): If True, implicit packages are appended to the result. Returns: List of `PackageRequest` objects.
['Get', 'packages', 'in', 'the', 'request', '.']
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/resolved_context.py#L322-L335
6,902
postlund/pyatv
pyatv/__main__.py
DeviceCommands.auth
async def auth(self): """Perform AirPlay device authentication.""" credentials = await self.atv.airplay.generate_credentials() await self.atv.airplay.load_credentials(credentials) try: await self.atv.airplay.start_authentication() pin = await _read_input(self.loo...
python
async def auth(self): """Perform AirPlay device authentication.""" credentials = await self.atv.airplay.generate_credentials() await self.atv.airplay.load_credentials(credentials) try: await self.atv.airplay.start_authentication() pin = await _read_input(self.loo...
['async', 'def', 'auth', '(', 'self', ')', ':', 'credentials', '=', 'await', 'self', '.', 'atv', '.', 'airplay', '.', 'generate_credentials', '(', ')', 'await', 'self', '.', 'atv', '.', 'airplay', '.', 'load_credentials', '(', 'credentials', ')', 'try', ':', 'await', 'self', '.', 'atv', '.', 'airplay', '.', 'start_auth...
Perform AirPlay device authentication.
['Perform', 'AirPlay', 'device', 'authentication', '.']
train
https://github.com/postlund/pyatv/blob/655dfcda4e2f9d1c501540e18da4f480d8bf0e70/pyatv/__main__.py#L138-L154
6,903
kumar303/mohawk
mohawk/sender.py
Sender.accept_response
def accept_response(self, response_header, content=EmptyValue, content_type=EmptyValue, accept_untrusted_content=False, localtime_offset_in_seconds=0, timestamp_skew_in_seconds...
python
def accept_response(self, response_header, content=EmptyValue, content_type=EmptyValue, accept_untrusted_content=False, localtime_offset_in_seconds=0, timestamp_skew_in_seconds...
['def', 'accept_response', '(', 'self', ',', 'response_header', ',', 'content', '=', 'EmptyValue', ',', 'content_type', '=', 'EmptyValue', ',', 'accept_untrusted_content', '=', 'False', ',', 'localtime_offset_in_seconds', '=', '0', ',', 'timestamp_skew_in_seconds', '=', 'default_ts_skew_in_seconds', ',', '*', '*', 'aut...
Accept a response to this request. :param response_header: A `Hawk`_ ``Server-Authorization`` header such as one created by :class:`mohawk.Receiver`. :type response_header: str :param content=EmptyValue: Byte string of the response body received. :type content=E...
['Accept', 'a', 'response', 'to', 'this', 'request', '.']
train
https://github.com/kumar303/mohawk/blob/037be67ccf50ae704705e67add44e02737a65d21/mohawk/sender.py#L106-L175
6,904
redcanari/canari3
src/canari/entrypoints.py
generate_entities
def generate_entities(ctx, output_path, mtz_file, exclude_namespace, namespace, maltego_entities, append, entity): """Converts Maltego entity definition files to Canari python classes. Excludes Maltego built-in entities by default.""" from canari.commands.generate_entities import generate_entities gener...
python
def generate_entities(ctx, output_path, mtz_file, exclude_namespace, namespace, maltego_entities, append, entity): """Converts Maltego entity definition files to Canari python classes. Excludes Maltego built-in entities by default.""" from canari.commands.generate_entities import generate_entities gener...
['def', 'generate_entities', '(', 'ctx', ',', 'output_path', ',', 'mtz_file', ',', 'exclude_namespace', ',', 'namespace', ',', 'maltego_entities', ',', 'append', ',', 'entity', ')', ':', 'from', 'canari', '.', 'commands', '.', 'generate_entities', 'import', 'generate_entities', 'generate_entities', '(', 'ctx', '.', 'pr...
Converts Maltego entity definition files to Canari python classes. Excludes Maltego built-in entities by default.
['Converts', 'Maltego', 'entity', 'definition', 'files', 'to', 'Canari', 'python', 'classes', '.', 'Excludes', 'Maltego', 'built', '-', 'in', 'entities', 'by', 'default', '.']
train
https://github.com/redcanari/canari3/blob/322d2bae4b49ac728229f418b786b51fcc227352/src/canari/entrypoints.py#L146-L151
6,905
brentp/cruzdb
cruzdb/__init__.py
Genome.load_file
def load_file(self, fname, table=None, sep="\t", bins=False, indexes=None): """ use some of the machinery in pandas to load a file into a table Parameters ---------- fname : str filename or filehandle to load table : str table to load the file t...
python
def load_file(self, fname, table=None, sep="\t", bins=False, indexes=None): """ use some of the machinery in pandas to load a file into a table Parameters ---------- fname : str filename or filehandle to load table : str table to load the file t...
['def', 'load_file', '(', 'self', ',', 'fname', ',', 'table', '=', 'None', ',', 'sep', '=', '"\\t"', ',', 'bins', '=', 'False', ',', 'indexes', '=', 'None', ')', ':', 'convs', '=', '{', '"#chr"', ':', '"chrom"', ',', '"start"', ':', '"txStart"', ',', '"end"', ':', '"txEnd"', ',', '"chr"', ':', '"chrom"', ',', '"pos"', ...
use some of the machinery in pandas to load a file into a table Parameters ---------- fname : str filename or filehandle to load table : str table to load the file to sep : str CSV separator bins : bool add a "bin" colu...
['use', 'some', 'of', 'the', 'machinery', 'in', 'pandas', 'to', 'load', 'a', 'file', 'into', 'a', 'table']
train
https://github.com/brentp/cruzdb/blob/9068d46e25952f4a929dde0242beb31fa4c7e89a/cruzdb/__init__.py#L146-L228
6,906
jeffh/rpi_courses
rpi_courses/sis_parser/course_catalog.py
CourseCatalog.find_course_by_crn
def find_course_by_crn(self, crn): """Searches all courses by CRNs. Not particularly efficient. Returns None if not found. """ for name, course in self.courses.iteritems(): if crn in course: return course return None
python
def find_course_by_crn(self, crn): """Searches all courses by CRNs. Not particularly efficient. Returns None if not found. """ for name, course in self.courses.iteritems(): if crn in course: return course return None
['def', 'find_course_by_crn', '(', 'self', ',', 'crn', ')', ':', 'for', 'name', ',', 'course', 'in', 'self', '.', 'courses', '.', 'iteritems', '(', ')', ':', 'if', 'crn', 'in', 'course', ':', 'return', 'course', 'return', 'None']
Searches all courses by CRNs. Not particularly efficient. Returns None if not found.
['Searches', 'all', 'courses', 'by', 'CRNs', '.', 'Not', 'particularly', 'efficient', '.', 'Returns', 'None', 'if', 'not', 'found', '.']
train
https://github.com/jeffh/rpi_courses/blob/c97176f73f866f112c785910ebf3ff8a790e8e9a/rpi_courses/sis_parser/course_catalog.py#L99-L106
6,907
theSage21/lanchat
lanchat/chat.py
Node.__make_client
def __make_client(self): "Make this node a client" notice('Making client, getting server connection', self.color) self.mode = 'c' addr = utils.get_existing_server_addr() sock = utils.get_client_sock(addr) self.__s = sock with self.__client_list_lock: s...
python
def __make_client(self): "Make this node a client" notice('Making client, getting server connection', self.color) self.mode = 'c' addr = utils.get_existing_server_addr() sock = utils.get_client_sock(addr) self.__s = sock with self.__client_list_lock: s...
['def', '__make_client', '(', 'self', ')', ':', 'notice', '(', "'Making client, getting server connection'", ',', 'self', '.', 'color', ')', 'self', '.', 'mode', '=', "'c'", 'addr', '=', 'utils', '.', 'get_existing_server_addr', '(', ')', 'sock', '=', 'utils', '.', 'get_client_sock', '(', 'addr', ')', 'self', '.', '__s...
Make this node a client
['Make', 'this', 'node', 'a', 'client']
train
https://github.com/theSage21/lanchat/blob/66f5dcead67fef815347b956b1d3e149a7e13b29/lanchat/chat.py#L194-L203
6,908
kpdyer/regex2dfa
third_party/re2/lib/codereview/codereview.py
GetRpcServer
def GetRpcServer(options): """Returns an instance of an AbstractRpcServer. Returns: A new AbstractRpcServer, on which RPC calls can be made. """ rpc_server_class = HttpRpcServer def GetUserCredentials(): """Prompts the user for a username and password.""" # Disable status prints so they don't obscure the ...
python
def GetRpcServer(options): """Returns an instance of an AbstractRpcServer. Returns: A new AbstractRpcServer, on which RPC calls can be made. """ rpc_server_class = HttpRpcServer def GetUserCredentials(): """Prompts the user for a username and password.""" # Disable status prints so they don't obscure the ...
['def', 'GetRpcServer', '(', 'options', ')', ':', 'rpc_server_class', '=', 'HttpRpcServer', 'def', 'GetUserCredentials', '(', ')', ':', '"""Prompts the user for a username and password."""', "# Disable status prints so they don't obscure the password prompt.", 'global', 'global_status', 'st', '=', 'global_status', 'glo...
Returns an instance of an AbstractRpcServer. Returns: A new AbstractRpcServer, on which RPC calls can be made.
['Returns', 'an', 'instance', 'of', 'an', 'AbstractRpcServer', '.']
train
https://github.com/kpdyer/regex2dfa/blob/109f877e60ef0dfcb430f11516d215930b7b9936/third_party/re2/lib/codereview/codereview.py#L3048-L3091
6,909
tipsi/tipsi_tools
tipsi_tools/doc_utils/tipsi_sphinx/dyn_serializer.py
parse_doc
def parse_doc(doc): """ Parse docstrings to dict, it should look like: key: value """ if not doc: return {} out = {} for s in doc.split('\n'): s = s.strip().split(':', maxsplit=1) if len(s) == 2: out[s[0]] = s[1] return out
python
def parse_doc(doc): """ Parse docstrings to dict, it should look like: key: value """ if not doc: return {} out = {} for s in doc.split('\n'): s = s.strip().split(':', maxsplit=1) if len(s) == 2: out[s[0]] = s[1] return out
['def', 'parse_doc', '(', 'doc', ')', ':', 'if', 'not', 'doc', ':', 'return', '{', '}', 'out', '=', '{', '}', 'for', 's', 'in', 'doc', '.', 'split', '(', "'\\n'", ')', ':', 's', '=', 's', '.', 'strip', '(', ')', '.', 'split', '(', "':'", ',', 'maxsplit', '=', '1', ')', 'if', 'len', '(', 's', ')', '==', '2', ':', 'out',...
Parse docstrings to dict, it should look like: key: value
['Parse', 'docstrings', 'to', 'dict', 'it', 'should', 'look', 'like', ':', 'key', ':', 'value']
train
https://github.com/tipsi/tipsi_tools/blob/1aba960c9890ceef2fb5e215b98b1646056ee58e/tipsi_tools/doc_utils/tipsi_sphinx/dyn_serializer.py#L20-L32
6,910
gr33ndata/dysl
dysl/social.py
SocialLM.karbasa
def karbasa(self, result): """ Finding if class probabilities are close to eachother Ratio of the distance between 1st and 2nd class, to the distance between 1st and last class. :param result: The dict returned by LM.calculate() """ probs = result['all_probs'...
python
def karbasa(self, result): """ Finding if class probabilities are close to eachother Ratio of the distance between 1st and 2nd class, to the distance between 1st and last class. :param result: The dict returned by LM.calculate() """ probs = result['all_probs'...
['def', 'karbasa', '(', 'self', ',', 'result', ')', ':', 'probs', '=', 'result', '[', "'all_probs'", ']', 'probs', '.', 'sort', '(', ')', 'return', 'float', '(', 'probs', '[', '1', ']', '-', 'probs', '[', '0', ']', ')', '/', 'float', '(', 'probs', '[', '-', '1', ']', '-', 'probs', '[', '0', ']', ')']
Finding if class probabilities are close to eachother Ratio of the distance between 1st and 2nd class, to the distance between 1st and last class. :param result: The dict returned by LM.calculate()
['Finding', 'if', 'class', 'probabilities', 'are', 'close', 'to', 'eachother', 'Ratio', 'of', 'the', 'distance', 'between', '1st', 'and', '2nd', 'class', 'to', 'the', 'distance', 'between', '1st', 'and', 'last', 'class', '.']
train
https://github.com/gr33ndata/dysl/blob/649c1d6a1761f47d49a9842e7389f6df52039155/dysl/social.py#L26-L35
6,911
titusjan/argos
argos/config/choicecti.py
ChoiceCti.createEditor
def createEditor(self, delegate, parent, option): """ Creates a ChoiceCtiEditor. For the parameters see the AbstractCti constructor documentation. """ return ChoiceCtiEditor(self, delegate, parent=parent)
python
def createEditor(self, delegate, parent, option): """ Creates a ChoiceCtiEditor. For the parameters see the AbstractCti constructor documentation. """ return ChoiceCtiEditor(self, delegate, parent=parent)
['def', 'createEditor', '(', 'self', ',', 'delegate', ',', 'parent', ',', 'option', ')', ':', 'return', 'ChoiceCtiEditor', '(', 'self', ',', 'delegate', ',', 'parent', '=', 'parent', ')']
Creates a ChoiceCtiEditor. For the parameters see the AbstractCti constructor documentation.
['Creates', 'a', 'ChoiceCtiEditor', '.', 'For', 'the', 'parameters', 'see', 'the', 'AbstractCti', 'constructor', 'documentation', '.']
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/choicecti.py#L161-L165
6,912
clalancette/pycdlib
pycdlib/udf.py
symlink_to_bytes
def symlink_to_bytes(symlink_target): # type: (str) -> bytes ''' A function to generate UDF symlink data from a Unix-like path. Parameters: symlink_target - The Unix-like path that is the symlink. Returns: The UDF data corresponding to the symlink. ''' symlink_data = bytearray() ...
python
def symlink_to_bytes(symlink_target): # type: (str) -> bytes ''' A function to generate UDF symlink data from a Unix-like path. Parameters: symlink_target - The Unix-like path that is the symlink. Returns: The UDF data corresponding to the symlink. ''' symlink_data = bytearray() ...
['def', 'symlink_to_bytes', '(', 'symlink_target', ')', ':', '# type: (str) -> bytes', 'symlink_data', '=', 'bytearray', '(', ')', 'for', 'comp', 'in', 'symlink_target', '.', 'split', '(', "'/'", ')', ':', 'if', 'comp', '==', "''", ':', '# If comp is empty, then we know this is the leading slash', '# and we should make...
A function to generate UDF symlink data from a Unix-like path. Parameters: symlink_target - The Unix-like path that is the symlink. Returns: The UDF data corresponding to the symlink.
['A', 'function', 'to', 'generate', 'UDF', 'symlink', 'data', 'from', 'a', 'Unix', '-', 'like', 'path', '.']
train
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/udf.py#L3554-L3582
6,913
GNS3/gns3-server
gns3server/compute/dynamips/nios/nio.py
NIO.set_bandwidth
def set_bandwidth(self, bandwidth): """ Sets bandwidth constraint. :param bandwidth: bandwidth integer value (in Kb/s) """ yield from self._hypervisor.send("nio set_bandwidth {name} {bandwidth}".format(name=self._name, bandwidth=bandwidth)) self._bandwidth = bandwidth
python
def set_bandwidth(self, bandwidth): """ Sets bandwidth constraint. :param bandwidth: bandwidth integer value (in Kb/s) """ yield from self._hypervisor.send("nio set_bandwidth {name} {bandwidth}".format(name=self._name, bandwidth=bandwidth)) self._bandwidth = bandwidth
['def', 'set_bandwidth', '(', 'self', ',', 'bandwidth', ')', ':', 'yield', 'from', 'self', '.', '_hypervisor', '.', 'send', '(', '"nio set_bandwidth {name} {bandwidth}"', '.', 'format', '(', 'name', '=', 'self', '.', '_name', ',', 'bandwidth', '=', 'bandwidth', ')', ')', 'self', '.', '_bandwidth', '=', 'bandwidth']
Sets bandwidth constraint. :param bandwidth: bandwidth integer value (in Kb/s)
['Sets', 'bandwidth', 'constraint', '.']
train
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nios/nio.py#L229-L237
6,914
SystemRDL/systemrdl-compiler
systemrdl/core/ComponentVisitor.py
ComponentVisitor.visitParam_def
def visitParam_def(self, ctx:SystemRDLParser.Param_defContext): """ Parameter Definition block """ self.compiler.namespace.enter_scope() param_defs = [] for elem in ctx.getTypedRuleContexts(SystemRDLParser.Param_def_elemContext): param_def = self.visit(elem) ...
python
def visitParam_def(self, ctx:SystemRDLParser.Param_defContext): """ Parameter Definition block """ self.compiler.namespace.enter_scope() param_defs = [] for elem in ctx.getTypedRuleContexts(SystemRDLParser.Param_def_elemContext): param_def = self.visit(elem) ...
['def', 'visitParam_def', '(', 'self', ',', 'ctx', ':', 'SystemRDLParser', '.', 'Param_defContext', ')', ':', 'self', '.', 'compiler', '.', 'namespace', '.', 'enter_scope', '(', ')', 'param_defs', '=', '[', ']', 'for', 'elem', 'in', 'ctx', '.', 'getTypedRuleContexts', '(', 'SystemRDLParser', '.', 'Param_def_elemContext...
Parameter Definition block
['Parameter', 'Definition', 'block']
train
https://github.com/SystemRDL/systemrdl-compiler/blob/6ae64f2bb6ecbbe9db356e20e8ac94e85bdeed3a/systemrdl/core/ComponentVisitor.py#L471-L483
6,915
alejandroautalan/pygubu
pygubu/widgets/calendarframe.py
CalendarFrame._draw_calendar
def _draw_calendar(self, canvas, redraw=False): """Draws calendar.""" options = self.__options # Update labels: name = self._cal.formatmonthname(self._date.year, self._date.month, 0, withyear=False) self._lmonth.configure(text=name.title()...
python
def _draw_calendar(self, canvas, redraw=False): """Draws calendar.""" options = self.__options # Update labels: name = self._cal.formatmonthname(self._date.year, self._date.month, 0, withyear=False) self._lmonth.configure(text=name.title()...
['def', '_draw_calendar', '(', 'self', ',', 'canvas', ',', 'redraw', '=', 'False', ')', ':', 'options', '=', 'self', '.', '__options', '# Update labels:', 'name', '=', 'self', '.', '_cal', '.', 'formatmonthname', '(', 'self', '.', '_date', '.', 'year', ',', 'self', '.', '_date', '.', 'month', ',', '0', ',', 'withyear',...
Draws calendar.
['Draws', 'calendar', '.']
train
https://github.com/alejandroautalan/pygubu/blob/41c8fb37ef973736ec5d68cbe1cd4ecb78712e40/pygubu/widgets/calendarframe.py#L362-L440
6,916
log2timeline/plaso
plaso/storage/event_tag_index.py
EventTagIndex._Build
def _Build(self, storage_file): """Builds the event tag index. Args: storage_file (BaseStorageFile): storage file. """ self._index = {} for event_tag in storage_file.GetEventTags(): self.SetEventTag(event_tag)
python
def _Build(self, storage_file): """Builds the event tag index. Args: storage_file (BaseStorageFile): storage file. """ self._index = {} for event_tag in storage_file.GetEventTags(): self.SetEventTag(event_tag)
['def', '_Build', '(', 'self', ',', 'storage_file', ')', ':', 'self', '.', '_index', '=', '{', '}', 'for', 'event_tag', 'in', 'storage_file', '.', 'GetEventTags', '(', ')', ':', 'self', '.', 'SetEventTag', '(', 'event_tag', ')']
Builds the event tag index. Args: storage_file (BaseStorageFile): storage file.
['Builds', 'the', 'event', 'tag', 'index', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/storage/event_tag_index.py#L21-L29
6,917
marcharper/python-ternary
ternary/ternary_axes_subplot.py
TernaryAxesSubplot.left_axis_label
def left_axis_label(self, label, position=None, rotation=60, offset=0.08, **kwargs): """ Sets the label on the left axis. Parameters ---------- label: String The axis label position: 3-Tuple of floats, None The position of...
python
def left_axis_label(self, label, position=None, rotation=60, offset=0.08, **kwargs): """ Sets the label on the left axis. Parameters ---------- label: String The axis label position: 3-Tuple of floats, None The position of...
['def', 'left_axis_label', '(', 'self', ',', 'label', ',', 'position', '=', 'None', ',', 'rotation', '=', '60', ',', 'offset', '=', '0.08', ',', '*', '*', 'kwargs', ')', ':', 'if', 'not', 'position', ':', 'position', '=', '(', '-', 'offset', ',', '3.', '/', '5', ',', '2.', '/', '5', ')', 'self', '.', '_labels', '[', '"...
Sets the label on the left axis. Parameters ---------- label: String The axis label position: 3-Tuple of floats, None The position of the text label rotation: float, 60 The angle of rotation of the label offset: float, Used...
['Sets', 'the', 'label', 'on', 'the', 'left', 'axis', '.']
train
https://github.com/marcharper/python-ternary/blob/a4bef393ec9df130d4b55707293c750498a01843/ternary/ternary_axes_subplot.py#L122-L143
6,918
materialsproject/pymatgen
pymatgen/symmetry/analyzer.py
PointGroupAnalyzer._find_spherical_axes
def _find_spherical_axes(self): """ Looks for R5, R4, R3 and R2 axes in spherical top molecules. Point group T molecules have only one unique 3-fold and one unique 2-fold axis. O molecules have one unique 4, 3 and 2-fold axes. I molecules have a unique 5-fold axis. """ ...
python
def _find_spherical_axes(self): """ Looks for R5, R4, R3 and R2 axes in spherical top molecules. Point group T molecules have only one unique 3-fold and one unique 2-fold axis. O molecules have one unique 4, 3 and 2-fold axes. I molecules have a unique 5-fold axis. """ ...
['def', '_find_spherical_axes', '(', 'self', ')', ':', 'rot_present', '=', 'defaultdict', '(', 'bool', ')', 'origin_site', ',', 'dist_el_sites', '=', 'cluster_sites', '(', 'self', '.', 'centered_mol', ',', 'self', '.', 'tol', ')', 'test_set', '=', 'min', '(', 'dist_el_sites', '.', 'values', '(', ')', ',', 'key', '=', '...
Looks for R5, R4, R3 and R2 axes in spherical top molecules. Point group T molecules have only one unique 3-fold and one unique 2-fold axis. O molecules have one unique 4, 3 and 2-fold axes. I molecules have a unique 5-fold axis.
['Looks', 'for', 'R5', 'R4', 'R3', 'and', 'R2', 'axes', 'in', 'spherical', 'top', 'molecules', '.', 'Point', 'group', 'T', 'molecules', 'have', 'only', 'one', 'unique', '3', '-', 'fold', 'and', 'one', 'unique', '2', '-', 'fold', 'axis', '.', 'O', 'molecules', 'have', 'one', 'unique', '4', '3', 'and', '2', '-', 'fold', ...
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1151-L1187
6,919
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/master.py
print_header
def print_header(text): """Prints header with given text and frame composed of '#' characters.""" print() print('#'*(len(text)+4)) print('# ' + text + ' #') print('#'*(len(text)+4)) print()
python
def print_header(text): """Prints header with given text and frame composed of '#' characters.""" print() print('#'*(len(text)+4)) print('# ' + text + ' #') print('#'*(len(text)+4)) print()
['def', 'print_header', '(', 'text', ')', ':', 'print', '(', ')', 'print', '(', "'#'", '*', '(', 'len', '(', 'text', ')', '+', '4', ')', ')', 'print', '(', "'# '", '+', 'text', '+', "' #'", ')', 'print', '(', "'#'", '*', '(', 'len', '(', 'text', ')', '+', '4', ')', ')', 'print', '(', ')']
Prints header with given text and frame composed of '#' characters.
['Prints', 'header', 'with', 'given', 'text', 'and', 'frame', 'composed', 'of', '#', 'characters', '.']
train
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/master.py#L40-L46
6,920
tuomas2/automate
src/automate/traits_fixes.py
_dispatch_change_event
def _dispatch_change_event(self, object, trait_name, old, new, handler): """ Prepare and dispatch a trait change event to a listener. """ # Extract the arguments needed from the handler. args = self.argument_transform(object, trait_name, old, new) # Send a description of the event to the change event ...
python
def _dispatch_change_event(self, object, trait_name, old, new, handler): """ Prepare and dispatch a trait change event to a listener. """ # Extract the arguments needed from the handler. args = self.argument_transform(object, trait_name, old, new) # Send a description of the event to the change event ...
['def', '_dispatch_change_event', '(', 'self', ',', 'object', ',', 'trait_name', ',', 'old', ',', 'new', ',', 'handler', ')', ':', '# Extract the arguments needed from the handler.', 'args', '=', 'self', '.', 'argument_transform', '(', 'object', ',', 'trait_name', ',', 'old', ',', 'new', ')', '# Send a description of t...
Prepare and dispatch a trait change event to a listener.
['Prepare', 'and', 'dispatch', 'a', 'trait', 'change', 'event', 'to', 'a', 'listener', '.']
train
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/traits_fixes.py#L59-L85
6,921
scrapinghub/adblockparser
adblockparser/parser.py
AdblockRules._matches
def _matches(self, url, options, general_re, domain_required_rules, rules_with_options): """ Return if ``url``/``options`` are matched by rules defined by ``general_re``, ``domain_required_rules`` and ``rules_with_options``. ``general_re`` is a compiled regex for rules ...
python
def _matches(self, url, options, general_re, domain_required_rules, rules_with_options): """ Return if ``url``/``options`` are matched by rules defined by ``general_re``, ``domain_required_rules`` and ``rules_with_options``. ``general_re`` is a compiled regex for rules ...
['def', '_matches', '(', 'self', ',', 'url', ',', 'options', ',', 'general_re', ',', 'domain_required_rules', ',', 'rules_with_options', ')', ':', 'if', 'general_re', 'and', 'general_re', '.', 'search', '(', 'url', ')', ':', 'return', 'True', 'rules', '=', '[', ']', 'if', "'domain'", 'in', 'options', 'and', 'domain_req...
Return if ``url``/``options`` are matched by rules defined by ``general_re``, ``domain_required_rules`` and ``rules_with_options``. ``general_re`` is a compiled regex for rules without options. ``domain_required_rules`` is a {domain: [rules_which_require_it]} mapping. ``rules...
['Return', 'if', 'url', '/', 'options', 'are', 'matched', 'by', 'rules', 'defined', 'by', 'general_re', 'domain_required_rules', 'and', 'rules_with_options', '.']
train
https://github.com/scrapinghub/adblockparser/blob/4089612d65018d38dbb88dd7f697bcb07814014d/adblockparser/parser.py#L366-L395
6,922
ND-CSE-30151/tock
tock/graphs.py
Graph.only_path
def only_path(self): """Finds the only path from the start node. If there is more than one, raises ValueError.""" start = [v for v in self.nodes if self.nodes[v].get('start', False)] if len(start) != 1: raise ValueError("graph does not have exactly one start node") ...
python
def only_path(self): """Finds the only path from the start node. If there is more than one, raises ValueError.""" start = [v for v in self.nodes if self.nodes[v].get('start', False)] if len(start) != 1: raise ValueError("graph does not have exactly one start node") ...
['def', 'only_path', '(', 'self', ')', ':', 'start', '=', '[', 'v', 'for', 'v', 'in', 'self', '.', 'nodes', 'if', 'self', '.', 'nodes', '[', 'v', ']', '.', 'get', '(', "'start'", ',', 'False', ')', ']', 'if', 'len', '(', 'start', ')', '!=', '1', ':', 'raise', 'ValueError', '(', '"graph does not have exactly one start n...
Finds the only path from the start node. If there is more than one, raises ValueError.
['Finds', 'the', 'only', 'path', 'from', 'the', 'start', 'node', '.', 'If', 'there', 'is', 'more', 'than', 'one', 'raises', 'ValueError', '.']
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/graphs.py#L44-L63
6,923
tjvr/kurt
kurt/__init__.py
BlockType.has_conversion
def has_conversion(self, plugin): """Return True if the plugin supports this block.""" plugin = kurt.plugin.Kurt.get_plugin(plugin) return plugin.name in self._plugins
python
def has_conversion(self, plugin): """Return True if the plugin supports this block.""" plugin = kurt.plugin.Kurt.get_plugin(plugin) return plugin.name in self._plugins
['def', 'has_conversion', '(', 'self', ',', 'plugin', ')', ':', 'plugin', '=', 'kurt', '.', 'plugin', '.', 'Kurt', '.', 'get_plugin', '(', 'plugin', ')', 'return', 'plugin', '.', 'name', 'in', 'self', '.', '_plugins']
Return True if the plugin supports this block.
['Return', 'True', 'if', 'the', 'plugin', 'supports', 'this', 'block', '.']
train
https://github.com/tjvr/kurt/blob/fcccd80cae11dc233f6dd02b40ec9a388c62f259/kurt/__init__.py#L1596-L1599
6,924
inasafe/inasafe
safe/gui/widgets/message.py
show_keyword_version_message
def show_keyword_version_message(sender, keyword_version, inasafe_version): """Show a message indicating that the keywords version is mismatch .. versionadded: 3.2 :param sender: Sender of the message signal. Default to Any object. :type sender: object :param keyword_version: The version of the l...
python
def show_keyword_version_message(sender, keyword_version, inasafe_version): """Show a message indicating that the keywords version is mismatch .. versionadded: 3.2 :param sender: Sender of the message signal. Default to Any object. :type sender: object :param keyword_version: The version of the l...
['def', 'show_keyword_version_message', '(', 'sender', ',', 'keyword_version', ',', 'inasafe_version', ')', ':', 'LOGGER', '.', 'debug', '(', "'Showing Mismatch Version Message'", ')', 'message', '=', 'generate_input_error_message', '(', 'tr', '(', "'Layer Keyword\\'s Version Mismatch:'", ')', ',', 'm', '.', 'Paragraph...
Show a message indicating that the keywords version is mismatch .. versionadded: 3.2 :param sender: Sender of the message signal. Default to Any object. :type sender: object :param keyword_version: The version of the layer's keywords :type keyword_version: str :param inasafe_version: The ver...
['Show', 'a', 'message', 'indicating', 'that', 'the', 'keywords', 'version', 'is', 'mismatch']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/message.py#L187-L223
6,925
acorg/dark-matter
dark/sam.py
SAMFilter.addFilteringOptions
def addFilteringOptions(parser, samfileIsPositionalArg=False): """ Add options to an argument parser for filtering SAM/BAM. @param samfileIsPositionalArg: If C{True} the SAM/BAM file must be given as the final argument on the command line (without being preceded by --sam...
python
def addFilteringOptions(parser, samfileIsPositionalArg=False): """ Add options to an argument parser for filtering SAM/BAM. @param samfileIsPositionalArg: If C{True} the SAM/BAM file must be given as the final argument on the command line (without being preceded by --sam...
['def', 'addFilteringOptions', '(', 'parser', ',', 'samfileIsPositionalArg', '=', 'False', ')', ':', 'parser', '.', 'add_argument', '(', "'%ssamfile'", '%', '(', "''", 'if', 'samfileIsPositionalArg', 'else', "'--'", ')', ',', 'required', '=', 'True', ',', 'help', '=', "'The SAM/BAM file to filter.'", ')', 'parser', '.'...
Add options to an argument parser for filtering SAM/BAM. @param samfileIsPositionalArg: If C{True} the SAM/BAM file must be given as the final argument on the command line (without being preceded by --samfile). @param parser: An C{argparse.ArgumentParser} instance.
['Add', 'options', 'to', 'an', 'argument', 'parser', 'for', 'filtering', 'SAM', '/', 'BAM', '.']
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L211-L269
6,926
LonamiWebs/Telethon
telethon/events/common.py
_into_id_set
async def _into_id_set(client, chats): """Helper util to turn the input chat or chats into a set of IDs.""" if chats is None: return None if not utils.is_list_like(chats): chats = (chats,) result = set() for chat in chats: if isinstance(chat, int): if chat < 0: ...
python
async def _into_id_set(client, chats): """Helper util to turn the input chat or chats into a set of IDs.""" if chats is None: return None if not utils.is_list_like(chats): chats = (chats,) result = set() for chat in chats: if isinstance(chat, int): if chat < 0: ...
['async', 'def', '_into_id_set', '(', 'client', ',', 'chats', ')', ':', 'if', 'chats', 'is', 'None', ':', 'return', 'None', 'if', 'not', 'utils', '.', 'is_list_like', '(', 'chats', ')', ':', 'chats', '=', '(', 'chats', ',', ')', 'result', '=', 'set', '(', ')', 'for', 'chat', 'in', 'chats', ':', 'if', 'isinstance', '(',...
Helper util to turn the input chat or chats into a set of IDs.
['Helper', 'util', 'to', 'turn', 'the', 'input', 'chat', 'or', 'chats', 'into', 'a', 'set', 'of', 'IDs', '.']
train
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/events/common.py#L11-L39
6,927
jazzband/django-widget-tweaks
widget_tweaks/templatetags/widget_tweaks.py
render_field
def render_field(parser, token): """ Render a form field using given attribute-value pairs Takes form field as first argument and list of attribute-value pairs for all other arguments. Attribute-value pairs should be in the form of attribute=value or attribute="a value" for assignment and attribut...
python
def render_field(parser, token): """ Render a form field using given attribute-value pairs Takes form field as first argument and list of attribute-value pairs for all other arguments. Attribute-value pairs should be in the form of attribute=value or attribute="a value" for assignment and attribut...
['def', 'render_field', '(', 'parser', ',', 'token', ')', ':', 'error_msg', '=', '\'%r tag requires a form field followed by a list of attributes and values in the form attr="value"\'', '%', 'token', '.', 'split_contents', '(', ')', '[', '0', ']', 'try', ':', 'bits', '=', 'token', '.', 'split_contents', '(', ')', 'tag_...
Render a form field using given attribute-value pairs Takes form field as first argument and list of attribute-value pairs for all other arguments. Attribute-value pairs should be in the form of attribute=value or attribute="a value" for assignment and attribute+=value or attribute+="value" for append...
['Render', 'a', 'form', 'field', 'using', 'given', 'attribute', '-', 'value', 'pairs']
train
https://github.com/jazzband/django-widget-tweaks/blob/f50ee92410d68e81528a7643a10544e7331af8fb/widget_tweaks/templatetags/widget_tweaks.py#L138-L172
6,928
jmgilman/Neolib
neolib/pyamf/remoting/client/__init__.py
RemotingService.addRequest
def addRequest(self, service, *args): """ Adds a request to be sent to the remoting gateway. """ wrapper = RequestWrapper(self, '/%d' % self.request_number, service, *args) self.request_number += 1 self.requests.append(wrapper) if self.logger: ...
python
def addRequest(self, service, *args): """ Adds a request to be sent to the remoting gateway. """ wrapper = RequestWrapper(self, '/%d' % self.request_number, service, *args) self.request_number += 1 self.requests.append(wrapper) if self.logger: ...
['def', 'addRequest', '(', 'self', ',', 'service', ',', '*', 'args', ')', ':', 'wrapper', '=', 'RequestWrapper', '(', 'self', ',', "'/%d'", '%', 'self', '.', 'request_number', ',', 'service', ',', '*', 'args', ')', 'self', '.', 'request_number', '+=', '1', 'self', '.', 'requests', '.', 'append', '(', 'wrapper', ')', 'i...
Adds a request to be sent to the remoting gateway.
['Adds', 'a', 'request', 'to', 'be', 'sent', 'to', 'the', 'remoting', 'gateway', '.']
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/remoting/client/__init__.py#L298-L311
6,929
chrlie/frogsay
src/frogsay/__init__.py
cli
def cli(): """\ Frogsay generates an ASCII picture of a FROG spouting a FROG tip. FROG tips are fetched from frog.tips's API endpoint when needed, otherwise they are cached locally in an application-specific folder. """ with open_client(cache_dir=get_cache_dir()) as client: tip = client...
python
def cli(): """\ Frogsay generates an ASCII picture of a FROG spouting a FROG tip. FROG tips are fetched from frog.tips's API endpoint when needed, otherwise they are cached locally in an application-specific folder. """ with open_client(cache_dir=get_cache_dir()) as client: tip = client...
['def', 'cli', '(', ')', ':', 'with', 'open_client', '(', 'cache_dir', '=', 'get_cache_dir', '(', ')', ')', 'as', 'client', ':', 'tip', '=', 'client', '.', 'frog_tip', '(', ')', 'terminal_width', '=', 'click', '.', 'termui', '.', 'get_terminal_size', '(', ')', '[', '0', ']', 'wisdom', '=', 'make_frog_fresco', '(', 'tip...
\ Frogsay generates an ASCII picture of a FROG spouting a FROG tip. FROG tips are fetched from frog.tips's API endpoint when needed, otherwise they are cached locally in an application-specific folder.
['\\', 'Frogsay', 'generates', 'an', 'ASCII', 'picture', 'of', 'a', 'FROG', 'spouting', 'a', 'FROG', 'tip', '.']
train
https://github.com/chrlie/frogsay/blob/1c21e1401dc24719732218af830d34b842ab10b9/src/frogsay/__init__.py#L17-L30
6,930
wonambi-python/wonambi
wonambi/trans/select.py
_create_subepochs
def _create_subepochs(x, nperseg, step): """Transform the data into a matrix for easy manipulation Parameters ---------- x : 1d ndarray actual data values nperseg : int number of samples in each row to create step : int distance in samples between rows Returns --...
python
def _create_subepochs(x, nperseg, step): """Transform the data into a matrix for easy manipulation Parameters ---------- x : 1d ndarray actual data values nperseg : int number of samples in each row to create step : int distance in samples between rows Returns --...
['def', '_create_subepochs', '(', 'x', ',', 'nperseg', ',', 'step', ')', ':', 'axis', '=', 'x', '.', 'ndim', '-', '1', '# last dim', 'nsmp', '=', 'x', '.', 'shape', '[', 'axis', ']', 'stride', '=', 'x', '.', 'strides', '[', 'axis', ']', 'noverlap', '=', 'nperseg', '-', 'step', 'v_shape', '=', '*', 'x', '.', 'shape', '[...
Transform the data into a matrix for easy manipulation Parameters ---------- x : 1d ndarray actual data values nperseg : int number of samples in each row to create step : int distance in samples between rows Returns ------- 2d ndarray a view (i.e. doesn'...
['Transform', 'the', 'data', 'into', 'a', 'matrix', 'for', 'easy', 'manipulation']
train
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L690-L715
6,931
numenta/htmresearch
projects/l2_pooling/topology_experiments.py
plotConvergenceByColumnTopology
def plotConvergenceByColumnTopology(results, columnRange, featureRange, networkType, numTrials): """ Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features. """ #######################################################################...
python
def plotConvergenceByColumnTopology(results, columnRange, featureRange, networkType, numTrials): """ Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features. """ #######################################################################...
['def', 'plotConvergenceByColumnTopology', '(', 'results', ',', 'columnRange', ',', 'featureRange', ',', 'networkType', ',', 'numTrials', ')', ':', '########################################################################', '#', '# Accumulate all the results per column in a convergence array.', '#', '# Convergence[f, c...
Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features.
['Plots', 'the', 'convergence', 'graph', ':', 'iterations', 'vs', 'number', 'of', 'columns', '.', 'Each', 'curve', 'shows', 'the', 'convergence', 'for', 'a', 'given', 'number', 'of', 'unique', 'features', '.']
train
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/l2_pooling/topology_experiments.py#L118-L182
6,932
StanfordVL/robosuite
robosuite/utils/mjcf_utils.py
xml_path_completion
def xml_path_completion(xml_path): """ Takes in a local xml path and returns a full path. if @xml_path is absolute, do nothing if @xml_path is not absolute, load xml that is shipped by the package """ if xml_path.startswith("/"): full_path = xml_path else: full_path =...
python
def xml_path_completion(xml_path): """ Takes in a local xml path and returns a full path. if @xml_path is absolute, do nothing if @xml_path is not absolute, load xml that is shipped by the package """ if xml_path.startswith("/"): full_path = xml_path else: full_path =...
['def', 'xml_path_completion', '(', 'xml_path', ')', ':', 'if', 'xml_path', '.', 'startswith', '(', '"/"', ')', ':', 'full_path', '=', 'xml_path', 'else', ':', 'full_path', '=', 'os', '.', 'path', '.', 'join', '(', 'robosuite', '.', 'models', '.', 'assets_root', ',', 'xml_path', ')', 'return', 'full_path']
Takes in a local xml path and returns a full path. if @xml_path is absolute, do nothing if @xml_path is not absolute, load xml that is shipped by the package
['Takes', 'in', 'a', 'local', 'xml', 'path', 'and', 'returns', 'a', 'full', 'path', '.', 'if']
train
https://github.com/StanfordVL/robosuite/blob/65cd16810e2ed647e3ec88746af3412065b7f278/robosuite/utils/mjcf_utils.py#L14-L24
6,933
SuperCowPowers/workbench
workbench_apps/workbench_cli/workbench_shell.py
WorkbenchShell.run
def run(self): ''' Running the workbench CLI ''' # Announce versions self.versions() # Sample/Tag info and Help self.tags() print '\n%s' % self.workbench.help('cli') # Now that we have the Workbench connection spun up, we register some stuff # with the ...
python
def run(self): ''' Running the workbench CLI ''' # Announce versions self.versions() # Sample/Tag info and Help self.tags() print '\n%s' % self.workbench.help('cli') # Now that we have the Workbench connection spun up, we register some stuff # with the ...
['def', 'run', '(', 'self', ')', ':', '# Announce versions', 'self', '.', 'versions', '(', ')', '# Sample/Tag info and Help', 'self', '.', 'tags', '(', ')', 'print', "'\\n%s'", '%', 'self', '.', 'workbench', '.', 'help', '(', "'cli'", ')', '# Now that we have the Workbench connection spun up, we register some stuff', '...
Running the workbench CLI
['Running', 'the', 'workbench', 'CLI']
train
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench_apps/workbench_cli/workbench_shell.py#L238-L274
6,934
dpgaspar/Flask-AppBuilder
flask_appbuilder/api/convert.py
Model2SchemaConverter._meta_schema_factory
def _meta_schema_factory(self, columns, model, class_mixin): """ Creates ModelSchema marshmallow-sqlalchemy :param columns: a list of columns to mix :param model: Model :param class_mixin: a marshamallow Schema to mix :return: ModelSchema """ _model =...
python
def _meta_schema_factory(self, columns, model, class_mixin): """ Creates ModelSchema marshmallow-sqlalchemy :param columns: a list of columns to mix :param model: Model :param class_mixin: a marshamallow Schema to mix :return: ModelSchema """ _model =...
['def', '_meta_schema_factory', '(', 'self', ',', 'columns', ',', 'model', ',', 'class_mixin', ')', ':', '_model', '=', 'model', 'if', 'columns', ':', 'class', 'MetaSchema', '(', 'ModelSchema', ',', 'class_mixin', ')', ':', 'class', 'Meta', ':', 'model', '=', '_model', 'fields', '=', 'columns', 'strict', '=', 'True', '...
Creates ModelSchema marshmallow-sqlalchemy :param columns: a list of columns to mix :param model: Model :param class_mixin: a marshamallow Schema to mix :return: ModelSchema
['Creates', 'ModelSchema', 'marshmallow', '-', 'sqlalchemy']
train
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/convert.py#L87-L110
6,935
bcbio/bcbio-nextgen
bcbio/distributed/resources.py
_get_prog_memory
def _get_prog_memory(resources, cores_per_job): """Get expected memory usage, in Gb per core, for a program from resource specification. """ out = None for jvm_opt in resources.get("jvm_opts", []): if jvm_opt.startswith("-Xmx"): out = _str_memory_to_gb(jvm_opt[4:]) memory = resou...
python
def _get_prog_memory(resources, cores_per_job): """Get expected memory usage, in Gb per core, for a program from resource specification. """ out = None for jvm_opt in resources.get("jvm_opts", []): if jvm_opt.startswith("-Xmx"): out = _str_memory_to_gb(jvm_opt[4:]) memory = resou...
['def', '_get_prog_memory', '(', 'resources', ',', 'cores_per_job', ')', ':', 'out', '=', 'None', 'for', 'jvm_opt', 'in', 'resources', '.', 'get', '(', '"jvm_opts"', ',', '[', ']', ')', ':', 'if', 'jvm_opt', '.', 'startswith', '(', '"-Xmx"', ')', ':', 'out', '=', '_str_memory_to_gb', '(', 'jvm_opt', '[', '4', ':', ']',...
Get expected memory usage, in Gb per core, for a program from resource specification.
['Get', 'expected', 'memory', 'usage', 'in', 'Gb', 'per', 'core', 'for', 'a', 'program', 'from', 'resource', 'specification', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/resources.py#L83-L98
6,936
pschmitt/python-opsview
opsview/opsview.py
main
def main(): ''' Main function ''' # We should only steal the root logger if we're the application, not the module logging.basicConfig(level=logging.DEBUG) args = get_args() if args.password: password = args.password else: password = getpass( prompt='Enter pa...
python
def main(): ''' Main function ''' # We should only steal the root logger if we're the application, not the module logging.basicConfig(level=logging.DEBUG) args = get_args() if args.password: password = args.password else: password = getpass( prompt='Enter pa...
['def', 'main', '(', ')', ':', "# We should only steal the root logger if we're the application, not the module", 'logging', '.', 'basicConfig', '(', 'level', '=', 'logging', '.', 'DEBUG', ')', 'args', '=', 'get_args', '(', ')', 'if', 'args', '.', 'password', ':', 'password', '=', 'args', '.', 'password', 'else', ':', ...
Main function
['Main', 'function']
train
https://github.com/pschmitt/python-opsview/blob/720acc06c491db32d18c79d20f04cae16e57a7fb/opsview/opsview.py#L500-L529
6,937
nchopin/particles
particles/kalman.py
predict_step
def predict_step(F, covX, filt): """Predictive step of Kalman filter. Parameters ---------- F: (dx, dx) numpy array Mean of X_t | X_{t-1} is F * X_{t-1} covX: (dx, dx) numpy array covariance of X_t | X_{t-1} filt: MeanAndCov object filtering distribution at time t-1 ...
python
def predict_step(F, covX, filt): """Predictive step of Kalman filter. Parameters ---------- F: (dx, dx) numpy array Mean of X_t | X_{t-1} is F * X_{t-1} covX: (dx, dx) numpy array covariance of X_t | X_{t-1} filt: MeanAndCov object filtering distribution at time t-1 ...
['def', 'predict_step', '(', 'F', ',', 'covX', ',', 'filt', ')', ':', 'pred_mean', '=', 'np', '.', 'matmul', '(', 'filt', '.', 'mean', ',', 'F', '.', 'T', ')', 'pred_cov', '=', 'dotdot', '(', 'F', ',', 'filt', '.', 'cov', ',', 'F', '.', 'T', ')', '+', 'covX', 'return', 'MeanAndCov', '(', 'mean', '=', 'pred_mean', ',', ...
Predictive step of Kalman filter. Parameters ---------- F: (dx, dx) numpy array Mean of X_t | X_{t-1} is F * X_{t-1} covX: (dx, dx) numpy array covariance of X_t | X_{t-1} filt: MeanAndCov object filtering distribution at time t-1 Returns ------- pred: MeanAn...
['Predictive', 'step', 'of', 'Kalman', 'filter', '.']
train
https://github.com/nchopin/particles/blob/3faa97a1073db45c5889eef3e015dd76ef350b52/particles/kalman.py#L163-L187
6,938
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.phase_search_names
def phase_search_names(self, source, phase): """Search the bundle.yaml metadata file for pipeline configurations. Looks for: - <phase>-<source_table> - <phase>-<dest_table> - <phase>-<source_name> """ search = [] assert phase is not None # Create a sear...
python
def phase_search_names(self, source, phase): """Search the bundle.yaml metadata file for pipeline configurations. Looks for: - <phase>-<source_table> - <phase>-<dest_table> - <phase>-<source_name> """ search = [] assert phase is not None # Create a sear...
['def', 'phase_search_names', '(', 'self', ',', 'source', ',', 'phase', ')', ':', 'search', '=', '[', ']', 'assert', 'phase', 'is', 'not', 'None', '# Create a search list of names for getting a pipline from the metadata', 'if', 'source', 'and', 'source', '.', 'source_table_name', ':', 'search', '.', 'append', '(', 'pha...
Search the bundle.yaml metadata file for pipeline configurations. Looks for: - <phase>-<source_table> - <phase>-<dest_table> - <phase>-<source_name>
['Search', 'the', 'bundle', '.', 'yaml', 'metadata', 'file', 'for', 'pipeline', 'configurations', '.', 'Looks', 'for', ':', '-', '<phase', '>', '-', '<source_table', '>', '-', '<phase', '>', '-', '<dest_table', '>', '-', '<phase', '>', '-', '<source_name', '>']
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L644-L667
6,939
fabioz/PyDev.Debugger
_pydev_imps/_pydev_SocketServer.py
ForkingMixIn.process_request
def process_request(self, request, client_address): """Fork a new subprocess to process the request.""" self.collect_children() pid = os.fork() # @UndefinedVariable if pid: # Parent process if self.active_children is None: self.active_children = [...
python
def process_request(self, request, client_address): """Fork a new subprocess to process the request.""" self.collect_children() pid = os.fork() # @UndefinedVariable if pid: # Parent process if self.active_children is None: self.active_children = [...
['def', 'process_request', '(', 'self', ',', 'request', ',', 'client_address', ')', ':', 'self', '.', 'collect_children', '(', ')', 'pid', '=', 'os', '.', 'fork', '(', ')', '# @UndefinedVariable', 'if', 'pid', ':', '# Parent process', 'if', 'self', '.', 'active_children', 'is', 'None', ':', 'self', '.', 'active_childre...
Fork a new subprocess to process the request.
['Fork', 'a', 'new', 'subprocess', 'to', 'process', 'the', 'request', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydev_imps/_pydev_SocketServer.py#L542-L565
6,940
andreikop/qutepart
qutepart/vim.py
isChar
def isChar(ev): """ Check if an event may be a typed character """ text = ev.text() if len(text) != 1: return False if ev.modifiers() not in (Qt.ShiftModifier, Qt.KeypadModifier, Qt.NoModifier): return False asciiCode = ord(text) if asciiCode <= 31 or asciiCode == 0x7f: # ...
python
def isChar(ev): """ Check if an event may be a typed character """ text = ev.text() if len(text) != 1: return False if ev.modifiers() not in (Qt.ShiftModifier, Qt.KeypadModifier, Qt.NoModifier): return False asciiCode = ord(text) if asciiCode <= 31 or asciiCode == 0x7f: # ...
['def', 'isChar', '(', 'ev', ')', ':', 'text', '=', 'ev', '.', 'text', '(', ')', 'if', 'len', '(', 'text', ')', '!=', '1', ':', 'return', 'False', 'if', 'ev', '.', 'modifiers', '(', ')', 'not', 'in', '(', 'Qt', '.', 'ShiftModifier', ',', 'Qt', '.', 'KeypadModifier', ',', 'Qt', '.', 'NoModifier', ')', ':', 'return', 'Fa...
Check if an event may be a typed character
['Check', 'if', 'an', 'event', 'may', 'be', 'a', 'typed', 'character']
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/vim.py#L47-L64
6,941
openego/ding0
ding0/tools/geo.py
calc_geo_centre_point
def calc_geo_centre_point(node_source, node_target): """ Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in config_calc.cfg. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDistributorDing0 sou...
python
def calc_geo_centre_point(node_source, node_target): """ Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in config_calc.cfg. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDistributorDing0 sou...
['def', 'calc_geo_centre_point', '(', 'node_source', ',', 'node_target', ')', ':', 'proj_source', '=', 'partial', '(', 'pyproj', '.', 'transform', ',', 'pyproj', '.', 'Proj', '(', 'init', '=', "'epsg:4326'", ')', ',', '# source coordinate system', 'pyproj', '.', 'Proj', '(', 'init', '=', "'epsg:3035'", ')', ')', '# des...
Calculates the geodesic distance between `node_source` and `node_target` incorporating the detour factor specified in config_calc.cfg. Parameters ---------- node_source: LVStationDing0, GeneratorDing0, or CableDistributorDing0 source node, member of GridDing0._graph node_target: LVStati...
['Calculates', 'the', 'geodesic', 'distance', 'between', 'node_source', 'and', 'node_target', 'incorporating', 'the', 'detour', 'factor', 'specified', 'in', 'config_calc', '.', 'cfg', '.', 'Parameters', '----------', 'node_source', ':', 'LVStationDing0', 'GeneratorDing0', 'or', 'CableDistributorDing0', 'source', 'node'...
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/geo.py#L206-L241
6,942
elmotec/massedit
massedit.py
MassEdit.append_code_expr
def append_code_expr(self, code): """Compile argument and adds it to the list of code objects.""" # expects a string. if isinstance(code, str) and not isinstance(code, unicode): code = unicode(code) if not isinstance(code, unicode): raise TypeError("string expecte...
python
def append_code_expr(self, code): """Compile argument and adds it to the list of code objects.""" # expects a string. if isinstance(code, str) and not isinstance(code, unicode): code = unicode(code) if not isinstance(code, unicode): raise TypeError("string expecte...
['def', 'append_code_expr', '(', 'self', ',', 'code', ')', ':', '# expects a string.', 'if', 'isinstance', '(', 'code', ',', 'str', ')', 'and', 'not', 'isinstance', '(', 'code', ',', 'unicode', ')', ':', 'code', '=', 'unicode', '(', 'code', ')', 'if', 'not', 'isinstance', '(', 'code', ',', 'unicode', ')', ':', 'raise',...
Compile argument and adds it to the list of code objects.
['Compile', 'argument', 'and', 'adds', 'it', 'to', 'the', 'list', 'of', 'code', 'objects', '.']
train
https://github.com/elmotec/massedit/blob/57e22787354896d63a8850312314b19aa0308906/massedit.py#L262-L276
6,943
ska-sa/montblanc
montblanc/util/__init__.py
random_like
def random_like(ary=None, shape=None, dtype=None): """ Returns a random array of the same shape and type as the supplied array argument, or the supplied shape and dtype """ if ary is not None: shape, dtype = ary.shape, ary.dtype elif shape is None or dtype is None: raise ValueErr...
python
def random_like(ary=None, shape=None, dtype=None): """ Returns a random array of the same shape and type as the supplied array argument, or the supplied shape and dtype """ if ary is not None: shape, dtype = ary.shape, ary.dtype elif shape is None or dtype is None: raise ValueErr...
['def', 'random_like', '(', 'ary', '=', 'None', ',', 'shape', '=', 'None', ',', 'dtype', '=', 'None', ')', ':', 'if', 'ary', 'is', 'not', 'None', ':', 'shape', ',', 'dtype', '=', 'ary', '.', 'shape', ',', 'ary', '.', 'dtype', 'elif', 'shape', 'is', 'None', 'or', 'dtype', 'is', 'None', ':', 'raise', 'ValueError', '(', '...
Returns a random array of the same shape and type as the supplied array argument, or the supplied shape and dtype
['Returns', 'a', 'random', 'array', 'of', 'the', 'same', 'shape', 'and', 'type', 'as', 'the', 'supplied', 'array', 'argument', 'or', 'the', 'supplied', 'shape', 'and', 'dtype']
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/__init__.py#L96-L113
6,944
soldag/python-pwmled
pwmled/led/rgb.py
RgbLed._prepare_transition
def _prepare_transition(self, is_on=None, brightness=None, color=None): """ Perform pre-transition tasks and construct the destination state. :param is_on: The on-off state to transition to. :param brightness: The brightness to transition to (0.0-1.0). :param color: The color to...
python
def _prepare_transition(self, is_on=None, brightness=None, color=None): """ Perform pre-transition tasks and construct the destination state. :param is_on: The on-off state to transition to. :param brightness: The brightness to transition to (0.0-1.0). :param color: The color to...
['def', '_prepare_transition', '(', 'self', ',', 'is_on', '=', 'None', ',', 'brightness', '=', 'None', ',', 'color', '=', 'None', ')', ':', 'dest_state', '=', 'super', '(', ')', '.', '_prepare_transition', '(', 'is_on', ',', 'brightness', '=', 'brightness', ',', 'color', '=', 'color', ')', '# Handle transitions from of...
Perform pre-transition tasks and construct the destination state. :param is_on: The on-off state to transition to. :param brightness: The brightness to transition to (0.0-1.0). :param color: The color to transition to. :return: The destination state of the transition.
['Perform', 'pre', '-', 'transition', 'tasks', 'and', 'construct', 'the', 'destination', 'state', '.']
train
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/led/rgb.py#L74-L91
6,945
geopy/geopy
geopy/geocoders/arcgis.py
ArcGIS._authenticated_call_geocoder
def _authenticated_call_geocoder(self, url, timeout=DEFAULT_SENTINEL): """ Wrap self._call_geocoder, handling tokens. """ if self.token is None or int(time()) > self.token_expiry: self._refresh_authentication_token() request = Request( "&".join((url, urlen...
python
def _authenticated_call_geocoder(self, url, timeout=DEFAULT_SENTINEL): """ Wrap self._call_geocoder, handling tokens. """ if self.token is None or int(time()) > self.token_expiry: self._refresh_authentication_token() request = Request( "&".join((url, urlen...
['def', '_authenticated_call_geocoder', '(', 'self', ',', 'url', ',', 'timeout', '=', 'DEFAULT_SENTINEL', ')', ':', 'if', 'self', '.', 'token', 'is', 'None', 'or', 'int', '(', 'time', '(', ')', ')', '>', 'self', '.', 'token_expiry', ':', 'self', '.', '_refresh_authentication_token', '(', ')', 'request', '=', 'Request',...
Wrap self._call_geocoder, handling tokens.
['Wrap', 'self', '.', '_call_geocoder', 'handling', 'tokens', '.']
train
https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/arcgis.py#L145-L155
6,946
ismms-himc/clustergrammer2
setupbase.py
_get_data_files
def _get_data_files(data_specs, existing, top=HERE): """Expand data file specs into valid data files metadata. Parameters ---------- data_specs: list of tuples See [create_cmdclass] for description. existing: list of tuples The existing distrubution data_files metadata. Returns...
python
def _get_data_files(data_specs, existing, top=HERE): """Expand data file specs into valid data files metadata. Parameters ---------- data_specs: list of tuples See [create_cmdclass] for description. existing: list of tuples The existing distrubution data_files metadata. Returns...
['def', '_get_data_files', '(', 'data_specs', ',', 'existing', ',', 'top', '=', 'HERE', ')', ':', '# Extract the existing data files into a staging object.', 'file_data', '=', 'defaultdict', '(', 'list', ')', 'for', '(', 'path', ',', 'files', ')', 'in', 'existing', 'or', '[', ']', ':', 'file_data', '[', 'path', ']', '=...
Expand data file specs into valid data files metadata. Parameters ---------- data_specs: list of tuples See [create_cmdclass] for description. existing: list of tuples The existing distrubution data_files metadata. Returns ------- A valid list of data_files items.
['Expand', 'data', 'file', 'specs', 'into', 'valid', 'data', 'files', 'metadata', '.']
train
https://github.com/ismms-himc/clustergrammer2/blob/5acea9bff7eda546cf0647b9e3647f631eb6f5f5/setupbase.py#L514-L554
6,947
fhcrc/taxtastic
taxtastic/taxonomy.py
Taxonomy.primary_from_name
def primary_from_name(self, tax_name): """ Return tax_id and primary tax_name corresponding to tax_name. """ names = self.names s1 = select([names.c.tax_id, names.c.is_primary], names.c.tax_name == tax_name) log.debug(str(s1)) res = s1.execu...
python
def primary_from_name(self, tax_name): """ Return tax_id and primary tax_name corresponding to tax_name. """ names = self.names s1 = select([names.c.tax_id, names.c.is_primary], names.c.tax_name == tax_name) log.debug(str(s1)) res = s1.execu...
['def', 'primary_from_name', '(', 'self', ',', 'tax_name', ')', ':', 'names', '=', 'self', '.', 'names', 's1', '=', 'select', '(', '[', 'names', '.', 'c', '.', 'tax_id', ',', 'names', '.', 'c', '.', 'is_primary', ']', ',', 'names', '.', 'c', '.', 'tax_name', '==', 'tax_name', ')', 'log', '.', 'debug', '(', 'str', '(', ...
Return tax_id and primary tax_name corresponding to tax_name.
['Return', 'tax_id', 'and', 'primary', 'tax_name', 'corresponding', 'to', 'tax_name', '.']
train
https://github.com/fhcrc/taxtastic/blob/4e874b7f2cc146178828bfba386314f8c342722b/taxtastic/taxonomy.py#L169-L193
6,948
tornadoweb/tornado
tornado/auth.py
GoogleOAuth2Mixin.get_authenticated_user
async def get_authenticated_user( self, redirect_uri: str, code: str ) -> Dict[str, Any]: """Handles the login for the Google user, returning an access token. The result is a dictionary containing an ``access_token`` field ([among others](https://developers.google.com/identity/proto...
python
async def get_authenticated_user( self, redirect_uri: str, code: str ) -> Dict[str, Any]: """Handles the login for the Google user, returning an access token. The result is a dictionary containing an ``access_token`` field ([among others](https://developers.google.com/identity/proto...
['async', 'def', 'get_authenticated_user', '(', 'self', ',', 'redirect_uri', ':', 'str', ',', 'code', ':', 'str', ')', '->', 'Dict', '[', 'str', ',', 'Any', ']', ':', '# noqa: E501', 'handler', '=', 'cast', '(', 'RequestHandler', ',', 'self', ')', 'http', '=', 'self', '.', 'get_auth_http_client', '(', ')', 'body', '=',...
Handles the login for the Google user, returning an access token. The result is a dictionary containing an ``access_token`` field ([among others](https://developers.google.com/identity/protocols/OAuth2WebServer#handlingtheresponse)). Unlike other ``get_authenticated_user`` methods in this packa...
['Handles', 'the', 'login', 'for', 'the', 'Google', 'user', 'returning', 'an', 'access', 'token', '.']
train
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/tornado/auth.py#L854-L916
6,949
ensime/ensime-vim
ensime_shared/editor.py
Editor.point2pos
def point2pos(self, point): """Converts a point or offset in a file to a (row, col) position.""" row = self._vim.eval('byte2line({})'.format(point)) col = self._vim.eval('{} - line2byte({})'.format(point, row)) return (int(row), int(col))
python
def point2pos(self, point): """Converts a point or offset in a file to a (row, col) position.""" row = self._vim.eval('byte2line({})'.format(point)) col = self._vim.eval('{} - line2byte({})'.format(point, row)) return (int(row), int(col))
['def', 'point2pos', '(', 'self', ',', 'point', ')', ':', 'row', '=', 'self', '.', '_vim', '.', 'eval', '(', "'byte2line({})'", '.', 'format', '(', 'point', ')', ')', 'col', '=', 'self', '.', '_vim', '.', 'eval', '(', "'{} - line2byte({})'", '.', 'format', '(', 'point', ',', 'row', ')', ')', 'return', '(', 'int', '(', ...
Converts a point or offset in a file to a (row, col) position.
['Converts', 'a', 'point', 'or', 'offset', 'in', 'a', 'file', 'to', 'a', '(', 'row', 'col', ')', 'position', '.']
train
https://github.com/ensime/ensime-vim/blob/caa734e84f002b25446c615706283a74edd4ecfe/ensime_shared/editor.py#L89-L93
6,950
parkouss/pyewmh
ewmh/ewmh.py
EWMH._setProperty
def _setProperty(self, _type, data, win=None, mask=None): """ Send a ClientMessage event to the root window """ if not win: win = self.root if type(data) is str: dataSize = 8 else: data = (data+[0]*(5-len(data)))[:5] dataSiz...
python
def _setProperty(self, _type, data, win=None, mask=None): """ Send a ClientMessage event to the root window """ if not win: win = self.root if type(data) is str: dataSize = 8 else: data = (data+[0]*(5-len(data)))[:5] dataSiz...
['def', '_setProperty', '(', 'self', ',', '_type', ',', 'data', ',', 'win', '=', 'None', ',', 'mask', '=', 'None', ')', ':', 'if', 'not', 'win', ':', 'win', '=', 'self', '.', 'root', 'if', 'type', '(', 'data', ')', 'is', 'str', ':', 'dataSize', '=', '8', 'else', ':', 'data', '=', '(', 'data', '+', '[', '0', ']', '*', '...
Send a ClientMessage event to the root window
['Send', 'a', 'ClientMessage', 'event', 'to', 'the', 'root', 'window']
train
https://github.com/parkouss/pyewmh/blob/8209e9d942b4f39e32f14e2684d94bb5e6269aac/ewmh/ewmh.py#L412-L430
6,951
stephen-bunn/file-config
tasks/docs.py
view
def view(ctx): """ Build and view docs. """ report.info(ctx, "docs.view", f"viewing documentation") build_path = ctx.docs.directory / "build" / "html" / "index.html" build_path = pathname2url(build_path.as_posix()) webbrowser.open(f"file:{build_path!s}")
python
def view(ctx): """ Build and view docs. """ report.info(ctx, "docs.view", f"viewing documentation") build_path = ctx.docs.directory / "build" / "html" / "index.html" build_path = pathname2url(build_path.as_posix()) webbrowser.open(f"file:{build_path!s}")
['def', 'view', '(', 'ctx', ')', ':', 'report', '.', 'info', '(', 'ctx', ',', '"docs.view"', ',', 'f"viewing documentation"', ')', 'build_path', '=', 'ctx', '.', 'docs', '.', 'directory', '/', '"build"', '/', '"html"', '/', '"index.html"', 'build_path', '=', 'pathname2url', '(', 'build_path', '.', 'as_posix', '(', ')',...
Build and view docs.
['Build', 'and', 'view', 'docs', '.']
train
https://github.com/stephen-bunn/file-config/blob/93429360c949985202e1f2b9cd0340731819ba75/tasks/docs.py#L58-L65
6,952
HazyResearch/fonduer
src/fonduer/candidates/matchers.py
_FigureMatcher._get_span
def _get_span(self, m): """ Gets a tuple that identifies a figure for the specific mention class that m belongs to. """ return (m.figure.document.id, m.figure.position)
python
def _get_span(self, m): """ Gets a tuple that identifies a figure for the specific mention class that m belongs to. """ return (m.figure.document.id, m.figure.position)
['def', '_get_span', '(', 'self', ',', 'm', ')', ':', 'return', '(', 'm', '.', 'figure', '.', 'document', '.', 'id', ',', 'm', '.', 'figure', '.', 'position', ')']
Gets a tuple that identifies a figure for the specific mention class that m belongs to.
['Gets', 'a', 'tuple', 'that', 'identifies', 'a', 'figure', 'for', 'the', 'specific', 'mention', 'class', 'that', 'm', 'belongs', 'to', '.']
train
https://github.com/HazyResearch/fonduer/blob/4520f86a716f03dcca458a9f4bddac75b4e7068f/src/fonduer/candidates/matchers.py#L476-L481
6,953
gwastro/pycbc
pycbc/inference/sampler/base_mcmc.py
BaseMCMC.set_target_from_config
def set_target_from_config(self, cp, section): """Sets the target using the given config file. This looks for ``niterations`` to set the ``target_niterations``, and ``effective-nsamples`` to set the ``target_eff_nsamples``. Parameters ---------- cp : ConfigParser ...
python
def set_target_from_config(self, cp, section): """Sets the target using the given config file. This looks for ``niterations`` to set the ``target_niterations``, and ``effective-nsamples`` to set the ``target_eff_nsamples``. Parameters ---------- cp : ConfigParser ...
['def', 'set_target_from_config', '(', 'self', ',', 'cp', ',', 'section', ')', ':', 'if', 'cp', '.', 'has_option', '(', 'section', ',', '"niterations"', ')', ':', 'niterations', '=', 'int', '(', 'cp', '.', 'get', '(', 'section', ',', '"niterations"', ')', ')', 'else', ':', 'niterations', '=', 'None', 'if', 'cp', '.', '...
Sets the target using the given config file. This looks for ``niterations`` to set the ``target_niterations``, and ``effective-nsamples`` to set the ``target_eff_nsamples``. Parameters ---------- cp : ConfigParser Open config parser to retrieve the argument from. ...
['Sets', 'the', 'target', 'using', 'the', 'given', 'config', 'file', '.']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/inference/sampler/base_mcmc.py#L661-L682
6,954
choderalab/pymbar
pymbar/utils.py
check_w_normalized
def check_w_normalized(W, N_k, tolerance = 1.0e-4): """Check the weight matrix W is properly normalized. The sum over N should be 1, and the sum over k by N_k should aslo be 1 Parameters ---------- W : np.ndarray, shape=(N, K), dtype='float' The normalized weight matrix for snapshots and states...
python
def check_w_normalized(W, N_k, tolerance = 1.0e-4): """Check the weight matrix W is properly normalized. The sum over N should be 1, and the sum over k by N_k should aslo be 1 Parameters ---------- W : np.ndarray, shape=(N, K), dtype='float' The normalized weight matrix for snapshots and states...
['def', 'check_w_normalized', '(', 'W', ',', 'N_k', ',', 'tolerance', '=', '1.0e-4', ')', ':', '[', 'N', ',', 'K', ']', '=', 'W', '.', 'shape', 'column_sums', '=', 'np', '.', 'sum', '(', 'W', ',', 'axis', '=', '0', ')', 'badcolumns', '=', '(', 'np', '.', 'abs', '(', 'column_sums', '-', '1', ')', '>', 'tolerance', ')', ...
Check the weight matrix W is properly normalized. The sum over N should be 1, and the sum over k by N_k should aslo be 1 Parameters ---------- W : np.ndarray, shape=(N, K), dtype='float' The normalized weight matrix for snapshots and states. W[n, k] is the weight of snapshot n in state k. ...
['Check', 'the', 'weight', 'matrix', 'W', 'is', 'properly', 'normalized', '.', 'The', 'sum', 'over', 'N', 'should', 'be', '1', 'and', 'the', 'sum', 'over', 'k', 'by', 'N_k', 'should', 'aslo', 'be', '1']
train
https://github.com/choderalab/pymbar/blob/69d1f0ff680e9ac1c6a51a5a207ea28f3ed86740/pymbar/utils.py#L332-L371
6,955
Microsoft/nni
src/sdk/pynni/nni/metis_tuner/metis_tuner.py
_rand_init
def _rand_init(x_bounds, x_types, selection_num_starting_points): ''' Random sample some init seed within bounds. ''' return [lib_data.rand(x_bounds, x_types) for i \ in range(0, selection_num_starting_points)]
python
def _rand_init(x_bounds, x_types, selection_num_starting_points): ''' Random sample some init seed within bounds. ''' return [lib_data.rand(x_bounds, x_types) for i \ in range(0, selection_num_starting_points)]
['def', '_rand_init', '(', 'x_bounds', ',', 'x_types', ',', 'selection_num_starting_points', ')', ':', 'return', '[', 'lib_data', '.', 'rand', '(', 'x_bounds', ',', 'x_types', ')', 'for', 'i', 'in', 'range', '(', '0', ',', 'selection_num_starting_points', ')', ']']
Random sample some init seed within bounds.
['Random', 'sample', 'some', 'init', 'seed', 'within', 'bounds', '.']
train
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/metis_tuner.py#L493-L498
6,956
juju/python-libjuju
juju/model.py
Model._wait
async def _wait(self, entity_type, entity_id, action, predicate=None): """ Block the calling routine until a given action has happened to the given entity :param entity_type: The entity's type. :param entity_id: The entity's id. :param action: the type of action (e.g., '...
python
async def _wait(self, entity_type, entity_id, action, predicate=None): """ Block the calling routine until a given action has happened to the given entity :param entity_type: The entity's type. :param entity_id: The entity's id. :param action: the type of action (e.g., '...
['async', 'def', '_wait', '(', 'self', ',', 'entity_type', ',', 'entity_id', ',', 'action', ',', 'predicate', '=', 'None', ')', ':', 'q', '=', 'asyncio', '.', 'Queue', '(', 'loop', '=', 'self', '.', '_connector', '.', 'loop', ')', 'async', 'def', 'callback', '(', 'delta', ',', 'old', ',', 'new', ',', 'model', ')', ':',...
Block the calling routine until a given action has happened to the given entity :param entity_type: The entity's type. :param entity_id: The entity's id. :param action: the type of action (e.g., 'add', 'change', or 'remove') :param predicate: optional callable that must take as ...
['Block', 'the', 'calling', 'routine', 'until', 'a', 'given', 'action', 'has', 'happened', 'to', 'the', 'given', 'entity']
train
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L898-L922
6,957
theislab/anndata
anndata/h5py/h5sparse.py
_set_many
def _set_many(self, i, j, x): """Sets value at each (i, j) to x Here (i,j) index major and minor respectively, and must not contain duplicate entries. """ i, j, M, N = self._prepare_indices(i, j) n_samples = len(x) offsets = np.empty(n_samples, dtype=self.indices.dtype) ret = _sparseto...
python
def _set_many(self, i, j, x): """Sets value at each (i, j) to x Here (i,j) index major and minor respectively, and must not contain duplicate entries. """ i, j, M, N = self._prepare_indices(i, j) n_samples = len(x) offsets = np.empty(n_samples, dtype=self.indices.dtype) ret = _sparseto...
['def', '_set_many', '(', 'self', ',', 'i', ',', 'j', ',', 'x', ')', ':', 'i', ',', 'j', ',', 'M', ',', 'N', '=', 'self', '.', '_prepare_indices', '(', 'i', ',', 'j', ')', 'n_samples', '=', 'len', '(', 'x', ')', 'offsets', '=', 'np', '.', 'empty', '(', 'n_samples', ',', 'dtype', '=', 'self', '.', 'indices', '.', 'dtype...
Sets value at each (i, j) to x Here (i,j) index major and minor respectively, and must not contain duplicate entries.
['Sets', 'value', 'at', 'each', '(', 'i', 'j', ')', 'to', 'x']
train
https://github.com/theislab/anndata/blob/34f4eb63710628fbc15e7050e5efcac1d7806062/anndata/h5py/h5sparse.py#L170-L208
6,958
radical-cybertools/radical.entk
src/radical/entk/stage/stage.py
Stage._validate_entities
def _validate_entities(self, tasks): """ Purpose: Validate whether the 'tasks' is of type set. Validate the description of each Task. """ if not tasks: raise TypeError(expected_type=Task, actual_type=type(tasks)) if not isinstance(tasks, set): if not is...
python
def _validate_entities(self, tasks): """ Purpose: Validate whether the 'tasks' is of type set. Validate the description of each Task. """ if not tasks: raise TypeError(expected_type=Task, actual_type=type(tasks)) if not isinstance(tasks, set): if not is...
['def', '_validate_entities', '(', 'self', ',', 'tasks', ')', ':', 'if', 'not', 'tasks', ':', 'raise', 'TypeError', '(', 'expected_type', '=', 'Task', ',', 'actual_type', '=', 'type', '(', 'tasks', ')', ')', 'if', 'not', 'isinstance', '(', 'tasks', ',', 'set', ')', ':', 'if', 'not', 'isinstance', '(', 'tasks', ',', 'li...
Purpose: Validate whether the 'tasks' is of type set. Validate the description of each Task.
['Purpose', ':', 'Validate', 'whether', 'the', 'tasks', 'is', 'of', 'type', 'set', '.', 'Validate', 'the', 'description', 'of', 'each', 'Task', '.']
train
https://github.com/radical-cybertools/radical.entk/blob/945f6c93c9a62db90ad191b306418d5c1cdd9d24/src/radical/entk/stage/stage.py#L308-L328
6,959
boriel/zxbasic
zxbpplex.py
Lexer.t_singlecomment_NEWLINE
def t_singlecomment_NEWLINE(self, t): r'\r?\n' t.lexer.pop_state() # Back to initial t.lexer.lineno += 1 return t
python
def t_singlecomment_NEWLINE(self, t): r'\r?\n' t.lexer.pop_state() # Back to initial t.lexer.lineno += 1 return t
['def', 't_singlecomment_NEWLINE', '(', 'self', ',', 't', ')', ':', 't', '.', 'lexer', '.', 'pop_state', '(', ')', '# Back to initial', 't', '.', 'lexer', '.', 'lineno', '+=', '1', 'return', 't']
r'\r?\n
['r', '\\', 'r?', '\\', 'n']
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbpplex.py#L152-L156
6,960
infothrill/python-dyndnsc
dyndnsc/detector/rand.py
RandomIPGenerator.random_public_ip
def random_public_ip(self): """Return a randomly generated, public IPv4 address. :return: ip address """ randomip = random_ip() while self.is_reserved_ip(randomip): randomip = random_ip() return randomip
python
def random_public_ip(self): """Return a randomly generated, public IPv4 address. :return: ip address """ randomip = random_ip() while self.is_reserved_ip(randomip): randomip = random_ip() return randomip
['def', 'random_public_ip', '(', 'self', ')', ':', 'randomip', '=', 'random_ip', '(', ')', 'while', 'self', '.', 'is_reserved_ip', '(', 'randomip', ')', ':', 'randomip', '=', 'random_ip', '(', ')', 'return', 'randomip']
Return a randomly generated, public IPv4 address. :return: ip address
['Return', 'a', 'randomly', 'generated', 'public', 'IPv4', 'address', '.']
train
https://github.com/infothrill/python-dyndnsc/blob/2196d48aa6098da9835a7611fbdb0b5f0fbf51e4/dyndnsc/detector/rand.py#L64-L72
6,961
fermiPy/fermipy
fermipy/jobs/file_archive.py
FileArchive.get_file_paths
def get_file_paths(self, id_list): """Get a list of file paths based of a set of ids Parameters ---------- id_list : list List of integer file keys Returns list of file paths """ if id_list is None: return [] try: pat...
python
def get_file_paths(self, id_list): """Get a list of file paths based of a set of ids Parameters ---------- id_list : list List of integer file keys Returns list of file paths """ if id_list is None: return [] try: pat...
['def', 'get_file_paths', '(', 'self', ',', 'id_list', ')', ':', 'if', 'id_list', 'is', 'None', ':', 'return', '[', ']', 'try', ':', 'path_array', '=', 'self', '.', '_table', '[', 'id_list', '-', '1', ']', '[', "'path'", ']', 'except', 'IndexError', ':', 'print', '(', '"IndexError "', ',', 'len', '(', 'self', '.', '_ta...
Get a list of file paths based of a set of ids Parameters ---------- id_list : list List of integer file keys Returns list of file paths
['Get', 'a', 'list', 'of', 'file', 'paths', 'based', 'of', 'a', 'set', 'of', 'ids']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L746-L764
6,962
mitsei/dlkit
dlkit/json_/assessment_authoring/managers.py
AssessmentAuthoringManager.get_sequence_rule_admin_session_for_bank
def get_sequence_rule_admin_session_for_bank(self, bank_id): """Gets the ``OsidSession`` associated with the sequence rule administration service for the given bank. arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank`` return: (osid.assessment.authoring.SequenceRuleAdminSession) - a ...
python
def get_sequence_rule_admin_session_for_bank(self, bank_id): """Gets the ``OsidSession`` associated with the sequence rule administration service for the given bank. arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank`` return: (osid.assessment.authoring.SequenceRuleAdminSession) - a ...
['def', 'get_sequence_rule_admin_session_for_bank', '(', 'self', ',', 'bank_id', ')', ':', 'if', 'not', 'self', '.', 'supports_sequence_rule_admin', '(', ')', ':', 'raise', 'errors', '.', 'Unimplemented', '(', ')', '##', '# Also include check to see if the catalog Id is found otherwise raise errors.NotFound', '##', '# ...
Gets the ``OsidSession`` associated with the sequence rule administration service for the given bank. arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank`` return: (osid.assessment.authoring.SequenceRuleAdminSession) - a ``SequenceRuleAdminSession`` raise: NotFound - no ``Ba...
['Gets', 'the', 'OsidSession', 'associated', 'with', 'the', 'sequence', 'rule', 'administration', 'service', 'for', 'the', 'given', 'bank', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/managers.py#L560-L582
6,963
camptocamp/Studio
studio/config/environment.py
load_environment
def load_environment(global_conf, app_conf): """Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), ...
python
def load_environment(global_conf, app_conf): """Configure the Pylons environment via the ``pylons.config`` object """ # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) paths = dict(root=root, controllers=os.path.join(root, 'controllers'), ...
['def', 'load_environment', '(', 'global_conf', ',', 'app_conf', ')', ':', '# Pylons paths', 'root', '=', 'os', '.', 'path', '.', 'dirname', '(', 'os', '.', 'path', '.', 'dirname', '(', 'os', '.', 'path', '.', 'abspath', '(', '__file__', ')', ')', ')', 'paths', '=', 'dict', '(', 'root', '=', 'root', ',', 'controllers',...
Configure the Pylons environment via the ``pylons.config`` object
['Configure', 'the', 'Pylons', 'environment', 'via', 'the', 'pylons', '.', 'config', 'object']
train
https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/config/environment.py#L34-L75
6,964
jilljenn/tryalgo
tryalgo/windows_k_distinct.py
windows_k_distinct
def windows_k_distinct(x, k): """Find all largest windows containing exactly k distinct elements :param x: list or string :param k: positive integer :yields: largest intervals [i, j) with len(set(x[i:j])) == k :complexity: `O(|x|)` """ dist, i, j = 0, 0, 0 # dist = |{x[i], .....
python
def windows_k_distinct(x, k): """Find all largest windows containing exactly k distinct elements :param x: list or string :param k: positive integer :yields: largest intervals [i, j) with len(set(x[i:j])) == k :complexity: `O(|x|)` """ dist, i, j = 0, 0, 0 # dist = |{x[i], .....
['def', 'windows_k_distinct', '(', 'x', ',', 'k', ')', ':', 'dist', ',', 'i', ',', 'j', '=', '0', ',', '0', ',', '0', '# dist = |{x[i], ..., x[j-1]}|', 'occ', '=', '{', 'xi', ':', '0', 'for', 'xi', 'in', 'x', '}', '# number of occurrences in x[i:j]', 'while', 'j', '<', 'len', '(', 'x', ')', ':', 'while', 'dist', '==', ...
Find all largest windows containing exactly k distinct elements :param x: list or string :param k: positive integer :yields: largest intervals [i, j) with len(set(x[i:j])) == k :complexity: `O(|x|)`
['Find', 'all', 'largest', 'windows', 'containing', 'exactly', 'k', 'distinct', 'elements']
train
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/windows_k_distinct.py#L8-L30
6,965
SwoopSearch/pyaddress
address/dstk.py
post_multipart
def post_multipart(host, selector, fields, files): """ Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's re...
python
def post_multipart(host, selector, fields, files): """ Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's re...
['def', 'post_multipart', '(', 'host', ',', 'selector', ',', 'fields', ',', 'files', ')', ':', 'content_type', ',', 'body', '=', 'encode_multipart_formdata', '(', 'fields', ',', 'files', ')', 'h', '=', 'httplib', '.', 'HTTP', '(', 'host', ')', 'h', '.', 'putrequest', '(', "'POST'", ',', 'selector', ')', 'h', '.', 'puth...
Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's response page.
['Post', 'fields', 'and', 'files', 'to', 'an', 'http', 'host', 'as', 'multipart', '/', 'form', '-', 'data', '.', 'fields', 'is', 'a', 'sequence', 'of', '(', 'name', 'value', ')', 'elements', 'for', 'regular', 'form', 'fields', '.', 'files', 'is', 'a', 'sequence', 'of', '(', 'name', 'filename', 'value', ')', 'elements',...
train
https://github.com/SwoopSearch/pyaddress/blob/62ebb07a6840e710d256406a8ec1d06abec0e1c4/address/dstk.py#L208-L223
6,966
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.tickEFP
def tickEFP(self, tickerId, tickType, basisPoints, formattedBasisPoints, totalDividends, holdDays, futureExpiry, dividendImpact, dividendsToExpiry): """tickEFP(EWrapper self, TickerId tickerId, TickType tickType, double basisPoints, IBString const & formattedBasisPoints, double totalDividends, int holdDays, IBS...
python
def tickEFP(self, tickerId, tickType, basisPoints, formattedBasisPoints, totalDividends, holdDays, futureExpiry, dividendImpact, dividendsToExpiry): """tickEFP(EWrapper self, TickerId tickerId, TickType tickType, double basisPoints, IBString const & formattedBasisPoints, double totalDividends, int holdDays, IBS...
['def', 'tickEFP', '(', 'self', ',', 'tickerId', ',', 'tickType', ',', 'basisPoints', ',', 'formattedBasisPoints', ',', 'totalDividends', ',', 'holdDays', ',', 'futureExpiry', ',', 'dividendImpact', ',', 'dividendsToExpiry', ')', ':', 'return', '_swigibpy', '.', 'EWrapper_tickEFP', '(', 'self', ',', 'tickerId', ',', 't...
tickEFP(EWrapper self, TickerId tickerId, TickType tickType, double basisPoints, IBString const & formattedBasisPoints, double totalDividends, int holdDays, IBString const & futureExpiry, double dividendImpact, double dividendsToExpiry)
['tickEFP', '(', 'EWrapper', 'self', 'TickerId', 'tickerId', 'TickType', 'tickType', 'double', 'basisPoints', 'IBString', 'const', '&', 'formattedBasisPoints', 'double', 'totalDividends', 'int', 'holdDays', 'IBString', 'const', '&', 'futureExpiry', 'double', 'dividendImpact', 'double', 'dividendsToExpiry', ')']
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2446-L2448
6,967
eyurtsev/FlowCytometryTools
FlowCytometryTools/core/transforms.py
transform_frame
def transform_frame(frame, transform, columns=None, direction='forward', return_all=True, args=(), **kwargs): """ Apply transform to specified columns. direction: 'forward' | 'inverse' return_all: bool True - return all columns, with specified ones transformed. Fals...
python
def transform_frame(frame, transform, columns=None, direction='forward', return_all=True, args=(), **kwargs): """ Apply transform to specified columns. direction: 'forward' | 'inverse' return_all: bool True - return all columns, with specified ones transformed. Fals...
['def', 'transform_frame', '(', 'frame', ',', 'transform', ',', 'columns', '=', 'None', ',', 'direction', '=', "'forward'", ',', 'return_all', '=', 'True', ',', 'args', '=', '(', ')', ',', '*', '*', 'kwargs', ')', ':', 'tfun', ',', 'tname', '=', 'parse_transform', '(', 'transform', ',', 'direction', ')', 'columns', '='...
Apply transform to specified columns. direction: 'forward' | 'inverse' return_all: bool True - return all columns, with specified ones transformed. False - return only specified columns. .. warning:: deprecated
['Apply', 'transform', 'to', 'specified', 'columns', '.']
train
https://github.com/eyurtsev/FlowCytometryTools/blob/4355632508b875273d68c7e2972c17668bcf7b40/FlowCytometryTools/core/transforms.py#L303-L325
6,968
ethereum/py-evm
eth/vm/base.py
VM.validate_header
def validate_header(cls, header: BlockHeader, parent_header: BlockHeader, check_seal: bool = True) -> None: """ :raise eth.exceptions.ValidationError: if the header is not valid """ if parent_header is None: ...
python
def validate_header(cls, header: BlockHeader, parent_header: BlockHeader, check_seal: bool = True) -> None: """ :raise eth.exceptions.ValidationError: if the header is not valid """ if parent_header is None: ...
['def', 'validate_header', '(', 'cls', ',', 'header', ':', 'BlockHeader', ',', 'parent_header', ':', 'BlockHeader', ',', 'check_seal', ':', 'bool', '=', 'True', ')', '->', 'None', ':', 'if', 'parent_header', 'is', 'None', ':', '# to validate genesis header, check if it equals canonical header at block number 0', 'raise...
:raise eth.exceptions.ValidationError: if the header is not valid
[':', 'raise', 'eth', '.', 'exceptions', '.', 'ValidationError', ':', 'if', 'the', 'header', 'is', 'not', 'valid']
train
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/vm/base.py#L879-L915
6,969
seequent/properties
properties/base/instance.py
Instance.assert_valid
def assert_valid(self, instance, value=None): """Checks if valid, including HasProperty instances pass validation""" valid = super(Instance, self).assert_valid(instance, value) if not valid: return False if value is None: value = instance._get(self.name) i...
python
def assert_valid(self, instance, value=None): """Checks if valid, including HasProperty instances pass validation""" valid = super(Instance, self).assert_valid(instance, value) if not valid: return False if value is None: value = instance._get(self.name) i...
['def', 'assert_valid', '(', 'self', ',', 'instance', ',', 'value', '=', 'None', ')', ':', 'valid', '=', 'super', '(', 'Instance', ',', 'self', ')', '.', 'assert_valid', '(', 'instance', ',', 'value', ')', 'if', 'not', 'valid', ':', 'return', 'False', 'if', 'value', 'is', 'None', ':', 'value', '=', 'instance', '.', '_g...
Checks if valid, including HasProperty instances pass validation
['Checks', 'if', 'valid', 'including', 'HasProperty', 'instances', 'pass', 'validation']
train
https://github.com/seequent/properties/blob/096b07012fff86b0a880c8c018320c3b512751b9/properties/base/instance.py#L113-L122
6,970
jssimporter/python-jss
jss/jamf_software_server.py
JSS.from_pickle
def from_pickle(cls, path): """Load all objects from pickle file and return as dict. The dict returned will have keys named the same as the JSSObject classes contained, and the values will be JSSObjectLists of all full objects of that class (for example, the equivalent of my_jss...
python
def from_pickle(cls, path): """Load all objects from pickle file and return as dict. The dict returned will have keys named the same as the JSSObject classes contained, and the values will be JSSObjectLists of all full objects of that class (for example, the equivalent of my_jss...
['def', 'from_pickle', '(', 'cls', ',', 'path', ')', ':', 'with', 'open', '(', 'os', '.', 'path', '.', 'expanduser', '(', 'path', ')', ',', '"rb"', ')', 'as', 'pickle', ':', 'return', 'cPickle', '.', 'Unpickler', '(', 'pickle', ')', '.', 'load', '(', ')']
Load all objects from pickle file and return as dict. The dict returned will have keys named the same as the JSSObject classes contained, and the values will be JSSObjectLists of all full objects of that class (for example, the equivalent of my_jss.Computer().retrieve_all()). T...
['Load', 'all', 'objects', 'from', 'pickle', 'file', 'and', 'return', 'as', 'dict', '.']
train
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jamf_software_server.py#L393-L413
6,971
rodluger/everest
everest/missions/k2/pipelines.py
plot
def plot(ID, pipeline='everest2', show=True, campaign=None): ''' Plots the de-trended flux for the given EPIC `ID` and for the specified `pipeline`. ''' # Get the data time, flux = get(ID, pipeline=pipeline, campaign=campaign) # Remove nans mask = np.where(np.isnan(flux))[0] time ...
python
def plot(ID, pipeline='everest2', show=True, campaign=None): ''' Plots the de-trended flux for the given EPIC `ID` and for the specified `pipeline`. ''' # Get the data time, flux = get(ID, pipeline=pipeline, campaign=campaign) # Remove nans mask = np.where(np.isnan(flux))[0] time ...
['def', 'plot', '(', 'ID', ',', 'pipeline', '=', "'everest2'", ',', 'show', '=', 'True', ',', 'campaign', '=', 'None', ')', ':', '# Get the data', 'time', ',', 'flux', '=', 'get', '(', 'ID', ',', 'pipeline', '=', 'pipeline', ',', 'campaign', '=', 'campaign', ')', '# Remove nans', 'mask', '=', 'np', '.', 'where', '(', '...
Plots the de-trended flux for the given EPIC `ID` and for the specified `pipeline`.
['Plots', 'the', 'de', '-', 'trended', 'flux', 'for', 'the', 'given', 'EPIC', 'ID', 'and', 'for', 'the', 'specified', 'pipeline', '.']
train
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/pipelines.py#L91-L134
6,972
Neurosim-lab/netpyne
doc/source/code/HHCellFile.py
Cell.createNetcon
def createNetcon(self, thresh=10): """ created netcon to record spikes """ nc = h.NetCon(self.soma(0.5)._ref_v, None, sec = self.soma) nc.threshold = thresh return nc
python
def createNetcon(self, thresh=10): """ created netcon to record spikes """ nc = h.NetCon(self.soma(0.5)._ref_v, None, sec = self.soma) nc.threshold = thresh return nc
['def', 'createNetcon', '(', 'self', ',', 'thresh', '=', '10', ')', ':', 'nc', '=', 'h', '.', 'NetCon', '(', 'self', '.', 'soma', '(', '0.5', ')', '.', '_ref_v', ',', 'None', ',', 'sec', '=', 'self', '.', 'soma', ')', 'nc', '.', 'threshold', '=', 'thresh', 'return', 'nc']
created netcon to record spikes
['created', 'netcon', 'to', 'record', 'spikes']
train
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/doc/source/code/HHCellFile.py#L42-L46
6,973
jpscaletti/solution
solution/fields/select.py
MultiSelect._clean_data
def _clean_data(self, str_value, file_data, obj_value): """This overwrite is neccesary for work with multivalues""" str_value = str_value or None obj_value = obj_value or None return (str_value, None, obj_value)
python
def _clean_data(self, str_value, file_data, obj_value): """This overwrite is neccesary for work with multivalues""" str_value = str_value or None obj_value = obj_value or None return (str_value, None, obj_value)
['def', '_clean_data', '(', 'self', ',', 'str_value', ',', 'file_data', ',', 'obj_value', ')', ':', 'str_value', '=', 'str_value', 'or', 'None', 'obj_value', '=', 'obj_value', 'or', 'None', 'return', '(', 'str_value', ',', 'None', ',', 'obj_value', ')']
This overwrite is neccesary for work with multivalues
['This', 'overwrite', 'is', 'neccesary', 'for', 'work', 'with', 'multivalues']
train
https://github.com/jpscaletti/solution/blob/eabafd8e695bbb0209242e002dbcc05ffb327f43/solution/fields/select.py#L286-L290
6,974
clalancette/pycdlib
pycdlib/udf.py
UDFTimestamp.parse
def parse(self, data): # type: (bytes) -> None ''' Parse the passed in data into a UDF Timestamp. Parameters: data - The data to parse. Returns: Nothing. ''' if self._initialized: raise pycdlibexception.PyCdlibInternalError('UDF Time...
python
def parse(self, data): # type: (bytes) -> None ''' Parse the passed in data into a UDF Timestamp. Parameters: data - The data to parse. Returns: Nothing. ''' if self._initialized: raise pycdlibexception.PyCdlibInternalError('UDF Time...
['def', 'parse', '(', 'self', ',', 'data', ')', ':', '# type: (bytes) -> None', 'if', 'self', '.', '_initialized', ':', 'raise', 'pycdlibexception', '.', 'PyCdlibInternalError', '(', "'UDF Timestamp already initialized'", ')', '(', 'tz', ',', 'timetype', ',', 'self', '.', 'year', ',', 'self', '.', 'month', ',', 'self',...
Parse the passed in data into a UDF Timestamp. Parameters: data - The data to parse. Returns: Nothing.
['Parse', 'the', 'passed', 'in', 'data', 'into', 'a', 'UDF', 'Timestamp', '.']
train
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/udf.py#L763-L808
6,975
romaryd/python-jsonrepo
jsonrepo/record.py
namedtuple_asdict
def namedtuple_asdict(obj): """ Serializing a nested namedtuple into a Python dict """ if obj is None: return obj if hasattr(obj, "_asdict"): # detect namedtuple return OrderedDict(zip(obj._fields, (namedtuple_asdict(item) for item in obj...
python
def namedtuple_asdict(obj): """ Serializing a nested namedtuple into a Python dict """ if obj is None: return obj if hasattr(obj, "_asdict"): # detect namedtuple return OrderedDict(zip(obj._fields, (namedtuple_asdict(item) for item in obj...
['def', 'namedtuple_asdict', '(', 'obj', ')', ':', 'if', 'obj', 'is', 'None', ':', 'return', 'obj', 'if', 'hasattr', '(', 'obj', ',', '"_asdict"', ')', ':', '# detect namedtuple', 'return', 'OrderedDict', '(', 'zip', '(', 'obj', '.', '_fields', ',', '(', 'namedtuple_asdict', '(', 'item', ')', 'for', 'item', 'in', 'obj'...
Serializing a nested namedtuple into a Python dict
['Serializing', 'a', 'nested', 'namedtuple', 'into', 'a', 'Python', 'dict']
train
https://github.com/romaryd/python-jsonrepo/blob/08a9c039a5bd21e93e9a6d1bce77d43e6e10b57d/jsonrepo/record.py#L11-L28
6,976
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Parser.py
AdvancedHTMLParser.handle_data
def handle_data(self, data): ''' Internal for parsing ''' if data: inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText(data) elif data.strip(): #and not self.getRoot(): # Must be text prior to or after root n...
python
def handle_data(self, data): ''' Internal for parsing ''' if data: inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText(data) elif data.strip(): #and not self.getRoot(): # Must be text prior to or after root n...
['def', 'handle_data', '(', 'self', ',', 'data', ')', ':', 'if', 'data', ':', 'inTag', '=', 'self', '.', '_inTag', 'if', 'len', '(', 'inTag', ')', '>', '0', ':', 'inTag', '[', '-', '1', ']', '.', 'appendText', '(', 'data', ')', 'elif', 'data', '.', 'strip', '(', ')', ':', '#and not self.getRoot():', '# Must be text pri...
Internal for parsing
['Internal', 'for', 'parsing']
train
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L176-L186
6,977
rochacbruno/dynaconf
dynaconf/utils/__init__.py
object_merge
def object_merge(old, new, unique=False): """ Recursively merge two data structures. :param unique: When set to True existing list items are not set. """ if isinstance(old, list) and isinstance(new, list): if old == new: return for item in old[::-1]: if uniqu...
python
def object_merge(old, new, unique=False): """ Recursively merge two data structures. :param unique: When set to True existing list items are not set. """ if isinstance(old, list) and isinstance(new, list): if old == new: return for item in old[::-1]: if uniqu...
['def', 'object_merge', '(', 'old', ',', 'new', ',', 'unique', '=', 'False', ')', ':', 'if', 'isinstance', '(', 'old', ',', 'list', ')', 'and', 'isinstance', '(', 'new', ',', 'list', ')', ':', 'if', 'old', '==', 'new', ':', 'return', 'for', 'item', 'in', 'old', '[', ':', ':', '-', '1', ']', ':', 'if', 'unique', 'and', ...
Recursively merge two data structures. :param unique: When set to True existing list items are not set.
['Recursively', 'merge', 'two', 'data', 'structures', '.']
train
https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/utils/__init__.py#L20-L38
6,978
qiniu/python-sdk
qiniu/services/storage/bucket.py
BucketManager.move
def move(self, bucket, key, bucket_to, key_to, force='false'): """移动文件: 将资源从一个空间到另一个空间,具体规格参考: http://developer.qiniu.com/docs/v6/api/reference/rs/move.html Args: bucket: 待操作资源所在空间 bucket_to: 目标资源空间名 key: 待操作资源文件名 key_to: ...
python
def move(self, bucket, key, bucket_to, key_to, force='false'): """移动文件: 将资源从一个空间到另一个空间,具体规格参考: http://developer.qiniu.com/docs/v6/api/reference/rs/move.html Args: bucket: 待操作资源所在空间 bucket_to: 目标资源空间名 key: 待操作资源文件名 key_to: ...
['def', 'move', '(', 'self', ',', 'bucket', ',', 'key', ',', 'bucket_to', ',', 'key_to', ',', 'force', '=', "'false'", ')', ':', 'resource', '=', 'entry', '(', 'bucket', ',', 'key', ')', 'to', '=', 'entry', '(', 'bucket_to', ',', 'key_to', ')', 'return', 'self', '.', '__rs_do', '(', "'move'", ',', 'resource', ',', 'to'...
移动文件: 将资源从一个空间到另一个空间,具体规格参考: http://developer.qiniu.com/docs/v6/api/reference/rs/move.html Args: bucket: 待操作资源所在空间 bucket_to: 目标资源空间名 key: 待操作资源文件名 key_to: 目标资源文件名 Returns: 一个dict变量,成功返回NULL,失败返回{"error": "<er...
['移动文件', ':']
train
https://github.com/qiniu/python-sdk/blob/a69fbef4e3e6ea1ebe09f4610a5b18bb2c17de59/qiniu/services/storage/bucket.py#L124-L142
6,979
mapbox/mapboxgl-jupyter
mapboxgl/viz.py
VectorMixin.generate_vector_color_map
def generate_vector_color_map(self): """Generate color stops array for use with match expression in mapbox template""" vector_stops = [] # if join data specified as filename or URL, parse JSON to list of Python dicts if type(self.data) == str: self.data = geojson_to_dict_lis...
python
def generate_vector_color_map(self): """Generate color stops array for use with match expression in mapbox template""" vector_stops = [] # if join data specified as filename or URL, parse JSON to list of Python dicts if type(self.data) == str: self.data = geojson_to_dict_lis...
['def', 'generate_vector_color_map', '(', 'self', ')', ':', 'vector_stops', '=', '[', ']', '# if join data specified as filename or URL, parse JSON to list of Python dicts', 'if', 'type', '(', 'self', '.', 'data', ')', '==', 'str', ':', 'self', '.', 'data', '=', 'geojson_to_dict_list', '(', 'self', '.', 'data', ')', '#...
Generate color stops array for use with match expression in mapbox template
['Generate', 'color', 'stops', 'array', 'for', 'use', 'with', 'match', 'expression', 'in', 'mapbox', 'template']
train
https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L20-L37
6,980
peergradeio/flask-mongo-profiler
flask_mongo_profiler/contrib/flask_admin/formatters/profiling.py
profiling_query_formatter
def profiling_query_formatter(view, context, query_document, name): """Format a ProfilingQuery entry for a ProfilingRequest detail field Parameters ---------- query_document : model.ProfilingQuery """ return Markup( ''.join( [ '<div class="pymongo-query row">...
python
def profiling_query_formatter(view, context, query_document, name): """Format a ProfilingQuery entry for a ProfilingRequest detail field Parameters ---------- query_document : model.ProfilingQuery """ return Markup( ''.join( [ '<div class="pymongo-query row">...
['def', 'profiling_query_formatter', '(', 'view', ',', 'context', ',', 'query_document', ',', 'name', ')', ':', 'return', 'Markup', '(', "''", '.', 'join', '(', '[', '\'<div class="pymongo-query row">\'', ',', '\'<div class="col-md-1">\'', ',', '\'<a href="{}">\'', '.', 'format', '(', 'query_document', '.', 'get_admin_...
Format a ProfilingQuery entry for a ProfilingRequest detail field Parameters ---------- query_document : model.ProfilingQuery
['Format', 'a', 'ProfilingQuery', 'entry', 'for', 'a', 'ProfilingRequest', 'detail', 'field']
train
https://github.com/peergradeio/flask-mongo-profiler/blob/a267eeb49fea07c9a24fb370bd9d7a90ed313ccf/flask_mongo_profiler/contrib/flask_admin/formatters/profiling.py#L94-L127
6,981
StackStorm/pybind
pybind/slxos/v17s_1_02/__init__.py
brocade_pw_profile._set_pw_profile
def _set_pw_profile(self, v, load=False): """ Setter method for pw_profile, mapped from YANG variable /pw_profile (list) If this variable is read-only (config: false) in the source YANG file, then _set_pw_profile is considered as a private method. Backends looking to populate this variable should ...
python
def _set_pw_profile(self, v, load=False): """ Setter method for pw_profile, mapped from YANG variable /pw_profile (list) If this variable is read-only (config: false) in the source YANG file, then _set_pw_profile is considered as a private method. Backends looking to populate this variable should ...
['def', '_set_pw_profile', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'YANGListType', '(', '"pw_profile_name"', ',', 'pw_profile', '.', 'p...
Setter method for pw_profile, mapped from YANG variable /pw_profile (list) If this variable is read-only (config: false) in the source YANG file, then _set_pw_profile is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_pw_profile() directly...
['Setter', 'method', 'for', 'pw_profile', 'mapped', 'from', 'YANG', 'variable', '/', 'pw_profile', '(', 'list', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_pw_profile', 'is', 'considered', 'as', 'a', 'private', 'method'...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/__init__.py#L11394-L11415
6,982
rigetti/quantumflow
quantumflow/backend/numpybk.py
inner
def inner(tensor0: BKTensor, tensor1: BKTensor) -> BKTensor: """Return the inner product between two tensors""" # Note: Relying on fact that vdot flattens arrays return np.vdot(tensor0, tensor1)
python
def inner(tensor0: BKTensor, tensor1: BKTensor) -> BKTensor: """Return the inner product between two tensors""" # Note: Relying on fact that vdot flattens arrays return np.vdot(tensor0, tensor1)
['def', 'inner', '(', 'tensor0', ':', 'BKTensor', ',', 'tensor1', ':', 'BKTensor', ')', '->', 'BKTensor', ':', '# Note: Relying on fact that vdot flattens arrays', 'return', 'np', '.', 'vdot', '(', 'tensor0', ',', 'tensor1', ')']
Return the inner product between two tensors
['Return', 'the', 'inner', 'product', 'between', 'two', 'tensors']
train
https://github.com/rigetti/quantumflow/blob/13a66cabbe8aabf6e023cc675f4a4ebe6ccda8fb/quantumflow/backend/numpybk.py#L125-L128
6,983
SHTOOLS/SHTOOLS
pyshtools/utils/datetime.py
_yyyymmdd_to_year_fraction
def _yyyymmdd_to_year_fraction(date): """Convert YYYMMDD.DD date string or float to YYYY.YYY""" date = str(date) if '.' in date: date, residual = str(date).split('.') residual = float('0.' + residual) else: residual = 0.0 date = _datetime.datetime.strptime(date, '%Y%m%d') ...
python
def _yyyymmdd_to_year_fraction(date): """Convert YYYMMDD.DD date string or float to YYYY.YYY""" date = str(date) if '.' in date: date, residual = str(date).split('.') residual = float('0.' + residual) else: residual = 0.0 date = _datetime.datetime.strptime(date, '%Y%m%d') ...
['def', '_yyyymmdd_to_year_fraction', '(', 'date', ')', ':', 'date', '=', 'str', '(', 'date', ')', 'if', "'.'", 'in', 'date', ':', 'date', ',', 'residual', '=', 'str', '(', 'date', ')', '.', 'split', '(', "'.'", ')', 'residual', '=', 'float', '(', "'0.'", '+', 'residual', ')', 'else', ':', 'residual', '=', '0.0', 'date...
Convert YYYMMDD.DD date string or float to YYYY.YYY
['Convert', 'YYYMMDD', '.', 'DD', 'date', 'string', 'or', 'float', 'to', 'YYYY', '.', 'YYY']
train
https://github.com/SHTOOLS/SHTOOLS/blob/9a115cf83002df2ddec6b7f41aeb6be688e285de/pyshtools/utils/datetime.py#L11-L31
6,984
bachya/py17track
py17track/client.py
Client._request
async def _request( self, method: str, url: str, *, headers: dict = None, params: dict = None, json: dict = None) -> dict: """Make a request against the RainMachine device.""" if not headers: headers = {} ...
python
async def _request( self, method: str, url: str, *, headers: dict = None, params: dict = None, json: dict = None) -> dict: """Make a request against the RainMachine device.""" if not headers: headers = {} ...
['async', 'def', '_request', '(', 'self', ',', 'method', ':', 'str', ',', 'url', ':', 'str', ',', '*', ',', 'headers', ':', 'dict', '=', 'None', ',', 'params', ':', 'dict', '=', 'None', ',', 'json', ':', 'dict', '=', 'None', ')', '->', 'dict', ':', 'if', 'not', 'headers', ':', 'headers', '=', '{', '}', 'try', ':', 'asy...
Make a request against the RainMachine device.
['Make', 'a', 'request', 'against', 'the', 'RainMachine', 'device', '.']
train
https://github.com/bachya/py17track/blob/e6e64f2a79571433df7ee702cb4ebc4127b7ad6d/py17track/client.py#L22-L43
6,985
PGower/PyCanvas
pycanvas/apis/assignment_groups.py
AssignmentGroupsAPI.create_assignment_group
def create_assignment_group(self, course_id, group_weight=None, integration_data=None, name=None, position=None, rules=None, sis_source_id=None): """ Create an Assignment Group. Create a new assignment group for this course. """ path = {} data = {} params...
python
def create_assignment_group(self, course_id, group_weight=None, integration_data=None, name=None, position=None, rules=None, sis_source_id=None): """ Create an Assignment Group. Create a new assignment group for this course. """ path = {} data = {} params...
['def', 'create_assignment_group', '(', 'self', ',', 'course_id', ',', 'group_weight', '=', 'None', ',', 'integration_data', '=', 'None', ',', 'name', '=', 'None', ',', 'position', '=', 'None', ',', 'rules', '=', 'None', ',', 'sis_source_id', '=', 'None', ')', ':', 'path', '=', '{', '}', 'data', '=', '{', '}', 'params'...
Create an Assignment Group. Create a new assignment group for this course.
['Create', 'an', 'Assignment', 'Group', '.', 'Create', 'a', 'new', 'assignment', 'group', 'for', 'this', 'course', '.']
train
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/assignment_groups.py#L112-L158
6,986
bwohlberg/sporco
sporco/admm/cbpdn.py
GenericConvBPDN.ystep
def ystep(self): r"""Minimise Augmented Lagrangian with respect to :math:`\mathbf{y}`. If this method is not overridden, the problem is solved without any regularisation other than the option enforcement of non-negativity of the solution and filter boundary crossing supression. W...
python
def ystep(self): r"""Minimise Augmented Lagrangian with respect to :math:`\mathbf{y}`. If this method is not overridden, the problem is solved without any regularisation other than the option enforcement of non-negativity of the solution and filter boundary crossing supression. W...
['def', 'ystep', '(', 'self', ')', ':', 'if', 'self', '.', 'opt', '[', "'NonNegCoef'", ']', ':', 'self', '.', 'Y', '[', 'self', '.', 'Y', '<', '0.0', ']', '=', '0.0', 'if', 'self', '.', 'opt', '[', "'NoBndryCross'", ']', ':', 'for', 'n', 'in', 'range', '(', '0', ',', 'self', '.', 'cri', '.', 'dimN', ')', ':', 'self', '...
r"""Minimise Augmented Lagrangian with respect to :math:`\mathbf{y}`. If this method is not overridden, the problem is solved without any regularisation other than the option enforcement of non-negativity of the solution and filter boundary crossing supression. When it is overridden, it ...
['r', 'Minimise', 'Augmented', 'Lagrangian', 'with', 'respect', 'to', ':', 'math', ':', '\\', 'mathbf', '{', 'y', '}', '.', 'If', 'this', 'method', 'is', 'not', 'overridden', 'the', 'problem', 'is', 'solved', 'without', 'any', 'regularisation', 'other', 'than', 'the', 'option', 'enforcement', 'of', 'non', '-', 'negativ...
train
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/cbpdn.py#L287-L301
6,987
Cognexa/cxflow
cxflow/cli/eval.py
predict
def predict(config_path: str, restore_from: Optional[str], cl_arguments: Iterable[str], output_root: str) -> None: """ Run prediction from the specified config path. If the config contains a ``predict`` section: - override hooks with ``predict.hooks`` if present - update dataset, model and ...
python
def predict(config_path: str, restore_from: Optional[str], cl_arguments: Iterable[str], output_root: str) -> None: """ Run prediction from the specified config path. If the config contains a ``predict`` section: - override hooks with ``predict.hooks`` if present - update dataset, model and ...
['def', 'predict', '(', 'config_path', ':', 'str', ',', 'restore_from', ':', 'Optional', '[', 'str', ']', ',', 'cl_arguments', ':', 'Iterable', '[', 'str', ']', ',', 'output_root', ':', 'str', ')', '->', 'None', ':', 'config', '=', 'None', 'try', ':', 'config_path', '=', 'find_config', '(', 'config_path', ')', 'restore...
Run prediction from the specified config path. If the config contains a ``predict`` section: - override hooks with ``predict.hooks`` if present - update dataset, model and main loop sections if the respective sections are present :param config_path: path to the config file or the directory in ...
['Run', 'prediction', 'from', 'the', 'specified', 'config', 'path', '.']
train
https://github.com/Cognexa/cxflow/blob/dd609e6b0bd854424a8f86781dd77801a13038f9/cxflow/cli/eval.py#L60-L99
6,988
tanghaibao/jcvi
jcvi/assembly/syntenypath.py
bed
def bed(args): """ %prog bed anchorsfile Convert ANCHORS file to BED format. """ from collections import defaultdict from jcvi.compara.synteny import AnchorFile, check_beds from jcvi.formats.bed import Bed from jcvi.formats.base import get_number p = OptionParser(bed.__doc__) p...
python
def bed(args): """ %prog bed anchorsfile Convert ANCHORS file to BED format. """ from collections import defaultdict from jcvi.compara.synteny import AnchorFile, check_beds from jcvi.formats.bed import Bed from jcvi.formats.base import get_number p = OptionParser(bed.__doc__) p...
['def', 'bed', '(', 'args', ')', ':', 'from', 'collections', 'import', 'defaultdict', 'from', 'jcvi', '.', 'compara', '.', 'synteny', 'import', 'AnchorFile', ',', 'check_beds', 'from', 'jcvi', '.', 'formats', '.', 'bed', 'import', 'Bed', 'from', 'jcvi', '.', 'formats', '.', 'base', 'import', 'get_number', 'p', '=', 'Op...
%prog bed anchorsfile Convert ANCHORS file to BED format.
['%prog', 'bed', 'anchorsfile']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/syntenypath.py#L128-L184
6,989
ssanderson/interface
interface/interface.py
InterfaceMeta._invalid_implementation
def _invalid_implementation(self, t, missing, mistyped, mismatched): """ Make a TypeError explaining why ``t`` doesn't implement our interface. """ assert missing or mistyped or mismatched, "Implementation wasn't invalid." message = "\nclass {C} failed to implement interface {I}...
python
def _invalid_implementation(self, t, missing, mistyped, mismatched): """ Make a TypeError explaining why ``t`` doesn't implement our interface. """ assert missing or mistyped or mismatched, "Implementation wasn't invalid." message = "\nclass {C} failed to implement interface {I}...
['def', '_invalid_implementation', '(', 'self', ',', 't', ',', 'missing', ',', 'mistyped', ',', 'mismatched', ')', ':', 'assert', 'missing', 'or', 'mistyped', 'or', 'mismatched', ',', '"Implementation wasn\'t invalid."', 'message', '=', '"\\nclass {C} failed to implement interface {I}:"', '.', 'format', '(', 'C', '=', ...
Make a TypeError explaining why ``t`` doesn't implement our interface.
['Make', 'a', 'TypeError', 'explaining', 'why', 't', 'doesn', 't', 'implement', 'our', 'interface', '.']
train
https://github.com/ssanderson/interface/blob/b1dabab8556848fd473e388e28399886321b6127/interface/interface.py#L189-L231
6,990
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_tracker.py
TrackerModule.mavlink_packet
def mavlink_packet(self, m): '''handle an incoming mavlink packet from the master vehicle. Relay it to the tracker if it is a GLOBAL_POSITION_INT''' if m.get_type() in ['GLOBAL_POSITION_INT', 'SCALED_PRESSURE']: connection = self.find_connection() if not connection: ...
python
def mavlink_packet(self, m): '''handle an incoming mavlink packet from the master vehicle. Relay it to the tracker if it is a GLOBAL_POSITION_INT''' if m.get_type() in ['GLOBAL_POSITION_INT', 'SCALED_PRESSURE']: connection = self.find_connection() if not connection: ...
['def', 'mavlink_packet', '(', 'self', ',', 'm', ')', ':', 'if', 'm', '.', 'get_type', '(', ')', 'in', '[', "'GLOBAL_POSITION_INT'", ',', "'SCALED_PRESSURE'", ']', ':', 'connection', '=', 'self', '.', 'find_connection', '(', ')', 'if', 'not', 'connection', ':', 'return', 'if', 'm', '.', 'get_srcSystem', '(', ')', '!=',...
handle an incoming mavlink packet from the master vehicle. Relay it to the tracker if it is a GLOBAL_POSITION_INT
['handle', 'an', 'incoming', 'mavlink', 'packet', 'from', 'the', 'master', 'vehicle', '.', 'Relay', 'it', 'to', 'the', 'tracker', 'if', 'it', 'is', 'a', 'GLOBAL_POSITION_INT']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_tracker.py#L131-L139
6,991
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_reminders
def get_all_reminders(self, params=None): """ Get all reminders This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """ i...
python
def get_all_reminders(self, params=None): """ Get all reminders This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """ i...
['def', 'get_all_reminders', '(', 'self', ',', 'params', '=', 'None', ')', ':', 'if', 'not', 'params', ':', 'params', '=', '{', '}', 'return', 'self', '.', '_iterate_through_pages', '(', 'self', '.', 'get_reminders_per_page', ',', 'resource', '=', 'REMINDERS', ',', '*', '*', '{', "'params'", ':', 'params', '}', ')']
Get all reminders This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list
['Get', 'all', 'reminders', 'This', 'will', 'iterate', 'over', 'all', 'pages', 'until', 'it', 'gets', 'all', 'elements', '.', 'So', 'if', 'the', 'rate', 'limit', 'exceeded', 'it', 'will', 'throw', 'an', 'Exception', 'and', 'you', 'will', 'get', 'nothing']
train
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3250-L3261
6,992
tensorflow/tensorboard
tensorboard/plugins/graph/graphs_plugin.py
GraphsPlugin.info_impl
def info_impl(self): """Returns a dict of all runs and tags and their data availabilities.""" result = {} def add_row_item(run, tag=None): run_item = result.setdefault(run, { 'run': run, 'tags': {}, # A run-wide GraphDef of ops. 'run_graph': False}) tag_i...
python
def info_impl(self): """Returns a dict of all runs and tags and their data availabilities.""" result = {} def add_row_item(run, tag=None): run_item = result.setdefault(run, { 'run': run, 'tags': {}, # A run-wide GraphDef of ops. 'run_graph': False}) tag_i...
['def', 'info_impl', '(', 'self', ')', ':', 'result', '=', '{', '}', 'def', 'add_row_item', '(', 'run', ',', 'tag', '=', 'None', ')', ':', 'run_item', '=', 'result', '.', 'setdefault', '(', 'run', ',', '{', "'run'", ':', 'run', ',', "'tags'", ':', '{', '}', ',', '# A run-wide GraphDef of ops.', "'run_graph'", ':', 'Fal...
Returns a dict of all runs and tags and their data availabilities.
['Returns', 'a', 'dict', 'of', 'all', 'runs', 'and', 'tags', 'and', 'their', 'data', 'availabilities', '.']
train
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graphs_plugin.py#L74-L143
6,993
rootpy/rootpy
rootpy/stats/histfactory/utils.py
make_measurement
def make_measurement(name, channels, lumi=1.0, lumi_rel_error=0.1, output_prefix='./histfactory', POI=None, const_params=None, verbose=False): """ Create a Measurement from a list of Cha...
python
def make_measurement(name, channels, lumi=1.0, lumi_rel_error=0.1, output_prefix='./histfactory', POI=None, const_params=None, verbose=False): """ Create a Measurement from a list of Cha...
['def', 'make_measurement', '(', 'name', ',', 'channels', ',', 'lumi', '=', '1.0', ',', 'lumi_rel_error', '=', '0.1', ',', 'output_prefix', '=', "'./histfactory'", ',', 'POI', '=', 'None', ',', 'const_params', '=', 'None', ',', 'verbose', '=', 'False', ')', ':', 'if', 'verbose', ':', 'llog', '=', 'log', '[', "'make_mea...
Create a Measurement from a list of Channels
['Create', 'a', 'Measurement', 'from', 'a', 'list', 'of', 'Channels']
train
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/utils.py#L56-L104
6,994
joke2k/faker
faker/providers/internet/__init__.py
Provider.ipv4_private
def ipv4_private(self, network=False, address_class=None): """ Returns a private IPv4. :param network: Network address :param address_class: IPv4 address class (a, b, or c) :returns: Private IPv4 """ # compute private networks from given class supernet = ...
python
def ipv4_private(self, network=False, address_class=None): """ Returns a private IPv4. :param network: Network address :param address_class: IPv4 address class (a, b, or c) :returns: Private IPv4 """ # compute private networks from given class supernet = ...
['def', 'ipv4_private', '(', 'self', ',', 'network', '=', 'False', ',', 'address_class', '=', 'None', ')', ':', '# compute private networks from given class', 'supernet', '=', '_IPv4Constants', '.', '_network_classes', '[', 'address_class', 'or', 'self', '.', 'ipv4_network_class', '(', ')', ']', 'private_networks', '='...
Returns a private IPv4. :param network: Network address :param address_class: IPv4 address class (a, b, or c) :returns: Private IPv4
['Returns', 'a', 'private', 'IPv4', '.']
train
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/providers/internet/__init__.py#L363-L390
6,995
pr-omethe-us/PyKED
pyked/chemked.py
DataPoint.process_quantity
def process_quantity(self, properties): """Process the uncertainty information from a given quantity and return it """ quant = Q_(properties[0]) if len(properties) > 1: unc = properties[1] uncertainty = unc.get('uncertainty', False) upper_uncertainty =...
python
def process_quantity(self, properties): """Process the uncertainty information from a given quantity and return it """ quant = Q_(properties[0]) if len(properties) > 1: unc = properties[1] uncertainty = unc.get('uncertainty', False) upper_uncertainty =...
['def', 'process_quantity', '(', 'self', ',', 'properties', ')', ':', 'quant', '=', 'Q_', '(', 'properties', '[', '0', ']', ')', 'if', 'len', '(', 'properties', ')', '>', '1', ':', 'unc', '=', 'properties', '[', '1', ']', 'uncertainty', '=', 'unc', '.', 'get', '(', "'uncertainty'", ',', 'False', ')', 'upper_uncertainty...
Process the uncertainty information from a given quantity and return it
['Process', 'the', 'uncertainty', 'information', 'from', 'a', 'given', 'quantity', 'and', 'return', 'it']
train
https://github.com/pr-omethe-us/PyKED/blob/d9341a068c1099049a3f1de41c512591f342bf64/pyked/chemked.py#L722-L760
6,996
lawsie/guizero
guizero/event.py
EventManager.remove_event
def remove_event(self, ref): """ Removes an event for a ref (reference), """ # is this reference one which has been setup? if ref in self._refs: self._refs[ref].remove_callback(ref)
python
def remove_event(self, ref): """ Removes an event for a ref (reference), """ # is this reference one which has been setup? if ref in self._refs: self._refs[ref].remove_callback(ref)
['def', 'remove_event', '(', 'self', ',', 'ref', ')', ':', '# is this reference one which has been setup?', 'if', 'ref', 'in', 'self', '.', '_refs', ':', 'self', '.', '_refs', '[', 'ref', ']', '.', 'remove_callback', '(', 'ref', ')']
Removes an event for a ref (reference),
['Removes', 'an', 'event', 'for', 'a', 'ref', '(', 'reference', ')']
train
https://github.com/lawsie/guizero/blob/84c7f0b314fa86f9fc88eb11c9a0f6c4b57155e2/guizero/event.py#L192-L198
6,997
KelSolaar/Umbra
umbra/ui/models.py
GraphModel.vertical_headers
def vertical_headers(self, value): """ Setter for **self.__vertical_headers** attribute. :param value: Attribute value. :type value: OrderedDict """ if value is not None: assert type(value) is OrderedDict, "'{0}' attribute: '{1}' type is not 'OrderedDict'!"....
python
def vertical_headers(self, value): """ Setter for **self.__vertical_headers** attribute. :param value: Attribute value. :type value: OrderedDict """ if value is not None: assert type(value) is OrderedDict, "'{0}' attribute: '{1}' type is not 'OrderedDict'!"....
['def', 'vertical_headers', '(', 'self', ',', 'value', ')', ':', 'if', 'value', 'is', 'not', 'None', ':', 'assert', 'type', '(', 'value', ')', 'is', 'OrderedDict', ',', '"\'{0}\' attribute: \'{1}\' type is not \'OrderedDict\'!"', '.', 'format', '(', '"vertical_headers"', ',', 'value', ')', 'self', '.', '__vertical_head...
Setter for **self.__vertical_headers** attribute. :param value: Attribute value. :type value: OrderedDict
['Setter', 'for', '**', 'self', '.', '__vertical_headers', '**', 'attribute', '.']
train
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/ui/models.py#L208-L219
6,998
yyuu/botornado
boto/ec2/autoscale/group.py
AutoScalingGroup.get_activities
def get_activities(self, activity_ids=None, max_records=50): """ Get all activies for this group. """ return self.connection.get_all_activities(self, activity_ids, max_records)
python
def get_activities(self, activity_ids=None, max_records=50): """ Get all activies for this group. """ return self.connection.get_all_activities(self, activity_ids, max_records)
['def', 'get_activities', '(', 'self', ',', 'activity_ids', '=', 'None', ',', 'max_records', '=', '50', ')', ':', 'return', 'self', '.', 'connection', '.', 'get_all_activities', '(', 'self', ',', 'activity_ids', ',', 'max_records', ')']
Get all activies for this group.
['Get', 'all', 'activies', 'for', 'this', 'group', '.']
train
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/ec2/autoscale/group.py#L266-L271
6,999
dwavesystems/dimod
dimod/binary_quadratic_model.py
BinaryQuadraticModel.from_pandas_dataframe
def from_pandas_dataframe(cls, bqm_df, offset=0.0, interactions=None): """Create a binary quadratic model from a QUBO model formatted as a pandas DataFrame. Args: bqm_df (:class:`pandas.DataFrame`): Quadratic unconstrained binary optimization (QUBO) model formatted ...
python
def from_pandas_dataframe(cls, bqm_df, offset=0.0, interactions=None): """Create a binary quadratic model from a QUBO model formatted as a pandas DataFrame. Args: bqm_df (:class:`pandas.DataFrame`): Quadratic unconstrained binary optimization (QUBO) model formatted ...
['def', 'from_pandas_dataframe', '(', 'cls', ',', 'bqm_df', ',', 'offset', '=', '0.0', ',', 'interactions', '=', 'None', ')', ':', 'if', 'interactions', 'is', 'None', ':', 'interactions', '=', '[', ']', 'bqm', '=', 'cls', '(', '{', '}', ',', '{', '}', ',', 'offset', ',', 'Vartype', '.', 'BINARY', ')', 'for', 'u', ',', ...
Create a binary quadratic model from a QUBO model formatted as a pandas DataFrame. Args: bqm_df (:class:`pandas.DataFrame`): Quadratic unconstrained binary optimization (QUBO) model formatted as a pandas DataFrame. Row and column indices label the QUBO variables; ...
['Create', 'a', 'binary', 'quadratic', 'model', 'from', 'a', 'QUBO', 'model', 'formatted', 'as', 'a', 'pandas', 'DataFrame', '.']
train
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/binary_quadratic_model.py#L2456-L2514