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
7,200
skggm/skggm
inverse_covariance/inverse_covariance.py
_compute_error
def _compute_error(comp_cov, covariance_, precision_, score_metric="frobenius"): """Computes the covariance error vs. comp_cov. Parameters ---------- comp_cov : array-like, shape = (n_features, n_features) The precision to compare with. This should normally be the test sample covariance...
python
def _compute_error(comp_cov, covariance_, precision_, score_metric="frobenius"): """Computes the covariance error vs. comp_cov. Parameters ---------- comp_cov : array-like, shape = (n_features, n_features) The precision to compare with. This should normally be the test sample covariance...
['def', '_compute_error', '(', 'comp_cov', ',', 'covariance_', ',', 'precision_', ',', 'score_metric', '=', '"frobenius"', ')', ':', 'if', 'score_metric', '==', '"frobenius"', ':', 'return', 'np', '.', 'linalg', '.', 'norm', '(', 'np', '.', 'triu', '(', 'comp_cov', '-', 'covariance_', ',', '1', ')', ',', 'ord', '=', '"...
Computes the covariance error vs. comp_cov. Parameters ---------- comp_cov : array-like, shape = (n_features, n_features) The precision to compare with. This should normally be the test sample covariance/precision. scaling : bool If True, the squared error norm is divided by n_...
['Computes', 'the', 'covariance', 'error', 'vs', '.', 'comp_cov', '.']
train
https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/inverse_covariance.py#L31-L74
7,201
reflexsc/reflex
dev/build.py
Obj.add_info
def add_info(self, data): """add info to a build""" for key in data: # verboten if key in ('status','state','name','id','application','services','release'): raise ValueError("Sorry, cannot set build info with key of {}".format(key)) self.obj[key] = dat...
python
def add_info(self, data): """add info to a build""" for key in data: # verboten if key in ('status','state','name','id','application','services','release'): raise ValueError("Sorry, cannot set build info with key of {}".format(key)) self.obj[key] = dat...
['def', 'add_info', '(', 'self', ',', 'data', ')', ':', 'for', 'key', 'in', 'data', ':', '# verboten', 'if', 'key', 'in', '(', "'status'", ',', "'state'", ',', "'name'", ',', "'id'", ',', "'application'", ',', "'services'", ',', "'release'", ')', ':', 'raise', 'ValueError', '(', '"Sorry, cannot set build info with key ...
add info to a build
['add', 'info', 'to', 'a', 'build']
train
https://github.com/reflexsc/reflex/blob/cee6b0ccfef395ca5e157d644a2e3252cea9fe62/dev/build.py#L213-L221
7,202
autokey/autokey
lib/autokey/interface.py
XInterfaceBase.__ungrabHotkey
def __ungrabHotkey(self, key, modifiers, window): """ Ungrab a specific hotkey in the given window """ logger.debug("Ungrabbing hotkey: %r %r", modifiers, key) try: keycode = self.__lookupKeyCode(key) mask = 0 for mod in modifiers: ...
python
def __ungrabHotkey(self, key, modifiers, window): """ Ungrab a specific hotkey in the given window """ logger.debug("Ungrabbing hotkey: %r %r", modifiers, key) try: keycode = self.__lookupKeyCode(key) mask = 0 for mod in modifiers: ...
['def', '__ungrabHotkey', '(', 'self', ',', 'key', ',', 'modifiers', ',', 'window', ')', ':', 'logger', '.', 'debug', '(', '"Ungrabbing hotkey: %r %r"', ',', 'modifiers', ',', 'key', ')', 'try', ':', 'keycode', '=', 'self', '.', '__lookupKeyCode', '(', 'key', ')', 'mask', '=', '0', 'for', 'mod', 'in', 'modifiers', ':',...
Ungrab a specific hotkey in the given window
['Ungrab', 'a', 'specific', 'hotkey', 'in', 'the', 'given', 'window']
train
https://github.com/autokey/autokey/blob/35decb72f286ce68cd2a1f09ace8891a520b58d1/lib/autokey/interface.py#L550-L572
7,203
ltworf/typedload
typedload/dataloader.py
_namedtupleload
def _namedtupleload(l: Loader, value: Dict[str, Any], type_) -> Tuple: """ This loads a Dict[str, Any] into a NamedTuple. """ if not hasattr(type_, '__dataclass_fields__'): fields = set(type_._fields) optional_fields = set(getattr(type_, '_field_defaults', {}).keys()) type_hints ...
python
def _namedtupleload(l: Loader, value: Dict[str, Any], type_) -> Tuple: """ This loads a Dict[str, Any] into a NamedTuple. """ if not hasattr(type_, '__dataclass_fields__'): fields = set(type_._fields) optional_fields = set(getattr(type_, '_field_defaults', {}).keys()) type_hints ...
['def', '_namedtupleload', '(', 'l', ':', 'Loader', ',', 'value', ':', 'Dict', '[', 'str', ',', 'Any', ']', ',', 'type_', ')', '->', 'Tuple', ':', 'if', 'not', 'hasattr', '(', 'type_', ',', "'__dataclass_fields__'", ')', ':', 'fields', '=', 'set', '(', 'type_', '.', '_fields', ')', 'optional_fields', '=', 'set', '(', '...
This loads a Dict[str, Any] into a NamedTuple.
['This', 'loads', 'a', 'Dict', '[', 'str', 'Any', ']', 'into', 'a', 'NamedTuple', '.']
train
https://github.com/ltworf/typedload/blob/7fd130612963bfcec3242698463ef863ca4af927/typedload/dataloader.py#L331-L398
7,204
StackStorm/pybind
pybind/slxos/v17s_1_02/routing_system/router/isis/router_isis_cmds_holder/router_isis_attributes/__init__.py
router_isis_attributes._set_fast_flood
def _set_fast_flood(self, v, load=False): """ Setter method for fast_flood, mapped from YANG variable /routing_system/router/isis/router_isis_cmds_holder/router_isis_attributes/fast_flood (container) If this variable is read-only (config: false) in the source YANG file, then _set_fast_flood is considere...
python
def _set_fast_flood(self, v, load=False): """ Setter method for fast_flood, mapped from YANG variable /routing_system/router/isis/router_isis_cmds_holder/router_isis_attributes/fast_flood (container) If this variable is read-only (config: false) in the source YANG file, then _set_fast_flood is considere...
['def', '_set_fast_flood', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'fast_flood', '.', 'fast_flood', ',', 'is_container', '=', "'contain...
Setter method for fast_flood, mapped from YANG variable /routing_system/router/isis/router_isis_cmds_holder/router_isis_attributes/fast_flood (container) If this variable is read-only (config: false) in the source YANG file, then _set_fast_flood is considered as a private method. Backends looking to populat...
['Setter', 'method', 'for', 'fast_flood', 'mapped', 'from', 'YANG', 'variable', '/', 'routing_system', '/', 'router', '/', 'isis', '/', 'router_isis_cmds_holder', '/', 'router_isis_attributes', '/', 'fast_flood', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/routing_system/router/isis/router_isis_cmds_holder/router_isis_attributes/__init__.py#L393-L414
7,205
Aluriak/ACCC
accc/compiler/compiler.py
Compiler._next_lexem
def _next_lexem(self, lexem_type, source_code, source_code_size): """Return next readable lexem of given type in source_code. If no value can be found, the neutral_value will be used""" # define reader as a lexem extractor def reader(seq, block_size): identificator = '' ...
python
def _next_lexem(self, lexem_type, source_code, source_code_size): """Return next readable lexem of given type in source_code. If no value can be found, the neutral_value will be used""" # define reader as a lexem extractor def reader(seq, block_size): identificator = '' ...
['def', '_next_lexem', '(', 'self', ',', 'lexem_type', ',', 'source_code', ',', 'source_code_size', ')', ':', '# define reader as a lexem extractor', 'def', 'reader', '(', 'seq', ',', 'block_size', ')', ':', 'identificator', '=', "''", 'for', 'char', 'in', 'source_code', ':', 'if', 'len', '(', 'identificator', ')', '==...
Return next readable lexem of given type in source_code. If no value can be found, the neutral_value will be used
['Return', 'next', 'readable', 'lexem', 'of', 'given', 'type', 'in', 'source_code', '.', 'If', 'no', 'value', 'can', 'be', 'found', 'the', 'neutral_value', 'will', 'be', 'used']
train
https://github.com/Aluriak/ACCC/blob/9092f985bef7ed784264c86bc19c980f4ce2309f/accc/compiler/compiler.py#L160-L178
7,206
RedHatInsights/insights-core
insights/core/spec_factory.py
CommandOutputProvider._stream
def _stream(self): """ Returns a generator of lines instead of a list of lines. """ if self._exception: raise self._exception try: if self._content: yield self._content else: args = self.create_args() ...
python
def _stream(self): """ Returns a generator of lines instead of a list of lines. """ if self._exception: raise self._exception try: if self._content: yield self._content else: args = self.create_args() ...
['def', '_stream', '(', 'self', ')', ':', 'if', 'self', '.', '_exception', ':', 'raise', 'self', '.', '_exception', 'try', ':', 'if', 'self', '.', '_content', ':', 'yield', 'self', '.', '_content', 'else', ':', 'args', '=', 'self', '.', 'create_args', '(', ')', 'with', 'self', '.', 'ctx', '.', 'connect', '(', '*', 'arg...
Returns a generator of lines instead of a list of lines.
['Returns', 'a', 'generator', 'of', 'lines', 'instead', 'of', 'a', 'list', 'of', 'lines', '.']
train
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/core/spec_factory.py#L358-L375
7,207
mdiener/grace
grace/py27/slimit/visitors/scopevisitor.py
mangle_scope_tree
def mangle_scope_tree(root, toplevel): """Walk over a scope tree and mangle symbol names. Args: toplevel: Defines if global scope should be mangled or not. """ def mangle(scope): # don't mangle global scope if not specified otherwise if scope.get_enclosing_scope() is None and no...
python
def mangle_scope_tree(root, toplevel): """Walk over a scope tree and mangle symbol names. Args: toplevel: Defines if global scope should be mangled or not. """ def mangle(scope): # don't mangle global scope if not specified otherwise if scope.get_enclosing_scope() is None and no...
['def', 'mangle_scope_tree', '(', 'root', ',', 'toplevel', ')', ':', 'def', 'mangle', '(', 'scope', ')', ':', "# don't mangle global scope if not specified otherwise", 'if', 'scope', '.', 'get_enclosing_scope', '(', ')', 'is', 'None', 'and', 'not', 'toplevel', ':', 'return', 'for', 'name', 'in', 'scope', '.', 'symbols'...
Walk over a scope tree and mangle symbol names. Args: toplevel: Defines if global scope should be mangled or not.
['Walk', 'over', 'a', 'scope', 'tree', 'and', 'mangle', 'symbol', 'names', '.']
train
https://github.com/mdiener/grace/blob/2dab13a2cf636da5da989904c5885166fc94d36d/grace/py27/slimit/visitors/scopevisitor.py#L141-L161
7,208
Alignak-monitoring/alignak
alignak/objects/notificationway.py
NotificationWay.want_service_notification
def want_service_notification(self, timeperiods, timestamp, state, n_type, business_impact, cmd=None): # pylint: disable=too-many-return-statements """Check if notification options match the state of the service Notification is NOT wanted in ONE of the following...
python
def want_service_notification(self, timeperiods, timestamp, state, n_type, business_impact, cmd=None): # pylint: disable=too-many-return-statements """Check if notification options match the state of the service Notification is NOT wanted in ONE of the following...
['def', 'want_service_notification', '(', 'self', ',', 'timeperiods', ',', 'timestamp', ',', 'state', ',', 'n_type', ',', 'business_impact', ',', 'cmd', '=', 'None', ')', ':', '# pylint: disable=too-many-return-statements', 'if', 'not', 'self', '.', 'service_notifications_enabled', ':', 'return', 'False', '# Maybe the ...
Check if notification options match the state of the service Notification is NOT wanted in ONE of the following case:: * service notifications are disabled * cmd is not in service_notification_commands * business_impact < self.min_business_impact * service_notification_period is...
['Check', 'if', 'notification', 'options', 'match', 'the', 'state', 'of', 'the', 'service', 'Notification', 'is', 'NOT', 'wanted', 'in', 'ONE', 'of', 'the', 'following', 'case', '::']
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/notificationway.py#L144-L206
7,209
cdeboever3/cdpybio
cdpybio/analysis.py
parse_grasp_gwas
def parse_grasp_gwas(fn): """ Read GRASP database and filter for unique hits. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of ...
python
def parse_grasp_gwas(fn): """ Read GRASP database and filter for unique hits. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of ...
['def', 'parse_grasp_gwas', '(', 'fn', ')', ':', 'df', '=', 'pd', '.', 'read_table', '(', 'fn', ',', 'low_memory', '=', 'False', ')', 'df', '=', 'df', '[', 'df', '.', 'Pvalue', '<', '1e-5', ']', 'df', '=', 'df', '.', 'sort', '(', 'columns', '=', '[', "'chr(hg19)'", ',', "'pos(hg19)'", ',', "'Pvalue'", ']', ')', 'df', '...
Read GRASP database and filter for unique hits. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of the form chrom:pos where pos is the on...
['Read', 'GRASP', 'database', 'and', 'filter', 'for', 'unique', 'hits', '.', 'Parameters', '----------', 'fn', ':', 'str', 'Path', 'to', '(', 'subset', 'of', ')', 'GRASP', 'database', '.', 'Returns', '-------', 'df', ':', 'pandas', '.', 'DataFrame', 'Pandas', 'dataframe', 'with', 'de', '-', 'duplicated', 'significant',...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L151-L181
7,210
dw/mitogen
mitogen/core.py
Poller.stop_transmit
def stop_transmit(self, fd): """ Stop yielding writeability events for `fd`. Redundant calls to :meth:`stop_transmit` are silently ignored, this may change in future. """ self._wfds.pop(fd, None) self._update(fd)
python
def stop_transmit(self, fd): """ Stop yielding writeability events for `fd`. Redundant calls to :meth:`stop_transmit` are silently ignored, this may change in future. """ self._wfds.pop(fd, None) self._update(fd)
['def', 'stop_transmit', '(', 'self', ',', 'fd', ')', ':', 'self', '.', '_wfds', '.', 'pop', '(', 'fd', ',', 'None', ')', 'self', '.', '_update', '(', 'fd', ')']
Stop yielding writeability events for `fd`. Redundant calls to :meth:`stop_transmit` are silently ignored, this may change in future.
['Stop', 'yielding', 'writeability', 'events', 'for', 'fd', '.']
train
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/mitogen/core.py#L1999-L2007
7,211
twisted/txaws
txaws/s3/client.py
S3Client.init_multipart_upload
def init_multipart_upload(self, bucket, object_name, content_type=None, amz_headers={}, metadata={}): """ Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Con...
python
def init_multipart_upload(self, bucket, object_name, content_type=None, amz_headers={}, metadata={}): """ Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Con...
['def', 'init_multipart_upload', '(', 'self', ',', 'bucket', ',', 'object_name', ',', 'content_type', '=', 'None', ',', 'amz_headers', '=', '{', '}', ',', 'metadata', '=', '{', '}', ')', ':', 'objectname_plus', '=', "'%s?uploads'", '%', 'object_name', 'details', '=', 'self', '.', '_details', '(', 'method', '=', 'b"POST...
Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Content-Type for the object @param metadata: C{dict} containing additional metadata @param amz_headers: A C{dict} used to build C{x-amz-*} ...
['Initiate', 'a', 'multipart', 'upload', 'to', 'a', 'bucket', '.']
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L589-L613
7,212
luismasuelli/python-cantrips
cantrips/patterns/broadcast.py
IBroadcast.BROADCAST_FILTER_OR
def BROADCAST_FILTER_OR(*funcs): """ Composes the passed filters into an and-joined filter. """ return lambda u, command, *args, **kwargs: any(f(u, command, *args, **kwargs) for f in funcs)
python
def BROADCAST_FILTER_OR(*funcs): """ Composes the passed filters into an and-joined filter. """ return lambda u, command, *args, **kwargs: any(f(u, command, *args, **kwargs) for f in funcs)
['def', 'BROADCAST_FILTER_OR', '(', '*', 'funcs', ')', ':', 'return', 'lambda', 'u', ',', 'command', ',', '*', 'args', ',', '*', '*', 'kwargs', ':', 'any', '(', 'f', '(', 'u', ',', 'command', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', 'for', 'f', 'in', 'funcs', ')']
Composes the passed filters into an and-joined filter.
['Composes', 'the', 'passed', 'filters', 'into', 'an', 'and', '-', 'joined', 'filter', '.']
train
https://github.com/luismasuelli/python-cantrips/blob/dba2742c1d1a60863bb65f4a291464f6e68eb2ee/cantrips/patterns/broadcast.py#L75-L79
7,213
log2timeline/dfvfs
dfvfs/file_io/encoded_stream_io.py
EncodedStream._GetDecodedStreamSize
def _GetDecodedStreamSize(self): """Retrieves the decoded stream size. Returns: int: decoded stream size. """ self._file_object.seek(0, os.SEEK_SET) self._decoder = self._GetDecoder() self._decoded_data = b'' encoded_data_offset = 0 encoded_data_size = self._file_object.get_size...
python
def _GetDecodedStreamSize(self): """Retrieves the decoded stream size. Returns: int: decoded stream size. """ self._file_object.seek(0, os.SEEK_SET) self._decoder = self._GetDecoder() self._decoded_data = b'' encoded_data_offset = 0 encoded_data_size = self._file_object.get_size...
['def', '_GetDecodedStreamSize', '(', 'self', ')', ':', 'self', '.', '_file_object', '.', 'seek', '(', '0', ',', 'os', '.', 'SEEK_SET', ')', 'self', '.', '_decoder', '=', 'self', '.', '_GetDecoder', '(', ')', 'self', '.', '_decoded_data', '=', "b''", 'encoded_data_offset', '=', '0', 'encoded_data_size', '=', 'self', '....
Retrieves the decoded stream size. Returns: int: decoded stream size.
['Retrieves', 'the', 'decoded', 'stream', 'size', '.']
train
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/file_io/encoded_stream_io.py#L75-L98
7,214
HPCC-Cloud-Computing/CAL
calplus/v1/network/resources/network.py
NetworkController.get
def get(self, req, driver): """Get info of a network Get info of a specific netowrk with id on special cloud with: :Param req :Type object Request """ response = driver.get_network(req.params, id) data = { 'action': "get", 'contr...
python
def get(self, req, driver): """Get info of a network Get info of a specific netowrk with id on special cloud with: :Param req :Type object Request """ response = driver.get_network(req.params, id) data = { 'action': "get", 'contr...
['def', 'get', '(', 'self', ',', 'req', ',', 'driver', ')', ':', 'response', '=', 'driver', '.', 'get_network', '(', 'req', '.', 'params', ',', 'id', ')', 'data', '=', '{', "'action'", ':', '"get"', ',', "'controller'", ':', '"network"', ',', "'id'", ':', 'id', ',', "'cloud'", ':', 'req', '.', 'environ', '[', "'calplus...
Get info of a network Get info of a specific netowrk with id on special cloud with: :Param req :Type object Request
['Get', 'info', 'of', 'a', 'network', 'Get', 'info', 'of', 'a', 'specific', 'netowrk', 'with', 'id', 'on', 'special', 'cloud', 'with', ':', ':', 'Param', 'req', ':', 'Type', 'object', 'Request']
train
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/network/resources/network.py#L85-L100
7,215
yyuu/botornado
boto/ec2/autoscale/__init__.py
AutoScaleConnection.create_launch_configuration
def create_launch_configuration(self, launch_config): """ Creates a new Launch Configuration. :type launch_config: :class:`boto.ec2.autoscale.launchconfig.LaunchConfiguration` :param launch_config: LaunchConfiguration object. """ params = {'ImageId': launch_config.image_...
python
def create_launch_configuration(self, launch_config): """ Creates a new Launch Configuration. :type launch_config: :class:`boto.ec2.autoscale.launchconfig.LaunchConfiguration` :param launch_config: LaunchConfiguration object. """ params = {'ImageId': launch_config.image_...
['def', 'create_launch_configuration', '(', 'self', ',', 'launch_config', ')', ':', 'params', '=', '{', "'ImageId'", ':', 'launch_config', '.', 'image_id', ',', "'LaunchConfigurationName'", ':', 'launch_config', '.', 'name', ',', "'InstanceType'", ':', 'launch_config', '.', 'instance_type', '}', 'if', 'launch_config', ...
Creates a new Launch Configuration. :type launch_config: :class:`boto.ec2.autoscale.launchconfig.LaunchConfiguration` :param launch_config: LaunchConfiguration object.
['Creates', 'a', 'new', 'Launch', 'Configuration', '.']
train
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/ec2/autoscale/__init__.py#L188-L215
7,216
Calysto/calysto
calysto/ai/conx.py
Network.actDerivASIG
def actDerivASIG(self, x): """ Only works on scalars. """ def act(v): if v < -15.0: return 0.0 elif v > 15.0: return 1.0 else: return 1.0 / (1.0 + Numeric.exp(-v)) return (act(x) * (1.0 - act(x))) + self.sigmoid_prime_offset
python
def actDerivASIG(self, x): """ Only works on scalars. """ def act(v): if v < -15.0: return 0.0 elif v > 15.0: return 1.0 else: return 1.0 / (1.0 + Numeric.exp(-v)) return (act(x) * (1.0 - act(x))) + self.sigmoid_prime_offset
['def', 'actDerivASIG', '(', 'self', ',', 'x', ')', ':', 'def', 'act', '(', 'v', ')', ':', 'if', 'v', '<', '-', '15.0', ':', 'return', '0.0', 'elif', 'v', '>', '15.0', ':', 'return', '1.0', 'else', ':', 'return', '1.0', '/', '(', '1.0', '+', 'Numeric', '.', 'exp', '(', '-', 'v', ')', ')', 'return', '(', 'act', '(', 'x'...
Only works on scalars.
['Only', 'works', 'on', 'scalars', '.']
train
https://github.com/Calysto/calysto/blob/20813c0f48096317aa775d03a5c6b20f12fafc93/calysto/ai/conx.py#L2143-L2151
7,217
qntm/greenery
greenery/fsm.py
fsm.islive
def islive(self, state): '''A state is "live" if a final state can be reached from it.''' reachable = [state] i = 0 while i < len(reachable): current = reachable[i] if current in self.finals: return True if current in self.map: for symbol in self.map[current]: next = self.map[current][symb...
python
def islive(self, state): '''A state is "live" if a final state can be reached from it.''' reachable = [state] i = 0 while i < len(reachable): current = reachable[i] if current in self.finals: return True if current in self.map: for symbol in self.map[current]: next = self.map[current][symb...
['def', 'islive', '(', 'self', ',', 'state', ')', ':', 'reachable', '=', '[', 'state', ']', 'i', '=', '0', 'while', 'i', '<', 'len', '(', 'reachable', ')', ':', 'current', '=', 'reachable', '[', 'i', ']', 'if', 'current', 'in', 'self', '.', 'finals', ':', 'return', 'True', 'if', 'current', 'in', 'self', '.', 'map', ':'...
A state is "live" if a final state can be reached from it.
['A', 'state', 'is', 'live', 'if', 'a', 'final', 'state', 'can', 'be', 'reached', 'from', 'it', '.']
train
https://github.com/qntm/greenery/blob/f4dc7fb483825459d26e8fe9f417764469c56ee8/greenery/fsm.py#L421-L435
7,218
keras-rl/keras-rl
rl/core.py
Agent.fit
def fit(self, env, nb_steps, action_repetition=1, callbacks=None, verbose=1, visualize=False, nb_max_start_steps=0, start_step_policy=None, log_interval=10000, nb_max_episode_steps=None): """Trains the agent on the given environment. # Arguments env: (`Env` instance)...
python
def fit(self, env, nb_steps, action_repetition=1, callbacks=None, verbose=1, visualize=False, nb_max_start_steps=0, start_step_policy=None, log_interval=10000, nb_max_episode_steps=None): """Trains the agent on the given environment. # Arguments env: (`Env` instance)...
['def', 'fit', '(', 'self', ',', 'env', ',', 'nb_steps', ',', 'action_repetition', '=', '1', ',', 'callbacks', '=', 'None', ',', 'verbose', '=', '1', ',', 'visualize', '=', 'False', ',', 'nb_max_start_steps', '=', '0', ',', 'start_step_policy', '=', 'None', ',', 'log_interval', '=', '10000', ',', 'nb_max_episode_steps'...
Trains the agent on the given environment. # Arguments env: (`Env` instance): Environment that the agent interacts with. See [Env](#env) for details. nb_steps (integer): Number of training steps to be performed. action_repetition (integer): Number of times the agent repeats ...
['Trains', 'the', 'agent', 'on', 'the', 'given', 'environment', '.']
train
https://github.com/keras-rl/keras-rl/blob/e6efb0d8297ec38d704a3110b5d6ed74d09a05e3/rl/core.py#L53-L238
7,219
agoragames/haigha
haigha/connection.py
Connection._next_channel_id
def _next_channel_id(self): '''Return the next possible channel id. Is a circular enumeration.''' self._channel_counter += 1 if self._channel_counter >= self._channel_max: self._channel_counter = 1 return self._channel_counter
python
def _next_channel_id(self): '''Return the next possible channel id. Is a circular enumeration.''' self._channel_counter += 1 if self._channel_counter >= self._channel_max: self._channel_counter = 1 return self._channel_counter
['def', '_next_channel_id', '(', 'self', ')', ':', 'self', '.', '_channel_counter', '+=', '1', 'if', 'self', '.', '_channel_counter', '>=', 'self', '.', '_channel_max', ':', 'self', '.', '_channel_counter', '=', '1', 'return', 'self', '.', '_channel_counter']
Return the next possible channel id. Is a circular enumeration.
['Return', 'the', 'next', 'possible', 'channel', 'id', '.', 'Is', 'a', 'circular', 'enumeration', '.']
train
https://github.com/agoragames/haigha/blob/7b004e1c0316ec14b94fec1c54554654c38b1a25/haigha/connection.py#L307-L312
7,220
Bearle/django-private-chat
django_private_chat/handlers.py
check_online
def check_online(stream): """ Used to check user's online opponents and show their online/offline status on page on init """ while True: packet = yield from stream.get() session_id = packet.get('session_key') opponent_username = packet.get('username') if session_i...
python
def check_online(stream): """ Used to check user's online opponents and show their online/offline status on page on init """ while True: packet = yield from stream.get() session_id = packet.get('session_key') opponent_username = packet.get('username') if session_i...
['def', 'check_online', '(', 'stream', ')', ':', 'while', 'True', ':', 'packet', '=', 'yield', 'from', 'stream', '.', 'get', '(', ')', 'session_id', '=', 'packet', '.', 'get', '(', "'session_key'", ')', 'opponent_username', '=', 'packet', '.', 'get', '(', "'username'", ')', 'if', 'session_id', 'and', 'opponent_username...
Used to check user's online opponents and show their online/offline status on page on init
['Used', 'to', 'check', 'user', 's', 'online', 'opponents', 'and', 'show', 'their', 'online', '/', 'offline', 'status', 'on', 'page', 'on', 'init']
train
https://github.com/Bearle/django-private-chat/blob/5b51e65875795c5c0ce21bb631c53bd3aac4c26b/django_private_chat/handlers.py#L64-L90
7,221
franciscogarate/pyliferisk
pyliferisk/__init__.py
Axn
def Axn(mt, x, n): """ (A^1)x:n : Returns the EPV (net single premium) of a term insurance. """ return (mt.Mx[x] - mt.Mx[x + n]) / mt.Dx[x]
python
def Axn(mt, x, n): """ (A^1)x:n : Returns the EPV (net single premium) of a term insurance. """ return (mt.Mx[x] - mt.Mx[x + n]) / mt.Dx[x]
['def', 'Axn', '(', 'mt', ',', 'x', ',', 'n', ')', ':', 'return', '(', 'mt', '.', 'Mx', '[', 'x', ']', '-', 'mt', '.', 'Mx', '[', 'x', '+', 'n', ']', ')', '/', 'mt', '.', 'Dx', '[', 'x', ']']
(A^1)x:n : Returns the EPV (net single premium) of a term insurance.
['(', 'A^1', ')', 'x', ':', 'n', ':', 'Returns', 'the', 'EPV', '(', 'net', 'single', 'premium', ')', 'of', 'a', 'term', 'insurance', '.']
train
https://github.com/franciscogarate/pyliferisk/blob/8d906bed04df1ba00fa1cacc6f31030ce5ab6233/pyliferisk/__init__.py#L305-L307
7,222
rdo-management/python-rdomanager-oscplugin
rdomanager_oscplugin/utils.py
generate_overcloud_passwords
def generate_overcloud_passwords(output_file="tripleo-overcloud-passwords"): """Create the passwords needed for the overcloud This will create the set of passwords required by the overcloud, store them in the output file path and return a dictionary of passwords. If the file already exists the existing...
python
def generate_overcloud_passwords(output_file="tripleo-overcloud-passwords"): """Create the passwords needed for the overcloud This will create the set of passwords required by the overcloud, store them in the output file path and return a dictionary of passwords. If the file already exists the existing...
['def', 'generate_overcloud_passwords', '(', 'output_file', '=', '"tripleo-overcloud-passwords"', ')', ':', 'if', 'os', '.', 'path', '.', 'isfile', '(', 'output_file', ')', ':', 'with', 'open', '(', 'output_file', ')', 'as', 'f', ':', 'return', 'dict', '(', 'line', '.', 'split', '(', "'='", ')', 'for', 'line', 'in', 'f...
Create the passwords needed for the overcloud This will create the set of passwords required by the overcloud, store them in the output file path and return a dictionary of passwords. If the file already exists the existing passwords will be returned instead,
['Create', 'the', 'passwords', 'needed', 'for', 'the', 'overcloud']
train
https://github.com/rdo-management/python-rdomanager-oscplugin/blob/165a166fb2e5a2598380779b35812b8b8478c4fb/rdomanager_oscplugin/utils.py#L63-L97
7,223
cloud-custodian/cloud-custodian
tools/c7n_logexporter/c7n_logexporter/exporter.py
subscribe
def subscribe(config, accounts, region, merge, debug): """subscribe accounts log groups to target account log group destination""" config = validate.callback(config) subscription = config.get('subscription') if subscription is None: log.error("config file: logs subscription missing") sy...
python
def subscribe(config, accounts, region, merge, debug): """subscribe accounts log groups to target account log group destination""" config = validate.callback(config) subscription = config.get('subscription') if subscription is None: log.error("config file: logs subscription missing") sy...
['def', 'subscribe', '(', 'config', ',', 'accounts', ',', 'region', ',', 'merge', ',', 'debug', ')', ':', 'config', '=', 'validate', '.', 'callback', '(', 'config', ')', 'subscription', '=', 'config', '.', 'get', '(', "'subscription'", ')', 'if', 'subscription', 'is', 'None', ':', 'log', '.', 'error', '(', '"config fil...
subscribe accounts log groups to target account log group destination
['subscribe', 'accounts', 'log', 'groups', 'to', 'target', 'account', 'log', 'group', 'destination']
train
https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_logexporter/c7n_logexporter/exporter.py#L171-L251
7,224
jlaine/python-netfilter
netfilter/rule.py
Extension.log
def log(self, level, prefix = ''): """Writes the contents of the Extension to the logging system. """ logging.log(level, "%sname: %s", prefix, self.__name) logging.log(level, "%soptions: %s", prefix, self.__options)
python
def log(self, level, prefix = ''): """Writes the contents of the Extension to the logging system. """ logging.log(level, "%sname: %s", prefix, self.__name) logging.log(level, "%soptions: %s", prefix, self.__options)
['def', 'log', '(', 'self', ',', 'level', ',', 'prefix', '=', "''", ')', ':', 'logging', '.', 'log', '(', 'level', ',', '"%sname: %s"', ',', 'prefix', ',', 'self', '.', '__name', ')', 'logging', '.', 'log', '(', 'level', ',', '"%soptions: %s"', ',', 'prefix', ',', 'self', '.', '__options', ')']
Writes the contents of the Extension to the logging system.
['Writes', 'the', 'contents', 'of', 'the', 'Extension', 'to', 'the', 'logging', 'system', '.']
train
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/rule.py#L91-L95
7,225
prthkms/alex
alex/preprocess.py
QueryMatcher.query
def query(self, query): """Q.query(query string) -> category string -- return the matched category for any user query """ self.query = query self.process_query() matching_corpus_index = self.match_query_to_corpus() return self.category_list[matching_corpus_index].strip()
python
def query(self, query): """Q.query(query string) -> category string -- return the matched category for any user query """ self.query = query self.process_query() matching_corpus_index = self.match_query_to_corpus() return self.category_list[matching_corpus_index].strip()
['def', 'query', '(', 'self', ',', 'query', ')', ':', 'self', '.', 'query', '=', 'query', 'self', '.', 'process_query', '(', ')', 'matching_corpus_index', '=', 'self', '.', 'match_query_to_corpus', '(', ')', 'return', 'self', '.', 'category_list', '[', 'matching_corpus_index', ']', '.', 'strip', '(', ')']
Q.query(query string) -> category string -- return the matched category for any user query
['Q', '.', 'query', '(', 'query', 'string', ')', '-', '>', 'category', 'string', '--', 'return', 'the', 'matched', 'category', 'for', 'any', 'user', 'query']
train
https://github.com/prthkms/alex/blob/79d3167c877e94cc07db0aab55a35857fac67ef7/alex/preprocess.py#L149-L156
7,226
jahuth/litus
spikes.py
LabeledMatrix.convert
def convert(self,label,units=None,conversion_function=convert_time): """ converts a dimension in place """ label_no = self.get_label_no(label) new_label, new_column = self.get_converted(label_no,units,conversion_function) labels = [LabelDimension(l) for l in self.labels] labels[l...
python
def convert(self,label,units=None,conversion_function=convert_time): """ converts a dimension in place """ label_no = self.get_label_no(label) new_label, new_column = self.get_converted(label_no,units,conversion_function) labels = [LabelDimension(l) for l in self.labels] labels[l...
['def', 'convert', '(', 'self', ',', 'label', ',', 'units', '=', 'None', ',', 'conversion_function', '=', 'convert_time', ')', ':', 'label_no', '=', 'self', '.', 'get_label_no', '(', 'label', ')', 'new_label', ',', 'new_column', '=', 'self', '.', 'get_converted', '(', 'label_no', ',', 'units', ',', 'conversion_function...
converts a dimension in place
['converts', 'a', 'dimension', 'in', 'place']
train
https://github.com/jahuth/litus/blob/712b016ea2dbb1cf0a30bfdbb0a136945a7b7c5e/spikes.py#L597-L605
7,227
Shizmob/pydle
pydle/features/rfc1459/client.py
RFC1459Support.join
async def join(self, channel, password=None): """ Join channel, optionally with password. """ if self.in_channel(channel): raise AlreadyInChannel(channel) if password: await self.rawmsg('JOIN', channel, password) else: await self.rawmsg('JOIN', channe...
python
async def join(self, channel, password=None): """ Join channel, optionally with password. """ if self.in_channel(channel): raise AlreadyInChannel(channel) if password: await self.rawmsg('JOIN', channel, password) else: await self.rawmsg('JOIN', channe...
['async', 'def', 'join', '(', 'self', ',', 'channel', ',', 'password', '=', 'None', ')', ':', 'if', 'self', '.', 'in_channel', '(', 'channel', ')', ':', 'raise', 'AlreadyInChannel', '(', 'channel', ')', 'if', 'password', ':', 'await', 'self', '.', 'rawmsg', '(', "'JOIN'", ',', 'channel', ',', 'password', ')', 'else', '...
Join channel, optionally with password.
['Join', 'channel', 'optionally', 'with', 'password', '.']
train
https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/rfc1459/client.py#L254-L262
7,228
Capitains/MyCapytain
MyCapytain/retrievers/cts5.py
HttpCtsRetriever.getReffs
def getReffs(self, textId, level=1, subreference=None): """ Retrieve the siblings of a textual node :param textId: CtsTextMetadata Identifier :type textId: str :param level: Depth for retrieval :type level: int :param subreference: CapitainsCtsPassage Reference :...
python
def getReffs(self, textId, level=1, subreference=None): """ Retrieve the siblings of a textual node :param textId: CtsTextMetadata Identifier :type textId: str :param level: Depth for retrieval :type level: int :param subreference: CapitainsCtsPassage Reference :...
['def', 'getReffs', '(', 'self', ',', 'textId', ',', 'level', '=', '1', ',', 'subreference', '=', 'None', ')', ':', 'depth', '=', 'level', 'if', 'subreference', ':', 'textId', '=', '"{}:{}"', '.', 'format', '(', 'textId', ',', 'subreference', ')', 'if', 'subreference', ':', 'if', 'isinstance', '(', 'subreference', ',',...
Retrieve the siblings of a textual node :param textId: CtsTextMetadata Identifier :type textId: str :param level: Depth for retrieval :type level: int :param subreference: CapitainsCtsPassage Reference :type subreference: str :return: List of references :...
['Retrieve', 'the', 'siblings', 'of', 'a', 'textual', 'node']
train
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/retrievers/cts5.py#L216-L238
7,229
wavefrontHQ/python-client
wavefront_api_client/models/chart_settings.py
ChartSettings.sparkline_display_value_type
def sparkline_display_value_type(self, sparkline_display_value_type): """Sets the sparkline_display_value_type of this ChartSettings. For the single stat view, whether to display the name of the query or the value of query # noqa: E501 :param sparkline_display_value_type: The sparkline_displa...
python
def sparkline_display_value_type(self, sparkline_display_value_type): """Sets the sparkline_display_value_type of this ChartSettings. For the single stat view, whether to display the name of the query or the value of query # noqa: E501 :param sparkline_display_value_type: The sparkline_displa...
['def', 'sparkline_display_value_type', '(', 'self', ',', 'sparkline_display_value_type', ')', ':', 'allowed_values', '=', '[', '"VALUE"', ',', '"LABEL"', ']', '# noqa: E501', 'if', 'sparkline_display_value_type', 'not', 'in', 'allowed_values', ':', 'raise', 'ValueError', '(', '"Invalid value for `sparkline_display_val...
Sets the sparkline_display_value_type of this ChartSettings. For the single stat view, whether to display the name of the query or the value of query # noqa: E501 :param sparkline_display_value_type: The sparkline_display_value_type of this ChartSettings. # noqa: E501 :type: str
['Sets', 'the', 'sparkline_display_value_type', 'of', 'this', 'ChartSettings', '.']
train
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L1038-L1053
7,230
softlayer/softlayer-python
SoftLayer/managers/dns.py
DNSManager._generate_create_dict
def _generate_create_dict(record, record_type, data, ttl, **kwargs): """Returns a dict appropriate to pass into Dns_Domain_ResourceRecord::createObject""" # Basic dns record structure resource_record = { 'host': record, 'data': data, 'ttl': ttl, '...
python
def _generate_create_dict(record, record_type, data, ttl, **kwargs): """Returns a dict appropriate to pass into Dns_Domain_ResourceRecord::createObject""" # Basic dns record structure resource_record = { 'host': record, 'data': data, 'ttl': ttl, '...
['def', '_generate_create_dict', '(', 'record', ',', 'record_type', ',', 'data', ',', 'ttl', ',', '*', '*', 'kwargs', ')', ':', '# Basic dns record structure', 'resource_record', '=', '{', "'host'", ':', 'record', ',', "'data'", ':', 'data', ',', "'ttl'", ':', 'ttl', ',', "'type'", ':', 'record_type', '}', 'for', '(', ...
Returns a dict appropriate to pass into Dns_Domain_ResourceRecord::createObject
['Returns', 'a', 'dict', 'appropriate', 'to', 'pass', 'into', 'Dns_Domain_ResourceRecord', '::', 'createObject']
train
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dns.py#L152-L166
7,231
marrow/schema
marrow/schema/transform/base.py
BaseTransform.dump
def dump(self, fh, value, context=None): """Attempt to transform and write a string-based foreign value to the given file-like object. Returns the length written. """ value = self.dumps(value) fh.write(value) return len(value)
python
def dump(self, fh, value, context=None): """Attempt to transform and write a string-based foreign value to the given file-like object. Returns the length written. """ value = self.dumps(value) fh.write(value) return len(value)
['def', 'dump', '(', 'self', ',', 'fh', ',', 'value', ',', 'context', '=', 'None', ')', ':', 'value', '=', 'self', '.', 'dumps', '(', 'value', ')', 'fh', '.', 'write', '(', 'value', ')', 'return', 'len', '(', 'value', ')']
Attempt to transform and write a string-based foreign value to the given file-like object. Returns the length written.
['Attempt', 'to', 'transform', 'and', 'write', 'a', 'string', '-', 'based', 'foreign', 'value', 'to', 'the', 'given', 'file', '-', 'like', 'object', '.', 'Returns', 'the', 'length', 'written', '.']
train
https://github.com/marrow/schema/blob/0c4c3e3b8c79d8bfeb8d7265cfa5b12a2e643152/marrow/schema/transform/base.py#L50-L58
7,232
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/table.py
_EmptyRowIterator.to_dataframe
def to_dataframe(self, bqstorage_client=None, dtypes=None, progress_bar_type=None): """Create an empty dataframe. Args: bqstorage_client (Any): Ignored. Added for compatibility with RowIterator. dtypes (Any): Ignored. Added for compatibility with ...
python
def to_dataframe(self, bqstorage_client=None, dtypes=None, progress_bar_type=None): """Create an empty dataframe. Args: bqstorage_client (Any): Ignored. Added for compatibility with RowIterator. dtypes (Any): Ignored. Added for compatibility with ...
['def', 'to_dataframe', '(', 'self', ',', 'bqstorage_client', '=', 'None', ',', 'dtypes', '=', 'None', ',', 'progress_bar_type', '=', 'None', ')', ':', 'if', 'pandas', 'is', 'None', ':', 'raise', 'ValueError', '(', '_NO_PANDAS_ERROR', ')', 'return', 'pandas', '.', 'DataFrame', '(', ')']
Create an empty dataframe. Args: bqstorage_client (Any): Ignored. Added for compatibility with RowIterator. dtypes (Any): Ignored. Added for compatibility with RowIterator. progress_bar_type (Any): Ignored. Added for compatibil...
['Create', 'an', 'empty', 'dataframe', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/table.py#L1710-L1727
7,233
datajoint/datajoint-python
datajoint/expression.py
QueryExpression.get_select_fields
def get_select_fields(self, select_fields=None): """ :return: string specifying the attributes to return """ return self.heading.as_sql if select_fields is None else self.heading.project(select_fields).as_sql
python
def get_select_fields(self, select_fields=None): """ :return: string specifying the attributes to return """ return self.heading.as_sql if select_fields is None else self.heading.project(select_fields).as_sql
['def', 'get_select_fields', '(', 'self', ',', 'select_fields', '=', 'None', ')', ':', 'return', 'self', '.', 'heading', '.', 'as_sql', 'if', 'select_fields', 'is', 'None', 'else', 'self', '.', 'heading', '.', 'project', '(', 'select_fields', ')', '.', 'as_sql']
:return: string specifying the attributes to return
[':', 'return', ':', 'string', 'specifying', 'the', 'attributes', 'to', 'return']
train
https://github.com/datajoint/datajoint-python/blob/4f29bb154a7ed2b8b64b4d3a9c8be4c16b39621c/datajoint/expression.py#L203-L207
7,234
fake-name/WebRequest
WebRequest/utility.py
determine_json_encoding
def determine_json_encoding(json_bytes): ''' Given the fact that the first 2 characters in json are guaranteed to be ASCII, we can use these to determine the encoding. See: http://tools.ietf.org/html/rfc4627#section-3 Copied here: Since the first two characters of a JSON text will always be ASCII characte...
python
def determine_json_encoding(json_bytes): ''' Given the fact that the first 2 characters in json are guaranteed to be ASCII, we can use these to determine the encoding. See: http://tools.ietf.org/html/rfc4627#section-3 Copied here: Since the first two characters of a JSON text will always be ASCII characte...
['def', 'determine_json_encoding', '(', 'json_bytes', ')', ':', 'assert', 'isinstance', '(', 'json_bytes', ',', 'bytes', ')', ',', '"`determine_json_encoding()` can only operate on bytestring inputs"', 'if', 'len', '(', 'json_bytes', ')', '>', '4', ':', 'b1', ',', 'b2', ',', 'b3', ',', 'b4', '=', 'json_bytes', '[', '0'...
Given the fact that the first 2 characters in json are guaranteed to be ASCII, we can use these to determine the encoding. See: http://tools.ietf.org/html/rfc4627#section-3 Copied here: Since the first two characters of a JSON text will always be ASCII characters [RFC0020], it is possible to determine wheth...
['Given', 'the', 'fact', 'that', 'the', 'first', '2', 'characters', 'in', 'json', 'are', 'guaranteed', 'to', 'be', 'ASCII', 'we', 'can', 'use', 'these', 'to', 'determine', 'the', 'encoding', '.', 'See', ':', 'http', ':', '//', 'tools', '.', 'ietf', '.', 'org', '/', 'html', '/', 'rfc4627#section', '-', '3']
train
https://github.com/fake-name/WebRequest/blob/b6c94631ff88b5f81f26a9f99a2d5c706810b11f/WebRequest/utility.py#L28-L77
7,235
frejanordsiek/hdf5storage
hdf5storage/__init__.py
reads
def reads(paths, filename='data.h5', options=None, **keywords): """ Reads data from an HDF5 file (high level). High level function to read one or more pieces of data from an HDF5 file located at the paths specified in `paths` into Python types. Each path is specified as a POSIX style path where the dat...
python
def reads(paths, filename='data.h5', options=None, **keywords): """ Reads data from an HDF5 file (high level). High level function to read one or more pieces of data from an HDF5 file located at the paths specified in `paths` into Python types. Each path is specified as a POSIX style path where the dat...
['def', 'reads', '(', 'paths', ',', 'filename', '=', "'data.h5'", ',', 'options', '=', 'None', ',', '*', '*', 'keywords', ')', ':', '# Pack the different options into an Options class if an Options was', '# not given. By default, the matlab_compatible option is set to', "# False. So, if it wasn't passed in the keywords...
Reads data from an HDF5 file (high level). High level function to read one or more pieces of data from an HDF5 file located at the paths specified in `paths` into Python types. Each path is specified as a POSIX style path where the data to read is located. There are various options that can be use...
['Reads', 'data', 'from', 'an', 'HDF5', 'file', '(', 'high', 'level', ')', '.']
train
https://github.com/frejanordsiek/hdf5storage/blob/539275141dd3a4efbbbfd9bdb978f3ed59e3f05d/hdf5storage/__init__.py#L1727-L1836
7,236
rdussurget/py-altimetry
altimetry/tools/nctools.py
load_ncVar
def load_ncVar(varName, nc=None, **kwargs): ''' Loads a variable from the NetCDF file and saves it as a data structure. :parameter varName: variable name :keywords kwargs: additional keyword arguments for slicing the dataset. Keywords should be named the name of the dimensi...
python
def load_ncVar(varName, nc=None, **kwargs): ''' Loads a variable from the NetCDF file and saves it as a data structure. :parameter varName: variable name :keywords kwargs: additional keyword arguments for slicing the dataset. Keywords should be named the name of the dimensi...
['def', 'load_ncVar', '(', 'varName', ',', 'nc', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'if', '(', 'nc', 'is', 'None', ')', ':', 'raise', 'Exception', '(', "'No Netcdf file passed'", ')', 'var', '=', 'nc', '.', 'variables', '[', 'varName', ']', 'var', '.', 'set_auto_maskandscale', '(', 'False', ')', '#Load dim...
Loads a variable from the NetCDF file and saves it as a data structure. :parameter varName: variable name :keywords kwargs: additional keyword arguments for slicing the dataset. Keywords should be named the name of the dimensions to subsample along and associated value should be a length 2 o...
['Loads', 'a', 'variable', 'from', 'the', 'NetCDF', 'file', 'and', 'saves', 'it', 'as', 'a', 'data', 'structure', '.', ':', 'parameter', 'varName', ':', 'variable', 'name', ':', 'keywords', 'kwargs', ':', 'additional', 'keyword', 'arguments', 'for', 'slicing', 'the', 'dataset', '.', 'Keywords', 'should', 'be', 'named',...
train
https://github.com/rdussurget/py-altimetry/blob/57ce7f2d63c6bbc4993821af0bbe46929e3a2d98/altimetry/tools/nctools.py#L1134-L1270
7,237
astroswego/plotypus
src/plotypus/lightcurve.py
make_predictor
def make_predictor(regressor=LassoLarsIC(fit_intercept=False), Selector=GridSearchCV, fourier_degree=(2, 25), selector_processes=1, use_baart=False, scoring='r2', scoring_cv=3, **kwargs): """make_predictor(regressor=LassoLarsIC(fit_intercep...
python
def make_predictor(regressor=LassoLarsIC(fit_intercept=False), Selector=GridSearchCV, fourier_degree=(2, 25), selector_processes=1, use_baart=False, scoring='r2', scoring_cv=3, **kwargs): """make_predictor(regressor=LassoLarsIC(fit_intercep...
['def', 'make_predictor', '(', 'regressor', '=', 'LassoLarsIC', '(', 'fit_intercept', '=', 'False', ')', ',', 'Selector', '=', 'GridSearchCV', ',', 'fourier_degree', '=', '(', '2', ',', '25', ')', ',', 'selector_processes', '=', '1', ',', 'use_baart', '=', 'False', ',', 'scoring', '=', "'r2'", ',', 'scoring_cv', '=', '...
make_predictor(regressor=LassoLarsIC(fit_intercept=False), Selector=GridSearchCV, fourier_degree=(2, 25), selector_processes=1, use_baart=False, scoring='r2', scoring_cv=3, **kwargs) Makes a predictor object for use in :func:`get_lightcurve`. **Parameters** regressor : object with "fit" and "transform" m...
['make_predictor', '(', 'regressor', '=', 'LassoLarsIC', '(', 'fit_intercept', '=', 'False', ')', 'Selector', '=', 'GridSearchCV', 'fourier_degree', '=', '(', '2', '25', ')', 'selector_processes', '=', '1', 'use_baart', '=', 'False', 'scoring', '=', 'r2', 'scoring_cv', '=', '3', '**', 'kwargs', ')']
train
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/lightcurve.py#L35-L81
7,238
pywbem/pywbem
pywbem/cim_obj.py
CIMInstance.property_list
def property_list(self, property_list): """Setter method; for a description see the getter method.""" if property_list is not None: msg = "The 'property_list' init parameter and attribute of " \ "CIMInstance is deprecated; Set only the desired properties " \ "...
python
def property_list(self, property_list): """Setter method; for a description see the getter method.""" if property_list is not None: msg = "The 'property_list' init parameter and attribute of " \ "CIMInstance is deprecated; Set only the desired properties " \ "...
['def', 'property_list', '(', 'self', ',', 'property_list', ')', ':', 'if', 'property_list', 'is', 'not', 'None', ':', 'msg', '=', '"The \'property_list\' init parameter and attribute of "', '"CIMInstance is deprecated; Set only the desired properties "', '"instead."', 'if', 'DEBUG_WARNING_ORIGIN', ':', 'msg', '+=', '"...
Setter method; for a description see the getter method.
['Setter', 'method', ';', 'for', 'a', 'description', 'see', 'the', 'getter', 'method', '.']
train
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L2540-L2554
7,239
internetarchive/brozzler
brozzler/frontier.py
RethinkDbFrontier.enforce_time_limit
def enforce_time_limit(self, site): ''' Raises `brozzler.ReachedTimeLimit` if appropriate. ''' if (site.time_limit and site.time_limit > 0 and site.elapsed() > site.time_limit): self.logger.debug( "site FINISHED_TIME_LIMIT! time_limit=%s " ...
python
def enforce_time_limit(self, site): ''' Raises `brozzler.ReachedTimeLimit` if appropriate. ''' if (site.time_limit and site.time_limit > 0 and site.elapsed() > site.time_limit): self.logger.debug( "site FINISHED_TIME_LIMIT! time_limit=%s " ...
['def', 'enforce_time_limit', '(', 'self', ',', 'site', ')', ':', 'if', '(', 'site', '.', 'time_limit', 'and', 'site', '.', 'time_limit', '>', '0', 'and', 'site', '.', 'elapsed', '(', ')', '>', 'site', '.', 'time_limit', ')', ':', 'self', '.', 'logger', '.', 'debug', '(', '"site FINISHED_TIME_LIMIT! time_limit=%s "', '...
Raises `brozzler.ReachedTimeLimit` if appropriate.
['Raises', 'brozzler', '.', 'ReachedTimeLimit', 'if', 'appropriate', '.']
train
https://github.com/internetarchive/brozzler/blob/411b3f266a38b9bb942021c0121ebd8e5ca66447/brozzler/frontier.py#L155-L164
7,240
ubc/ubcpi
ubcpi/answer_pool.py
offer_answer
def offer_answer(pool, answer, rationale, student_id, algo, options): """ submit a student answer to the answer pool The answer maybe selected to stay in the pool depending on the selection algorithm Args: pool (dict): answer pool Answer pool format: { o...
python
def offer_answer(pool, answer, rationale, student_id, algo, options): """ submit a student answer to the answer pool The answer maybe selected to stay in the pool depending on the selection algorithm Args: pool (dict): answer pool Answer pool format: { o...
['def', 'offer_answer', '(', 'pool', ',', 'answer', ',', 'rationale', ',', 'student_id', ',', 'algo', ',', 'options', ')', ':', 'if', 'algo', '[', "'name'", ']', '==', "'simple'", ':', 'offer_simple', '(', 'pool', ',', 'answer', ',', 'rationale', ',', 'student_id', ',', 'options', ')', 'elif', 'algo', '[', "'name'", ']...
submit a student answer to the answer pool The answer maybe selected to stay in the pool depending on the selection algorithm Args: pool (dict): answer pool Answer pool format: { option1_index: { 'student_id': { can store algorithm specific i...
['submit', 'a', 'student', 'answer', 'to', 'the', 'answer', 'pool']
train
https://github.com/ubc/ubcpi/blob/7b6de03f93f3a4a8af4b92dfde7c69eeaf21f46e/ubcpi/answer_pool.py#L43-L73
7,241
tensorflow/cleverhans
cleverhans/utils_tf.py
jacobian_augmentation
def jacobian_augmentation(sess, x, X_sub_prev, Y_sub, grads, lmbda, aug_batch_size=512, feed=None): """ Augment an adversary's substit...
python
def jacobian_augmentation(sess, x, X_sub_prev, Y_sub, grads, lmbda, aug_batch_size=512, feed=None): """ Augment an adversary's substit...
['def', 'jacobian_augmentation', '(', 'sess', ',', 'x', ',', 'X_sub_prev', ',', 'Y_sub', ',', 'grads', ',', 'lmbda', ',', 'aug_batch_size', '=', '512', ',', 'feed', '=', 'None', ')', ':', 'assert', 'len', '(', 'x', '.', 'get_shape', '(', ')', ')', '==', 'len', '(', 'np', '.', 'shape', '(', 'X_sub_prev', ')', ')', 'asse...
Augment an adversary's substitute training set using the Jacobian of a substitute model to generate new synthetic inputs. See https://arxiv.org/abs/1602.02697 for more details. See cleverhans_tutorials/mnist_blackbox.py for example use case :param sess: TF session in which the substitute model is defined :par...
['Augment', 'an', 'adversary', 's', 'substitute', 'training', 'set', 'using', 'the', 'Jacobian', 'of', 'a', 'substitute', 'model', 'to', 'generate', 'new', 'synthetic', 'inputs', '.', 'See', 'https', ':', '//', 'arxiv', '.', 'org', '/', 'abs', '/', '1602', '.', '02697', 'for', 'more', 'details', '.', 'See', 'cleverhans...
train
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L667-L722
7,242
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.update_context
def update_context(self): """ Make sure Bazaar respects the configured author. This method first calls :func:`.Repository.update_context()` and then it sets the ``$BZR_EMAIL`` environment variable based on the value of :attr:`~Repository.author` (but only if :attr:`~Repository.a...
python
def update_context(self): """ Make sure Bazaar respects the configured author. This method first calls :func:`.Repository.update_context()` and then it sets the ``$BZR_EMAIL`` environment variable based on the value of :attr:`~Repository.author` (but only if :attr:`~Repository.a...
['def', 'update_context', '(', 'self', ')', ':', '# Call our superclass.', 'super', '(', 'BzrRepo', ',', 'self', ')', '.', 'update_context', '(', ')', '# Try to ensure that $BZR_EMAIL is set (see above for the reason)', "# but only if the `author' property was set by the caller (more", "# specifically there's no point ...
Make sure Bazaar respects the configured author. This method first calls :func:`.Repository.update_context()` and then it sets the ``$BZR_EMAIL`` environment variable based on the value of :attr:`~Repository.author` (but only if :attr:`~Repository.author` was set by the caller). ...
['Make', 'sure', 'Bazaar', 'respects', 'the', 'configured', 'author', '.']
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L272-L298
7,243
skyfielders/python-skyfield
skyfield/positionlib.py
ICRF.galactic_xyz
def galactic_xyz(self): """Compute galactic coordinates (x, y, z)""" vector = _GALACTIC.dot(self.position.au) return Distance(vector)
python
def galactic_xyz(self): """Compute galactic coordinates (x, y, z)""" vector = _GALACTIC.dot(self.position.au) return Distance(vector)
['def', 'galactic_xyz', '(', 'self', ')', ':', 'vector', '=', '_GALACTIC', '.', 'dot', '(', 'self', '.', 'position', '.', 'au', ')', 'return', 'Distance', '(', 'vector', ')']
Compute galactic coordinates (x, y, z)
['Compute', 'galactic', 'coordinates', '(', 'x', 'y', 'z', ')']
train
https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/positionlib.py#L245-L248
7,244
novopl/peltak
src/peltak/core/conf.py
load_py_config
def load_py_config(conf_file): # type: (str) -> None """ Import configuration from a python file. This will just import the file into python. Sky is the limit. The file has to deal with the configuration all by itself (i.e. call conf.init()). You will also need to add your src directory to sys.path...
python
def load_py_config(conf_file): # type: (str) -> None """ Import configuration from a python file. This will just import the file into python. Sky is the limit. The file has to deal with the configuration all by itself (i.e. call conf.init()). You will also need to add your src directory to sys.path...
['def', 'load_py_config', '(', 'conf_file', ')', ':', '# type: (str) -> None', 'if', 'sys', '.', 'version_info', '>=', '(', '3', ',', '5', ')', ':', 'from', 'importlib', 'import', 'util', 'spec', '=', 'util', '.', 'spec_from_file_location', '(', "'pelconf'", ',', 'conf_file', ')', 'mod', '=', 'util', '.', 'module_from_...
Import configuration from a python file. This will just import the file into python. Sky is the limit. The file has to deal with the configuration all by itself (i.e. call conf.init()). You will also need to add your src directory to sys.paths if it's not the current working directory. This is done aut...
['Import', 'configuration', 'from', 'a', 'python', 'file', '.']
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/conf.py#L140-L171
7,245
csparpa/pyowm
pyowm/agroapi10/enums.py
PaletteEnum.items
def items(cls): """ All values for this enum :return: list of str """ return [ cls.GREEN, cls.BLACK_AND_WHITE, cls.CONTRAST_SHIFTED, cls.CONTRAST_CONTINUOUS ]
python
def items(cls): """ All values for this enum :return: list of str """ return [ cls.GREEN, cls.BLACK_AND_WHITE, cls.CONTRAST_SHIFTED, cls.CONTRAST_CONTINUOUS ]
['def', 'items', '(', 'cls', ')', ':', 'return', '[', 'cls', '.', 'GREEN', ',', 'cls', '.', 'BLACK_AND_WHITE', ',', 'cls', '.', 'CONTRAST_SHIFTED', ',', 'cls', '.', 'CONTRAST_CONTINUOUS', ']']
All values for this enum :return: list of str
['All', 'values', 'for', 'this', 'enum', ':', 'return', ':', 'list', 'of', 'str']
train
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/agroapi10/enums.py#L61-L72
7,246
adamzap/landslide
landslide/rst.py
html_parts
def html_parts(input_string, source_path=None, destination_path=None, input_encoding='unicode', doctitle=1, initial_header_level=1): """ Given an input string, returns a dictionary of HTML document parts. Dictionary keys are the names of parts, and values are Unicode strings; encoding is...
python
def html_parts(input_string, source_path=None, destination_path=None, input_encoding='unicode', doctitle=1, initial_header_level=1): """ Given an input string, returns a dictionary of HTML document parts. Dictionary keys are the names of parts, and values are Unicode strings; encoding is...
['def', 'html_parts', '(', 'input_string', ',', 'source_path', '=', 'None', ',', 'destination_path', '=', 'None', ',', 'input_encoding', '=', "'unicode'", ',', 'doctitle', '=', '1', ',', 'initial_header_level', '=', '1', ')', ':', 'overrides', '=', '{', "'input_encoding'", ':', 'input_encoding', ',', "'doctitle_xform'"...
Given an input string, returns a dictionary of HTML document parts. Dictionary keys are the names of parts, and values are Unicode strings; encoding is up to the client. Parameters: - `input_string`: A multi-line text string; required. - `source_path`: Path to the source file or object. Optional...
['Given', 'an', 'input', 'string', 'returns', 'a', 'dictionary', 'of', 'HTML', 'document', 'parts', '.']
train
https://github.com/adamzap/landslide/blob/59b0403d7a7cca4b8ff6ba7fb76efb9748b3f832/landslide/rst.py#L43-L79
7,247
jalanb/pysyte
pysyte/bash/git.py
branches
def branches(remotes=False): """Return a list of all local branches in the repo If remotes is true then also include remote branches Note: the normal '*' indicator for current branch is removed this method just gives a list of branch names Use branch() method to determine the current branch ...
python
def branches(remotes=False): """Return a list of all local branches in the repo If remotes is true then also include remote branches Note: the normal '*' indicator for current branch is removed this method just gives a list of branch names Use branch() method to determine the current branch ...
['def', 'branches', '(', 'remotes', '=', 'False', ')', ':', 'stdout', '=', 'branch', '(', "'--list %s'", '%', '(', 'remotes', 'and', "'-a'", 'or', "''", ')', ',', 'quiet', '=', 'True', ')', 'return', '[', '_', '.', 'lstrip', '(', "'*'", ')', '.', 'strip', '(', ')', 'for', '_', 'in', 'stdout', '.', 'splitlines', '(', ')...
Return a list of all local branches in the repo If remotes is true then also include remote branches Note: the normal '*' indicator for current branch is removed this method just gives a list of branch names Use branch() method to determine the current branch
['Return', 'a', 'list', 'of', 'all', 'local', 'branches', 'in', 'the', 'repo']
train
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L258-L268
7,248
rtfd/sphinx-autoapi
autoapi/mappers/javascript.py
JavaScriptSphinxMapper.create_class
def create_class(self, data, options=None, **kwargs): """Return instance of class based on Javascript data Data keys handled here: type Set the object class consts, types, vars, funcs Recurse into :py:meth:`create_class` to create child object ...
python
def create_class(self, data, options=None, **kwargs): """Return instance of class based on Javascript data Data keys handled here: type Set the object class consts, types, vars, funcs Recurse into :py:meth:`create_class` to create child object ...
['def', 'create_class', '(', 'self', ',', 'data', ',', 'options', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'obj_map', '=', 'dict', '(', '(', 'cls', '.', 'type', ',', 'cls', ')', 'for', 'cls', 'in', 'ALL_CLASSES', ')', 'try', ':', 'cls', '=', 'obj_map', '[', 'data', '[', '"kind"', ']', ']', 'except', '(', 'KeyErr...
Return instance of class based on Javascript data Data keys handled here: type Set the object class consts, types, vars, funcs Recurse into :py:meth:`create_class` to create child object instances :param data: dictionary data fr...
['Return', 'instance', 'of', 'class', 'based', 'on', 'Javascript', 'data']
train
https://github.com/rtfd/sphinx-autoapi/blob/9735f43a8d9ff4620c7bcbd177fd1bb7608052e9/autoapi/mappers/javascript.py#L50-L76
7,249
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py
find_functions
def find_functions(code): """ Return a list of (name, arguments, return type) for all function definition2 found in *code*. Arguments are returned as [(type, name), ...]. """ regex = "^\s*" + re_func_decl + "\s*{" funcs = [] while True: m = re.search(regex, code, re.M) ...
python
def find_functions(code): """ Return a list of (name, arguments, return type) for all function definition2 found in *code*. Arguments are returned as [(type, name), ...]. """ regex = "^\s*" + re_func_decl + "\s*{" funcs = [] while True: m = re.search(regex, code, re.M) ...
['def', 'find_functions', '(', 'code', ')', ':', 'regex', '=', '"^\\s*"', '+', 're_func_decl', '+', '"\\s*{"', 'funcs', '=', '[', ']', 'while', 'True', ':', 'm', '=', 're', '.', 'search', '(', 'regex', ',', 'code', ',', 're', '.', 'M', ')', 'if', 'm', 'is', 'None', ':', 'return', 'funcs', 'rtype', ',', 'name', ',', 'ar...
Return a list of (name, arguments, return type) for all function definition2 found in *code*. Arguments are returned as [(type, name), ...].
['Return', 'a', 'list', 'of', '(', 'name', 'arguments', 'return', 'type', ')', 'for', 'all', 'function', 'definition2', 'found', 'in', '*', 'code', '*', '.', 'Arguments', 'are', 'returned', 'as', '[', '(', 'type', 'name', ')', '...', ']', '.']
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L73-L93
7,250
aws/sagemaker-containers
src/sagemaker_containers/_env.py
_create_training_directories
def _create_training_directories(): """Creates the directory structure and files necessary for training under the base path """ logger.info('Creating a new training folder under %s .' % base_dir) os.makedirs(model_dir) os.makedirs(input_config_dir) os.makedirs(output_data_dir) _write_json(...
python
def _create_training_directories(): """Creates the directory structure and files necessary for training under the base path """ logger.info('Creating a new training folder under %s .' % base_dir) os.makedirs(model_dir) os.makedirs(input_config_dir) os.makedirs(output_data_dir) _write_json(...
['def', '_create_training_directories', '(', ')', ':', 'logger', '.', 'info', '(', "'Creating a new training folder under %s .'", '%', 'base_dir', ')', 'os', '.', 'makedirs', '(', 'model_dir', ')', 'os', '.', 'makedirs', '(', 'input_config_dir', ')', 'os', '.', 'makedirs', '(', 'output_data_dir', ')', '_write_json', '(...
Creates the directory structure and files necessary for training under the base path
['Creates', 'the', 'directory', 'structure', 'and', 'files', 'necessary', 'for', 'training', 'under', 'the', 'base', 'path']
train
https://github.com/aws/sagemaker-containers/blob/0030f07abbaf22a55d986d97274d7a8d1aa1f10c/src/sagemaker_containers/_env.py#L150-L168
7,251
ejeschke/ginga
ginga/canvas/render.py
RendererBase.reorder
def reorder(self, dst_order, arr, src_order=None): """Reorder the output array to match that needed by the viewer.""" if dst_order is None: dst_order = self.viewer.rgb_order if src_order is None: src_order = self.rgb_order if src_order != dst_order: ar...
python
def reorder(self, dst_order, arr, src_order=None): """Reorder the output array to match that needed by the viewer.""" if dst_order is None: dst_order = self.viewer.rgb_order if src_order is None: src_order = self.rgb_order if src_order != dst_order: ar...
['def', 'reorder', '(', 'self', ',', 'dst_order', ',', 'arr', ',', 'src_order', '=', 'None', ')', ':', 'if', 'dst_order', 'is', 'None', ':', 'dst_order', '=', 'self', '.', 'viewer', '.', 'rgb_order', 'if', 'src_order', 'is', 'None', ':', 'src_order', '=', 'self', '.', 'rgb_order', 'if', 'src_order', '!=', 'dst_order', ...
Reorder the output array to match that needed by the viewer.
['Reorder', 'the', 'output', 'array', 'to', 'match', 'that', 'needed', 'by', 'the', 'viewer', '.']
train
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/canvas/render.py#L107-L116
7,252
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py
SandboxedEnvironment.call
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" # the double prefixes are to avoid double keyword argument # errors when proxying the call. if not __self.is_safe_callable(__obj): raise SecurityError('%r is not safely callable' % ...
python
def call(__self, __context, __obj, *args, **kwargs): """Call an object from sandboxed code.""" # the double prefixes are to avoid double keyword argument # errors when proxying the call. if not __self.is_safe_callable(__obj): raise SecurityError('%r is not safely callable' % ...
['def', 'call', '(', '__self', ',', '__context', ',', '__obj', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', '# the double prefixes are to avoid double keyword argument', '# errors when proxying the call.', 'if', 'not', '__self', '.', 'is_safe_callable', '(', '__obj', ')', ':', 'raise', 'SecurityError', '(', "'%...
Call an object from sandboxed code.
['Call', 'an', 'object', 'from', 'sandboxed', 'code', '.']
train
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/sandbox.py#L253-L259
7,253
Erotemic/utool
utool/util_cache.py
to_json
def to_json(val, allow_pickle=False, pretty=False): r""" Converts a python object to a JSON string using the utool convention Args: val (object): Returns: str: json_str References: http://stackoverflow.com/questions/11561932/why-does-json-dumpslistnp CommandLine: ...
python
def to_json(val, allow_pickle=False, pretty=False): r""" Converts a python object to a JSON string using the utool convention Args: val (object): Returns: str: json_str References: http://stackoverflow.com/questions/11561932/why-does-json-dumpslistnp CommandLine: ...
['def', 'to_json', '(', 'val', ',', 'allow_pickle', '=', 'False', ',', 'pretty', '=', 'False', ')', ':', 'UtoolJSONEncoder', '=', 'make_utool_json_encoder', '(', 'allow_pickle', ')', 'json_kw', '=', '{', '}', 'json_kw', '[', "'cls'", ']', '=', 'UtoolJSONEncoder', 'if', 'pretty', ':', 'json_kw', '[', "'indent'", ']', '=...
r""" Converts a python object to a JSON string using the utool convention Args: val (object): Returns: str: json_str References: http://stackoverflow.com/questions/11561932/why-does-json-dumpslistnp CommandLine: python -m utool.util_cache --test-to_json py...
['r', 'Converts', 'a', 'python', 'object', 'to', 'a', 'JSON', 'string', 'using', 'the', 'utool', 'convention']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_cache.py#L532-L600
7,254
joferkington/mplstereonet
mplstereonet/contouring.py
_schmidt_count
def _schmidt_count(cos_dist, sigma=None): """Schmidt (a.k.a. 1%) counting kernel function.""" radius = 0.01 count = ((1 - cos_dist) <= radius).astype(float) # To offset the count.sum() - 0.5 required for the kamb methods... count = 0.5 / count.size + count return count, (cos_dist.size * radius)
python
def _schmidt_count(cos_dist, sigma=None): """Schmidt (a.k.a. 1%) counting kernel function.""" radius = 0.01 count = ((1 - cos_dist) <= radius).astype(float) # To offset the count.sum() - 0.5 required for the kamb methods... count = 0.5 / count.size + count return count, (cos_dist.size * radius)
['def', '_schmidt_count', '(', 'cos_dist', ',', 'sigma', '=', 'None', ')', ':', 'radius', '=', '0.01', 'count', '=', '(', '(', '1', '-', 'cos_dist', ')', '<=', 'radius', ')', '.', 'astype', '(', 'float', ')', '# To offset the count.sum() - 0.5 required for the kamb methods...', 'count', '=', '0.5', '/', 'count', '.', '...
Schmidt (a.k.a. 1%) counting kernel function.
['Schmidt', '(', 'a', '.', 'k', '.', 'a', '.', '1%', ')', 'counting', 'kernel', 'function', '.']
train
https://github.com/joferkington/mplstereonet/blob/f6d78ca49807915d4223e864e12bb24d497cc2d6/mplstereonet/contouring.py#L216-L222
7,255
StackStorm/pybind
pybind/slxos/v17s_1_02/qos_mpls/map_/inexp_outexp/__init__.py
inexp_outexp._set_in_exp
def _set_in_exp(self, v, load=False): """ Setter method for in_exp, mapped from YANG variable /qos_mpls/map/inexp_outexp/in_exp (list) If this variable is read-only (config: false) in the source YANG file, then _set_in_exp is considered as a private method. Backends looking to populate this variable...
python
def _set_in_exp(self, v, load=False): """ Setter method for in_exp, mapped from YANG variable /qos_mpls/map/inexp_outexp/in_exp (list) If this variable is read-only (config: false) in the source YANG file, then _set_in_exp is considered as a private method. Backends looking to populate this variable...
['def', '_set_in_exp', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'YANGListType', '(', '"in_exp_in_values"', ',', 'in_exp', '.', 'in_exp',...
Setter method for in_exp, mapped from YANG variable /qos_mpls/map/inexp_outexp/in_exp (list) If this variable is read-only (config: false) in the source YANG file, then _set_in_exp is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_in_exp(...
['Setter', 'method', 'for', 'in_exp', 'mapped', 'from', 'YANG', 'variable', '/', 'qos_mpls', '/', 'map', '/', 'inexp_outexp', '/', 'in_exp', '(', 'list', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_in_exp', 'is', 'consi...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/qos_mpls/map_/inexp_outexp/__init__.py#L131-L152
7,256
abarker/pdfCropMargins
src/pdfCropMargins/calculate_bounding_boxes.py
get_bounding_box_list
def get_bounding_box_list(input_doc_fname, input_doc, full_page_box_list, set_of_page_nums_to_crop, argparse_args, chosen_PdfFileWriter): """Calculate a bounding box for each page in the document. The first argument is the filename of the document's original PDF file, the second is t...
python
def get_bounding_box_list(input_doc_fname, input_doc, full_page_box_list, set_of_page_nums_to_crop, argparse_args, chosen_PdfFileWriter): """Calculate a bounding box for each page in the document. The first argument is the filename of the document's original PDF file, the second is t...
['def', 'get_bounding_box_list', '(', 'input_doc_fname', ',', 'input_doc', ',', 'full_page_box_list', ',', 'set_of_page_nums_to_crop', ',', 'argparse_args', ',', 'chosen_PdfFileWriter', ')', ':', 'global', 'args', ',', 'page_nums_to_crop', ',', 'PdfFileWriter', 'args', '=', 'argparse_args', '# Make args available to al...
Calculate a bounding box for each page in the document. The first argument is the filename of the document's original PDF file, the second is the PdfFileReader for the document. The argument full_page_box_list is a list of the full-page-size boxes (which is used to correct for any nonzero origins in t...
['Calculate', 'a', 'bounding', 'box', 'for', 'each', 'page', 'in', 'the', 'document', '.', 'The', 'first', 'argument', 'is', 'the', 'filename', 'of', 'the', 'document', 's', 'original', 'PDF', 'file', 'the', 'second', 'is', 'the', 'PdfFileReader', 'for', 'the', 'document', '.', 'The', 'argument', 'full_page_box_list', ...
train
https://github.com/abarker/pdfCropMargins/blob/55aca874613750ebf4ae69fd8851bdbb7696d6ac/src/pdfCropMargins/calculate_bounding_boxes.py#L62-L97
7,257
naphatkrit/easyci
easyci/locking.py
init
def init(vcs): """Initialize the locking module for a repository """ path = os.path.join(vcs.private_dir(), 'locks') if not os.path.exists(path): os.mkdir(path)
python
def init(vcs): """Initialize the locking module for a repository """ path = os.path.join(vcs.private_dir(), 'locks') if not os.path.exists(path): os.mkdir(path)
['def', 'init', '(', 'vcs', ')', ':', 'path', '=', 'os', '.', 'path', '.', 'join', '(', 'vcs', '.', 'private_dir', '(', ')', ',', "'locks'", ')', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'path', ')', ':', 'os', '.', 'mkdir', '(', 'path', ')']
Initialize the locking module for a repository
['Initialize', 'the', 'locking', 'module', 'for', 'a', 'repository']
train
https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/locking.py#L24-L29
7,258
minio/minio-py
minio/parsers.py
_iso8601_to_localized_time
def _iso8601_to_localized_time(date_string): """ Convert iso8601 date string into UTC time. :param date_string: iso8601 formatted date string. :return: :class:`datetime.datetime` """ parsed_date = datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ') localized_time = pytz.utc.localize(par...
python
def _iso8601_to_localized_time(date_string): """ Convert iso8601 date string into UTC time. :param date_string: iso8601 formatted date string. :return: :class:`datetime.datetime` """ parsed_date = datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ') localized_time = pytz.utc.localize(par...
['def', '_iso8601_to_localized_time', '(', 'date_string', ')', ':', 'parsed_date', '=', 'datetime', '.', 'strptime', '(', 'date_string', ',', "'%Y-%m-%dT%H:%M:%S.%fZ'", ')', 'localized_time', '=', 'pytz', '.', 'utc', '.', 'localize', '(', 'parsed_date', ')', 'return', 'localized_time']
Convert iso8601 date string into UTC time. :param date_string: iso8601 formatted date string. :return: :class:`datetime.datetime`
['Convert', 'iso8601', 'date', 'string', 'into', 'UTC', 'time', '.']
train
https://github.com/minio/minio-py/blob/7107c84183cf5fb4deff68c0a16ab9f1c0b4c37e/minio/parsers.py#L356-L365
7,259
hydraplatform/hydra-base
hydra_base/lib/units.py
update_dimension
def update_dimension(dimension,**kwargs): """ Update a dimension in the DB. Raises and exception if the dimension does not exist. The key is ALWAYS the name and the name itself is not modificable """ db_dimension = None dimension = JSONObject(dimension) try: db_dimens...
python
def update_dimension(dimension,**kwargs): """ Update a dimension in the DB. Raises and exception if the dimension does not exist. The key is ALWAYS the name and the name itself is not modificable """ db_dimension = None dimension = JSONObject(dimension) try: db_dimens...
['def', 'update_dimension', '(', 'dimension', ',', '*', '*', 'kwargs', ')', ':', 'db_dimension', '=', 'None', 'dimension', '=', 'JSONObject', '(', 'dimension', ')', 'try', ':', 'db_dimension', '=', 'db', '.', 'DBSession', '.', 'query', '(', 'Dimension', ')', '.', 'filter', '(', 'Dimension', '.', 'id', '==', 'dimension'...
Update a dimension in the DB. Raises and exception if the dimension does not exist. The key is ALWAYS the name and the name itself is not modificable
['Update', 'a', 'dimension', 'in', 'the', 'DB', '.', 'Raises', 'and', 'exception', 'if', 'the', 'dimension', 'does', 'not', 'exist', '.', 'The', 'key', 'is', 'ALWAYS', 'the', 'name', 'and', 'the', 'name', 'itself', 'is', 'not', 'modificable']
train
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/units.py#L340-L360
7,260
brennv/namedtupled
namedtupled/integrations.py
load_lists
def load_lists(keys=[], values=[], name='NT'): """ Map namedtuples given a pair of key, value lists. """ mapping = dict(zip(keys, values)) return mapper(mapping, _nt_name=name)
python
def load_lists(keys=[], values=[], name='NT'): """ Map namedtuples given a pair of key, value lists. """ mapping = dict(zip(keys, values)) return mapper(mapping, _nt_name=name)
['def', 'load_lists', '(', 'keys', '=', '[', ']', ',', 'values', '=', '[', ']', ',', 'name', '=', "'NT'", ')', ':', 'mapping', '=', 'dict', '(', 'zip', '(', 'keys', ',', 'values', ')', ')', 'return', 'mapper', '(', 'mapping', ',', '_nt_name', '=', 'name', ')']
Map namedtuples given a pair of key, value lists.
['Map', 'namedtuples', 'given', 'a', 'pair', 'of', 'key', 'value', 'lists', '.']
train
https://github.com/brennv/namedtupled/blob/2b8e3bafd82835ef01549d7a266c34454637ff70/namedtupled/integrations.py#L8-L11
7,261
ArduPilot/MAVProxy
MAVProxy/modules/lib/wxhorizon_ui.py
HorizonFrame.updateAARLocations
def updateAARLocations(self): '''Update the locations of airspeed, altitude and Climb rate.''' # Locations self.airspeedText.set_position((self.rightPos-(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0))) self.altitudeText.set_position((self.rightPos-(self.vertSize/10.0),...
python
def updateAARLocations(self): '''Update the locations of airspeed, altitude and Climb rate.''' # Locations self.airspeedText.set_position((self.rightPos-(self.vertSize/10.0),-0.97+(2*self.vertSize)-(self.vertSize/10.0))) self.altitudeText.set_position((self.rightPos-(self.vertSize/10.0),...
['def', 'updateAARLocations', '(', 'self', ')', ':', '# Locations', 'self', '.', 'airspeedText', '.', 'set_position', '(', '(', 'self', '.', 'rightPos', '-', '(', 'self', '.', 'vertSize', '/', '10.0', ')', ',', '-', '0.97', '+', '(', '2', '*', 'self', '.', 'vertSize', ')', '-', '(', 'self', '.', 'vertSize', '/', '10.0'...
Update the locations of airspeed, altitude and Climb rate.
['Update', 'the', 'locations', 'of', 'airspeed', 'altitude', 'and', 'Climb', 'rate', '.']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L336-L345
7,262
flowersteam/explauto
explauto/interest_model/tree.py
Tree.sample_random
def sample_random(self): """ Sample a point in a random leaf. """ if self.sampling_mode['volume']: # Choose a leaf weighted by volume, randomly if self.leafnode: return self.sample_bounds() else: split_ratio =...
python
def sample_random(self): """ Sample a point in a random leaf. """ if self.sampling_mode['volume']: # Choose a leaf weighted by volume, randomly if self.leafnode: return self.sample_bounds() else: split_ratio =...
['def', 'sample_random', '(', 'self', ')', ':', 'if', 'self', '.', 'sampling_mode', '[', "'volume'", ']', ':', '# Choose a leaf weighted by volume, randomly', 'if', 'self', '.', 'leafnode', ':', 'return', 'self', '.', 'sample_bounds', '(', ')', 'else', ':', 'split_ratio', '=', '(', '(', 'self', '.', 'split_value', '-',...
Sample a point in a random leaf.
['Sample', 'a', 'point', 'in', 'a', 'random', 'leaf', '.']
train
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/interest_model/tree.py#L244-L262
7,263
ktbyers/netmiko
netmiko/_textfsm/_texttable.py
TextTable.RowWith
def RowWith(self, column, value): """Retrieves the first non header row with the column of the given value. Args: column: str, the name of the column to check. value: str, The value of the column to check. Returns: A Row() of the first row found, None otherwise. Raises: In...
python
def RowWith(self, column, value): """Retrieves the first non header row with the column of the given value. Args: column: str, the name of the column to check. value: str, The value of the column to check. Returns: A Row() of the first row found, None otherwise. Raises: In...
['def', 'RowWith', '(', 'self', ',', 'column', ',', 'value', ')', ':', 'for', 'row', 'in', 'self', '.', '_table', '[', '1', ':', ']', ':', 'if', 'row', '[', 'column', ']', '==', 'value', ':', 'return', 'row', 'return', 'None']
Retrieves the first non header row with the column of the given value. Args: column: str, the name of the column to check. value: str, The value of the column to check. Returns: A Row() of the first row found, None otherwise. Raises: IndexError: The specified column does not exist...
['Retrieves', 'the', 'first', 'non', 'header', 'row', 'with', 'the', 'column', 'of', 'the', 'given', 'value', '.']
train
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L965-L981
7,264
igvteam/igv-jupyter
igv/browser.py
Browser.on
def on(self, eventName, cb): """ Subscribe to an igv.js event. :param Name of the event. Currently only "locuschange" is supported. :type str :param cb - callback function taking a single argument. For the locuschange event this argument will contain a dictiona...
python
def on(self, eventName, cb): """ Subscribe to an igv.js event. :param Name of the event. Currently only "locuschange" is supported. :type str :param cb - callback function taking a single argument. For the locuschange event this argument will contain a dictiona...
['def', 'on', '(', 'self', ',', 'eventName', ',', 'cb', ')', ':', 'self', '.', 'eventHandlers', '[', 'eventName', ']', '=', 'cb', 'return', 'self', '.', '_send', '(', '{', '"id"', ':', 'self', '.', 'igv_id', ',', '"command"', ':', '"on"', ',', '"eventName"', ':', 'eventName', '}', ')']
Subscribe to an igv.js event. :param Name of the event. Currently only "locuschange" is supported. :type str :param cb - callback function taking a single argument. For the locuschange event this argument will contain a dictionary of the form {chr, start, end} :type f...
['Subscribe', 'to', 'an', 'igv', '.', 'js', 'event', '.']
train
https://github.com/igvteam/igv-jupyter/blob/f93752ce507eae893c203325764551647e28a3dc/igv/browser.py#L151-L166
7,265
osrg/ryu
ryu/controller/controller.py
_split_addr
def _split_addr(addr): """ Splits a str of IP address and port pair into (host, port). Example:: >>> _split_addr('127.0.0.1:6653') ('127.0.0.1', 6653) >>> _split_addr('[::1]:6653') ('::1', 6653) Raises ValueError if invalid format. :param addr: A pair of IP addres...
python
def _split_addr(addr): """ Splits a str of IP address and port pair into (host, port). Example:: >>> _split_addr('127.0.0.1:6653') ('127.0.0.1', 6653) >>> _split_addr('[::1]:6653') ('::1', 6653) Raises ValueError if invalid format. :param addr: A pair of IP addres...
['def', '_split_addr', '(', 'addr', ')', ':', 'e', '=', 'ValueError', '(', '\'Invalid IP address and port pair: "%s"\'', '%', 'addr', ')', 'pair', '=', 'addr', '.', 'rsplit', '(', "':'", ',', '1', ')', 'if', 'len', '(', 'pair', ')', '!=', '2', ':', 'raise', 'e', 'addr', ',', 'port', '=', 'pair', 'if', 'addr', '.', 'sta...
Splits a str of IP address and port pair into (host, port). Example:: >>> _split_addr('127.0.0.1:6653') ('127.0.0.1', 6653) >>> _split_addr('[::1]:6653') ('::1', 6653) Raises ValueError if invalid format. :param addr: A pair of IP address and port. :return: IP address...
['Splits', 'a', 'str', 'of', 'IP', 'address', 'and', 'port', 'pair', 'into', '(', 'host', 'port', ')', '.']
train
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/controller/controller.py#L92-L121
7,266
opencobra/memote
memote/utils.py
jsonify
def jsonify(obj, pretty=False): """ Turn a nested object into a (compressed) JSON string. Parameters ---------- obj : dict Any kind of dictionary structure. pretty : bool, optional Whether to format the resulting JSON in a more legible way ( default False). """ ...
python
def jsonify(obj, pretty=False): """ Turn a nested object into a (compressed) JSON string. Parameters ---------- obj : dict Any kind of dictionary structure. pretty : bool, optional Whether to format the resulting JSON in a more legible way ( default False). """ ...
['def', 'jsonify', '(', 'obj', ',', 'pretty', '=', 'False', ')', ':', 'if', 'pretty', ':', 'params', '=', 'dict', '(', 'sort_keys', '=', 'True', ',', 'indent', '=', '2', ',', 'allow_nan', '=', 'False', ',', 'separators', '=', '(', '","', ',', '": "', ')', ',', 'ensure_ascii', '=', 'False', ')', 'else', ':', 'params', '...
Turn a nested object into a (compressed) JSON string. Parameters ---------- obj : dict Any kind of dictionary structure. pretty : bool, optional Whether to format the resulting JSON in a more legible way ( default False).
['Turn', 'a', 'nested', 'object', 'into', 'a', '(', 'compressed', ')', 'JSON', 'string', '.']
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/utils.py#L225-L251
7,267
saltstack/salt
salt/cloud/clouds/msazure.py
avail_images
def avail_images(conn=None, call=None): ''' List available images for Azure ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-images option' ) if not conn: conn =...
python
def avail_images(conn=None, call=None): ''' List available images for Azure ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-images option' ) if not conn: conn =...
['def', 'avail_images', '(', 'conn', '=', 'None', ',', 'call', '=', 'None', ')', ':', 'if', 'call', '==', "'action'", ':', 'raise', 'SaltCloudSystemExit', '(', "'The avail_images function must be called with '", "'-f or --function, or with the --list-images option'", ')', 'if', 'not', 'conn', ':', 'conn', '=', 'get_con...
List available images for Azure
['List', 'available', 'images', 'for', 'Azure']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L177-L195
7,268
casastorta/python-sar
sar/parser.py
Parser.__split_info
def __split_info(self, info_part, patternsname, patterns): """ Splits info from SAR parts into logical stuff :-) :param info_part: Part of SAR output we want to split into usable data :param patternsname: ??? :param patterns: ??? :return: ``List``-style info from SAR file...
python
def __split_info(self, info_part, patternsname, patterns): """ Splits info from SAR parts into logical stuff :-) :param info_part: Part of SAR output we want to split into usable data :param patternsname: ??? :param patterns: ??? :return: ``List``-style info from SAR file...
['def', '__split_info', '(', 'self', ',', 'info_part', ',', 'patternsname', ',', 'patterns', ')', ':', 'pattern', '=', 'patterns', '[', "'PATTERN'", ']', 'if', 'pattern', '==', "''", ':', 'return', 'False', 'return_dict', '=', '{', '}', 'pattern_re', '=', 're', '.', 'compile', '(', 'pattern', ')', 'for', 'part_line', '...
Splits info from SAR parts into logical stuff :-) :param info_part: Part of SAR output we want to split into usable data :param patternsname: ??? :param patterns: ??? :return: ``List``-style info from SAR files, now finally \ completely parsed into meaningful data for further...
['Splits', 'info', 'from', 'SAR', 'parts', 'into', 'logical', 'stuff', ':', '-', ')', ':', 'param', 'info_part', ':', 'Part', 'of', 'SAR', 'output', 'we', 'want', 'to', 'split', 'into', 'usable', 'data', ':', 'param', 'patternsname', ':', '???', ':', 'param', 'patterns', ':', '???', ':', 'return', ':', 'List', '-', 'st...
train
https://github.com/casastorta/python-sar/blob/e6d8bb86524102d677f37e985302fad34e3297c1/sar/parser.py#L310-L403
7,269
bitesofcode/projexui
projexui/widgets/xcommentedit.py
XCommentEdit.resizeToContents
def resizeToContents(self): """ Resizes this toolbar based on the contents of its text. """ if self._toolbar.isVisible(): doc = self.document() h = doc.documentLayout().documentSize().height() offset = 34 ...
python
def resizeToContents(self): """ Resizes this toolbar based on the contents of its text. """ if self._toolbar.isVisible(): doc = self.document() h = doc.documentLayout().documentSize().height() offset = 34 ...
['def', 'resizeToContents', '(', 'self', ')', ':', 'if', 'self', '.', '_toolbar', '.', 'isVisible', '(', ')', ':', 'doc', '=', 'self', '.', 'document', '(', ')', 'h', '=', 'doc', '.', 'documentLayout', '(', ')', '.', 'documentSize', '(', ')', '.', 'height', '(', ')', 'offset', '=', '34', '# update the attachments edit\...
Resizes this toolbar based on the contents of its text.
['Resizes', 'this', 'toolbar', 'based', 'on', 'the', 'contents', 'of', 'its', 'text', '.']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcommentedit.py#L183-L208
7,270
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.get_as_boolean_with_default
def get_as_boolean_with_default(self, key, default_value): """ Converts map element into a boolean or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: boolean value ot the element or d...
python
def get_as_boolean_with_default(self, key, default_value): """ Converts map element into a boolean or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: boolean value ot the element or d...
['def', 'get_as_boolean_with_default', '(', 'self', ',', 'key', ',', 'default_value', ')', ':', 'value', '=', 'self', '.', 'get', '(', 'key', ')', 'return', 'BooleanConverter', '.', 'to_boolean_with_default', '(', 'value', ',', 'default_value', ')']
Converts map element into a boolean or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: boolean value ot the element or default value if conversion is not supported.
['Converts', 'map', 'element', 'into', 'a', 'boolean', 'or', 'returns', 'default', 'value', 'if', 'conversion', 'is', 'not', 'possible', '.']
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L221-L232
7,271
m32/endesive
endesive/pdf/fpdf/fpdf.py
FPDF.set_link
def set_link(self, link,y=0,page=-1): "Set destination of internal link" if(y==-1): y=self.y if(page==-1): page=self.page self.links[link]=[page,y]
python
def set_link(self, link,y=0,page=-1): "Set destination of internal link" if(y==-1): y=self.y if(page==-1): page=self.page self.links[link]=[page,y]
['def', 'set_link', '(', 'self', ',', 'link', ',', 'y', '=', '0', ',', 'page', '=', '-', '1', ')', ':', 'if', '(', 'y', '==', '-', '1', ')', ':', 'y', '=', 'self', '.', 'y', 'if', '(', 'page', '==', '-', '1', ')', ':', 'page', '=', 'self', '.', 'page', 'self', '.', 'links', '[', 'link', ']', '=', '[', 'page', ',', 'y',...
Set destination of internal link
['Set', 'destination', 'of', 'internal', 'link']
train
https://github.com/m32/endesive/blob/973091dc69847fe2df594c80ac9235a8d08460ff/endesive/pdf/fpdf/fpdf.py#L629-L635
7,272
bitesofcode/projexui
projexui/widgets/xloggerwidget/xloggerwidget.py
XLoggerWidget.color
def color(self, key): """ Returns the color value for the given key for this console. :param key | <unicode> :return <QtGui.QColor> """ if type(key) == int: key = self.LoggingMap.get(key, ('NotSet', ''))[0] name = n...
python
def color(self, key): """ Returns the color value for the given key for this console. :param key | <unicode> :return <QtGui.QColor> """ if type(key) == int: key = self.LoggingMap.get(key, ('NotSet', ''))[0] name = n...
['def', 'color', '(', 'self', ',', 'key', ')', ':', 'if', 'type', '(', 'key', ')', '==', 'int', ':', 'key', '=', 'self', '.', 'LoggingMap', '.', 'get', '(', 'key', ',', '(', "'NotSet'", ',', "''", ')', ')', '[', '0', ']', 'name', '=', 'nativestring', '(', 'key', ')', '.', 'capitalize', '(', ')', 'return', 'self', '.', ...
Returns the color value for the given key for this console. :param key | <unicode> :return <QtGui.QColor>
['Returns', 'the', 'color', 'value', 'for', 'the', 'given', 'key', 'for', 'this', 'console', '.', ':', 'param', 'key', '|', '<unicode', '>', ':', 'return', '<QtGui', '.', 'QColor', '>']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xloggerwidget/xloggerwidget.py#L185-L196
7,273
astooke/gtimer
gtimer/public/io.py
get_times
def get_times(): """ Produce a deepcopy of the current timing data (no risk of interference with active timing or other operaitons). Returns: Times: gtimer timing data structure object. """ if f.root.stopped: return copy.deepcopy(f.root.times) else: t = timer() ...
python
def get_times(): """ Produce a deepcopy of the current timing data (no risk of interference with active timing or other operaitons). Returns: Times: gtimer timing data structure object. """ if f.root.stopped: return copy.deepcopy(f.root.times) else: t = timer() ...
['def', 'get_times', '(', ')', ':', 'if', 'f', '.', 'root', '.', 'stopped', ':', 'return', 'copy', '.', 'deepcopy', '(', 'f', '.', 'root', '.', 'times', ')', 'else', ':', 't', '=', 'timer', '(', ')', 'times', '=', 'collapse', '.', 'collapse_times', '(', ')', 'f', '.', 'root', '.', 'self_cut', '+=', 'timer', '(', ')', '...
Produce a deepcopy of the current timing data (no risk of interference with active timing or other operaitons). Returns: Times: gtimer timing data structure object.
['Produce', 'a', 'deepcopy', 'of', 'the', 'current', 'timing', 'data', '(', 'no', 'risk', 'of', 'interference', 'with', 'active', 'timing', 'or', 'other', 'operaitons', ')', '.']
train
https://github.com/astooke/gtimer/blob/2146dab459e5d959feb291821733d3d3ba7c523c/gtimer/public/io.py#L25-L39
7,274
BerkeleyAutomation/perception
perception/phoxi_sensor.py
PhoXiSensor.frames
def frames(self): """Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage o...
python
def frames(self): """Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage o...
['def', 'frames', '(', 'self', ')', ':', '# Run a software trigger', 'times', '=', '[', ']', 'rospy', '.', 'ServiceProxy', '(', "'phoxi_camera/start_acquisition'", ',', 'Empty', ')', '(', ')', 'rospy', '.', 'ServiceProxy', '(', "'phoxi_camera/trigger_image'", ',', 'TriggerImage', ')', '(', ')', 'self', '.', '_cur_color...
Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage of the current frame.
['Retrieve', 'a', 'new', 'frame', 'from', 'the', 'PhoXi', 'and', 'convert', 'it', 'to', 'a', 'ColorImage', 'a', 'DepthImage', 'and', 'an', 'IrImage', '.']
train
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L148-L176
7,275
faucamp/python-gsmmodem
gsmmodem/modem.py
IncomingCall.answer
def answer(self): """ Answer the phone call. :return: self (for chaining method calls) """ if self.ringing: self._gsmModem.write('ATA') self.ringing = False self.answered = True return self
python
def answer(self): """ Answer the phone call. :return: self (for chaining method calls) """ if self.ringing: self._gsmModem.write('ATA') self.ringing = False self.answered = True return self
['def', 'answer', '(', 'self', ')', ':', 'if', 'self', '.', 'ringing', ':', 'self', '.', '_gsmModem', '.', 'write', '(', "'ATA'", ')', 'self', '.', 'ringing', '=', 'False', 'self', '.', 'answered', '=', 'True', 'return', 'self']
Answer the phone call. :return: self (for chaining method calls)
['Answer', 'the', 'phone', 'call', '.', ':', 'return', ':', 'self', '(', 'for', 'chaining', 'method', 'calls', ')']
train
https://github.com/faucamp/python-gsmmodem/blob/834c68b1387ca2c91e2210faa8f75526b39723b5/gsmmodem/modem.py#L1308-L1316
7,276
walkr/nanoservice
nanoservice/core.py
Endpoint.encode
def encode(self, payload): """ Encode payload """ try: return self.encoder.encode(payload) except Exception as exception: raise EncodeError(str(exception))
python
def encode(self, payload): """ Encode payload """ try: return self.encoder.encode(payload) except Exception as exception: raise EncodeError(str(exception))
['def', 'encode', '(', 'self', ',', 'payload', ')', ':', 'try', ':', 'return', 'self', '.', 'encoder', '.', 'encode', '(', 'payload', ')', 'except', 'Exception', 'as', 'exception', ':', 'raise', 'EncodeError', '(', 'str', '(', 'exception', ')', ')']
Encode payload
['Encode', 'payload']
train
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L138-L143
7,277
eaton-lab/toytree
toytree/etemini.py
TreeNode.get_farthest_node
def get_farthest_node(self, topology_only=False): """ Returns the node's farthest descendant or ancestor node, and the distance to it. :argument False topology_only: If set to True, distance between nodes will be referred to the number of nodes between them. In other...
python
def get_farthest_node(self, topology_only=False): """ Returns the node's farthest descendant or ancestor node, and the distance to it. :argument False topology_only: If set to True, distance between nodes will be referred to the number of nodes between them. In other...
['def', 'get_farthest_node', '(', 'self', ',', 'topology_only', '=', 'False', ')', ':', '# Init fasthest node to current farthest leaf', 'farthest_node', ',', 'farthest_dist', '=', 'self', '.', 'get_farthest_leaf', '(', 'topology_only', '=', 'topology_only', ')', 'prev', '=', 'self', 'cdist', '=', '0.0', 'if', 'topolog...
Returns the node's farthest descendant or ancestor node, and the distance to it. :argument False topology_only: If set to True, distance between nodes will be referred to the number of nodes between them. In other words, topological distance will be used instead of branch ...
['Returns', 'the', 'node', 's', 'farthest', 'descendant', 'or', 'ancestor', 'node', 'and', 'the', 'distance', 'to', 'it', '.']
train
https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L926-L969
7,278
PythonOptimizers/cygenja
cygenja/treemap/location_descriptor.py
LocationDescriptor.get_locations_list
def get_locations_list(self, lower_bound=0, upper_bound=None): """ Return the internal location list. Args: lower_bound: upper_bound: Returns: """ real_upper_bound = upper_bound if upper_bound is None: real_upper_bound = self....
python
def get_locations_list(self, lower_bound=0, upper_bound=None): """ Return the internal location list. Args: lower_bound: upper_bound: Returns: """ real_upper_bound = upper_bound if upper_bound is None: real_upper_bound = self....
['def', 'get_locations_list', '(', 'self', ',', 'lower_bound', '=', '0', ',', 'upper_bound', '=', 'None', ')', ':', 'real_upper_bound', '=', 'upper_bound', 'if', 'upper_bound', 'is', 'None', ':', 'real_upper_bound', '=', 'self', '.', 'nbr_of_sub_locations', '(', ')', 'try', ':', 'return', 'self', '.', '_locations_list'...
Return the internal location list. Args: lower_bound: upper_bound: Returns:
['Return', 'the', 'internal', 'location', 'list', '.']
train
https://github.com/PythonOptimizers/cygenja/blob/a9ef91cdfa8452beeeec4f050f928b830379f91c/cygenja/treemap/location_descriptor.py#L132-L149
7,279
ansible/ansible-container
container/templates/wait_on_host.py
wait_on_hosts
def wait_on_hosts(hosts, max_attempts=3, sleep_time=1): ''' Wait for a container to have a State.Running value = true. :param hosts: list of service names taken from container.yml :param max_attempts: Max number of times to inspect the container and check State.Running :param sleep_time: Number of s...
python
def wait_on_hosts(hosts, max_attempts=3, sleep_time=1): ''' Wait for a container to have a State.Running value = true. :param hosts: list of service names taken from container.yml :param max_attempts: Max number of times to inspect the container and check State.Running :param sleep_time: Number of s...
['def', 'wait_on_hosts', '(', 'hosts', ',', 'max_attempts', '=', '3', ',', 'sleep_time', '=', '1', ')', ':', 'results', '=', '{', '}', 'for', 'host', 'in', 'hosts', ':', 'container', '=', '"ansible_{}_1"', '.', 'format', '(', 'host', ')', 'tries', '=', 'max_attempts', 'host_ready', '=', 'False', 'output', '=', 'None', ...
Wait for a container to have a State.Running value = true. :param hosts: list of service names taken from container.yml :param max_attempts: Max number of times to inspect the container and check State.Running :param sleep_time: Number of seconds to wait between attempts. :return: dict of host:running p...
['Wait', 'for', 'a', 'container', 'to', 'have', 'a', 'State', '.', 'Running', 'value', '=', 'true', '.', ':', 'param', 'hosts', ':', 'list', 'of', 'service', 'names', 'taken', 'from', 'container', '.', 'yml', ':', 'param', 'max_attempts', ':', 'Max', 'number', 'of', 'times', 'to', 'inspect', 'the', 'container', 'and', ...
train
https://github.com/ansible/ansible-container/blob/d031c1a6133d5482a5d054fcbdbecafb923f8b4b/container/templates/wait_on_host.py#L12-L39
7,280
mbedmicro/pyOCD
pyocd/target/pack/flash_algo.py
PackFlashAlgo._algo_fill_zi_if_missing
def _algo_fill_zi_if_missing(self, ro_rw_zi): """! @brief Create an empty zi section if it is missing""" s_ro, s_rw, s_zi = ro_rw_zi if s_rw is None: return ro_rw_zi if s_zi is not None: return ro_rw_zi s_zi = MemoryRange(start=(s_rw.start + s_rw.length), ...
python
def _algo_fill_zi_if_missing(self, ro_rw_zi): """! @brief Create an empty zi section if it is missing""" s_ro, s_rw, s_zi = ro_rw_zi if s_rw is None: return ro_rw_zi if s_zi is not None: return ro_rw_zi s_zi = MemoryRange(start=(s_rw.start + s_rw.length), ...
['def', '_algo_fill_zi_if_missing', '(', 'self', ',', 'ro_rw_zi', ')', ':', 's_ro', ',', 's_rw', ',', 's_zi', '=', 'ro_rw_zi', 'if', 's_rw', 'is', 'None', ':', 'return', 'ro_rw_zi', 'if', 's_zi', 'is', 'not', 'None', ':', 'return', 'ro_rw_zi', 's_zi', '=', 'MemoryRange', '(', 'start', '=', '(', 's_rw', '.', 'start', '+...
! @brief Create an empty zi section if it is missing
['!']
train
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/target/pack/flash_algo.py#L205-L213
7,281
gem/oq-engine
openquake/baselib/general.py
assert_independent
def assert_independent(package, *packages): """ :param package: Python name of a module/package :param packages: Python names of modules/packages Make sure the `package` does not depend from the `packages`. """ assert packages, 'At least one package must be specified' import_package = 'from...
python
def assert_independent(package, *packages): """ :param package: Python name of a module/package :param packages: Python names of modules/packages Make sure the `package` does not depend from the `packages`. """ assert packages, 'At least one package must be specified' import_package = 'from...
['def', 'assert_independent', '(', 'package', ',', '*', 'packages', ')', ':', 'assert', 'packages', ',', "'At least one package must be specified'", 'import_package', '=', "'from openquake.baselib.general import import_all\\n'", '\'print(import_all("%s"))\'', '%', 'package', 'imported_modules', '=', 'run_in_process', '...
:param package: Python name of a module/package :param packages: Python names of modules/packages Make sure the `package` does not depend from the `packages`.
[':', 'param', 'package', ':', 'Python', 'name', 'of', 'a', 'module', '/', 'package', ':', 'param', 'packages', ':', 'Python', 'names', 'of', 'modules', '/', 'packages']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/general.py#L475-L489
7,282
MarcMeszaros/envitro
envitro/core.py
int
def int(name, default=None, allow_none=False, fallback=None): """Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) ...
python
def int(name, default=None, allow_none=False, fallback=None): """Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) ...
['def', 'int', '(', 'name', ',', 'default', '=', 'None', ',', 'allow_none', '=', 'False', ',', 'fallback', '=', 'None', ')', ':', 'value', '=', 'read', '(', 'name', ',', 'default', ',', 'allow_none', ',', 'fallback', '=', 'fallback', ')', 'if', 'isinstance', '(', 'value', ',', 'builtins', '.', 'str', ')', ':', 'value',...
Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional)
['Get', 'a', 'string', 'environment', 'value', 'or', 'the', 'default', '.']
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L144-L159
7,283
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_media_list_player_set_media_list
def libvlc_media_list_player_set_media_list(p_mlp, p_mlist): '''Set the media list associated with the player. @param p_mlp: media list player instance. @param p_mlist: list of media. ''' f = _Cfunctions.get('libvlc_media_list_player_set_media_list', None) or \ _Cfunction('libvlc_media_list_...
python
def libvlc_media_list_player_set_media_list(p_mlp, p_mlist): '''Set the media list associated with the player. @param p_mlp: media list player instance. @param p_mlist: list of media. ''' f = _Cfunctions.get('libvlc_media_list_player_set_media_list', None) or \ _Cfunction('libvlc_media_list_...
['def', 'libvlc_media_list_player_set_media_list', '(', 'p_mlp', ',', 'p_mlist', ')', ':', 'f', '=', '_Cfunctions', '.', 'get', '(', "'libvlc_media_list_player_set_media_list'", ',', 'None', ')', 'or', '_Cfunction', '(', "'libvlc_media_list_player_set_media_list'", ',', '(', '(', '1', ',', ')', ',', '(', '1', ',', ')',...
Set the media list associated with the player. @param p_mlp: media list player instance. @param p_mlist: list of media.
['Set', 'the', 'media', 'list', 'associated', 'with', 'the', 'player', '.']
train
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4820-L4828
7,284
gplepage/gvar
src/gvar/linalg.py
solve
def solve(a, b): """ Find ``x`` such that ``a @ x = b`` for matrix ``a``. Args: a: Two-dimensional, square matrix/array of numbers and/or :class:`gvar.GVar`\s. b: One-dimensional vector/array of numbers and/or :class:`gvar.GVar`\s, or an array of such vectors. ...
python
def solve(a, b): """ Find ``x`` such that ``a @ x = b`` for matrix ``a``. Args: a: Two-dimensional, square matrix/array of numbers and/or :class:`gvar.GVar`\s. b: One-dimensional vector/array of numbers and/or :class:`gvar.GVar`\s, or an array of such vectors. ...
['def', 'solve', '(', 'a', ',', 'b', ')', ':', 'amean', '=', 'gvar', '.', 'mean', '(', 'a', ')', 'if', 'amean', '.', 'ndim', '!=', '2', 'or', 'amean', '.', 'shape', '[', '0', ']', '!=', 'amean', '.', 'shape', '[', '1', ']', ':', 'raise', 'ValueError', '(', "'bad matrix shape: '", '+', 'str', '(', 'a', '.', 'shape', ')'...
Find ``x`` such that ``a @ x = b`` for matrix ``a``. Args: a: Two-dimensional, square matrix/array of numbers and/or :class:`gvar.GVar`\s. b: One-dimensional vector/array of numbers and/or :class:`gvar.GVar`\s, or an array of such vectors. Requires ``b.shape[0] =...
['Find', 'x', 'such', 'that', 'a', '@', 'x', '=', 'b', 'for', 'matrix', 'a', '.']
train
https://github.com/gplepage/gvar/blob/d6671697319eb6280de3793c9a1c2b616c6f2ae0/src/gvar/linalg.py#L316-L346
7,285
wummel/linkchecker
linkcheck/i18n.py
get_translator
def get_translator (domain, directory, languages=None, translatorklass=Translator, fallback=False, fallbackklass=NullTranslator): """Search the appropriate GNUTranslations class.""" translator = gettext.translation(domain, localedir=directory, languages=langua...
python
def get_translator (domain, directory, languages=None, translatorklass=Translator, fallback=False, fallbackklass=NullTranslator): """Search the appropriate GNUTranslations class.""" translator = gettext.translation(domain, localedir=directory, languages=langua...
['def', 'get_translator', '(', 'domain', ',', 'directory', ',', 'languages', '=', 'None', ',', 'translatorklass', '=', 'Translator', ',', 'fallback', '=', 'False', ',', 'fallbackklass', '=', 'NullTranslator', ')', ':', 'translator', '=', 'gettext', '.', 'translation', '(', 'domain', ',', 'localedir', '=', 'directory', ...
Search the appropriate GNUTranslations class.
['Search', 'the', 'appropriate', 'GNUTranslations', 'class', '.']
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/i18n.py#L105-L113
7,286
flatangle/flatlib
flatlib/chart.py
Chart.copy
def copy(self): """ Returns a deep copy of this chart. """ chart = Chart.__new__(Chart) chart.date = self.date chart.pos = self.pos chart.hsys = self.hsys chart.objects = self.objects.copy() chart.houses = self.houses.copy() chart.angles = self.angles.copy...
python
def copy(self): """ Returns a deep copy of this chart. """ chart = Chart.__new__(Chart) chart.date = self.date chart.pos = self.pos chart.hsys = self.hsys chart.objects = self.objects.copy() chart.houses = self.houses.copy() chart.angles = self.angles.copy...
['def', 'copy', '(', 'self', ')', ':', 'chart', '=', 'Chart', '.', '__new__', '(', 'Chart', ')', 'chart', '.', 'date', '=', 'self', '.', 'date', 'chart', '.', 'pos', '=', 'self', '.', 'pos', 'chart', '.', 'hsys', '=', 'self', '.', 'hsys', 'chart', '.', 'objects', '=', 'self', '.', 'objects', '.', 'copy', '(', ')', 'cha...
Returns a deep copy of this chart.
['Returns', 'a', 'deep', 'copy', 'of', 'this', 'chart', '.']
train
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/chart.py#L56-L65
7,287
StackStorm/pybind
pybind/slxos/v17s_1_02/resource_monitor/cpu/__init__.py
cpu._set_offset_cpu
def _set_offset_cpu(self, v, load=False): """ Setter method for offset_cpu, mapped from YANG variable /resource_monitor/cpu/offset_cpu (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_offset_cpu is considered as a private method. Backends looking to populate ...
python
def _set_offset_cpu(self, v, load=False): """ Setter method for offset_cpu, mapped from YANG variable /resource_monitor/cpu/offset_cpu (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_offset_cpu is considered as a private method. Backends looking to populate ...
['def', '_set_offset_cpu', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'RestrictedClassType', '(', 'base_type', '=', 'RestrictedClassType',...
Setter method for offset_cpu, mapped from YANG variable /resource_monitor/cpu/offset_cpu (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_offset_cpu is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._se...
['Setter', 'method', 'for', 'offset_cpu', 'mapped', 'from', 'YANG', 'variable', '/', 'resource_monitor', '/', 'cpu', '/', 'offset_cpu', '(', 'uint32', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_offset_cpu', 'is', 'cons...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/resource_monitor/cpu/__init__.py#L295-L316
7,288
shad7/tvrenamer
tvrenamer/cache/api.py
DatabaseAPI.save
def save(self, instance): """Save (create or update) the instance to the database :param instance: an instance of modeled data object """ cond = tinydb.where('original') == instance.original eid = self.update(instance, cond) if eid is None: return self.create...
python
def save(self, instance): """Save (create or update) the instance to the database :param instance: an instance of modeled data object """ cond = tinydb.where('original') == instance.original eid = self.update(instance, cond) if eid is None: return self.create...
['def', 'save', '(', 'self', ',', 'instance', ')', ':', 'cond', '=', 'tinydb', '.', 'where', '(', "'original'", ')', '==', 'instance', '.', 'original', 'eid', '=', 'self', '.', 'update', '(', 'instance', ',', 'cond', ')', 'if', 'eid', 'is', 'None', ':', 'return', 'self', '.', 'create', '(', 'instance', ')', 'return', '...
Save (create or update) the instance to the database :param instance: an instance of modeled data object
['Save', '(', 'create', 'or', 'update', ')', 'the', 'instance', 'to', 'the', 'database']
train
https://github.com/shad7/tvrenamer/blob/7fb59cb02669357e73b7acb92dcb6d74fdff4654/tvrenamer/cache/api.py#L49-L58
7,289
redcap-tools/PyCap
redcap/project.py
Project.export_fem
def export_fem(self, arms=None, format='json', df_kwargs=None): """ Export the project's form to event mapping Parameters ---------- arms : list Limit exported form event mappings to these arm numbers format : (``'json'``), ``'csv'``, ``'xml'`` Re...
python
def export_fem(self, arms=None, format='json', df_kwargs=None): """ Export the project's form to event mapping Parameters ---------- arms : list Limit exported form event mappings to these arm numbers format : (``'json'``), ``'csv'``, ``'xml'`` Re...
['def', 'export_fem', '(', 'self', ',', 'arms', '=', 'None', ',', 'format', '=', "'json'", ',', 'df_kwargs', '=', 'None', ')', ':', 'ret_format', '=', 'format', 'if', 'format', '==', "'df'", ':', 'from', 'pandas', 'import', 'read_csv', 'ret_format', '=', "'csv'", 'pl', '=', 'self', '.', '__basepl', '(', "'formEventMapp...
Export the project's form to event mapping Parameters ---------- arms : list Limit exported form event mappings to these arm numbers format : (``'json'``), ``'csv'``, ``'xml'`` Return the form event mappings in native objects, csv or xml, ``'df''`` wi...
['Export', 'the', 'project', 's', 'form', 'to', 'event', 'mapping']
train
https://github.com/redcap-tools/PyCap/blob/f44c9b62a4f62675aa609c06608663f37e12097e/redcap/project.py#L157-L194
7,290
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.red
def red(cls): "Make the text foreground color red." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_RED cls._set_text_attributes(wAttributes)
python
def red(cls): "Make the text foreground color red." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_MASK wAttributes |= win32.FOREGROUND_RED cls._set_text_attributes(wAttributes)
['def', 'red', '(', 'cls', ')', ':', 'wAttributes', '=', 'cls', '.', '_get_text_attributes', '(', ')', 'wAttributes', '&=', '~', 'win32', '.', 'FOREGROUND_MASK', 'wAttributes', '|=', 'win32', '.', 'FOREGROUND_RED', 'cls', '.', '_set_text_attributes', '(', 'wAttributes', ')']
Make the text foreground color red.
['Make', 'the', 'text', 'foreground', 'color', 'red', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L959-L964
7,291
amoffat/sh
sh.py
RunningCommand.handle_command_exit_code
def handle_command_exit_code(self, code): """ here we determine if we had an exception, or an error code that we weren't expecting to see. if we did, we create and raise an exception """ ca = self.call_args exc_class = get_exc_exit_code_would_raise(code, ca["ok_code"], ...
python
def handle_command_exit_code(self, code): """ here we determine if we had an exception, or an error code that we weren't expecting to see. if we did, we create and raise an exception """ ca = self.call_args exc_class = get_exc_exit_code_would_raise(code, ca["ok_code"], ...
['def', 'handle_command_exit_code', '(', 'self', ',', 'code', ')', ':', 'ca', '=', 'self', '.', 'call_args', 'exc_class', '=', 'get_exc_exit_code_would_raise', '(', 'code', ',', 'ca', '[', '"ok_code"', ']', ',', 'ca', '[', '"piped"', ']', ')', 'if', 'exc_class', ':', 'exc', '=', 'exc_class', '(', 'self', '.', 'ran', ',...
here we determine if we had an exception, or an error code that we weren't expecting to see. if we did, we create and raise an exception
['here', 'we', 'determine', 'if', 'we', 'had', 'an', 'exception', 'or', 'an', 'error', 'code', 'that', 'we', 'weren', 't', 'expecting', 'to', 'see', '.', 'if', 'we', 'did', 'we', 'create', 'and', 'raise', 'an', 'exception']
train
https://github.com/amoffat/sh/blob/858adf0c682af4c40e41f34d6926696b7a5d3b12/sh.py#L805-L815
7,292
OpenTreeOfLife/peyotl
peyotl/collections_store/collections_shard.py
TreeCollectionsShard.write_configuration
def write_configuration(self, out, secret_attrs=False): """Generic configuration, may be overridden by type-specific version""" key_order = ['name', 'path', 'git_dir', 'doc_dir', 'assumed_doc_version', 'git_ssh', 'pkey', 'has_aliases', 'number of collections'] cd = self.get_...
python
def write_configuration(self, out, secret_attrs=False): """Generic configuration, may be overridden by type-specific version""" key_order = ['name', 'path', 'git_dir', 'doc_dir', 'assumed_doc_version', 'git_ssh', 'pkey', 'has_aliases', 'number of collections'] cd = self.get_...
['def', 'write_configuration', '(', 'self', ',', 'out', ',', 'secret_attrs', '=', 'False', ')', ':', 'key_order', '=', '[', "'name'", ',', "'path'", ',', "'git_dir'", ',', "'doc_dir'", ',', "'assumed_doc_version'", ',', "'git_ssh'", ',', "'pkey'", ',', "'has_aliases'", ',', "'number of collections'", ']', 'cd', '=', 's...
Generic configuration, may be overridden by type-specific version
['Generic', 'configuration', 'may', 'be', 'overridden', 'by', 'type', '-', 'specific', 'version']
train
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/collections_store/collections_shard.py#L105-L115
7,293
wrongwaycn/ssdb-py
ssdb/client.py
StrictSSDB.zrlist
def zrlist(self, name_start, name_end, limit=10): """ Return a list of the top ``limit`` zset's name between ``name_start`` and ``name_end`` in descending order .. note:: The range is (``name_start``, ``name_end``]. The ``name_start`` isn't in the range, but ``name_end`` is. ...
python
def zrlist(self, name_start, name_end, limit=10): """ Return a list of the top ``limit`` zset's name between ``name_start`` and ``name_end`` in descending order .. note:: The range is (``name_start``, ``name_end``]. The ``name_start`` isn't in the range, but ``name_end`` is. ...
['def', 'zrlist', '(', 'self', ',', 'name_start', ',', 'name_end', ',', 'limit', '=', '10', ')', ':', 'limit', '=', 'get_positive_integer', '(', "'limit'", ',', 'limit', ')', 'return', 'self', '.', 'execute_command', '(', "'zrlist'", ',', 'name_start', ',', 'name_end', ',', 'limit', ')']
Return a list of the top ``limit`` zset's name between ``name_start`` and ``name_end`` in descending order .. note:: The range is (``name_start``, ``name_end``]. The ``name_start`` isn't in the range, but ``name_end`` is. :param string name_start: The lower bound(not included) of zs...
['Return', 'a', 'list', 'of', 'the', 'top', 'limit', 'zset', 's', 'name', 'between', 'name_start', 'and', 'name_end', 'in', 'descending', 'order']
train
https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1427-L1451
7,294
exosite-labs/pyonep
pyonep/onep.py
OnepV1.flush
def flush(self, auth, resource, options=None, defer=False): """ Empties the specified resource of data per specified constraints. Args: auth: <cik> resource: resource to empty. options: Time limits. """ args = [resource] if options is not None...
python
def flush(self, auth, resource, options=None, defer=False): """ Empties the specified resource of data per specified constraints. Args: auth: <cik> resource: resource to empty. options: Time limits. """ args = [resource] if options is not None...
['def', 'flush', '(', 'self', ',', 'auth', ',', 'resource', ',', 'options', '=', 'None', ',', 'defer', '=', 'False', ')', ':', 'args', '=', '[', 'resource', ']', 'if', 'options', 'is', 'not', 'None', ':', 'args', '.', 'append', '(', 'options', ')', 'return', 'self', '.', '_call', '(', "'flush'", ',', 'auth', ',', 'args...
Empties the specified resource of data per specified constraints. Args: auth: <cik> resource: resource to empty. options: Time limits.
['Empties', 'the', 'specified', 'resource', 'of', 'data', 'per', 'specified', 'constraints', '.']
train
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L319-L330
7,295
ctuning/ck
ck/kernel.py
load_repo_info_from_cache
def load_repo_info_from_cache(i): """ Input: { repo_uoa - repo_uoa } Output: { return - return code = 0, if successful 16, if repo not found (may be warning) > 0, if error ...
python
def load_repo_info_from_cache(i): """ Input: { repo_uoa - repo_uoa } Output: { return - return code = 0, if successful 16, if repo not found (may be warning) > 0, if error ...
['def', 'load_repo_info_from_cache', '(', 'i', ')', ':', 'ruoa', '=', 'i', '[', "'repo_uoa'", ']', 'ruid', '=', 'ruoa', 'if', 'ruoa', '==', 'cfg', '[', "'repo_name_default'", ']', 'or', 'ruoa', '==', 'cfg', '[', "'repo_uid_default'", ']', ':', 'd', '=', '{', '}', 'd', '[', '"path_to_repo_desc"', ']', '=', 'work', '[', ...
Input: { repo_uoa - repo_uoa } Output: { return - return code = 0, if successful 16, if repo not found (may be warning) > 0, if error (error) - error text if retur...
['Input', ':', '{', 'repo_uoa', '-', 'repo_uoa', '}']
train
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/kernel.py#L2558-L2611
7,296
HewlettPackard/python-hpOneView
hpOneView/resources/networking/logical_interconnects.py
LogicalInterconnects.get_snmp_configuration
def get_snmp_configuration(self): """ Gets the SNMP configuration for a logical interconnect. Returns: dict: SNMP configuration. """ uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH) return self._helper.do_get(uri)
python
def get_snmp_configuration(self): """ Gets the SNMP configuration for a logical interconnect. Returns: dict: SNMP configuration. """ uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH) return self._helper.do_get(uri)
['def', 'get_snmp_configuration', '(', 'self', ')', ':', 'uri', '=', '"{}{}"', '.', 'format', '(', 'self', '.', 'data', '[', '"uri"', ']', ',', 'self', '.', 'SNMP_CONFIGURATION_PATH', ')', 'return', 'self', '.', '_helper', '.', 'do_get', '(', 'uri', ')']
Gets the SNMP configuration for a logical interconnect. Returns: dict: SNMP configuration.
['Gets', 'the', 'SNMP', 'configuration', 'for', 'a', 'logical', 'interconnect', '.']
train
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L247-L255
7,297
bcbio/bcbio-nextgen
bcbio/variation/genotype.py
variant_filtration
def variant_filtration(call_file, ref_file, vrn_files, data, items): """Filter variant calls using Variant Quality Score Recalibration. Newer GATK with Haplotype calling has combined SNP/indel filtering. """ caller = data["config"]["algorithm"].get("variantcaller") if "gvcf" not in dd.get_tools_on(...
python
def variant_filtration(call_file, ref_file, vrn_files, data, items): """Filter variant calls using Variant Quality Score Recalibration. Newer GATK with Haplotype calling has combined SNP/indel filtering. """ caller = data["config"]["algorithm"].get("variantcaller") if "gvcf" not in dd.get_tools_on(...
['def', 'variant_filtration', '(', 'call_file', ',', 'ref_file', ',', 'vrn_files', ',', 'data', ',', 'items', ')', ':', 'caller', '=', 'data', '[', '"config"', ']', '[', '"algorithm"', ']', '.', 'get', '(', '"variantcaller"', ')', 'if', '"gvcf"', 'not', 'in', 'dd', '.', 'get_tools_on', '(', 'data', ')', ':', 'call_file...
Filter variant calls using Variant Quality Score Recalibration. Newer GATK with Haplotype calling has combined SNP/indel filtering.
['Filter', 'variant', 'calls', 'using', 'Variant', 'Quality', 'Score', 'Recalibration', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L23-L45
7,298
kiwi0fruit/sugartex
sugartex/sugartex_filter.py
SugarTeX._su_scripts_regex
def _su_scripts_regex(self): """ :return: [compiled regex, function] """ sups = re.escape(''.join([k for k in self.superscripts.keys()])) subs = re.escape(''.join([k for k in self.subscripts.keys()])) # language=PythonRegExp su_regex = (r'\\([{su_}])|([{sub}]...
python
def _su_scripts_regex(self): """ :return: [compiled regex, function] """ sups = re.escape(''.join([k for k in self.superscripts.keys()])) subs = re.escape(''.join([k for k in self.subscripts.keys()])) # language=PythonRegExp su_regex = (r'\\([{su_}])|([{sub}]...
['def', '_su_scripts_regex', '(', 'self', ')', ':', 'sups', '=', 're', '.', 'escape', '(', "''", '.', 'join', '(', '[', 'k', 'for', 'k', 'in', 'self', '.', 'superscripts', '.', 'keys', '(', ')', ']', ')', ')', 'subs', '=', 're', '.', 'escape', '(', "''", '.', 'join', '(', '[', 'k', 'for', 'k', 'in', 'self', '.', 'subsc...
:return: [compiled regex, function]
[':', 'return', ':', '[', 'compiled', 'regex', 'function', ']']
train
https://github.com/kiwi0fruit/sugartex/blob/9eb13703cb02d3e2163c9c5f29df280f6bf49cec/sugartex/sugartex_filter.py#L671-L696
7,299
jaraco/irc
irc/features.py
FeatureSet.load
def load(self, arguments): "Load the values from the a ServerConnection arguments" features = arguments[1:-1] list(map(self.load_feature, features))
python
def load(self, arguments): "Load the values from the a ServerConnection arguments" features = arguments[1:-1] list(map(self.load_feature, features))
['def', 'load', '(', 'self', ',', 'arguments', ')', ':', 'features', '=', 'arguments', '[', '1', ':', '-', '1', ']', 'list', '(', 'map', '(', 'self', '.', 'load_feature', ',', 'features', ')', ')']
Load the values from the a ServerConnection arguments
['Load', 'the', 'values', 'from', 'the', 'a', 'ServerConnection', 'arguments']
train
https://github.com/jaraco/irc/blob/571c1f448d5d5bb92bbe2605c33148bf6e698413/irc/features.py#L44-L47