Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
5,600
jeffknupp/sandman2
sandman2/scripts/sandman2ctl.py
main
def main(): """Main entry point for script.""" parser = argparse.ArgumentParser( description='Auto-generate a RESTful API service ' 'from an existing database.' ) parser.add_argument( 'URI', help='Database URI in the format ' 'postgresql+psycopg2://user:p...
python
def main(): """Main entry point for script.""" parser = argparse.ArgumentParser( description='Auto-generate a RESTful API service ' 'from an existing database.' ) parser.add_argument( 'URI', help='Database URI in the format ' 'postgresql+psycopg2://user:p...
['def', 'main', '(', ')', ':', 'parser', '=', 'argparse', '.', 'ArgumentParser', '(', 'description', '=', "'Auto-generate a RESTful API service '", "'from an existing database.'", ')', 'parser', '.', 'add_argument', '(', "'URI'", ',', 'help', '=', "'Database URI in the format '", "'postgresql+psycopg2://user:password@h...
Main entry point for script.
['Main', 'entry', 'point', 'for', 'script', '.']
train
https://github.com/jeffknupp/sandman2/blob/1ce21d6f7a6df77fa96fab694b0f9bb8469c166b/sandman2/scripts/sandman2ctl.py#L9-L59
5,601
BlockHub/slackbot
slackbot/__init__.py
Bot.__parse_direct_mention
def __parse_direct_mention(self, message_text): """ Finds a direct mention (a mention that is at the beginning) in message text and returns the user ID which was mentioned. If there is no direct mention, returns None """ matches = re.search(MENTION_REGEX, message_text) ...
python
def __parse_direct_mention(self, message_text): """ Finds a direct mention (a mention that is at the beginning) in message text and returns the user ID which was mentioned. If there is no direct mention, returns None """ matches = re.search(MENTION_REGEX, message_text) ...
['def', '__parse_direct_mention', '(', 'self', ',', 'message_text', ')', ':', 'matches', '=', 're', '.', 'search', '(', 'MENTION_REGEX', ',', 'message_text', ')', '# the first group contains the username, the second group contains the remaining message', 'return', '(', 'matches', '.', 'group', '(', '1', ')', ',', 'list...
Finds a direct mention (a mention that is at the beginning) in message text and returns the user ID which was mentioned. If there is no direct mention, returns None
['Finds', 'a', 'direct', 'mention', '(', 'a', 'mention', 'that', 'is', 'at', 'the', 'beginning', ')', 'in', 'message', 'text', 'and', 'returns', 'the', 'user', 'ID', 'which', 'was', 'mentioned', '.', 'If', 'there', 'is', 'no', 'direct', 'mention', 'returns', 'None']
train
https://github.com/BlockHub/slackbot/blob/c37201516841cb322b4943f26e432ae717fe36a3/slackbot/__init__.py#L28-L35
5,602
Duke-GCB/DukeDSClient
ddsc/core/ddsapi.py
DataServiceApi.create_activity
def create_activity(self, activity_name, desc=None, started_on=None, ended_on=None): """ Send POST to /activities creating a new activity with the specified name and desc. Raises DataServiceError on error. :param activity_name: str name of the activity :param desc: str descriptio...
python
def create_activity(self, activity_name, desc=None, started_on=None, ended_on=None): """ Send POST to /activities creating a new activity with the specified name and desc. Raises DataServiceError on error. :param activity_name: str name of the activity :param desc: str descriptio...
['def', 'create_activity', '(', 'self', ',', 'activity_name', ',', 'desc', '=', 'None', ',', 'started_on', '=', 'None', ',', 'ended_on', '=', 'None', ')', ':', 'data', '=', '{', '"name"', ':', 'activity_name', ',', '"description"', ':', 'desc', ',', '"started_on"', ':', 'started_on', ',', '"ended_on"', ':', 'ended_on',...
Send POST to /activities creating a new activity with the specified name and desc. Raises DataServiceError on error. :param activity_name: str name of the activity :param desc: str description of the activity (optional) :param started_on: str datetime when the activity started (optional)...
['Send', 'POST', 'to', '/', 'activities', 'creating', 'a', 'new', 'activity', 'with', 'the', 'specified', 'name', 'and', 'desc', '.', 'Raises', 'DataServiceError', 'on', 'error', '.', ':', 'param', 'activity_name', ':', 'str', 'name', 'of', 'the', 'activity', ':', 'param', 'desc', ':', 'str', 'description', 'of', 'the'...
train
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/ddsapi.py#L815-L831
5,603
LogicalDash/LiSE
ELiDE/ELiDE/screen.py
MainScreen.next_turn
def next_turn(self, *args): """Advance time by one turn, if it's not blocked. Block time by setting ``engine.universal['block'] = True``""" if self.tmp_block: return eng = self.app.engine dial = self.dialoglayout if eng.universal.get('block'): Log...
python
def next_turn(self, *args): """Advance time by one turn, if it's not blocked. Block time by setting ``engine.universal['block'] = True``""" if self.tmp_block: return eng = self.app.engine dial = self.dialoglayout if eng.universal.get('block'): Log...
['def', 'next_turn', '(', 'self', ',', '*', 'args', ')', ':', 'if', 'self', '.', 'tmp_block', ':', 'return', 'eng', '=', 'self', '.', 'app', '.', 'engine', 'dial', '=', 'self', '.', 'dialoglayout', 'if', 'eng', '.', 'universal', '.', 'get', '(', "'block'", ')', ':', 'Logger', '.', 'info', '(', '"MainScreen: next_turn b...
Advance time by one turn, if it's not blocked. Block time by setting ``engine.universal['block'] = True``
['Advance', 'time', 'by', 'one', 'turn', 'if', 'it', 's', 'not', 'blocked', '.']
train
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/screen.py#L330-L350
5,604
StanfordVL/robosuite
robosuite/controllers/baxter_ik_controller.py
BaxterIKController.get_control
def get_control(self, right=None, left=None): """ Returns joint velocities to control the robot after the target end effector positions and orientations are updated from arguments @left and @right. If no arguments are provided, joint velocities will be computed based on the prev...
python
def get_control(self, right=None, left=None): """ Returns joint velocities to control the robot after the target end effector positions and orientations are updated from arguments @left and @right. If no arguments are provided, joint velocities will be computed based on the prev...
['def', 'get_control', '(', 'self', ',', 'right', '=', 'None', ',', 'left', '=', 'None', ')', ':', '# Sync joint positions for IK.', 'self', '.', 'sync_ik_robot', '(', 'self', '.', 'robot_jpos_getter', '(', ')', ')', '# Compute new target joint positions if arguments are provided', 'if', '(', 'right', 'is', 'not', 'Non...
Returns joint velocities to control the robot after the target end effector positions and orientations are updated from arguments @left and @right. If no arguments are provided, joint velocities will be computed based on the previously recorded target. Args: left (dict): A ...
['Returns', 'joint', 'velocities', 'to', 'control', 'the', 'robot', 'after', 'the', 'target', 'end', 'effector', 'positions', 'and', 'orientations', 'are', 'updated', 'from', 'arguments', '@left', 'and', '@right', '.', 'If', 'no', 'arguments', 'are', 'provided', 'joint', 'velocities', 'will', 'be', 'computed', 'based',...
train
https://github.com/StanfordVL/robosuite/blob/65cd16810e2ed647e3ec88746af3412065b7f278/robosuite/controllers/baxter_ik_controller.py#L46-L96
5,605
wright-group/WrightTools
WrightTools/kit/_list.py
intersperse
def intersperse(lis, value): """Put value between each existing item in list. Parameters ---------- lis : list List to intersperse. value : object Value to insert. Returns ------- list interspersed list """ out = [value] * (len(lis) * 2 - 1) out[0::2...
python
def intersperse(lis, value): """Put value between each existing item in list. Parameters ---------- lis : list List to intersperse. value : object Value to insert. Returns ------- list interspersed list """ out = [value] * (len(lis) * 2 - 1) out[0::2...
['def', 'intersperse', '(', 'lis', ',', 'value', ')', ':', 'out', '=', '[', 'value', ']', '*', '(', 'len', '(', 'lis', ')', '*', '2', '-', '1', ')', 'out', '[', '0', ':', ':', '2', ']', '=', 'lis', 'return', 'out']
Put value between each existing item in list. Parameters ---------- lis : list List to intersperse. value : object Value to insert. Returns ------- list interspersed list
['Put', 'value', 'between', 'each', 'existing', 'item', 'in', 'list', '.']
train
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_list.py#L55-L72
5,606
WebarchivCZ/WA-KAT
src/wa_kat/templates/static/js/Lib/site-packages/wa_kat_main.py
AnalysisRunnerAdapter.start
def start(cls, ev=None): """ Start the analysis. """ ViewController.log_view.add("Beginning AnalysisRunner request..") # reset all inputs ViewController.reset_bars() # read the urlbox url = ViewController.url.strip() # make sure, that `url` was ...
python
def start(cls, ev=None): """ Start the analysis. """ ViewController.log_view.add("Beginning AnalysisRunner request..") # reset all inputs ViewController.reset_bars() # read the urlbox url = ViewController.url.strip() # make sure, that `url` was ...
['def', 'start', '(', 'cls', ',', 'ev', '=', 'None', ')', ':', 'ViewController', '.', 'log_view', '.', 'add', '(', '"Beginning AnalysisRunner request.."', ')', '# reset all inputs', 'ViewController', '.', 'reset_bars', '(', ')', '# read the urlbox', 'url', '=', 'ViewController', '.', 'url', '.', 'strip', '(', ')', '# m...
Start the analysis.
['Start', 'the', 'analysis', '.']
train
https://github.com/WebarchivCZ/WA-KAT/blob/16d064a3a775dc1d2713debda7847ded52dd2a06/src/wa_kat/templates/static/js/Lib/site-packages/wa_kat_main.py#L118-L153
5,607
google-research/batch-ppo
agents/algorithms/ppo/ppo.py
PPO._policy_loss
def _policy_loss( self, old_policy, policy, action, advantage, length): """Compute the policy loss composed of multiple components. 1. The policy gradient loss is importance sampled from the data-collecting policy at the beginning of training. 2. The second term is a KL penalty between the pol...
python
def _policy_loss( self, old_policy, policy, action, advantage, length): """Compute the policy loss composed of multiple components. 1. The policy gradient loss is importance sampled from the data-collecting policy at the beginning of training. 2. The second term is a KL penalty between the pol...
['def', '_policy_loss', '(', 'self', ',', 'old_policy', ',', 'policy', ',', 'action', ',', 'advantage', ',', 'length', ')', ':', 'with', 'tf', '.', 'name_scope', '(', "'policy_loss'", ')', ':', 'kl', '=', 'tf', '.', 'contrib', '.', 'distributions', '.', 'kl_divergence', '(', 'old_policy', ',', 'policy', ')', '# Infinit...
Compute the policy loss composed of multiple components. 1. The policy gradient loss is importance sampled from the data-collecting policy at the beginning of training. 2. The second term is a KL penalty between the policy at the beginning of training and the current policy. 3. Additionally, ...
['Compute', 'the', 'policy', 'loss', 'composed', 'of', 'multiple', 'components', '.']
train
https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/algorithms/ppo/ppo.py#L443-L503
5,608
greenbender/python-fifo
fifo/__init__.py
Fifo.peekuntil
def peekuntil(self, token, size=0): """ Peeks for token into the FIFO. Performs the same function as readuntil() without removing data from the FIFO. See readuntil() for further information. """ self.__append() i = self.buf.find(token, self.pos) if i < 0...
python
def peekuntil(self, token, size=0): """ Peeks for token into the FIFO. Performs the same function as readuntil() without removing data from the FIFO. See readuntil() for further information. """ self.__append() i = self.buf.find(token, self.pos) if i < 0...
['def', 'peekuntil', '(', 'self', ',', 'token', ',', 'size', '=', '0', ')', ':', 'self', '.', '__append', '(', ')', 'i', '=', 'self', '.', 'buf', '.', 'find', '(', 'token', ',', 'self', '.', 'pos', ')', 'if', 'i', '<', '0', ':', 'index', '=', 'max', '(', 'len', '(', 'token', ')', '-', '1', ',', 'size', ')', 'newpos', '...
Peeks for token into the FIFO. Performs the same function as readuntil() without removing data from the FIFO. See readuntil() for further information.
['Peeks', 'for', 'token', 'into', 'the', 'FIFO', '.']
train
https://github.com/greenbender/python-fifo/blob/ffabb6c8b844086dd3a490d0b42bbb5aa8fbb932/fifo/__init__.py#L216-L232
5,609
bioidiap/gridtk
gridtk/manager.py
JobManager._create
def _create(self): """Creates a new and empty database.""" from .tools import makedirs_safe # create directory for sql database makedirs_safe(os.path.dirname(self._database)) # create all the tables Base.metadata.create_all(self._engine) logger.debug("Created new empty database '%s'" % sel...
python
def _create(self): """Creates a new and empty database.""" from .tools import makedirs_safe # create directory for sql database makedirs_safe(os.path.dirname(self._database)) # create all the tables Base.metadata.create_all(self._engine) logger.debug("Created new empty database '%s'" % sel...
['def', '_create', '(', 'self', ')', ':', 'from', '.', 'tools', 'import', 'makedirs_safe', '# create directory for sql database', 'makedirs_safe', '(', 'os', '.', 'path', '.', 'dirname', '(', 'self', '.', '_database', ')', ')', '# create all the tables', 'Base', '.', 'metadata', '.', 'create_all', '(', 'self', '.', '_e...
Creates a new and empty database.
['Creates', 'a', 'new', 'and', 'empty', 'database', '.']
train
https://github.com/bioidiap/gridtk/blob/9e3291b8b50388682908927231b2730db1da147d/gridtk/manager.py#L97-L106
5,610
pantsbuild/pants
src/python/pants/engine/struct.py
Struct.kwargs
def kwargs(self): """Returns a dict of the kwargs for this Struct which were not interpreted by the baseclass. This excludes fields like `extends`, `merges`, and `abstract`, which are consumed by SerializableFactory.create and Validatable.validate. """ return {k: v for k, v in self._kwargs.items() ...
python
def kwargs(self): """Returns a dict of the kwargs for this Struct which were not interpreted by the baseclass. This excludes fields like `extends`, `merges`, and `abstract`, which are consumed by SerializableFactory.create and Validatable.validate. """ return {k: v for k, v in self._kwargs.items() ...
['def', 'kwargs', '(', 'self', ')', ':', 'return', '{', 'k', ':', 'v', 'for', 'k', ',', 'v', 'in', 'self', '.', '_kwargs', '.', 'items', '(', ')', 'if', 'k', 'not', 'in', 'self', '.', '_INTERNAL_FIELDS', '}']
Returns a dict of the kwargs for this Struct which were not interpreted by the baseclass. This excludes fields like `extends`, `merges`, and `abstract`, which are consumed by SerializableFactory.create and Validatable.validate.
['Returns', 'a', 'dict', 'of', 'the', 'kwargs', 'for', 'this', 'Struct', 'which', 'were', 'not', 'interpreted', 'by', 'the', 'baseclass', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/engine/struct.py#L95-L101
5,611
pyviz/holoviews
holoviews/core/tree.py
AttrTree._propagate
def _propagate(self, path, val): """ Propagate the value up to the root node. """ if val == '_DELETE': if path in self.data: del self.data[path] else: items = [(key, v) for key, v in self.data.items() if not...
python
def _propagate(self, path, val): """ Propagate the value up to the root node. """ if val == '_DELETE': if path in self.data: del self.data[path] else: items = [(key, v) for key, v in self.data.items() if not...
['def', '_propagate', '(', 'self', ',', 'path', ',', 'val', ')', ':', 'if', 'val', '==', "'_DELETE'", ':', 'if', 'path', 'in', 'self', '.', 'data', ':', 'del', 'self', '.', 'data', '[', 'path', ']', 'else', ':', 'items', '=', '[', '(', 'key', ',', 'v', ')', 'for', 'key', ',', 'v', 'in', 'self', '.', 'data', '.', 'items...
Propagate the value up to the root node.
['Propagate', 'the', 'value', 'up', 'to', 'the', 'root', 'node', '.']
train
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L146-L160
5,612
StackStorm/pybind
pybind/nos/v6_0_2f/interface/fortygigabitethernet/ipv6/ipv6_config/address/__init__.py
address._set_ipv6_address
def _set_ipv6_address(self, v, load=False): """ Setter method for ipv6_address, mapped from YANG variable /interface/fortygigabitethernet/ipv6/ipv6_config/address/ipv6_address (list) If this variable is read-only (config: false) in the source YANG file, then _set_ipv6_address is considered as a private ...
python
def _set_ipv6_address(self, v, load=False): """ Setter method for ipv6_address, mapped from YANG variable /interface/fortygigabitethernet/ipv6/ipv6_config/address/ipv6_address (list) If this variable is read-only (config: false) in the source YANG file, then _set_ipv6_address is considered as a private ...
['def', '_set_ipv6_address', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'YANGListType', '(', '"address"', ',', 'ipv6_address', '.', 'ipv6_...
Setter method for ipv6_address, mapped from YANG variable /interface/fortygigabitethernet/ipv6/ipv6_config/address/ipv6_address (list) If this variable is read-only (config: false) in the source YANG file, then _set_ipv6_address is considered as a private method. Backends looking to populate this variable s...
['Setter', 'method', 'for', 'ipv6_address', 'mapped', 'from', 'YANG', 'variable', '/', 'interface', '/', 'fortygigabitethernet', '/', 'ipv6', '/', 'ipv6_config', '/', 'address', '/', 'ipv6_address', '(', 'list', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'so...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/interface/fortygigabitethernet/ipv6/ipv6_config/address/__init__.py#L161-L182
5,613
DataONEorg/d1_python
lib_client/src/d1_client/cnclient.py
CoordinatingNodeClient.setObsoletedBy
def setObsoletedBy(self, pid, obsoletedByPid, serialVersion, vendorSpecific=None): """See Also: setObsoletedByResponse() Args: pid: obsoletedByPid: serialVersion: vendorSpecific: Returns: """ response = self.setObsoletedByResponse( ...
python
def setObsoletedBy(self, pid, obsoletedByPid, serialVersion, vendorSpecific=None): """See Also: setObsoletedByResponse() Args: pid: obsoletedByPid: serialVersion: vendorSpecific: Returns: """ response = self.setObsoletedByResponse( ...
['def', 'setObsoletedBy', '(', 'self', ',', 'pid', ',', 'obsoletedByPid', ',', 'serialVersion', ',', 'vendorSpecific', '=', 'None', ')', ':', 'response', '=', 'self', '.', 'setObsoletedByResponse', '(', 'pid', ',', 'obsoletedByPid', ',', 'serialVersion', ',', 'vendorSpecific', ')', 'return', 'self', '.', '_read_boolean...
See Also: setObsoletedByResponse() Args: pid: obsoletedByPid: serialVersion: vendorSpecific: Returns:
['See', 'Also', ':', 'setObsoletedByResponse', '()']
train
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_client/src/d1_client/cnclient.py#L192-L207
5,614
CalebBell/fluids
fluids/fittings.py
entrance_beveled
def entrance_beveled(Di, l, angle, method='Rennels'): r'''Returns loss coefficient for a beveled or chamfered entrance to a pipe flush with the wall of a reservoir. This calculation has two methods available. The 'Rennels' and 'Idelchik' methods have similar trends, but the 'Rennels' formulatio...
python
def entrance_beveled(Di, l, angle, method='Rennels'): r'''Returns loss coefficient for a beveled or chamfered entrance to a pipe flush with the wall of a reservoir. This calculation has two methods available. The 'Rennels' and 'Idelchik' methods have similar trends, but the 'Rennels' formulatio...
['def', 'entrance_beveled', '(', 'Di', ',', 'l', ',', 'angle', ',', 'method', '=', "'Rennels'", ')', ':', 'if', 'method', 'is', 'None', ':', 'method', '=', "'Rennels'", 'if', 'method', '==', "'Rennels'", ':', 'Cb', '=', '(', '1', '-', 'angle', '/', '90.', ')', '*', '(', 'angle', '/', '90.', ')', '**', '(', '1.', '/', '...
r'''Returns loss coefficient for a beveled or chamfered entrance to a pipe flush with the wall of a reservoir. This calculation has two methods available. The 'Rennels' and 'Idelchik' methods have similar trends, but the 'Rennels' formulation is centered around a straight loss coefficient of 0.57, ...
['r', 'Returns', 'loss', 'coefficient', 'for', 'a', 'beveled', 'or', 'chamfered', 'entrance', 'to', 'a', 'pipe', 'flush', 'with', 'the', 'wall', 'of', 'a', 'reservoir', '.', 'This', 'calculation', 'has', 'two', 'methods', 'available', '.', 'The', 'Rennels', 'and', 'Idelchik', 'methods', 'have', 'similar', 'trends', 'bu...
train
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/fittings.py#L654-L733
5,615
gwastro/pycbc
pycbc/waveform/waveform.py
get_waveform_end_frequency
def get_waveform_end_frequency(template=None, **kwargs): """Return the stop frequency of a template """ input_params = props(template,**kwargs) approximant = kwargs['approximant'] if approximant in _filter_ends: return _filter_ends[approximant](**input_params) else: return None
python
def get_waveform_end_frequency(template=None, **kwargs): """Return the stop frequency of a template """ input_params = props(template,**kwargs) approximant = kwargs['approximant'] if approximant in _filter_ends: return _filter_ends[approximant](**input_params) else: return None
['def', 'get_waveform_end_frequency', '(', 'template', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'input_params', '=', 'props', '(', 'template', ',', '*', '*', 'kwargs', ')', 'approximant', '=', 'kwargs', '[', "'approximant'", ']', 'if', 'approximant', 'in', '_filter_ends', ':', 'return', '_filter_ends', '[', 'app...
Return the stop frequency of a template
['Return', 'the', 'stop', 'frequency', 'of', 'a', 'template']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/waveform/waveform.py#L1052-L1061
5,616
remind101/stacker_blueprints
stacker_blueprints/empire/policies.py
logstream_policy
def logstream_policy(): """Policy needed for logspout -> kinesis log streaming.""" p = Policy( Statement=[ Statement( Effect=Allow, Resource=["*"], Action=[ kinesis.CreateStream, kinesis.DescribeStream, A...
python
def logstream_policy(): """Policy needed for logspout -> kinesis log streaming.""" p = Policy( Statement=[ Statement( Effect=Allow, Resource=["*"], Action=[ kinesis.CreateStream, kinesis.DescribeStream, A...
['def', 'logstream_policy', '(', ')', ':', 'p', '=', 'Policy', '(', 'Statement', '=', '[', 'Statement', '(', 'Effect', '=', 'Allow', ',', 'Resource', '=', '[', '"*"', ']', ',', 'Action', '=', '[', 'kinesis', '.', 'CreateStream', ',', 'kinesis', '.', 'DescribeStream', ',', 'Action', '(', 'kinesis', '.', 'prefix', ',', '...
Policy needed for logspout -> kinesis log streaming.
['Policy', 'needed', 'for', 'logspout', '-', '>', 'kinesis', 'log', 'streaming', '.']
train
https://github.com/remind101/stacker_blueprints/blob/71624f6e1bd4ea794dc98fb621a04235e1931cae/stacker_blueprints/empire/policies.py#L245-L257
5,617
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
SearchForwardMiniApplet.qteAbort
def qteAbort(self, msgObj): """ Restore the original cursor position because the user hit abort. """ self.qteWidget.setCursorPosition(*self.cursorPosOrig) self.qteMain.qtesigAbort.disconnect(self.qteAbort)
python
def qteAbort(self, msgObj): """ Restore the original cursor position because the user hit abort. """ self.qteWidget.setCursorPosition(*self.cursorPosOrig) self.qteMain.qtesigAbort.disconnect(self.qteAbort)
['def', 'qteAbort', '(', 'self', ',', 'msgObj', ')', ':', 'self', '.', 'qteWidget', '.', 'setCursorPosition', '(', '*', 'self', '.', 'cursorPosOrig', ')', 'self', '.', 'qteMain', '.', 'qtesigAbort', '.', 'disconnect', '(', 'self', '.', 'qteAbort', ')']
Restore the original cursor position because the user hit abort.
['Restore', 'the', 'original', 'cursor', 'position', 'because', 'the', 'user', 'hit', 'abort', '.']
train
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1581-L1586
5,618
radjkarl/fancyTools
fancytools/geometry/polylines.py
separate
def separate(polylines, f_mx_dist=2, mn_group_len=4): """ split polylines wherever crinkles are found """ s = [] for n in range(len(polylines) - 1, -1, -1): c = polylines[n] separated = False start = 0 for m in range(mn_group_len, len(c) - 1): if m - sta...
python
def separate(polylines, f_mx_dist=2, mn_group_len=4): """ split polylines wherever crinkles are found """ s = [] for n in range(len(polylines) - 1, -1, -1): c = polylines[n] separated = False start = 0 for m in range(mn_group_len, len(c) - 1): if m - sta...
['def', 'separate', '(', 'polylines', ',', 'f_mx_dist', '=', '2', ',', 'mn_group_len', '=', '4', ')', ':', 's', '=', '[', ']', 'for', 'n', 'in', 'range', '(', 'len', '(', 'polylines', ')', '-', '1', ',', '-', '1', ',', '-', '1', ')', ':', 'c', '=', 'polylines', '[', 'n', ']', 'separated', '=', 'False', 'start', '=', '0...
split polylines wherever crinkles are found
['split', 'polylines', 'wherever', 'crinkles', 'are', 'found']
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/geometry/polylines.py#L94-L133
5,619
saltstack/salt
salt/utils/network.py
mac2eui64
def mac2eui64(mac, prefix=None): ''' Convert a MAC address to a EUI64 identifier or, with prefix provided, a full IPv6 address ''' # http://tools.ietf.org/html/rfc4291#section-2.5.1 eui64 = re.sub(r'[.:-]', '', mac).lower() eui64 = eui64[0:6] + 'fffe' + eui64[6:] eui64 = hex(int(eui64[0:...
python
def mac2eui64(mac, prefix=None): ''' Convert a MAC address to a EUI64 identifier or, with prefix provided, a full IPv6 address ''' # http://tools.ietf.org/html/rfc4291#section-2.5.1 eui64 = re.sub(r'[.:-]', '', mac).lower() eui64 = eui64[0:6] + 'fffe' + eui64[6:] eui64 = hex(int(eui64[0:...
['def', 'mac2eui64', '(', 'mac', ',', 'prefix', '=', 'None', ')', ':', '# http://tools.ietf.org/html/rfc4291#section-2.5.1', 'eui64', '=', 're', '.', 'sub', '(', "r'[.:-]'", ',', "''", ',', 'mac', ')', '.', 'lower', '(', ')', 'eui64', '=', 'eui64', '[', '0', ':', '6', ']', '+', "'fffe'", '+', 'eui64', '[', '6', ':', ']...
Convert a MAC address to a EUI64 identifier or, with prefix provided, a full IPv6 address
['Convert', 'a', 'MAC', 'address', 'to', 'a', 'EUI64', 'identifier', 'or', 'with', 'prefix', 'provided', 'a', 'full', 'IPv6', 'address']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1343-L1361
5,620
resonai/ybt
yabt/builders/cpp.py
get_source_files
def get_source_files(target, build_context) -> list: """Return list of source files for `target`.""" all_sources = list(target.props.sources) for proto_dep_name in target.props.protos: proto_dep = build_context.targets[proto_dep_name] all_sources.extend(proto_dep.artifacts.get(AT.gen_cc).key...
python
def get_source_files(target, build_context) -> list: """Return list of source files for `target`.""" all_sources = list(target.props.sources) for proto_dep_name in target.props.protos: proto_dep = build_context.targets[proto_dep_name] all_sources.extend(proto_dep.artifacts.get(AT.gen_cc).key...
['def', 'get_source_files', '(', 'target', ',', 'build_context', ')', '->', 'list', ':', 'all_sources', '=', 'list', '(', 'target', '.', 'props', '.', 'sources', ')', 'for', 'proto_dep_name', 'in', 'target', '.', 'props', '.', 'protos', ':', 'proto_dep', '=', 'build_context', '.', 'targets', '[', 'proto_dep_name', ']',...
Return list of source files for `target`.
['Return', 'list', 'of', 'source', 'files', 'for', 'target', '.']
train
https://github.com/resonai/ybt/blob/5b40df0922ef3383eb85f2b04a26a2db4b81b3fd/yabt/builders/cpp.py#L307-L313
5,621
Esri/ArcREST
src/arcrest/manageags/_system.py
System.registerWebAdaptor
def registerWebAdaptor(self, webAdaptorURL, machineName, machineIP, isAdminEnabled, description, httpPort, httpsPort): """ You can use this operation to register the ArcGIS Web Adaptor from your ArcGIS Server. By registering the Web Adaptor with the server, yo...
python
def registerWebAdaptor(self, webAdaptorURL, machineName, machineIP, isAdminEnabled, description, httpPort, httpsPort): """ You can use this operation to register the ArcGIS Web Adaptor from your ArcGIS Server. By registering the Web Adaptor with the server, yo...
['def', 'registerWebAdaptor', '(', 'self', ',', 'webAdaptorURL', ',', 'machineName', ',', 'machineIP', ',', 'isAdminEnabled', ',', 'description', ',', 'httpPort', ',', 'httpsPort', ')', ':', 'url', '=', 'self', '.', '_url', '+', '"/webadaptors/register"', 'params', '=', '{', '"f"', ':', '"json"', ',', '"webAdaptorURL"'...
You can use this operation to register the ArcGIS Web Adaptor from your ArcGIS Server. By registering the Web Adaptor with the server, you are telling the server to trust requests (including security credentials) that have been submitted through this Web Adaptor. Inputs: w...
['You', 'can', 'use', 'this', 'operation', 'to', 'register', 'the', 'ArcGIS', 'Web', 'Adaptor', 'from', 'your', 'ArcGIS', 'Server', '.', 'By', 'registering', 'the', 'Web', 'Adaptor', 'with', 'the', 'server', 'you', 'are', 'telling', 'the', 'server', 'to', 'trust', 'requests', '(', 'including', 'security', 'credentials'...
train
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_system.py#L285-L325
5,622
valerymelou/django-active-link
active_link/templatetags/active_link_tags.py
active_link
def active_link(context, viewnames, css_class=None, strict=None, *args, **kwargs): """ Renders the given CSS class if the request path matches the path of the view. :param context: The context where the tag was called. Used to access the request object. :param viewnames: The name of the view or views se...
python
def active_link(context, viewnames, css_class=None, strict=None, *args, **kwargs): """ Renders the given CSS class if the request path matches the path of the view. :param context: The context where the tag was called. Used to access the request object. :param viewnames: The name of the view or views se...
['def', 'active_link', '(', 'context', ',', 'viewnames', ',', 'css_class', '=', 'None', ',', 'strict', '=', 'None', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'css_class', 'is', 'None', ':', 'css_class', '=', 'getattr', '(', 'settings', ',', "'ACTIVE_LINK_CSS_CLASS'", ',', "'active'", ')', 'if', 'strict...
Renders the given CSS class if the request path matches the path of the view. :param context: The context where the tag was called. Used to access the request object. :param viewnames: The name of the view or views separated by || (include namespaces if any). :param css_class: The CSS class to render. :...
['Renders', 'the', 'given', 'CSS', 'class', 'if', 'the', 'request', 'path', 'matches', 'the', 'path', 'of', 'the', 'view', '.', ':', 'param', 'context', ':', 'The', 'context', 'where', 'the', 'tag', 'was', 'called', '.', 'Used', 'to', 'access', 'the', 'request', 'object', '.', ':', 'param', 'viewnames', ':', 'The', 'na...
train
https://github.com/valerymelou/django-active-link/blob/4791e7af2fb6d77d3ef2a3f3be0241b5c3019beb/active_link/templatetags/active_link_tags.py#L14-L48
5,623
ipfs/py-ipfs-api
ipfsapi/client.py
Client.files_rm
def files_rm(self, path, recursive=False, **kwargs): """Removes a file from the MFS. .. code-block:: python >>> c.files_rm("/bla/file") b'' Parameters ---------- path : str Filepath within the MFS recursive : bool Recursi...
python
def files_rm(self, path, recursive=False, **kwargs): """Removes a file from the MFS. .. code-block:: python >>> c.files_rm("/bla/file") b'' Parameters ---------- path : str Filepath within the MFS recursive : bool Recursi...
['def', 'files_rm', '(', 'self', ',', 'path', ',', 'recursive', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '.', 'setdefault', '(', '"opts"', ',', '{', '"recursive"', ':', 'recursive', '}', ')', 'args', '=', '(', 'path', ',', ')', 'return', 'self', '.', '_client', '.', 'request', '(', "'/files/rm'", ',',...
Removes a file from the MFS. .. code-block:: python >>> c.files_rm("/bla/file") b'' Parameters ---------- path : str Filepath within the MFS recursive : bool Recursively remove directories?
['Removes', 'a', 'file', 'from', 'the', 'MFS', '.']
train
https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1989-L2007
5,624
mcieslik-mctp/papy
src/papy/core.py
_TeePiper.next
def next(self): """ (internal) returns the next result from the ``itertools.tee`` object for the wrapped ``Piper`` instance or re-raises an ``Exception``. """ # do not acquire lock if NuMap is not finished. if self.finished: raise StopIteration ...
python
def next(self): """ (internal) returns the next result from the ``itertools.tee`` object for the wrapped ``Piper`` instance or re-raises an ``Exception``. """ # do not acquire lock if NuMap is not finished. if self.finished: raise StopIteration ...
['def', 'next', '(', 'self', ')', ':', '# do not acquire lock if NuMap is not finished.', 'if', 'self', '.', 'finished', ':', 'raise', 'StopIteration', '# get per-tee lock', 'self', '.', 'piper', '.', 'tee_locks', '[', 'self', '.', 'i', ']', '.', 'acquire', '(', ')', '# get result or exception', 'exception', '=', 'True...
(internal) returns the next result from the ``itertools.tee`` object for the wrapped ``Piper`` instance or re-raises an ``Exception``.
['(', 'internal', ')', 'returns', 'the', 'next', 'result', 'from', 'the', 'itertools', '.', 'tee', 'object', 'for', 'the', 'wrapped', 'Piper', 'instance', 'or', 're', '-', 'raises', 'an', 'Exception', '.']
train
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/papy/core.py#L1728-L1759
5,625
saltstack/salt
salt/modules/debuild_pkgbuild.py
_get_src
def _get_src(tree_base, source, saltenv='base'): ''' Get the named sources and place them into the tree_base ''' parsed = _urlparse(source) sbase = os.path.basename(source) dest = os.path.join(tree_base, sbase) if parsed.scheme: __salt__['cp.get_url'](source, dest, saltenv=saltenv) ...
python
def _get_src(tree_base, source, saltenv='base'): ''' Get the named sources and place them into the tree_base ''' parsed = _urlparse(source) sbase = os.path.basename(source) dest = os.path.join(tree_base, sbase) if parsed.scheme: __salt__['cp.get_url'](source, dest, saltenv=saltenv) ...
['def', '_get_src', '(', 'tree_base', ',', 'source', ',', 'saltenv', '=', "'base'", ')', ':', 'parsed', '=', '_urlparse', '(', 'source', ')', 'sbase', '=', 'os', '.', 'path', '.', 'basename', '(', 'source', ')', 'dest', '=', 'os', '.', 'path', '.', 'join', '(', 'tree_base', ',', 'sbase', ')', 'if', 'parsed', '.', 'sche...
Get the named sources and place them into the tree_base
['Get', 'the', 'named', 'sources', 'and', 'place', 'them', 'into', 'the', 'tree_base']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debuild_pkgbuild.py#L305-L315
5,626
ayust/kitnirc
skeleton/main.py
initialize_logging
def initialize_logging(args): """Configure the root logger with some sensible defaults.""" log_handler = logging.StreamHandler() log_formatter = logging.Formatter( "%(levelname)s %(asctime)s %(name)s:%(lineno)04d - %(message)s") log_handler.setFormatter(log_formatter) root_logger = logging....
python
def initialize_logging(args): """Configure the root logger with some sensible defaults.""" log_handler = logging.StreamHandler() log_formatter = logging.Formatter( "%(levelname)s %(asctime)s %(name)s:%(lineno)04d - %(message)s") log_handler.setFormatter(log_formatter) root_logger = logging....
['def', 'initialize_logging', '(', 'args', ')', ':', 'log_handler', '=', 'logging', '.', 'StreamHandler', '(', ')', 'log_formatter', '=', 'logging', '.', 'Formatter', '(', '"%(levelname)s %(asctime)s %(name)s:%(lineno)04d - %(message)s"', ')', 'log_handler', '.', 'setFormatter', '(', 'log_formatter', ')', 'root_logger'...
Configure the root logger with some sensible defaults.
['Configure', 'the', 'root', 'logger', 'with', 'some', 'sensible', 'defaults', '.']
train
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/skeleton/main.py#L38-L47
5,627
googleapis/google-cloud-python
datastore/google/cloud/datastore/batch.py
Batch._add_partial_key_entity_pb
def _add_partial_key_entity_pb(self): """Adds a new mutation for an entity with a partial key. :rtype: :class:`.entity_pb2.Entity` :returns: The newly created entity protobuf that will be updated and sent with a commit. """ new_mutation = _datastore_pb2.Mutatio...
python
def _add_partial_key_entity_pb(self): """Adds a new mutation for an entity with a partial key. :rtype: :class:`.entity_pb2.Entity` :returns: The newly created entity protobuf that will be updated and sent with a commit. """ new_mutation = _datastore_pb2.Mutatio...
['def', '_add_partial_key_entity_pb', '(', 'self', ')', ':', 'new_mutation', '=', '_datastore_pb2', '.', 'Mutation', '(', ')', 'self', '.', '_mutations', '.', 'append', '(', 'new_mutation', ')', 'return', 'new_mutation', '.', 'insert']
Adds a new mutation for an entity with a partial key. :rtype: :class:`.entity_pb2.Entity` :returns: The newly created entity protobuf that will be updated and sent with a commit.
['Adds', 'a', 'new', 'mutation', 'for', 'an', 'entity', 'with', 'a', 'partial', 'key', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/batch.py#L107-L116
5,628
pywavefront/PyWavefront
pywavefront/material.py
MaterialParser.parse_map_Ks
def parse_map_Ks(self): """Specular color map""" Kd = os.path.join(self.dir, " ".join(self.values[1:])) self.this_material.set_texture_specular_color(Kd)
python
def parse_map_Ks(self): """Specular color map""" Kd = os.path.join(self.dir, " ".join(self.values[1:])) self.this_material.set_texture_specular_color(Kd)
['def', 'parse_map_Ks', '(', 'self', ')', ':', 'Kd', '=', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'dir', ',', '" "', '.', 'join', '(', 'self', '.', 'values', '[', '1', ':', ']', ')', ')', 'self', '.', 'this_material', '.', 'set_texture_specular_color', '(', 'Kd', ')']
Specular color map
['Specular', 'color', 'map']
train
https://github.com/pywavefront/PyWavefront/blob/39ee5186cb37750d4654d19ebe43f723ecd01e2f/pywavefront/material.py#L223-L226
5,629
Erotemic/utool
utool/util_grabdata.py
grab_selenium_driver
def grab_selenium_driver(driver_name=None): """ pip install selenium -U """ from selenium import webdriver if driver_name is None: driver_name = 'firefox' if driver_name.lower() == 'chrome': grab_selenium_chromedriver() return webdriver.Chrome() elif driver_name.lower...
python
def grab_selenium_driver(driver_name=None): """ pip install selenium -U """ from selenium import webdriver if driver_name is None: driver_name = 'firefox' if driver_name.lower() == 'chrome': grab_selenium_chromedriver() return webdriver.Chrome() elif driver_name.lower...
['def', 'grab_selenium_driver', '(', 'driver_name', '=', 'None', ')', ':', 'from', 'selenium', 'import', 'webdriver', 'if', 'driver_name', 'is', 'None', ':', 'driver_name', '=', "'firefox'", 'if', 'driver_name', '.', 'lower', '(', ')', '==', "'chrome'", ':', 'grab_selenium_chromedriver', '(', ')', 'return', 'webdriver'...
pip install selenium -U
['pip', 'install', 'selenium', '-', 'U']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_grabdata.py#L678-L692
5,630
StackStorm/pybind
pybind/nos/v6_0_2f/port_profile/__init__.py
port_profile._set_security_profile
def _set_security_profile(self, v, load=False): """ Setter method for security_profile, mapped from YANG variable /port_profile/security_profile (container) If this variable is read-only (config: false) in the source YANG file, then _set_security_profile is considered as a private method. Backends l...
python
def _set_security_profile(self, v, load=False): """ Setter method for security_profile, mapped from YANG variable /port_profile/security_profile (container) If this variable is read-only (config: false) in the source YANG file, then _set_security_profile is considered as a private method. Backends l...
['def', '_set_security_profile', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'security_profile', '.', 'security_profile', ',', 'is_containe...
Setter method for security_profile, mapped from YANG variable /port_profile/security_profile (container) If this variable is read-only (config: false) in the source YANG file, then _set_security_profile is considered as a private method. Backends looking to populate this variable should do so via callin...
['Setter', 'method', 'for', 'security_profile', 'mapped', 'from', 'YANG', 'variable', '/', 'port_profile', '/', 'security_profile', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_security_profile', 'is', ...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/port_profile/__init__.py#L298-L321
5,631
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.iterkeys
def iterkeys(self, key_type=None, return_all_keys=False): """ Returns an iterator over the dictionary's keys. @param key_type if specified, iterator for a dictionary of this type will be used. Otherwise (if not specified) tuples containing all (multiple) keys ...
python
def iterkeys(self, key_type=None, return_all_keys=False): """ Returns an iterator over the dictionary's keys. @param key_type if specified, iterator for a dictionary of this type will be used. Otherwise (if not specified) tuples containing all (multiple) keys ...
['def', 'iterkeys', '(', 'self', ',', 'key_type', '=', 'None', ',', 'return_all_keys', '=', 'False', ')', ':', 'if', '(', 'key_type', 'is', 'not', 'None', ')', ':', 'the_key', '=', 'str', '(', 'key_type', ')', 'if', 'the_key', 'in', 'self', '.', '__dict__', ':', 'for', 'key', 'in', 'self', '.', '__dict__', '[', 'the_ke...
Returns an iterator over the dictionary's keys. @param key_type if specified, iterator for a dictionary of this type will be used. Otherwise (if not specified) tuples containing all (multiple) keys for this dictionary will be generated. @param return_al...
['Returns', 'an', 'iterator', 'over', 'the', 'dictionary', 's', 'keys', '.']
train
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L201-L217
5,632
awslabs/sockeye
sockeye/encoder.py
Embedding.encode
def encode(self, data: mx.sym.Symbol, data_length: Optional[mx.sym.Symbol], seq_len: int) -> Tuple[mx.sym.Symbol, mx.sym.Symbol, int]: """ Encodes data given sequence lengths of individual examples and maximum sequence length. :param data: Input data...
python
def encode(self, data: mx.sym.Symbol, data_length: Optional[mx.sym.Symbol], seq_len: int) -> Tuple[mx.sym.Symbol, mx.sym.Symbol, int]: """ Encodes data given sequence lengths of individual examples and maximum sequence length. :param data: Input data...
['def', 'encode', '(', 'self', ',', 'data', ':', 'mx', '.', 'sym', '.', 'Symbol', ',', 'data_length', ':', 'Optional', '[', 'mx', '.', 'sym', '.', 'Symbol', ']', ',', 'seq_len', ':', 'int', ')', '->', 'Tuple', '[', 'mx', '.', 'sym', '.', 'Symbol', ',', 'mx', '.', 'sym', '.', 'Symbol', ',', 'int', ']', ':', 'factor_embe...
Encodes data given sequence lengths of individual examples and maximum sequence length. :param data: Input data. :param data_length: Vector with sequence lengths. :param seq_len: Maximum sequence length. :return: Encoded versions of input data (data, data_length, seq_len).
['Encodes', 'data', 'given', 'sequence', 'lengths', 'of', 'individual', 'examples', 'and', 'maximum', 'sequence', 'length', '.']
train
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/encoder.py#L387-L431
5,633
OnroerendErfgoed/language-tags
language_tags/Tag.py
Tag.errors
def errors(self): """ Get the errors of the tag. If invalid then the list will consist of errors containing each a code and message explaining the error. Each error also refers to the respective (sub)tag(s). :return: list of errors of the tag. If the tag is valid, it returns an ...
python
def errors(self): """ Get the errors of the tag. If invalid then the list will consist of errors containing each a code and message explaining the error. Each error also refers to the respective (sub)tag(s). :return: list of errors of the tag. If the tag is valid, it returns an ...
['def', 'errors', '(', 'self', ')', ':', 'errors', '=', '[', ']', 'data', '=', 'self', '.', 'data', 'error', '=', 'self', '.', 'error', '# Check if the tag is grandfathered and if the grandfathered tag is deprecated (e.g. no-nyn).', 'if', "'record'", 'in', 'data', ':', 'if', "'Deprecated'", 'in', 'data', '[', "'record'...
Get the errors of the tag. If invalid then the list will consist of errors containing each a code and message explaining the error. Each error also refers to the respective (sub)tag(s). :return: list of errors of the tag. If the tag is valid, it returns an empty list.
['Get', 'the', 'errors', 'of', 'the', 'tag', '.', 'If', 'invalid', 'then', 'the', 'list', 'will', 'consist', 'of', 'errors', 'containing', 'each', 'a', 'code', 'and', 'message', 'explaining', 'the', 'error', '.', 'Each', 'error', 'also', 'refers', 'to', 'the', 'respective', '(', 'sub', ')', 'tag', '(', 's', ')', '.']
train
https://github.com/OnroerendErfgoed/language-tags/blob/acb91e5458d22617f344e2eefaba9a9865373fdd/language_tags/Tag.py#L263-L352
5,634
ArduPilot/MAVProxy
MAVProxy/modules/lib/wxhorizon_ui.py
HorizonFrame.createHeadingPointer
def createHeadingPointer(self): '''Creates the pointer for the current heading.''' self.headingTri = patches.RegularPolygon((0.0,0.80),3,0.05,color='k',zorder=4) self.axes.add_patch(self.headingTri) self.headingText = self.axes.text(0.0,0.675,'0',color='k',size=self.fontSize,horizontalal...
python
def createHeadingPointer(self): '''Creates the pointer for the current heading.''' self.headingTri = patches.RegularPolygon((0.0,0.80),3,0.05,color='k',zorder=4) self.axes.add_patch(self.headingTri) self.headingText = self.axes.text(0.0,0.675,'0',color='k',size=self.fontSize,horizontalal...
['def', 'createHeadingPointer', '(', 'self', ')', ':', 'self', '.', 'headingTri', '=', 'patches', '.', 'RegularPolygon', '(', '(', '0.0', ',', '0.80', ')', ',', '3', ',', '0.05', ',', 'color', '=', "'k'", ',', 'zorder', '=', '4', ')', 'self', '.', 'axes', '.', 'add_patch', '(', 'self', '.', 'headingTri', ')', 'self', '...
Creates the pointer for the current heading.
['Creates', 'the', 'pointer', 'for', 'the', 'current', 'heading', '.']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L174-L178
5,635
google/python-gflags
gflags/__init__.py
register_multi_flags_validator
def register_multi_flags_validator(flag_names, multi_flags_checker, message='Flags validation failed', flag_values=FLAGS): """Adds a constraint to multiple flags. The constraint is validated when flags are init...
python
def register_multi_flags_validator(flag_names, multi_flags_checker, message='Flags validation failed', flag_values=FLAGS): """Adds a constraint to multiple flags. The constraint is validated when flags are init...
['def', 'register_multi_flags_validator', '(', 'flag_names', ',', 'multi_flags_checker', ',', 'message', '=', "'Flags validation failed'", ',', 'flag_values', '=', 'FLAGS', ')', ':', 'v', '=', 'gflags_validators', '.', 'MultiFlagsValidator', '(', 'flag_names', ',', 'multi_flags_checker', ',', 'message', ')', '_add_vali...
Adds a constraint to multiple flags. The constraint is validated when flags are initially parsed, and after each change of the corresponding flag's value. Args: flag_names: [str], a list of the flag names to be checked. multi_flags_checker: callable, a function to validate the flag. input - dict...
['Adds', 'a', 'constraint', 'to', 'multiple', 'flags', '.']
train
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L187-L214
5,636
rene-aguirre/pywinusb
pywinusb/hid/core.py
hid_device_path_exists
def hid_device_path_exists(device_path, guid = None): """Test if required device_path is still valid (HID device connected to host) """ # expecing HID devices if not guid: guid = winapi.GetHidGuid() info_data = winapi.SP_DEVINFO_DATA() info_data.cb_size = sizeof(win...
python
def hid_device_path_exists(device_path, guid = None): """Test if required device_path is still valid (HID device connected to host) """ # expecing HID devices if not guid: guid = winapi.GetHidGuid() info_data = winapi.SP_DEVINFO_DATA() info_data.cb_size = sizeof(win...
['def', 'hid_device_path_exists', '(', 'device_path', ',', 'guid', '=', 'None', ')', ':', '# expecing HID devices\r', 'if', 'not', 'guid', ':', 'guid', '=', 'winapi', '.', 'GetHidGuid', '(', ')', 'info_data', '=', 'winapi', '.', 'SP_DEVINFO_DATA', '(', ')', 'info_data', '.', 'cb_size', '=', 'sizeof', '(', 'winapi', '.'...
Test if required device_path is still valid (HID device connected to host)
['Test', 'if', 'required', 'device_path', 'is', 'still', 'valid', '(', 'HID', 'device', 'connected', 'to', 'host', ')']
train
https://github.com/rene-aguirre/pywinusb/blob/954c4b2105d9f01cb0c50e24500bb747d4ecdc43/pywinusb/hid/core.py#L67-L86
5,637
LeastAuthority/txkube
src/txkube/_authentication.py
pick_cert_for_twisted
def pick_cert_for_twisted(netloc, possible): """ Pick the right client key/certificate to use for the given server and return it in the form Twisted wants. :param NetLocation netloc: The location of the server to consider. :param dict[TLSCredentials] possible: The available credentials from which ...
python
def pick_cert_for_twisted(netloc, possible): """ Pick the right client key/certificate to use for the given server and return it in the form Twisted wants. :param NetLocation netloc: The location of the server to consider. :param dict[TLSCredentials] possible: The available credentials from which ...
['def', 'pick_cert_for_twisted', '(', 'netloc', ',', 'possible', ')', ':', 'try', ':', 'creds', '=', 'possible', '[', 'netloc', ']', 'except', 'KeyError', ':', 'return', '(', 'None', ',', '(', ')', ')', 'key', '=', 'ssl', '.', 'KeyPair', '.', 'load', '(', 'creds', '.', 'key', '.', 'as_bytes', '(', ')', ',', 'FILETYPE_P...
Pick the right client key/certificate to use for the given server and return it in the form Twisted wants. :param NetLocation netloc: The location of the server to consider. :param dict[TLSCredentials] possible: The available credentials from which to choose. :return: A two-tuple. If no crede...
['Pick', 'the', 'right', 'client', 'key', '/', 'certificate', 'to', 'use', 'for', 'the', 'given', 'server', 'and', 'return', 'it', 'in', 'the', 'form', 'Twisted', 'wants', '.']
train
https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_authentication.py#L122-L153
5,638
deepmind/pysc2
pysc2/bin/gen_actions.py
get_data
def get_data(): """Retrieve static data from the game.""" run_config = run_configs.get() with run_config.start(want_rgb=False) as controller: m = maps.get("Sequencer") # Arbitrary ladder map. create = sc_pb.RequestCreateGame(local_map=sc_pb.LocalMap( map_path=m.path, map_data=m.data(run_config))...
python
def get_data(): """Retrieve static data from the game.""" run_config = run_configs.get() with run_config.start(want_rgb=False) as controller: m = maps.get("Sequencer") # Arbitrary ladder map. create = sc_pb.RequestCreateGame(local_map=sc_pb.LocalMap( map_path=m.path, map_data=m.data(run_config))...
['def', 'get_data', '(', ')', ':', 'run_config', '=', 'run_configs', '.', 'get', '(', ')', 'with', 'run_config', '.', 'start', '(', 'want_rgb', '=', 'False', ')', 'as', 'controller', ':', 'm', '=', 'maps', '.', 'get', '(', '"Sequencer"', ')', '# Arbitrary ladder map.', 'create', '=', 'sc_pb', '.', 'RequestCreateGame', ...
Retrieve static data from the game.
['Retrieve', 'static', 'data', 'from', 'the', 'game', '.']
train
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/bin/gen_actions.py#L39-L55
5,639
romanz/trezor-agent
libagent/device/interface.py
identity_to_string
def identity_to_string(identity_dict): """Dump Identity dictionary into its string representation.""" result = [] if identity_dict.get('proto'): result.append(identity_dict['proto'] + '://') if identity_dict.get('user'): result.append(identity_dict['user'] + '@') result.append(identi...
python
def identity_to_string(identity_dict): """Dump Identity dictionary into its string representation.""" result = [] if identity_dict.get('proto'): result.append(identity_dict['proto'] + '://') if identity_dict.get('user'): result.append(identity_dict['user'] + '@') result.append(identi...
['def', 'identity_to_string', '(', 'identity_dict', ')', ':', 'result', '=', '[', ']', 'if', 'identity_dict', '.', 'get', '(', "'proto'", ')', ':', 'result', '.', 'append', '(', 'identity_dict', '[', "'proto'", ']', '+', "'://'", ')', 'if', 'identity_dict', '.', 'get', '(', "'user'", ')', ':', 'result', '.', 'append', ...
Dump Identity dictionary into its string representation.
['Dump', 'Identity', 'dictionary', 'into', 'its', 'string', 'representation', '.']
train
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/device/interface.py#L34-L47
5,640
dustin/twitty-twister
twittytwister/twitter.py
TwitterMonitor._state_stopped
def _state_stopped(self): """ The service is not running. This is the initial state, and the state after L{stopService} was called. To get out of this state, call L{startService}. If there is a current connection, we disconnect. """ if self._reconnectDelayedCall:...
python
def _state_stopped(self): """ The service is not running. This is the initial state, and the state after L{stopService} was called. To get out of this state, call L{startService}. If there is a current connection, we disconnect. """ if self._reconnectDelayedCall:...
['def', '_state_stopped', '(', 'self', ')', ':', 'if', 'self', '.', '_reconnectDelayedCall', ':', 'self', '.', '_reconnectDelayedCall', '.', 'cancel', '(', ')', 'self', '.', '_reconnectDelayedCall', '=', 'None', 'self', '.', 'loseConnection', '(', ')']
The service is not running. This is the initial state, and the state after L{stopService} was called. To get out of this state, call L{startService}. If there is a current connection, we disconnect.
['The', 'service', 'is', 'not', 'running', '.']
train
https://github.com/dustin/twitty-twister/blob/8524750ee73adb57bbe14ef0cfd8aa08e1e59fb3/twittytwister/twitter.py#L1048-L1059
5,641
jalanb/pysyte
pysyte/bash/git.py
log
def log(args, number=None, oneline=False, quiet=False): """Run a "git log ..." command, and return stdout args is anything which can be added after a normal "git log ..." it can be blank number, if true-ish, will be added as a "-n" option oneline, if true-ish, will add the "--oneline" option ...
python
def log(args, number=None, oneline=False, quiet=False): """Run a "git log ..." command, and return stdout args is anything which can be added after a normal "git log ..." it can be blank number, if true-ish, will be added as a "-n" option oneline, if true-ish, will add the "--oneline" option ...
['def', 'log', '(', 'args', ',', 'number', '=', 'None', ',', 'oneline', '=', 'False', ',', 'quiet', '=', 'False', ')', ':', 'options', '=', "' '", '.', 'join', '(', '[', 'number', 'and', 'str', '(', "'-n %s'", '%', 'number', ')', 'or', "''", ',', 'oneline', 'and', "'--oneline'", 'or', "''", ']', ')', 'try', ':', 'retur...
Run a "git log ..." command, and return stdout args is anything which can be added after a normal "git log ..." it can be blank number, if true-ish, will be added as a "-n" option oneline, if true-ish, will add the "--oneline" option
['Run', 'a', 'git', 'log', '...', 'command', 'and', 'return', 'stdout']
train
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/bash/git.py#L217-L232
5,642
tchellomello/python-arlo
pyarlo/__init__.py
PyArlo.update
def update(self, update_cameras=False, update_base_station=False): """Refresh object.""" self._authenticate() # update attributes in all cameras to avoid duped queries if update_cameras: url = DEVICES_ENDPOINT response = self.query(url) if not respons...
python
def update(self, update_cameras=False, update_base_station=False): """Refresh object.""" self._authenticate() # update attributes in all cameras to avoid duped queries if update_cameras: url = DEVICES_ENDPOINT response = self.query(url) if not respons...
['def', 'update', '(', 'self', ',', 'update_cameras', '=', 'False', ',', 'update_base_station', '=', 'False', ')', ':', 'self', '.', '_authenticate', '(', ')', '# update attributes in all cameras to avoid duped queries', 'if', 'update_cameras', ':', 'url', '=', 'DEVICES_ENDPOINT', 'response', '=', 'self', '.', 'query',...
Refresh object.
['Refresh', 'object', '.']
train
https://github.com/tchellomello/python-arlo/blob/db70aeb81705309c56ad32bbab1094f6cd146524/pyarlo/__init__.py#L249-L274
5,643
tomi77/python-t77-date
t77_date/datetime.py
end_of_month
def end_of_month(val): """ Return a new datetime.datetime object with values that represent a end of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) i...
python
def end_of_month(val): """ Return a new datetime.datetime object with values that represent a end of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) i...
['def', 'end_of_month', '(', 'val', ')', ':', 'if', 'type', '(', 'val', ')', '==', 'date', ':', 'val', '=', 'datetime', '.', 'fromordinal', '(', 'val', '.', 'toordinal', '(', ')', ')', 'if', 'val', '.', 'month', '==', '12', ':', 'return', 'start_of_month', '(', 'val', ')', '.', 'replace', '(', 'year', '=', 'val', '.', ...
Return a new datetime.datetime object with values that represent a end of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime
['Return', 'a', 'new', 'datetime', '.', 'datetime', 'object', 'with', 'values', 'that', 'represent', 'a', 'end', 'of', 'a', 'month', '.', ':', 'param', 'val', ':', 'Date', 'to', '...', ':', 'type', 'val', ':', 'datetime', '.', 'datetime', '|', 'datetime', '.', 'date', ':', 'rtype', ':', 'datetime', '.', 'datetime']
train
https://github.com/tomi77/python-t77-date/blob/b4b12ce6a02884fb62460f6b9068e7fa28979fce/t77_date/datetime.py#L45-L60
5,644
fstab50/metal
metal/cli.py
SetLogging.set
def set(self, mode, disable): """ create logger object, enable or disable logging """ global logger try: if logger: if disable: logger.disabled = True else: if mode in ('STREAM', 'FILE'): logger = log...
python
def set(self, mode, disable): """ create logger object, enable or disable logging """ global logger try: if logger: if disable: logger.disabled = True else: if mode in ('STREAM', 'FILE'): logger = log...
['def', 'set', '(', 'self', ',', 'mode', ',', 'disable', ')', ':', 'global', 'logger', 'try', ':', 'if', 'logger', ':', 'if', 'disable', ':', 'logger', '.', 'disabled', '=', 'True', 'else', ':', 'if', 'mode', 'in', '(', "'STREAM'", ',', "'FILE'", ')', ':', 'logger', '=', 'logd', '.', 'getLogger', '(', 'mode', ',', '__v...
create logger object, enable or disable logging
['create', 'logger', 'object', 'enable', 'or', 'disable', 'logging']
train
https://github.com/fstab50/metal/blob/0488bbdd516a508909267cc44191f632e21156ba/metal/cli.py#L123-L138
5,645
mitsei/dlkit
dlkit/records/osid/base_records.py
FilesFormRecord._init_metadata
def _init_metadata(self): """stub""" self._files_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'files'), 'element_label': 'Files', 'instructions': 'ente...
python
def _init_metadata(self): """stub""" self._files_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'files'), 'element_label': 'Files', 'instructions': 'ente...
['def', '_init_metadata', '(', 'self', ')', ':', 'self', '.', '_files_metadata', '=', '{', "'element_id'", ':', 'Id', '(', 'self', '.', 'my_osid_object_form', '.', '_authority', ',', 'self', '.', 'my_osid_object_form', '.', '_namespace', ',', "'files'", ')', ',', "'element_label'", ':', "'Files'", ',', "'instructions'"...
stub
['stub']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1949-L1994
5,646
PMBio/limix-backup
limix/mtSet/core/preprocessCore.py
computePCsPlink
def computePCsPlink(plink_path,k,out_dir,bfile,ffile): """ computing the covariance matrix via plink """ print("Using plink to compute principal components") cmd = '%s --bfile %s --pca %d '%(plink_path,bfile,k) cmd+= '--out %s'%(os.path.join(out_dir,'plink')) subprocess.call(cmd,shell=True) ...
python
def computePCsPlink(plink_path,k,out_dir,bfile,ffile): """ computing the covariance matrix via plink """ print("Using plink to compute principal components") cmd = '%s --bfile %s --pca %d '%(plink_path,bfile,k) cmd+= '--out %s'%(os.path.join(out_dir,'plink')) subprocess.call(cmd,shell=True) ...
['def', 'computePCsPlink', '(', 'plink_path', ',', 'k', ',', 'out_dir', ',', 'bfile', ',', 'ffile', ')', ':', 'print', '(', '"Using plink to compute principal components"', ')', 'cmd', '=', "'%s --bfile %s --pca %d '", '%', '(', 'plink_path', ',', 'bfile', ',', 'k', ')', 'cmd', '+=', "'--out %s'", '%', '(', 'os', '.', ...
computing the covariance matrix via plink
['computing', 'the', 'covariance', 'matrix', 'via', 'plink']
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/mtSet/core/preprocessCore.py#L56-L69
5,647
sassoftware/saspy
saspy/sasml.py
SASml.hpforest
def hpforest(self, data: ['SASdata', str] = None, freq: str = None, id: str = None, input: [str, list, dict] = None, save: str = None, score: [str, bool, 'SASdata'] = True, target: [str, list, dict] = None, ...
python
def hpforest(self, data: ['SASdata', str] = None, freq: str = None, id: str = None, input: [str, list, dict] = None, save: str = None, score: [str, bool, 'SASdata'] = True, target: [str, list, dict] = None, ...
['def', 'hpforest', '(', 'self', ',', 'data', ':', '[', "'SASdata'", ',', 'str', ']', '=', 'None', ',', 'freq', ':', 'str', '=', 'None', ',', 'id', ':', 'str', '=', 'None', ',', 'input', ':', '[', 'str', ',', 'list', ',', 'dict', ']', '=', 'None', ',', 'save', ':', 'str', '=', 'None', ',', 'score', ':', '[', 'str', ','...
Python method to call the HPFOREST procedure Documentation link: https://support.sas.com/documentation/solutions/miner/emhp/14.1/emhpprcref.pdf :param data: SASdata object or string. This parameter is required. :parm freq: The freq variable can only be a string type. :parm id: ...
['Python', 'method', 'to', 'call', 'the', 'HPFOREST', 'procedure']
train
https://github.com/sassoftware/saspy/blob/e433f71990f249d3a6c3db323ceb11cb2d462cf9/saspy/sasml.py#L89-L115
5,648
Jaza/flask-thumbnails-s3
flask_thumbnails_s3/__init__.py
Thumbnail._thumbnail_s3
def _thumbnail_s3(self, original_filename, thumb_filename, thumb_size, thumb_url, bucket_name, crop=None, bg=None, quality=85): """Finds or creates a thumbnail for the specified image on Amazon S3.""" scheme = self.app.config.get('THUMBNAIL_S3_USE_HTTPS') and...
python
def _thumbnail_s3(self, original_filename, thumb_filename, thumb_size, thumb_url, bucket_name, crop=None, bg=None, quality=85): """Finds or creates a thumbnail for the specified image on Amazon S3.""" scheme = self.app.config.get('THUMBNAIL_S3_USE_HTTPS') and...
['def', '_thumbnail_s3', '(', 'self', ',', 'original_filename', ',', 'thumb_filename', ',', 'thumb_size', ',', 'thumb_url', ',', 'bucket_name', ',', 'crop', '=', 'None', ',', 'bg', '=', 'None', ',', 'quality', '=', '85', ')', ':', 'scheme', '=', 'self', '.', 'app', '.', 'config', '.', 'get', '(', "'THUMBNAIL_S3_USE_HTT...
Finds or creates a thumbnail for the specified image on Amazon S3.
['Finds', 'or', 'creates', 'a', 'thumbnail', 'for', 'the', 'specified', 'image', 'on', 'Amazon', 'S3', '.']
train
https://github.com/Jaza/flask-thumbnails-s3/blob/a4f20fa643cea175f7b7c22315f4ae8a3edc7636/flask_thumbnails_s3/__init__.py#L90-L147
5,649
sdispater/eloquent
eloquent/orm/scopes/soft_deleting.py
SoftDeletingScope.remove
def remove(self, builder, model): """ Remove the scope from a given query builder. :param builder: The query builder :type builder: eloquent.orm.builder.Builder :param model: The model :type model: eloquent.orm.Model """ column = model.get_qualified_dele...
python
def remove(self, builder, model): """ Remove the scope from a given query builder. :param builder: The query builder :type builder: eloquent.orm.builder.Builder :param model: The model :type model: eloquent.orm.Model """ column = model.get_qualified_dele...
['def', 'remove', '(', 'self', ',', 'builder', ',', 'model', ')', ':', 'column', '=', 'model', '.', 'get_qualified_deleted_at_column', '(', ')', 'query', '=', 'builder', '.', 'get_query', '(', ')', 'wheres', '=', '[', ']', 'for', 'where', 'in', 'query', '.', 'wheres', ':', '# If the where clause is a soft delete date c...
Remove the scope from a given query builder. :param builder: The query builder :type builder: eloquent.orm.builder.Builder :param model: The model :type model: eloquent.orm.Model
['Remove', 'the', 'scope', 'from', 'a', 'given', 'query', 'builder', '.']
train
https://github.com/sdispater/eloquent/blob/0638b688d5fd0c1a46b7471dd465eeb4c2f84666/eloquent/orm/scopes/soft_deleting.py#L24-L47
5,650
AlexandreDecan/python-intervals
intervals.py
AtomicInterval.replace
def replace(self, left=None, lower=None, upper=None, right=None, ignore_inf=True): """ Create a new interval based on the current one and the provided values. Callable can be passed instead of values. In that case, it is called with the current corresponding value except if ignore_inf i...
python
def replace(self, left=None, lower=None, upper=None, right=None, ignore_inf=True): """ Create a new interval based on the current one and the provided values. Callable can be passed instead of values. In that case, it is called with the current corresponding value except if ignore_inf i...
['def', 'replace', '(', 'self', ',', 'left', '=', 'None', ',', 'lower', '=', 'None', ',', 'upper', '=', 'None', ',', 'right', '=', 'None', ',', 'ignore_inf', '=', 'True', ')', ':', 'if', 'callable', '(', 'left', ')', ':', 'left', '=', 'left', '(', 'self', '.', '_left', ')', 'else', ':', 'left', '=', 'self', '.', '_left...
Create a new interval based on the current one and the provided values. Callable can be passed instead of values. In that case, it is called with the current corresponding value except if ignore_inf if set (default) and the corresponding bound is an infinity. :param left: (a function o...
['Create', 'a', 'new', 'interval', 'based', 'on', 'the', 'current', 'one', 'and', 'the', 'provided', 'values', '.']
train
https://github.com/AlexandreDecan/python-intervals/blob/eda4da7dd39afabab2c1689e0b5158abae08c831/intervals.py#L366-L401
5,651
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/PharLapCommon.py
addPharLapPaths
def addPharLapPaths(env): """This function adds the path to the Phar Lap binaries, includes, and libraries, if they are not already there.""" ph_path = getPharLapPath() try: env_dict = env['ENV'] except KeyError: env_dict = {} env['ENV'] = env_dict SCons.Util.AddPathIfNo...
python
def addPharLapPaths(env): """This function adds the path to the Phar Lap binaries, includes, and libraries, if they are not already there.""" ph_path = getPharLapPath() try: env_dict = env['ENV'] except KeyError: env_dict = {} env['ENV'] = env_dict SCons.Util.AddPathIfNo...
['def', 'addPharLapPaths', '(', 'env', ')', ':', 'ph_path', '=', 'getPharLapPath', '(', ')', 'try', ':', 'env_dict', '=', 'env', '[', "'ENV'", ']', 'except', 'KeyError', ':', 'env_dict', '=', '{', '}', 'env', '[', "'ENV'", ']', '=', 'env_dict', 'SCons', '.', 'Util', '.', 'AddPathIfNotExists', '(', 'env_dict', ',', "'PA...
This function adds the path to the Phar Lap binaries, includes, and libraries, if they are not already there.
['This', 'function', 'adds', 'the', 'path', 'to', 'the', 'Phar', 'Lap', 'binaries', 'includes', 'and', 'libraries', 'if', 'they', 'are', 'not', 'already', 'there', '.']
train
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/PharLapCommon.py#L88-L108
5,652
macbre/sql-metadata
sql_metadata.py
generalize_sql
def generalize_sql(sql): """ Removes most variables from an SQL query and replaces them with X or N for numbers. Based on Mediawiki's DatabaseBase::generalizeSQL :type sql str|None :rtype: str """ if sql is None: return None # multiple spaces sql = re.sub(r'\s{2,}', ' ', s...
python
def generalize_sql(sql): """ Removes most variables from an SQL query and replaces them with X or N for numbers. Based on Mediawiki's DatabaseBase::generalizeSQL :type sql str|None :rtype: str """ if sql is None: return None # multiple spaces sql = re.sub(r'\s{2,}', ' ', s...
['def', 'generalize_sql', '(', 'sql', ')', ':', 'if', 'sql', 'is', 'None', ':', 'return', 'None', '# multiple spaces', 'sql', '=', 're', '.', 'sub', '(', "r'\\s{2,}'", ',', "' '", ',', 'sql', ')', '# MW comments', '# e.g. /* CategoryDataService::getMostVisited N.N.N.N */', 'sql', '=', 'remove_comments_from_sql', '(', '...
Removes most variables from an SQL query and replaces them with X or N for numbers. Based on Mediawiki's DatabaseBase::generalizeSQL :type sql str|None :rtype: str
['Removes', 'most', 'variables', 'from', 'an', 'SQL', 'query', 'and', 'replaces', 'them', 'with', 'X', 'or', 'N', 'for', 'numbers', '.']
train
https://github.com/macbre/sql-metadata/blob/4b7b4ae0a961d568075aefe78535cf5aee74583c/sql_metadata.py#L269-L306
5,653
InQuest/python-sandboxapi
sandboxapi/falcon.py
FalconAPI.analyze
def analyze(self, handle, filename): """Submit a file for analysis. :type handle: File handle :param handle: Handle to file to upload for analysis. :type filename: str :param filename: File name. :rtype: str :return: File hash as a string """ ...
python
def analyze(self, handle, filename): """Submit a file for analysis. :type handle: File handle :param handle: Handle to file to upload for analysis. :type filename: str :param filename: File name. :rtype: str :return: File hash as a string """ ...
['def', 'analyze', '(', 'self', ',', 'handle', ',', 'filename', ')', ':', '# multipart post files.', 'files', '=', '{', '"file"', ':', '(', 'filename', ',', 'handle', ')', '}', '# ensure the handle is at offset 0.', 'handle', '.', 'seek', '(', '0', ')', 'response', '=', 'self', '.', '_request', '(', '"/submit/file"', '...
Submit a file for analysis. :type handle: File handle :param handle: Handle to file to upload for analysis. :type filename: str :param filename: File name. :rtype: str :return: File hash as a string
['Submit', 'a', 'file', 'for', 'analysis', '.']
train
https://github.com/InQuest/python-sandboxapi/blob/9bad73f453e25d7d23e7b4b1ae927f44a35a5bc3/sandboxapi/falcon.py#L45-L71
5,654
olls/graphics
graphics/funcs.py
rotateImage
def rotateImage(image, angle): """ rotates a 2d array to a multiple of 90 deg. 0 = default 1 = 90 deg. cw 2 = 180 deg. 3 = 90 deg. ccw """ image = [list(row) for row in image] for n in range(angle % 4): image = list(zip(*image[::-1])) return image
python
def rotateImage(image, angle): """ rotates a 2d array to a multiple of 90 deg. 0 = default 1 = 90 deg. cw 2 = 180 deg. 3 = 90 deg. ccw """ image = [list(row) for row in image] for n in range(angle % 4): image = list(zip(*image[::-1])) return image
['def', 'rotateImage', '(', 'image', ',', 'angle', ')', ':', 'image', '=', '[', 'list', '(', 'row', ')', 'for', 'row', 'in', 'image', ']', 'for', 'n', 'in', 'range', '(', 'angle', '%', '4', ')', ':', 'image', '=', 'list', '(', 'zip', '(', '*', 'image', '[', ':', ':', '-', '1', ']', ')', ')', 'return', 'image']
rotates a 2d array to a multiple of 90 deg. 0 = default 1 = 90 deg. cw 2 = 180 deg. 3 = 90 deg. ccw
['rotates', 'a', '2d', 'array', 'to', 'a', 'multiple', 'of', '90', 'deg', '.', '0', '=', 'default', '1', '=', '90', 'deg', '.', 'cw', '2', '=', '180', 'deg', '.', '3', '=', '90', 'deg', '.', 'ccw']
train
https://github.com/olls/graphics/blob/a302e9fe648d2d44603b52ac5bb80df4863b2a7d/graphics/funcs.py#L7-L20
5,655
konomae/lastpass-python
lastpass/parser.py
extract_chunks
def extract_chunks(blob): """Splits the blob into chucks grouped by kind.""" chunks = [] stream = BytesIO(blob.bytes) current_pos = stream.tell() stream.seek(0, 2) length = stream.tell() stream.seek(current_pos, 0) while stream.tell() < length: chunks.append(read_chunk(stream)) ...
python
def extract_chunks(blob): """Splits the blob into chucks grouped by kind.""" chunks = [] stream = BytesIO(blob.bytes) current_pos = stream.tell() stream.seek(0, 2) length = stream.tell() stream.seek(current_pos, 0) while stream.tell() < length: chunks.append(read_chunk(stream)) ...
['def', 'extract_chunks', '(', 'blob', ')', ':', 'chunks', '=', '[', ']', 'stream', '=', 'BytesIO', '(', 'blob', '.', 'bytes', ')', 'current_pos', '=', 'stream', '.', 'tell', '(', ')', 'stream', '.', 'seek', '(', '0', ',', '2', ')', 'length', '=', 'stream', '.', 'tell', '(', ')', 'stream', '.', 'seek', '(', 'current_po...
Splits the blob into chucks grouped by kind.
['Splits', 'the', 'blob', 'into', 'chucks', 'grouped', 'by', 'kind', '.']
train
https://github.com/konomae/lastpass-python/blob/5063911b789868a1fd9db9922db82cdf156b938a/lastpass/parser.py#L26-L37
5,656
Esri/ArcREST
src/arcrest/ags/mapservice.py
MapService.getExtensions
def getExtensions(self): """returns objects for all map service extensions""" extensions = [] if isinstance(self.supportedExtensions, list): for ext in self.supportedExtensions: extensionURL = self._url + "/exts/%s" % ext if ext == "SchematicsServer": ...
python
def getExtensions(self): """returns objects for all map service extensions""" extensions = [] if isinstance(self.supportedExtensions, list): for ext in self.supportedExtensions: extensionURL = self._url + "/exts/%s" % ext if ext == "SchematicsServer": ...
['def', 'getExtensions', '(', 'self', ')', ':', 'extensions', '=', '[', ']', 'if', 'isinstance', '(', 'self', '.', 'supportedExtensions', ',', 'list', ')', ':', 'for', 'ext', 'in', 'self', '.', 'supportedExtensions', ':', 'extensionURL', '=', 'self', '.', '_url', '+', '"/exts/%s"', '%', 'ext', 'if', 'ext', '==', '"Sche...
returns objects for all map service extensions
['returns', 'objects', 'for', 'all', 'map', 'service', 'extensions']
train
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/mapservice.py#L423-L442
5,657
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.sync_out
def sync_out(self, file_name=None, force=False): """Synchronize from objects to records""" self.log('---- Sync Out ----') from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING for f in self.build_source_files.list_records(): if (f.sync_d...
python
def sync_out(self, file_name=None, force=False): """Synchronize from objects to records""" self.log('---- Sync Out ----') from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING for f in self.build_source_files.list_records(): if (f.sync_d...
['def', 'sync_out', '(', 'self', ',', 'file_name', '=', 'None', ',', 'force', '=', 'False', ')', ':', 'self', '.', 'log', '(', "'---- Sync Out ----'", ')', 'from', 'ambry', '.', 'bundle', '.', 'files', 'import', 'BuildSourceFile', 'self', '.', 'dstate', '=', 'self', '.', 'STATES', '.', 'BUILDING', 'for', 'f', 'in', 'se...
Synchronize from objects to records
['Synchronize', 'from', 'objects', 'to', 'records']
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1472-L1485
5,658
apache/incubator-mxnet
python/mxnet/metric.py
EvalMetric.reset
def reset(self): """Resets the internal evaluation result to initial state.""" self.num_inst = 0 self.sum_metric = 0.0 self.global_num_inst = 0 self.global_sum_metric = 0.0
python
def reset(self): """Resets the internal evaluation result to initial state.""" self.num_inst = 0 self.sum_metric = 0.0 self.global_num_inst = 0 self.global_sum_metric = 0.0
['def', 'reset', '(', 'self', ')', ':', 'self', '.', 'num_inst', '=', '0', 'self', '.', 'sum_metric', '=', '0.0', 'self', '.', 'global_num_inst', '=', '0', 'self', '.', 'global_sum_metric', '=', '0.0']
Resets the internal evaluation result to initial state.
['Resets', 'the', 'internal', 'evaluation', 'result', 'to', 'initial', 'state', '.']
train
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/metric.py#L148-L153
5,659
ejeschke/ginga
ginga/misc/Task.py
ThreadPool.register_dn
def register_dn(self): """Called by WorkerThread objects to register themselves. Acquire the condition variable for the WorkerThread objects. Decrement the running-thread count. If we are the last thread to start, release the ThreadPool thread, which is stuck in start() """ ...
python
def register_dn(self): """Called by WorkerThread objects to register themselves. Acquire the condition variable for the WorkerThread objects. Decrement the running-thread count. If we are the last thread to start, release the ThreadPool thread, which is stuck in start() """ ...
['def', 'register_dn', '(', 'self', ')', ':', 'with', 'self', '.', 'regcond', ':', 'self', '.', 'runningcount', '-=', '1', 'tid', '=', 'thread', '.', 'get_ident', '(', ')', 'self', '.', 'tids', '.', 'remove', '(', 'tid', ')', 'self', '.', 'logger', '.', 'debug', '(', '"register_dn: count_dn is %d"', '%', 'self', '.', '...
Called by WorkerThread objects to register themselves. Acquire the condition variable for the WorkerThread objects. Decrement the running-thread count. If we are the last thread to start, release the ThreadPool thread, which is stuck in start()
['Called', 'by', 'WorkerThread', 'objects', 'to', 'register', 'themselves', '.']
train
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/misc/Task.py#L1130-L1145
5,660
sosy-lab/benchexec
benchexec/result.py
get_result_category
def get_result_category(expected_results, result, properties): ''' This function determines the relation between actual result and expected result for the given file and properties. @param filename: The file name of the input file. @param result: The result given by the tool (needs to be one of the ...
python
def get_result_category(expected_results, result, properties): ''' This function determines the relation between actual result and expected result for the given file and properties. @param filename: The file name of the input file. @param result: The result given by the tool (needs to be one of the ...
['def', 'get_result_category', '(', 'expected_results', ',', 'result', ',', 'properties', ')', ':', 'result_class', '=', 'get_result_classification', '(', 'result', ')', 'if', 'result_class', '==', 'RESULT_CLASS_OTHER', ':', 'if', 'result', '==', 'RESULT_UNKNOWN', ':', 'return', 'CATEGORY_UNKNOWN', 'elif', 'result', '=...
This function determines the relation between actual result and expected result for the given file and properties. @param filename: The file name of the input file. @param result: The result given by the tool (needs to be one of the RESULT_* strings to be recognized). @param properties: The list of prop...
['This', 'function', 'determines', 'the', 'relation', 'between', 'actual', 'result', 'and', 'expected', 'result', 'for', 'the', 'given', 'file', 'and', 'properties', '.']
train
https://github.com/sosy-lab/benchexec/blob/44428f67f41384c03aea13e7e25f884764653617/benchexec/result.py#L440-L489
5,661
valohai/valohai-yaml
valohai_yaml/utils/__init__.py
listify
def listify(value): """ Wrap the given value into a list, with the below provisions: * If the value is a list or a tuple, it's coerced into a new list. * If the value is None, an empty list is returned. * Otherwise, a single-element list is returned, containing the value. :param value: A value...
python
def listify(value): """ Wrap the given value into a list, with the below provisions: * If the value is a list or a tuple, it's coerced into a new list. * If the value is None, an empty list is returned. * Otherwise, a single-element list is returned, containing the value. :param value: A value...
['def', 'listify', '(', 'value', ')', ':', 'if', 'value', 'is', 'None', ':', 'return', '[', ']', 'if', 'isinstance', '(', 'value', ',', '(', 'list', ',', 'tuple', ')', ')', ':', 'return', 'list', '(', 'value', ')', 'return', '[', 'value', ']']
Wrap the given value into a list, with the below provisions: * If the value is a list or a tuple, it's coerced into a new list. * If the value is None, an empty list is returned. * Otherwise, a single-element list is returned, containing the value. :param value: A value. :return: a list! :rtyp...
['Wrap', 'the', 'given', 'value', 'into', 'a', 'list', 'with', 'the', 'below', 'provisions', ':']
train
https://github.com/valohai/valohai-yaml/blob/3d2e92381633d84cdba039f6905df34c9633a2e1/valohai_yaml/utils/__init__.py#L12-L28
5,662
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.name
def name(self, new_name): """ Sets the name of this node. :param new_name: name """ log.info("{module}: {name} [{id}] renamed to {new_name}".format(module=self.manager.module_name, name=self.name, ...
python
def name(self, new_name): """ Sets the name of this node. :param new_name: name """ log.info("{module}: {name} [{id}] renamed to {new_name}".format(module=self.manager.module_name, name=self.name, ...
['def', 'name', '(', 'self', ',', 'new_name', ')', ':', 'log', '.', 'info', '(', '"{module}: {name} [{id}] renamed to {new_name}"', '.', 'format', '(', 'module', '=', 'self', '.', 'manager', '.', 'module_name', ',', 'name', '=', 'self', '.', 'name', ',', 'id', '=', 'self', '.', 'id', ',', 'new_name', '=', 'new_name', '...
Sets the name of this node. :param new_name: name
['Sets', 'the', 'name', 'of', 'this', 'node', '.']
train
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L176-L187
5,663
jopohl/urh
src/urh/awre/components/Address.py
Address.find_candidates
def find_candidates(candidates): """ Find candidate addresses using LCS algorithm perform a scoring based on how often a candidate appears in a longer candidate Input is something like ------------------------ ['1b6033', '1b6033fd57', '701b603378e289', '20701b603378e2890...
python
def find_candidates(candidates): """ Find candidate addresses using LCS algorithm perform a scoring based on how often a candidate appears in a longer candidate Input is something like ------------------------ ['1b6033', '1b6033fd57', '701b603378e289', '20701b603378e2890...
['def', 'find_candidates', '(', 'candidates', ')', ':', 'result', '=', 'defaultdict', '(', 'int', ')', 'for', 'i', ',', 'c_i', 'in', 'enumerate', '(', 'candidates', ')', ':', 'for', 'j', 'in', 'range', '(', 'i', ',', 'len', '(', 'candidates', ')', ')', ':', 'lcs', '=', 'util', '.', 'longest_common_substring', '(', 'c_i...
Find candidate addresses using LCS algorithm perform a scoring based on how often a candidate appears in a longer candidate Input is something like ------------------------ ['1b6033', '1b6033fd57', '701b603378e289', '20701b603378e289000c62', '1b603300', '78e289757e', '7078e2891b...
['Find', 'candidate', 'addresses', 'using', 'LCS', 'algorithm', 'perform', 'a', 'scoring', 'based', 'on', 'how', 'often', 'a', 'candidate', 'appears', 'in', 'a', 'longer', 'candidate']
train
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/awre/components/Address.py#L190-L217
5,664
dead-beef/markovchain
markovchain/text/util.py
CharCase.convert
def convert(self, string): """Return a copy of string converted to case. Parameters ---------- string : `str` Returns ------- `str` Examples -------- >>> CharCase.LOWER.convert('sTr InG') 'str ing' >>> CharCase.UPPER.conv...
python
def convert(self, string): """Return a copy of string converted to case. Parameters ---------- string : `str` Returns ------- `str` Examples -------- >>> CharCase.LOWER.convert('sTr InG') 'str ing' >>> CharCase.UPPER.conv...
['def', 'convert', '(', 'self', ',', 'string', ')', ':', 'if', 'self', '==', 'self', '.', '__class__', '.', 'TITLE', ':', 'return', 'capitalize', '(', 'string', ')', 'if', 'self', '==', 'self', '.', '__class__', '.', 'UPPER', ':', 'return', 'string', '.', 'upper', '(', ')', 'if', 'self', '==', 'self', '.', '__class__',...
Return a copy of string converted to case. Parameters ---------- string : `str` Returns ------- `str` Examples -------- >>> CharCase.LOWER.convert('sTr InG') 'str ing' >>> CharCase.UPPER.convert('sTr InG') 'STR ING' ...
['Return', 'a', 'copy', 'of', 'string', 'converted', 'to', 'case', '.']
train
https://github.com/dead-beef/markovchain/blob/9bd10b2f01089341c4a875a0fa569d50caba22c7/markovchain/text/util.py#L27-L55
5,665
gem/oq-engine
openquake/hazardlib/gsim/abrahamson_silva_1997.py
AbrahamsonSilva1997._compute_f5
def _compute_f5(self, C, pga_rock): """ Compute f5 term (non-linear soil response) """ return C['a10'] + C['a11'] * np.log(pga_rock + C['c5'])
python
def _compute_f5(self, C, pga_rock): """ Compute f5 term (non-linear soil response) """ return C['a10'] + C['a11'] * np.log(pga_rock + C['c5'])
['def', '_compute_f5', '(', 'self', ',', 'C', ',', 'pga_rock', ')', ':', 'return', 'C', '[', "'a10'", ']', '+', 'C', '[', "'a11'", ']', '*', 'np', '.', 'log', '(', 'pga_rock', '+', 'C', '[', "'c5'", ']', ')']
Compute f5 term (non-linear soil response)
['Compute', 'f5', 'term', '(', 'non', '-', 'linear', 'soil', 'response', ')']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/abrahamson_silva_1997.py#L228-L232
5,666
ModisWorks/modis
modis/discord_modis/gui.py
BotControl.stop
def stop(self): """Stop Modis and log it out of Discord.""" self.button_toggle_text.set("Start Modis") self.state = "off" logger.info("Stopping Discord Modis") from ._client import client asyncio.run_coroutine_threadsafe(client.logout(), client.loop) self.status...
python
def stop(self): """Stop Modis and log it out of Discord.""" self.button_toggle_text.set("Start Modis") self.state = "off" logger.info("Stopping Discord Modis") from ._client import client asyncio.run_coroutine_threadsafe(client.logout(), client.loop) self.status...
['def', 'stop', '(', 'self', ')', ':', 'self', '.', 'button_toggle_text', '.', 'set', '(', '"Start Modis"', ')', 'self', '.', 'state', '=', '"off"', 'logger', '.', 'info', '(', '"Stopping Discord Modis"', ')', 'from', '.', '_client', 'import', 'client', 'asyncio', '.', 'run_coroutine_threadsafe', '(', 'client', '.', 'l...
Stop Modis and log it out of Discord.
['Stop', 'Modis', 'and', 'log', 'it', 'out', 'of', 'Discord', '.']
train
https://github.com/ModisWorks/modis/blob/1f1225c9841835ec1d1831fc196306527567db8b/modis/discord_modis/gui.py#L350-L359
5,667
exa-analytics/exa
exa/core/container.py
Container.slice_cardinal
def slice_cardinal(self, key): """ Slice the container according to its (primary) cardinal axis. The "cardinal" axis can have any name so long as the name matches a data object attached to the container. The index name for this object should also match the value of the cardinal ...
python
def slice_cardinal(self, key): """ Slice the container according to its (primary) cardinal axis. The "cardinal" axis can have any name so long as the name matches a data object attached to the container. The index name for this object should also match the value of the cardinal ...
['def', 'slice_cardinal', '(', 'self', ',', 'key', ')', ':', 'if', 'self', '.', '_cardinal', ':', 'cls', '=', 'self', '.', '__class__', 'key', '=', 'check_key', '(', 'self', '[', 'self', '.', '_cardinal', ']', ',', 'key', ',', 'cardinal', '=', 'True', ')', 'g', '=', 'self', '.', 'network', '(', 'fig', '=', 'False', ')'...
Slice the container according to its (primary) cardinal axis. The "cardinal" axis can have any name so long as the name matches a data object attached to the container. The index name for this object should also match the value of the cardinal axis. The algorithm builds a network graph...
['Slice', 'the', 'container', 'according', 'to', 'its', '(', 'primary', ')', 'cardinal', 'axis', '.']
train
https://github.com/exa-analytics/exa/blob/40fb3c22b531d460dbc51e603de75b856cc28f0d/exa/core/container.py#L84-L144
5,668
benmoran56/esper
esper.py
World._get_component
def _get_component(self, component_type: Type[C]) -> Iterable[Tuple[int, C]]: """Get an iterator for Entity, Component pairs. :param component_type: The Component type to retrieve. :return: An iterator for (Entity, Component) tuples. """ entity_db = self._entities for e...
python
def _get_component(self, component_type: Type[C]) -> Iterable[Tuple[int, C]]: """Get an iterator for Entity, Component pairs. :param component_type: The Component type to retrieve. :return: An iterator for (Entity, Component) tuples. """ entity_db = self._entities for e...
['def', '_get_component', '(', 'self', ',', 'component_type', ':', 'Type', '[', 'C', ']', ')', '->', 'Iterable', '[', 'Tuple', '[', 'int', ',', 'C', ']', ']', ':', 'entity_db', '=', 'self', '.', '_entities', 'for', 'entity', 'in', 'self', '.', '_components', '.', 'get', '(', 'component_type', ',', '[', ']', ')', ':', '...
Get an iterator for Entity, Component pairs. :param component_type: The Component type to retrieve. :return: An iterator for (Entity, Component) tuples.
['Get', 'an', 'iterator', 'for', 'Entity', 'Component', 'pairs', '.']
train
https://github.com/benmoran56/esper/blob/5b6cd0c51718d5dcfa0e5613f824b5251cf092ac/esper.py#L224-L233
5,669
bitesofcode/projexui
projexui/widgets/xdocktoolbar.py
XDockToolbar.rebuild
def rebuild(self): """ Rebuilds the widget based on the position and current size/location of its parent. """ if not self.isVisible(): return self.raise_() max_size = self.maximumPixmapSize() min_size = self.minimum...
python
def rebuild(self): """ Rebuilds the widget based on the position and current size/location of its parent. """ if not self.isVisible(): return self.raise_() max_size = self.maximumPixmapSize() min_size = self.minimum...
['def', 'rebuild', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'isVisible', '(', ')', ':', 'return', 'self', '.', 'raise_', '(', ')', 'max_size', '=', 'self', '.', 'maximumPixmapSize', '(', ')', 'min_size', '=', 'self', '.', 'minimumPixmapSize', '(', ')', 'widget', '=', 'self', '.', 'window', '(', ')', 'rect', '='...
Rebuilds the widget based on the position and current size/location of its parent.
['Rebuilds', 'the', 'widget', 'based', 'on', 'the', 'position', 'and', 'current', 'size', '/', 'location', 'of', 'its', 'parent', '.']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xdocktoolbar.py#L452-L488
5,670
pypa/pipenv
pipenv/vendor/tomlkit/source.py
Source.inc
def inc(self, exception=None): # type: (Optional[ParseError.__class__]) -> bool """ Increments the parser if the end of the input has not been reached. Returns whether or not it was able to advance. """ try: self._idx, self._current = next(self._chars) r...
python
def inc(self, exception=None): # type: (Optional[ParseError.__class__]) -> bool """ Increments the parser if the end of the input has not been reached. Returns whether or not it was able to advance. """ try: self._idx, self._current = next(self._chars) r...
['def', 'inc', '(', 'self', ',', 'exception', '=', 'None', ')', ':', '# type: (Optional[ParseError.__class__]) -> bool', 'try', ':', 'self', '.', '_idx', ',', 'self', '.', '_current', '=', 'next', '(', 'self', '.', '_chars', ')', 'return', 'True', 'except', 'StopIteration', ':', 'self', '.', '_idx', '=', 'len', '(', 's...
Increments the parser if the end of the input has not been reached. Returns whether or not it was able to advance.
['Increments', 'the', 'parser', 'if', 'the', 'end', 'of', 'the', 'input', 'has', 'not', 'been', 'reached', '.', 'Returns', 'whether', 'or', 'not', 'it', 'was', 'able', 'to', 'advance', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/tomlkit/source.py#L117-L132
5,671
abilian/abilian-core
abilian/web/attachments/extension.py
AttachmentExtension.manager
def manager(self, obj): """Returns the :class:`AttachmentsManager` instance for this object.""" manager = getattr(obj, _MANAGER_ATTR, None) if manager is None: manager = AttachmentsManager() setattr(obj.__class__, _MANAGER_ATTR, manager) return manager
python
def manager(self, obj): """Returns the :class:`AttachmentsManager` instance for this object.""" manager = getattr(obj, _MANAGER_ATTR, None) if manager is None: manager = AttachmentsManager() setattr(obj.__class__, _MANAGER_ATTR, manager) return manager
['def', 'manager', '(', 'self', ',', 'obj', ')', ':', 'manager', '=', 'getattr', '(', 'obj', ',', '_MANAGER_ATTR', ',', 'None', ')', 'if', 'manager', 'is', 'None', ':', 'manager', '=', 'AttachmentsManager', '(', ')', 'setattr', '(', 'obj', '.', '__class__', ',', '_MANAGER_ATTR', ',', 'manager', ')', 'return', 'manager'...
Returns the :class:`AttachmentsManager` instance for this object.
['Returns', 'the', ':', 'class', ':', 'AttachmentsManager', 'instance', 'for', 'this', 'object', '.']
train
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/web/attachments/extension.py#L28-L35
5,672
foremast/foremast
src/foremast/awslambda/api_gateway_event/api_gateway_event.py
APIGateway.find_api_id
def find_api_id(self): """Given API name, find API ID.""" allapis = self.client.get_rest_apis() api_name = self.trigger_settings['api_name'] api_id = None for api in allapis['items']: if api['name'] == api_name: api_id = api['id'] self....
python
def find_api_id(self): """Given API name, find API ID.""" allapis = self.client.get_rest_apis() api_name = self.trigger_settings['api_name'] api_id = None for api in allapis['items']: if api['name'] == api_name: api_id = api['id'] self....
['def', 'find_api_id', '(', 'self', ')', ':', 'allapis', '=', 'self', '.', 'client', '.', 'get_rest_apis', '(', ')', 'api_name', '=', 'self', '.', 'trigger_settings', '[', "'api_name'", ']', 'api_id', '=', 'None', 'for', 'api', 'in', 'allapis', '[', "'items'", ']', ':', 'if', 'api', '[', "'name'", ']', '==', 'api_name'...
Given API name, find API ID.
['Given', 'API', 'name', 'find', 'API', 'ID', '.']
train
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/api_gateway_event/api_gateway_event.py#L59-L72
5,673
bokeh/bokeh
bokeh/colors/rgb.py
RGB.to_css
def to_css(self): ''' Generate the CSS representation of this RGB color. Returns: str, ``"rgb(...)"`` or ``"rgba(...)"`` ''' if self.a == 1.0: return "rgb(%d, %d, %d)" % (self.r, self.g, self.b) else: return "rgba(%d, %d, %d, %s)" % (self.r, ...
python
def to_css(self): ''' Generate the CSS representation of this RGB color. Returns: str, ``"rgb(...)"`` or ``"rgba(...)"`` ''' if self.a == 1.0: return "rgb(%d, %d, %d)" % (self.r, self.g, self.b) else: return "rgba(%d, %d, %d, %s)" % (self.r, ...
['def', 'to_css', '(', 'self', ')', ':', 'if', 'self', '.', 'a', '==', '1.0', ':', 'return', '"rgb(%d, %d, %d)"', '%', '(', 'self', '.', 'r', ',', 'self', '.', 'g', ',', 'self', '.', 'b', ')', 'else', ':', 'return', '"rgba(%d, %d, %d, %s)"', '%', '(', 'self', '.', 'r', ',', 'self', '.', 'g', ',', 'self', '.', 'b', ',',...
Generate the CSS representation of this RGB color. Returns: str, ``"rgb(...)"`` or ``"rgba(...)"``
['Generate', 'the', 'CSS', 'representation', 'of', 'this', 'RGB', 'color', '.']
train
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/colors/rgb.py#L110-L120
5,674
twitterdev/tweet_parser
tweet_parser/tweet_checking.py
get_all_keys
def get_all_keys(tweet, parent_key=''): """ Takes a tweet object and recursively returns a list of all keys contained in this level and all nexstted levels of the tweet. Args: tweet (Tweet): the tweet dict parent_key (str): key from which this process will start, e.g., you can ...
python
def get_all_keys(tweet, parent_key=''): """ Takes a tweet object and recursively returns a list of all keys contained in this level and all nexstted levels of the tweet. Args: tweet (Tweet): the tweet dict parent_key (str): key from which this process will start, e.g., you can ...
['def', 'get_all_keys', '(', 'tweet', ',', 'parent_key', '=', "''", ')', ':', 'items', '=', '[', ']', 'for', 'k', ',', 'v', 'in', 'tweet', '.', 'items', '(', ')', ':', 'new_key', '=', 'parent_key', '+', '" "', '+', 'k', 'if', 'isinstance', '(', 'v', ',', 'dict', ')', ':', 'items', '.', 'extend', '(', 'get_all_keys', '(...
Takes a tweet object and recursively returns a list of all keys contained in this level and all nexstted levels of the tweet. Args: tweet (Tweet): the tweet dict parent_key (str): key from which this process will start, e.g., you can get keys only under some key that i...
['Takes', 'a', 'tweet', 'object', 'and', 'recursively', 'returns', 'a', 'list', 'of', 'all', 'keys', 'contained', 'in', 'this', 'level', 'and', 'all', 'nexstted', 'levels', 'of', 'the', 'tweet', '.']
train
https://github.com/twitterdev/tweet_parser/blob/3435de8367d36b483a6cfd8d46cc28694ee8a42e/tweet_parser/tweet_checking.py#L46-L73
5,675
pantsbuild/pants
src/python/pants/option/options.py
Options._check_and_apply_deprecations
def _check_and_apply_deprecations(self, scope, values): """Checks whether a ScopeInfo has options specified in a deprecated scope. There are two related cases here. Either: 1) The ScopeInfo has an associated deprecated_scope that was replaced with a non-deprecated scope, meaning that the options...
python
def _check_and_apply_deprecations(self, scope, values): """Checks whether a ScopeInfo has options specified in a deprecated scope. There are two related cases here. Either: 1) The ScopeInfo has an associated deprecated_scope that was replaced with a non-deprecated scope, meaning that the options...
['def', '_check_and_apply_deprecations', '(', 'self', ',', 'scope', ',', 'values', ')', ':', 'si', '=', 'self', '.', 'known_scope_to_info', '[', 'scope', ']', '# If this Scope is itself deprecated, report that.', 'if', 'si', '.', 'removal_version', ':', 'explicit_keys', '=', 'self', '.', 'for_scope', '(', 'scope', ',',...
Checks whether a ScopeInfo has options specified in a deprecated scope. There are two related cases here. Either: 1) The ScopeInfo has an associated deprecated_scope that was replaced with a non-deprecated scope, meaning that the options temporarily live in two locations. 2) The entire ScopeIn...
['Checks', 'whether', 'a', 'ScopeInfo', 'has', 'options', 'specified', 'in', 'a', 'deprecated', 'scope', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/option/options.py#L323-L368
5,676
twilio/twilio-python
twilio/rest/taskrouter/v1/workspace/workspace_statistics.py
WorkspaceStatisticsInstance._proxy
def _proxy(self): """ Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context :returns: WorkspaceStatisticsContext for this WorkspaceStatisticsInstance :rtype: twilio.rest.taskrouter.v1...
python
def _proxy(self): """ Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context :returns: WorkspaceStatisticsContext for this WorkspaceStatisticsInstance :rtype: twilio.rest.taskrouter.v1...
['def', '_proxy', '(', 'self', ')', ':', 'if', 'self', '.', '_context', 'is', 'None', ':', 'self', '.', '_context', '=', 'WorkspaceStatisticsContext', '(', 'self', '.', '_version', ',', 'workspace_sid', '=', 'self', '.', '_solution', '[', "'workspace_sid'", ']', ',', ')', 'return', 'self', '.', '_context']
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context :returns: WorkspaceStatisticsContext for this WorkspaceStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.Worksp...
['Generate', 'an', 'instance', 'context', 'for', 'the', 'instance', 'the', 'context', 'is', 'capable', 'of', 'performing', 'various', 'actions', '.', 'All', 'instance', 'actions', 'are', 'proxied', 'to', 'the', 'context']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py#L198-L211
5,677
Robpol86/Flask-Statics-Helper
flask_statics/helpers.py
get_resources
def get_resources(minify=False): """Find all resources which subclass ResourceBase. Keyword arguments: minify -- select minified resources if available. Returns: Dictionary of available resources. Keys are resource names (part of the config variable names), values are dicts with css and js key...
python
def get_resources(minify=False): """Find all resources which subclass ResourceBase. Keyword arguments: minify -- select minified resources if available. Returns: Dictionary of available resources. Keys are resource names (part of the config variable names), values are dicts with css and js key...
['def', 'get_resources', '(', 'minify', '=', 'False', ')', ':', 'all_resources', '=', 'dict', '(', ')', 'subclasses', '=', 'resource_base', '.', 'ResourceBase', '.', '__subclasses__', '(', ')', '+', 'resource_definitions', '.', 'ResourceAngular', '.', '__subclasses__', '(', ')', 'for', 'resource', 'in', 'subclasses', '...
Find all resources which subclass ResourceBase. Keyword arguments: minify -- select minified resources if available. Returns: Dictionary of available resources. Keys are resource names (part of the config variable names), values are dicts with css and js keys, and tuples of resources as values.
['Find', 'all', 'resources', 'which', 'subclass', 'ResourceBase', '.']
train
https://github.com/Robpol86/Flask-Statics-Helper/blob/b1771e65225f62b760b3ef841b710ff23ef6f83c/flask_statics/helpers.py#L23-L38
5,678
tanghaibao/goatools
goatools/grouper/sorter.py
Sorter.get_desc2nts
def get_desc2nts(self, **kws_usr): """Return grouped, sorted namedtuples in either format: flat, sections.""" # desc2nts contains: (sections hdrgo_prt sortobj) or (flat hdrgo_prt sortobj) # keys_nts: hdrgo_prt section_prt top_n use_sections kws_nts = {k:v for k, v in kws_usr.items() if k...
python
def get_desc2nts(self, **kws_usr): """Return grouped, sorted namedtuples in either format: flat, sections.""" # desc2nts contains: (sections hdrgo_prt sortobj) or (flat hdrgo_prt sortobj) # keys_nts: hdrgo_prt section_prt top_n use_sections kws_nts = {k:v for k, v in kws_usr.items() if k...
['def', 'get_desc2nts', '(', 'self', ',', '*', '*', 'kws_usr', ')', ':', '# desc2nts contains: (sections hdrgo_prt sortobj) or (flat hdrgo_prt sortobj)', '# keys_nts: hdrgo_prt section_prt top_n use_sections', 'kws_nts', '=', '{', 'k', ':', 'v', 'for', 'k', ',', 'v', 'in', 'kws_usr', '.', 'items', '(', ')', 'if', 'k', ...
Return grouped, sorted namedtuples in either format: flat, sections.
['Return', 'grouped', 'sorted', 'namedtuples', 'in', 'either', 'format', ':', 'flat', 'sections', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/sorter.py#L87-L92
5,679
saltstack/salt
salt/proxy/marathon.py
ping
def ping(): ''' Is the marathon api responding? ''' try: response = salt.utils.http.query( "{0}/ping".format(CONFIG[CONFIG_BASE_URL]), decode_type='plain', decode=True, ) log.debug( 'marathon.info returned successfully: %s', ...
python
def ping(): ''' Is the marathon api responding? ''' try: response = salt.utils.http.query( "{0}/ping".format(CONFIG[CONFIG_BASE_URL]), decode_type='plain', decode=True, ) log.debug( 'marathon.info returned successfully: %s', ...
['def', 'ping', '(', ')', ':', 'try', ':', 'response', '=', 'salt', '.', 'utils', '.', 'http', '.', 'query', '(', '"{0}/ping"', '.', 'format', '(', 'CONFIG', '[', 'CONFIG_BASE_URL', ']', ')', ',', 'decode_type', '=', "'plain'", ',', 'decode', '=', 'True', ',', ')', 'log', '.', 'debug', '(', "'marathon.info returned suc...
Is the marathon api responding?
['Is', 'the', 'marathon', 'api', 'responding?']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/marathon.py#L54-L76
5,680
coin-or/GiMPy
src/gimpy/graph.py
Graph.minimum_spanning_tree_kruskal
def minimum_spanning_tree_kruskal(self, display = None, components = None): ''' API: minimum_spanning_tree_kruskal(self, display = None, components = None) Description: Determines a minimum spanning tree using Kruskal's Algorithm. Input:...
python
def minimum_spanning_tree_kruskal(self, display = None, components = None): ''' API: minimum_spanning_tree_kruskal(self, display = None, components = None) Description: Determines a minimum spanning tree using Kruskal's Algorithm. Input:...
['def', 'minimum_spanning_tree_kruskal', '(', 'self', ',', 'display', '=', 'None', ',', 'components', '=', 'None', ')', ':', 'if', 'display', '==', 'None', ':', 'display', '=', 'self', '.', 'attr', '[', "'display'", ']', 'else', ':', 'self', '.', 'set_display_mode', '(', 'display', ')', 'if', 'components', 'is', 'None'...
API: minimum_spanning_tree_kruskal(self, display = None, components = None) Description: Determines a minimum spanning tree using Kruskal's Algorithm. Input: display: Display method. component: component number. Post: ...
['API', ':', 'minimum_spanning_tree_kruskal', '(', 'self', 'display', '=', 'None', 'components', '=', 'None', ')', 'Description', ':', 'Determines', 'a', 'minimum', 'spanning', 'tree', 'using', 'Kruskal', 's', 'Algorithm', '.', 'Input', ':', 'display', ':', 'Display', 'method', '.', 'component', ':', 'component', 'numb...
train
https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L1217-L1257
5,681
hobson/pug-invest
pug/invest/util.py
clean_dataframes
def clean_dataframes(dfs): """Fill NaNs with the previous value, the next value or if all are NaN then 1.0 TODO: Linear interpolation and extrapolation Arguments: dfs (list of dataframes): list of dataframes that contain NaNs to be removed Returns: list of dataframes: list of datafr...
python
def clean_dataframes(dfs): """Fill NaNs with the previous value, the next value or if all are NaN then 1.0 TODO: Linear interpolation and extrapolation Arguments: dfs (list of dataframes): list of dataframes that contain NaNs to be removed Returns: list of dataframes: list of datafr...
['def', 'clean_dataframes', '(', 'dfs', ')', ':', 'if', 'isinstance', '(', 'dfs', ',', '(', 'list', ')', ')', ':', 'for', 'df', 'in', 'dfs', ':', 'df', '=', 'clean_dataframe', '(', 'df', ')', 'return', 'dfs', 'else', ':', 'return', '[', 'clean_dataframe', '(', 'dfs', ')', ']']
Fill NaNs with the previous value, the next value or if all are NaN then 1.0 TODO: Linear interpolation and extrapolation Arguments: dfs (list of dataframes): list of dataframes that contain NaNs to be removed Returns: list of dataframes: list of dataframes with NaNs replaced by interpo...
['Fill', 'NaNs', 'with', 'the', 'previous', 'value', 'the', 'next', 'value', 'or', 'if', 'all', 'are', 'NaN', 'then', '1', '.', '0']
train
https://github.com/hobson/pug-invest/blob/836911258a0e920083a88c91beae88eefdebb20c/pug/invest/util.py#L113-L130
5,682
mrstephenneal/mysql-toolkit
mysql/toolkit/components/connector.py
Connector._fetch
def _fetch(self, statement, commit, max_attempts=5): """ Execute a SQL query and return a result. Recursively disconnect and reconnect to the database if an error occurs. """ if self._auto_reconnect: attempts = 0 while attempts < max_attempts: ...
python
def _fetch(self, statement, commit, max_attempts=5): """ Execute a SQL query and return a result. Recursively disconnect and reconnect to the database if an error occurs. """ if self._auto_reconnect: attempts = 0 while attempts < max_attempts: ...
['def', '_fetch', '(', 'self', ',', 'statement', ',', 'commit', ',', 'max_attempts', '=', '5', ')', ':', 'if', 'self', '.', '_auto_reconnect', ':', 'attempts', '=', '0', 'while', 'attempts', '<', 'max_attempts', ':', 'try', ':', '# Execute statement', 'self', '.', '_cursor', '.', 'execute', '(', 'statement', ')', 'fetc...
Execute a SQL query and return a result. Recursively disconnect and reconnect to the database if an error occurs.
['Execute', 'a', 'SQL', 'query', 'and', 'return', 'a', 'result', '.']
train
https://github.com/mrstephenneal/mysql-toolkit/blob/6964f718f4b72eb30f2259adfcfaf3090526c53d/mysql/toolkit/components/connector.py#L113-L149
5,683
candango/firenado
firenado/config.py
process_config
def process_config(config, config_data): """ Populates config with data from the configuration data dict. It handles components, data, log, management and session sections from the configuration data. :param config: The config reference of the object that will hold the configuration data from the c...
python
def process_config(config, config_data): """ Populates config with data from the configuration data dict. It handles components, data, log, management and session sections from the configuration data. :param config: The config reference of the object that will hold the configuration data from the c...
['def', 'process_config', '(', 'config', ',', 'config_data', ')', ':', 'if', "'components'", 'in', 'config_data', ':', 'process_components_config_section', '(', 'config', ',', 'config_data', '[', "'components'", ']', ')', 'if', "'data'", 'in', 'config_data', ':', 'process_data_config_section', '(', 'config', ',', 'conf...
Populates config with data from the configuration data dict. It handles components, data, log, management and session sections from the configuration data. :param config: The config reference of the object that will hold the configuration data from the config_data. :param config_data: The configura...
['Populates', 'config', 'with', 'data', 'from', 'the', 'configuration', 'data', 'dict', '.', 'It', 'handles', 'components', 'data', 'log', 'management', 'and', 'session', 'sections', 'from', 'the', 'configuration', 'data', '.']
train
https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L124-L143
5,684
fishtown-analytics/dbt
core/dbt/clients/system.py
make_symlink
def make_symlink(source, link_path): """ Create a symlink at `link_path` referring to `source`. """ if not supports_symlinks(): dbt.exceptions.system_error('create a symbolic link') return os.symlink(source, link_path)
python
def make_symlink(source, link_path): """ Create a symlink at `link_path` referring to `source`. """ if not supports_symlinks(): dbt.exceptions.system_error('create a symbolic link') return os.symlink(source, link_path)
['def', 'make_symlink', '(', 'source', ',', 'link_path', ')', ':', 'if', 'not', 'supports_symlinks', '(', ')', ':', 'dbt', '.', 'exceptions', '.', 'system_error', '(', "'create a symbolic link'", ')', 'return', 'os', '.', 'symlink', '(', 'source', ',', 'link_path', ')']
Create a symlink at `link_path` referring to `source`.
['Create', 'a', 'symlink', 'at', 'link_path', 'referring', 'to', 'source', '.']
train
https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/clients/system.py#L102-L109
5,685
dcos/shakedown
shakedown/dcos/package.py
uninstall_package_and_data
def uninstall_package_and_data( package_name, service_name=None, role=None, principal=None, zk_node=None, timeout_sec=600): """ Uninstall a package via the DC/OS library, wait for completion, and delete any persistent data :param package_name: name of the pac...
python
def uninstall_package_and_data( package_name, service_name=None, role=None, principal=None, zk_node=None, timeout_sec=600): """ Uninstall a package via the DC/OS library, wait for completion, and delete any persistent data :param package_name: name of the pac...
['def', 'uninstall_package_and_data', '(', 'package_name', ',', 'service_name', '=', 'None', ',', 'role', '=', 'None', ',', 'principal', '=', 'None', ',', 'zk_node', '=', 'None', ',', 'timeout_sec', '=', '600', ')', ':', 'start', '=', 'time', '.', 'time', '(', ')', 'if', 'service_name', 'is', 'None', ':', 'pkg', '=', '...
Uninstall a package via the DC/OS library, wait for completion, and delete any persistent data :param package_name: name of the package :type package_name: str :param service_name: unique service name for the package :type service_name: str :param role: role to use when deleting...
['Uninstall', 'a', 'package', 'via', 'the', 'DC', '/', 'OS', 'library', 'wait', 'for', 'completion', 'and', 'delete', 'any', 'persistent', 'data']
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/package.py#L282-L335
5,686
IndicoDataSolutions/IndicoIo-python
indicoio/utils/preprocessing.py
get_element_type
def get_element_type(_list, dimens): """ Given the dimensions of a nested list and the list, returns the type of the elements in the inner list. """ elem = _list for _ in range(len(dimens)): elem = elem[0] return type(elem)
python
def get_element_type(_list, dimens): """ Given the dimensions of a nested list and the list, returns the type of the elements in the inner list. """ elem = _list for _ in range(len(dimens)): elem = elem[0] return type(elem)
['def', 'get_element_type', '(', '_list', ',', 'dimens', ')', ':', 'elem', '=', '_list', 'for', '_', 'in', 'range', '(', 'len', '(', 'dimens', ')', ')', ':', 'elem', '=', 'elem', '[', '0', ']', 'return', 'type', '(', 'elem', ')']
Given the dimensions of a nested list and the list, returns the type of the elements in the inner list.
['Given', 'the', 'dimensions', 'of', 'a', 'nested', 'list', 'and', 'the', 'list', 'returns', 'the', 'type', 'of', 'the', 'elements', 'in', 'the', 'inner', 'list', '.']
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/preprocessing.py#L109-L117
5,687
gregreen/dustmaps
dustmaps/bayestar.py
BayestarQuery.query
def query(self, coords, mode='random_sample', return_flags=False, pct=None): """ Returns reddening at the requested coordinates. There are several different query modes, which handle the probabilistic nature of the map differently. Args: coords (:obj:`astropy.coordin...
python
def query(self, coords, mode='random_sample', return_flags=False, pct=None): """ Returns reddening at the requested coordinates. There are several different query modes, which handle the probabilistic nature of the map differently. Args: coords (:obj:`astropy.coordin...
['def', 'query', '(', 'self', ',', 'coords', ',', 'mode', '=', "'random_sample'", ',', 'return_flags', '=', 'False', ',', 'pct', '=', 'None', ')', ':', '# Check that the query mode is supported', 'self', '.', '_raise_on_mode', '(', 'mode', ')', '# Validate percentile specification', 'pct', ',', 'scalar_pct', '=', 'self...
Returns reddening at the requested coordinates. There are several different query modes, which handle the probabilistic nature of the map differently. Args: coords (:obj:`astropy.coordinates.SkyCoord`): The coordinates to query. mode (Optional[:obj:`str`]): Seven differe...
['Returns', 'reddening', 'at', 'the', 'requested', 'coordinates', '.', 'There', 'are', 'several', 'different', 'query', 'modes', 'which', 'handle', 'the', 'probabilistic', 'nature', 'of', 'the', 'map', 'differently', '.']
train
https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/bayestar.py#L255-L533
5,688
spacetelescope/stsci.tools
lib/stsci/tools/editpar.py
EditParDialog.checkSetSaveChildren
def checkSetSaveChildren(self, doSave=True): """Check, then set, then save the parameter settings for all child (pset) windows. Prompts if any problems are found. Returns None on success, list of bad entries on failure. """ if self.isChild: return #...
python
def checkSetSaveChildren(self, doSave=True): """Check, then set, then save the parameter settings for all child (pset) windows. Prompts if any problems are found. Returns None on success, list of bad entries on failure. """ if self.isChild: return #...
['def', 'checkSetSaveChildren', '(', 'self', ',', 'doSave', '=', 'True', ')', ':', 'if', 'self', '.', 'isChild', ':', 'return', '# Need to get all the entries and verify them.', '# Save the children in backwards order to coincide with the', '# display of the dialogs (LIFO)', 'for', 'n', 'in', 'range', '(', 'len', '(', ...
Check, then set, then save the parameter settings for all child (pset) windows. Prompts if any problems are found. Returns None on success, list of bad entries on failure.
['Check', 'then', 'set', 'then', 'save', 'the', 'parameter', 'settings', 'for', 'all', 'child', '(', 'pset', ')', 'windows', '.']
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/editpar.py#L1658-L1685
5,689
IdentityPython/pysaml2
src/saml2/argtree.py
add_path
def add_path(tdict, path): """ Create or extend an argument tree `tdict` from `path`. :param tdict: a dictionary representing a argument tree :param path: a path list :return: a dictionary Convert a list of items in a 'path' into a nested dict, where the second to last item becomes the key...
python
def add_path(tdict, path): """ Create or extend an argument tree `tdict` from `path`. :param tdict: a dictionary representing a argument tree :param path: a path list :return: a dictionary Convert a list of items in a 'path' into a nested dict, where the second to last item becomes the key...
['def', 'add_path', '(', 'tdict', ',', 'path', ')', ':', 't', '=', 'tdict', 'for', 'step', 'in', 'path', '[', ':', '-', '2', ']', ':', 'try', ':', 't', '=', 't', '[', 'step', ']', 'except', 'KeyError', ':', 't', '[', 'step', ']', '=', '{', '}', 't', '=', 't', '[', 'step', ']', 't', '[', 'path', '[', '-', '2', ']', ']',...
Create or extend an argument tree `tdict` from `path`. :param tdict: a dictionary representing a argument tree :param path: a path list :return: a dictionary Convert a list of items in a 'path' into a nested dict, where the second to last item becomes the key for the final item. The remaining ...
['Create', 'or', 'extend', 'an', 'argument', 'tree', 'tdict', 'from', 'path', '.']
train
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/argtree.py#L54-L94
5,690
UCSBarchlab/PyRTL
pyrtl/rtllib/multipliers.py
complex_mult
def complex_mult(A, B, shifts, start): """ Generate shift-and-add multiplier that can shift and add multiple bits per clock cycle. Uses substantially more space than `simple_mult()` but is much faster. :param WireVector A, B: two input wires for the multiplication :param int shifts: number of spaces Re...
python
def complex_mult(A, B, shifts, start): """ Generate shift-and-add multiplier that can shift and add multiple bits per clock cycle. Uses substantially more space than `simple_mult()` but is much faster. :param WireVector A, B: two input wires for the multiplication :param int shifts: number of spaces Re...
['def', 'complex_mult', '(', 'A', ',', 'B', ',', 'shifts', ',', 'start', ')', ':', 'alen', '=', 'len', '(', 'A', ')', 'blen', '=', 'len', '(', 'B', ')', 'areg', '=', 'pyrtl', '.', 'Register', '(', 'alen', ')', 'breg', '=', 'pyrtl', '.', 'Register', '(', 'alen', '+', 'blen', ')', 'accum', '=', 'pyrtl', '.', 'Register', ...
Generate shift-and-add multiplier that can shift and add multiple bits per clock cycle. Uses substantially more space than `simple_mult()` but is much faster. :param WireVector A, B: two input wires for the multiplication :param int shifts: number of spaces Register is to be shifted per clk cycle (...
['Generate', 'shift', '-', 'and', '-', 'add', 'multiplier', 'that', 'can', 'shift', 'and', 'add', 'multiple', 'bits', 'per', 'clock', 'cycle', '.', 'Uses', 'substantially', 'more', 'space', 'than', 'simple_mult', '()', 'but', 'is', 'much', 'faster', '.']
train
https://github.com/UCSBarchlab/PyRTL/blob/0988e5c9c10ededd5e1f58d5306603f9edf4b3e2/pyrtl/rtllib/multipliers.py#L67-L102
5,691
noahbenson/neuropythy
neuropythy/commands/surface_to_image.py
main
def main(args): ''' surface_to_rubbon.main(args) can be given a list of arguments, such as sys.argv[1:]; these arguments may include any options and must include exactly one subject id and one output filename. Additionally one or two surface input filenames must be given. The surface files are proje...
python
def main(args): ''' surface_to_rubbon.main(args) can be given a list of arguments, such as sys.argv[1:]; these arguments may include any options and must include exactly one subject id and one output filename. Additionally one or two surface input filenames must be given. The surface files are proje...
['def', 'main', '(', 'args', ')', ':', '# Parse the arguments', '(', 'args', ',', 'opts', ')', '=', '_surface_to_ribbon_parser', '(', 'args', ')', '# First, help?', 'if', 'opts', '[', "'help'", ']', ':', 'print', '(', 'info', ',', 'file', '=', 'sys', '.', 'stdout', ')', 'return', '1', '# and if we are verbose, lets set...
surface_to_rubbon.main(args) can be given a list of arguments, such as sys.argv[1:]; these arguments may include any options and must include exactly one subject id and one output filename. Additionally one or two surface input filenames must be given. The surface files are projected into the ribbon and wri...
['surface_to_rubbon', '.', 'main', '(', 'args', ')', 'can', 'be', 'given', 'a', 'list', 'of', 'arguments', 'such', 'as', 'sys', '.', 'argv', '[', '1', ':', ']', ';', 'these', 'arguments', 'may', 'include', 'any', 'options', 'and', 'must', 'include', 'exactly', 'one', 'subject', 'id', 'and', 'one', 'output', 'filename',...
train
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/commands/surface_to_image.py#L83-L187
5,692
pricingassistant/mongokat
mongokat/collection.py
Collection.find_one
def find_one(self, *args, **kwargs): """ Get a single document from the database. """ doc = self._collection_with_options(kwargs).find_one(*args, **kwargs) if doc is None: return None return doc
python
def find_one(self, *args, **kwargs): """ Get a single document from the database. """ doc = self._collection_with_options(kwargs).find_one(*args, **kwargs) if doc is None: return None return doc
['def', 'find_one', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'doc', '=', 'self', '.', '_collection_with_options', '(', 'kwargs', ')', '.', 'find_one', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', 'if', 'doc', 'is', 'None', ':', 'return', 'None', 'return', 'doc']
Get a single document from the database.
['Get', 'a', 'single', 'document', 'from', 'the', 'database', '.']
train
https://github.com/pricingassistant/mongokat/blob/61eaf4bc1c4cc359c6f9592ec97b9a04d9561411/mongokat/collection.py#L203-L211
5,693
IzunaDevs/SnekChek
snekchek/config_gen.py
ConfigGenerator.main
def main(self) -> None: """The main function for generating the config file""" path = ask_path("where should the config be stored?", ".snekrc") conf = configobj.ConfigObj() tools = self.get_tools() for tool in tools: conf[tool] = getattr(self, tool)() # pylint: dis...
python
def main(self) -> None: """The main function for generating the config file""" path = ask_path("where should the config be stored?", ".snekrc") conf = configobj.ConfigObj() tools = self.get_tools() for tool in tools: conf[tool] = getattr(self, tool)() # pylint: dis...
['def', 'main', '(', 'self', ')', '->', 'None', ':', 'path', '=', 'ask_path', '(', '"where should the config be stored?"', ',', '".snekrc"', ')', 'conf', '=', 'configobj', '.', 'ConfigObj', '(', ')', 'tools', '=', 'self', '.', 'get_tools', '(', ')', 'for', 'tool', 'in', 'tools', ':', 'conf', '[', 'tool', ']', '=', 'get...
The main function for generating the config file
['The', 'main', 'function', 'for', 'generating', 'the', 'config', 'file']
train
https://github.com/IzunaDevs/SnekChek/blob/fdb01bdf1ec8e79d9aae2a11d96bfb27e53a97a9/snekchek/config_gen.py#L68-L84
5,694
apple/turicreate
src/unity/python/turicreate/util/__init__.py
_assert_sframe_equal
def _assert_sframe_equal(sf1, sf2, check_column_names=True, check_column_order=True, check_row_order=True, float_column_delta=None): """ Assert the two SFrames are equal. The default...
python
def _assert_sframe_equal(sf1, sf2, check_column_names=True, check_column_order=True, check_row_order=True, float_column_delta=None): """ Assert the two SFrames are equal. The default...
['def', '_assert_sframe_equal', '(', 'sf1', ',', 'sf2', ',', 'check_column_names', '=', 'True', ',', 'check_column_order', '=', 'True', ',', 'check_row_order', '=', 'True', ',', 'float_column_delta', '=', 'None', ')', ':', 'from', '.', '.', 'import', 'SFrame', 'as', '_SFrame', 'if', '(', 'type', '(', 'sf1', ')', 'is', ...
Assert the two SFrames are equal. The default behavior of this function uses the strictest possible definition of equality, where all columns must be in the same order, with the same names and have the same data in the same order. Each of these stipulations can be relaxed individually and in concert w...
['Assert', 'the', 'two', 'SFrames', 'are', 'equal', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L263-L365
5,695
wbond/asn1crypto
asn1crypto/core.py
Asn1Value._copy
def _copy(self, other, copy_func): """ Copies the contents of another Asn1Value object to itself :param object: Another instance of the same class :param copy_func: An reference of copy.copy() or copy.deepcopy() to use when copying lists, dicts and o...
python
def _copy(self, other, copy_func): """ Copies the contents of another Asn1Value object to itself :param object: Another instance of the same class :param copy_func: An reference of copy.copy() or copy.deepcopy() to use when copying lists, dicts and o...
['def', '_copy', '(', 'self', ',', 'other', ',', 'copy_func', ')', ':', 'if', 'self', '.', '__class__', '!=', 'other', '.', '__class__', ':', 'raise', 'TypeError', '(', 'unwrap', '(', "'''\n Can not copy values from %s object to %s object\n '''", ',', 'type_name', '(', 'other', ')', ',', '...
Copies the contents of another Asn1Value object to itself :param object: Another instance of the same class :param copy_func: An reference of copy.copy() or copy.deepcopy() to use when copying lists, dicts and objects
['Copies', 'the', 'contents', 'of', 'another', 'Asn1Value', 'object', 'to', 'itself']
train
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/core.py#L546-L568
5,696
bram85/topydo
topydo/ui/columns/TodoListWidget.py
TodoListWidget.execute_builtin_action
def execute_builtin_action(self, p_action_str, p_size=None): """ Executes built-in action specified in p_action_str. Currently supported actions are: 'up', 'down', 'home', 'end', 'first_column', 'last_column', 'prev_column', 'next_column', 'append_column', 'insert_column', 'edit...
python
def execute_builtin_action(self, p_action_str, p_size=None): """ Executes built-in action specified in p_action_str. Currently supported actions are: 'up', 'down', 'home', 'end', 'first_column', 'last_column', 'prev_column', 'next_column', 'append_column', 'insert_column', 'edit...
['def', 'execute_builtin_action', '(', 'self', ',', 'p_action_str', ',', 'p_size', '=', 'None', ')', ':', 'column_actions', '=', '[', "'first_column'", ',', "'last_column'", ',', "'prev_column'", ',', "'next_column'", ',', "'append_column'", ',', "'insert_column'", ',', "'edit_column'", ',', "'delete_column'", ',', "'c...
Executes built-in action specified in p_action_str. Currently supported actions are: 'up', 'down', 'home', 'end', 'first_column', 'last_column', 'prev_column', 'next_column', 'append_column', 'insert_column', 'edit_column', 'delete_column', 'copy_column', swap_right', 'swap_left', 'post...
['Executes', 'built', '-', 'in', 'action', 'specified', 'in', 'p_action_str', '.']
train
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/ui/columns/TodoListWidget.py#L277-L318
5,697
nephila/python-taiga
taiga/models/models.py
Project.add_webhook
def add_webhook(self, name, url, key, **attrs): """ Add a new Webhook and return a :class:`Webhook` object. :param name: name of the :class:`Webhook` :param url: payload url of the :class:`Webhook` :param key: secret key of the :class:`Webhook` :param attrs: optional att...
python
def add_webhook(self, name, url, key, **attrs): """ Add a new Webhook and return a :class:`Webhook` object. :param name: name of the :class:`Webhook` :param url: payload url of the :class:`Webhook` :param key: secret key of the :class:`Webhook` :param attrs: optional att...
['def', 'add_webhook', '(', 'self', ',', 'name', ',', 'url', ',', 'key', ',', '*', '*', 'attrs', ')', ':', 'return', 'Webhooks', '(', 'self', '.', 'requester', ')', '.', 'create', '(', 'self', '.', 'id', ',', 'name', ',', 'url', ',', 'key', ',', '*', '*', 'attrs', ')']
Add a new Webhook and return a :class:`Webhook` object. :param name: name of the :class:`Webhook` :param url: payload url of the :class:`Webhook` :param key: secret key of the :class:`Webhook` :param attrs: optional attributes for :class:`Webhook`
['Add', 'a', 'new', 'Webhook', 'and', 'return', 'a', ':', 'class', ':', 'Webhook', 'object', '.']
train
https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/models.py#L1500-L1511
5,698
saltstack/salt
salt/modules/file.py
extract_hash
def extract_hash(hash_fn, hash_type='sha256', file_name='', source='', source_hash_name=None): ''' .. versionchanged:: 2016.3.5 Prior to this version, only the ``file_name`` argument was considered for filename matches in the ha...
python
def extract_hash(hash_fn, hash_type='sha256', file_name='', source='', source_hash_name=None): ''' .. versionchanged:: 2016.3.5 Prior to this version, only the ``file_name`` argument was considered for filename matches in the ha...
['def', 'extract_hash', '(', 'hash_fn', ',', 'hash_type', '=', "'sha256'", ',', 'file_name', '=', "''", ',', 'source', '=', "''", ',', 'source_hash_name', '=', 'None', ')', ':', 'hash_len', '=', 'HASHES', '.', 'get', '(', 'hash_type', ')', 'if', 'hash_len', 'is', 'None', ':', 'if', 'hash_type', ':', 'log', '.', 'warnin...
.. versionchanged:: 2016.3.5 Prior to this version, only the ``file_name`` argument was considered for filename matches in the hash file. This would be problematic for cases in which the user was relying on a remote checksum file that they do not control, and they wished to use a differe...
['..', 'versionchanged', '::', '2016', '.', '3', '.', '5', 'Prior', 'to', 'this', 'version', 'only', 'the', 'file_name', 'argument', 'was', 'considered', 'for', 'filename', 'matches', 'in', 'the', 'hash', 'file', '.', 'This', 'would', 'be', 'problematic', 'for', 'cases', 'in', 'which', 'the', 'user', 'was', 'relying', ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L4336-L4563
5,699
klahnakoski/pyLibrary
jx_python/namespace/rename.py
Rename.convert
def convert(self, expr): """ EXPAND INSTANCES OF name TO value """ if expr is True or expr == None or expr is False: return expr elif is_number(expr): return expr elif expr == ".": return "." elif is_variable_name(expr): ...
python
def convert(self, expr): """ EXPAND INSTANCES OF name TO value """ if expr is True or expr == None or expr is False: return expr elif is_number(expr): return expr elif expr == ".": return "." elif is_variable_name(expr): ...
['def', 'convert', '(', 'self', ',', 'expr', ')', ':', 'if', 'expr', 'is', 'True', 'or', 'expr', '==', 'None', 'or', 'expr', 'is', 'False', ':', 'return', 'expr', 'elif', 'is_number', '(', 'expr', ')', ':', 'return', 'expr', 'elif', 'expr', '==', '"."', ':', 'return', '"."', 'elif', 'is_variable_name', '(', 'expr', ')'...
EXPAND INSTANCES OF name TO value
['EXPAND', 'INSTANCES', 'OF', 'name', 'TO', 'value']
train
https://github.com/klahnakoski/pyLibrary/blob/fa2dcbc48fda8d26999baef400e9a98149e0b982/jx_python/namespace/rename.py#L39-L70