repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
sassoo/goldman
goldman/deserializers/jsonapi.py
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/deserializers/jsonapi.py#L85-L121
def normalize(self, body): """ Invoke the JSON API normalizer Perform the following: * add the type as a rtype property * flatten the payload * add the id as a rid property ONLY if present We don't need to vet the inputs much because the Parser has ...
[ "def", "normalize", "(", "self", ",", "body", ")", ":", "resource", "=", "body", "[", "'data'", "]", "data", "=", "{", "'rtype'", ":", "resource", "[", "'type'", "]", "}", "if", "'attributes'", "in", "resource", ":", "attributes", "=", "resource", "[",...
Invoke the JSON API normalizer Perform the following: * add the type as a rtype property * flatten the payload * add the id as a rid property ONLY if present We don't need to vet the inputs much because the Parser has already done all the work. :pa...
[ "Invoke", "the", "JSON", "API", "normalizer" ]
python
train
27.081081
garenchan/policy
policy/enforcer.py
https://github.com/garenchan/policy/blob/7709ae5f371146f8c90380d0877a5e59d731f644/policy/enforcer.py#L115-L131
def load_rules(self, force_reload=False, overwrite=True): """Load rules from policy file or cache.""" # double-checked locking if self.load_once and self._policy_loaded: return with self._load_lock: if self.load_once and self._policy_loaded: retur...
[ "def", "load_rules", "(", "self", ",", "force_reload", "=", "False", ",", "overwrite", "=", "True", ")", ":", "# double-checked locking", "if", "self", ".", "load_once", "and", "self", ".", "_policy_loaded", ":", "return", "with", "self", ".", "_load_lock", ...
Load rules from policy file or cache.
[ "Load", "rules", "from", "policy", "file", "or", "cache", "." ]
python
train
41.705882
bitesofcode/projexui
projexui/xwidgetvalue.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xwidgetvalue.py#L92-L107
def getComboValue(combo): """ Checks to see if there is a dataType custom property set to determine whether to return an integer or a string. :param combo | <QComboBox> :return <int> || <str> """ dataType = unwrapVariant(combo.property('dataType')) if ...
[ "def", "getComboValue", "(", "combo", ")", ":", "dataType", "=", "unwrapVariant", "(", "combo", ".", "property", "(", "'dataType'", ")", ")", "if", "dataType", "==", "'string'", ":", "return", "combo", ".", "currentText", "(", ")", "elif", "dataType", "=="...
Checks to see if there is a dataType custom property set to determine whether to return an integer or a string. :param combo | <QComboBox> :return <int> || <str>
[ "Checks", "to", "see", "if", "there", "is", "a", "dataType", "custom", "property", "set", "to", "determine", "whether", "to", "return", "an", "integer", "or", "a", "string", ".", ":", "param", "combo", "|", "<QComboBox", ">", ":", "return", "<int", ">", ...
python
train
30.8125
OSSOS/MOP
src/jjk/preproc/ephemSearch.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/ephemSearch.py#L264-L274
def predict(abg,date,obs=568): """Run GB's predict using an ABG file as input.""" import orbfit import RO.StringUtil (ra,dec,a,b,ang) = orbfit.predict(abg,date,obs) obj['RA']=ra obj['DEC']=dec obj['dRA']=a obj['dDEC']=b obj['dANG']=ang return obj
[ "def", "predict", "(", "abg", ",", "date", ",", "obs", "=", "568", ")", ":", "import", "orbfit", "import", "RO", ".", "StringUtil", "(", "ra", ",", "dec", ",", "a", ",", "b", ",", "ang", ")", "=", "orbfit", ".", "predict", "(", "abg", ",", "dat...
Run GB's predict using an ABG file as input.
[ "Run", "GB", "s", "predict", "using", "an", "ABG", "file", "as", "input", "." ]
python
train
25.090909
MartinThoma/hwrt
hwrt/utils.py
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/utils.py#L855-L882
def get_objectlist(description, config_key, module): """ Take a description and return a list of classes. Parameters ---------- description : list of dictionaries Each dictionary has only one entry. The key is the name of a class. The value of that entry is a list of dictionaries ag...
[ "def", "get_objectlist", "(", "description", ",", "config_key", ",", "module", ")", ":", "object_list", "=", "[", "]", "for", "feature", "in", "description", ":", "for", "feat", ",", "params", "in", "feature", ".", "items", "(", ")", ":", "feat", "=", ...
Take a description and return a list of classes. Parameters ---------- description : list of dictionaries Each dictionary has only one entry. The key is the name of a class. The value of that entry is a list of dictionaries again. Those dictionaries are paramters. Returns -...
[ "Take", "a", "description", "and", "return", "a", "list", "of", "classes", "." ]
python
train
33.464286
heitzmann/gdspy
gdspy/__init__.py
https://github.com/heitzmann/gdspy/blob/2c8d1313248c544e2066d19095b7ad7158c79bc9/gdspy/__init__.py#L2379-L2395
def get_datatypes(self): """ Returns a set of datatypes in this cell. Returns ------- out : set Set of the datatypes used in this cell. """ datatypes = set() for element in self.elements: if isinstance(element, PolygonSet): ...
[ "def", "get_datatypes", "(", "self", ")", ":", "datatypes", "=", "set", "(", ")", "for", "element", "in", "self", ".", "elements", ":", "if", "isinstance", "(", "element", ",", "PolygonSet", ")", ":", "datatypes", ".", "update", "(", "element", ".", "d...
Returns a set of datatypes in this cell. Returns ------- out : set Set of the datatypes used in this cell.
[ "Returns", "a", "set", "of", "datatypes", "in", "this", "cell", "." ]
python
train
32.235294
Unity-Technologies/ml-agents
ml-agents-envs/mlagents/envs/rpc_communicator.py
https://github.com/Unity-Technologies/ml-agents/blob/37d139af636e4a2351751fbf0f2fca5a9ed7457f/ml-agents-envs/mlagents/envs/rpc_communicator.py#L65-L75
def check_port(self, port): """ Attempts to bind to the requested communicator port, checking if it is already in use. """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.bind(("localhost", port)) except socket.error: raise UnityWorker...
[ "def", "check_port", "(", "self", ",", "port", ")", ":", "s", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "try", ":", "s", ".", "bind", "(", "(", "\"localhost\"", ",", "port", ")", ")", "exce...
Attempts to bind to the requested communicator port, checking if it is already in use.
[ "Attempts", "to", "bind", "to", "the", "requested", "communicator", "port", "checking", "if", "it", "is", "already", "in", "use", "." ]
python
train
34.454545
CalebBell/fluids
fluids/friction.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/friction.py#L3647-L3733
def roughness_Farshad(ID=None, D=None, coeffs=None): r'''Calculates of retrieves the roughness of a pipe based on the work of [1]_. This function will return an average value for pipes of a given material, or if diameter is provided, will calculate one specifically for the pipe inner diameter according ...
[ "def", "roughness_Farshad", "(", "ID", "=", "None", ",", "D", "=", "None", ",", "coeffs", "=", "None", ")", ":", "# Case 1, coeffs given; only run if ID is not given.", "if", "ID", "is", "None", "and", "coeffs", ":", "A", ",", "B", "=", "coeffs", "return", ...
r'''Calculates of retrieves the roughness of a pipe based on the work of [1]_. This function will return an average value for pipes of a given material, or if diameter is provided, will calculate one specifically for the pipe inner diameter according to the following expression with constants `A` and `...
[ "r", "Calculates", "of", "retrieves", "the", "roughness", "of", "a", "pipe", "based", "on", "the", "work", "of", "[", "1", "]", "_", ".", "This", "function", "will", "return", "an", "average", "value", "for", "pipes", "of", "a", "given", "material", "o...
python
train
34.402299
materialsproject/pymatgen
pymatgen/io/abinit/abiinspect.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L639-L654
def all_docs_with_tag(self, doc_tag): """ Returns all the documents with the specified tag. """ docs = [] while True: try: doc = self.next_doc_with(doc_tag) docs.append(doc) except StopIteration: break ...
[ "def", "all_docs_with_tag", "(", "self", ",", "doc_tag", ")", ":", "docs", "=", "[", "]", "while", "True", ":", "try", ":", "doc", "=", "self", ".", "next_doc_with", "(", "doc_tag", ")", "docs", ".", "append", "(", "doc", ")", "except", "StopIteration"...
Returns all the documents with the specified tag.
[ "Returns", "all", "the", "documents", "with", "the", "specified", "tag", "." ]
python
train
21.375
tadashi-aikawa/owlmixin
owlmixin/owlcollections.py
https://github.com/tadashi-aikawa/owlmixin/blob/7c4a042c3008abddc56a8e8e55ae930d276071f5/owlmixin/owlcollections.py#L190-L206
def group_by(self, to_key): """ :param to_key: :type to_key: T -> unicode :rtype: TDict[TList[T]] Usage: >>> TList([1, 2, 3, 4, 5]).group_by(lambda x: x % 2).to_json() '{"0": [2,4],"1": [1,3,5]}' """ ret = TDict() for v in self: ...
[ "def", "group_by", "(", "self", ",", "to_key", ")", ":", "ret", "=", "TDict", "(", ")", "for", "v", "in", "self", ":", "k", "=", "to_key", "(", "v", ")", "ret", ".", "setdefault", "(", "k", ",", "TList", "(", ")", ")", "ret", "[", "k", "]", ...
:param to_key: :type to_key: T -> unicode :rtype: TDict[TList[T]] Usage: >>> TList([1, 2, 3, 4, 5]).group_by(lambda x: x % 2).to_json() '{"0": [2,4],"1": [1,3,5]}'
[ ":", "param", "to_key", ":", ":", "type", "to_key", ":", "T", "-", ">", "unicode", ":", "rtype", ":", "TDict", "[", "TList", "[", "T", "]]" ]
python
train
24.411765
maximtrp/scikit-posthocs
scikit_posthocs/_posthocs.py
https://github.com/maximtrp/scikit-posthocs/blob/5476b09e2a325cd4e31c0b0bc6906ab5cd77fc5d/scikit_posthocs/_posthocs.py#L1845-L1897
def posthoc_tukey_hsd(x, g, alpha=0.05): '''Pairwise comparisons with TukeyHSD confidence intervals. This is a convenience function to make statsmodels `pairwise_tukeyhsd` method more applicable for further use. Parameters ---------- x : array_like or pandas Series object, 1d An array,...
[ "def", "posthoc_tukey_hsd", "(", "x", ",", "g", ",", "alpha", "=", "0.05", ")", ":", "result", "=", "pairwise_tukeyhsd", "(", "x", ",", "g", ",", "alpha", "=", "0.05", ")", "groups", "=", "np", ".", "array", "(", "result", ".", "groupsunique", ",", ...
Pairwise comparisons with TukeyHSD confidence intervals. This is a convenience function to make statsmodels `pairwise_tukeyhsd` method more applicable for further use. Parameters ---------- x : array_like or pandas Series object, 1d An array, any object exposing the array interface, contain...
[ "Pairwise", "comparisons", "with", "TukeyHSD", "confidence", "intervals", ".", "This", "is", "a", "convenience", "function", "to", "make", "statsmodels", "pairwise_tukeyhsd", "method", "more", "applicable", "for", "further", "use", "." ]
python
train
34.811321
GPflow/GPflow
gpflow/models/model.py
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/models/model.py#L201-L206
def predict_y(self, Xnew): """ Compute the mean and variance of held-out data at the points Xnew """ pred_f_mean, pred_f_var = self._build_predict(Xnew) return self.likelihood.predict_mean_and_var(pred_f_mean, pred_f_var)
[ "def", "predict_y", "(", "self", ",", "Xnew", ")", ":", "pred_f_mean", ",", "pred_f_var", "=", "self", ".", "_build_predict", "(", "Xnew", ")", "return", "self", ".", "likelihood", ".", "predict_mean_and_var", "(", "pred_f_mean", ",", "pred_f_var", ")" ]
Compute the mean and variance of held-out data at the points Xnew
[ "Compute", "the", "mean", "and", "variance", "of", "held", "-", "out", "data", "at", "the", "points", "Xnew" ]
python
train
42.666667
sebdah/dynamic-dynamodb
dynamic_dynamodb/aws/sns.py
https://github.com/sebdah/dynamic-dynamodb/blob/bfd0ca806b1c3301e724696de90ef0f973410493/dynamic_dynamodb/aws/sns.py#L71-L89
def __publish(topic, message, subject=None): """ Publish a message to a SNS topic :type topic: str :param topic: SNS topic to publish the message to :type message: str :param message: Message to send via SNS :type subject: str :param subject: Subject to use for e-mail notifications :ret...
[ "def", "__publish", "(", "topic", ",", "message", ",", "subject", "=", "None", ")", ":", "try", ":", "SNS_CONNECTION", ".", "publish", "(", "topic", "=", "topic", ",", "message", "=", "message", ",", "subject", "=", "subject", ")", "logger", ".", "info...
Publish a message to a SNS topic :type topic: str :param topic: SNS topic to publish the message to :type message: str :param message: Message to send via SNS :type subject: str :param subject: Subject to use for e-mail notifications :returns: None
[ "Publish", "a", "message", "to", "a", "SNS", "topic" ]
python
train
32.578947
square/pylink
pylink/jlink.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L3717-L3821
def watchpoint_set(self, addr, addr_mask=0x0, data=0x0, data_mask=0x0, access_size=None, read=False, write=False, privileged=False): ...
[ "def", "watchpoint_set", "(", "self", ",", "addr", ",", "addr_mask", "=", "0x0", ",", "data", "=", "0x0", ",", "data_mask", "=", "0x0", ",", "access_size", "=", "None", ",", "read", "=", "False", ",", "write", "=", "False", ",", "privileged", "=", "F...
Sets a watchpoint at the given address. This method allows for a watchpoint to be set on an given address or range of addresses. The watchpoint can then be triggered if the data at the given address matches the specified ``data`` or range of data as determined by ``data_mask``, on spec...
[ "Sets", "a", "watchpoint", "at", "the", "given", "address", "." ]
python
train
45.657143
data61/clkhash
clkhash/field_formats.py
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/field_formats.py#L157-L188
def fhp_from_json_dict( json_dict # type: Dict[str, Any] ): # type: (...) -> FieldHashingProperties """ Make a :class:`FieldHashingProperties` object from a dictionary. :param dict json_dict: The dictionary must have have an 'ngram' key and one of k or num_bits....
[ "def", "fhp_from_json_dict", "(", "json_dict", "# type: Dict[str, Any]", ")", ":", "# type: (...) -> FieldHashingProperties", "h", "=", "json_dict", ".", "get", "(", "'hash'", ",", "{", "'type'", ":", "'blakeHash'", "}", ")", "num_bits", "=", "json_dict", ".", "ge...
Make a :class:`FieldHashingProperties` object from a dictionary. :param dict json_dict: The dictionary must have have an 'ngram' key and one of k or num_bits. It may have 'positional' key; if missing a default is used. The encoding is always set to th...
[ "Make", "a", ":", "class", ":", "FieldHashingProperties", "object", "from", "a", "dictionary", "." ]
python
train
36.25
Azure/azure-cli-extensions
src/express-route/azext_express_route/vendored_sdks/network_management_client.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/express-route/azext_express_route/vendored_sdks/network_management_client.py#L861-L871
def express_route_ports(self): """Instance depends on the API version: * 2018-08-01: :class:`ExpressRoutePortsOperations<azure.mgmt.network.v2018_08_01.operations.ExpressRoutePortsOperations>` """ api_version = self._get_api_version('express_route_ports') if api_version == '2...
[ "def", "express_route_ports", "(", "self", ")", ":", "api_version", "=", "self", ".", "_get_api_version", "(", "'express_route_ports'", ")", "if", "api_version", "==", "'2018-08-01'", ":", "from", ".", "v2018_08_01", ".", "operations", "import", "ExpressRoutePortsOp...
Instance depends on the API version: * 2018-08-01: :class:`ExpressRoutePortsOperations<azure.mgmt.network.v2018_08_01.operations.ExpressRoutePortsOperations>`
[ "Instance", "depends", "on", "the", "API", "version", ":" ]
python
train
60.727273
getsentry/sentry-python
sentry_sdk/integrations/wsgi.py
https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/integrations/wsgi.py#L35-L55
def get_host(environ): # type: (Dict[str, str]) -> str """Return the host for the given WSGI environment. Yanked from Werkzeug.""" if environ.get("HTTP_HOST"): rv = environ["HTTP_HOST"] if environ["wsgi.url_scheme"] == "http" and rv.endswith(":80"): rv = rv[:-3] elif envi...
[ "def", "get_host", "(", "environ", ")", ":", "# type: (Dict[str, str]) -> str", "if", "environ", ".", "get", "(", "\"HTTP_HOST\"", ")", ":", "rv", "=", "environ", "[", "\"HTTP_HOST\"", "]", "if", "environ", "[", "\"wsgi.url_scheme\"", "]", "==", "\"http\"", "a...
Return the host for the given WSGI environment. Yanked from Werkzeug.
[ "Return", "the", "host", "for", "the", "given", "WSGI", "environment", ".", "Yanked", "from", "Werkzeug", "." ]
python
train
36.380952
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L1473-L1512
def multi_load_data(Channel, RunNos, RepeatNos, directoryPath='.', calcPSD=True, NPerSegmentPSD=1000000): """ Lets you load multiple datasets at once assuming they have a filename which contains a pattern of the form: CH<ChannelNo>_RUN00...<RunNo>_REPEAT00...<RepeatNo> Parameters ---------...
[ "def", "multi_load_data", "(", "Channel", ",", "RunNos", ",", "RepeatNos", ",", "directoryPath", "=", "'.'", ",", "calcPSD", "=", "True", ",", "NPerSegmentPSD", "=", "1000000", ")", ":", "matching_files", "=", "search_data_std", "(", "Channel", "=", "Channel",...
Lets you load multiple datasets at once assuming they have a filename which contains a pattern of the form: CH<ChannelNo>_RUN00...<RunNo>_REPEAT00...<RepeatNo> Parameters ---------- Channel : int The channel you want to load RunNos : sequence Sequence of run numbers you wan...
[ "Lets", "you", "load", "multiple", "datasets", "at", "once", "assuming", "they", "have", "a", "filename", "which", "contains", "a", "pattern", "of", "the", "form", ":", "CH<ChannelNo", ">", "_RUN00", "...", "<RunNo", ">", "_REPEAT00", "...", "<RepeatNo", ">"...
python
train
37.875
xmikos/soapy_power
soapypower/__main__.py
https://github.com/xmikos/soapy_power/blob/46e12659b8d08af764dc09a1f31b0e85a68f808f/soapypower/__main__.py#L36-L45
def specific_gains(string): """Convert string with gains of individual amplification elements to dict""" if not string: return {} gains = {} for gain in string.split(','): amp_name, value = gain.split('=') gains[amp_name.strip()] = float(value.strip()) return gains
[ "def", "specific_gains", "(", "string", ")", ":", "if", "not", "string", ":", "return", "{", "}", "gains", "=", "{", "}", "for", "gain", "in", "string", ".", "split", "(", "','", ")", ":", "amp_name", ",", "value", "=", "gain", ".", "split", "(", ...
Convert string with gains of individual amplification elements to dict
[ "Convert", "string", "with", "gains", "of", "individual", "amplification", "elements", "to", "dict" ]
python
test
30.1
sloria/aiohttp_utils
aiohttp_utils/runner.py
https://github.com/sloria/aiohttp_utils/blob/e5b41452f8077e7d749715606b1560f4b50e3d71/aiohttp_utils/runner.py#L99-L117
def run(app: web.Application, **kwargs): """Run an `aiohttp.web.Application` using gunicorn. :param app: The app to run. :param str app_uri: Import path to `app`. Takes the form ``$(MODULE_NAME):$(VARIABLE_NAME)``. The module name can be a full dotted path. The variable name refers ...
[ "def", "run", "(", "app", ":", "web", ".", "Application", ",", "*", "*", "kwargs", ")", ":", "runner", "=", "Runner", "(", "app", ",", "*", "*", "kwargs", ")", "runner", ".", "run", "(", ")" ]
Run an `aiohttp.web.Application` using gunicorn. :param app: The app to run. :param str app_uri: Import path to `app`. Takes the form ``$(MODULE_NAME):$(VARIABLE_NAME)``. The module name can be a full dotted path. The variable name refers to the `aiohttp.web.Application` instance. ...
[ "Run", "an", "aiohttp", ".", "web", ".", "Application", "using", "gunicorn", "." ]
python
test
42.578947
gbowerman/azurerm
azurerm/keyvault.py
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/keyvault.py#L99-L115
def list_keyvaults(access_token, subscription_id, rgname): '''Lists key vaults in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP res...
[ "def", "list_keyvaults", "(", "access_token", ",", "subscription_id", ",", "rgname", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/resourcegroups/'", ",", "rgname", ...
Lists key vaults in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response. 200 OK.
[ "Lists", "key", "vaults", "in", "the", "named", "resource", "group", "." ]
python
train
38.117647
materialsproject/pymatgen
pymatgen/io/abinit/tasks.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L2626-L2650
def setup(self): """ Abinit has the very *bad* habit of changing the file extension by appending the characters in [A,B ..., Z] to the output file, and this breaks a lot of code that relies of the use of a unique file extension. Here we fix this issue by renaming run.abo to run.abo_[numb...
[ "def", "setup", "(", "self", ")", ":", "def", "rename_file", "(", "afile", ")", ":", "\"\"\"Helper function to rename :class:`File` objects. Return string for logging purpose.\"\"\"", "# Find the index of the last file (if any).", "# TODO: Maybe it's better to use run.abo --> run(1).abo"...
Abinit has the very *bad* habit of changing the file extension by appending the characters in [A,B ..., Z] to the output file, and this breaks a lot of code that relies of the use of a unique file extension. Here we fix this issue by renaming run.abo to run.abo_[number] if the output file "run.abo" alre...
[ "Abinit", "has", "the", "very", "*", "bad", "*", "habit", "of", "changing", "the", "file", "extension", "by", "appending", "the", "characters", "in", "[", "A", "B", "...", "Z", "]", "to", "the", "output", "file", "and", "this", "breaks", "a", "lot", ...
python
train
53.76
edublancas/sklearn-evaluation
sklearn_evaluation/util.py
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/util.py#L80-L89
def _product(k, v): """ Perform the product between two objects even if they don't support iteration """ if not _can_iterate(k): k = [k] if not _can_iterate(v): v = [v] return list(product(k, v))
[ "def", "_product", "(", "k", ",", "v", ")", ":", "if", "not", "_can_iterate", "(", "k", ")", ":", "k", "=", "[", "k", "]", "if", "not", "_can_iterate", "(", "v", ")", ":", "v", "=", "[", "v", "]", "return", "list", "(", "product", "(", "k", ...
Perform the product between two objects even if they don't support iteration
[ "Perform", "the", "product", "between", "two", "objects", "even", "if", "they", "don", "t", "support", "iteration" ]
python
train
23.8
sublee/etc
etc/helpers.py
https://github.com/sublee/etc/blob/f2be64604da5af0d7739cfacf36f55712f0fc5cb/etc/helpers.py#L37-L52
def gen_repr(cls, template, *args, **kwargs): """Generates a string for :func:`repr`.""" buf = io.StringIO() buf.write(u'<') buf.write(cls.__module__.decode() if kwargs.pop('full', False) else u'etc') buf.write(u'.') buf.write(cls.__name__.decode()) if not kwargs.pop('dense', False): ...
[ "def", "gen_repr", "(", "cls", ",", "template", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "buf", "=", "io", ".", "StringIO", "(", ")", "buf", ".", "write", "(", "u'<'", ")", "buf", ".", "write", "(", "cls", ".", "__module__", ".", "d...
Generates a string for :func:`repr`.
[ "Generates", "a", "string", "for", ":", "func", ":", "repr", "." ]
python
train
35.375
tradenity/python-sdk
tradenity/resources/discount_promotion.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/discount_promotion.py#L682-L704
def list_all_discount_promotions(cls, **kwargs): """List DiscountPromotions Return a list of DiscountPromotions This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.list_all_discount_promotions(asy...
[ "def", "list_all_discount_promotions", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", "_list_all_discount_promotions_with_htt...
List DiscountPromotions Return a list of DiscountPromotions This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.list_all_discount_promotions(async=True) >>> result = thread.get() :param a...
[ "List", "DiscountPromotions" ]
python
train
39.391304
sosy-lab/benchexec
benchexec/resources.py
https://github.com/sosy-lab/benchexec/blob/44428f67f41384c03aea13e7e25f884764653617/benchexec/resources.py#L213-L241
def get_memory_banks_per_run(coreAssignment, cgroups): """Get an assignment of memory banks to runs that fits to the given coreAssignment, i.e., no run is allowed to use memory that is not local (on the same NUMA node) to one of its CPU cores.""" try: # read list of available memory banks ...
[ "def", "get_memory_banks_per_run", "(", "coreAssignment", ",", "cgroups", ")", ":", "try", ":", "# read list of available memory banks", "allMems", "=", "set", "(", "cgroups", ".", "read_allowed_memory_banks", "(", ")", ")", "result", "=", "[", "]", "for", "cores"...
Get an assignment of memory banks to runs that fits to the given coreAssignment, i.e., no run is allowed to use memory that is not local (on the same NUMA node) to one of its CPU cores.
[ "Get", "an", "assignment", "of", "memory", "banks", "to", "runs", "that", "fits", "to", "the", "given", "coreAssignment", "i", ".", "e", ".", "no", "run", "is", "allowed", "to", "use", "memory", "that", "is", "not", "local", "(", "on", "the", "same", ...
python
train
42.448276
MacHu-GWU/sqlalchemy_mate-project
sqlalchemy_mate/credential.py
https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/credential.py#L191-L241
def from_env(cls, prefix, kms_decrypt=False, aws_profile=None): """ Load database credential from env variable. - host: ENV.{PREFIX}_HOST - port: ENV.{PREFIX}_PORT - database: ENV.{PREFIX}_DATABASE - username: ENV.{PREFIX}_USERNAME - password: ENV.{PREFIX}_PASSWO...
[ "def", "from_env", "(", "cls", ",", "prefix", ",", "kms_decrypt", "=", "False", ",", "aws_profile", "=", "None", ")", ":", "if", "len", "(", "prefix", ")", "<", "1", ":", "raise", "ValueError", "(", "\"prefix can't be empty\"", ")", "if", "len", "(", "...
Load database credential from env variable. - host: ENV.{PREFIX}_HOST - port: ENV.{PREFIX}_PORT - database: ENV.{PREFIX}_DATABASE - username: ENV.{PREFIX}_USERNAME - password: ENV.{PREFIX}_PASSWORD :param prefix: str :param kms_decrypt: bool :param aws_p...
[ "Load", "database", "credential", "from", "env", "variable", "." ]
python
train
32.313725
redodo/formats
formats/helpers.py
https://github.com/redodo/formats/blob/5bc7a79a2c93ef895534edbbf83f1efe2f62e081/formats/helpers.py#L28-L44
def discover_yaml(bank=None, **meta): """Discovers the YAML format and registers it if available. Install YAML support via PIP:: pip install PyYAML :param bank: The format bank to register the format in :param meta: Extra information associated with the format """ try: import ...
[ "def", "discover_yaml", "(", "bank", "=", "None", ",", "*", "*", "meta", ")", ":", "try", ":", "import", "yaml", "if", "bank", "is", "None", ":", "bank", "=", "default_bank", "bank", ".", "register", "(", "'yaml'", ",", "yaml", ".", "load", ",", "y...
Discovers the YAML format and registers it if available. Install YAML support via PIP:: pip install PyYAML :param bank: The format bank to register the format in :param meta: Extra information associated with the format
[ "Discovers", "the", "YAML", "format", "and", "registers", "it", "if", "available", "." ]
python
train
27.176471
gem/oq-engine
openquake/commonlib/logictree.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/logictree.py#L873-L884
def _parse_planar_geometry_surface(self, node): """ Parses a planar geometry surface """ nodes = [] for key in ["topLeft", "topRight", "bottomRight", "bottomLeft"]: nodes.append(geo.Point(getattr(node, key)["lon"], getattr(node, key)...
[ "def", "_parse_planar_geometry_surface", "(", "self", ",", "node", ")", ":", "nodes", "=", "[", "]", "for", "key", "in", "[", "\"topLeft\"", ",", "\"topRight\"", ",", "\"bottomRight\"", ",", "\"bottomLeft\"", "]", ":", "nodes", ".", "append", "(", "geo", "...
Parses a planar geometry surface
[ "Parses", "a", "planar", "geometry", "surface" ]
python
train
47.083333
tomprince/txgithub
txgithub/api.py
https://github.com/tomprince/txgithub/blob/3bd5eebb25db013e2193e6a102a91049f356710d/txgithub/api.py#L336-L347
def create(self, repo_user, repo_name, issue_number, body): """ PATCH /repos/:owner/:repo/issues/:number/comments :param issue_number: The issue's (or pull request's) number :param body: The body of this comment """ return self.api.makeRequest( ['repos', repo...
[ "def", "create", "(", "self", ",", "repo_user", ",", "repo_name", ",", "issue_number", ",", "body", ")", ":", "return", "self", ".", "api", ".", "makeRequest", "(", "[", "'repos'", ",", "repo_user", ",", "repo_name", ",", "'issues'", ",", "issue_number", ...
PATCH /repos/:owner/:repo/issues/:number/comments :param issue_number: The issue's (or pull request's) number :param body: The body of this comment
[ "PATCH", "/", "repos", "/", ":", "owner", "/", ":", "repo", "/", "issues", "/", ":", "number", "/", "comments" ]
python
train
36.416667
kmn/coincheck
coincheck/order.py
https://github.com/kmn/coincheck/blob/4e1062f1e564cddceec2f6fb4d70fe3a3ab645bc/coincheck/order.py#L59-L66
def cancel(self,order_id): ''' cancel the specified order :param order_id: order_id to be canceled ''' url= 'https://coincheck.com/api/exchange/orders/' + order_id headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key) r = requests.delete(url,hea...
[ "def", "cancel", "(", "self", ",", "order_id", ")", ":", "url", "=", "'https://coincheck.com/api/exchange/orders/'", "+", "order_id", "headers", "=", "make_header", "(", "url", ",", "access_key", "=", "self", ".", "access_key", ",", "secret_key", "=", "self", ...
cancel the specified order :param order_id: order_id to be canceled
[ "cancel", "the", "specified", "order", ":", "param", "order_id", ":", "order_id", "to", "be", "canceled" ]
python
train
45
apache/airflow
airflow/contrib/hooks/azure_container_instance_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_container_instance_hook.py#L149-L158
def delete(self, resource_group, name): """ Delete a container group :param resource_group: the name of the resource group :type resource_group: str :param name: the name of the container group :type name: str """ self.connection.container_groups.delete(r...
[ "def", "delete", "(", "self", ",", "resource_group", ",", "name", ")", ":", "self", ".", "connection", ".", "container_groups", ".", "delete", "(", "resource_group", ",", "name", ")" ]
Delete a container group :param resource_group: the name of the resource group :type resource_group: str :param name: the name of the container group :type name: str
[ "Delete", "a", "container", "group" ]
python
test
33.1
widdowquinn/pyani
bin/genbank_get_genomes_by_taxon.py
https://github.com/widdowquinn/pyani/blob/2b24ec971401e04024bba896e4011984fe3f53f0/bin/genbank_get_genomes_by_taxon.py#L263-L275
def extract_filestem(data): """Extract filestem from Entrez eSummary data. Function expects esummary['DocumentSummarySet']['DocumentSummary'][0] Some illegal characters may occur in AssemblyName - for these, a more robust regex replace/escape may be required. Sadly, NCBI don't just use standard pe...
[ "def", "extract_filestem", "(", "data", ")", ":", "escapes", "=", "re", ".", "compile", "(", "r\"[\\s/,#\\(\\)]\"", ")", "escname", "=", "re", ".", "sub", "(", "escapes", ",", "'_'", ",", "data", "[", "'AssemblyName'", "]", ")", "return", "'_'", ".", "...
Extract filestem from Entrez eSummary data. Function expects esummary['DocumentSummarySet']['DocumentSummary'][0] Some illegal characters may occur in AssemblyName - for these, a more robust regex replace/escape may be required. Sadly, NCBI don't just use standard percent escapes, but instead replace ...
[ "Extract", "filestem", "from", "Entrez", "eSummary", "data", "." ]
python
train
45.384615
BD2KOnFHIR/i2b2model
i2b2model/data/i2b2observationfact.py
https://github.com/BD2KOnFHIR/i2b2model/blob/9d49bb53b0733dd83ab5b716014865e270a3c903/i2b2model/data/i2b2observationfact.py#L113-L120
def _date_val(self, dt: datetime) -> None: """ Add a date value :param dt: datetime to add """ self._tval_char = dt.strftime('%Y-%m-%d %H:%M') self._nval_num = (dt.year * 10000) + (dt.month * 100) + dt.day + \ (((dt.hour / 100.0) + (dt.minute / 10...
[ "def", "_date_val", "(", "self", ",", "dt", ":", "datetime", ")", "->", "None", ":", "self", ".", "_tval_char", "=", "dt", ".", "strftime", "(", "'%Y-%m-%d %H:%M'", ")", "self", ".", "_nval_num", "=", "(", "dt", ".", "year", "*", "10000", ")", "+", ...
Add a date value :param dt: datetime to add
[ "Add", "a", "date", "value", ":", "param", "dt", ":", "datetime", "to", "add" ]
python
train
44.5
project-rig/rig
rig/machine_control/struct_file.py
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/machine_control/struct_file.py#L101-L106
def num(value): """Convert a value from one of several bases to an int.""" if re_hex_num.match(value): return int(value, base=16) else: return int(value)
[ "def", "num", "(", "value", ")", ":", "if", "re_hex_num", ".", "match", "(", "value", ")", ":", "return", "int", "(", "value", ",", "base", "=", "16", ")", "else", ":", "return", "int", "(", "value", ")" ]
Convert a value from one of several bases to an int.
[ "Convert", "a", "value", "from", "one", "of", "several", "bases", "to", "an", "int", "." ]
python
train
29.333333
mkoura/dump2polarion
dump2polarion/properties.py
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/properties.py#L137-L153
def remove_response_property(xml_root): """Removes response properties if exist.""" if xml_root.tag == "testsuites": properties = xml_root.find("properties") resp_properties = [] for prop in properties: prop_name = prop.get("name", "") if "polarion-response-" in p...
[ "def", "remove_response_property", "(", "xml_root", ")", ":", "if", "xml_root", ".", "tag", "==", "\"testsuites\"", ":", "properties", "=", "xml_root", ".", "find", "(", "\"properties\"", ")", "resp_properties", "=", "[", "]", "for", "prop", "in", "properties"...
Removes response properties if exist.
[ "Removes", "response", "properties", "if", "exist", "." ]
python
train
42.705882
kensho-technologies/graphql-compiler
graphql_compiler/compiler/workarounds/orientdb_eval_scheduling.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/workarounds/orientdb_eval_scheduling.py#L101-L109
def _create_tautological_expression_for_location(query_metadata_table, location): """For a given location, create a BinaryComposition that always evaluates to 'true'.""" location_type = query_metadata_table.get_location_info(location).type location_exists = BinaryComposition( u'!=', ContextField(lo...
[ "def", "_create_tautological_expression_for_location", "(", "query_metadata_table", ",", "location", ")", ":", "location_type", "=", "query_metadata_table", ".", "get_location_info", "(", "location", ")", ".", "type", "location_exists", "=", "BinaryComposition", "(", "u'!...
For a given location, create a BinaryComposition that always evaluates to 'true'.
[ "For", "a", "given", "location", "create", "a", "BinaryComposition", "that", "always", "evaluates", "to", "true", "." ]
python
train
60.111111
saltstack/salt
salt/cloud/clouds/profitbricks.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/profitbricks.py#L1227-L1251
def _get_firewall_rules(firewall_rules): ''' Construct a list of optional firewall rules from the cloud profile. ''' ret = [] for key, value in six.iteritems(firewall_rules): # Verify the required 'protocol' property is present in the cloud # profile config if 'protocol' not ...
[ "def", "_get_firewall_rules", "(", "firewall_rules", ")", ":", "ret", "=", "[", "]", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "firewall_rules", ")", ":", "# Verify the required 'protocol' property is present in the cloud", "# profile config", "i...
Construct a list of optional firewall rules from the cloud profile.
[ "Construct", "a", "list", "of", "optional", "firewall", "rules", "from", "the", "cloud", "profile", "." ]
python
train
43.72
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/message.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/message.py#L603-L607
def _succeed(self, request_id, reply, duration): """Publish a CommandSucceededEvent.""" self.listeners.publish_command_success( duration, reply, self.name, request_id, self.sock_info.address, self.op_id)
[ "def", "_succeed", "(", "self", ",", "request_id", ",", "reply", ",", "duration", ")", ":", "self", ".", "listeners", ".", "publish_command_success", "(", "duration", ",", "reply", ",", "self", ".", "name", ",", "request_id", ",", "self", ".", "sock_info",...
Publish a CommandSucceededEvent.
[ "Publish", "a", "CommandSucceededEvent", "." ]
python
train
47.8
CybOXProject/mixbox
mixbox/entities.py
https://github.com/CybOXProject/mixbox/blob/9097dae7a433f5b98c18171c4a5598f69a7d30af/mixbox/entities.py#L777-L794
def _fix_example_namespace(self): """Attempts to resolve issues where our samples use 'http://example.com/' for our example namespace but python-stix uses 'http://example.com' by removing the former. """ example_prefix = 'example' # Example ns prefix idgen_prefix = idgen...
[ "def", "_fix_example_namespace", "(", "self", ")", ":", "example_prefix", "=", "'example'", "# Example ns prefix", "idgen_prefix", "=", "idgen", ".", "get_id_namespace_prefix", "(", ")", "# If the ID namespace alias doesn't match the example alias, return.", "if", "idgen_prefix...
Attempts to resolve issues where our samples use 'http://example.com/' for our example namespace but python-stix uses 'http://example.com' by removing the former.
[ "Attempts", "to", "resolve", "issues", "where", "our", "samples", "use", "http", ":", "//", "example", ".", "com", "/", "for", "our", "example", "namespace", "but", "python", "-", "stix", "uses", "http", ":", "//", "example", ".", "com", "by", "removing"...
python
train
40.277778
CityOfZion/neo-python-core
neocore/UIntBase.py
https://github.com/CityOfZion/neo-python-core/blob/786c02cc2f41712d70b1f064ae3d67f86167107f/neocore/UIntBase.py#L33-L36
def GetHashCode(self): """uint32 identifier""" slice_length = 4 if len(self.Data) >= 4 else len(self.Data) return int.from_bytes(self.Data[:slice_length], 'little')
[ "def", "GetHashCode", "(", "self", ")", ":", "slice_length", "=", "4", "if", "len", "(", "self", ".", "Data", ")", ">=", "4", "else", "len", "(", "self", ".", "Data", ")", "return", "int", ".", "from_bytes", "(", "self", ".", "Data", "[", ":", "s...
uint32 identifier
[ "uint32", "identifier" ]
python
train
46.25
CellProfiler/centrosome
centrosome/cpmorphology.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/cpmorphology.py#L3378-L3402
def spur(image, mask=None, iterations=1): '''Remove spur pixels from an image 0 0 0 0 0 0 0 1 0 -> 0 0 0 0 0 1 0 0 ? ''' global spur_table_1,spur_table_2 if mask is None: masked_image = image else: masked_image = image.astype(bool).copy() masked_image[~...
[ "def", "spur", "(", "image", ",", "mask", "=", "None", ",", "iterations", "=", "1", ")", ":", "global", "spur_table_1", ",", "spur_table_2", "if", "mask", "is", "None", ":", "masked_image", "=", "image", "else", ":", "masked_image", "=", "image", ".", ...
Remove spur pixels from an image 0 0 0 0 0 0 0 1 0 -> 0 0 0 0 0 1 0 0 ?
[ "Remove", "spur", "pixels", "from", "an", "image", "0", "0", "0", "0", "0", "0", "0", "1", "0", "-", ">", "0", "0", "0", "0", "0", "1", "0", "0", "?" ]
python
train
35.68
pandas-dev/pandas
pandas/core/nanops.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/nanops.py#L276-L304
def _wrap_results(result, dtype, fill_value=None): """ wrap our results if needed """ if is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype): if fill_value is None: # GH#24293 fill_value = iNaT if not isinstance(result, np.ndarray): tz = getattr(dtype,...
[ "def", "_wrap_results", "(", "result", ",", "dtype", ",", "fill_value", "=", "None", ")", ":", "if", "is_datetime64_dtype", "(", "dtype", ")", "or", "is_datetime64tz_dtype", "(", "dtype", ")", ":", "if", "fill_value", "is", "None", ":", "# GH#24293", "fill_v...
wrap our results if needed
[ "wrap", "our", "results", "if", "needed" ]
python
train
35.586207
materialsproject/pymatgen
pymatgen/io/qchem_deprecated.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem_deprecated.py#L226-L233
def set_velocities(self, velocities): """ :param velocities (au): list of list of atom velocities :return: """ assert len(velocities) == len(self.mol) self.params["velocity"] = velocities
[ "def", "set_velocities", "(", "self", ",", "velocities", ")", ":", "assert", "len", "(", "velocities", ")", "==", "len", "(", "self", ".", "mol", ")", "self", ".", "params", "[", "\"velocity\"", "]", "=", "velocities" ]
:param velocities (au): list of list of atom velocities :return:
[ ":", "param", "velocities", "(", "au", ")", ":", "list", "of", "list", "of", "atom", "velocities", ":", "return", ":" ]
python
train
29.875
demurgos/py-pathmatch
tools/lint_string_prefix.py
https://github.com/demurgos/py-pathmatch/blob/70b3aa99ee34da8b80b6ec6340862b760159d2a1/tools/lint_string_prefix.py#L45-L53
def process_tokens(self, tokens): u""" Iterate other tokens to find strings and ensure that they are prefixed. :param tokens: :return: """ for (tok_type, token, (start_row, _), _, _) in tokens: if tok_type == tokenize.STRING: self._check_string...
[ "def", "process_tokens", "(", "self", ",", "tokens", ")", ":", "for", "(", "tok_type", ",", "token", ",", "(", "start_row", ",", "_", ")", ",", "_", ",", "_", ")", "in", "tokens", ":", "if", "tok_type", "==", "tokenize", ".", "STRING", ":", "self",...
u""" Iterate other tokens to find strings and ensure that they are prefixed. :param tokens: :return:
[ "u", "Iterate", "other", "tokens", "to", "find", "strings", "and", "ensure", "that", "they", "are", "prefixed", ".", ":", "param", "tokens", ":", ":", "return", ":" ]
python
train
36.666667
tensorflow/tensor2tensor
tensor2tensor/models/video/nfg_interpolate.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/nfg_interpolate.py#L153-L164
def get_summaries_log_dir(decode_hp, output_dir, dataset_split): """Get nested summaries_log_dir based on decode_hp.""" child_dir = decode_hp.summaries_log_dir level_dir = "".join([str(level) for level in decode_hp.level_interp]) if decode_hp.channel_interp == "all": rank_dir = "all" else: rank_dir = ...
[ "def", "get_summaries_log_dir", "(", "decode_hp", ",", "output_dir", ",", "dataset_split", ")", ":", "child_dir", "=", "decode_hp", ".", "summaries_log_dir", "level_dir", "=", "\"\"", ".", "join", "(", "[", "str", "(", "level", ")", "for", "level", "in", "de...
Get nested summaries_log_dir based on decode_hp.
[ "Get", "nested", "summaries_log_dir", "based", "on", "decode_hp", "." ]
python
train
43.666667
nickmasster/xsmtplib
xsmtplib/xsmtplib.py
https://github.com/nickmasster/xsmtplib/blob/0207f5c72f2fec03f3ebdb3acb3a56401805f32f/xsmtplib/xsmtplib.py#L132-L183
def connect_proxy(self, proxy_host='localhost', proxy_port=0, proxy_type=socks.HTTP, host='localhost', port=0): """Connect to a host on a given port via proxy server If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix w...
[ "def", "connect_proxy", "(", "self", ",", "proxy_host", "=", "'localhost'", ",", "proxy_port", "=", "0", ",", "proxy_type", "=", "socks", ".", "HTTP", ",", "host", "=", "'localhost'", ",", "port", "=", "0", ")", ":", "if", "proxy_type", "not", "in", "s...
Connect to a host on a given port via proxy server If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use. Note: This method is automatically invoked by __init__...
[ "Connect", "to", "a", "host", "on", "a", "given", "port", "via", "proxy", "server" ]
python
train
41
carta/ldap_tools
src/ldap_tools/group.py
https://github.com/carta/ldap_tools/blob/7c039304a5abaf836c7afc35cf068b4471306264/src/ldap_tools/group.py#L180-L190
def delete(config, group, force): """Delete an LDAP group.""" if not force: if not click.confirm( 'Confirm that you want to delete group {}'.format(group)): sys.exit("Deletion of {} aborted".format(group)) client = Client() client.prepare_...
[ "def", "delete", "(", "config", ",", "group", ",", "force", ")", ":", "if", "not", "force", ":", "if", "not", "click", ".", "confirm", "(", "'Confirm that you want to delete group {}'", ".", "format", "(", "group", ")", ")", ":", "sys", ".", "exit", "(",...
Delete an LDAP group.
[ "Delete", "an", "LDAP", "group", "." ]
python
train
35.090909
scikit-learn-contrib/hdbscan
hdbscan/plots.py
https://github.com/scikit-learn-contrib/hdbscan/blob/e40ccef139e56e38adf7bd6912cd63efd97598f9/hdbscan/plots.py#L457-L481
def to_pandas(self): """Return a pandas dataframe representation of the condensed tree. Each row of the dataframe corresponds to an edge in the tree. The columns of the dataframe are `parent`, `child`, `lambda_val` and `child_size`. The `parent` and `child` are the ids of the ...
[ "def", "to_pandas", "(", "self", ")", ":", "try", ":", "from", "pandas", "import", "DataFrame", ",", "Series", "except", "ImportError", ":", "raise", "ImportError", "(", "'You must have pandas installed to export pandas DataFrames'", ")", "result", "=", "DataFrame", ...
Return a pandas dataframe representation of the condensed tree. Each row of the dataframe corresponds to an edge in the tree. The columns of the dataframe are `parent`, `child`, `lambda_val` and `child_size`. The `parent` and `child` are the ids of the parent and child nodes in...
[ "Return", "a", "pandas", "dataframe", "representation", "of", "the", "condensed", "tree", "." ]
python
train
37.96
mila-iqia/fuel
fuel/downloaders/youtube_audio.py
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/downloaders/youtube_audio.py#L41-L57
def fill_subparser(subparser): """Sets up a subparser to download audio of YouTube videos. Adds the compulsory `--youtube-id` flag. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `youtube_audio` command. """ subparser.add_argument( ...
[ "def", "fill_subparser", "(", "subparser", ")", ":", "subparser", ".", "add_argument", "(", "'--youtube-id'", ",", "type", "=", "str", ",", "required", "=", "True", ",", "help", "=", "(", "\"The YouTube ID of the video from which to extract audio, \"", "\"usually an 1...
Sets up a subparser to download audio of YouTube videos. Adds the compulsory `--youtube-id` flag. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `youtube_audio` command.
[ "Sets", "up", "a", "subparser", "to", "download", "audio", "of", "YouTube", "videos", "." ]
python
train
29.117647
TheGhouls/oct
oct/results/output.py
https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/results/output.py#L12-L21
def generate_graphs(data, name, results_dir): """Generate all reports from original dataframe :param dic data: dict containing raw and compiled results dataframes :param str name: name for prefixing graphs output :param str results_dir: results output directory """ graphs.resp_graph_raw(data['r...
[ "def", "generate_graphs", "(", "data", ",", "name", ",", "results_dir", ")", ":", "graphs", ".", "resp_graph_raw", "(", "data", "[", "'raw'", "]", ",", "name", "+", "'_response_times.svg'", ",", "results_dir", ")", "graphs", ".", "resp_graph", "(", "data", ...
Generate all reports from original dataframe :param dic data: dict containing raw and compiled results dataframes :param str name: name for prefixing graphs output :param str results_dir: results output directory
[ "Generate", "all", "reports", "from", "original", "dataframe" ]
python
train
52.9
laike9m/pdir2
pdir/api.py
https://github.com/laike9m/pdir2/blob/c4550523fe9b54bf9b755ffa28900a5e9f493d02/pdir/api.py#L74-L94
def search(self, term: str, case_sensitive: bool = False) -> 'PrettyDir': """Searches for names that match some pattern. Args: term: String used to match names. A name is returned if it matches the whole search term. case_sensitive: Boolean to match case or not, de...
[ "def", "search", "(", "self", ",", "term", ":", "str", ",", "case_sensitive", ":", "bool", "=", "False", ")", "->", "'PrettyDir'", ":", "if", "case_sensitive", ":", "return", "PrettyDir", "(", "self", ".", "obj", ",", "[", "pattr", "for", "pattr", "in"...
Searches for names that match some pattern. Args: term: String used to match names. A name is returned if it matches the whole search term. case_sensitive: Boolean to match case or not, default is False (case insensitive). Return: A Prett...
[ "Searches", "for", "names", "that", "match", "some", "pattern", "." ]
python
train
36.142857
dropbox/stone
stone/frontend/ir_generator.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/frontend/ir_generator.py#L579-L597
def _merge_patches(self): """Injects object patches into their original object definitions.""" for patched_item, patched_namespace in self._patch_data_by_canonical_name.values(): patched_item_base_name = self._get_base_name(patched_item.name, patched_namespace.name) if patched_it...
[ "def", "_merge_patches", "(", "self", ")", ":", "for", "patched_item", ",", "patched_namespace", "in", "self", ".", "_patch_data_by_canonical_name", ".", "values", "(", ")", ":", "patched_item_base_name", "=", "self", ".", "_get_base_name", "(", "patched_item", "....
Injects object patches into their original object definitions.
[ "Injects", "object", "patches", "into", "their", "original", "object", "definitions", "." ]
python
train
59.263158
HacKanCuBa/passphrase-py
passphrase/calc.py
https://github.com/HacKanCuBa/passphrase-py/blob/219d6374338ed9a1475b4f09b0d85212376f11e0/passphrase/calc.py#L103-L136
def words_amount_needed(entropybits: Union[int, float], entropy_w: Union[int, float], entropy_n: Union[int, float], amount_n: int) -> int: """Calculate words needed for a passphrase based on entropy.""" # Thanks to @julianor for this tip to...
[ "def", "words_amount_needed", "(", "entropybits", ":", "Union", "[", "int", ",", "float", "]", ",", "entropy_w", ":", "Union", "[", "int", ",", "float", "]", ",", "entropy_n", ":", "Union", "[", "int", ",", "float", "]", ",", "amount_n", ":", "int", ...
Calculate words needed for a passphrase based on entropy.
[ "Calculate", "words", "needed", "for", "a", "passphrase", "based", "on", "entropy", "." ]
python
train
43.235294
ethpm/py-ethpm
ethpm/utils/manifest_validation.py
https://github.com/ethpm/py-ethpm/blob/81ed58d7c636fe00c6770edeb0401812b1a5e8fc/ethpm/utils/manifest_validation.py#L21-L42
def validate_meta_object(meta: Dict[str, Any], allow_extra_meta_fields: bool) -> None: """ Validates that every key is one of `META_FIELDS` and has a value of the expected type. """ for key, value in meta.items(): if key in META_FIELDS: if type(value) is not META_FIELDS[key]: ...
[ "def", "validate_meta_object", "(", "meta", ":", "Dict", "[", "str", ",", "Any", "]", ",", "allow_extra_meta_fields", ":", "bool", ")", "->", "None", ":", "for", "key", ",", "value", "in", "meta", ".", "items", "(", ")", ":", "if", "key", "in", "META...
Validates that every key is one of `META_FIELDS` and has a value of the expected type.
[ "Validates", "that", "every", "key", "is", "one", "of", "META_FIELDS", "and", "has", "a", "value", "of", "the", "expected", "type", "." ]
python
train
43.454545
raphaelgyory/django-rest-messaging
rest_messaging/models.py
https://github.com/raphaelgyory/django-rest-messaging/blob/c9d5405fed7db2d79ec5c93c721a8fe42ea86958/rest_messaging/models.py#L191-L194
def return_daily_messages_count(self, sender): """ Returns the number of messages sent in the last 24 hours so we can ensure the user does not exceed his messaging limits """ h24 = now() - timedelta(days=1) return Message.objects.filter(sender=sender, sent_at__gte=h24).count()
[ "def", "return_daily_messages_count", "(", "self", ",", "sender", ")", ":", "h24", "=", "now", "(", ")", "-", "timedelta", "(", "days", "=", "1", ")", "return", "Message", ".", "objects", ".", "filter", "(", "sender", "=", "sender", ",", "sent_at__gte", ...
Returns the number of messages sent in the last 24 hours so we can ensure the user does not exceed his messaging limits
[ "Returns", "the", "number", "of", "messages", "sent", "in", "the", "last", "24", "hours", "so", "we", "can", "ensure", "the", "user", "does", "not", "exceed", "his", "messaging", "limits" ]
python
train
74.5
sammchardy/python-kucoin
kucoin/client.py
https://github.com/sammchardy/python-kucoin/blob/a4cacde413804784bd313f27a0ad37234888be29/kucoin/client.py#L1324-L1404
def get_fills(self, order_id=None, symbol=None, side=None, order_type=None, start=None, end=None, page=None, limit=None): """Get a list of recent fills. https://docs.kucoin.com/#list-fills :param order_id: (optional) generated order id :type order_id: string :...
[ "def", "get_fills", "(", "self", ",", "order_id", "=", "None", ",", "symbol", "=", "None", ",", "side", "=", "None", ",", "order_type", "=", "None", ",", "start", "=", "None", ",", "end", "=", "None", ",", "page", "=", "None", ",", "limit", "=", ...
Get a list of recent fills. https://docs.kucoin.com/#list-fills :param order_id: (optional) generated order id :type order_id: string :param symbol: (optional) Name of symbol e.g. KCS-BTC :type symbol: string :param side: (optional) buy or sell :type side: strin...
[ "Get", "a", "list", "of", "recent", "fills", "." ]
python
train
31.061728
astropy/astropy-healpix
astropy_healpix/core.py
https://github.com/astropy/astropy-healpix/blob/c7fbe36305aadda9946dd37969d5dcb9ff6b1440/astropy_healpix/core.py#L345-L395
def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'): """ Convert HEALPix indices (optionally with offsets) to longitudes/latitudes. If no offsets (``dx`` and ``dy``) are provided, the coordinates will default to those at the center of the HEALPix pixels. Parameters ----...
[ "def", "healpix_to_lonlat", "(", "healpix_index", ",", "nside", ",", "dx", "=", "None", ",", "dy", "=", "None", ",", "order", "=", "'ring'", ")", ":", "_validate_nside", "(", "nside", ")", "if", "_validate_order", "(", "order", ")", "==", "'ring'", ":", ...
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes. If no offsets (``dx`` and ``dy``) are provided, the coordinates will default to those at the center of the HEALPix pixels. Parameters ---------- healpix_index : int or `~numpy.ndarray` HEALPix indices (as a scalar o...
[ "Convert", "HEALPix", "indices", "(", "optionally", "with", "offsets", ")", "to", "longitudes", "/", "latitudes", "." ]
python
train
30.137255
kytos/python-openflow
pyof/foundation/base.py
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/foundation/base.py#L784-L812
def pack(self, value=None): """Pack the message into a binary data. One of the basic operations on a Message is the pack operation. During the packing process, we convert all message attributes to binary format. Since that this is usually used before sending the message to a sw...
[ "def", "pack", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "self", ".", "update_header_length", "(", ")", "return", "super", "(", ")", ".", "pack", "(", ")", "elif", "isinstance", "(", "value", ",", "type", "...
Pack the message into a binary data. One of the basic operations on a Message is the pack operation. During the packing process, we convert all message attributes to binary format. Since that this is usually used before sending the message to a switch, here we also call :meth:`...
[ "Pack", "the", "message", "into", "a", "binary", "data", "." ]
python
train
34.862069
pyca/pyopenssl
src/OpenSSL/SSL.py
https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1389-L1402
def set_tlsext_use_srtp(self, profiles): """ Enable support for negotiating SRTP keying material. :param bytes profiles: A colon delimited list of protection profile names, like ``b'SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32'``. :return: None """ if not is...
[ "def", "set_tlsext_use_srtp", "(", "self", ",", "profiles", ")", ":", "if", "not", "isinstance", "(", "profiles", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"profiles must be a byte string.\"", ")", "_openssl_assert", "(", "_lib", ".", "SSL_CTX_set_tlsex...
Enable support for negotiating SRTP keying material. :param bytes profiles: A colon delimited list of protection profile names, like ``b'SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32'``. :return: None
[ "Enable", "support", "for", "negotiating", "SRTP", "keying", "material", "." ]
python
test
36.214286
DallasMorningNews/django-datafreezer
datafreezer/views.py
https://github.com/DallasMorningNews/django-datafreezer/blob/982dcf2015c80a280f1a093e32977cb71d4ea7aa/datafreezer/views.py#L690-L735
def get(self, request): """View for HTTP GET method. Returns template and context from generate_page_title and generate_sections to populate template. """ sections = self.generate_sections() if self.paginated: p = Paginator(sections, 25) page = ...
[ "def", "get", "(", "self", ",", "request", ")", ":", "sections", "=", "self", ".", "generate_sections", "(", ")", "if", "self", ".", "paginated", ":", "p", "=", "Paginator", "(", "sections", ",", "25", ")", "page", "=", "request", ".", "GET", ".", ...
View for HTTP GET method. Returns template and context from generate_page_title and generate_sections to populate template.
[ "View", "for", "HTTP", "GET", "method", "." ]
python
train
27.326087
PythonCharmers/python-future
src/future/backports/urllib/parse.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/urllib/parse.py#L930-L949
def splitnport(host, defport=-1): """Split host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.""" global _nportprog if _nportprog is None: ...
[ "def", "splitnport", "(", "host", ",", "defport", "=", "-", "1", ")", ":", "global", "_nportprog", "if", "_nportprog", "is", "None", ":", "import", "re", "_nportprog", "=", "re", ".", "compile", "(", "'^(.*):(.*)$'", ")", "match", "=", "_nportprog", ".",...
Split host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.
[ "Split", "host", "and", "port", "returning", "numeric", "port", ".", "Return", "given", "default", "port", "if", "no", ":", "found", ";", "defaults", "to", "-", "1", ".", "Return", "numerical", "port", "if", "a", "valid", "number", "are", "found", "after...
python
train
32.45
mikedh/trimesh
trimesh/path/util.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/util.py#L4-L28
def is_ccw(points): """ Check if connected planar points are counterclockwise. Parameters ----------- points: (n,2) float, connected points on a plane Returns ---------- ccw: bool, True if points are counterclockwise """ points = np.asanyarray(points, dtype=np.float64) if ...
[ "def", "is_ccw", "(", "points", ")", ":", "points", "=", "np", ".", "asanyarray", "(", "points", ",", "dtype", "=", "np", ".", "float64", ")", "if", "(", "len", "(", "points", ".", "shape", ")", "!=", "2", "or", "points", ".", "shape", "[", "1", ...
Check if connected planar points are counterclockwise. Parameters ----------- points: (n,2) float, connected points on a plane Returns ---------- ccw: bool, True if points are counterclockwise
[ "Check", "if", "connected", "planar", "points", "are", "counterclockwise", "." ]
python
train
25.16
gamechanger/schemer
schemer/__init__.py
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L183-L215
def _validate_instance(self, instance, errors, path_prefix=''): """Validates that the given instance of a document conforms to the given schema's structure and validations. Any validation errors are added to the given errors collection. The caller should assume the instance is considered valid i...
[ "def", "_validate_instance", "(", "self", ",", "instance", ",", "errors", ",", "path_prefix", "=", "''", ")", ":", "if", "not", "isinstance", "(", "instance", ",", "dict", ")", ":", "errors", "[", "path_prefix", "]", "=", "\"Expected instance of dict to valida...
Validates that the given instance of a document conforms to the given schema's structure and validations. Any validation errors are added to the given errors collection. The caller should assume the instance is considered valid if the errors collection is empty when this method returns.
[ "Validates", "that", "the", "given", "instance", "of", "a", "document", "conforms", "to", "the", "given", "schema", "s", "structure", "and", "validations", ".", "Any", "validation", "errors", "are", "added", "to", "the", "given", "errors", "collection", ".", ...
python
train
49.939394
apache/airflow
airflow/hooks/presto_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/presto_hook.py#L129-L140
def insert_rows(self, table, rows, target_fields=None): """ A generic way to insert a set of tuples into a table. :param table: Name of the target table :type table: str :param rows: The rows to insert into the table :type rows: iterable of tuples :param target_f...
[ "def", "insert_rows", "(", "self", ",", "table", ",", "rows", ",", "target_fields", "=", "None", ")", ":", "super", "(", ")", ".", "insert_rows", "(", "table", ",", "rows", ",", "target_fields", ",", "0", ")" ]
A generic way to insert a set of tuples into a table. :param table: Name of the target table :type table: str :param rows: The rows to insert into the table :type rows: iterable of tuples :param target_fields: The names of the columns to fill in the table :type target_fi...
[ "A", "generic", "way", "to", "insert", "a", "set", "of", "tuples", "into", "a", "table", "." ]
python
test
40.083333
ethpm/py-ethpm
ethpm/tools/builder.py
https://github.com/ethpm/py-ethpm/blob/81ed58d7c636fe00c6770edeb0401812b1a5e8fc/ethpm/tools/builder.py#L553-L580
def deployment( *, block_uri: URI, contract_instance: str, contract_type: str, address: HexStr, transaction: HexStr = None, block: HexStr = None, deployment_bytecode: Dict[str, Any] = None, runtime_bytecode: Dict[str, Any] = None, compiler: Dict[str, Any] = None, ) -> Manifest: ...
[ "def", "deployment", "(", "*", ",", "block_uri", ":", "URI", ",", "contract_instance", ":", "str", ",", "contract_type", ":", "str", ",", "address", ":", "HexStr", ",", "transaction", ":", "HexStr", "=", "None", ",", "block", ":", "HexStr", "=", "None", ...
Returns a manifest, with the newly included deployment. Requires a valid blockchain URI, however no validation is provided that this URI is unique amongst the other deployment URIs, so the user must take care that each blockchain URI represents a unique blockchain.
[ "Returns", "a", "manifest", "with", "the", "newly", "included", "deployment", ".", "Requires", "a", "valid", "blockchain", "URI", "however", "no", "validation", "is", "provided", "that", "this", "URI", "is", "unique", "amongst", "the", "other", "deployment", "...
python
train
28.928571
cytoscape/py2cytoscape
py2cytoscape/cyrest/cybrowser.py
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cybrowser.py#L29-L40
def hide(self, wid, verbose=False): """ Hide and HTML browser in the Results Panel. :param wid: Window ID :param verbose: print more """ PARAMS={"id":wid} response=api(url=self.__url+"/hide?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
[ "def", "hide", "(", "self", ",", "wid", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "\"id\"", ":", "wid", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/hide?\"", ",", "PARAMS", "=", "PARAMS", ",", "m...
Hide and HTML browser in the Results Panel. :param wid: Window ID :param verbose: print more
[ "Hide", "and", "HTML", "browser", "in", "the", "Results", "Panel", "." ]
python
train
25.75
sassoo/goldman
goldman/deserializers/jsonapi.py
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/deserializers/jsonapi.py#L221-L238
def _parse_top_level(self, body): """ Ensure compliance with the spec's top-level section """ link = 'jsonapi.org/format/#document-top-level' try: if not isinstance(body['data'], dict): raise TypeError except (KeyError, TypeError): self.fail('JSO...
[ "def", "_parse_top_level", "(", "self", ",", "body", ")", ":", "link", "=", "'jsonapi.org/format/#document-top-level'", "try", ":", "if", "not", "isinstance", "(", "body", "[", "'data'", "]", ",", "dict", ")", ":", "raise", "TypeError", "except", "(", "KeyEr...
Ensure compliance with the spec's top-level section
[ "Ensure", "compliance", "with", "the", "spec", "s", "top", "-", "level", "section" ]
python
train
43.277778
SheffieldML/GPy
GPy/util/multioutput.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/multioutput.py#L43-L59
def ICM(input_dim, num_outputs, kernel, W_rank=1,W=None,kappa=None,name='ICM'): """ Builds a kernel for an Intrinsic Coregionalization Model :input_dim: Input dimensionality (does not include dimension of indices) :num_outputs: Number of outputs :param kernel: kernel that will be multiplied by the ...
[ "def", "ICM", "(", "input_dim", ",", "num_outputs", ",", "kernel", ",", "W_rank", "=", "1", ",", "W", "=", "None", ",", "kappa", "=", "None", ",", "name", "=", "'ICM'", ")", ":", "if", "kernel", ".", "input_dim", "!=", "input_dim", ":", "kernel", "...
Builds a kernel for an Intrinsic Coregionalization Model :input_dim: Input dimensionality (does not include dimension of indices) :num_outputs: Number of outputs :param kernel: kernel that will be multiplied by the coregionalize kernel (matrix B). :type kernel: a GPy kernel :param W_rank: number tu...
[ "Builds", "a", "kernel", "for", "an", "Intrinsic", "Coregionalization", "Model" ]
python
train
46.294118
delph-in/pydelphin
delphin/commands.py
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/commands.py#L625-L678
def compare(testsuite, gold, select='i-id i-input mrs'): """ Compare two [incr tsdb()] profiles. Args: testsuite (str, TestSuite): path to the test [incr tsdb()] testsuite or a :class:`TestSuite` object gold (str, TestSuite): path to the gold [incr tsdb()] testsuite ...
[ "def", "compare", "(", "testsuite", ",", "gold", ",", "select", "=", "'i-id i-input mrs'", ")", ":", "from", "delphin", ".", "mrs", "import", "simplemrs", ",", "compare", "as", "mrs_compare", "if", "not", "isinstance", "(", "testsuite", ",", "itsdb", ".", ...
Compare two [incr tsdb()] profiles. Args: testsuite (str, TestSuite): path to the test [incr tsdb()] testsuite or a :class:`TestSuite` object gold (str, TestSuite): path to the gold [incr tsdb()] testsuite or a :class:`TestSuite` object select: TSQL query to select (...
[ "Compare", "two", "[", "incr", "tsdb", "()", "]", "profiles", "." ]
python
train
37.111111
pywbem/pywbem
attic/twisted_client.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/twisted_client.py#L58-L88
def connectionMade(self): """Send a HTTP POST command with the appropriate CIM over HTTP headers and payload.""" self.factory.request_xml = str(self.factory.payload) self.sendCommand('POST', '/cimom') self.sendHeader('Host', '%s:%d' % (self.transport.ad...
[ "def", "connectionMade", "(", "self", ")", ":", "self", ".", "factory", ".", "request_xml", "=", "str", "(", "self", ".", "factory", ".", "payload", ")", "self", ".", "sendCommand", "(", "'POST'", ",", "'/cimom'", ")", "self", ".", "sendHeader", "(", "...
Send a HTTP POST command with the appropriate CIM over HTTP headers and payload.
[ "Send", "a", "HTTP", "POST", "command", "with", "the", "appropriate", "CIM", "over", "HTTP", "headers", "and", "payload", "." ]
python
train
39.225806
mattjj/pylds
pylds/laplace.py
https://github.com/mattjj/pylds/blob/e946bfa5aa76e8f8284614561a0f40ffd5d868fb/pylds/laplace.py#L133-L162
def gradient_log_joint(self, x): """ The gradient of the log joint probability. For the Gaussian terms, this is d/dx [-1/2 x^T J x + h^T x] = -Jx + h. For the likelihood terms, we have for each time t d/dx log p(yt | xt) """ T, D = self.T, self...
[ "def", "gradient_log_joint", "(", "self", ",", "x", ")", ":", "T", ",", "D", "=", "self", ".", "T", ",", "self", ".", "D_latent", "assert", "x", ".", "shape", "==", "(", "T", ",", "D", ")", "# Collect the Gaussian LDS prior terms", "_", ",", "h_init", ...
The gradient of the log joint probability. For the Gaussian terms, this is d/dx [-1/2 x^T J x + h^T x] = -Jx + h. For the likelihood terms, we have for each time t d/dx log p(yt | xt)
[ "The", "gradient", "of", "the", "log", "joint", "probability", "." ]
python
train
27.666667
juju/python-libjuju
juju/client/_client2.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/client/_client2.py#L5638-L5651
async def SetMeterStatus(self, statues): ''' statues : typing.Sequence[~MeterStatusParam] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='MetricsDebug', request='SetMeterStatus', ...
[ "async", "def", "SetMeterStatus", "(", "self", ",", "statues", ")", ":", "# map input types to rpc msg", "_params", "=", "dict", "(", ")", "msg", "=", "dict", "(", "type", "=", "'MetricsDebug'", ",", "request", "=", "'SetMeterStatus'", ",", "version", "=", "...
statues : typing.Sequence[~MeterStatusParam] Returns -> typing.Sequence[~ErrorResult]
[ "statues", ":", "typing", ".", "Sequence", "[", "~MeterStatusParam", "]", "Returns", "-", ">", "typing", ".", "Sequence", "[", "~ErrorResult", "]" ]
python
train
32.785714
krukas/Trionyx
trionyx/trionyx/views/core.py
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L278-L294
def get_items(self, paginator, current_page): """Get list items for current page""" fields = self.get_model_config().get_list_fields() page = paginator.page(current_page) items = [] for item in page: items.append({ 'id': item.id, 'url...
[ "def", "get_items", "(", "self", ",", "paginator", ",", "current_page", ")", ":", "fields", "=", "self", ".", "get_model_config", "(", ")", ".", "get_list_fields", "(", ")", "page", "=", "paginator", ".", "page", "(", "current_page", ")", "items", "=", "...
Get list items for current page
[ "Get", "list", "items", "for", "current", "page" ]
python
train
31.352941
mdickinson/bigfloat
bigfloat/core.py
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L171-L197
def _format_finite(negative, digits, dot_pos): """Given a (possibly empty) string of digits and an integer dot_pos indicating the position of the decimal point relative to the start of that string, output a formatted numeric string with the same value and same implicit exponent.""" # strip leading ...
[ "def", "_format_finite", "(", "negative", ",", "digits", ",", "dot_pos", ")", ":", "# strip leading zeros", "olddigits", "=", "digits", "digits", "=", "digits", ".", "lstrip", "(", "'0'", ")", "dot_pos", "-=", "len", "(", "olddigits", ")", "-", "len", "(",...
Given a (possibly empty) string of digits and an integer dot_pos indicating the position of the decimal point relative to the start of that string, output a formatted numeric string with the same value and same implicit exponent.
[ "Given", "a", "(", "possibly", "empty", ")", "string", "of", "digits", "and", "an", "integer", "dot_pos", "indicating", "the", "position", "of", "the", "decimal", "point", "relative", "to", "the", "start", "of", "that", "string", "output", "a", "formatted", ...
python
train
36.740741
JarryShaw/PyPCAPKit
src/protocols/internet/internet.py
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/internet.py#L77-L111
def _decode_next_layer(self, dict_, proto=None, length=None, *, version=4, ipv6_exthdr=None): """Decode next layer extractor. Positional arguments: * dict_ -- dict, info buffer * proto -- str, next layer protocol name * length -- int, valid (not padding) length ...
[ "def", "_decode_next_layer", "(", "self", ",", "dict_", ",", "proto", "=", "None", ",", "length", "=", "None", ",", "*", ",", "version", "=", "4", ",", "ipv6_exthdr", "=", "None", ")", ":", "if", "self", ".", "_onerror", ":", "next_", "=", "beholder"...
Decode next layer extractor. Positional arguments: * dict_ -- dict, info buffer * proto -- str, next layer protocol name * length -- int, valid (not padding) length Keyword Arguments: * version -- int, IP version (4 in default) ...
[ "Decode", "next", "layer", "extractor", "." ]
python
train
37.8
guaix-ucm/numina
numina/instrument/simulation/atmosphere.py
https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/instrument/simulation/atmosphere.py#L78-L89
def generate_moffat_profile(seeing_fwhm, alpha): """Generate a normalized Moffat profile from its FWHM and alpha""" scale = 2 * math.sqrt(2**(1.0 / alpha) - 1) gamma = seeing_fwhm / scale amplitude = 1.0 / math.pi * (alpha - 1) / gamma**2 seeing_model = Moffat2D(amplitude=amplitude, ...
[ "def", "generate_moffat_profile", "(", "seeing_fwhm", ",", "alpha", ")", ":", "scale", "=", "2", "*", "math", ".", "sqrt", "(", "2", "**", "(", "1.0", "/", "alpha", ")", "-", "1", ")", "gamma", "=", "seeing_fwhm", "/", "scale", "amplitude", "=", "1.0...
Generate a normalized Moffat profile from its FWHM and alpha
[ "Generate", "a", "normalized", "Moffat", "profile", "from", "its", "FWHM", "and", "alpha" ]
python
train
39.916667
saltstack/salt
salt/modules/boto_secgroup.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L406-L431
def delete(name=None, group_id=None, region=None, key=None, keyid=None, profile=None, vpc_id=None, vpc_name=None): ''' Delete a security group. CLI example:: salt myminion boto_secgroup.delete mysecgroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
[ "def", "delete", "(", "name", "=", "None", ",", "group_id", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ")", "...
Delete a security group. CLI example:: salt myminion boto_secgroup.delete mysecgroup
[ "Delete", "a", "security", "group", "." ]
python
train
34.923077
Fuyukai/ConfigMaster
configmaster/ConfigFile.py
https://github.com/Fuyukai/ConfigMaster/blob/8018aa415da55c84edaa8a49664f674758a14edd/configmaster/ConfigFile.py#L81-L90
def apply_defaults(self, other_config): """ Applies default values from a different ConfigObject or ConfigKey object to this ConfigObject. If there are any values in this object that are also in the default object, it will use the values from this object. """ if isinstance(other...
[ "def", "apply_defaults", "(", "self", ",", "other_config", ")", ":", "if", "isinstance", "(", "other_config", ",", "self", ".", "__class__", ")", ":", "self", ".", "config", ".", "load_from_dict", "(", "other_config", ".", "config", ",", "overwrite", "=", ...
Applies default values from a different ConfigObject or ConfigKey object to this ConfigObject. If there are any values in this object that are also in the default object, it will use the values from this object.
[ "Applies", "default", "values", "from", "a", "different", "ConfigObject", "or", "ConfigKey", "object", "to", "this", "ConfigObject", "." ]
python
train
49.7
cloudera/cm_api
python/examples/aws.py
https://github.com/cloudera/cm_api/blob/5d2512375bd94684b4da36df9e0d9177865ffcbb/python/examples/aws.py#L106-L117
def call_s3guard_prune(credential_name): """ Runs S3Guard prune command on external account associated with the given credential_name. """ # Get the AWS credential account associated with the credential account = get_external_account(api, credential_name) # Invoke the prune command for the account by its n...
[ "def", "call_s3guard_prune", "(", "credential_name", ")", ":", "# Get the AWS credential account associated with the credential", "account", "=", "get_external_account", "(", "api", ",", "credential_name", ")", "# Invoke the prune command for the account by its name", "cmd", "=", ...
Runs S3Guard prune command on external account associated with the given credential_name.
[ "Runs", "S3Guard", "prune", "command", "on", "external", "account", "associated", "with", "the", "given", "credential_name", "." ]
python
train
48.583333
onnx/onnxmltools
onnxutils/onnxconverter_common/topology.py
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxutils/onnxconverter_common/topology.py#L174-L194
def declare_local_variable(self, raw_name, type=None, prepend=False): ''' This function may create a new variable in this scope. If raw_name has been used to create other variables, the new variable will hide all other variables created using raw_name. ''' # Get unique ID for the...
[ "def", "declare_local_variable", "(", "self", ",", "raw_name", ",", "type", "=", "None", ",", "prepend", "=", "False", ")", ":", "# Get unique ID for the new variable", "onnx_name", "=", "self", ".", "get_unique_variable_name", "(", "raw_name", ")", "# Create the va...
This function may create a new variable in this scope. If raw_name has been used to create other variables, the new variable will hide all other variables created using raw_name.
[ "This", "function", "may", "create", "a", "new", "variable", "in", "this", "scope", ".", "If", "raw_name", "has", "been", "used", "to", "create", "other", "variables", "the", "new", "variable", "will", "hide", "all", "other", "variables", "created", "using",...
python
train
43.809524
ambitioninc/django-query-builder
querybuilder/query.py
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/query.py#L1324-L1337
def get_field_identifiers(self): """ Builds a list of the field identifiers for all tables and joined tables by calling ``get_field_identifiers()`` on each table :return: list of field identifiers :rtype: list of str """ field_identifiers = [] for table i...
[ "def", "get_field_identifiers", "(", "self", ")", ":", "field_identifiers", "=", "[", "]", "for", "table", "in", "self", ".", "tables", ":", "field_identifiers", "+=", "table", ".", "get_field_identifiers", "(", ")", "for", "join_item", "in", "self", ".", "j...
Builds a list of the field identifiers for all tables and joined tables by calling ``get_field_identifiers()`` on each table :return: list of field identifiers :rtype: list of str
[ "Builds", "a", "list", "of", "the", "field", "identifiers", "for", "all", "tables", "and", "joined", "tables", "by", "calling", "get_field_identifiers", "()", "on", "each", "table" ]
python
train
38.071429
leosartaj/tvstats
tvstats/graph.py
https://github.com/leosartaj/tvstats/blob/164fe736111d43869f8c9686e07a5ab1b9f22444/tvstats/graph.py#L7-L24
def graphdata(data): """returns ratings and episode number to be used for making graphs""" data = jh.get_ratings(data) num = 1 rating_final = [] episode_final = [] for k,v in data.iteritems(): rating=[] epinum=[] for r in v: if r != None: r...
[ "def", "graphdata", "(", "data", ")", ":", "data", "=", "jh", ".", "get_ratings", "(", "data", ")", "num", "=", "1", "rating_final", "=", "[", "]", "episode_final", "=", "[", "]", "for", "k", ",", "v", "in", "data", ".", "iteritems", "(", ")", ":...
returns ratings and episode number to be used for making graphs
[ "returns", "ratings", "and", "episode", "number", "to", "be", "used", "for", "making", "graphs" ]
python
train
27.444444
teepark/greenhouse
greenhouse/scheduler.py
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L779-L795
def remove_global_hook(handler): """remove a callback from the list of global hooks :param handler: the callback function, previously added with global_hook, to remove from the list of global hooks :type handler: function :returns: bool, whether the handler was removed from the global ...
[ "def", "remove_global_hook", "(", "handler", ")", ":", "for", "i", ",", "cb", "in", "enumerate", "(", "state", ".", "global_hooks", ")", ":", "cb", "=", "cb", "(", ")", "if", "cb", "is", "not", "None", "and", "cb", "is", "handler", ":", "state", "....
remove a callback from the list of global hooks :param handler: the callback function, previously added with global_hook, to remove from the list of global hooks :type handler: function :returns: bool, whether the handler was removed from the global hooks
[ "remove", "a", "callback", "from", "the", "list", "of", "global", "hooks" ]
python
train
33.117647
3DLIRIOUS/MeshLabXML
meshlabxml/transform.py
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/transform.py#L623-L655
def wrap2cylinder(script, radius=1, pitch=0, taper=0, pitch_func=None, taper_func=None): """Deform mesh around cylinder of radius and axis z y = 0 will be on the surface of radius "radius" pitch != 0 will create a helix, with distance "pitch" traveled in z for each rotation taper = ch...
[ "def", "wrap2cylinder", "(", "script", ",", "radius", "=", "1", ",", "pitch", "=", "0", ",", "taper", "=", "0", ",", "pitch_func", "=", "None", ",", "taper_func", "=", "None", ")", ":", "\"\"\"vert_function(s=s, x='(%s+y-taper)*sin(x/(%s+y))' % (radius, radius),\n...
Deform mesh around cylinder of radius and axis z y = 0 will be on the surface of radius "radius" pitch != 0 will create a helix, with distance "pitch" traveled in z for each rotation taper = change in r over z. E.g. a value of 0.5 will shrink r by 0.5 for every z length of 1
[ "Deform", "mesh", "around", "cylinder", "of", "radius", "and", "axis", "z" ]
python
test
44.545455
ic-labs/django-icekit
icekit_events/templatetags/events_tags.py
https://github.com/ic-labs/django-icekit/blob/c507ea5b1864303732c53ad7c5800571fca5fa94/icekit_events/templatetags/events_tags.py#L65-L83
def _format_with_same_year_and_month(format_specifier): """ Return a version of `format_specifier` that renders a date assuming it has the same year and month as another date. Usually this means ommitting the year and month. This can be overridden by specifying a format that has `_SAME_YEAR_S...
[ "def", "_format_with_same_year_and_month", "(", "format_specifier", ")", ":", "test_format_specifier", "=", "format_specifier", "+", "\"_SAME_YEAR_SAME_MONTH\"", "test_format", "=", "get_format", "(", "test_format_specifier", ",", "use_l10n", "=", "True", ")", "if", "test...
Return a version of `format_specifier` that renders a date assuming it has the same year and month as another date. Usually this means ommitting the year and month. This can be overridden by specifying a format that has `_SAME_YEAR_SAME_MONTH` appended to the name in the project's `formats` spec...
[ "Return", "a", "version", "of", "format_specifier", "that", "renders", "a", "date", "assuming", "it", "has", "the", "same", "year", "and", "month", "as", "another", "date", ".", "Usually", "this", "means", "ommitting", "the", "year", "and", "month", "." ]
python
train
45.105263
xeroc/python-graphenelib
graphenecommon/transactionbuilder.py
https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L367-L400
def constructTx(self): """ Construct the actual transaction and store it in the class's dict store """ ops = list() for op in self.ops: if isinstance(op, ProposalBuilder): # This operation is a proposal an needs to be deal with # di...
[ "def", "constructTx", "(", "self", ")", ":", "ops", "=", "list", "(", ")", "for", "op", "in", "self", ".", "ops", ":", "if", "isinstance", "(", "op", ",", "ProposalBuilder", ")", ":", "# This operation is a proposal an needs to be deal with", "# differently", ...
Construct the actual transaction and store it in the class's dict store
[ "Construct", "the", "actual", "transaction", "and", "store", "it", "in", "the", "class", "s", "dict", "store" ]
python
valid
37.911765
VirusTotal/yara-python
setup.py
https://github.com/VirusTotal/yara-python/blob/c3992bdc3a95d42e9df249ae92e726b74737e859/setup.py#L161-L273
def run(self): """Execute the build command.""" module = self.distribution.ext_modules[0] base_dir = os.path.dirname(__file__) if base_dir: os.chdir(base_dir) exclusions = [] for define in self.define or []: module.define_macros.append(define) for library in self.libraries o...
[ "def", "run", "(", "self", ")", ":", "module", "=", "self", ".", "distribution", ".", "ext_modules", "[", "0", "]", "base_dir", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "if", "base_dir", ":", "os", ".", "chdir", "(", "base_dir", ...
Execute the build command.
[ "Execute", "the", "build", "command", "." ]
python
train
36.327434
onelogin/python-saml
src/onelogin/saml2/logout_response.py
https://github.com/onelogin/python-saml/blob/9fe7a72da5b4caa1529c1640b52d2649447ce49b/src/onelogin/saml2/logout_response.py#L50-L60
def get_issuer(self): """ Gets the Issuer of the Logout Response Message :return: The Issuer :rtype: string """ issuer = None issuer_nodes = self.__query('/samlp:LogoutResponse/saml:Issuer') if len(issuer_nodes) == 1: issuer = OneLogin_Saml2_Ut...
[ "def", "get_issuer", "(", "self", ")", ":", "issuer", "=", "None", "issuer_nodes", "=", "self", ".", "__query", "(", "'/samlp:LogoutResponse/saml:Issuer'", ")", "if", "len", "(", "issuer_nodes", ")", "==", "1", ":", "issuer", "=", "OneLogin_Saml2_Utils", ".", ...
Gets the Issuer of the Logout Response Message :return: The Issuer :rtype: string
[ "Gets", "the", "Issuer", "of", "the", "Logout", "Response", "Message", ":", "return", ":", "The", "Issuer", ":", "rtype", ":", "string" ]
python
train
33.181818
inveniosoftware/invenio-oauthclient
invenio_oauthclient/handlers.py
https://github.com/inveniosoftware/invenio-oauthclient/blob/2500dc6935738107617aeade79e050d7608004bb/invenio_oauthclient/handlers.py#L266-L348
def authorized_signup_handler(resp, remote, *args, **kwargs): """Handle sign-in/up functionality. :param remote: The remote application. :param resp: The response. :returns: Redirect response. """ # Remove any previously stored auto register session key session.pop(token_session_key(remote....
[ "def", "authorized_signup_handler", "(", "resp", ",", "remote", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Remove any previously stored auto register session key", "session", ".", "pop", "(", "token_session_key", "(", "remote", ".", "name", ")", "+", ...
Handle sign-in/up functionality. :param remote: The remote application. :param resp: The response. :returns: Redirect response.
[ "Handle", "sign", "-", "in", "/", "up", "functionality", "." ]
python
train
34.012048
materialsproject/pymatgen
pymatgen/analysis/pourbaix_diagram.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L796-L846
def get_pourbaix_plot(self, limits=None, title="", label_domains=True, plt=None): """ Plot Pourbaix diagram. Args: limits: 2D list containing limits of the Pourbaix diagram of the form [[xlo, xhi], [ylo, yhi]] title (str): Title ...
[ "def", "get_pourbaix_plot", "(", "self", ",", "limits", "=", "None", ",", "title", "=", "\"\"", ",", "label_domains", "=", "True", ",", "plt", "=", "None", ")", ":", "if", "limits", "is", "None", ":", "limits", "=", "[", "[", "-", "2", ",", "16", ...
Plot Pourbaix diagram. Args: limits: 2D list containing limits of the Pourbaix diagram of the form [[xlo, xhi], [ylo, yhi]] title (str): Title to display on plot label_domains (bool): whether to label pourbaix domains plt (pyplot): Pyplot instance...
[ "Plot", "Pourbaix", "diagram", "." ]
python
train
38.176471
google/openhtf
openhtf/plugs/usb/filesync_service.py
https://github.com/google/openhtf/blob/655e85df7134db7bdf8f8fdd6ff9a6bf932e7b09/openhtf/plugs/usb/filesync_service.py#L230-L265
def send(self, src_file, filename, st_mode=DEFAULT_PUSH_MODE, mtime=None, timeout=None): """Push a file-like object to the device. Args: src_file: File-like object for reading from filename: Filename to push to on the device st_mode: stat mode for filename on the device mtime...
[ "def", "send", "(", "self", ",", "src_file", ",", "filename", ",", "st_mode", "=", "DEFAULT_PUSH_MODE", ",", "mtime", "=", "None", ",", "timeout", "=", "None", ")", ":", "transport", "=", "DataFilesyncTransport", "(", "self", ".", "stream", ")", "transport...
Push a file-like object to the device. Args: src_file: File-like object for reading from filename: Filename to push to on the device st_mode: stat mode for filename on the device mtime: modification time to set for the file on the device timeout: Timeout to use for the send operation....
[ "Push", "a", "file", "-", "like", "object", "to", "the", "device", "." ]
python
train
38.888889
shidenggui/easyquotation
easyquotation/jsl.py
https://github.com/shidenggui/easyquotation/blob/a75820db4f05f5386e1c1024d05b0bfc1de6cbda/easyquotation/jsl.py#L268-L323
def fundarb( self, jsl_username, jsl_password, avolume=100, bvolume=100, ptype="price", ): """以字典形式返回分级A数据 :param jsl_username: 集思录用户名 :param jsl_password: 集思路登录密码 :param avolume: A成交额,单位百万 :param bvolume: B成交额,单位百万 :par...
[ "def", "fundarb", "(", "self", ",", "jsl_username", ",", "jsl_password", ",", "avolume", "=", "100", ",", "bvolume", "=", "100", ",", "ptype", "=", "\"price\"", ",", ")", ":", "session", "=", "requests", ".", "session", "(", ")", "headers", "=", "{", ...
以字典形式返回分级A数据 :param jsl_username: 集思录用户名 :param jsl_password: 集思路登录密码 :param avolume: A成交额,单位百万 :param bvolume: B成交额,单位百万 :param ptype: 溢价计算方式,price=现价,buy=买一,sell=卖一
[ "以字典形式返回分级A数据", ":", "param", "jsl_username", ":", "集思录用户名", ":", "param", "jsl_password", ":", "集思路登录密码", ":", "param", "avolume", ":", "A成交额,单位百万", ":", "param", "bvolume", ":", "B成交额,单位百万", ":", "param", "ptype", ":", "溢价计算方式,price", "=", "现价,buy", "=", "...
python
train
26.392857
kejbaly2/metrique
metrique/plotting.py
https://github.com/kejbaly2/metrique/blob/a10b076097441b7dde687949139f702f5c1e1b35/metrique/plotting.py#L246-L262
def line(self, x, label=None, y='bottom', color='grey', **kwargs): ''' Creates a vertical line in the plot. :param x: The x coordinate of the line. Should be in the same units as the x-axis. :param string label: The label to be displayed. :par...
[ "def", "line", "(", "self", ",", "x", ",", "label", "=", "None", ",", "y", "=", "'bottom'", ",", "color", "=", "'grey'", ",", "*", "*", "kwargs", ")", ":", "super", "(", "DiffPlotter", ",", "self", ")", ".", "line", "(", "x", ",", "label", ",",...
Creates a vertical line in the plot. :param x: The x coordinate of the line. Should be in the same units as the x-axis. :param string label: The label to be displayed. :param y: May be 'top', 'bottom' or int. The y coordinate of the te...
[ "Creates", "a", "vertical", "line", "in", "the", "plot", "." ]
python
train
36.941176
pymupdf/PyMuPDF
fitz/fitz.py
https://github.com/pymupdf/PyMuPDF/blob/917f2d83482510e26ba0ff01fd2392c26f3a8e90/fitz/fitz.py#L2861-L2875
def deleteLink(self, linkdict): """Delete link if PDF""" CheckParent(self) val = _fitz.Page_deleteLink(self, linkdict) if linkdict["xref"] == 0: return linkid = linkdict["id"] try: linkobj = self._annot_refs[linkid] linkobj._erase() except...
[ "def", "deleteLink", "(", "self", ",", "linkdict", ")", ":", "CheckParent", "(", "self", ")", "val", "=", "_fitz", ".", "Page_deleteLink", "(", "self", ",", "linkdict", ")", "if", "linkdict", "[", "\"xref\"", "]", "==", "0", ":", "return", "linkid", "=...
Delete link if PDF
[ "Delete", "link", "if", "PDF" ]
python
train
23
readbeyond/aeneas
aeneas/logger.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/logger.py#L144-L165
def log(self, message, severity=INFO, tag=u""): """ Add a given message to the log, and return its time. :param string message: the message to be added :param severity: the severity of the message :type severity: :class:`~aeneas.logger.Logger` :param string tag: the tag...
[ "def", "log", "(", "self", ",", "message", ",", "severity", "=", "INFO", ",", "tag", "=", "u\"\"", ")", ":", "entry", "=", "_LogEntry", "(", "severity", "=", "severity", ",", "time", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ",", "tag...
Add a given message to the log, and return its time. :param string message: the message to be added :param severity: the severity of the message :type severity: :class:`~aeneas.logger.Logger` :param string tag: the tag associated with the message; usually, th...
[ "Add", "a", "given", "message", "to", "the", "log", "and", "return", "its", "time", "." ]
python
train
37.590909
pyblish/pyblish-maya
pyblish_maya/lib.py
https://github.com/pyblish/pyblish-maya/blob/75db8b5d8de9d53ae95e74195a788b5f6db2cb5f/pyblish_maya/lib.py#L209-L230
def maintained_selection(): """Maintain selection during context Example: >>> with maintained_selection(): ... # Modify selection ... cmds.select('node', replace=True) >>> # Selection restored """ previous_selection = cmds.ls(selection=True) try: yi...
[ "def", "maintained_selection", "(", ")", ":", "previous_selection", "=", "cmds", ".", "ls", "(", "selection", "=", "True", ")", "try", ":", "yield", "finally", ":", "if", "previous_selection", ":", "cmds", ".", "select", "(", "previous_selection", ",", "repl...
Maintain selection during context Example: >>> with maintained_selection(): ... # Modify selection ... cmds.select('node', replace=True) >>> # Selection restored
[ "Maintain", "selection", "during", "context" ]
python
test
25.409091
saltstack/salt
salt/modules/winrepo.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/winrepo.py#L81-L122
def update_git_repos(clean=False): ''' Checkout git repos containing :ref:`Windows Software Package Definitions <windows-package-manager>`. .. important:: This function requires `Git for Windows`_ to be installed in order to work. When installing, make sure to select an installation opt...
[ "def", "update_git_repos", "(", "clean", "=", "False", ")", ":", "if", "not", "salt", ".", "utils", ".", "path", ".", "which", "(", "'git'", ")", ":", "raise", "CommandExecutionError", "(", "'Git for Windows is not installed, or not configured to be '", "'accessible...
Checkout git repos containing :ref:`Windows Software Package Definitions <windows-package-manager>`. .. important:: This function requires `Git for Windows`_ to be installed in order to work. When installing, make sure to select an installation option which permits the git executable to...
[ "Checkout", "git", "repos", "containing", ":", "ref", ":", "Windows", "Software", "Package", "Definitions", "<windows", "-", "package", "-", "manager", ">", "." ]
python
train
34.595238
SHTOOLS/SHTOOLS
pyshtools/shclasses/shcoeffsgrid.py
https://github.com/SHTOOLS/SHTOOLS/blob/9a115cf83002df2ddec6b7f41aeb6be688e285de/pyshtools/shclasses/shcoeffsgrid.py#L1729-L1749
def _make_complex(self): """Convert the real SHCoeffs class to the complex class.""" rcomplex_coeffs = _shtools.SHrtoc(self.coeffs, convention=1, switchcs=0) # These coefficients are using real floats, and need to be # converted to complex form....
[ "def", "_make_complex", "(", "self", ")", ":", "rcomplex_coeffs", "=", "_shtools", ".", "SHrtoc", "(", "self", ".", "coeffs", ",", "convention", "=", "1", ",", "switchcs", "=", "0", ")", "# These coefficients are using real floats, and need to be", "# converted to c...
Convert the real SHCoeffs class to the complex class.
[ "Convert", "the", "real", "SHCoeffs", "class", "to", "the", "complex", "class", "." ]
python
train
49.142857
yaml/pyyaml
lib/yaml/__init__.py
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L303-L309
def safe_dump(data, stream=None, **kwds): """ Serialize a Python object into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. """ return dump_all([data], stream, Dumper=SafeDumper, **kwds)
[ "def", "safe_dump", "(", "data", ",", "stream", "=", "None", ",", "*", "*", "kwds", ")", ":", "return", "dump_all", "(", "[", "data", "]", ",", "stream", ",", "Dumper", "=", "SafeDumper", ",", "*", "*", "kwds", ")" ]
Serialize a Python object into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead.
[ "Serialize", "a", "Python", "object", "into", "a", "YAML", "stream", ".", "Produce", "only", "basic", "YAML", "tags", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
python
train
36.714286