repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
pyviz/holoviews
holoviews/plotting/plot.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plot.py#L1341-L1378
def _get_subplot_extents(self, overlay, ranges, range_type): """ Iterates over all subplots and collects the extents of each. """ if range_type == 'combined': extents = {'extents': [], 'soft': [], 'hard': [], 'data': []} else: extents = {range_type: []} ...
[ "def", "_get_subplot_extents", "(", "self", ",", "overlay", ",", "ranges", ",", "range_type", ")", ":", "if", "range_type", "==", "'combined'", ":", "extents", "=", "{", "'extents'", ":", "[", "]", ",", "'soft'", ":", "[", "]", ",", "'hard'", ":", "[",...
Iterates over all subplots and collects the extents of each.
[ "Iterates", "over", "all", "subplots", "and", "collects", "the", "extents", "of", "each", "." ]
python
train
asyncdef/apyio
apyio/__init__.py
https://github.com/asyncdef/apyio/blob/d6b914929269b8795ca4d6b1ede8a393841cbc29/apyio/__init__.py#L150-L184
def wrap_file(file_like_obj): """Wrap a file like object in an async stream wrapper. Files generated with `open()` may be one of several types. This convenience function retruns the stream wrapped in the most appropriate wrapper for the type. If the stream is already wrapped it is returned unaltere...
[ "def", "wrap_file", "(", "file_like_obj", ")", ":", "if", "isinstance", "(", "file_like_obj", ",", "AsyncIOBaseWrapper", ")", ":", "return", "file_like_obj", "if", "isinstance", "(", "file_like_obj", ",", "sync_io", ".", "FileIO", ")", ":", "return", "AsyncFileI...
Wrap a file like object in an async stream wrapper. Files generated with `open()` may be one of several types. This convenience function retruns the stream wrapped in the most appropriate wrapper for the type. If the stream is already wrapped it is returned unaltered.
[ "Wrap", "a", "file", "like", "object", "in", "an", "async", "stream", "wrapper", "." ]
python
train
thombashi/SimpleSQLite
simplesqlite/core.py
https://github.com/thombashi/SimpleSQLite/blob/b16f212132b9b98773e68bf7395abc2f60f56fe5/simplesqlite/core.py#L1439-L1464
def create_table_from_dataframe( self, dataframe, table_name="", primary_key=None, add_primary_key_column=False, index_attrs=None, ): """ Create a table from a pandas.DataFrame instance. :param pandas.DataFrame dataframe: DataFrame instance to...
[ "def", "create_table_from_dataframe", "(", "self", ",", "dataframe", ",", "table_name", "=", "\"\"", ",", "primary_key", "=", "None", ",", "add_primary_key_column", "=", "False", ",", "index_attrs", "=", "None", ",", ")", ":", "self", ".", "__create_table_from_t...
Create a table from a pandas.DataFrame instance. :param pandas.DataFrame dataframe: DataFrame instance to convert. :param str table_name: Table name to create. :param str primary_key: |primary_key| :param tuple index_attrs: |index_attrs| :Examples: :ref:`example-cre...
[ "Create", "a", "table", "from", "a", "pandas", ".", "DataFrame", "instance", "." ]
python
train
sorgerlab/indra
rest_api/api.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L89-L97
def trips_process_xml(): """Process TRIPS EKB XML and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) xml_str = body.get('xml_str') tp = trips.process_xml(xml_str) return _stmts_from_proc...
[ "def", "trips_process_xml", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "load...
Process TRIPS EKB XML and return INDRA Statements.
[ "Process", "TRIPS", "EKB", "XML", "and", "return", "INDRA", "Statements", "." ]
python
train
pandas-dev/pandas
pandas/core/reshape/merge.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/reshape/merge.py#L735-L740
def _get_join_indexers(self): """ return the join indexers """ return _get_join_indexers(self.left_join_keys, self.right_join_keys, sort=self.sort, how=self.how)
[ "def", "_get_join_indexers", "(", "self", ")", ":", "return", "_get_join_indexers", "(", "self", ".", "left_join_keys", ",", "self", ".", "right_join_keys", ",", "sort", "=", "self", ".", "sort", ",", "how", "=", "self", ".", "how", ")" ]
return the join indexers
[ "return", "the", "join", "indexers" ]
python
train
hydraplatform/hydra-base
hydra_base/lib/network.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/network.py#L2523-L2630
def clone_network(network_id, recipient_user_id=None, new_network_name=None, project_id=None, project_name=None, new_project=True, **kwargs): """ Create an exact clone of the specified network for the specified user. If project_id is specified, put the new network in there. Otherwise create a new ...
[ "def", "clone_network", "(", "network_id", ",", "recipient_user_id", "=", "None", ",", "new_network_name", "=", "None", ",", "project_id", "=", "None", ",", "project_name", "=", "None", ",", "new_project", "=", "True", ",", "*", "*", "kwargs", ")", ":", "u...
Create an exact clone of the specified network for the specified user. If project_id is specified, put the new network in there. Otherwise create a new project with the specified name and put it in there.
[ "Create", "an", "exact", "clone", "of", "the", "specified", "network", "for", "the", "specified", "user", "." ]
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L24914-L24944
def notify_update_image(self, x, y, width, height, image): """Informs about an update and provides 32bpp bitmap. in x of type int in y of type int in width of type int in height of type int in image of type str Array with 32BPP image data. """ ...
[ "def", "notify_update_image", "(", "self", ",", "x", ",", "y", ",", "width", ",", "height", ",", "image", ")", ":", "if", "not", "isinstance", "(", "x", ",", "baseinteger", ")", ":", "raise", "TypeError", "(", "\"x can only be an instance of type baseinteger\"...
Informs about an update and provides 32bpp bitmap. in x of type int in y of type int in width of type int in height of type int in image of type str Array with 32BPP image data.
[ "Informs", "about", "an", "update", "and", "provides", "32bpp", "bitmap", "." ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3104-L3122
def get_process_hardware_breakpoints(self, dwProcessId): """ @see: L{get_thread_hardware_breakpoints} @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of tuple( int, L{HardwareBreakpoint} ) @return: All hardware breakpoints for each thread in...
[ "def", "get_process_hardware_breakpoints", "(", "self", ",", "dwProcessId", ")", ":", "result", "=", "list", "(", ")", "aProcess", "=", "self", ".", "system", ".", "get_process", "(", "dwProcessId", ")", "for", "dwThreadId", "in", "aProcess", ".", "iter_thread...
@see: L{get_thread_hardware_breakpoints} @type dwProcessId: int @param dwProcessId: Process global ID. @rtype: list of tuple( int, L{HardwareBreakpoint} ) @return: All hardware breakpoints for each thread in the given process as a list of tuples (tid, bp).
[ "@see", ":", "L", "{", "get_thread_hardware_breakpoints", "}" ]
python
train
ray-project/ray
python/ray/utils.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/utils.py#L160-L181
def decode(byte_str, allow_none=False): """Make this unicode in Python 3, otherwise leave it as bytes. Args: byte_str: The byte string to decode. allow_none: If true, then we will allow byte_str to be None in which case we will return an empty string. TODO(rkn): Remove this flag. ...
[ "def", "decode", "(", "byte_str", ",", "allow_none", "=", "False", ")", ":", "if", "byte_str", "is", "None", "and", "allow_none", ":", "return", "\"\"", "if", "not", "isinstance", "(", "byte_str", ",", "bytes", ")", ":", "raise", "ValueError", "(", "\"Th...
Make this unicode in Python 3, otherwise leave it as bytes. Args: byte_str: The byte string to decode. allow_none: If true, then we will allow byte_str to be None in which case we will return an empty string. TODO(rkn): Remove this flag. This is only here to simplify upgradi...
[ "Make", "this", "unicode", "in", "Python", "3", "otherwise", "leave", "it", "as", "bytes", "." ]
python
train
bunq/sdk_python
bunq/sdk/model/generated/endpoint.py
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/generated/endpoint.py#L17716-L17802
def create(cls, currency, all_co_owner, description=None, daily_limit=None, overdraft_limit=None, alias=None, avatar_uuid=None, status=None, sub_status=None, reason=None, reason_description=None, notification_filters=None, setting=None, custom_headers=None): """ ...
[ "def", "create", "(", "cls", ",", "currency", ",", "all_co_owner", ",", "description", "=", "None", ",", "daily_limit", "=", "None", ",", "overdraft_limit", "=", "None", ",", "alias", "=", "None", ",", "avatar_uuid", "=", "None", ",", "status", "=", "Non...
:type user_id: int :param currency: The currency of the MonetaryAccountJoint as an ISO 4217 formatted currency code. :type currency: str :param all_co_owner: The users the account will be joint with. :type all_co_owner: list[object_.CoOwner] :param description: The descri...
[ ":", "type", "user_id", ":", "int", ":", "param", "currency", ":", "The", "currency", "of", "the", "MonetaryAccountJoint", "as", "an", "ISO", "4217", "formatted", "currency", "code", ".", ":", "type", "currency", ":", "str", ":", "param", "all_co_owner", "...
python
train
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L3780-L3842
def fit_radius_from_potentials(z, SampleFreq, Damping, HistBins=100, show_fig=False): """ Fits the dynamical potential to the Steady State Potential by varying the Radius. z : ndarray Position data SampleFreq : float frequency at which the position data was sampled ...
[ "def", "fit_radius_from_potentials", "(", "z", ",", "SampleFreq", ",", "Damping", ",", "HistBins", "=", "100", ",", "show_fig", "=", "False", ")", ":", "dt", "=", "1", "/", "SampleFreq", "boltzmann", "=", "Boltzmann", "temp", "=", "300", "# why halved??", ...
Fits the dynamical potential to the Steady State Potential by varying the Radius. z : ndarray Position data SampleFreq : float frequency at which the position data was sampled Damping : float value of damping (in radians/second) HistBins : int number of...
[ "Fits", "the", "dynamical", "potential", "to", "the", "Steady", "State", "Potential", "by", "varying", "the", "Radius", ".", "z", ":", "ndarray", "Position", "data", "SampleFreq", ":", "float", "frequency", "at", "which", "the", "position", "data", "was", "s...
python
train
hyperledger-archives/indy-anoncreds
anoncreds/protocol/utils.py
https://github.com/hyperledger-archives/indy-anoncreds/blob/9d9cda3d505c312257d99a13d74d8f05dac3091a/anoncreds/protocol/utils.py#L264-L274
def genPrime(): """ Generate 2 large primes `p_prime` and `q_prime` and use them to generate another 2 primes `p` and `q` of 1024 bits """ prime = cmod.randomPrime(LARGE_PRIME) i = 0 while not cmod.isPrime(2 * prime + 1): prime = cmod.randomPrime(LARGE_PRIME) i += 1 retur...
[ "def", "genPrime", "(", ")", ":", "prime", "=", "cmod", ".", "randomPrime", "(", "LARGE_PRIME", ")", "i", "=", "0", "while", "not", "cmod", ".", "isPrime", "(", "2", "*", "prime", "+", "1", ")", ":", "prime", "=", "cmod", ".", "randomPrime", "(", ...
Generate 2 large primes `p_prime` and `q_prime` and use them to generate another 2 primes `p` and `q` of 1024 bits
[ "Generate", "2", "large", "primes", "p_prime", "and", "q_prime", "and", "use", "them", "to", "generate", "another", "2", "primes", "p", "and", "q", "of", "1024", "bits" ]
python
train
blakev/python-syncthing
syncthing/__init__.py
https://github.com/blakev/python-syncthing/blob/a7f4930f86f7543cd96990277945467896fb523d/syncthing/__init__.py#L288-L298
def config_insync(self): """ Returns whether the config is in sync, i.e. whether the running configuration is the same as that on disk. Returns: bool """ status = self.get('config/insync').get('configInSync', False) if status is None: ...
[ "def", "config_insync", "(", "self", ")", ":", "status", "=", "self", ".", "get", "(", "'config/insync'", ")", ".", "get", "(", "'configInSync'", ",", "False", ")", "if", "status", "is", "None", ":", "status", "=", "False", "return", "status" ]
Returns whether the config is in sync, i.e. whether the running configuration is the same as that on disk. Returns: bool
[ "Returns", "whether", "the", "config", "is", "in", "sync", "i", ".", "e", ".", "whether", "the", "running", "configuration", "is", "the", "same", "as", "that", "on", "disk", "." ]
python
train
coleifer/walrus
walrus/cache.py
https://github.com/coleifer/walrus/blob/82bf15a6613487b5b5fefeb488f186d7e0106547/walrus/cache.py#L217-L249
def cache_async(self, key_fn=_key_fn, timeout=3600): """ Decorator that will execute the cached function in a separate thread. The function will immediately return, returning a callable to the user. This callable can be used to check for a return value. For details, see ...
[ "def", "cache_async", "(", "self", ",", "key_fn", "=", "_key_fn", ",", "timeout", "=", "3600", ")", ":", "def", "decorator", "(", "fn", ")", ":", "wrapped", "=", "self", ".", "cached", "(", "key_fn", ",", "timeout", ")", "(", "fn", ")", "@", "wraps...
Decorator that will execute the cached function in a separate thread. The function will immediately return, returning a callable to the user. This callable can be used to check for a return value. For details, see the :ref:`cache-async` section of the docs. :param key_fn: Funct...
[ "Decorator", "that", "will", "execute", "the", "cached", "function", "in", "a", "separate", "thread", ".", "The", "function", "will", "immediately", "return", "returning", "a", "callable", "to", "the", "user", ".", "This", "callable", "can", "be", "used", "t...
python
train
xoolive/traffic
traffic/algorithms/cpa.py
https://github.com/xoolive/traffic/blob/d1a8878098f16759f6b6e0e8d8b8f32e34a680a8/traffic/algorithms/cpa.py#L84-L216
def closest_point_of_approach( traffic: Traffic, lateral_separation: float, vertical_separation: float, projection: Union[pyproj.Proj, crs.Projection, None] = None, round_t: str = "d", max_workers: int = 4, ) -> CPA: """ Computes a CPA dataframe for all pairs of trajectories candidates f...
[ "def", "closest_point_of_approach", "(", "traffic", ":", "Traffic", ",", "lateral_separation", ":", "float", ",", "vertical_separation", ":", "float", ",", "projection", ":", "Union", "[", "pyproj", ".", "Proj", ",", "crs", ".", "Projection", ",", "None", "]",...
Computes a CPA dataframe for all pairs of trajectories candidates for being separated by less than lateral_separation in vertical_separation. In order to be computed efficiently, the method needs the following parameters: - projection: a first filtering is applied on the bounding boxes of trajecto...
[ "Computes", "a", "CPA", "dataframe", "for", "all", "pairs", "of", "trajectories", "candidates", "for", "being", "separated", "by", "less", "than", "lateral_separation", "in", "vertical_separation", "." ]
python
train
openstack/monasca-common
monasca_common/kafka_lib/protocol.py
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/kafka_lib/protocol.py#L601-L619
def create_gzip_message(payloads, key=None, compresslevel=None): """ Construct a Gzipped Message containing multiple Messages The given payloads will be encoded, compressed, and sent as a single atomic message to Kafka. Arguments: payloads: list(bytes), a list of payload to send be sent to...
[ "def", "create_gzip_message", "(", "payloads", ",", "key", "=", "None", ",", "compresslevel", "=", "None", ")", ":", "message_set", "=", "KafkaProtocol", ".", "_encode_message_set", "(", "[", "create_message", "(", "payload", ",", "pl_key", ")", "for", "payloa...
Construct a Gzipped Message containing multiple Messages The given payloads will be encoded, compressed, and sent as a single atomic message to Kafka. Arguments: payloads: list(bytes), a list of payload to send be sent to Kafka key: bytes, a key used for partition routing (optional)
[ "Construct", "a", "Gzipped", "Message", "containing", "multiple", "Messages" ]
python
train
saltstack/salt
salt/modules/win_certutil.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_certutil.py#L55-L72
def get_stored_cert_serials(store): ''' Get all of the certificate serials in the specified store store The store to get all the certificate serials from CLI Example: .. code-block:: bash salt '*' certutil.get_stored_cert_serials <store> ''' cmd = "certutil.exe -store {0}...
[ "def", "get_stored_cert_serials", "(", "store", ")", ":", "cmd", "=", "\"certutil.exe -store {0}\"", ".", "format", "(", "store", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "# match serial numbers by header position to work with multiple langua...
Get all of the certificate serials in the specified store store The store to get all the certificate serials from CLI Example: .. code-block:: bash salt '*' certutil.get_stored_cert_serials <store>
[ "Get", "all", "of", "the", "certificate", "serials", "in", "the", "specified", "store" ]
python
train
Nic30/hwt
hwt/hdl/types/hdlType.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/types/hdlType.py#L28-L33
def fromPy(self, v, vldMask=None): """ Construct value of this type. Delegated on value class for this type """ return self.getValueCls().fromPy(v, self, vldMask=vldMask)
[ "def", "fromPy", "(", "self", ",", "v", ",", "vldMask", "=", "None", ")", ":", "return", "self", ".", "getValueCls", "(", ")", ".", "fromPy", "(", "v", ",", "self", ",", "vldMask", "=", "vldMask", ")" ]
Construct value of this type. Delegated on value class for this type
[ "Construct", "value", "of", "this", "type", ".", "Delegated", "on", "value", "class", "for", "this", "type" ]
python
test
saltstack/salt
salt/modules/libcloud_compute.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_compute.py#L155-L178
def list_locations(profile, **libcloud_kwargs): ''' Return a list of locations for this cloud :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_locations method :type libcloud_kwargs: ``dict`` CLI Example: .. code-b...
[ "def", "list_locations", "(", "profile", ",", "*", "*", "libcloud_kwargs", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "libcloud_kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "libcloud_k...
Return a list of locations for this cloud :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_locations method :type libcloud_kwargs: ``dict`` CLI Example: .. code-block:: bash salt myminion libcloud_compute.list_loc...
[ "Return", "a", "list", "of", "locations", "for", "this", "cloud" ]
python
train
zyga/python-glibc
glibc.py
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/glibc.py#L159-L164
def lazily(self, name, callable, args): """ Load something lazily """ self._lazy[name] = callable, args self._all.add(name)
[ "def", "lazily", "(", "self", ",", "name", ",", "callable", ",", "args", ")", ":", "self", ".", "_lazy", "[", "name", "]", "=", "callable", ",", "args", "self", ".", "_all", ".", "add", "(", "name", ")" ]
Load something lazily
[ "Load", "something", "lazily" ]
python
train
narfman0/helga-markovify
helga_markovify/markov.py
https://github.com/narfman0/helga-markovify/blob/b5a82de070102e6da1fd3f5f81cad12d0a9185d8/helga_markovify/markov.py#L7-L12
def punctuate(current_text, new_text, add_punctuation): """ Add punctuation as needed """ if add_punctuation and current_text and not current_text[-1] in string.punctuation: current_text += '. ' spacer = ' ' if not current_text or (not current_text[-1].isspace() and not new_text[0].isspace()) else '...
[ "def", "punctuate", "(", "current_text", ",", "new_text", ",", "add_punctuation", ")", ":", "if", "add_punctuation", "and", "current_text", "and", "not", "current_text", "[", "-", "1", "]", "in", "string", ".", "punctuation", ":", "current_text", "+=", "'. '",...
Add punctuation as needed
[ "Add", "punctuation", "as", "needed" ]
python
train
vintasoftware/django-role-permissions
rolepermissions/roles.py
https://github.com/vintasoftware/django-role-permissions/blob/28924361e689e994e0c3575e18104a1a5abd8de6/rolepermissions/roles.py#L233-L240
def clear_roles(user): """Remove all roles from a user.""" roles = get_user_roles(user) for role in roles: role.remove_role_from_user(user) return roles
[ "def", "clear_roles", "(", "user", ")", ":", "roles", "=", "get_user_roles", "(", "user", ")", "for", "role", "in", "roles", ":", "role", ".", "remove_role_from_user", "(", "user", ")", "return", "roles" ]
Remove all roles from a user.
[ "Remove", "all", "roles", "from", "a", "user", "." ]
python
train
google/grr
grr/server/grr_response_server/databases/mysql_users.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_users.py#L254-L289
def ReadApprovalRequests(self, requestor_username, approval_type, subject_id=None, include_expired=False, cursor=None): """Reads approval requests of a given type for a given user."...
[ "def", "ReadApprovalRequests", "(", "self", ",", "requestor_username", ",", "approval_type", ",", "subject_id", "=", "None", ",", "include_expired", "=", "False", ",", "cursor", "=", "None", ")", ":", "query", "=", "\"\"\"\n SELECT\n ar.approval_id,\...
Reads approval requests of a given type for a given user.
[ "Reads", "approval", "requests", "of", "a", "given", "type", "for", "a", "given", "user", "." ]
python
train
marcomusy/vtkplotter
vtkplotter/actors.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/actors.py#L1920-L1942
def addGaussNoise(self, sigma): """ Add gaussian noise. :param float sigma: sigma is expressed in percent of the diagonal size of actor. :Example: .. code-block:: python from vtkplotter import Sphere Sphe...
[ "def", "addGaussNoise", "(", "self", ",", "sigma", ")", ":", "sz", "=", "self", ".", "diagonalSize", "(", ")", "pts", "=", "self", ".", "coordinates", "(", ")", "n", "=", "len", "(", "pts", ")", "ns", "=", "np", ".", "random", ".", "randn", "(", ...
Add gaussian noise. :param float sigma: sigma is expressed in percent of the diagonal size of actor. :Example: .. code-block:: python from vtkplotter import Sphere Sphere().addGaussNoise(1.0).show()
[ "Add", "gaussian", "noise", "." ]
python
train
DataDog/integrations-core
mongo/datadog_checks/mongo/mongo.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/mongo/datadog_checks/mongo/mongo.py#L537-L557
def _resolve_metric(self, original_metric_name, metrics_to_collect, prefix=""): """ Return the submit method and the metric name to use. The metric name is defined as follow: * If available, the normalized metric name alias * (Or) the normalized original metric name """ ...
[ "def", "_resolve_metric", "(", "self", ",", "original_metric_name", ",", "metrics_to_collect", ",", "prefix", "=", "\"\"", ")", ":", "submit_method", "=", "(", "metrics_to_collect", "[", "original_metric_name", "]", "[", "0", "]", "if", "isinstance", "(", "metri...
Return the submit method and the metric name to use. The metric name is defined as follow: * If available, the normalized metric name alias * (Or) the normalized original metric name
[ "Return", "the", "submit", "method", "and", "the", "metric", "name", "to", "use", "." ]
python
train
openstack/swauth
swauth/authtypes.py
https://github.com/openstack/swauth/blob/0c8eaf50a9e2b3317f3eba62f205546904bc6d74/swauth/authtypes.py#L42-L60
def validate_creds(creds): """Parse and validate user credentials whether format is right :param creds: User credentials :returns: Auth_type class instance and parsed user credentials in dict :raises ValueError: If credential format is wrong (eg: bad auth_type) """ try: auth_type, auth_...
[ "def", "validate_creds", "(", "creds", ")", ":", "try", ":", "auth_type", ",", "auth_rest", "=", "creds", ".", "split", "(", "':'", ",", "1", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "\"Missing ':' in %s\"", "%", "creds", ")", "authtyp...
Parse and validate user credentials whether format is right :param creds: User credentials :returns: Auth_type class instance and parsed user credentials in dict :raises ValueError: If credential format is wrong (eg: bad auth_type)
[ "Parse", "and", "validate", "user", "credentials", "whether", "format", "is", "right" ]
python
train
stephen-bunn/file-config
tasks/package.py
https://github.com/stephen-bunn/file-config/blob/93429360c949985202e1f2b9cd0340731819ba75/tasks/package.py#L145-L155
def stub(ctx): """ Generate typing stubs for the package. """ report.info(ctx, "package.stub", f"generating typing stubs for package") ctx.run( f"stubgen --include-private --no-import " f"--output {ctx.directory.joinpath('stubs')!s} " f"--search-path {ctx.directory.joinpath('src...
[ "def", "stub", "(", "ctx", ")", ":", "report", ".", "info", "(", "ctx", ",", "\"package.stub\"", ",", "f\"generating typing stubs for package\"", ")", "ctx", ".", "run", "(", "f\"stubgen --include-private --no-import \"", "f\"--output {ctx.directory.joinpath('stubs')!s} \""...
Generate typing stubs for the package.
[ "Generate", "typing", "stubs", "for", "the", "package", "." ]
python
train
tuxu/python-samplerate
samplerate/lowlevel.py
https://github.com/tuxu/python-samplerate/blob/ed73d7a39e61bfb34b03dade14ffab59aa27922a/samplerate/lowlevel.py#L86-L102
def src_simple(input_data, output_data, ratio, converter_type, channels): """Perform a single conversion from an input buffer to an output buffer. Simple interface for performing a single conversion from input buffer to output buffer at a fixed conversion ratio. Simple interface does not require initia...
[ "def", "src_simple", "(", "input_data", ",", "output_data", ",", "ratio", ",", "converter_type", ",", "channels", ")", ":", "input_frames", ",", "_", "=", "_check_data", "(", "input_data", ")", "output_frames", ",", "_", "=", "_check_data", "(", "output_data",...
Perform a single conversion from an input buffer to an output buffer. Simple interface for performing a single conversion from input buffer to output buffer at a fixed conversion ratio. Simple interface does not require initialisation as it can only operate on a single buffer worth of audio.
[ "Perform", "a", "single", "conversion", "from", "an", "input", "buffer", "to", "an", "output", "buffer", "." ]
python
train
krukas/Trionyx
trionyx/utils.py
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/utils.py#L24-L28
def import_object_by_string(namespace): """Import object by complete namespace""" segments = namespace.split('.') module = importlib.import_module('.'.join(segments[:-1])) return getattr(module, segments[-1])
[ "def", "import_object_by_string", "(", "namespace", ")", ":", "segments", "=", "namespace", ".", "split", "(", "'.'", ")", "module", "=", "importlib", ".", "import_module", "(", "'.'", ".", "join", "(", "segments", "[", ":", "-", "1", "]", ")", ")", "r...
Import object by complete namespace
[ "Import", "object", "by", "complete", "namespace" ]
python
train
odlgroup/odl
odl/operator/operator.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/operator/operator.py#L1801-L1824
def derivative(self, x): """Return the derivative at ``x``. The derivative of the right scalar operator multiplication follows the chain rule: ``OperatorRightScalarMult(op, s).derivative(y) == OperatorLeftScalarMult(op.derivative(s * y), s)`` Parameters ...
[ "def", "derivative", "(", "self", ",", "x", ")", ":", "return", "self", ".", "scalar", "*", "self", ".", "operator", ".", "derivative", "(", "self", ".", "scalar", "*", "x", ")" ]
Return the derivative at ``x``. The derivative of the right scalar operator multiplication follows the chain rule: ``OperatorRightScalarMult(op, s).derivative(y) == OperatorLeftScalarMult(op.derivative(s * y), s)`` Parameters ---------- x : `domain` `el...
[ "Return", "the", "derivative", "at", "x", "." ]
python
train
kubernetes-client/python
kubernetes/client/apis/rbac_authorization_v1_api.py
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/rbac_authorization_v1_api.py#L2794-L2814
def read_cluster_role(self, name, **kwargs): """ read the specified ClusterRole This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_cluster_role(name, async_req=True) >>> result = ...
[ "def", "read_cluster_role", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "read_cluster_role_with_htt...
read the specified ClusterRole This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_cluster_role(name, async_req=True) >>> result = thread.get() :param async_req bool :param str na...
[ "read", "the", "specified", "ClusterRole", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", ...
python
train
upsight/doctor
doctor/types.py
https://github.com/upsight/doctor/blob/2cf1d433f6f1aa1355644b449a757c0660793cdd/doctor/types.py#L881-L889
def number(description, **kwargs) -> typing.Type: """Create a :class:`~doctor.types.Number` type. :param description: A description of the type. :param kwargs: Can include any attribute defined in :class:`~doctor.types.Number` """ kwargs['description'] = description return type('Number'...
[ "def", "number", "(", "description", ",", "*", "*", "kwargs", ")", "->", "typing", ".", "Type", ":", "kwargs", "[", "'description'", "]", "=", "description", "return", "type", "(", "'Number'", ",", "(", "Number", ",", ")", ",", "kwargs", ")" ]
Create a :class:`~doctor.types.Number` type. :param description: A description of the type. :param kwargs: Can include any attribute defined in :class:`~doctor.types.Number`
[ "Create", "a", ":", "class", ":", "~doctor", ".", "types", ".", "Number", "type", "." ]
python
train
vkorn/pyvizio
custom_components/vizio/media_player.py
https://github.com/vkorn/pyvizio/blob/7153c9ad544195c867c14f8f03c97dba416c0a7a/custom_components/vizio/media_player.py#L233-L236
def volume_down(self): """Decreasing volume of the device.""" self._volume_level -= self._volume_step / self._max_volume self._device.vol_down(num=self._volume_step)
[ "def", "volume_down", "(", "self", ")", ":", "self", ".", "_volume_level", "-=", "self", ".", "_volume_step", "/", "self", ".", "_max_volume", "self", ".", "_device", ".", "vol_down", "(", "num", "=", "self", ".", "_volume_step", ")" ]
Decreasing volume of the device.
[ "Decreasing", "volume", "of", "the", "device", "." ]
python
test
polysquare/polysquare-generic-file-linter
polysquarelinter/spelling.py
https://github.com/polysquare/polysquare-generic-file-linter/blob/cfc88771acd3d5551c28fa5d917bb0aeb584c4cc/polysquarelinter/spelling.py#L600-L641
def get_transition(self, # suppress(too-many-arguments) line, line_index, column, is_escaped, comment_system_transitions, eof=False): """Get transition from InCommentParser....
[ "def", "get_transition", "(", "self", ",", "# suppress(too-many-arguments)", "line", ",", "line_index", ",", "column", ",", "is_escaped", ",", "comment_system_transitions", ",", "eof", "=", "False", ")", ":", "del", "comment_system_transitions", "if", "(", "_token_a...
Get transition from InCommentParser.
[ "Get", "transition", "from", "InCommentParser", "." ]
python
train
apache/incubator-heron
third_party/python/cpplint/cpplint.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/third_party/python/cpplint/cpplint.py#L1545-L1551
def FindNextMultiLineCommentEnd(lines, lineix): """We are inside a comment, find the end marker.""" while lineix < len(lines): if lines[lineix].strip().endswith('*/'): return lineix lineix += 1 return len(lines)
[ "def", "FindNextMultiLineCommentEnd", "(", "lines", ",", "lineix", ")", ":", "while", "lineix", "<", "len", "(", "lines", ")", ":", "if", "lines", "[", "lineix", "]", ".", "strip", "(", ")", ".", "endswith", "(", "'*/'", ")", ":", "return", "lineix", ...
We are inside a comment, find the end marker.
[ "We", "are", "inside", "a", "comment", "find", "the", "end", "marker", "." ]
python
valid
freshbooks/statsdecor
statsdecor/__init__.py
https://github.com/freshbooks/statsdecor/blob/1c4a98e120799b430fd40c8fede9020a91162d31/statsdecor/__init__.py#L97-L103
def timing(name, delta, rate=1, tags=None): """Sends new timing information. `delta` is in milliseconds. >>> import statsdecor >>> statsdecor.timing('my.metric', 314159265359) """ return client().timing(name, delta, rate=rate, tags=tags)
[ "def", "timing", "(", "name", ",", "delta", ",", "rate", "=", "1", ",", "tags", "=", "None", ")", ":", "return", "client", "(", ")", ".", "timing", "(", "name", ",", "delta", ",", "rate", "=", "rate", ",", "tags", "=", "tags", ")" ]
Sends new timing information. `delta` is in milliseconds. >>> import statsdecor >>> statsdecor.timing('my.metric', 314159265359)
[ "Sends", "new", "timing", "information", ".", "delta", "is", "in", "milliseconds", "." ]
python
train
jgm/pandocfilters
pandocfilters.py
https://github.com/jgm/pandocfilters/blob/0d6b4f9be9d8e54b18b8a97e6120dd85ece53de5/pandocfilters.py#L41-L49
def get_value(kv, key, value = None): """get value from the keyvalues (options)""" res = [] for k, v in kv: if k == key: value = v else: res.append([k, v]) return value, res
[ "def", "get_value", "(", "kv", ",", "key", ",", "value", "=", "None", ")", ":", "res", "=", "[", "]", "for", "k", ",", "v", "in", "kv", ":", "if", "k", "==", "key", ":", "value", "=", "v", "else", ":", "res", ".", "append", "(", "[", "k", ...
get value from the keyvalues (options)
[ "get", "value", "from", "the", "keyvalues", "(", "options", ")" ]
python
train
librosa/librosa
librosa/util/utils.py
https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/util/utils.py#L1170-L1203
def buf_to_float(x, n_bytes=2, dtype=np.float32): """Convert an integer buffer to floating point values. This is primarily useful when loading integer-valued wav data into numpy arrays. See Also -------- buf_to_float Parameters ---------- x : np.ndarray [dtype=int] The inte...
[ "def", "buf_to_float", "(", "x", ",", "n_bytes", "=", "2", ",", "dtype", "=", "np", ".", "float32", ")", ":", "# Invert the scale of the data", "scale", "=", "1.", "/", "float", "(", "1", "<<", "(", "(", "8", "*", "n_bytes", ")", "-", "1", ")", ")"...
Convert an integer buffer to floating point values. This is primarily useful when loading integer-valued wav data into numpy arrays. See Also -------- buf_to_float Parameters ---------- x : np.ndarray [dtype=int] The integer-valued data buffer n_bytes : int [1, 2, 4] ...
[ "Convert", "an", "integer", "buffer", "to", "floating", "point", "values", ".", "This", "is", "primarily", "useful", "when", "loading", "integer", "-", "valued", "wav", "data", "into", "numpy", "arrays", "." ]
python
test
Dani4kor/stockfishpy
stockfishpy/stockfishpy.py
https://github.com/Dani4kor/stockfishpy/blob/af26e8180a7d186ca0cb48d06bac9f2561432f4f/stockfishpy/stockfishpy.py#L107-L156
def setposition(self, position): """ The move format is in long algebraic notation. Takes list of stirngs = ['e2e4', 'd7d5'] OR FEN = 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1' """ try: if isinstance(position, list): ...
[ "def", "setposition", "(", "self", ",", "position", ")", ":", "try", ":", "if", "isinstance", "(", "position", ",", "list", ")", ":", "self", ".", "send", "(", "'position startpos moves {}'", ".", "format", "(", "self", ".", "__listtostring", "(", "positio...
The move format is in long algebraic notation. Takes list of stirngs = ['e2e4', 'd7d5'] OR FEN = 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1'
[ "The", "move", "format", "is", "in", "long", "algebraic", "notation", "." ]
python
train
coin-or/GiMPy
src/gimpy/graph.py
https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L1367-L1404
def process_edge_flow(self, source, sink, i, j, algo, q): ''' API: process_edge_flow(self, source, sink, i, j, algo, q) Description: Used by by max_flow_preflowpush() method. Processes edges along prefolow push. Input: source: Source node name of flow graph. ...
[ "def", "process_edge_flow", "(", "self", ",", "source", ",", "sink", ",", "i", ",", "j", ",", "algo", ",", "q", ")", ":", "if", "(", "self", ".", "get_node_attr", "(", "i", ",", "'distance'", ")", "!=", "self", ".", "get_node_attr", "(", "j", ",", ...
API: process_edge_flow(self, source, sink, i, j, algo, q) Description: Used by by max_flow_preflowpush() method. Processes edges along prefolow push. Input: source: Source node name of flow graph. sink: Sink node name of flow graph. i: Source node in t...
[ "API", ":", "process_edge_flow", "(", "self", "source", "sink", "i", "j", "algo", "q", ")", "Description", ":", "Used", "by", "by", "max_flow_preflowpush", "()", "method", ".", "Processes", "edges", "along", "prefolow", "push", ".", "Input", ":", "source", ...
python
train
raiden-network/raiden
raiden/raiden_service.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L684-L730
def handle_state_change(self, state_change: StateChange) -> List[Greenlet]: """ Dispatch the state change and return the processing threads. Use this for error reporting, failures in the returned greenlets, should be re-raised using `gevent.joinall` with `raise_error=True`. """ ...
[ "def", "handle_state_change", "(", "self", ",", "state_change", ":", "StateChange", ")", "->", "List", "[", "Greenlet", "]", ":", "assert", "self", ".", "wal", ",", "f'WAL not restored. node:{self!r}'", "log", ".", "debug", "(", "'State change'", ",", "node", ...
Dispatch the state change and return the processing threads. Use this for error reporting, failures in the returned greenlets, should be re-raised using `gevent.joinall` with `raise_error=True`.
[ "Dispatch", "the", "state", "change", "and", "return", "the", "processing", "threads", "." ]
python
train
uchicago-cs/deepdish
deepdish/image.py
https://github.com/uchicago-cs/deepdish/blob/01af93621fe082a3972fe53ba7375388c02b0085/deepdish/image.py#L109-L120
def crop_or_pad(im, size, value=0): """ Crops an image in the center. Parameters ---------- size : tuple, (height, width) Finally size after cropping. """ diff = [im.shape[index] - size[index] for index in (0, 1)] im2 = im[diff[0]//2:diff[0]//2 + size[0], diff[1]//2:diff[1]//2 +...
[ "def", "crop_or_pad", "(", "im", ",", "size", ",", "value", "=", "0", ")", ":", "diff", "=", "[", "im", ".", "shape", "[", "index", "]", "-", "size", "[", "index", "]", "for", "index", "in", "(", "0", ",", "1", ")", "]", "im2", "=", "im", "...
Crops an image in the center. Parameters ---------- size : tuple, (height, width) Finally size after cropping.
[ "Crops", "an", "image", "in", "the", "center", "." ]
python
train
azogue/i2csense
i2csense/__init__.py
https://github.com/azogue/i2csense/blob/ecc6806dcee9de827a5414a9e836d271fedca9b9/i2csense/__init__.py#L102-L120
def current_state_str(self): """Return string representation of the current state of the sensor.""" if self.sample_ok: msg = '' temperature = self._get_value_opc_attr('temperature') if temperature is not None: msg += 'Temp: %s ºC, ' % temperature ...
[ "def", "current_state_str", "(", "self", ")", ":", "if", "self", ".", "sample_ok", ":", "msg", "=", "''", "temperature", "=", "self", ".", "_get_value_opc_attr", "(", "'temperature'", ")", "if", "temperature", "is", "not", "None", ":", "msg", "+=", "'Temp:...
Return string representation of the current state of the sensor.
[ "Return", "string", "representation", "of", "the", "current", "state", "of", "the", "sensor", "." ]
python
train
senaite/senaite.core
bika/lims/browser/dashboard/dashboard.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/dashboard/dashboard.py#L252-L263
def _create_raw_data(self): """ Gathers the different sections ids and creates a string as first cookie data. :return: A dictionary like: {'analyses':'all','analysisrequest':'all','worksheets':'all'} """ result = {} for section in self.get_sections():...
[ "def", "_create_raw_data", "(", "self", ")", ":", "result", "=", "{", "}", "for", "section", "in", "self", ".", "get_sections", "(", ")", ":", "result", "[", "section", ".", "get", "(", "'id'", ")", "]", "=", "'all'", "return", "result" ]
Gathers the different sections ids and creates a string as first cookie data. :return: A dictionary like: {'analyses':'all','analysisrequest':'all','worksheets':'all'}
[ "Gathers", "the", "different", "sections", "ids", "and", "creates", "a", "string", "as", "first", "cookie", "data", "." ]
python
train
iamteem/redisco
redisco/models/base.py
https://github.com/iamteem/redisco/blob/a7ba19ff3c38061d6d8bc0c10fa754baadcfeb91/redisco/models/base.py#L45-L51
def _initialize_lists(model_class, name, bases, attrs): """Stores the list fields descriptors of a model.""" model_class._lists = {} for k, v in attrs.iteritems(): if isinstance(v, ListField): model_class._lists[k] = v v.name = v.name or k
[ "def", "_initialize_lists", "(", "model_class", ",", "name", ",", "bases", ",", "attrs", ")", ":", "model_class", ".", "_lists", "=", "{", "}", "for", "k", ",", "v", "in", "attrs", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "v", ",", ...
Stores the list fields descriptors of a model.
[ "Stores", "the", "list", "fields", "descriptors", "of", "a", "model", "." ]
python
train
dereneaton/ipyrad
ipyrad/assemble/cluster_within.py
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_within.py#L1161-L1263
def cluster(data, sample, nthreads, force): """ Calls vsearch for clustering. cov varies by data type, values were chosen based on experience, but could be edited by users """ ## get the dereplicated reads if "reference" in data.paramsdict["assembly_method"]: derephandle = os.path.join(...
[ "def", "cluster", "(", "data", ",", "sample", ",", "nthreads", ",", "force", ")", ":", "## get the dereplicated reads", "if", "\"reference\"", "in", "data", ".", "paramsdict", "[", "\"assembly_method\"", "]", ":", "derephandle", "=", "os", ".", "path", ".", ...
Calls vsearch for clustering. cov varies by data type, values were chosen based on experience, but could be edited by users
[ "Calls", "vsearch", "for", "clustering", ".", "cov", "varies", "by", "data", "type", "values", "were", "chosen", "based", "on", "experience", "but", "could", "be", "edited", "by", "users" ]
python
valid
cnobile2012/pololu-motors
pololu/motors/qik.py
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L361-L388
def _getSerialTimeout(self, device): """ Get the serial timeout stored on the hardware device. Caution, more that one value returned from the Qik can have the same actual timeout value according the the formula below. I have verified this as an idiosyncrasy of the Qik itself. Th...
[ "def", "_getSerialTimeout", "(", "self", ",", "device", ")", ":", "num", "=", "self", ".", "_getConfig", "(", "self", ".", "SERIAL_TIMEOUT", ",", "device", ")", "if", "isinstance", "(", "num", ",", "int", ")", ":", "x", "=", "num", "&", "0x0F", "y", ...
Get the serial timeout stored on the hardware device. Caution, more that one value returned from the Qik can have the same actual timeout value according the the formula below. I have verified this as an idiosyncrasy of the Qik itself. There are only a total of 72 unique values that the...
[ "Get", "the", "serial", "timeout", "stored", "on", "the", "hardware", "device", "." ]
python
train
Becksteinlab/GromacsWrapper
gromacs/config.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L401-L425
def get_template(t): """Find template file *t* and return its real path. *t* can be a single string or a list of strings. A string should be one of 1. a relative or absolute path, 2. a file in one of the directories listed in :data:`gromacs.config.path`, 3. a filename in the package template d...
[ "def", "get_template", "(", "t", ")", ":", "templates", "=", "[", "_get_template", "(", "s", ")", "for", "s", "in", "utilities", ".", "asiterable", "(", "t", ")", "]", "if", "len", "(", "templates", ")", "==", "1", ":", "return", "templates", "[", ...
Find template file *t* and return its real path. *t* can be a single string or a list of strings. A string should be one of 1. a relative or absolute path, 2. a file in one of the directories listed in :data:`gromacs.config.path`, 3. a filename in the package template directory (defined in the tem...
[ "Find", "template", "file", "*", "t", "*", "and", "return", "its", "real", "path", "." ]
python
valid
goerz/clusterjob
clusterjob/__init__.py
https://github.com/goerz/clusterjob/blob/361760d1a6dd3cbde49c5c2158a3acd0c314a749/clusterjob/__init__.py#L1050-L1079
def run_epilogue(self): """Run the epilogue script in the current working directory. raises: subprocess.CalledProcessError: if the script does not finish with exit code zero. """ logger = logging.getLogger(__name__) if self.epilogue is not None: ...
[ "def", "run_epilogue", "(", "self", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "if", "self", ".", "epilogue", "is", "not", "None", ":", "with", "tempfile", ".", "NamedTemporaryFile", "(", "'w'", ",", "delete", "=", "False...
Run the epilogue script in the current working directory. raises: subprocess.CalledProcessError: if the script does not finish with exit code zero.
[ "Run", "the", "epilogue", "script", "in", "the", "current", "working", "directory", "." ]
python
train
dmlc/gluon-nlp
scripts/natural_language_inference/preprocess.py
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/scripts/natural_language_inference/preprocess.py#L42-L58
def main(args): """ Read tokens from the provided parse tree in the SNLI dataset. Illegal examples are removed. """ examples = [] with open(args.input, 'r') as fin: reader = csv.DictReader(fin, delimiter='\t') for cols in reader: s1 = read_tokens(cols['sentence1_parse...
[ "def", "main", "(", "args", ")", ":", "examples", "=", "[", "]", "with", "open", "(", "args", ".", "input", ",", "'r'", ")", "as", "fin", ":", "reader", "=", "csv", ".", "DictReader", "(", "fin", ",", "delimiter", "=", "'\\t'", ")", "for", "cols"...
Read tokens from the provided parse tree in the SNLI dataset. Illegal examples are removed.
[ "Read", "tokens", "from", "the", "provided", "parse", "tree", "in", "the", "SNLI", "dataset", ".", "Illegal", "examples", "are", "removed", "." ]
python
train
BlueBrain/hpcbench
hpcbench/toolbox/functools_ext.py
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/toolbox/functools_ext.py#L8-L17
def compose(*functions): """Define functions composition like f ∘ g ∘ h :return: callable object that will perform function composition of callables given in argument. """ def _compose2(f, g): # pylint: disable=invalid-name return lambda x: f(g(x)) return functools.reduce(_compose2, f...
[ "def", "compose", "(", "*", "functions", ")", ":", "def", "_compose2", "(", "f", ",", "g", ")", ":", "# pylint: disable=invalid-name", "return", "lambda", "x", ":", "f", "(", "g", "(", "x", ")", ")", "return", "functools", ".", "reduce", "(", "_compose...
Define functions composition like f ∘ g ∘ h :return: callable object that will perform function composition of callables given in argument.
[ "Define", "functions", "composition", "like", "f", "∘", "g", "∘", "h", ":", "return", ":", "callable", "object", "that", "will", "perform", "function", "composition", "of", "callables", "given", "in", "argument", "." ]
python
train
robotools/fontParts
Lib/fontParts/base/normalizers.py
https://github.com/robotools/fontParts/blob/d2ff106fe95f9d566161d936a645157626568712/Lib/fontParts/base/normalizers.py#L299-L316
def normalizeGlyphUnicodes(value): """ Normalizes glyph unicodes. * **value** must be a ``list``. * **value** items must normalize as glyph unicodes with :func:`normalizeGlyphUnicode`. * **value** must not repeat unicode values. * Returned value will be a ``tuple`` of ints. """ if...
[ "def", "normalizeGlyphUnicodes", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "(", "tuple", ",", "list", ")", ")", ":", "raise", "TypeError", "(", "\"Glyph unicodes must be a list, not %s.\"", "%", "type", "(", "value", ")", ".", "__...
Normalizes glyph unicodes. * **value** must be a ``list``. * **value** items must normalize as glyph unicodes with :func:`normalizeGlyphUnicode`. * **value** must not repeat unicode values. * Returned value will be a ``tuple`` of ints.
[ "Normalizes", "glyph", "unicodes", "." ]
python
train
JnyJny/Geometry
Geometry/ellipse.py
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L111-L115
def xAxisIsMajor(self): ''' Returns True if the major axis is parallel to the X axis, boolean. ''' return max(self.radius.x, self.radius.y) == self.radius.x
[ "def", "xAxisIsMajor", "(", "self", ")", ":", "return", "max", "(", "self", ".", "radius", ".", "x", ",", "self", ".", "radius", ".", "y", ")", "==", "self", ".", "radius", ".", "x" ]
Returns True if the major axis is parallel to the X axis, boolean.
[ "Returns", "True", "if", "the", "major", "axis", "is", "parallel", "to", "the", "X", "axis", "boolean", "." ]
python
train
explosion/spaCy
spacy/cli/init_model.py
https://github.com/explosion/spaCy/blob/8ee4100f8ffb336886208a1ea827bf4c745e2709/spacy/cli/init_model.py#L39-L91
def init_model( lang, output_dir, freqs_loc=None, clusters_loc=None, jsonl_loc=None, vectors_loc=None, prune_vectors=-1, ): """ Create a new model from raw data, like word frequencies, Brown clusters and word vectors. If vectors are provided in Word2Vec format, they can be ei...
[ "def", "init_model", "(", "lang", ",", "output_dir", ",", "freqs_loc", "=", "None", ",", "clusters_loc", "=", "None", ",", "jsonl_loc", "=", "None", ",", "vectors_loc", "=", "None", ",", "prune_vectors", "=", "-", "1", ",", ")", ":", "if", "jsonl_loc", ...
Create a new model from raw data, like word frequencies, Brown clusters and word vectors. If vectors are provided in Word2Vec format, they can be either a .txt or zipped as a .zip or .tar.gz.
[ "Create", "a", "new", "model", "from", "raw", "data", "like", "word", "frequencies", "Brown", "clusters", "and", "word", "vectors", ".", "If", "vectors", "are", "provided", "in", "Word2Vec", "format", "they", "can", "be", "either", "a", ".", "txt", "or", ...
python
train
pyviz/param
param/parameterized.py
https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/parameterized.py#L1504-L1537
def get_value_generator(self_,name): # pylint: disable-msg=E0213 """ Return the value or value-generating object of the named attribute. For most parameters, this is simply the parameter's value (i.e. the same as getattr()), but Dynamic parameters have their value-genera...
[ "def", "get_value_generator", "(", "self_", ",", "name", ")", ":", "# pylint: disable-msg=E0213", "cls_or_slf", "=", "self_", ".", "self_or_cls", "param_obj", "=", "cls_or_slf", ".", "param", ".", "objects", "(", "'existing'", ")", ".", "get", "(", "name", ")"...
Return the value or value-generating object of the named attribute. For most parameters, this is simply the parameter's value (i.e. the same as getattr()), but Dynamic parameters have their value-generating object returned.
[ "Return", "the", "value", "or", "value", "-", "generating", "object", "of", "the", "named", "attribute", "." ]
python
train
HewlettPackard/python-hpOneView
hpOneView/resources/networking/interconnects.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L274-L285
def get_pluggable_module_information(self, id_or_uri): """ Gets all the pluggable module information. Args: id_or_uri: Can be either the interconnect id or uri. Returns: array: dicts of the pluggable module information. """ uri = self._client.bui...
[ "def", "get_pluggable_module_information", "(", "self", ",", "id_or_uri", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/pluggableModuleInformation\"", "return", "self", ".", "_client", ".", "get", "(", "uri", "...
Gets all the pluggable module information. Args: id_or_uri: Can be either the interconnect id or uri. Returns: array: dicts of the pluggable module information.
[ "Gets", "all", "the", "pluggable", "module", "information", "." ]
python
train
gwastro/pycbc
pycbc/population/rates_functions.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/population/rates_functions.py#L509-L525
def mchirp_sampler_flat(**kwargs): ''' Draw chirp mass samples for flat in mass model Parameters ---------- **kwargs: string Keyword arguments as model parameters and number of samples Returns ------- mchirp-astro: array The chirp mass samples ...
[ "def", "mchirp_sampler_flat", "(", "*", "*", "kwargs", ")", ":", "m1", ",", "m2", "=", "draw_flat_samples", "(", "*", "*", "kwargs", ")", "mchirp_astro", "=", "mchirp_from_mass1_mass2", "(", "m1", ",", "m2", ")", "return", "mchirp_astro" ]
Draw chirp mass samples for flat in mass model Parameters ---------- **kwargs: string Keyword arguments as model parameters and number of samples Returns ------- mchirp-astro: array The chirp mass samples for the population
[ "Draw", "chirp", "mass", "samples", "for", "flat", "in", "mass", "model" ]
python
train
monkeython/scriba
scriba/content_types/scriba_x_tar.py
https://github.com/monkeython/scriba/blob/fb8e7636ed07c3d035433fdd153599ac8b24dfc4/scriba/content_types/scriba_x_tar.py#L16-L27
def parse(binary, **params): """Turns a TAR file into a frozen sample.""" binary = io.BytesIO(binary) collection = list() with tarfile.TarFile(fileobj=binary, mode='r') as tar: for tar_info in tar.getmembers(): content_type, encoding = mimetypes.guess_type(tar_info.name) ...
[ "def", "parse", "(", "binary", ",", "*", "*", "params", ")", ":", "binary", "=", "io", ".", "BytesIO", "(", "binary", ")", "collection", "=", "list", "(", ")", "with", "tarfile", ".", "TarFile", "(", "fileobj", "=", "binary", ",", "mode", "=", "'r'...
Turns a TAR file into a frozen sample.
[ "Turns", "a", "TAR", "file", "into", "a", "frozen", "sample", "." ]
python
train
quantmind/ccy
ccy/core/currency.py
https://github.com/quantmind/ccy/blob/068cf6887489087cd26657a937a932e82106b47f/ccy/core/currency.py#L100-L111
def swap(self, c2): ''' put the order of currencies as market standard ''' inv = False c1 = self if c1.order > c2.order: ct = c1 c1 = c2 c2 = ct inv = True return inv, c1, c2
[ "def", "swap", "(", "self", ",", "c2", ")", ":", "inv", "=", "False", "c1", "=", "self", "if", "c1", ".", "order", ">", "c2", ".", "order", ":", "ct", "=", "c1", "c1", "=", "c2", "c2", "=", "ct", "inv", "=", "True", "return", "inv", ",", "c...
put the order of currencies as market standard
[ "put", "the", "order", "of", "currencies", "as", "market", "standard" ]
python
train
datawire/quark
quarkc/docmaker.py
https://github.com/datawire/quark/blob/df0058a148b077c0aff535eb6ee382605c556273/quarkc/docmaker.py#L75-L83
def get_doc(node): """ Return a node's documentation as a string, pulling from annotations or constructing a simple fake as needed. """ res = " ".join(get_doc_annotations(node)) if not res: res = "(%s)" % node.__class__.__name__.lower() return res
[ "def", "get_doc", "(", "node", ")", ":", "res", "=", "\" \"", ".", "join", "(", "get_doc_annotations", "(", "node", ")", ")", "if", "not", "res", ":", "res", "=", "\"(%s)\"", "%", "node", ".", "__class__", ".", "__name__", ".", "lower", "(", ")", "...
Return a node's documentation as a string, pulling from annotations or constructing a simple fake as needed.
[ "Return", "a", "node", "s", "documentation", "as", "a", "string", "pulling", "from", "annotations", "or", "constructing", "a", "simple", "fake", "as", "needed", "." ]
python
train
rwl/godot
godot/edge.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/edge.py#L707-L729
def arrange_all(self): """ Arrange the components of the node using Graphviz. """ # FIXME: Circular reference avoidance. import godot.dot_data_parser import godot.graph graph = godot.graph.Graph( ID="g", directed=True ) self.conn = "->" graph.edges.append...
[ "def", "arrange_all", "(", "self", ")", ":", "# FIXME: Circular reference avoidance.", "import", "godot", ".", "dot_data_parser", "import", "godot", ".", "graph", "graph", "=", "godot", ".", "graph", ".", "Graph", "(", "ID", "=", "\"g\"", ",", "directed", "=",...
Arrange the components of the node using Graphviz.
[ "Arrange", "the", "components", "of", "the", "node", "using", "Graphviz", "." ]
python
test
konstantint/matplotlib-venn
matplotlib_venn/_arc.py
https://github.com/konstantint/matplotlib-venn/blob/c26796c9925bdac512edf48387452fbd1848c791/matplotlib_venn/_arc.py#L195-L210
def approximately_equal(self, arc, tolerance=tol): ''' Returns true if the parameters of this arc are within <tolerance> of the parameters of the other arc, and the direction is the same. Note that no angle simplification is performed (i.e. some arcs that might be equal in principle are not decl...
[ "def", "approximately_equal", "(", "self", ",", "arc", ",", "tolerance", "=", "tol", ")", ":", "return", "self", ".", "direction", "==", "arc", ".", "direction", "and", "np", ".", "all", "(", "abs", "(", "self", ".", "center", "-", "arc", ".", "cente...
Returns true if the parameters of this arc are within <tolerance> of the parameters of the other arc, and the direction is the same. Note that no angle simplification is performed (i.e. some arcs that might be equal in principle are not declared as such by this method) >>> Arc((0, 0), 1...
[ "Returns", "true", "if", "the", "parameters", "of", "this", "arc", "are", "within", "<tolerance", ">", "of", "the", "parameters", "of", "the", "other", "arc", "and", "the", "direction", "is", "the", "same", ".", "Note", "that", "no", "angle", "simplificati...
python
train
wummel/linkchecker
linkcheck/director/__init__.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/director/__init__.py#L128-L135
def get_aggregate (config): """Get an aggregator instance with given configuration.""" _urlqueue = urlqueue.UrlQueue(max_allowed_urls=config["maxnumurls"]) _robots_txt = robots_txt.RobotsTxt(config["useragent"]) plugin_manager = plugins.PluginManager(config) result_cache = results.ResultCache() ...
[ "def", "get_aggregate", "(", "config", ")", ":", "_urlqueue", "=", "urlqueue", ".", "UrlQueue", "(", "max_allowed_urls", "=", "config", "[", "\"maxnumurls\"", "]", ")", "_robots_txt", "=", "robots_txt", ".", "RobotsTxt", "(", "config", "[", "\"useragent\"", "]...
Get an aggregator instance with given configuration.
[ "Get", "an", "aggregator", "instance", "with", "given", "configuration", "." ]
python
train
vpelletier/python-libaio
libaio/__init__.py
https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L221-L232
def buffer_list(self): """ The buffer list this instance operates on. Only available in mode != AIOBLOCK_MODE_POLL. Changes on a submitted transfer are not fully applied until its next submission: kernel will still be using original buffer list. """ if self._ioc...
[ "def", "buffer_list", "(", "self", ")", ":", "if", "self", ".", "_iocb", ".", "aio_lio_opcode", "==", "libaio", ".", "IO_CMD_POLL", ":", "raise", "AttributeError", "return", "self", ".", "_buffer_list" ]
The buffer list this instance operates on. Only available in mode != AIOBLOCK_MODE_POLL. Changes on a submitted transfer are not fully applied until its next submission: kernel will still be using original buffer list.
[ "The", "buffer", "list", "this", "instance", "operates", "on", "." ]
python
test
funkybob/knights-templater
knights/tags.py
https://github.com/funkybob/knights-templater/blob/b15cdbaae7d824d02f7f03ca04599ae94bb759dd/knights/tags.py#L215-L221
def macro(parser, token): ''' Works just like block, but does not render. ''' name = token.strip() parser.build_method(name, endnodes=['endmacro']) return ast.Yield(value=ast.Str(s=''))
[ "def", "macro", "(", "parser", ",", "token", ")", ":", "name", "=", "token", ".", "strip", "(", ")", "parser", ".", "build_method", "(", "name", ",", "endnodes", "=", "[", "'endmacro'", "]", ")", "return", "ast", ".", "Yield", "(", "value", "=", "a...
Works just like block, but does not render.
[ "Works", "just", "like", "block", "but", "does", "not", "render", "." ]
python
train
secdev/scapy
scapy/layers/tls/session.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L469-L513
def mirror(self): """ This function takes a tlsSession object and swaps the IP addresses, ports, connection ends and connection states. The triggered_commit are also swapped (though it is probably overkill, it is cleaner this way). It is useful for static analysis of a series of...
[ "def", "mirror", "(", "self", ")", ":", "self", ".", "ipdst", ",", "self", ".", "ipsrc", "=", "self", ".", "ipsrc", ",", "self", ".", "ipdst", "self", ".", "dport", ",", "self", ".", "sport", "=", "self", ".", "sport", ",", "self", ".", "dport", ...
This function takes a tlsSession object and swaps the IP addresses, ports, connection ends and connection states. The triggered_commit are also swapped (though it is probably overkill, it is cleaner this way). It is useful for static analysis of a series of messages from both the client...
[ "This", "function", "takes", "a", "tlsSession", "object", "and", "swaps", "the", "IP", "addresses", "ports", "connection", "ends", "and", "connection", "states", ".", "The", "triggered_commit", "are", "also", "swapped", "(", "though", "it", "is", "probably", "...
python
train
marcomusy/vtkplotter
vtkplotter/actors.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/actors.py#L30-L42
def mergeActors(actors, tol=0): """ Build a new actor formed by the fusion of the polydatas of input objects. Similar to Assembly, but in this case the input objects become a single mesh. .. hint:: |thinplate_grid| |thinplate_grid.py|_ """ polylns = vtk.vtkAppendPolyData() for a in actors: ...
[ "def", "mergeActors", "(", "actors", ",", "tol", "=", "0", ")", ":", "polylns", "=", "vtk", ".", "vtkAppendPolyData", "(", ")", "for", "a", "in", "actors", ":", "polylns", ".", "AddInputData", "(", "a", ".", "polydata", "(", ")", ")", "polylns", ".",...
Build a new actor formed by the fusion of the polydatas of input objects. Similar to Assembly, but in this case the input objects become a single mesh. .. hint:: |thinplate_grid| |thinplate_grid.py|_
[ "Build", "a", "new", "actor", "formed", "by", "the", "fusion", "of", "the", "polydatas", "of", "input", "objects", ".", "Similar", "to", "Assembly", "but", "in", "this", "case", "the", "input", "objects", "become", "a", "single", "mesh", "." ]
python
train
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/tokens.py
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/tokens.py#L137-L153
def check_exp(self, claim='exp', current_time=None): """ Checks whether a timestamp value in the given claim has passed (since the given datetime value in `current_time`). Raises a TokenError with a user-facing error message if so. """ if current_time is None: ...
[ "def", "check_exp", "(", "self", ",", "claim", "=", "'exp'", ",", "current_time", "=", "None", ")", ":", "if", "current_time", "is", "None", ":", "current_time", "=", "self", ".", "current_time", "try", ":", "claim_value", "=", "self", ".", "payload", "[...
Checks whether a timestamp value in the given claim has passed (since the given datetime value in `current_time`). Raises a TokenError with a user-facing error message if so.
[ "Checks", "whether", "a", "timestamp", "value", "in", "the", "given", "claim", "has", "passed", "(", "since", "the", "given", "datetime", "value", "in", "current_time", ")", ".", "Raises", "a", "TokenError", "with", "a", "user", "-", "facing", "error", "me...
python
train
opencobra/memote
memote/support/basic.py
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/basic.py#L541-L544
def find_external_metabolites(model): """Return all metabolites in the external compartment.""" ex_comp = find_external_compartment(model) return [met for met in model.metabolites if met.compartment == ex_comp]
[ "def", "find_external_metabolites", "(", "model", ")", ":", "ex_comp", "=", "find_external_compartment", "(", "model", ")", "return", "[", "met", "for", "met", "in", "model", ".", "metabolites", "if", "met", ".", "compartment", "==", "ex_comp", "]" ]
Return all metabolites in the external compartment.
[ "Return", "all", "metabolites", "in", "the", "external", "compartment", "." ]
python
train
Dallinger/Dallinger
dallinger/data.py
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/data.py#L266-L290
def ingest_zip(path, engine=None): """Given a path to a zip file created with `export()`, recreate the database with the data stored in the included .csv files. """ import_order = [ "network", "participant", "node", "info", "notification", "question", ...
[ "def", "ingest_zip", "(", "path", ",", "engine", "=", "None", ")", ":", "import_order", "=", "[", "\"network\"", ",", "\"participant\"", ",", "\"node\"", ",", "\"info\"", ",", "\"notification\"", ",", "\"question\"", ",", "\"transformation\"", ",", "\"vector\"",...
Given a path to a zip file created with `export()`, recreate the database with the data stored in the included .csv files.
[ "Given", "a", "path", "to", "a", "zip", "file", "created", "with", "export", "()", "recreate", "the", "database", "with", "the", "data", "stored", "in", "the", "included", ".", "csv", "files", "." ]
python
train
chrisjsewell/jsonextended
jsonextended/edict.py
https://github.com/chrisjsewell/jsonextended/blob/c3a7a880cc09789b3c61204265dcbb127be76c8a/jsonextended/edict.py#L1398-L1449
def split_key(d, key, new_keys, before=True, list_of_dicts=False, deepcopy=True): """ split an existing key(s) into multiple levels Parameters ---------- d : dict or dict like key: str existing key value new_keys: list[str] new levels to add before: boo...
[ "def", "split_key", "(", "d", ",", "key", ",", "new_keys", ",", "before", "=", "True", ",", "list_of_dicts", "=", "False", ",", "deepcopy", "=", "True", ")", ":", "list_of_dicts", "=", "'__list__'", "if", "list_of_dicts", "else", "None", "flatd", "=", "f...
split an existing key(s) into multiple levels Parameters ---------- d : dict or dict like key: str existing key value new_keys: list[str] new levels to add before: bool add level before existing key (else after) list_of_dicts: bool treat list of dicts...
[ "split", "an", "existing", "key", "(", "s", ")", "into", "multiple", "levels" ]
python
train
Kronuz/pyScss
scss/source.py
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/source.py#L194-L198
def from_filename(cls, path_string, origin=MISSING, **kwargs): """ Read Sass source from a String specifying the path """ path = Path(path_string) return cls.from_path(path, origin, **kwargs)
[ "def", "from_filename", "(", "cls", ",", "path_string", ",", "origin", "=", "MISSING", ",", "*", "*", "kwargs", ")", ":", "path", "=", "Path", "(", "path_string", ")", "return", "cls", ".", "from_path", "(", "path", ",", "origin", ",", "*", "*", "kwa...
Read Sass source from a String specifying the path
[ "Read", "Sass", "source", "from", "a", "String", "specifying", "the", "path" ]
python
train
instaloader/instaloader
instaloader/instaloadercontext.py
https://github.com/instaloader/instaloader/blob/87d877e650cd8020b04b8b51be120599a441fd5b/instaloader/instaloadercontext.py#L526-L534
def root_rhx_gis(self) -> Optional[str]: """rhx_gis string returned in the / query.""" if self.is_logged_in: # At the moment, rhx_gis seems to be required for anonymous requests only. By returning None when logged # in, we can save the root_rhx_gis lookup query. retur...
[ "def", "root_rhx_gis", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "is_logged_in", ":", "# At the moment, rhx_gis seems to be required for anonymous requests only. By returning None when logged", "# in, we can save the root_rhx_gis lookup query.", ...
rhx_gis string returned in the / query.
[ "rhx_gis", "string", "returned", "in", "the", "/", "query", "." ]
python
train
dogoncouch/logdissect
logdissect/core.py
https://github.com/dogoncouch/logdissect/blob/426b50264cbfa9665c86df3781e1e415ba8dbbd3/logdissect/core.py#L197-L202
def load_filters(self): """Load filter module(s)""" for f in sorted(logdissect.filters.__filters__): self.filter_modules[f] = \ __import__('logdissect.filters.' + f, globals(), \ locals(), [logdissect]).FilterModule(args=self.filter_args)
[ "def", "load_filters", "(", "self", ")", ":", "for", "f", "in", "sorted", "(", "logdissect", ".", "filters", ".", "__filters__", ")", ":", "self", ".", "filter_modules", "[", "f", "]", "=", "__import__", "(", "'logdissect.filters.'", "+", "f", ",", "glob...
Load filter module(s)
[ "Load", "filter", "module", "(", "s", ")" ]
python
train
log2timeline/plaso
plaso/parsers/winreg.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/winreg.py#L141-L161
def _NormalizeKeyPath(self, key_path): """Normalizes a Windows Registry key path. Args: key_path (str): Windows Registry key path. Returns: str: normalized Windows Registry key path. """ normalized_key_path = key_path.lower() # The Registry key path should start with: # HKEY_LO...
[ "def", "_NormalizeKeyPath", "(", "self", ",", "key_path", ")", ":", "normalized_key_path", "=", "key_path", ".", "lower", "(", ")", "# The Registry key path should start with:", "# HKEY_LOCAL_MACHINE\\System\\ControlSet followed by 3 digits", "# which makes 39 characters.", "if",...
Normalizes a Windows Registry key path. Args: key_path (str): Windows Registry key path. Returns: str: normalized Windows Registry key path.
[ "Normalizes", "a", "Windows", "Registry", "key", "path", "." ]
python
train
mitsei/dlkit
dlkit/json_/learning/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L2321-L2348
def assign_objective_requisite(self, objective_id, requisite_objective_id): """Creates a requirement dependency between two ``Objectives``. arg: objective_id (osid.id.Id): the ``Id`` of the dependent ``Objective`` arg: requisite_objective_id (osid.id.Id): the ``Id`` of the...
[ "def", "assign_objective_requisite", "(", "self", ",", "objective_id", ",", "requisite_objective_id", ")", ":", "requisite_type", "=", "Type", "(", "*", "*", "Relationship", "(", ")", ".", "get_type_data", "(", "'OBJECTIVE.REQUISITE'", ")", ")", "ras", "=", "sel...
Creates a requirement dependency between two ``Objectives``. arg: objective_id (osid.id.Id): the ``Id`` of the dependent ``Objective`` arg: requisite_objective_id (osid.id.Id): the ``Id`` of the required ``Objective`` raise: AlreadyExists - ``objective_id`...
[ "Creates", "a", "requirement", "dependency", "between", "two", "Objectives", "." ]
python
train
dsoprea/PySchedules
pyschedules/examples/read.py
https://github.com/dsoprea/PySchedules/blob/e5aae988fad90217f72db45f93bf69839f4d75e7/pyschedules/examples/read.py#L73-L84
def new_schedule(self, program, station, time, duration, new, stereo, subtitled, hdtv, closeCaptioned, ei, tvRating, dolby, partNumber, partTotal): """Callback run for each new schedule entry""" if self.__v_schedule: # [Schedule: EP012964250031, 70387...
[ "def", "new_schedule", "(", "self", ",", "program", ",", "station", ",", "time", ",", "duration", ",", "new", ",", "stereo", ",", "subtitled", ",", "hdtv", ",", "closeCaptioned", ",", "ei", ",", "tvRating", ",", "dolby", ",", "partNumber", ",", "partTota...
Callback run for each new schedule entry
[ "Callback", "run", "for", "each", "new", "schedule", "entry" ]
python
train
webrecorder/pywb
pywb/apps/frontendapp.py
https://github.com/webrecorder/pywb/blob/77f8bb647639dd66f6b92b7a9174c28810e4b1d9/pywb/apps/frontendapp.py#L300-L328
def serve_cdx(self, environ, coll='$root'): """Make the upstream CDX query for a collection and response with the results of the query :param dict environ: The WSGI environment dictionary for the request :param str coll: The name of the collection this CDX query is for :return: The WbRe...
[ "def", "serve_cdx", "(", "self", ",", "environ", ",", "coll", "=", "'$root'", ")", ":", "base_url", "=", "self", ".", "rewriterapp", ".", "paths", "[", "'cdx-server'", "]", "#if coll == self.all_coll:", "# coll = '*'", "cdx_url", "=", "base_url", ".", "form...
Make the upstream CDX query for a collection and response with the results of the query :param dict environ: The WSGI environment dictionary for the request :param str coll: The name of the collection this CDX query is for :return: The WbResponse containing the results of the CDX query ...
[ "Make", "the", "upstream", "CDX", "query", "for", "a", "collection", "and", "response", "with", "the", "results", "of", "the", "query" ]
python
train
yyuu/botornado
boto/cloudfront/distribution.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/cloudfront/distribution.py#L617-L633
def _custom_policy(resource, expires=None, valid_after=None, ip_address=None): """ Creates a custom policy string based on the supplied parameters. """ condition = {} if expires: condition["DateLessThan"] = {"AWS:EpochTime": expires} if valid_after: ...
[ "def", "_custom_policy", "(", "resource", ",", "expires", "=", "None", ",", "valid_after", "=", "None", ",", "ip_address", "=", "None", ")", ":", "condition", "=", "{", "}", "if", "expires", ":", "condition", "[", "\"DateLessThan\"", "]", "=", "{", "\"AW...
Creates a custom policy string based on the supplied parameters.
[ "Creates", "a", "custom", "policy", "string", "based", "on", "the", "supplied", "parameters", "." ]
python
train
Skype4Py/Skype4Py
Skype4Py/skype.py
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L477-L488
def ClearCallHistory(self, Username='ALL', Type=chsAllCalls): """Clears the call history. :Parameters: Username : str Skypename of the user. A special value of 'ALL' means that entries of all users should be removed. Type : `enums`.clt* Call type....
[ "def", "ClearCallHistory", "(", "self", ",", "Username", "=", "'ALL'", ",", "Type", "=", "chsAllCalls", ")", ":", "cmd", "=", "'CLEAR CALLHISTORY %s %s'", "%", "(", "str", "(", "Type", ")", ",", "Username", ")", "self", ".", "_DoCommand", "(", "cmd", ","...
Clears the call history. :Parameters: Username : str Skypename of the user. A special value of 'ALL' means that entries of all users should be removed. Type : `enums`.clt* Call type.
[ "Clears", "the", "call", "history", "." ]
python
train
debrouwere/google-analytics
googleanalytics/query.py
https://github.com/debrouwere/google-analytics/blob/7d585c2f6f5ca191e975e6e3eaf7d5e2424fa11c/googleanalytics/query.py#L1012-L1020
def next(self): """ Return a new query with a modified `start_index`. Mainly used internally to paginate through results. """ step = self.raw.get('max_results', 1000) start = self.raw.get('start_index', 1) + step self.raw['start_index'] = start return self
[ "def", "next", "(", "self", ")", ":", "step", "=", "self", ".", "raw", ".", "get", "(", "'max_results'", ",", "1000", ")", "start", "=", "self", ".", "raw", ".", "get", "(", "'start_index'", ",", "1", ")", "+", "step", "self", ".", "raw", "[", ...
Return a new query with a modified `start_index`. Mainly used internally to paginate through results.
[ "Return", "a", "new", "query", "with", "a", "modified", "start_index", ".", "Mainly", "used", "internally", "to", "paginate", "through", "results", "." ]
python
train
horazont/aioxmpp
aioxmpp/presence/service.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L344-L354
def make_stanza(self): """ Create and return a presence stanza with the current settings. :return: Presence stanza :rtype: :class:`aioxmpp.Presence` """ stanza = aioxmpp.Presence() self._state.apply_to_stanza(stanza) stanza.status.update(self._status) ...
[ "def", "make_stanza", "(", "self", ")", ":", "stanza", "=", "aioxmpp", ".", "Presence", "(", ")", "self", ".", "_state", ".", "apply_to_stanza", "(", "stanza", ")", "stanza", ".", "status", ".", "update", "(", "self", ".", "_status", ")", "return", "st...
Create and return a presence stanza with the current settings. :return: Presence stanza :rtype: :class:`aioxmpp.Presence`
[ "Create", "and", "return", "a", "presence", "stanza", "with", "the", "current", "settings", "." ]
python
train
NICTA/revrand
revrand/btypes.py
https://github.com/NICTA/revrand/blob/4c1881b6c1772d2b988518e49dde954f165acfb6/revrand/btypes.py#L13-L47
def check(self, value): """ Check a value falls within a bound. Parameters ---------- value : scalar or ndarray value to test Returns ------- bool: If all values fall within bounds Example ------- >>> bnd ...
[ "def", "check", "(", "self", ",", "value", ")", ":", "if", "self", ".", "lower", ":", "if", "np", ".", "any", "(", "value", "<", "self", ".", "lower", ")", ":", "return", "False", "if", "self", ".", "upper", ":", "if", "np", ".", "any", "(", ...
Check a value falls within a bound. Parameters ---------- value : scalar or ndarray value to test Returns ------- bool: If all values fall within bounds Example ------- >>> bnd = Bound(1, 2) >>> bnd.check(1.5) ...
[ "Check", "a", "value", "falls", "within", "a", "bound", "." ]
python
train
Cairnarvon/uptime
src/__init__.py
https://github.com/Cairnarvon/uptime/blob/1ddfd06bb300c00e6dc4bd2a9ddf9bf1aa27b1bb/src/__init__.py#L325-L349
def uptime(): """Returns uptime in seconds if even remotely possible, or None if not.""" if __boottime is not None: return time.time() - __boottime return {'amiga': _uptime_amiga, 'aros12': _uptime_amiga, 'beos5': _uptime_beos, 'cygwin': _uptime_linux, ...
[ "def", "uptime", "(", ")", ":", "if", "__boottime", "is", "not", "None", ":", "return", "time", ".", "time", "(", ")", "-", "__boottime", "return", "{", "'amiga'", ":", "_uptime_amiga", ",", "'aros12'", ":", "_uptime_amiga", ",", "'beos5'", ":", "_uptime...
Returns uptime in seconds if even remotely possible, or None if not.
[ "Returns", "uptime", "in", "seconds", "if", "even", "remotely", "possible", "or", "None", "if", "not", "." ]
python
valid
apache/incubator-mxnet
python/mxnet/ndarray/ndarray.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/ndarray/ndarray.py#L3949-L3992
def split_v2(ary, indices_or_sections, axis=0, squeeze_axis=False): """Split an array into multiple sub-arrays. Parameters ---------- ary : NDArray Array to be divided into sub-arrays. indices_or_sections : int or tuple of ints If `indices_or_sections` is an integer, N, the array wi...
[ "def", "split_v2", "(", "ary", ",", "indices_or_sections", ",", "axis", "=", "0", ",", "squeeze_axis", "=", "False", ")", ":", "indices", "=", "[", "]", "axis_size", "=", "ary", ".", "shape", "[", "axis", "]", "if", "isinstance", "(", "indices_or_section...
Split an array into multiple sub-arrays. Parameters ---------- ary : NDArray Array to be divided into sub-arrays. indices_or_sections : int or tuple of ints If `indices_or_sections` is an integer, N, the array will be divided into N equal arrays along `axis`. If such a split is...
[ "Split", "an", "array", "into", "multiple", "sub", "-", "arrays", "." ]
python
train
twidi/django-extended-choices
extended_choices/choices.py
https://github.com/twidi/django-extended-choices/blob/bb310c5da4d53685c69173541172e4b813a6afb2/extended_choices/choices.py#L930-L972
def _convert_choices(self, choices): """Auto create display values then call super method""" final_choices = [] for choice in choices: if isinstance(choice, ChoiceEntry): final_choices.append(choice) continue original_choice = choice ...
[ "def", "_convert_choices", "(", "self", ",", "choices", ")", ":", "final_choices", "=", "[", "]", "for", "choice", "in", "choices", ":", "if", "isinstance", "(", "choice", ",", "ChoiceEntry", ")", ":", "final_choices", ".", "append", "(", "choice", ")", ...
Auto create display values then call super method
[ "Auto", "create", "display", "values", "then", "call", "super", "method" ]
python
train
LabKey/labkey-api-python
labkey/security.py
https://github.com/LabKey/labkey-api-python/blob/3c8d393384d7cbb2785f8a7f5fe34007b17a76b8/labkey/security.py#L123-L141
def get_user_by_email(server_context, email): """ Get the user with the provided email. Throws a ValueError if not found. :param server_context: A LabKey server context. See utils.create_server_context. :param email: :return: """ url = server_context.build_url(user_controller, 'getUsers.api'...
[ "def", "get_user_by_email", "(", "server_context", ",", "email", ")", ":", "url", "=", "server_context", ".", "build_url", "(", "user_controller", ",", "'getUsers.api'", ")", "payload", "=", "dict", "(", "includeDeactivatedAccounts", "=", "True", ")", "result", ...
Get the user with the provided email. Throws a ValueError if not found. :param server_context: A LabKey server context. See utils.create_server_context. :param email: :return:
[ "Get", "the", "user", "with", "the", "provided", "email", ".", "Throws", "a", "ValueError", "if", "not", "found", ".", ":", "param", "server_context", ":", "A", "LabKey", "server", "context", ".", "See", "utils", ".", "create_server_context", ".", ":", "pa...
python
train
apache/incubator-mxnet
python/mxnet/operator.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/operator.py#L682-L688
def inc(self): """Get index for new entry.""" self.lock.acquire() cur = self.counter self.counter += 1 self.lock.release() return cur
[ "def", "inc", "(", "self", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "cur", "=", "self", ".", "counter", "self", ".", "counter", "+=", "1", "self", ".", "lock", ".", "release", "(", ")", "return", "cur" ]
Get index for new entry.
[ "Get", "index", "for", "new", "entry", "." ]
python
train
JasonKessler/scattertext
scattertext/TermDocMatrix.py
https://github.com/JasonKessler/scattertext/blob/cacf1f687d218ee8cae3fc05cc901db824bb1b81/scattertext/TermDocMatrix.py#L108-L117
def get_term_freq_mat(self): ''' Returns ------- np.array with columns as categories and rows as terms ''' freq_mat = np.zeros(shape=(self.get_num_terms(), self.get_num_categories()), dtype=int) for cat_i in range(self.get_num_categories()): freq_mat[:...
[ "def", "get_term_freq_mat", "(", "self", ")", ":", "freq_mat", "=", "np", ".", "zeros", "(", "shape", "=", "(", "self", ".", "get_num_terms", "(", ")", ",", "self", ".", "get_num_categories", "(", ")", ")", ",", "dtype", "=", "int", ")", "for", "cat_...
Returns ------- np.array with columns as categories and rows as terms
[ "Returns", "-------", "np", ".", "array", "with", "columns", "as", "categories", "and", "rows", "as", "terms" ]
python
train
casastorta/python-sar
sar/multiparser.py
https://github.com/casastorta/python-sar/blob/e6d8bb86524102d677f37e985302fad34e3297c1/sar/multiparser.py#L182-L209
def __get_part_date(self, part=''): ''' Retrieves date of the combo part from the file :param part: Part of the combo file (parsed out whole SAR file from the combo :type part: str. :return: string containing date in ISO format (YYY-MM-DD) ''' ...
[ "def", "__get_part_date", "(", "self", ",", "part", "=", "''", ")", ":", "if", "(", "type", "(", "part", ")", "is", "not", "StringType", ")", ":", "# We can cope with strings only", "return", "False", "firstline", "=", "part", ".", "split", "(", "\"\\n\"",...
Retrieves date of the combo part from the file :param part: Part of the combo file (parsed out whole SAR file from the combo :type part: str. :return: string containing date in ISO format (YYY-MM-DD)
[ "Retrieves", "date", "of", "the", "combo", "part", "from", "the", "file", ":", "param", "part", ":", "Part", "of", "the", "combo", "file", "(", "parsed", "out", "whole", "SAR", "file", "from", "the", "combo", ":", "type", "part", ":", "str", ".", ":"...
python
train
DataDog/integrations-core
haproxy/datadog_checks/haproxy/haproxy.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L601-L637
def _process_metrics( self, data, url, services_incl_filter=None, services_excl_filter=None, custom_tags=None, active_tag=None ): """ Data is a dictionary related to one host (one line) extracted from the csv. It should look like: {'pxname':'dogweb', 'svname':'i-45621...
[ "def", "_process_metrics", "(", "self", ",", "data", ",", "url", ",", "services_incl_filter", "=", "None", ",", "services_excl_filter", "=", "None", ",", "custom_tags", "=", "None", ",", "active_tag", "=", "None", ")", ":", "hostname", "=", "data", "[", "'...
Data is a dictionary related to one host (one line) extracted from the csv. It should look like: {'pxname':'dogweb', 'svname':'i-4562165', 'scur':'42', ...}
[ "Data", "is", "a", "dictionary", "related", "to", "one", "host", "(", "one", "line", ")", "extracted", "from", "the", "csv", ".", "It", "should", "look", "like", ":", "{", "pxname", ":", "dogweb", "svname", ":", "i", "-", "4562165", "scur", ":", "42"...
python
train
casebeer/audiogen
audiogen/sampler.py
https://github.com/casebeer/audiogen/blob/184dee2ca32c2bb4315a0f18e62288728fcd7881/audiogen/sampler.py#L97-L108
def buffer(stream, buffer_size=BUFFER_SIZE): ''' Buffer the generator into byte strings of buffer_size samples Return a generator that outputs reasonably sized byte strings containing buffer_size samples from the generator stream. This allows us to outputing big chunks of the audio stream to disk at once for ...
[ "def", "buffer", "(", "stream", ",", "buffer_size", "=", "BUFFER_SIZE", ")", ":", "i", "=", "iter", "(", "stream", ")", "return", "iter", "(", "lambda", ":", "\"\"", ".", "join", "(", "itertools", ".", "islice", "(", "i", ",", "buffer_size", ")", ")"...
Buffer the generator into byte strings of buffer_size samples Return a generator that outputs reasonably sized byte strings containing buffer_size samples from the generator stream. This allows us to outputing big chunks of the audio stream to disk at once for faster writes.
[ "Buffer", "the", "generator", "into", "byte", "strings", "of", "buffer_size", "samples" ]
python
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras_converter.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_keras_converter.py#L103-L110
def _get_layer_converter_fn(layer): """Get the right converter function for Keras """ layer_type = type(layer) if layer_type in _KERAS_LAYER_REGISTRY: return _KERAS_LAYER_REGISTRY[layer_type] else: raise TypeError("Keras layer of type %s is not supported." % type(layer))
[ "def", "_get_layer_converter_fn", "(", "layer", ")", ":", "layer_type", "=", "type", "(", "layer", ")", "if", "layer_type", "in", "_KERAS_LAYER_REGISTRY", ":", "return", "_KERAS_LAYER_REGISTRY", "[", "layer_type", "]", "else", ":", "raise", "TypeError", "(", "\"...
Get the right converter function for Keras
[ "Get", "the", "right", "converter", "function", "for", "Keras" ]
python
train
fozzle/python-brotherprint
brotherprint/brotherprint.py
https://github.com/fozzle/python-brotherprint/blob/5fb92df11b599c30a7da3d6ac7ed60acff230044/brotherprint/brotherprint.py#L906-L924
def machine_op(self, operation): '''Perform machine operations Args: operations: which operation you would like Returns: None Raises: RuntimeError: Invalid operation ''' operations = {'feed2start': 1, 'fee...
[ "def", "machine_op", "(", "self", ",", "operation", ")", ":", "operations", "=", "{", "'feed2start'", ":", "1", ",", "'feedone'", ":", "2", ",", "'cut'", ":", "3", "}", "if", "operation", "in", "operations", ":", "self", ".", "send", "(", "'^'", "+",...
Perform machine operations Args: operations: which operation you would like Returns: None Raises: RuntimeError: Invalid operation
[ "Perform", "machine", "operations", "Args", ":", "operations", ":", "which", "operation", "you", "would", "like", "Returns", ":", "None", "Raises", ":", "RuntimeError", ":", "Invalid", "operation" ]
python
train
twisted/mantissa
xmantissa/liveform.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/liveform.py#L451-L468
def getInitialLiveForms(self): """ Make and return as many L{LiveForm} instances as are necessary to hold our default values. @return: some subforms. @rtype: C{list} of L{LiveForm} """ liveForms = [] if self._defaultStuff: for values in self._...
[ "def", "getInitialLiveForms", "(", "self", ")", ":", "liveForms", "=", "[", "]", "if", "self", ".", "_defaultStuff", ":", "for", "values", "in", "self", ".", "_defaultStuff", ":", "liveForms", ".", "append", "(", "self", ".", "_makeDefaultLiveForm", "(", "...
Make and return as many L{LiveForm} instances as are necessary to hold our default values. @return: some subforms. @rtype: C{list} of L{LiveForm}
[ "Make", "and", "return", "as", "many", "L", "{", "LiveForm", "}", "instances", "as", "are", "necessary", "to", "hold", "our", "default", "values", "." ]
python
train
MKLab-ITI/reveal-graph-embedding
reveal_graph_embedding/datautil/insight_datautil/insight_read_data.py
https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/datautil/insight_datautil/insight_read_data.py#L139-L174
def scipy_sparse_to_csv(filepath, matrix, separator=",", directed=False, numbering="matlab"): """ Writes sparse matrix in separated value format. """ matrix = spsp.coo_matrix(matrix) shape = matrix.shape nnz = matrix.getnnz() if numbering == "matlab": row = matrix.row + 1 c...
[ "def", "scipy_sparse_to_csv", "(", "filepath", ",", "matrix", ",", "separator", "=", "\",\"", ",", "directed", "=", "False", ",", "numbering", "=", "\"matlab\"", ")", ":", "matrix", "=", "spsp", ".", "coo_matrix", "(", "matrix", ")", "shape", "=", "matrix"...
Writes sparse matrix in separated value format.
[ "Writes", "sparse", "matrix", "in", "separated", "value", "format", "." ]
python
train
release-engineering/productmd
productmd/common.py
https://github.com/release-engineering/productmd/blob/49256bf2e8c84124f42346241140b986ad7bfc38/productmd/common.py#L430-L462
def create_release_id(short, version, type, bp_short=None, bp_version=None, bp_type=None): """ Create release_id from given parts. :param short: Release short name :type short: str :param version: Release version :type version: str :param version: Release type :type version: str :pa...
[ "def", "create_release_id", "(", "short", ",", "version", ",", "type", ",", "bp_short", "=", "None", ",", "bp_version", "=", "None", ",", "bp_type", "=", "None", ")", ":", "if", "not", "is_valid_release_short", "(", "short", ")", ":", "raise", "ValueError"...
Create release_id from given parts. :param short: Release short name :type short: str :param version: Release version :type version: str :param version: Release type :type version: str :param bp_short: Base Product short name :type bp_short: str :param bp_version: Base Product versi...
[ "Create", "release_id", "from", "given", "parts", "." ]
python
train
angr/pyvex
pyvex/lifting/lifter.py
https://github.com/angr/pyvex/blob/c418edc1146982b2a0579bf56e5993c1c7046b19/pyvex/lifting/lifter.py#L36-L78
def _lift(self, data, bytes_offset=None, max_bytes=None, max_inst=None, opt_level=1, traceflags=None, allow_arch_optimizations=None, strict_block_end=None, skip_stmts=False, collec...
[ "def", "_lift", "(", "self", ",", "data", ",", "bytes_offset", "=", "None", ",", "max_bytes", "=", "None", ",", "max_inst", "=", "None", ",", "opt_level", "=", "1", ",", "traceflags", "=", "None", ",", "allow_arch_optimizations", "=", "None", ",", "stric...
Wrapper around the `lift` method on Lifters. Should not be overridden in child classes. :param data: The bytes to lift as either a python string of bytes or a cffi buffer object. :param bytes_offset: The offset into `data` to start lifting at. :param max_bytes: T...
[ "Wrapper", "around", "the", "lift", "method", "on", "Lifters", ".", "Should", "not", "be", "overridden", "in", "child", "classes", "." ]
python
train
rabitt/pysox
sox/core.py
https://github.com/rabitt/pysox/blob/eae89bde74567136ec3f723c3e6b369916d9b837/sox/core.py#L129-L168
def play(args): '''Pass an argument list to play. Parameters ---------- args : iterable Argument list for play. The first item can, but does not need to, be 'play'. Returns: -------- status : bool True on success. ''' if args[0].lower() != "play": a...
[ "def", "play", "(", "args", ")", ":", "if", "args", "[", "0", "]", ".", "lower", "(", ")", "!=", "\"play\"", ":", "args", ".", "insert", "(", "0", ",", "\"play\"", ")", "else", ":", "args", "[", "0", "]", "=", "\"play\"", "try", ":", "logger", ...
Pass an argument list to play. Parameters ---------- args : iterable Argument list for play. The first item can, but does not need to, be 'play'. Returns: -------- status : bool True on success.
[ "Pass", "an", "argument", "list", "to", "play", "." ]
python
valid
kwikteam/phy
phy/utils/event.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/utils/event.py#L68-L101
def connect(self, func=None, event=None, set_method=False): """Register a callback function to a given event. To register a callback function to the `spam` event, where `obj` is an instance of a class deriving from `EventEmitter`: ```python @obj.connect def on_spam(arg1...
[ "def", "connect", "(", "self", ",", "func", "=", "None", ",", "event", "=", "None", ",", "set_method", "=", "False", ")", ":", "if", "func", "is", "None", ":", "return", "partial", "(", "self", ".", "connect", ",", "set_method", "=", "set_method", ")...
Register a callback function to a given event. To register a callback function to the `spam` event, where `obj` is an instance of a class deriving from `EventEmitter`: ```python @obj.connect def on_spam(arg1, arg2): pass ``` This is called when `obj...
[ "Register", "a", "callback", "function", "to", "a", "given", "event", "." ]
python
train