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
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9706-L9717
def mission_ack_send(self, target_system, target_component, type, force_mavlink1=False): ''' Ack message during MISSION handling. The type field states if this message is a positive ack (type=0) or if an error happened (type=non-zero). tar...
[ "def", "mission_ack_send", "(", "self", ",", "target_system", ",", "target_component", ",", "type", ",", "force_mavlink1", "=", "False", ")", ":", "return", "self", ".", "send", "(", "self", ".", "mission_ack_encode", "(", "target_system", ",", "target_component...
Ack message during MISSION handling. The type field states if this message is a positive ack (type=0) or if an error happened (type=non-zero). target_system : System ID (uint8_t) target_component : Component ID (uint8_t) ...
[ "Ack", "message", "during", "MISSION", "handling", ".", "The", "type", "field", "states", "if", "this", "message", "is", "a", "positive", "ack", "(", "type", "=", "0", ")", "or", "if", "an", "error", "happened", "(", "type", "=", "non", "-", "zero", ...
python
train
twilio/twilio-python
twilio/rest/flex_api/v1/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/flex_api/v1/__init__.py#L38-L44
def configuration(self): """ :rtype: twilio.rest.flex_api.v1.configuration.ConfigurationList """ if self._configuration is None: self._configuration = ConfigurationList(self) return self._configuration
[ "def", "configuration", "(", "self", ")", ":", "if", "self", ".", "_configuration", "is", "None", ":", "self", ".", "_configuration", "=", "ConfigurationList", "(", "self", ")", "return", "self", ".", "_configuration" ]
:rtype: twilio.rest.flex_api.v1.configuration.ConfigurationList
[ ":", "rtype", ":", "twilio", ".", "rest", ".", "flex_api", ".", "v1", ".", "configuration", ".", "ConfigurationList" ]
python
train
nickw444/flask-ldap3-login
flask_ldap3_login/__init__.py
https://github.com/nickw444/flask-ldap3-login/blob/3cf0faff52d0e04d4813119a2ba36d706e6fb31f/flask_ldap3_login/__init__.py#L205-L219
def teardown(self, exception): """ Cleanup after a request. Close any open connections. """ ctx = stack.top if ctx is not None: if hasattr(ctx, 'ldap3_manager_connections'): for connection in ctx.ldap3_manager_connections: self.des...
[ "def", "teardown", "(", "self", ",", "exception", ")", ":", "ctx", "=", "stack", ".", "top", "if", "ctx", "is", "not", "None", ":", "if", "hasattr", "(", "ctx", ",", "'ldap3_manager_connections'", ")", ":", "for", "connection", "in", "ctx", ".", "ldap3...
Cleanup after a request. Close any open connections.
[ "Cleanup", "after", "a", "request", ".", "Close", "any", "open", "connections", "." ]
python
test
jborean93/requests-credssp
requests_credssp/credssp.py
https://github.com/jborean93/requests-credssp/blob/470db8d74dff919da67cf382e9ff784d4e8dd053/requests_credssp/credssp.py#L175-L221
def _build_pub_key_auth(self, context, nonce, auth_token, public_key): """ [MS-CSSP] 3.1.5 Processing Events and Sequencing Rules - Step 3 https://msdn.microsoft.com/en-us/library/cc226791.aspx This step sends the final SPNEGO token to the server if required and computes the val...
[ "def", "_build_pub_key_auth", "(", "self", ",", "context", ",", "nonce", ",", "auth_token", ",", "public_key", ")", ":", "ts_request", "=", "TSRequest", "(", ")", "if", "auth_token", "is", "not", "None", ":", "nego_token", "=", "NegoToken", "(", ")", "nego...
[MS-CSSP] 3.1.5 Processing Events and Sequencing Rules - Step 3 https://msdn.microsoft.com/en-us/library/cc226791.aspx This step sends the final SPNEGO token to the server if required and computes the value for the pubKeyAuth field for the protocol version negotiated. The forma...
[ "[", "MS", "-", "CSSP", "]", "3", ".", "1", ".", "5", "Processing", "Events", "and", "Sequencing", "Rules", "-", "Step", "3", "https", ":", "//", "msdn", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "library", "/", "cc226791", ".", "a...
python
train
clintval/sample-sheet
sample_sheet/__init__.py
https://github.com/clintval/sample-sheet/blob/116ac6f26f6e61b57716c90f6e887d3d457756f3/sample_sheet/__init__.py#L865-L908
def write(self, handle: TextIO, blank_lines: int = 1) -> None: """Write this :class:`SampleSheet` to a file-like object. Args: handle: Object to wrap by csv.writer. blank_lines: Number of blank lines to write between sections. """ if not isinstance(blank_lines, ...
[ "def", "write", "(", "self", ",", "handle", ":", "TextIO", ",", "blank_lines", ":", "int", "=", "1", ")", "->", "None", ":", "if", "not", "isinstance", "(", "blank_lines", ",", "int", ")", "or", "blank_lines", "<=", "0", ":", "raise", "ValueError", "...
Write this :class:`SampleSheet` to a file-like object. Args: handle: Object to wrap by csv.writer. blank_lines: Number of blank lines to write between sections.
[ "Write", "this", ":", "class", ":", "SampleSheet", "to", "a", "file", "-", "like", "object", "." ]
python
train
mikekatz04/BOWIE
bowie/plotutils/makeprocess.py
https://github.com/mikekatz04/BOWIE/blob/a941342a3536cb57c817a1643896d99a3f354a86/bowie/plotutils/makeprocess.py#L252-L280
def create_plots(self): """Creates plots according to each plotting class. """ for i, axis in enumerate(self.ax): # plot everything. First check general dict for parameters related to plots. trans_plot_class_call = globals()[self.plot_types[i]] trans_plot_cla...
[ "def", "create_plots", "(", "self", ")", ":", "for", "i", ",", "axis", "in", "enumerate", "(", "self", ".", "ax", ")", ":", "# plot everything. First check general dict for parameters related to plots.", "trans_plot_class_call", "=", "globals", "(", ")", "[", "self"...
Creates plots according to each plotting class.
[ "Creates", "plots", "according", "to", "each", "plotting", "class", "." ]
python
train
google/transitfeed
merge.py
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/merge.py#L1597-L1642
def _FindLargestIdPostfixNumber(self, schedule): """Finds the largest integer used as the ending of an id in the schedule. Args: schedule: The schedule to check. Returns: The maximum integer used as an ending for an id. """ postfix_number_re = re.compile('(\d+)$') def ExtractPostf...
[ "def", "_FindLargestIdPostfixNumber", "(", "self", ",", "schedule", ")", ":", "postfix_number_re", "=", "re", ".", "compile", "(", "'(\\d+)$'", ")", "def", "ExtractPostfixNumber", "(", "entity_id", ")", ":", "\"\"\"Try to extract an integer from the end of entity_id.\n\n ...
Finds the largest integer used as the ending of an id in the schedule. Args: schedule: The schedule to check. Returns: The maximum integer used as an ending for an id.
[ "Finds", "the", "largest", "integer", "used", "as", "the", "ending", "of", "an", "id", "in", "the", "schedule", "." ]
python
train
jvarho/pylibscrypt
pylibscrypt/pylibsodium.py
https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pylibsodium.py#L98-L138
def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64): """Returns a key derived using the scrypt key-derivarion function N must be a power of two larger than 1 but no larger than 2 ** 63 (insane) r and p must be positive numbers such that r * p < 2 ** 30 The default values are: N...
[ "def", "scrypt", "(", "password", ",", "salt", ",", "N", "=", "SCRYPT_N", ",", "r", "=", "SCRYPT_r", ",", "p", "=", "SCRYPT_p", ",", "olen", "=", "64", ")", ":", "check_args", "(", "password", ",", "salt", ",", "N", ",", "r", ",", "p", ",", "ol...
Returns a key derived using the scrypt key-derivarion function N must be a power of two larger than 1 but no larger than 2 ** 63 (insane) r and p must be positive numbers such that r * p < 2 ** 30 The default values are: N -- 2**14 (~16k) r -- 8 p -- 1 Memory usage is proportional to N*r....
[ "Returns", "a", "key", "derived", "using", "the", "scrypt", "key", "-", "derivarion", "function" ]
python
train
annoviko/pyclustering
pyclustering/cluster/__init__.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/__init__.py#L424-L476
def append_cluster(self, cluster, data=None, canvas=0, marker='.', markersize=None, color=None): """! @brief Appends cluster to canvas for drawing. @param[in] cluster (list): cluster that may consist of indexes of objects from the data or object itself. @param[in] data (lis...
[ "def", "append_cluster", "(", "self", ",", "cluster", ",", "data", "=", "None", ",", "canvas", "=", "0", ",", "marker", "=", "'.'", ",", "markersize", "=", "None", ",", "color", "=", "None", ")", ":", "if", "len", "(", "cluster", ")", "==", "0", ...
! @brief Appends cluster to canvas for drawing. @param[in] cluster (list): cluster that may consist of indexes of objects from the data or object itself. @param[in] data (list): If defines that each element of cluster is considered as a index of object from the data. @param...
[ "!" ]
python
valid
codelv/enaml-native
src/enamlnative/android/app.py
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/app.py#L119-L151
def request_permissions(self, permissions): """ Return a future that resolves with the results of the permission requests """ f = self.create_future() #: Old versions of android did permissions at install time if self.api_level < 23: f.set_result({p...
[ "def", "request_permissions", "(", "self", ",", "permissions", ")", ":", "f", "=", "self", ".", "create_future", "(", ")", "#: Old versions of android did permissions at install time", "if", "self", ".", "api_level", "<", "23", ":", "f", ".", "set_result", "(", ...
Return a future that resolves with the results of the permission requests
[ "Return", "a", "future", "that", "resolves", "with", "the", "results", "of", "the", "permission", "requests" ]
python
train
wbond/asn1crypto
asn1crypto/x509.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/x509.py#L1083-L1119
def human_friendly(self): """ :return: A human-friendly unicode string containing the parts of the name """ if self._human_friendly is None: data = OrderedDict() last_field = None for rdn in self.chosen: for type_val in rdn...
[ "def", "human_friendly", "(", "self", ")", ":", "if", "self", ".", "_human_friendly", "is", "None", ":", "data", "=", "OrderedDict", "(", ")", "last_field", "=", "None", "for", "rdn", "in", "self", ".", "chosen", ":", "for", "type_val", "in", "rdn", ":...
:return: A human-friendly unicode string containing the parts of the name
[ ":", "return", ":", "A", "human", "-", "friendly", "unicode", "string", "containing", "the", "parts", "of", "the", "name" ]
python
train
HazyResearch/metal
metal/multitask/mt_classifier.py
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_classifier.py#L213-L218
def _to_torch(Z, dtype=None): """Converts a None, list, np.ndarray, or torch.Tensor to torch.Tensor""" if isinstance(Z, list): return [Classifier._to_torch(z, dtype=dtype) for z in Z] else: return Classifier._to_torch(Z)
[ "def", "_to_torch", "(", "Z", ",", "dtype", "=", "None", ")", ":", "if", "isinstance", "(", "Z", ",", "list", ")", ":", "return", "[", "Classifier", ".", "_to_torch", "(", "z", ",", "dtype", "=", "dtype", ")", "for", "z", "in", "Z", "]", "else", ...
Converts a None, list, np.ndarray, or torch.Tensor to torch.Tensor
[ "Converts", "a", "None", "list", "np", ".", "ndarray", "or", "torch", ".", "Tensor", "to", "torch", ".", "Tensor" ]
python
train
tensorflow/probability
experimental/mcmc/elliptical_slice_sampler.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/experimental/mcmc/elliptical_slice_sampler.py#L405-L417
def _prepare_args(log_likelihood_fn, state, log_likelihood=None, description='log_likelihood'): """Processes input args to meet list-like assumptions.""" state_parts = list(state) if mcmc_util.is_list_like(state) else [state] state_parts = [tf.convert_to_tensor(s, name='current_state') ...
[ "def", "_prepare_args", "(", "log_likelihood_fn", ",", "state", ",", "log_likelihood", "=", "None", ",", "description", "=", "'log_likelihood'", ")", ":", "state_parts", "=", "list", "(", "state", ")", "if", "mcmc_util", ".", "is_list_like", "(", "state", ")",...
Processes input args to meet list-like assumptions.
[ "Processes", "input", "args", "to", "meet", "list", "-", "like", "assumptions", "." ]
python
test
quantumlib/Cirq
cirq/ops/common_gates.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/ops/common_gates.py#L1138-L1141
def Ry(rads: Union[float, sympy.Basic]) -> YPowGate: """Returns a gate with the matrix e^{-i Y rads / 2}.""" pi = sympy.pi if protocols.is_parameterized(rads) else np.pi return YPowGate(exponent=rads / pi, global_shift=-0.5)
[ "def", "Ry", "(", "rads", ":", "Union", "[", "float", ",", "sympy", ".", "Basic", "]", ")", "->", "YPowGate", ":", "pi", "=", "sympy", ".", "pi", "if", "protocols", ".", "is_parameterized", "(", "rads", ")", "else", "np", ".", "pi", "return", "YPow...
Returns a gate with the matrix e^{-i Y rads / 2}.
[ "Returns", "a", "gate", "with", "the", "matrix", "e^", "{", "-", "i", "Y", "rads", "/", "2", "}", "." ]
python
train
sentinel-hub/eo-learn
features/eolearn/features/radiometric_normalization.py
https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/features/eolearn/features/radiometric_normalization.py#L104-L124
def _geoville_index_by_percentile(self, data, percentile): """ Calculate percentile of numpy stack and return the index of the chosen pixel. """ # no_obs = bn.allnan(arr_tmp["data"], axis=0) data_tmp = np.array(data, copy=True) valid_obs = np.sum(np.isfinite(data_tmp), axis=0) # ...
[ "def", "_geoville_index_by_percentile", "(", "self", ",", "data", ",", "percentile", ")", ":", "# no_obs = bn.allnan(arr_tmp[\"data\"], axis=0)", "data_tmp", "=", "np", ".", "array", "(", "data", ",", "copy", "=", "True", ")", "valid_obs", "=", "np", ".", "sum",...
Calculate percentile of numpy stack and return the index of the chosen pixel.
[ "Calculate", "percentile", "of", "numpy", "stack", "and", "return", "the", "index", "of", "the", "chosen", "pixel", "." ]
python
train
kgiusti/pyngus
pyngus/link.py
https://github.com/kgiusti/pyngus/blob/5392392046989f1bb84ba938c30e4d48311075f1/pyngus/link.py#L878-L884
def _ep_need_close(self): """Peer has closed its end of the session.""" LOG.debug("Session %s close requested - closing...", self._name) links = self._links.copy() # may modify _links for link in links: link._session_closed()
[ "def", "_ep_need_close", "(", "self", ")", ":", "LOG", ".", "debug", "(", "\"Session %s close requested - closing...\"", ",", "self", ".", "_name", ")", "links", "=", "self", ".", "_links", ".", "copy", "(", ")", "# may modify _links", "for", "link", "in", "...
Peer has closed its end of the session.
[ "Peer", "has", "closed", "its", "end", "of", "the", "session", "." ]
python
test
UDST/urbansim
urbansim/models/dcm.py
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/models/dcm.py#L1439-L1457
def apply_fit_filters(self, choosers, alternatives): """ Filter `choosers` and `alternatives` for fitting. Parameters ---------- choosers : pandas.DataFrame Table describing the agents making choices, e.g. households. alternatives : pandas.DataFrame ...
[ "def", "apply_fit_filters", "(", "self", ",", "choosers", ",", "alternatives", ")", ":", "return", "super", "(", "SegmentedMNLDiscreteChoiceModel", ",", "self", ")", ".", "apply_fit_filters", "(", "choosers", ",", "alternatives", ")" ]
Filter `choosers` and `alternatives` for fitting. Parameters ---------- choosers : pandas.DataFrame Table describing the agents making choices, e.g. households. alternatives : pandas.DataFrame Table describing the things from which agents are choosing, ...
[ "Filter", "choosers", "and", "alternatives", "for", "fitting", "." ]
python
train
basho/riak-python-client
riak/mapreduce.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/mapreduce.py#L77-L85
def add_object(self, obj): """ Adds a RiakObject to the inputs. :param obj: the object to add :type obj: RiakObject :rtype: :class:`RiakMapReduce` """ return self.add_bucket_key_data(obj._bucket._name, obj._key, None)
[ "def", "add_object", "(", "self", ",", "obj", ")", ":", "return", "self", ".", "add_bucket_key_data", "(", "obj", ".", "_bucket", ".", "_name", ",", "obj", ".", "_key", ",", "None", ")" ]
Adds a RiakObject to the inputs. :param obj: the object to add :type obj: RiakObject :rtype: :class:`RiakMapReduce`
[ "Adds", "a", "RiakObject", "to", "the", "inputs", "." ]
python
train
sebp/scikit-survival
sksurv/meta/ensemble_selection.py
https://github.com/sebp/scikit-survival/blob/cfc99fd20454cdd6f4f20fe331b39f2191ccaabc/sksurv/meta/ensemble_selection.py#L277-L297
def fit(self, X, y=None, **fit_params): """Fit ensemble of models Parameters ---------- X : array-like, shape = (n_samples, n_features) Training data. y : array-like, optional Target data if base estimators are supervised. Returns ------...
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "fit_params", ")", ":", "self", ".", "_check_params", "(", ")", "cv", "=", "check_cv", "(", "self", ".", "cv", ",", "X", ")", "self", ".", "_fit", "(", "X", ",", "y", ...
Fit ensemble of models Parameters ---------- X : array-like, shape = (n_samples, n_features) Training data. y : array-like, optional Target data if base estimators are supervised. Returns ------- self
[ "Fit", "ensemble", "of", "models" ]
python
train
Jaymon/endpoints
endpoints/http.py
https://github.com/Jaymon/endpoints/blob/2f1c4ae2c69a168e69447d3d8395ada7becaa5fb/endpoints/http.py#L971-L976
def path(self): """path part of a url (eg, http://host.com/path?query=string)""" self._path = '' path_args = self.path_args path = "/{}".format("/".join(path_args)) return path
[ "def", "path", "(", "self", ")", ":", "self", ".", "_path", "=", "''", "path_args", "=", "self", ".", "path_args", "path", "=", "\"/{}\"", ".", "format", "(", "\"/\"", ".", "join", "(", "path_args", ")", ")", "return", "path" ]
path part of a url (eg, http://host.com/path?query=string)
[ "path", "part", "of", "a", "url", "(", "eg", "http", ":", "//", "host", ".", "com", "/", "path?query", "=", "string", ")" ]
python
train
rsinger86/django-lifecycle
django_lifecycle/__init__.py
https://github.com/rsinger86/django-lifecycle/blob/2196908ef0e242e52aab5bfaa3d337930700c106/django_lifecycle/__init__.py#L228-L245
def _run_hooked_methods(self, hook: str): """ Iterate through decorated methods to find those that should be triggered by the current hook. If conditions exist, check them before running otherwise go ahead and run. """ for method in self._potentially_hooked_me...
[ "def", "_run_hooked_methods", "(", "self", ",", "hook", ":", "str", ")", ":", "for", "method", "in", "self", ".", "_potentially_hooked_methods", ":", "for", "callback_specs", "in", "method", ".", "_hooked", ":", "if", "callback_specs", "[", "'hook'", "]", "!...
Iterate through decorated methods to find those that should be triggered by the current hook. If conditions exist, check them before running otherwise go ahead and run.
[ "Iterate", "through", "decorated", "methods", "to", "find", "those", "that", "should", "be", "triggered", "by", "the", "current", "hook", ".", "If", "conditions", "exist", "check", "them", "before", "running", "otherwise", "go", "ahead", "and", "run", "." ]
python
train
merll/docker-fabric
dockerfabric/actions.py
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/actions.py#L16-L25
def perform(action_name, container, **kwargs): """ Performs an action on the given container map and configuration. :param action_name: Name of the action (e.g. ``update``). :param container: Container configuration name. :param kwargs: Keyword arguments for the action implementation. """ c...
[ "def", "perform", "(", "action_name", ",", "container", ",", "*", "*", "kwargs", ")", ":", "cf", "=", "container_fabric", "(", ")", "cf", ".", "call", "(", "action_name", ",", "container", ",", "*", "*", "kwargs", ")" ]
Performs an action on the given container map and configuration. :param action_name: Name of the action (e.g. ``update``). :param container: Container configuration name. :param kwargs: Keyword arguments for the action implementation.
[ "Performs", "an", "action", "on", "the", "given", "container", "map", "and", "configuration", "." ]
python
train
blockcypher/blockcypher-python
blockcypher/api.py
https://github.com/blockcypher/blockcypher-python/blob/7601ea21916957ff279384fd699527ff9c28a56e/blockcypher/api.py#L887-L902
def delete_forwarding_address(payment_id, coin_symbol='btc', api_key=None): ''' Delete a forwarding address on a specific blockchain, using its payment id ''' assert payment_id, 'payment_id required' assert is_valid_coin_symbol(coin_symbol) assert api_key, 'api_key required' params = {...
[ "def", "delete_forwarding_address", "(", "payment_id", ",", "coin_symbol", "=", "'btc'", ",", "api_key", "=", "None", ")", ":", "assert", "payment_id", ",", "'payment_id required'", "assert", "is_valid_coin_symbol", "(", "coin_symbol", ")", "assert", "api_key", ",",...
Delete a forwarding address on a specific blockchain, using its payment id
[ "Delete", "a", "forwarding", "address", "on", "a", "specific", "blockchain", "using", "its", "payment", "id" ]
python
train
Ouranosinc/xclim
xclim/indices.py
https://github.com/Ouranosinc/xclim/blob/2080d139188bd8de2aeca097a025c2d89d6e0e09/xclim/indices.py#L1051-L1083
def ice_days(tasmax, freq='YS'): r"""Number of ice/freezing days Number of days where daily maximum temperatures are below 0℃. Parameters ---------- tasmax : xarrray.DataArray Maximum daily temperature [℃] or [K] freq : str, optional Resampling frequency Returns ------- ...
[ "def", "ice_days", "(", "tasmax", ",", "freq", "=", "'YS'", ")", ":", "tu", "=", "units", ".", "parse_units", "(", "tasmax", ".", "attrs", "[", "'units'", "]", ".", "replace", "(", "'-'", ",", "'**-'", ")", ")", "fu", "=", "'degC'", "frz", "=", "...
r"""Number of ice/freezing days Number of days where daily maximum temperatures are below 0℃. Parameters ---------- tasmax : xarrray.DataArray Maximum daily temperature [℃] or [K] freq : str, optional Resampling frequency Returns ------- xarray.DataArray Number of ic...
[ "r", "Number", "of", "ice", "/", "freezing", "days" ]
python
train
h2oai/h2o-3
h2o-bindings/bin/bindings.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L298-L303
def endpoint_groups(): """Return endpoints, grouped by the class which handles them.""" groups = defaultdict(list) for e in endpoints(): groups[e["class_name"]].append(e) return groups
[ "def", "endpoint_groups", "(", ")", ":", "groups", "=", "defaultdict", "(", "list", ")", "for", "e", "in", "endpoints", "(", ")", ":", "groups", "[", "e", "[", "\"class_name\"", "]", "]", ".", "append", "(", "e", ")", "return", "groups" ]
Return endpoints, grouped by the class which handles them.
[ "Return", "endpoints", "grouped", "by", "the", "class", "which", "handles", "them", "." ]
python
test
click-contrib/sphinx-click
sphinx_click/ext.py
https://github.com/click-contrib/sphinx-click/blob/ec76d15697ec80e51486a6e3daa0aec60b04870f/sphinx_click/ext.py#L144-L156
def _format_envvar(param): """Format the envvars of a `click.Option` or `click.Argument`.""" yield '.. envvar:: {}'.format(param.envvar) yield ' :noindex:' yield '' if isinstance(param, click.Argument): param_ref = param.human_readable_name else: # if a user has defined an opt ...
[ "def", "_format_envvar", "(", "param", ")", ":", "yield", "'.. envvar:: {}'", ".", "format", "(", "param", ".", "envvar", ")", "yield", "' :noindex:'", "yield", "''", "if", "isinstance", "(", "param", ",", "click", ".", "Argument", ")", ":", "param_ref", ...
Format the envvars of a `click.Option` or `click.Argument`.
[ "Format", "the", "envvars", "of", "a", "click", ".", "Option", "or", "click", ".", "Argument", "." ]
python
train
closeio/tasktiger
tasktiger/worker.py
https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/worker.py#L177-L220
def _wait_for_new_tasks(self, timeout=0, batch_timeout=0): """ Check activity channel and wait as necessary. This method is also used to slow down the main processing loop to reduce the effects of rapidly sending Redis commands. This method will exit for any of these conditions...
[ "def", "_wait_for_new_tasks", "(", "self", ",", "timeout", "=", "0", ",", "batch_timeout", "=", "0", ")", ":", "new_queue_found", "=", "False", "start_time", "=", "batch_exit", "=", "time", ".", "time", "(", ")", "while", "True", ":", "# Check to see if batc...
Check activity channel and wait as necessary. This method is also used to slow down the main processing loop to reduce the effects of rapidly sending Redis commands. This method will exit for any of these conditions: 1. _did_work is True, suggests there could be more work pending ...
[ "Check", "activity", "channel", "and", "wait", "as", "necessary", "." ]
python
train
fhamborg/news-please
newsplease/helper_classes/savepath_parser.py
https://github.com/fhamborg/news-please/blob/731837c2a6c223cfb3e1d7f5fdc4f4eced2310f9/newsplease/helper_classes/savepath_parser.py#L280-L292
def get_formatted_relative_path(self, path): """ Formates path to not start with a leading './' or '.\' if enables in the config :param str path: the path to format :return str: the [formatted] path """ if self.format_relative_path and \ (path.sta...
[ "def", "get_formatted_relative_path", "(", "self", ",", "path", ")", ":", "if", "self", ".", "format_relative_path", "and", "(", "path", ".", "startswith", "(", "'./'", ")", "or", "path", ".", "startswith", "(", "'.\\\\'", ")", ")", ":", "return", "path", ...
Formates path to not start with a leading './' or '.\' if enables in the config :param str path: the path to format :return str: the [formatted] path
[ "Formates", "path", "to", "not", "start", "with", "a", "leading", ".", "/", "or", ".", "\\", "if", "enables", "in", "the", "config" ]
python
train
fhs/pyhdf
pyhdf/V.py
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/V.py#L778-L798
def find(self, name): """Find a vgroup given its name, returning its reference number if found. Args:: name name of the vgroup to find Returns:: vgroup reference number An exception is raised if the vgroup is not found. C library equivalent: ...
[ "def", "find", "(", "self", ",", "name", ")", ":", "refnum", "=", "_C", ".", "Vfind", "(", "self", ".", "_hdf_inst", ".", "_id", ",", "name", ")", "if", "not", "refnum", ":", "raise", "HDF4Error", "(", "\"vgroup not found\"", ")", "return", "refnum" ]
Find a vgroup given its name, returning its reference number if found. Args:: name name of the vgroup to find Returns:: vgroup reference number An exception is raised if the vgroup is not found. C library equivalent: Vfind
[ "Find", "a", "vgroup", "given", "its", "name", "returning", "its", "reference", "number", "if", "found", "." ]
python
train
sentinel-hub/sentinelhub-py
sentinelhub/geopedia.py
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/geopedia.py#L388-L398
def _fetch_features(self): """ Retrieves a new page of features from Geopedia """ if self.next_page_url is None: return response = get_json(self.next_page_url, post_values=self.query, headers=self.gpd_session.session_headers) self.features.extend(response['features'...
[ "def", "_fetch_features", "(", "self", ")", ":", "if", "self", ".", "next_page_url", "is", "None", ":", "return", "response", "=", "get_json", "(", "self", ".", "next_page_url", ",", "post_values", "=", "self", ".", "query", ",", "headers", "=", "self", ...
Retrieves a new page of features from Geopedia
[ "Retrieves", "a", "new", "page", "of", "features", "from", "Geopedia" ]
python
train
numenta/nupic
src/nupic/data/aggregator.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/aggregator.py#L720-L834
def generateDataset(aggregationInfo, inputFilename, outputFilename=None): """Generate a dataset of aggregated values Parameters: ---------------------------------------------------------------------------- aggregationInfo: a dictionary that contains the following entries - fields: a list of pairs. Each pai...
[ "def", "generateDataset", "(", "aggregationInfo", ",", "inputFilename", ",", "outputFilename", "=", "None", ")", ":", "# Create the input stream", "inputFullPath", "=", "resource_filename", "(", "\"nupic.datafiles\"", ",", "inputFilename", ")", "inputObj", "=", "FileRec...
Generate a dataset of aggregated values Parameters: ---------------------------------------------------------------------------- aggregationInfo: a dictionary that contains the following entries - fields: a list of pairs. Each pair is a field name and an aggregation function (e.g. sum). The function wi...
[ "Generate", "a", "dataset", "of", "aggregated", "values" ]
python
valid
apache/incubator-mxnet
example/gluon/lipnet/utils/align.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/gluon/lipnet/utils/align.py#L54-L60
def sentence(self, padding=75): """ Get sentence """ vec = word_to_vector(self.sentence_str) vec += [-1] * (padding - self.sentence_length) return np.array(vec, dtype=np.int32)
[ "def", "sentence", "(", "self", ",", "padding", "=", "75", ")", ":", "vec", "=", "word_to_vector", "(", "self", ".", "sentence_str", ")", "vec", "+=", "[", "-", "1", "]", "*", "(", "padding", "-", "self", ".", "sentence_length", ")", "return", "np", ...
Get sentence
[ "Get", "sentence" ]
python
train
phaethon/kamene
kamene/contrib/gsm_um.py
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/contrib/gsm_um.py#L2390-L2399
def detachRequest(GmmCause_presence=0): """DETACH REQUEST Section 9.4.5""" a = TpPd(pd=0x3) b = MessageType(mesType=0x5) # 00000101 c = DetachTypeAndForceToStandby() packet = a / b / c if GmmCause_presence is 1: e = GmmCause(ieiGC=0x25) packet = packet / e return packet
[ "def", "detachRequest", "(", "GmmCause_presence", "=", "0", ")", ":", "a", "=", "TpPd", "(", "pd", "=", "0x3", ")", "b", "=", "MessageType", "(", "mesType", "=", "0x5", ")", "# 00000101", "c", "=", "DetachTypeAndForceToStandby", "(", ")", "packet", "=", ...
DETACH REQUEST Section 9.4.5
[ "DETACH", "REQUEST", "Section", "9", ".", "4", ".", "5" ]
python
train
lablup/backend.ai-client-py
src/ai/backend/client/kernel.py
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/kernel.py#L168-L200
async def complete(self, code: str, opts: dict = None) -> Iterable[str]: ''' Gets the auto-completion candidates from the given code string, as if a user has pressed the tab key just after the code in IDEs. Depending on the language of the compute session, this feature m...
[ "async", "def", "complete", "(", "self", ",", "code", ":", "str", ",", "opts", ":", "dict", "=", "None", ")", "->", "Iterable", "[", "str", "]", ":", "opts", "=", "{", "}", "if", "opts", "is", "None", "else", "opts", "params", "=", "{", "}", "i...
Gets the auto-completion candidates from the given code string, as if a user has pressed the tab key just after the code in IDEs. Depending on the language of the compute session, this feature may not be supported. Unsupported sessions returns an empty list. :param code: An (i...
[ "Gets", "the", "auto", "-", "completion", "candidates", "from", "the", "given", "code", "string", "as", "if", "a", "user", "has", "pressed", "the", "tab", "key", "just", "after", "the", "code", "in", "IDEs", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17r_2_00/routing_system/interface/ve/ipv6/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_2_00/routing_system/interface/ve/ipv6/__init__.py#L559-L580
def _set_vrrpv3e(self, v, load=False): """ Setter method for vrrpv3e, mapped from YANG variable /routing_system/interface/ve/ipv6/vrrpv3e (list) If this variable is read-only (config: false) in the source YANG file, then _set_vrrpv3e is considered as a private method. Backends looking to populate th...
[ "def", "_set_vrrpv3e", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base",...
Setter method for vrrpv3e, mapped from YANG variable /routing_system/interface/ve/ipv6/vrrpv3e (list) If this variable is read-only (config: false) in the source YANG file, then _set_vrrpv3e is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._s...
[ "Setter", "method", "for", "vrrpv3e", "mapped", "from", "YANG", "variable", "/", "routing_system", "/", "interface", "/", "ve", "/", "ipv6", "/", "vrrpv3e", "(", "list", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false...
python
train
cons3rt/pycons3rt
pycons3rt/bash.py
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/bash.py#L677-L719
def get_ip(interface=0): """This method return the IP address :param interface: (int) Interface number (e.g. 0 for eth0) :return: (str) IP address or None """ log = logging.getLogger(mod_logger + '.get_ip') log.info('Getting the IP address for this system...') ip_address = None try: ...
[ "def", "get_ip", "(", "interface", "=", "0", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.get_ip'", ")", "log", ".", "info", "(", "'Getting the IP address for this system...'", ")", "ip_address", "=", "None", "try", ":", "log...
This method return the IP address :param interface: (int) Interface number (e.g. 0 for eth0) :return: (str) IP address or None
[ "This", "method", "return", "the", "IP", "address" ]
python
train
buguroo/pyknow
pyknow/matchers/rete/abstract.py
https://github.com/buguroo/pyknow/blob/48818336f2e9a126f1964f2d8dc22d37ff800fe8/pyknow/matchers/rete/abstract.py#L57-L61
def activate_left(self, token): """Make a copy of the received token and call `_activate_left`.""" watchers.MATCHER.debug( "Node <%s> activated left with token %r", self, token) return self._activate_left(token.copy())
[ "def", "activate_left", "(", "self", ",", "token", ")", ":", "watchers", ".", "MATCHER", ".", "debug", "(", "\"Node <%s> activated left with token %r\"", ",", "self", ",", "token", ")", "return", "self", ".", "_activate_left", "(", "token", ".", "copy", "(", ...
Make a copy of the received token and call `_activate_left`.
[ "Make", "a", "copy", "of", "the", "received", "token", "and", "call", "_activate_left", "." ]
python
train
praekelt/jmbo-poll
poll/models.py
https://github.com/praekelt/jmbo-poll/blob/322cd398372139e9db74a37cb2ce8ab1c2ef17fd/poll/models.py#L30-L54
def can_vote_on_poll(self, request): """Based on jmbo.models.can_vote.""" # can't vote if liking is closed if self.votes_closed: return False, 'closed' # can't vote if liking is disabled if not self.votes_enabled: return False, 'disabled' # anon...
[ "def", "can_vote_on_poll", "(", "self", ",", "request", ")", ":", "# can't vote if liking is closed", "if", "self", ".", "votes_closed", ":", "return", "False", ",", "'closed'", "# can't vote if liking is disabled", "if", "not", "self", ".", "votes_enabled", ":", "r...
Based on jmbo.models.can_vote.
[ "Based", "on", "jmbo", ".", "models", ".", "can_vote", "." ]
python
train
rigetti/quantumflow
quantumflow/forest/__init__.py
https://github.com/rigetti/quantumflow/blob/13a66cabbe8aabf6e023cc675f4a4ebe6ccda8fb/quantumflow/forest/__init__.py#L160-L168
def pyquil_to_image(program: pyquil.Program) -> PIL.Image: # pragma: no cover """Returns an image of a pyquil circuit. See circuit_to_latex() for more details. """ circ = pyquil_to_circuit(program) latex = circuit_to_latex(circ) img = render_latex(latex) return img
[ "def", "pyquil_to_image", "(", "program", ":", "pyquil", ".", "Program", ")", "->", "PIL", ".", "Image", ":", "# pragma: no cover", "circ", "=", "pyquil_to_circuit", "(", "program", ")", "latex", "=", "circuit_to_latex", "(", "circ", ")", "img", "=", "render...
Returns an image of a pyquil circuit. See circuit_to_latex() for more details.
[ "Returns", "an", "image", "of", "a", "pyquil", "circuit", "." ]
python
train
SpockBotMC/SpockBot
spockbot/mcp/yggdrasil.py
https://github.com/SpockBotMC/SpockBot/blob/f89911551f18357720034fbaa52837a0d09f66ea/spockbot/mcp/yggdrasil.py#L50-L76
def authenticate(self): """ Generate an access token using an username and password. Any existing client token is invalidated if not provided. Returns: dict: Response or error dict """ endpoint = '/authenticate' payload = { 'agent': { ...
[ "def", "authenticate", "(", "self", ")", ":", "endpoint", "=", "'/authenticate'", "payload", "=", "{", "'agent'", ":", "{", "'name'", ":", "'Minecraft'", ",", "'version'", ":", "self", ".", "ygg_version", ",", "}", ",", "'username'", ":", "self", ".", "u...
Generate an access token using an username and password. Any existing client token is invalidated if not provided. Returns: dict: Response or error dict
[ "Generate", "an", "access", "token", "using", "an", "username", "and", "password", ".", "Any", "existing", "client", "token", "is", "invalidated", "if", "not", "provided", "." ]
python
train
JoeVirtual/KonFoo
konfoo/core.py
https://github.com/JoeVirtual/KonFoo/blob/0c62ef5c2bed4deaf908b34082e4de2544532fdc/konfoo/core.py#L1274-L1313
def view_fields(self, *attributes, **options): """ Returns a list with the selected field *attribute* or a list with the dictionaries of the selected field *attributes* for each :class:`Field` *nested* in the `Sequence`. The *attributes* of each :class:`Field` for containers *nested* in...
[ "def", "view_fields", "(", "self", ",", "*", "attributes", ",", "*", "*", "options", ")", ":", "items", "=", "list", "(", ")", "for", "index", ",", "item", "in", "enumerate", "(", "self", ")", ":", "if", "is_container", "(", "item", ")", ":", "# Co...
Returns a list with the selected field *attribute* or a list with the dictionaries of the selected field *attributes* for each :class:`Field` *nested* in the `Sequence`. The *attributes* of each :class:`Field` for containers *nested* in the `Sequence` are viewed as well (chained method ...
[ "Returns", "a", "list", "with", "the", "selected", "field", "*", "attribute", "*", "or", "a", "list", "with", "the", "dictionaries", "of", "the", "selected", "field", "*", "attributes", "*", "for", "each", ":", "class", ":", "Field", "*", "nested", "*", ...
python
train
openstack/proliantutils
proliantutils/redfish/resources/system/smart_storage_config.py
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/smart_storage_config.py#L119-L136
def delete_raid(self): """Clears the RAID configuration from the system. """ if not self.logical_drives: msg = ('No logical drives found on the controller ' '%(controller)s' % {'controller': str(self.controller_id)}) LOG.debug(msg) raise ex...
[ "def", "delete_raid", "(", "self", ")", ":", "if", "not", "self", ".", "logical_drives", ":", "msg", "=", "(", "'No logical drives found on the controller '", "'%(controller)s'", "%", "{", "'controller'", ":", "str", "(", "self", ".", "controller_id", ")", "}", ...
Clears the RAID configuration from the system.
[ "Clears", "the", "RAID", "configuration", "from", "the", "system", "." ]
python
train
chrisrink10/basilisp
src/basilisp/lang/runtime.py
https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/lang/runtime.py#L920-L931
def deref(o, timeout_s=None, timeout_val=None): """Dereference a Deref object and return its contents. If o is an object implementing IBlockingDeref and timeout_s and timeout_val are supplied, deref will wait at most timeout_s seconds, returning timeout_val if timeout_s seconds elapse and o has not ...
[ "def", "deref", "(", "o", ",", "timeout_s", "=", "None", ",", "timeout_val", "=", "None", ")", ":", "if", "isinstance", "(", "o", ",", "IDeref", ")", ":", "return", "o", ".", "deref", "(", ")", "elif", "isinstance", "(", "o", ",", "IBlockingDeref", ...
Dereference a Deref object and return its contents. If o is an object implementing IBlockingDeref and timeout_s and timeout_val are supplied, deref will wait at most timeout_s seconds, returning timeout_val if timeout_s seconds elapse and o has not returned.
[ "Dereference", "a", "Deref", "object", "and", "return", "its", "contents", "." ]
python
test
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L136-L164
def face_and_energy_detector(image_path, detect_faces=True): """ Finds faces and energy in an image """ source = Image.open(image_path) work_width = 800 if source.mode != 'RGB' or source.bits != 8: source24 = source.convert('RGB') else: source24 = source.copy() grayscale...
[ "def", "face_and_energy_detector", "(", "image_path", ",", "detect_faces", "=", "True", ")", ":", "source", "=", "Image", ".", "open", "(", "image_path", ")", "work_width", "=", "800", "if", "source", ".", "mode", "!=", "'RGB'", "or", "source", ".", "bits"...
Finds faces and energy in an image
[ "Finds", "faces", "and", "energy", "in", "an", "image" ]
python
train
suryakencana007/baka_model
baka_model/model/helper.py
https://github.com/suryakencana007/baka_model/blob/915c2da9920e973302f5764ae63799acd5ecf0b7/baka_model/model/helper.py#L42-L54
def guid(*args): """ Generates a universally unique ID. Any arguments only create more randomness. """ t = float(time.time() * 1000) r = float(random.random()*10000000000000) a = random.random() * 10000000000000 data = str(t) + ' ' + str(r) + ' ' + str(a) + ' ' + str(args) data = ha...
[ "def", "guid", "(", "*", "args", ")", ":", "t", "=", "float", "(", "time", ".", "time", "(", ")", "*", "1000", ")", "r", "=", "float", "(", "random", ".", "random", "(", ")", "*", "10000000000000", ")", "a", "=", "random", ".", "random", "(", ...
Generates a universally unique ID. Any arguments only create more randomness.
[ "Generates", "a", "universally", "unique", "ID", ".", "Any", "arguments", "only", "create", "more", "randomness", "." ]
python
valid
Knio/pynmea2
pynmea2/nmea_utils.py
https://github.com/Knio/pynmea2/blob/c4fc66c6a13dd85ad862b15c516245af6e571456/pynmea2/nmea_utils.py#L29-L39
def dm_to_sd(dm): ''' Converts a geographic co-ordinate given in "degrees/minutes" dddmm.mmmm format (eg, "12319.943281" = 123 degrees, 19.943281 minutes) to a signed decimal (python float) format ''' # '12319.943281' if not dm or dm == '0': return 0. d, m = re.match(r'^...
[ "def", "dm_to_sd", "(", "dm", ")", ":", "# '12319.943281'\r", "if", "not", "dm", "or", "dm", "==", "'0'", ":", "return", "0.", "d", ",", "m", "=", "re", ".", "match", "(", "r'^(\\d+)(\\d\\d\\.\\d+)$'", ",", "dm", ")", ".", "groups", "(", ")", "return...
Converts a geographic co-ordinate given in "degrees/minutes" dddmm.mmmm format (eg, "12319.943281" = 123 degrees, 19.943281 minutes) to a signed decimal (python float) format
[ "Converts", "a", "geographic", "co", "-", "ordinate", "given", "in", "degrees", "/", "minutes", "dddmm", ".", "mmmm", "format", "(", "eg", "12319", ".", "943281", "=", "123", "degrees", "19", ".", "943281", "minutes", ")", "to", "a", "signed", "decimal",...
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L1955-L1965
def do_dd(self, arg): """ [~thread] dd <register> - show memory contents as dwords [~thread] dd <register-register> - show memory contents as dwords [~thread] dd <register> <size> - show memory contents as dwords [~process] dd <address> - show memory contents as dwords [~...
[ "def", "do_dd", "(", "self", ",", "arg", ")", ":", "self", ".", "print_memory_display", "(", "arg", ",", "HexDump", ".", "hexblock_dword", ")", "self", ".", "last_display_command", "=", "self", ".", "do_dd" ]
[~thread] dd <register> - show memory contents as dwords [~thread] dd <register-register> - show memory contents as dwords [~thread] dd <register> <size> - show memory contents as dwords [~process] dd <address> - show memory contents as dwords [~process] dd <address-address> - show memor...
[ "[", "~thread", "]", "dd", "<register", ">", "-", "show", "memory", "contents", "as", "dwords", "[", "~thread", "]", "dd", "<register", "-", "register", ">", "-", "show", "memory", "contents", "as", "dwords", "[", "~thread", "]", "dd", "<register", ">", ...
python
train
pkgw/pwkit
pwkit/fk10.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L173-L229
def do_figure9_calc_lowlevel(shlib_path, set_unused=True): """Reproduce the calculation used to produce Figure 9 of the Fleischman & Kuznetsov (2010) paper, using our low-level interfaces. Input parameters, etc., come from the file ``Flare071231a.pro`` that is distributed with the paper’s Supplementary...
[ "def", "do_figure9_calc_lowlevel", "(", "shlib_path", ",", "set_unused", "=", "True", ")", ":", "fk10func", "=", "FK10Invoker", "(", "shlib_path", ")", "in_vals", "=", "make_in_vals_array", "(", ")", "in_vals", "[", "IN_VAL_AREA", "]", "=", "1.33e18", "in_vals",...
Reproduce the calculation used to produce Figure 9 of the Fleischman & Kuznetsov (2010) paper, using our low-level interfaces. Input parameters, etc., come from the file ``Flare071231a.pro`` that is distributed with the paper’s Supplementary Data archive. Invoke with something like:: from pwkit...
[ "Reproduce", "the", "calculation", "used", "to", "produce", "Figure", "9", "of", "the", "Fleischman", "&", "Kuznetsov", "(", "2010", ")", "paper", "using", "our", "low", "-", "level", "interfaces", "." ]
python
train
VingtCinq/python-mailchimp
mailchimp3/entities/listwebhooks.py
https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/listwebhooks.py#L97-L108
def delete(self, list_id, webhook_id): """ Delete a specific webhook in a list. :param list_id: The unique id for the list. :type list_id: :py:class:`str` :param webhook_id: The unique id for the webhook. :type webhook_id: :py:class:`str` """ self.list_id...
[ "def", "delete", "(", "self", ",", "list_id", ",", "webhook_id", ")", ":", "self", ".", "list_id", "=", "list_id", "self", ".", "webhook_id", "=", "webhook_id", "return", "self", ".", "_mc_client", ".", "_delete", "(", "url", "=", "self", ".", "_build_pa...
Delete a specific webhook in a list. :param list_id: The unique id for the list. :type list_id: :py:class:`str` :param webhook_id: The unique id for the webhook. :type webhook_id: :py:class:`str`
[ "Delete", "a", "specific", "webhook", "in", "a", "list", "." ]
python
valid
royi1000/py-libhdate
hdate/converters.py
https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/converters.py#L125-L149
def jdn_to_gdate(jdn): """ Convert from the Julian day to the Gregorian day. Algorithm from 'Julian and Gregorian Day Numbers' by Peter Meyer. Return: day, month, year """ # pylint: disable=invalid-name # The algorithm is a verbatim copy from Peter Meyer's article # No explanation in t...
[ "def", "jdn_to_gdate", "(", "jdn", ")", ":", "# pylint: disable=invalid-name", "# The algorithm is a verbatim copy from Peter Meyer's article", "# No explanation in the article is given for the variables", "# Hence the exceptions for pylint and for flake8 (E741)", "l", "=", "jdn", "+", "...
Convert from the Julian day to the Gregorian day. Algorithm from 'Julian and Gregorian Day Numbers' by Peter Meyer. Return: day, month, year
[ "Convert", "from", "the", "Julian", "day", "to", "the", "Gregorian", "day", "." ]
python
train
ioos/compliance-checker
compliance_checker/ioos.py
https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/ioos.py#L288-L309
def check_platform_variable_attributes(self, ds): ''' Platform variables must contain the following attributes: ioos_code long_name short_name type :param netCDF4.Dataset ds: An open netCDF dataset ''' results = [] platform...
[ "def", "check_platform_variable_attributes", "(", "self", ",", "ds", ")", ":", "results", "=", "[", "]", "platform_name", "=", "getattr", "(", "ds", ",", "'platform'", ",", "''", ")", "# There can be multiple platforms defined here (space separated)", "for", "platform...
Platform variables must contain the following attributes: ioos_code long_name short_name type :param netCDF4.Dataset ds: An open netCDF dataset
[ "Platform", "variables", "must", "contain", "the", "following", "attributes", ":", "ioos_code", "long_name", "short_name", "type" ]
python
train
ARMmbed/icetea
icetea_lib/LogManager.py
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L699-L733
def filter(self, record): """ Filter record :param record: Record to filter :return: """ def modify(value): """ Modify logged record, truncating it to max length and logging remaining length :param value: Record to modify :...
[ "def", "filter", "(", "self", ",", "record", ")", ":", "def", "modify", "(", "value", ")", ":", "\"\"\"\n Modify logged record, truncating it to max length and logging remaining length\n :param value: Record to modify\n :return:\n \"\"\"", "i...
Filter record :param record: Record to filter :return:
[ "Filter", "record", ":", "param", "record", ":", "Record", "to", "filter", ":", "return", ":" ]
python
train
dswah/pyGAM
pygam/terms.py
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/terms.py#L333-L379
def build_constraints(self, coef, constraint_lam, constraint_l2): """ builds the GAM block-diagonal constraint matrix in quadratic form out of constraint matrices specified for each feature. behaves like a penalty, but with a very large lambda value, ie 1e6. Parameters ...
[ "def", "build_constraints", "(", "self", ",", "coef", ",", "constraint_lam", ",", "constraint_l2", ")", ":", "if", "self", ".", "isintercept", ":", "return", "np", ".", "array", "(", "[", "[", "0.", "]", "]", ")", "Cs", "=", "[", "]", "for", "constra...
builds the GAM block-diagonal constraint matrix in quadratic form out of constraint matrices specified for each feature. behaves like a penalty, but with a very large lambda value, ie 1e6. Parameters --------- coefs : array-like containing the coefficients of a term co...
[ "builds", "the", "GAM", "block", "-", "diagonal", "constraint", "matrix", "in", "quadratic", "form", "out", "of", "constraint", "matrices", "specified", "for", "each", "feature", "." ]
python
train
Azure/azure-sdk-for-python
azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicemanagementservice.py#L1090-L1110
def update_affinity_group(self, affinity_group_name, label, description=None): ''' Updates the label and/or the description for an affinity group for the specified subscription. affinity_group_name: The name of the affinity group. label:...
[ "def", "update_affinity_group", "(", "self", ",", "affinity_group_name", ",", "label", ",", "description", "=", "None", ")", ":", "_validate_not_none", "(", "'affinity_group_name'", ",", "affinity_group_name", ")", "_validate_not_none", "(", "'label'", ",", "label", ...
Updates the label and/or the description for an affinity group for the specified subscription. affinity_group_name: The name of the affinity group. label: A name for the affinity group. The name can be up to 100 characters in length. description: ...
[ "Updates", "the", "label", "and", "/", "or", "the", "description", "for", "an", "affinity", "group", "for", "the", "specified", "subscription", "." ]
python
test
apache/incubator-mxnet
python/mxnet/contrib/text/embedding.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/contrib/text/embedding.py#L63-L87
def create(embedding_name, **kwargs): """Creates an instance of token embedding. Creates a token embedding instance by loading embedding vectors from an externally hosted pre-trained token embedding file, such as those of GloVe and FastText. To get all the valid `embedding_name` and `pretrained_file_n...
[ "def", "create", "(", "embedding_name", ",", "*", "*", "kwargs", ")", ":", "create_text_embedding", "=", "registry", ".", "get_create_func", "(", "_TokenEmbedding", ",", "'token embedding'", ")", "return", "create_text_embedding", "(", "embedding_name", ",", "*", ...
Creates an instance of token embedding. Creates a token embedding instance by loading embedding vectors from an externally hosted pre-trained token embedding file, such as those of GloVe and FastText. To get all the valid `embedding_name` and `pretrained_file_name`, use `mxnet.contrib.text.embedding.g...
[ "Creates", "an", "instance", "of", "token", "embedding", "." ]
python
train
bwohlberg/sporco
sporco/dictlrn/prlcnscdl.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/dictlrn/prlcnscdl.py#L588-L592
def getcoef(self): """Get final coefficient map array.""" global mp_Z_Y return np.swapaxes(mp_Z_Y, 0, self.xstep.cri.axisK+1)[0]
[ "def", "getcoef", "(", "self", ")", ":", "global", "mp_Z_Y", "return", "np", ".", "swapaxes", "(", "mp_Z_Y", ",", "0", ",", "self", ".", "xstep", ".", "cri", ".", "axisK", "+", "1", ")", "[", "0", "]" ]
Get final coefficient map array.
[ "Get", "final", "coefficient", "map", "array", "." ]
python
train
HPAC/matchpy
matchpy/matching/many_to_one.py
https://github.com/HPAC/matchpy/blob/06b2ec50ee0efdf3dd183768c0ffdb51b7efc393/matchpy/matching/many_to_one.py#L434-L443
def match(self, subject: Expression) -> Iterator[Tuple[Expression, Substitution]]: """Match the subject against all the matcher's patterns. Args: subject: The subject to match. Yields: For every match, a tuple of the matching pattern and the match substitution. ...
[ "def", "match", "(", "self", ",", "subject", ":", "Expression", ")", "->", "Iterator", "[", "Tuple", "[", "Expression", ",", "Substitution", "]", "]", ":", "return", "_MatchIter", "(", "self", ",", "subject", ")" ]
Match the subject against all the matcher's patterns. Args: subject: The subject to match. Yields: For every match, a tuple of the matching pattern and the match substitution.
[ "Match", "the", "subject", "against", "all", "the", "matcher", "s", "patterns", "." ]
python
train
pixelogik/NearPy
nearpy/storage/storage_redis.py
https://github.com/pixelogik/NearPy/blob/1b534b864d320d875508e95cd2b76b6d8c07a90b/nearpy/storage/storage_redis.py#L205-L211
def load_hash_configuration(self, hash_name): """ Loads and returns hash configuration """ conf = self.redis_object.get(hash_name+'_conf') return pickle.loads(conf) if conf is not None else None
[ "def", "load_hash_configuration", "(", "self", ",", "hash_name", ")", ":", "conf", "=", "self", ".", "redis_object", ".", "get", "(", "hash_name", "+", "'_conf'", ")", "return", "pickle", ".", "loads", "(", "conf", ")", "if", "conf", "is", "not", "None",...
Loads and returns hash configuration
[ "Loads", "and", "returns", "hash", "configuration" ]
python
train
welbornprod/colr
colr/controls.py
https://github.com/welbornprod/colr/blob/417117fdbddbc53142096685ac2af006b2bd0220/colr/controls.py#L109-L125
def erase_line(method=EraseMethod.ALL, file=sys.stdout): """ Erase a line, or part of a line. See `method` argument below. Cursor position does not change. Esc[<method>K Arguments: method : One of these possible values: EraseMethod.END or 0: ...
[ "def", "erase_line", "(", "method", "=", "EraseMethod", ".", "ALL", ",", "file", "=", "sys", ".", "stdout", ")", ":", "erase", ".", "line", "(", "method", ")", ".", "write", "(", "file", "=", "file", ")" ]
Erase a line, or part of a line. See `method` argument below. Cursor position does not change. Esc[<method>K Arguments: method : One of these possible values: EraseMethod.END or 0: Clear from cursor to the end of the line. ...
[ "Erase", "a", "line", "or", "part", "of", "a", "line", ".", "See", "method", "argument", "below", ".", "Cursor", "position", "does", "not", "change", "." ]
python
train
coghost/izen
izen/prettify.py
https://github.com/coghost/izen/blob/432db017f99dd2ba809e1ba1792145ab6510263d/izen/prettify.py#L93-L102
def log_random_sleep(self, minimum=3.0, scale=1.0, hints=None): """wrap random sleep. - log it for debug purpose only """ hints = '{} slept'.format(hints) if hints else 'slept' st = time.time() helper.random_sleep(minimum, scale) log.debug('{} {} {}s'.format( ...
[ "def", "log_random_sleep", "(", "self", ",", "minimum", "=", "3.0", ",", "scale", "=", "1.0", ",", "hints", "=", "None", ")", ":", "hints", "=", "'{} slept'", ".", "format", "(", "hints", ")", "if", "hints", "else", "'slept'", "st", "=", "time", ".",...
wrap random sleep. - log it for debug purpose only
[ "wrap", "random", "sleep", "." ]
python
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/config.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/config.py#L321-L340
def save_config(**kwargs): """Save configuration keys to vispy config file Parameters ---------- **kwargs : keyword arguments Key/value pairs to save to the config file. """ if kwargs == {}: kwargs = config._config current_config = _load_config() current_config.update(**...
[ "def", "save_config", "(", "*", "*", "kwargs", ")", ":", "if", "kwargs", "==", "{", "}", ":", "kwargs", "=", "config", ".", "_config", "current_config", "=", "_load_config", "(", ")", "current_config", ".", "update", "(", "*", "*", "kwargs", ")", "# wr...
Save configuration keys to vispy config file Parameters ---------- **kwargs : keyword arguments Key/value pairs to save to the config file.
[ "Save", "configuration", "keys", "to", "vispy", "config", "file" ]
python
train
pudo/jsongraph
jsongraph/graph.py
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/graph.py#L104-L111
def get_uri(self, alias): """ Get the URI for a given alias. A registered URI will return itself, otherwise ``None`` is returned. """ if alias in self.aliases.keys(): return self.aliases[alias] if alias in self.aliases.values(): return alias raise GraphExc...
[ "def", "get_uri", "(", "self", ",", "alias", ")", ":", "if", "alias", "in", "self", ".", "aliases", ".", "keys", "(", ")", ":", "return", "self", ".", "aliases", "[", "alias", "]", "if", "alias", "in", "self", ".", "aliases", ".", "values", "(", ...
Get the URI for a given alias. A registered URI will return itself, otherwise ``None`` is returned.
[ "Get", "the", "URI", "for", "a", "given", "alias", ".", "A", "registered", "URI", "will", "return", "itself", "otherwise", "None", "is", "returned", "." ]
python
train
saltstack/salt
salt/utils/openstack/nova.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L1192-L1202
def virtual_interface_create(self, name, net_name): ''' Add an interfaces to a slice ''' nt_ks = self.compute_conn serverid = self._server_uuid_from_name(name) networkid = self.network_show(net_name).get('id', None) if networkid is None: return {net_na...
[ "def", "virtual_interface_create", "(", "self", ",", "name", ",", "net_name", ")", ":", "nt_ks", "=", "self", ".", "compute_conn", "serverid", "=", "self", ".", "_server_uuid_from_name", "(", "name", ")", "networkid", "=", "self", ".", "network_show", "(", "...
Add an interfaces to a slice
[ "Add", "an", "interfaces", "to", "a", "slice" ]
python
train
pmacosta/peng
docs/support/ptypes.py
https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/ptypes.py#L248-L273
def touchstone_options(obj): r""" Validate if an object is an :ref:`TouchstoneOptions` pseudo-type object. :param obj: Object :type obj: any :raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The token \*[argument_name]\* is replaced by the name of the argument the con...
[ "def", "touchstone_options", "(", "obj", ")", ":", "if", "(", "not", "isinstance", "(", "obj", ",", "dict", ")", ")", "or", "(", "isinstance", "(", "obj", ",", "dict", ")", "and", "(", "sorted", "(", "obj", ".", "keys", "(", ")", ")", "!=", "sort...
r""" Validate if an object is an :ref:`TouchstoneOptions` pseudo-type object. :param obj: Object :type obj: any :raises: RuntimeError (Argument \`*[argument_name]*\` is not valid). The token \*[argument_name]\* is replaced by the name of the argument the contract is attached to :rtype:...
[ "r", "Validate", "if", "an", "object", "is", "an", ":", "ref", ":", "TouchstoneOptions", "pseudo", "-", "type", "object", "." ]
python
test
crunchyroll/ef-open
efopen/ef_aws_resolver.py
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L686-L694
def kms_decrypt_value(self, lookup): """ Args: lookup: the encrypted value to be decrypted by KMS; base64 encoded Returns: The decrypted lookup value """ decrypted_lookup = ef_utils.kms_decrypt(EFAwsResolver.__CLIENTS["kms"], lookup) return decrypted_lookup
[ "def", "kms_decrypt_value", "(", "self", ",", "lookup", ")", ":", "decrypted_lookup", "=", "ef_utils", ".", "kms_decrypt", "(", "EFAwsResolver", ".", "__CLIENTS", "[", "\"kms\"", "]", ",", "lookup", ")", "return", "decrypted_lookup" ]
Args: lookup: the encrypted value to be decrypted by KMS; base64 encoded Returns: The decrypted lookup value
[ "Args", ":", "lookup", ":", "the", "encrypted", "value", "to", "be", "decrypted", "by", "KMS", ";", "base64", "encoded", "Returns", ":", "The", "decrypted", "lookup", "value" ]
python
train
Yubico/python-yubico
yubico/yubikey_neo_usb_hid.py
https://github.com/Yubico/python-yubico/blob/a72e8eddb90da6ee96e29f60912ca1f2872c9aea/yubico/yubikey_neo_usb_hid.py#L345-L350
def to_frame(self, slot=SLOT.SCAN_MAP): """ Return the current configuration as a YubiKeyFrame object. """ payload = self.scanmap.ljust(64, b'\0') return yubikey_frame.YubiKeyFrame(command=slot, payload=payload)
[ "def", "to_frame", "(", "self", ",", "slot", "=", "SLOT", ".", "SCAN_MAP", ")", ":", "payload", "=", "self", ".", "scanmap", ".", "ljust", "(", "64", ",", "b'\\0'", ")", "return", "yubikey_frame", ".", "YubiKeyFrame", "(", "command", "=", "slot", ",", ...
Return the current configuration as a YubiKeyFrame object.
[ "Return", "the", "current", "configuration", "as", "a", "YubiKeyFrame", "object", "." ]
python
train
ihgazni2/elist
elist/elist.py
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L1349-L1367
def uniform_index(index,length): ''' uniform_index(0,3) uniform_index(-1,3) uniform_index(-4,3) uniform_index(-3,3) uniform_index(5,3) ''' if(index<0): rl = length+index if(rl<0): index = 0 else: index = rl elif(inde...
[ "def", "uniform_index", "(", "index", ",", "length", ")", ":", "if", "(", "index", "<", "0", ")", ":", "rl", "=", "length", "+", "index", "if", "(", "rl", "<", "0", ")", ":", "index", "=", "0", "else", ":", "index", "=", "rl", "elif", "(", "i...
uniform_index(0,3) uniform_index(-1,3) uniform_index(-4,3) uniform_index(-3,3) uniform_index(5,3)
[ "uniform_index", "(", "0", "3", ")", "uniform_index", "(", "-", "1", "3", ")", "uniform_index", "(", "-", "4", "3", ")", "uniform_index", "(", "-", "3", "3", ")", "uniform_index", "(", "5", "3", ")" ]
python
valid
rsgalloway/grit
grit/server/cherrypy/__init__.py
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/server/cherrypy/__init__.py#L747-L768
def respond(self): """Call the gateway and write its iterable output.""" mrbs = self.server.max_request_body_size if self.chunked_read: self.rfile = ChunkedRFile(self.conn.rfile, mrbs) else: cl = int(self.inheaders.get("Content-Length", 0)) if mrbs and...
[ "def", "respond", "(", "self", ")", ":", "mrbs", "=", "self", ".", "server", ".", "max_request_body_size", "if", "self", ".", "chunked_read", ":", "self", ".", "rfile", "=", "ChunkedRFile", "(", "self", ".", "conn", ".", "rfile", ",", "mrbs", ")", "els...
Call the gateway and write its iterable output.
[ "Call", "the", "gateway", "and", "write", "its", "iterable", "output", "." ]
python
train
drdoctr/doctr
doctr/travis.py
https://github.com/drdoctr/doctr/blob/0f19ff78c8239efcc98d417f36b0a31d9be01ba5/doctr/travis.py#L383-L400
def copy_to_tmp(source): """ Copies ``source`` to a temporary directory, and returns the copied location. If source is a file, the copied location is also a file. """ tmp_dir = tempfile.mkdtemp() # Use pathlib because os.path.basename is different depending on whether # the path ends in...
[ "def", "copy_to_tmp", "(", "source", ")", ":", "tmp_dir", "=", "tempfile", ".", "mkdtemp", "(", ")", "# Use pathlib because os.path.basename is different depending on whether", "# the path ends in a /", "p", "=", "pathlib", ".", "Path", "(", "source", ")", "dirname", ...
Copies ``source`` to a temporary directory, and returns the copied location. If source is a file, the copied location is also a file.
[ "Copies", "source", "to", "a", "temporary", "directory", "and", "returns", "the", "copied", "location", "." ]
python
train
LonamiWebs/Telethon
telethon/tl/custom/message.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L206-L253
def _finish_init(self, client, entities, input_chat): """ Finishes the initialization of this message by setting the client that sent the message and making use of the known entities. """ self._client = client self._sender = entities.get(self._sender_id) i...
[ "def", "_finish_init", "(", "self", ",", "client", ",", "entities", ",", "input_chat", ")", ":", "self", ".", "_client", "=", "client", "self", ".", "_sender", "=", "entities", ".", "get", "(", "self", ".", "_sender_id", ")", "if", "self", ".", "_sende...
Finishes the initialization of this message by setting the client that sent the message and making use of the known entities.
[ "Finishes", "the", "initialization", "of", "this", "message", "by", "setting", "the", "client", "that", "sent", "the", "message", "and", "making", "use", "of", "the", "known", "entities", "." ]
python
train
evhub/coconut
coconut/command/command.py
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/command/command.py#L288-L303
def compile_path(self, path, write=True, package=None, *args, **kwargs): """Compile a path and returns paths to compiled files.""" path = fixpath(path) if not isinstance(write, bool): write = fixpath(write) if os.path.isfile(path): if package is None: ...
[ "def", "compile_path", "(", "self", ",", "path", ",", "write", "=", "True", ",", "package", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "fixpath", "(", "path", ")", "if", "not", "isinstance", "(", "write", ",", ...
Compile a path and returns paths to compiled files.
[ "Compile", "a", "path", "and", "returns", "paths", "to", "compiled", "files", "." ]
python
train
tensorflow/cleverhans
cleverhans/devtools/list_files.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/devtools/list_files.py#L41-L71
def _list_files(path, suffix=""): """ Returns a list of all files ending in `suffix` contained within `path`. Parameters ---------- path : str a filepath suffix : str Returns ------- l : list A list of all files ending in `suffix` contained within `path`. (If `path` is a file rathe...
[ "def", "_list_files", "(", "path", ",", "suffix", "=", "\"\"", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "incomplete", "=", "os", ".", "listdir", "(", "path", ")", "complete", "=", "[", "os", ".", "path", ".", "join"...
Returns a list of all files ending in `suffix` contained within `path`. Parameters ---------- path : str a filepath suffix : str Returns ------- l : list A list of all files ending in `suffix` contained within `path`. (If `path` is a file rather than a directory, it is considered ...
[ "Returns", "a", "list", "of", "all", "files", "ending", "in", "suffix", "contained", "within", "path", "." ]
python
train
pvlib/pvlib-python
pvlib/modelchain.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/modelchain.py#L478-L494
def singlediode(self): """Deprecated""" (photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth) = ( self.system.calcparams_desoto(self.effective_irradiance, self.temps['temp_cell'])) self.desoto = (photocurre...
[ "def", "singlediode", "(", "self", ")", ":", "(", "photocurrent", ",", "saturation_current", ",", "resistance_series", ",", "resistance_shunt", ",", "nNsVth", ")", "=", "(", "self", ".", "system", ".", "calcparams_desoto", "(", "self", ".", "effective_irradiance...
Deprecated
[ "Deprecated" ]
python
train
biocore/burrito-fillings
bfillings/blat.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/blat.py#L185-L282
def _input_as_list(self, data): '''Takes the positional arguments as input in a list. The list input here should be [query_file_path, database_file_path, output_file_path]''' query, database, output = data if (not isabs(database)) \ or (not isabs(query)) \ ...
[ "def", "_input_as_list", "(", "self", ",", "data", ")", ":", "query", ",", "database", ",", "output", "=", "data", "if", "(", "not", "isabs", "(", "database", ")", ")", "or", "(", "not", "isabs", "(", "query", ")", ")", "or", "(", "not", "isabs", ...
Takes the positional arguments as input in a list. The list input here should be [query_file_path, database_file_path, output_file_path]
[ "Takes", "the", "positional", "arguments", "as", "input", "in", "a", "list", "." ]
python
train
yyuu/botornado
boto/s3/bucket.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/s3/bucket.py#L360-L397
def get_all_versions(self, headers=None, **params): """ A lower-level, version-aware method for listing contents of a bucket. This closely models the actual S3 API and requires you to manually handle the paging of results. For a higher-level method that handles the details of pa...
[ "def", "get_all_versions", "(", "self", ",", "headers", "=", "None", ",", "*", "*", "params", ")", ":", "return", "self", ".", "_get_all", "(", "[", "(", "'Version'", ",", "self", ".", "key_class", ")", ",", "(", "'CommonPrefixes'", ",", "Prefix", ")",...
A lower-level, version-aware method for listing contents of a bucket. This closely models the actual S3 API and requires you to manually handle the paging of results. For a higher-level method that handles the details of paging for you, you can use the list method. :type max_ke...
[ "A", "lower", "-", "level", "version", "-", "aware", "method", "for", "listing", "contents", "of", "a", "bucket", ".", "This", "closely", "models", "the", "actual", "S3", "API", "and", "requires", "you", "to", "manually", "handle", "the", "paging", "of", ...
python
train
vaexio/vaex
packages/vaex-core/vaex/dataframe.py
https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L4970-L5078
def join(self, other, on=None, left_on=None, right_on=None, lsuffix='', rsuffix='', how='left', inplace=False): """Return a DataFrame joined with other DataFrames, matched by columns/expression on/left_on/right_on If neither on/left_on/right_on is given, the join is done by simply adding the columns (i...
[ "def", "join", "(", "self", ",", "other", ",", "on", "=", "None", ",", "left_on", "=", "None", ",", "right_on", "=", "None", ",", "lsuffix", "=", "''", ",", "rsuffix", "=", "''", ",", "how", "=", "'left'", ",", "inplace", "=", "False", ")", ":", ...
Return a DataFrame joined with other DataFrames, matched by columns/expression on/left_on/right_on If neither on/left_on/right_on is given, the join is done by simply adding the columns (i.e. on the implicit row index). Note: The filters will be ignored when joining, the full DataFrame will be...
[ "Return", "a", "DataFrame", "joined", "with", "other", "DataFrames", "matched", "by", "columns", "/", "expression", "on", "/", "left_on", "/", "right_on" ]
python
test
gijzelaerr/python-snap7
snap7/server.py
https://github.com/gijzelaerr/python-snap7/blob/a6db134c7a3a2ef187b9eca04669221d6fc634c3/snap7/server.py#L72-L81
def register_area(self, area_code, index, userdata): """Shares a memory area with the server. That memory block will be visible by the clients. """ size = ctypes.sizeof(userdata) logger.info("registering area %s, index %s, size %s" % (area_code, ...
[ "def", "register_area", "(", "self", ",", "area_code", ",", "index", ",", "userdata", ")", ":", "size", "=", "ctypes", ".", "sizeof", "(", "userdata", ")", "logger", ".", "info", "(", "\"registering area %s, index %s, size %s\"", "%", "(", "area_code", ",", ...
Shares a memory area with the server. That memory block will be visible by the clients.
[ "Shares", "a", "memory", "area", "with", "the", "server", ".", "That", "memory", "block", "will", "be", "visible", "by", "the", "clients", "." ]
python
train
saltstack/salt
salt/modules/lxc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2632-L2674
def state(name, path=None): ''' Returns the state of a container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.state name ''' # Don't use _ensure_exists() here, it wi...
[ "def", "state", "(", "name", ",", "path", "=", "None", ")", ":", "# Don't use _ensure_exists() here, it will mess with _change_state()", "cachekey", "=", "'lxc.state.{0}{1}'", ".", "format", "(", "name", ",", "path", ")", "try", ":", "return", "__context__", "[", ...
Returns the state of a container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.state name
[ "Returns", "the", "state", "of", "a", "container", "." ]
python
train
kshlm/gant
gant/utils/ssh.py
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/ssh.py#L10-L20
def launch_shell(username, hostname, password, port=22): """ Launches an ssh shell """ if not username or not hostname or not password: return False with tempfile.NamedTemporaryFile() as tmpFile: os.system(sshCmdLine.format(password, tmpFile.name, username, hostname, ...
[ "def", "launch_shell", "(", "username", ",", "hostname", ",", "password", ",", "port", "=", "22", ")", ":", "if", "not", "username", "or", "not", "hostname", "or", "not", "password", ":", "return", "False", "with", "tempfile", ".", "NamedTemporaryFile", "(...
Launches an ssh shell
[ "Launches", "an", "ssh", "shell" ]
python
train
ladybug-tools/ladybug
ladybug/designday.py
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L457-L493
def from_ashrae_dict_cooling(cls, ashrae_dict, location, use_010=False, pressure=None, tau=None): """Create a heating design day object from a ASHRAE HOF dictionary. Args: ashrae_dict: A dictionary with 32 keys that match those in the cooling...
[ "def", "from_ashrae_dict_cooling", "(", "cls", ",", "ashrae_dict", ",", "location", ",", "use_010", "=", "False", ",", "pressure", "=", "None", ",", "tau", "=", "None", ")", ":", "db_key", "=", "'DB004'", "if", "use_010", "is", "False", "else", "'DB010'", ...
Create a heating design day object from a ASHRAE HOF dictionary. Args: ashrae_dict: A dictionary with 32 keys that match those in the cooling_keys property of this object. Each key should correspond to a value. location: Location object for the design day...
[ "Create", "a", "heating", "design", "day", "object", "from", "a", "ASHRAE", "HOF", "dictionary", "." ]
python
train
pavlin-policar/openTSNE
openTSNE/pynndescent/utils.py
https://github.com/pavlin-policar/openTSNE/blob/28513a0d669f2f20e7b971c0c6373dc375f72771/openTSNE/pynndescent/utils.py#L107-L134
def make_heap(n_points, size): """Constructor for the numba enabled heap objects. The heaps are used for approximate nearest neighbor search, maintaining a list of potential neighbors sorted by their distance. We also flag if potential neighbors are newly added to the list or not. Internally this is sto...
[ "def", "make_heap", "(", "n_points", ",", "size", ")", ":", "result", "=", "np", ".", "zeros", "(", "(", "3", ",", "n_points", ",", "size", ")", ")", "result", "[", "0", "]", "=", "-", "1", "result", "[", "1", "]", "=", "np", ".", "infty", "r...
Constructor for the numba enabled heap objects. The heaps are used for approximate nearest neighbor search, maintaining a list of potential neighbors sorted by their distance. We also flag if potential neighbors are newly added to the list or not. Internally this is stored as a single ndarray; the first...
[ "Constructor", "for", "the", "numba", "enabled", "heap", "objects", ".", "The", "heaps", "are", "used", "for", "approximate", "nearest", "neighbor", "search", "maintaining", "a", "list", "of", "potential", "neighbors", "sorted", "by", "their", "distance", ".", ...
python
train
da4089/simplefix
simplefix/message.py
https://github.com/da4089/simplefix/blob/10f7f165a99a03467110bee69cc7c083c3531c68/simplefix/message.py#L475-L489
def append_data(self, len_tag, val_tag, data, header=False): """Append raw data, possibly including a embedded SOH. :param len_tag: Tag number for length field. :param val_tag: Tag number for value field. :param data: Raw data byte string. :param header: Append to header if True...
[ "def", "append_data", "(", "self", ",", "len_tag", ",", "val_tag", ",", "data", ",", "header", "=", "False", ")", ":", "self", ".", "append_pair", "(", "len_tag", ",", "len", "(", "data", ")", ",", "header", "=", "header", ")", "self", ".", "append_p...
Append raw data, possibly including a embedded SOH. :param len_tag: Tag number for length field. :param val_tag: Tag number for value field. :param data: Raw data byte string. :param header: Append to header if True; default to body. Appends two pairs: a length pair, followed b...
[ "Append", "raw", "data", "possibly", "including", "a", "embedded", "SOH", "." ]
python
train
kytos/kytos-utils
kytos/cli/commands/napps/api.py
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/cli/commands/napps/api.py#L198-L210
def _print_napps(cls, napp_list): """Format the NApp list to be printed.""" mgr = NAppsManager() enabled = mgr.get_enabled() installed = mgr.get_installed() napps = [] for napp, desc in sorted(napp_list): status = 'i' if napp in installed else '-' ...
[ "def", "_print_napps", "(", "cls", ",", "napp_list", ")", ":", "mgr", "=", "NAppsManager", "(", ")", "enabled", "=", "mgr", ".", "get_enabled", "(", ")", "installed", "=", "mgr", ".", "get_installed", "(", ")", "napps", "=", "[", "]", "for", "napp", ...
Format the NApp list to be printed.
[ "Format", "the", "NApp", "list", "to", "be", "printed", "." ]
python
train
saltstack/salt
salt/states/zone.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zone.py#L1141-L1182
def installed(name, nodataset=False, brand_opts=None): ''' Ensure zone is installed name : string name of the zone nodataset : boolean do not create a ZFS file system brand_opts : boolean brand specific options to pass ''' ret = {'name': name, 'changes': ...
[ "def", "installed", "(", "name", ",", "nodataset", "=", "False", ",", "brand_opts", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "zon...
Ensure zone is installed name : string name of the zone nodataset : boolean do not create a ZFS file system brand_opts : boolean brand specific options to pass
[ "Ensure", "zone", "is", "installed" ]
python
train
jonathf/chaospy
chaospy/quad/stieltjes.py
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/quad/stieltjes.py#L98-L129
def _stieltjes_analytical(dist, order, normed): """Stieltjes' method with analytical recurrence coefficients.""" dimensions = len(dist) mom_order = numpy.arange(order+1).repeat(dimensions) mom_order = mom_order.reshape(order+1, dimensions).T coeff1, coeff2 = dist.ttr(mom_order) coeff2[:, 0] = 1....
[ "def", "_stieltjes_analytical", "(", "dist", ",", "order", ",", "normed", ")", ":", "dimensions", "=", "len", "(", "dist", ")", "mom_order", "=", "numpy", ".", "arange", "(", "order", "+", "1", ")", ".", "repeat", "(", "dimensions", ")", "mom_order", "...
Stieltjes' method with analytical recurrence coefficients.
[ "Stieltjes", "method", "with", "analytical", "recurrence", "coefficients", "." ]
python
train
Naresh1318/crystal
crystal/Crystal.py
https://github.com/Naresh1318/crystal/blob/6bb43fd1128296cc59b8ed3bc03064cc61c6bd88/crystal/Crystal.py#L17-L25
def get_valid_time_stamp(): """ Get a valid time stamp without illegal characters. Adds time_ to make the time stamp a valid table name in sql. :return: String, extracted timestamp """ time_stamp = str(datetime.datetime.now()) time_stamp = "time_" + time_stamp.replace("-", "_").replace(":", ...
[ "def", "get_valid_time_stamp", "(", ")", ":", "time_stamp", "=", "str", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ")", "time_stamp", "=", "\"time_\"", "+", "time_stamp", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", ".", "replace", "(", ...
Get a valid time stamp without illegal characters. Adds time_ to make the time stamp a valid table name in sql. :return: String, extracted timestamp
[ "Get", "a", "valid", "time", "stamp", "without", "illegal", "characters", ".", "Adds", "time_", "to", "make", "the", "time", "stamp", "a", "valid", "table", "name", "in", "sql", ".", ":", "return", ":", "String", "extracted", "timestamp" ]
python
train
readbeyond/aeneas
aeneas/executejob.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/executejob.py#L220-L296
def write_output_container(self, output_directory_path): """ Write the output container for this job. Return the path to output container, which is the concatenation of ``output_directory_path`` and of the output container file or directory name. :param string output_di...
[ "def", "write_output_container", "(", "self", ",", "output_directory_path", ")", ":", "self", ".", "log", "(", "u\"Writing output container for this job\"", ")", "if", "self", ".", "job", "is", "None", ":", "self", ".", "log_exc", "(", "u\"The job object is None\"",...
Write the output container for this job. Return the path to output container, which is the concatenation of ``output_directory_path`` and of the output container file or directory name. :param string output_directory_path: the path to a directory where ...
[ "Write", "the", "output", "container", "for", "this", "job", "." ]
python
train
quantopian/zipline
zipline/utils/cli.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/cli.py#L7-L36
def maybe_show_progress(it, show_progress, **kwargs): """Optionally show a progress bar for the given iterator. Parameters ---------- it : iterable The underlying iterator. show_progress : bool Should progress be shown. **kwargs Forwarded to the click progress bar. ...
[ "def", "maybe_show_progress", "(", "it", ",", "show_progress", ",", "*", "*", "kwargs", ")", ":", "if", "show_progress", ":", "return", "click", ".", "progressbar", "(", "it", ",", "*", "*", "kwargs", ")", "# context manager that just return `it` when we enter it"...
Optionally show a progress bar for the given iterator. Parameters ---------- it : iterable The underlying iterator. show_progress : bool Should progress be shown. **kwargs Forwarded to the click progress bar. Returns ------- itercontext : context manager ...
[ "Optionally", "show", "a", "progress", "bar", "for", "the", "given", "iterator", "." ]
python
train
frmdstryr/enamlx
enamlx/qt/qt_graphics_view.py
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_graphics_view.py#L638-L643
def mousePressEvent(self, event): """ Handle the mouse press event for a drag operation. """ self.declaration.mouse_press_event(event) super(QtGraphicsView, self).mousePressEvent(event)
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "self", ".", "declaration", ".", "mouse_press_event", "(", "event", ")", "super", "(", "QtGraphicsView", ",", "self", ")", ".", "mousePressEvent", "(", "event", ")" ]
Handle the mouse press event for a drag operation.
[ "Handle", "the", "mouse", "press", "event", "for", "a", "drag", "operation", "." ]
python
train
materials-data-facility/toolbox
mdf_toolbox/sub_helpers.py
https://github.com/materials-data-facility/toolbox/blob/2a4ac2b6a892238263008efa6a5f3923d9a83505/mdf_toolbox/sub_helpers.py#L23-L97
def _aggregate(self, scroll_field, scroll_size=SEARCH_LIMIT): """Perform an advanced query, and return *all* matching results. Will automatically perform multiple queries in order to retrieve all results. Note: All ``aggregate`` queries run in advanced mode. Arguments: scro...
[ "def", "_aggregate", "(", "self", ",", "scroll_field", ",", "scroll_size", "=", "SEARCH_LIMIT", ")", ":", "# Make sure scroll_field is valid", "if", "not", "scroll_field", ":", "raise", "AttributeError", "(", "\"scroll_field is required.\"", ")", "# Make sure the query is...
Perform an advanced query, and return *all* matching results. Will automatically perform multiple queries in order to retrieve all results. Note: All ``aggregate`` queries run in advanced mode. Arguments: scroll_field (str): The field on which to scroll. This should be a field ...
[ "Perform", "an", "advanced", "query", "and", "return", "*", "all", "*", "matching", "results", ".", "Will", "automatically", "perform", "multiple", "queries", "in", "order", "to", "retrieve", "all", "results", "." ]
python
train
DataBiosphere/toil
src/toil/jobStores/fileJobStore.py
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/jobStores/fileJobStore.py#L605-L626
def _getUniqueName(self, fileName, jobStoreID=None, sourceFunctionName="x"): """ Create unique file name within a jobStore directory or tmp directory. :param fileName: A file name, which can be a full path as only the basename will be used. :param jobStoreID: If given, the path ...
[ "def", "_getUniqueName", "(", "self", ",", "fileName", ",", "jobStoreID", "=", "None", ",", "sourceFunctionName", "=", "\"x\"", ")", ":", "fd", ",", "absPath", "=", "self", ".", "_getTempFile", "(", "jobStoreID", ")", "os", ".", "close", "(", "fd", ")", ...
Create unique file name within a jobStore directory or tmp directory. :param fileName: A file name, which can be a full path as only the basename will be used. :param jobStoreID: If given, the path returned will be in the jobStore directory. Otherwise, the tmp directory will be used. ...
[ "Create", "unique", "file", "name", "within", "a", "jobStore", "directory", "or", "tmp", "directory", "." ]
python
train
Alignak-monitoring/alignak
alignak/daemon.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemon.py#L1010-L1177
def do_main_loop(self): # pylint: disable=too-many-branches, too-many-statements, too-many-locals """Main loop for an Alignak daemon :return: None """ # Increased on each loop turn if self.loop_count is None: self.loop_count = 0 # Daemon start timest...
[ "def", "do_main_loop", "(", "self", ")", ":", "# pylint: disable=too-many-branches, too-many-statements, too-many-locals", "# Increased on each loop turn", "if", "self", ".", "loop_count", "is", "None", ":", "self", ".", "loop_count", "=", "0", "# Daemon start timestamp", "...
Main loop for an Alignak daemon :return: None
[ "Main", "loop", "for", "an", "Alignak", "daemon" ]
python
train
ihgazni2/edict
edict/edict.py
https://github.com/ihgazni2/edict/blob/44a08ccc10b196aa3854619b4c51ddb246778a34/edict/edict.py#L1908-L1929
def _kvmatrix2d(km,vm): ''' km = [[[1], [3]], [[1, 2], [3, 'a']], [[1, 2, 22]]] show_kmatrix(km) vm = [[[222]], ['b']] show_vmatrix(vm) d = _kvmatrix2d(km,vm) ''' d = {} kmwfs = get_kmwfs(km) vmwfs = elel.get_wfs(vm) lngth = vmwfs.__len__...
[ "def", "_kvmatrix2d", "(", "km", ",", "vm", ")", ":", "d", "=", "{", "}", "kmwfs", "=", "get_kmwfs", "(", "km", ")", "vmwfs", "=", "elel", ".", "get_wfs", "(", "vm", ")", "lngth", "=", "vmwfs", ".", "__len__", "(", ")", "for", "i", "in", "range...
km = [[[1], [3]], [[1, 2], [3, 'a']], [[1, 2, 22]]] show_kmatrix(km) vm = [[[222]], ['b']] show_vmatrix(vm) d = _kvmatrix2d(km,vm)
[ "km", "=", "[[[", "1", "]", "[", "3", "]]", "[[", "1", "2", "]", "[", "3", "a", "]]", "[[", "1", "2", "22", "]]]", "show_kmatrix", "(", "km", ")", "vm", "=", "[[[", "222", "]]", "[", "b", "]]", "show_vmatrix", "(", "vm", ")", "d", "=", "_...
python
train
common-workflow-language/workflow-service
wes_client/util.py
https://github.com/common-workflow-language/workflow-service/blob/e879604b65c55546e4f87be1c9df9903a3e0b896/wes_client/util.py#L27-L38
def get_version(extension, workflow_file): '''Determines the version of a .py, .wdl, or .cwl file.''' if extension == 'py' and two_seven_compatible(workflow_file): return '2.7' elif extension == 'cwl': return yaml.load(open(workflow_file))['cwlVersion'] else: # Must be a wdl file. ...
[ "def", "get_version", "(", "extension", ",", "workflow_file", ")", ":", "if", "extension", "==", "'py'", "and", "two_seven_compatible", "(", "workflow_file", ")", ":", "return", "'2.7'", "elif", "extension", "==", "'cwl'", ":", "return", "yaml", ".", "load", ...
Determines the version of a .py, .wdl, or .cwl file.
[ "Determines", "the", "version", "of", "a", ".", "py", ".", "wdl", "or", ".", "cwl", "file", "." ]
python
train
Kaggle/kaggle-api
kaggle/api/kaggle_api.py
https://github.com/Kaggle/kaggle-api/blob/65f14b1386470c5784d4753e491478e7537660d9/kaggle/api/kaggle_api.py#L1070-L1091
def datasets_create_version(self, owner_slug, dataset_slug, dataset_new_version_request, **kwargs): # noqa: E501 """Create a new dataset version # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> t...
[ "def", "datasets_create_version", "(", "self", ",", "owner_slug", ",", "dataset_slug", ",", "dataset_new_version_request", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", ...
Create a new dataset version # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.datasets_create_version(owner_slug, dataset_slug, dataset_new_version_request, async_req=True) >>> result...
[ "Create", "a", "new", "dataset", "version", "#", "noqa", ":", "E501" ]
python
train
googleapis/google-cloud-python
api_core/google/api_core/future/polling.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/future/polling.py#L145-L166
def add_done_callback(self, fn): """Add a callback to be executed when the operation is complete. If the operation is not already complete, this will start a helper thread to poll for the status of the operation in the background. Args: fn (Callable[Future]): The callback t...
[ "def", "add_done_callback", "(", "self", ",", "fn", ")", ":", "if", "self", ".", "_result_set", ":", "_helpers", ".", "safe_invoke_callback", "(", "fn", ",", "self", ")", "return", "self", ".", "_done_callbacks", ".", "append", "(", "fn", ")", "if", "sel...
Add a callback to be executed when the operation is complete. If the operation is not already complete, this will start a helper thread to poll for the status of the operation in the background. Args: fn (Callable[Future]): The callback to execute when the operation ...
[ "Add", "a", "callback", "to", "be", "executed", "when", "the", "operation", "is", "complete", "." ]
python
train
goshuirc/irc
girc/imapping.py
https://github.com/goshuirc/irc/blob/d6a5e3e04d337566c009b087f108cd76f9e122cc/girc/imapping.py#L42-L57
def set_std(self, std): """Set the standard we'll be using (isupport CASEMAPPING).""" if not hasattr(self, '_std'): IMap.__init__(self) # translation based on std self._std = std.lower() # set casemapping maps self._set_transmaps() # create translat...
[ "def", "set_std", "(", "self", ",", "std", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_std'", ")", ":", "IMap", ".", "__init__", "(", "self", ")", "# translation based on std", "self", ".", "_std", "=", "std", ".", "lower", "(", ")", "# se...
Set the standard we'll be using (isupport CASEMAPPING).
[ "Set", "the", "standard", "we", "ll", "be", "using", "(", "isupport", "CASEMAPPING", ")", "." ]
python
train
gmr/remy
remy/cli.py
https://github.com/gmr/remy/blob/74368ae74e3f2b59376d6f8e457aefbe9c7debdf/remy/cli.py#L64-L90
def add_jenkins_job_options(parser): """Add a new job to Jenkins for updating chef-repo :rtype: argparse.ArgumentParser """ cookbook = parser.add_parser('jenkins', help='Add a new cookbook job to ' 'Jenkins') cookbook.add_argument('jenkins', action=...
[ "def", "add_jenkins_job_options", "(", "parser", ")", ":", "cookbook", "=", "parser", ".", "add_parser", "(", "'jenkins'", ",", "help", "=", "'Add a new cookbook job to '", "'Jenkins'", ")", "cookbook", ".", "add_argument", "(", "'jenkins'", ",", "action", "=", ...
Add a new job to Jenkins for updating chef-repo :rtype: argparse.ArgumentParser
[ "Add", "a", "new", "job", "to", "Jenkins", "for", "updating", "chef", "-", "repo" ]
python
train
developmentseed/landsat-util
landsat/landsat.py
https://github.com/developmentseed/landsat-util/blob/92dc81771ddaa64a8a9124a89a6516b52485374b/landsat/landsat.py#L166-L273
def args_options(): """ Generates an arugment parser. :returns: Parser object """ parser = argparse.ArgumentParser(prog='landsat', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent(DESCRIP...
[ "def", "args_options", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'landsat'", ",", "formatter_class", "=", "argparse", ".", "RawDescriptionHelpFormatter", ",", "description", "=", "textwrap", ".", "dedent", "(", "DESCRIPT...
Generates an arugment parser. :returns: Parser object
[ "Generates", "an", "arugment", "parser", "." ]
python
train
myint/rstcheck
rstcheck.py
https://github.com/myint/rstcheck/blob/2f975906b75f3b88d501ef3b13d213815cf7079a/rstcheck.py#L949-L985
def main(): """Return 0 on success.""" args = parse_args() if not args.files: return 0 with enable_sphinx_if_possible(): status = 0 pool = multiprocessing.Pool(multiprocessing.cpu_count()) try: if len(args.files) > 1: results = pool.map( ...
[ "def", "main", "(", ")", ":", "args", "=", "parse_args", "(", ")", "if", "not", "args", ".", "files", ":", "return", "0", "with", "enable_sphinx_if_possible", "(", ")", ":", "status", "=", "0", "pool", "=", "multiprocessing", ".", "Pool", "(", "multipr...
Return 0 on success.
[ "Return", "0", "on", "success", "." ]
python
train