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
annoviko/pyclustering
pyclustering/cluster/clique.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/clique.py#L626-L640
def __validate_arguments(self): """! @brief Check input arguments of CLIQUE algorithm and if one of them is not correct then appropriate exception is thrown. """ if len(self.__data) == 0: raise ValueError("Empty input data. Data should contain at lea...
[ "def", "__validate_arguments", "(", "self", ")", ":", "if", "len", "(", "self", ".", "__data", ")", "==", "0", ":", "raise", "ValueError", "(", "\"Empty input data. Data should contain at least one point.\"", ")", "if", "self", ".", "__amount_intervals", "<=", "0"...
! @brief Check input arguments of CLIQUE algorithm and if one of them is not correct then appropriate exception is thrown.
[ "!" ]
python
valid
46.133333
bitesofcode/projexui
projexui/widgets/xwalkthroughwidget/xwalkthroughscene.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xwalkthroughwidget/xwalkthroughscene.py#L29-L44
def addGraphic(self, typ='basic'): """ Adds a new graphic to the scene. :param typ | <str> :return <XWalkthroughGraphic> || None """ cls = XWalkthroughGraphic.find(typ) if not cls: return None graphic = c...
[ "def", "addGraphic", "(", "self", ",", "typ", "=", "'basic'", ")", ":", "cls", "=", "XWalkthroughGraphic", ".", "find", "(", "typ", ")", "if", "not", "cls", ":", "return", "None", "graphic", "=", "cls", "(", ")", "self", ".", "addItem", "(", "graphic...
Adds a new graphic to the scene. :param typ | <str> :return <XWalkthroughGraphic> || None
[ "Adds", "a", "new", "graphic", "to", "the", "scene", ".", ":", "param", "typ", "|", "<str", ">", ":", "return", "<XWalkthroughGraphic", ">", "||", "None" ]
python
train
23.375
MacHu-GWU/pymongo_mate-project
pymongo_mate/pkg/pandas_mate/pkg/rolex/__init__.py
https://github.com/MacHu-GWU/pymongo_mate-project/blob/be53170c2db54cb705b9e548d32ef26c773ff7f3/pymongo_mate/pkg/pandas_mate/pkg/rolex/__init__.py#L626-L637
def add_minutes(self, datetimestr, n): """Returns a time that n minutes after a time. :param datetimestr: a datetime object or a datetime str :param n: number of minutes, value can be negative **中文文档** 返回给定日期N分钟之后的时间。 """ a_datetime = self.parse_datetime(dateti...
[ "def", "add_minutes", "(", "self", ",", "datetimestr", ",", "n", ")", ":", "a_datetime", "=", "self", ".", "parse_datetime", "(", "datetimestr", ")", "return", "a_datetime", "+", "timedelta", "(", "seconds", "=", "60", "*", "n", ")" ]
Returns a time that n minutes after a time. :param datetimestr: a datetime object or a datetime str :param n: number of minutes, value can be negative **中文文档** 返回给定日期N分钟之后的时间。
[ "Returns", "a", "time", "that", "n", "minutes", "after", "a", "time", "." ]
python
train
30.75
bethgelab/foolbox
foolbox/adversarial.py
https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L316-L369
def batch_predictions( self, images, greedy=False, strict=True, return_details=False): """Interface to model.batch_predictions for attacks. Parameters ---------- images : `numpy.ndarray` Batch of inputs with shape as expected by the model. greedy : bool ...
[ "def", "batch_predictions", "(", "self", ",", "images", ",", "greedy", "=", "False", ",", "strict", "=", "True", ",", "return_details", "=", "False", ")", ":", "if", "strict", ":", "in_bounds", "=", "self", ".", "in_bounds", "(", "images", ")", "assert",...
Interface to model.batch_predictions for attacks. Parameters ---------- images : `numpy.ndarray` Batch of inputs with shape as expected by the model. greedy : bool Whether the first adversarial should be returned. strict : bool Controls if the...
[ "Interface", "to", "model", ".", "batch_predictions", "for", "attacks", "." ]
python
valid
33.833333
rainwoodman/kdcount
kdcount/sphere.py
https://github.com/rainwoodman/kdcount/blob/483548f6d27a4f245cd5d98880b5f4edd6cc8dc1/kdcount/sphere.py#L167-L219
def ang2pix(nside, theta, phi): r"""Convert angle :math:`\theta` :math:`\phi` to pixel. This is translated from chealpix.c; but refer to Section 4.1 of http://adsabs.harvard.edu/abs/2005ApJ...622..759G """ nside, theta, phi = numpy.lib.stride_tricks.broadcast_arrays(nside, theta, phi) ...
[ "def", "ang2pix", "(", "nside", ",", "theta", ",", "phi", ")", ":", "nside", ",", "theta", ",", "phi", "=", "numpy", ".", "lib", ".", "stride_tricks", ".", "broadcast_arrays", "(", "nside", ",", "theta", ",", "phi", ")", "def", "equatorial", "(", "ns...
r"""Convert angle :math:`\theta` :math:`\phi` to pixel. This is translated from chealpix.c; but refer to Section 4.1 of http://adsabs.harvard.edu/abs/2005ApJ...622..759G
[ "r", "Convert", "angle", ":", "math", ":", "\\", "theta", ":", "math", ":", "\\", "phi", "to", "pixel", "." ]
python
train
31.509434
grundic/yagocd
yagocd/client.py
https://github.com/grundic/yagocd/blob/4c75336ae6f107c8723d37b15e52169151822127/yagocd/client.py#L266-L274
def package_repositories(self): """ Property for accessing :class:`PackageRepositoryManager` instance, which is used to manage package repos. :rtype: yagocd.resources.package_repository.PackageRepositoryManager """ if self._package_repository_manager is None: self._p...
[ "def", "package_repositories", "(", "self", ")", ":", "if", "self", ".", "_package_repository_manager", "is", "None", ":", "self", ".", "_package_repository_manager", "=", "PackageRepositoryManager", "(", "session", "=", "self", ".", "_session", ")", "return", "se...
Property for accessing :class:`PackageRepositoryManager` instance, which is used to manage package repos. :rtype: yagocd.resources.package_repository.PackageRepositoryManager
[ "Property", "for", "accessing", ":", "class", ":", "PackageRepositoryManager", "instance", "which", "is", "used", "to", "manage", "package", "repos", "." ]
python
train
48.333333
mozilla/amo-validator
validator/errorbundler.py
https://github.com/mozilla/amo-validator/blob/0251bfbd7d93106e01ecdb6de5fcd1dc1a180664/validator/errorbundler.py#L257-L261
def failed(self, fail_on_warnings=True): """Returns a boolean value describing whether the validation succeeded or not.""" return bool(self.errors) or (fail_on_warnings and bool(self.warnings))
[ "def", "failed", "(", "self", ",", "fail_on_warnings", "=", "True", ")", ":", "return", "bool", "(", "self", ".", "errors", ")", "or", "(", "fail_on_warnings", "and", "bool", "(", "self", ".", "warnings", ")", ")" ]
Returns a boolean value describing whether the validation succeeded or not.
[ "Returns", "a", "boolean", "value", "describing", "whether", "the", "validation", "succeeded", "or", "not", "." ]
python
train
42.8
Azure/azure-event-hubs-python
azure/eventprocessorhost/azure_storage_checkpoint_manager.py
https://github.com/Azure/azure-event-hubs-python/blob/737c5f966557ada2cf10fa0d8f3c19671ae96348/azure/eventprocessorhost/azure_storage_checkpoint_manager.py#L204-L241
async def get_lease_async(self, partition_id): """ Return the lease info for the specified partition. Can return null if no lease has been created in the store for the specified partition. :param partition_id: The partition ID. :type partition_id: str :return: lease info...
[ "async", "def", "get_lease_async", "(", "self", ",", "partition_id", ")", ":", "try", ":", "blob", "=", "await", "self", ".", "host", ".", "loop", ".", "run_in_executor", "(", "self", ".", "executor", ",", "functools", ".", "partial", "(", "self", ".", ...
Return the lease info for the specified partition. Can return null if no lease has been created in the store for the specified partition. :param partition_id: The partition ID. :type partition_id: str :return: lease info for the partition, or `None`. :rtype: ~azure.eventprocesso...
[ "Return", "the", "lease", "info", "for", "the", "specified", "partition", ".", "Can", "return", "null", "if", "no", "lease", "has", "been", "created", "in", "the", "store", "for", "the", "specified", "partition", "." ]
python
train
42.894737
globality-corp/microcosm
microcosm/loaders/environment.py
https://github.com/globality-corp/microcosm/blob/6856200ca295da4269c8c1c9de7db0b97c1f4523/microcosm/loaders/environment.py#L13-L43
def _load_from_environ(metadata, value_func=None): """ Load configuration from environment variables. Any environment variable prefixed with the metadata's name will be used to recursively set dictionary keys, splitting on '__'. :param value_func: a mutator for the envvar's value (if any) """...
[ "def", "_load_from_environ", "(", "metadata", ",", "value_func", "=", "None", ")", ":", "# We'll match the ennvar name against the metadata's name. The ennvar", "# name must be uppercase and hyphens in names converted to underscores.", "#", "# | envar | name | matches? |", "# +-...
Load configuration from environment variables. Any environment variable prefixed with the metadata's name will be used to recursively set dictionary keys, splitting on '__'. :param value_func: a mutator for the envvar's value (if any)
[ "Load", "configuration", "from", "environment", "variables", "." ]
python
train
35.612903
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7106-L7114
def validateDocument(self, doc): """Try to validate the document instance basically it does the all the checks described by the XML Rec i.e. validates the internal and external subset (if present) and validate the document tree. """ if doc is None: doc__o = None e...
[ "def", "validateDocument", "(", "self", ",", "doc", ")", ":", "if", "doc", "is", "None", ":", "doc__o", "=", "None", "else", ":", "doc__o", "=", "doc", ".", "_o", "ret", "=", "libxml2mod", ".", "xmlValidateDocument", "(", "self", ".", "_o", ",", "doc...
Try to validate the document instance basically it does the all the checks described by the XML Rec i.e. validates the internal and external subset (if present) and validate the document tree.
[ "Try", "to", "validate", "the", "document", "instance", "basically", "it", "does", "the", "all", "the", "checks", "described", "by", "the", "XML", "Rec", "i", ".", "e", ".", "validates", "the", "internal", "and", "external", "subset", "(", "if", "present",...
python
train
45.888889
jhuapl-boss/intern
intern/service/boss/v1/volume.py
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/v1/volume.py#L247-L283
def reserve_ids( self, resource, num_ids, url_prefix, auth, session, send_opts): """Reserve a block of unique, sequential ids for annotations. Args: resource (intern.resource.Resource): Resource should be an annotation channel. num_ids (int): Number of id...
[ "def", "reserve_ids", "(", "self", ",", "resource", ",", "num_ids", ",", "url_prefix", ",", "auth", ",", "session", ",", "send_opts", ")", ":", "if", "not", "isinstance", "(", "resource", ",", "ChannelResource", ")", ":", "raise", "TypeError", "(", "'resou...
Reserve a block of unique, sequential ids for annotations. Args: resource (intern.resource.Resource): Resource should be an annotation channel. num_ids (int): Number of ids to reserve. url_prefix (string): Protocol + host such as https://api.theboss.io auth (stri...
[ "Reserve", "a", "block", "of", "unique", "sequential", "ids", "for", "annotations", "." ]
python
train
40.945946
askovpen/discord_simple
pylint-recursive.py
https://github.com/askovpen/discord_simple/blob/6dff3a94b63bb3657fae8b16e3d03f944afee71b/pylint-recursive.py#L17-L36
def check(module): global passed, failed ''' apply pylint to the file specified if it is a *.py file ''' module_name = module.rsplit('/', 1)[1] if module[-3:] == ".py" and module_name not in IGNORED_FILES: print ("CHECKING ", module) pout = os.popen('pylint %s'% module, 'r') for line in pout: ...
[ "def", "check", "(", "module", ")", ":", "global", "passed", ",", "failed", "module_name", "=", "module", ".", "rsplit", "(", "'/'", ",", "1", ")", "[", "1", "]", "if", "module", "[", "-", "3", ":", "]", "==", "\".py\"", "and", "module_name", "not"...
apply pylint to the file specified if it is a *.py file
[ "apply", "pylint", "to", "the", "file", "specified", "if", "it", "is", "a", "*", ".", "py", "file" ]
python
train
32.9
apache/airflow
airflow/contrib/hooks/azure_fileshare_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L136-L153
def get_file_to_stream(self, stream, share_name, directory_name, file_name, **kwargs): """ Download a file from Azure File Share. :param stream: A filehandle to store the file to. :type stream: file-like object :param share_name: Name of the share. :type share_name: str ...
[ "def", "get_file_to_stream", "(", "self", ",", "stream", ",", "share_name", ",", "directory_name", ",", "file_name", ",", "*", "*", "kwargs", ")", ":", "self", ".", "connection", ".", "get_file_to_stream", "(", "share_name", ",", "directory_name", ",", "file_n...
Download a file from Azure File Share. :param stream: A filehandle to store the file to. :type stream: file-like object :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param file...
[ "Download", "a", "file", "from", "Azure", "File", "Share", "." ]
python
test
42
LLNL/scraper
scraper/github/queryManager.py
https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/github/queryManager.py#L141-L168
def queryGitHubFromFile(self, filePath, gitvars={}, verbosity=0, **kwargs): """Submit a GitHub GraphQL query from a file. Can only be used with GraphQL queries. For REST queries, see the 'queryGitHub' method. Args: filePath (str): A relative or absolute path to a file conta...
[ "def", "queryGitHubFromFile", "(", "self", ",", "filePath", ",", "gitvars", "=", "{", "}", ",", "verbosity", "=", "0", ",", "*", "*", "kwargs", ")", ":", "gitquery", "=", "self", ".", "_readGQL", "(", "filePath", ",", "verbose", "=", "(", "verbosity", ...
Submit a GitHub GraphQL query from a file. Can only be used with GraphQL queries. For REST queries, see the 'queryGitHub' method. Args: filePath (str): A relative or absolute path to a file containing a GraphQL query. File may use comments and multi-...
[ "Submit", "a", "GitHub", "GraphQL", "query", "from", "a", "file", "." ]
python
test
43.928571
CamDavidsonPilon/lifelines
lifelines/fitters/aalen_additive_fitter.py
https://github.com/CamDavidsonPilon/lifelines/blob/bdf6be6f1d10eea4c46365ee0ee6a47d8c30edf8/lifelines/fitters/aalen_additive_fitter.py#L417-L471
def plot(self, columns=None, loc=None, iloc=None, **kwargs): """" A wrapper around plotting. Matplotlib plot arguments can be passed in, plus: Parameters ----------- columns: string or list-like, optional If not empty, plot a subset of columns from the ``cumulative_haz...
[ "def", "plot", "(", "self", ",", "columns", "=", "None", ",", "loc", "=", "None", ",", "iloc", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", "matplotlib", "import", "pyplot", "as", "plt", "assert", "loc", "is", "None", "or", "iloc", "is",...
A wrapper around plotting. Matplotlib plot arguments can be passed in, plus: Parameters ----------- columns: string or list-like, optional If not empty, plot a subset of columns from the ``cumulative_hazards_``. Default all. loc: iloc: slice, optional specif...
[ "A", "wrapper", "around", "plotting", ".", "Matplotlib", "plot", "arguments", "can", "be", "passed", "in", "plus", ":" ]
python
train
38.890909
chrisspen/burlap
burlap/decorators.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/decorators.py#L100-L110
def runs_once(meth): """ A wrapper around Fabric's runs_once() to support our dryrun feature. """ from burlap.common import get_dryrun, runs_once_methods if get_dryrun(): pass else: runs_once_methods.append(meth) _runs_once(meth) return meth
[ "def", "runs_once", "(", "meth", ")", ":", "from", "burlap", ".", "common", "import", "get_dryrun", ",", "runs_once_methods", "if", "get_dryrun", "(", ")", ":", "pass", "else", ":", "runs_once_methods", ".", "append", "(", "meth", ")", "_runs_once", "(", "...
A wrapper around Fabric's runs_once() to support our dryrun feature.
[ "A", "wrapper", "around", "Fabric", "s", "runs_once", "()", "to", "support", "our", "dryrun", "feature", "." ]
python
valid
25.727273
ansible/tower-cli
tower_cli/resources/node.py
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L185-L201
def associate_failure_node(self, parent, child=None, **kwargs): """Add a node to run on failure. =====API DOCS===== Add a node to run on failure. :param parent: Primary key of parent node to associate failure node to. :type parent: int :param child: Primary key of child...
[ "def", "associate_failure_node", "(", "self", ",", "parent", ",", "child", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_assoc_or_create", "(", "'failure'", ",", "parent", ",", "child", ",", "*", "*", "kwargs", ")" ]
Add a node to run on failure. =====API DOCS===== Add a node to run on failure. :param parent: Primary key of parent node to associate failure node to. :type parent: int :param child: Primary key of child node to be associated. :type child: int :param `**kwargs`:...
[ "Add", "a", "node", "to", "run", "on", "failure", "." ]
python
valid
40.176471
theislab/scanpy
scanpy/preprocessing/_recipes.py
https://github.com/theislab/scanpy/blob/9e4e5ee02e04cf618872d9b098e24f0542e8b227/scanpy/preprocessing/_recipes.py#L9-L37
def recipe_weinreb17(adata, log=True, mean_threshold=0.01, cv_threshold=2, n_pcs=50, svd_solver='randomized', random_state=0, copy=False): """Normalization and filtering as of [Weinreb17]_. Expects non-logarithmized data. If using logarithmized data, pass `log=False`. ...
[ "def", "recipe_weinreb17", "(", "adata", ",", "log", "=", "True", ",", "mean_threshold", "=", "0.01", ",", "cv_threshold", "=", "2", ",", "n_pcs", "=", "50", ",", "svd_solver", "=", "'randomized'", ",", "random_state", "=", "0", ",", "copy", "=", "False"...
Normalization and filtering as of [Weinreb17]_. Expects non-logarithmized data. If using logarithmized data, pass `log=False`. Parameters ---------- adata : :class:`~anndata.AnnData` Annotated data matrix. copy : bool (default: False) Return a copy if true.
[ "Normalization", "and", "filtering", "as", "of", "[", "Weinreb17", "]", "_", "." ]
python
train
43.827586
wesyoung/pyzyre
czmq/_czmq_ctypes.py
https://github.com/wesyoung/pyzyre/blob/22d4c757acefcfdb700d3802adaf30b402bb9eea/czmq/_czmq_ctypes.py#L1222-L1227
def extend(self, data, size): """ Append user-supplied data to chunk, return resulting chunk size. If the data would exceeded the available space, the chunk grows in size. """ return lib.zchunk_extend(self._as_parameter_, data, size)
[ "def", "extend", "(", "self", ",", "data", ",", "size", ")", ":", "return", "lib", ".", "zchunk_extend", "(", "self", ".", "_as_parameter_", ",", "data", ",", "size", ")" ]
Append user-supplied data to chunk, return resulting chunk size. If the data would exceeded the available space, the chunk grows in size.
[ "Append", "user", "-", "supplied", "data", "to", "chunk", "return", "resulting", "chunk", "size", ".", "If", "the", "data", "would", "exceeded", "the", "available", "space", "the", "chunk", "grows", "in", "size", "." ]
python
train
43.333333
StackStorm/pybind
pybind/slxos/v17r_1_01a/interface/port_channel/qos/random_detect/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/interface/port_channel/qos/random_detect/__init__.py#L92-L113
def _set_traffic_class(self, v, load=False): """ Setter method for traffic_class, mapped from YANG variable /interface/port_channel/qos/random_detect/traffic_class (list) If this variable is read-only (config: false) in the source YANG file, then _set_traffic_class is considered as a private method....
[ "def", "_set_traffic_class", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "...
Setter method for traffic_class, mapped from YANG variable /interface/port_channel/qos/random_detect/traffic_class (list) If this variable is read-only (config: false) in the source YANG file, then _set_traffic_class is considered as a private method. Backends looking to populate this variable should do...
[ "Setter", "method", "for", "traffic_class", "mapped", "from", "YANG", "variable", "/", "interface", "/", "port_channel", "/", "qos", "/", "random_detect", "/", "traffic_class", "(", "list", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "conf...
python
train
148.227273
troeger/opensubmit
executor/opensubmitexec/hostinfo.py
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/executor/opensubmitexec/hostinfo.py#L82-L99
def all_host_infos(): ''' Summarize all host information. ''' output = [] output.append(["Operating system", os()]) output.append(["CPUID information", cpu()]) output.append(["CC information", compiler()]) output.append(["JDK information", from_cmd("java -version")]) output.appen...
[ "def", "all_host_infos", "(", ")", ":", "output", "=", "[", "]", "output", ".", "append", "(", "[", "\"Operating system\"", ",", "os", "(", ")", "]", ")", "output", ".", "append", "(", "[", "\"CPUID information\"", ",", "cpu", "(", ")", "]", ")", "ou...
Summarize all host information.
[ "Summarize", "all", "host", "information", "." ]
python
train
40.944444
elifesciences/elife-article
elifearticle/parse.py
https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/parse.py#L255-L280
def component_title(component): """ Label, title and caption Title is the label text plus the title text Title may contain italic tag, etc. """ title = u'' label_text = u'' title_text = u'' if component.get('label'): label_text = component.get('label') if component.get...
[ "def", "component_title", "(", "component", ")", ":", "title", "=", "u''", "label_text", "=", "u''", "title_text", "=", "u''", "if", "component", ".", "get", "(", "'label'", ")", ":", "label_text", "=", "component", ".", "get", "(", "'label'", ")", "if",...
Label, title and caption Title is the label text plus the title text Title may contain italic tag, etc.
[ "Label", "title", "and", "caption", "Title", "is", "the", "label", "text", "plus", "the", "title", "text", "Title", "may", "contain", "italic", "tag", "etc", "." ]
python
train
23.076923
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavextra.py#L223-L230
def lowpass(var, key, factor): '''a simple lowpass filter''' global lowpass_data if not key in lowpass_data: lowpass_data[key] = var else: lowpass_data[key] = factor*lowpass_data[key] + (1.0 - factor)*var return lowpass_data[key]
[ "def", "lowpass", "(", "var", ",", "key", ",", "factor", ")", ":", "global", "lowpass_data", "if", "not", "key", "in", "lowpass_data", ":", "lowpass_data", "[", "key", "]", "=", "var", "else", ":", "lowpass_data", "[", "key", "]", "=", "factor", "*", ...
a simple lowpass filter
[ "a", "simple", "lowpass", "filter" ]
python
train
32.25
tensorpack/tensorpack
tensorpack/compat/tensor_spec.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/compat/tensor_spec.py#L75-L88
def is_compatible_with(self, spec_or_tensor): """Returns True if spec_or_tensor is compatible with this TensorSpec. Two tensors are considered compatible if they have the same dtype and their shapes are compatible (see `tf.TensorShape.is_compatible_with`). Args: spec_or_tensor: A tf.TensorSpec o...
[ "def", "is_compatible_with", "(", "self", ",", "spec_or_tensor", ")", ":", "return", "(", "self", ".", "_dtype", ".", "is_compatible_with", "(", "spec_or_tensor", ".", "dtype", ")", "and", "self", ".", "_shape", ".", "is_compatible_with", "(", "spec_or_tensor", ...
Returns True if spec_or_tensor is compatible with this TensorSpec. Two tensors are considered compatible if they have the same dtype and their shapes are compatible (see `tf.TensorShape.is_compatible_with`). Args: spec_or_tensor: A tf.TensorSpec or a tf.Tensor Returns: True if spec_or_ten...
[ "Returns", "True", "if", "spec_or_tensor", "is", "compatible", "with", "this", "TensorSpec", "." ]
python
train
37.928571
wummel/linkchecker
linkcheck/checker/__init__.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/checker/__init__.py#L128-L154
def get_urlclass_from (scheme, assume_local_file=False): """Return checker class for given URL scheme. If the scheme cannot be matched and assume_local_file is True, assume a local file. """ if scheme in ("http", "https"): klass = httpurl.HttpUrl elif scheme == "ftp": klass = ftpurl....
[ "def", "get_urlclass_from", "(", "scheme", ",", "assume_local_file", "=", "False", ")", ":", "if", "scheme", "in", "(", "\"http\"", ",", "\"https\"", ")", ":", "klass", "=", "httpurl", ".", "HttpUrl", "elif", "scheme", "==", "\"ftp\"", ":", "klass", "=", ...
Return checker class for given URL scheme. If the scheme cannot be matched and assume_local_file is True, assume a local file.
[ "Return", "checker", "class", "for", "given", "URL", "scheme", ".", "If", "the", "scheme", "cannot", "be", "matched", "and", "assume_local_file", "is", "True", "assume", "a", "local", "file", "." ]
python
train
34.37037
saltstack/salt
salt/modules/git.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L2462-L2517
def list_tags(cwd, user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionadded:: 2015.8.0 Return a list of tags cwd The path to the git checkout user User under which to run the git command. By ...
[ "def", "list_tags", "(", "cwd", ",", "user", "=", "None", ",", "password", "=", "None", ",", "ignore_retcode", "=", "False", ",", "output_encoding", "=", "None", ")", ":", "cwd", "=", "_expand_path", "(", "cwd", ",", "user", ")", "command", "=", "[", ...
.. versionadded:: 2015.8.0 Return a list of tags cwd The path to the git checkout user User under which to run the git command. By default, the command is run by the user under which the minion is running. password Windows only. Required when specifying ``user``. This...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
python
train
29.017857
mikedh/trimesh
trimesh/path/entities.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/entities.py#L336-L359
def angle(self, vertices): """ If Text is 2D, get the rotation angle in radians. Parameters ----------- vertices : (n, 2) float Vertices in space referenced by self.points Returns --------- angle : float Rotation angle in radians ...
[ "def", "angle", "(", "self", ",", "vertices", ")", ":", "if", "vertices", ".", "shape", "[", "1", "]", "!=", "2", ":", "raise", "ValueError", "(", "'angle only valid for 2D points!'", ")", "# get the vector from origin", "direction", "=", "vertices", "[", "sel...
If Text is 2D, get the rotation angle in radians. Parameters ----------- vertices : (n, 2) float Vertices in space referenced by self.points Returns --------- angle : float Rotation angle in radians
[ "If", "Text", "is", "2D", "get", "the", "rotation", "angle", "in", "radians", "." ]
python
train
25.791667
gwpy/gwpy
gwpy/types/io/hdf5.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/types/io/hdf5.py#L226-L233
def write_hdf5_series(series, output, path=None, attrs=None, **kwargs): """Write a Series to HDF5. See :func:`write_hdf5_array` for details of arguments and keywords. """ if attrs is None: attrs = format_index_array_attrs(series) return write_hdf5_array(series, output, path=path, attrs=attr...
[ "def", "write_hdf5_series", "(", "series", ",", "output", ",", "path", "=", "None", ",", "attrs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "attrs", "is", "None", ":", "attrs", "=", "format_index_array_attrs", "(", "series", ")", "return", ...
Write a Series to HDF5. See :func:`write_hdf5_array` for details of arguments and keywords.
[ "Write", "a", "Series", "to", "HDF5", "." ]
python
train
40.625
wummel/linkchecker
linkcheck/director/__init__.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/director/__init__.py#L83-L95
def interrupt (aggregate): """Interrupt execution and shutdown, ignoring any subsequent interrupts.""" while True: try: log.warn(LOG_CHECK, _("interrupt; waiting for active threads to finish")) log.warn(LOG_CHECK, _("another interrupt will exit i...
[ "def", "interrupt", "(", "aggregate", ")", ":", "while", "True", ":", "try", ":", "log", ".", "warn", "(", "LOG_CHECK", ",", "_", "(", "\"interrupt; waiting for active threads to finish\"", ")", ")", "log", ".", "warn", "(", "LOG_CHECK", ",", "_", "(", "\"...
Interrupt execution and shutdown, ignoring any subsequent interrupts.
[ "Interrupt", "execution", "and", "shutdown", "ignoring", "any", "subsequent", "interrupts", "." ]
python
train
32.230769
spotify/gordon-gcp
src/gordon_gcp/clients/gcrm.py
https://github.com/spotify/gordon-gcp/blob/5ab19e3c2fe6ace72ee91e2ef1a1326f90b805da/src/gordon_gcp/clients/gcrm.py#L85-L105
async def list_all_active_projects(self, page_size=1000): """Get all active projects. You can find the endpoint documentation `here <https://cloud. google.com/resource-manager/reference/rest/v1/projects/list>`__. Args: page_size (int): hint for the client to only retrieve u...
[ "async", "def", "list_all_active_projects", "(", "self", ",", "page_size", "=", "1000", ")", ":", "url", "=", "f'{self.BASE_URL}/{self.api_version}/projects'", "params", "=", "{", "'pageSize'", ":", "page_size", "}", "responses", "=", "await", "self", ".", "list_a...
Get all active projects. You can find the endpoint documentation `here <https://cloud. google.com/resource-manager/reference/rest/v1/projects/list>`__. Args: page_size (int): hint for the client to only retrieve up to this number of results per API call. Ret...
[ "Get", "all", "active", "projects", "." ]
python
train
37.47619
LionelAuroux/pyrser
pyrser/type_system/tuple.py
https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/tuple.py#L22-L33
def to_fmt(self) -> fmt.indentable: """ Return an Fmt representation for pretty-printing """ lsb = [] if len(self._lsig) > 0: for s in self._lsig: lsb.append(s.to_fmt()) block = fmt.block("(", ")", fmt.sep(', ', lsb)) qual = "tuple" ...
[ "def", "to_fmt", "(", "self", ")", "->", "fmt", ".", "indentable", ":", "lsb", "=", "[", "]", "if", "len", "(", "self", ".", "_lsig", ")", ">", "0", ":", "for", "s", "in", "self", ".", "_lsig", ":", "lsb", ".", "append", "(", "s", ".", "to_fm...
Return an Fmt representation for pretty-printing
[ "Return", "an", "Fmt", "representation", "for", "pretty", "-", "printing" ]
python
test
30.416667
obriencj/python-javatools
javatools/cheetah/__init__.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/cheetah/__init__.py#L53-L61
def xml_entity_escape(data): """ replace special characters with their XML entity versions """ data = data.replace("&", "&amp;") data = data.replace(">", "&gt;") data = data.replace("<", "&lt;") return data
[ "def", "xml_entity_escape", "(", "data", ")", ":", "data", "=", "data", ".", "replace", "(", "\"&\"", ",", "\"&amp;\"", ")", "data", "=", "data", ".", "replace", "(", "\">\"", ",", "\"&gt;\"", ")", "data", "=", "data", ".", "replace", "(", "\"<\"", "...
replace special characters with their XML entity versions
[ "replace", "special", "characters", "with", "their", "XML", "entity", "versions" ]
python
train
25.222222
ooici/elasticpy
elasticpy/query.py
https://github.com/ooici/elasticpy/blob/ec221800a80c39e80d8c31667c5b138da39219f2/elasticpy/query.py#L206-L216
def has_child(cls, child_type, query): ''' http://www.elasticsearch.org/guide/reference/query-dsl/has-child-query.html The has_child query accepts a query and the child type to run against, and results in parent documents that have child docs matching the query. > child_query = ElasticQ...
[ "def", "has_child", "(", "cls", ",", "child_type", ",", "query", ")", ":", "instance", "=", "cls", "(", "has_child", "=", "{", "'type'", ":", "child_type", ",", "'query'", ":", "query", "}", ")", "return", "instance" ]
http://www.elasticsearch.org/guide/reference/query-dsl/has-child-query.html The has_child query accepts a query and the child type to run against, and results in parent documents that have child docs matching the query. > child_query = ElasticQuery().term(tag='something') > query = ElasticQuery...
[ "http", ":", "//", "www", ".", "elasticsearch", ".", "org", "/", "guide", "/", "reference", "/", "query", "-", "dsl", "/", "has", "-", "child", "-", "query", ".", "html", "The", "has_child", "query", "accepts", "a", "query", "and", "the", "child", "t...
python
train
46.727273
ejhigson/nestcheck
nestcheck/ns_run_utils.py
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L399-L417
def log_subtract(loga, logb): r"""Numerically stable method for avoiding overflow errors when calculating :math:`\log (a-b)`, given :math:`\log (a)`, :math:`\log (a)` and that :math:`a > b`. See https://hips.seas.harvard.edu/blog/2013/01/09/computing-log-sum-exp/ for more details. Parameters ...
[ "def", "log_subtract", "(", "loga", ",", "logb", ")", ":", "return", "loga", "+", "np", ".", "log", "(", "1", "-", "np", ".", "exp", "(", "logb", "-", "loga", ")", ")" ]
r"""Numerically stable method for avoiding overflow errors when calculating :math:`\log (a-b)`, given :math:`\log (a)`, :math:`\log (a)` and that :math:`a > b`. See https://hips.seas.harvard.edu/blog/2013/01/09/computing-log-sum-exp/ for more details. Parameters ---------- loga: float ...
[ "r", "Numerically", "stable", "method", "for", "avoiding", "overflow", "errors", "when", "calculating", ":", "math", ":", "\\", "log", "(", "a", "-", "b", ")", "given", ":", "math", ":", "\\", "log", "(", "a", ")", ":", "math", ":", "\\", "log", "(...
python
train
25.473684
Qiskit/qiskit-terra
qiskit/quantum_info/operators/pauli.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/pauli.py#L344-L370
def update_x(self, x, indices=None): """ Update partial or entire x. Args: x (numpy.ndarray or list): to-be-updated x indices (numpy.ndarray or list or optional): to-be-updated qubit indices Returns: Pauli: self Raises: QiskitErr...
[ "def", "update_x", "(", "self", ",", "x", ",", "indices", "=", "None", ")", ":", "x", "=", "_make_np_bool", "(", "x", ")", "if", "indices", "is", "None", ":", "if", "len", "(", "self", ".", "_x", ")", "!=", "len", "(", "x", ")", ":", "raise", ...
Update partial or entire x. Args: x (numpy.ndarray or list): to-be-updated x indices (numpy.ndarray or list or optional): to-be-updated qubit indices Returns: Pauli: self Raises: QiskitError: when updating whole x, the number of qubits must be t...
[ "Update", "partial", "or", "entire", "x", "." ]
python
test
32.222222
ellmetha/django-machina
machina/apps/forum_member/views.py
https://github.com/ellmetha/django-machina/blob/89ac083c1eaf1cfdeae6686ee094cc86362e8c69/machina/apps/forum_member/views.py#L43-L47
def get_context_data(self, **kwargs): """ Returns the context data to provide to the template. """ context = super().get_context_data(**kwargs) context['poster'] = self.poster return context
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", ")", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "context", "[", "'poster'", "]", "=", "self", ".", "poster", "return", "context" ]
Returns the context data to provide to the template.
[ "Returns", "the", "context", "data", "to", "provide", "to", "the", "template", "." ]
python
train
43.6
xenadevel/PyXenaManager
xenamanager/xena_port.py
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/xena_port.py#L361-L370
def packets(self): """ :return: dictionary {id: object} of all packets. :rtype: dict of (int, xenamanager.xena_port.XenaCapturePacket) """ if not self.get_object_by_type('cappacket'): for index in range(0, self.read_stats()['packets']): XenaCapturePac...
[ "def", "packets", "(", "self", ")", ":", "if", "not", "self", ".", "get_object_by_type", "(", "'cappacket'", ")", ":", "for", "index", "in", "range", "(", "0", ",", "self", ".", "read_stats", "(", ")", "[", "'packets'", "]", ")", ":", "XenaCapturePacke...
:return: dictionary {id: object} of all packets. :rtype: dict of (int, xenamanager.xena_port.XenaCapturePacket)
[ ":", "return", ":", "dictionary", "{", "id", ":", "object", "}", "of", "all", "packets", ".", ":", "rtype", ":", "dict", "of", "(", "int", "xenamanager", ".", "xena_port", ".", "XenaCapturePacket", ")" ]
python
train
44
Hundemeier/sacn
sacn/receiver.py
https://github.com/Hundemeier/sacn/blob/f08bf3d7554a1ed2870f23a9e0e7b89a4a509231/sacn/receiver.py#L68-L78
def join_multicast(self, universe: int) -> None: """ Joins the multicast address that is used for the given universe. Note: If you are on Windows you must have given a bind IP-Address for this feature to function properly. On the other hand you are not allowed to set a bind address if yo...
[ "def", "join_multicast", "(", "self", ",", "universe", ":", "int", ")", "->", "None", ":", "self", ".", "sock", ".", "setsockopt", "(", "socket", ".", "SOL_IP", ",", "socket", ".", "IP_ADD_MEMBERSHIP", ",", "socket", ".", "inet_aton", "(", "calculate_multi...
Joins the multicast address that is used for the given universe. Note: If you are on Windows you must have given a bind IP-Address for this feature to function properly. On the other hand you are not allowed to set a bind address if you are on any other OS. :param universe: the universe to join ...
[ "Joins", "the", "multicast", "address", "that", "is", "used", "for", "the", "given", "universe", ".", "Note", ":", "If", "you", "are", "on", "Windows", "you", "must", "have", "given", "a", "bind", "IP", "-", "Address", "for", "this", "feature", "to", "...
python
train
63.454545
royi1000/py-libhdate
hdate/zmanim.py
https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/zmanim.py#L159-L221
def _get_utc_sun_time_deg(self, deg): """ Return the times in minutes from 00:00 (utc) for a given sun altitude. This is done for a given sun altitude in sunrise `deg` degrees This function only works for altitudes sun really is. If the sun never gets to this altitude, the retur...
[ "def", "_get_utc_sun_time_deg", "(", "self", ",", "deg", ")", ":", "gama", "=", "0", "# location of sun in yearly cycle in radians", "eqtime", "=", "0", "# difference betwen sun noon and clock noon", "decl", "=", "0", "# sun declanation", "hour_angle", "=", "0", "# sola...
Return the times in minutes from 00:00 (utc) for a given sun altitude. This is done for a given sun altitude in sunrise `deg` degrees This function only works for altitudes sun really is. If the sun never gets to this altitude, the returned sunset and sunrise values will be negative. Th...
[ "Return", "the", "times", "in", "minutes", "from", "00", ":", "00", "(", "utc", ")", "for", "a", "given", "sun", "altitude", "." ]
python
train
43.380952
ssato/python-anyconfig
src/anyconfig/backend/xml.py
https://github.com/ssato/python-anyconfig/blob/f2f4fb8d8e232aadea866c202e1dd7a5967e2877/src/anyconfig/backend/xml.py#L361-L371
def _elem_set_attrs(obj, parent, to_str): """ :param obj: Container instance gives attributes of XML Element :param parent: XML ElementTree parent node object :param to_str: Callable to convert value to string or None :param options: Keyword options, see :func:`container_to_etree` :return: None...
[ "def", "_elem_set_attrs", "(", "obj", ",", "parent", ",", "to_str", ")", ":", "for", "attr", ",", "val", "in", "anyconfig", ".", "compat", ".", "iteritems", "(", "obj", ")", ":", "parent", ".", "set", "(", "attr", ",", "to_str", "(", "val", ")", ")...
:param obj: Container instance gives attributes of XML Element :param parent: XML ElementTree parent node object :param to_str: Callable to convert value to string or None :param options: Keyword options, see :func:`container_to_etree` :return: None but parent will be modified
[ ":", "param", "obj", ":", "Container", "instance", "gives", "attributes", "of", "XML", "Element", ":", "param", "parent", ":", "XML", "ElementTree", "parent", "node", "object", ":", "param", "to_str", ":", "Callable", "to", "convert", "value", "to", "string"...
python
train
39.818182
awslabs/aws-sam-cli
samcli/local/docker/lambda_image.py
https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/local/docker/lambda_image.py#L195-L225
def _generate_dockerfile(base_image, layers): """ Generate the Dockerfile contents A generated Dockerfile will look like the following: ``` FROM lambci/lambda:python3.6 ADD --chown=sbx_user1051:495 layer1 /opt ADD --chown=sbx_user1051:495 layer2 /opt ```...
[ "def", "_generate_dockerfile", "(", "base_image", ",", "layers", ")", ":", "dockerfile_content", "=", "\"FROM {}\\n\"", ".", "format", "(", "base_image", ")", "for", "layer", "in", "layers", ":", "dockerfile_content", "=", "dockerfile_content", "+", "\"ADD --chown=s...
Generate the Dockerfile contents A generated Dockerfile will look like the following: ``` FROM lambci/lambda:python3.6 ADD --chown=sbx_user1051:495 layer1 /opt ADD --chown=sbx_user1051:495 layer2 /opt ``` Parameters ---------- base_image str ...
[ "Generate", "the", "Dockerfile", "contents" ]
python
train
30.483871
log2timeline/dfvfs
dfvfs/analyzer/analyzer.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/analyzer/analyzer.py#L230-L254
def GetArchiveTypeIndicators(cls, path_spec, resolver_context=None): """Determines if a file contains a supported archive types. Args: path_spec (PathSpec): path specification. resolver_context (Optional[Context]): resolver context, where None represents the built-in context which is not ...
[ "def", "GetArchiveTypeIndicators", "(", "cls", ",", "path_spec", ",", "resolver_context", "=", "None", ")", ":", "if", "(", "cls", ".", "_archive_remainder_list", "is", "None", "or", "cls", ".", "_archive_store", "is", "None", ")", ":", "specification_store", ...
Determines if a file contains a supported archive types. Args: path_spec (PathSpec): path specification. resolver_context (Optional[Context]): resolver context, where None represents the built-in context which is not multi process safe. Returns: list[str]: supported format type ind...
[ "Determines", "if", "a", "file", "contains", "a", "supported", "archive", "types", "." ]
python
train
39.12
consbio/parserutils
parserutils/collections.py
https://github.com/consbio/parserutils/blob/f13f80db99ed43479336b116e38512e3566e4623/parserutils/collections.py#L215-L225
def rindex(values, value): """ :return: the highest index in values where value is found, else raise ValueError """ if isinstance(values, STRING_TYPES): try: return values.rindex(value) except TypeError: # Python 3 compliance: search for str values in bytearray ...
[ "def", "rindex", "(", "values", ",", "value", ")", ":", "if", "isinstance", "(", "values", ",", "STRING_TYPES", ")", ":", "try", ":", "return", "values", ".", "rindex", "(", "value", ")", "except", "TypeError", ":", "# Python 3 compliance: search for str value...
:return: the highest index in values where value is found, else raise ValueError
[ ":", "return", ":", "the", "highest", "index", "in", "values", "where", "value", "is", "found", "else", "raise", "ValueError" ]
python
train
40.090909
tensorflow/mesh
mesh_tensorflow/layers.py
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/layers.py#L1116-L1136
def compress_mean(x, dim, compression_factor): """Compress by taking group means. Args: x: a Tensor dim: a dimension in x.shape compression_factor: an integer Returns: a Tensor """ dims = x.shape.dims pos = dims.index(dim) compressed_dim = mtf.Dimension(dim.name, dim.size // compression_...
[ "def", "compress_mean", "(", "x", ",", "dim", ",", "compression_factor", ")", ":", "dims", "=", "x", ".", "shape", ".", "dims", "pos", "=", "dims", ".", "index", "(", "dim", ")", "compressed_dim", "=", "mtf", ".", "Dimension", "(", "dim", ".", "name"...
Compress by taking group means. Args: x: a Tensor dim: a dimension in x.shape compression_factor: an integer Returns: a Tensor
[ "Compress", "by", "taking", "group", "means", "." ]
python
train
28.333333
saltstack/salt
salt/modules/consul.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L409-L437
def agent_checks(consul_url=None, token=None): ''' Returns the checks the local agent is managing :param consul_url: The Consul server URL. :return: Returns the checks the local agent is managing CLI Example: .. code-block:: bash salt '*' consul.agent_checks ''' ret = {} ...
[ "def", "agent_checks", "(", "consul_url", "=", "None", ",", "token", "=", "None", ")", ":", "ret", "=", "{", "}", "if", "not", "consul_url", ":", "consul_url", "=", "_get_config", "(", ")", "if", "not", "consul_url", ":", "log", ".", "error", "(", "'...
Returns the checks the local agent is managing :param consul_url: The Consul server URL. :return: Returns the checks the local agent is managing CLI Example: .. code-block:: bash salt '*' consul.agent_checks
[ "Returns", "the", "checks", "the", "local", "agent", "is", "managing" ]
python
train
24.413793
SAP/PyHDB
pyhdb/cursor.py
https://github.com/SAP/PyHDB/blob/826539d06b8bcef74fe755e7489b8a8255628f12/pyhdb/cursor.py#L328-L347
def _handle_select(self, parts, result_metadata=None): """Handle reply messages from SELECT statements""" self.rowcount = -1 if result_metadata is not None: # Select was prepared and we can use the already received metadata self.description, self._column_types = self._han...
[ "def", "_handle_select", "(", "self", ",", "parts", ",", "result_metadata", "=", "None", ")", ":", "self", ".", "rowcount", "=", "-", "1", "if", "result_metadata", "is", "not", "None", ":", "# Select was prepared and we can use the already received metadata", "self"...
Handle reply messages from SELECT statements
[ "Handle", "reply", "messages", "from", "SELECT", "statements" ]
python
train
56.7
cltl/KafNafParserPy
KafNafParserPy/causal_data.py
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/causal_data.py#L156-L165
def remove_this_clink(self,clink_id): """ Removes the clink for the given clink identifier @type clink_id: string @param clink_id: the clink identifier to be removed """ for clink in self.get_clinks(): if clink.get_id() == clink_id: self.node.r...
[ "def", "remove_this_clink", "(", "self", ",", "clink_id", ")", ":", "for", "clink", "in", "self", ".", "get_clinks", "(", ")", ":", "if", "clink", ".", "get_id", "(", ")", "==", "clink_id", ":", "self", ".", "node", ".", "remove", "(", "clink", ".", ...
Removes the clink for the given clink identifier @type clink_id: string @param clink_id: the clink identifier to be removed
[ "Removes", "the", "clink", "for", "the", "given", "clink", "identifier" ]
python
train
35.6
SectorLabs/django-localized-fields
localized_fields/fields/bleach_field.py
https://github.com/SectorLabs/django-localized-fields/blob/f0ac0f7f2503317fde5d75ba8481e34db83512bd/localized_fields/fields/bleach_field.py#L13-L40
def pre_save(self, instance, add: bool): """Ran just before the model is saved, allows us to built the slug. Arguments: instance: The model that is being saved. add: Indicates whether this is a new entry to the database or...
[ "def", "pre_save", "(", "self", ",", "instance", ",", "add", ":", "bool", ")", ":", "localized_value", "=", "getattr", "(", "instance", ",", "self", ".", "attname", ")", "if", "not", "localized_value", ":", "return", "None", "for", "lang_code", ",", "_",...
Ran just before the model is saved, allows us to built the slug. Arguments: instance: The model that is being saved. add: Indicates whether this is a new entry to the database or an update.
[ "Ran", "just", "before", "the", "model", "is", "saved", "allows", "us", "to", "built", "the", "slug", "." ]
python
train
27.035714
kwikteam/phy
phy/cluster/supervisor.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/cluster/supervisor.py#L630-L640
def move(self, group, cluster_ids=None): """Assign a group to some clusters. Example: `good` """ if isinstance(cluster_ids, string_types): logger.warn("The list of clusters should be a list of integers, " "not a string.") return s...
[ "def", "move", "(", "self", ",", "group", ",", "cluster_ids", "=", "None", ")", ":", "if", "isinstance", "(", "cluster_ids", ",", "string_types", ")", ":", "logger", ".", "warn", "(", "\"The list of clusters should be a list of integers, \"", "\"not a string.\"", ...
Assign a group to some clusters. Example: `good`
[ "Assign", "a", "group", "to", "some", "clusters", "." ]
python
train
32.727273
steffann/pylisp
pylisp/packet/ip/protocol.py
https://github.com/steffann/pylisp/blob/907340f0c7ef2c4d4fe0c8e0a48df5be0d969407/pylisp/packet/ip/protocol.py#L61-L72
def sanitize(self): ''' Check and optionally fix properties ''' # Let the parent do its stuff super(Protocol, self).sanitize() # Check if the next header is of the right type, and fix this header # if we know better (i.e. the payload is a ProtocolElement so we kn...
[ "def", "sanitize", "(", "self", ")", ":", "# Let the parent do its stuff", "super", "(", "Protocol", ",", "self", ")", ".", "sanitize", "(", ")", "# Check if the next header is of the right type, and fix this header", "# if we know better (i.e. the payload is a ProtocolElement so...
Check and optionally fix properties
[ "Check", "and", "optionally", "fix", "properties" ]
python
train
36.75
ahopkins/sanic-jwt
sanic_jwt/initialization.py
https://github.com/ahopkins/sanic-jwt/blob/fca7750499c8cedde823d778512f613777fb5282/sanic_jwt/initialization.py#L20-L29
def initialize(*args, **kwargs): """ Functional approach to initializing Sanic JWT. This was the original method, but was replaced by the Initialize class. It is recommended to use the class because it is more flexible. There is no current plan to remove this method, but it may be depracated in the ...
[ "def", "initialize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", ">", "1", ":", "kwargs", ".", "update", "(", "{", "\"authenticate\"", ":", "args", "[", "1", "]", "}", ")", "return", "Initialize", "(", "arg...
Functional approach to initializing Sanic JWT. This was the original method, but was replaced by the Initialize class. It is recommended to use the class because it is more flexible. There is no current plan to remove this method, but it may be depracated in the future.
[ "Functional", "approach", "to", "initializing", "Sanic", "JWT", ".", "This", "was", "the", "original", "method", "but", "was", "replaced", "by", "the", "Initialize", "class", ".", "It", "is", "recommended", "to", "use", "the", "class", "because", "it", "is",...
python
train
43.8
Azure/blobxfer
blobxfer/models/synccopy.py
https://github.com/Azure/blobxfer/blob/3eccbe7530cc6a20ab2d30f9e034b6f021817f34/blobxfer/models/synccopy.py#L259-L288
def complete_offset_upload(self, chunk_num): # type: (Descriptor, int) -> None """Complete the upload for the offset :param Descriptor self: this :param int chunk_num: chunk num completed """ with self._meta_lock: self._outstanding_ops -= 1 # save ...
[ "def", "complete_offset_upload", "(", "self", ",", "chunk_num", ")", ":", "# type: (Descriptor, int) -> None", "with", "self", ".", "_meta_lock", ":", "self", ".", "_outstanding_ops", "-=", "1", "# save resume state", "if", "self", ".", "is_resumable", ":", "# only ...
Complete the upload for the offset :param Descriptor self: this :param int chunk_num: chunk num completed
[ "Complete", "the", "upload", "for", "the", "offset", ":", "param", "Descriptor", "self", ":", "this", ":", "param", "int", "chunk_num", ":", "chunk", "num", "completed" ]
python
train
49.266667
BD2KGenomics/toil-lib
src/toil_lib/__init__.py
https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/__init__.py#L25-L40
def partitions(l, partition_size): """ >>> list(partitions([], 10)) [] >>> list(partitions([1,2,3,4,5], 1)) [[1], [2], [3], [4], [5]] >>> list(partitions([1,2,3,4,5], 2)) [[1, 2], [3, 4], [5]] >>> list(partitions([1,2,3,4,5], 5)) [[1, 2, 3, 4, 5]] :param list l: List to be parti...
[ "def", "partitions", "(", "l", ",", "partition_size", ")", ":", "for", "i", "in", "xrange", "(", "0", ",", "len", "(", "l", ")", ",", "partition_size", ")", ":", "yield", "l", "[", "i", ":", "i", "+", "partition_size", "]" ]
>>> list(partitions([], 10)) [] >>> list(partitions([1,2,3,4,5], 1)) [[1], [2], [3], [4], [5]] >>> list(partitions([1,2,3,4,5], 2)) [[1, 2], [3, 4], [5]] >>> list(partitions([1,2,3,4,5], 5)) [[1, 2, 3, 4, 5]] :param list l: List to be partitioned :param int partition_size: Size of p...
[ ">>>", "list", "(", "partitions", "(", "[]", "10", "))", "[]", ">>>", "list", "(", "partitions", "(", "[", "1", "2", "3", "4", "5", "]", "1", "))", "[[", "1", "]", "[", "2", "]", "[", "3", "]", "[", "4", "]", "[", "5", "]]", ">>>", "list"...
python
test
28.4375
MacHu-GWU/pymongo_mate-project
pymongo_mate/pkg/pandas_mate/transform.py
https://github.com/MacHu-GWU/pymongo_mate-project/blob/be53170c2db54cb705b9e548d32ef26c773ff7f3/pymongo_mate/pkg/pandas_mate/transform.py#L91-L106
def to_dict_list(df, use_ordered_dict=True): """Transform each row to dict, and put them into a list. **中文文档** 将 ``pandas.DataFrame`` 转换成一个字典的列表。列表的长度与行数相同, 其中 每一个字典相当于表中的一行, 相当于一个 ``pandas.Series`` 对象。 """ if use_ordered_dict: dict = OrderedDict columns = df.columns data = li...
[ "def", "to_dict_list", "(", "df", ",", "use_ordered_dict", "=", "True", ")", ":", "if", "use_ordered_dict", ":", "dict", "=", "OrderedDict", "columns", "=", "df", ".", "columns", "data", "=", "list", "(", ")", "for", "tp", "in", "itertuple", "(", "df", ...
Transform each row to dict, and put them into a list. **中文文档** 将 ``pandas.DataFrame`` 转换成一个字典的列表。列表的长度与行数相同, 其中 每一个字典相当于表中的一行, 相当于一个 ``pandas.Series`` 对象。
[ "Transform", "each", "row", "to", "dict", "and", "put", "them", "into", "a", "list", "." ]
python
train
24.875
saltstack/salt
salt/runners/mattermost.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/mattermost.py#L95-L146
def post_message(message, channel=None, username=None, api_url=None, hook=None): ''' Send a message to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :pa...
[ "def", "post_message", "(", "message", ",", "channel", "=", "None", ",", "username", "=", "None", ",", "api_url", "=", "None", ",", "hook", "=", "None", ")", ":", "if", "not", "api_url", ":", "api_url", "=", "_get_api_url", "(", ")", "if", "not", "ho...
Send a message to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param message: The message to send to the Mattermost channel. :param api_url: The Mattermost api url, if not specified in the configuration. :param...
[ "Send", "a", "message", "to", "a", "Mattermost", "channel", ".", ":", "param", "channel", ":", "The", "channel", "name", "either", "will", "work", ".", ":", "param", "username", ":", "The", "username", "of", "the", "poster", ".", ":", "param", "message",...
python
train
29.192308
apache/incubator-superset
superset/connectors/sqla/models.py
https://github.com/apache/incubator-superset/blob/ca2996c78f679260eb79c6008e276733df5fb653/superset/connectors/sqla/models.py#L143-L162
def get_timestamp_expression(self, time_grain): """Getting the time component of the query""" label = utils.DTTM_ALIAS db = self.table.database pdf = self.python_date_format is_epoch = pdf in ('epoch_s', 'epoch_ms') if not self.expression and not time_grain and not is_ep...
[ "def", "get_timestamp_expression", "(", "self", ",", "time_grain", ")", ":", "label", "=", "utils", ".", "DTTM_ALIAS", "db", "=", "self", ".", "table", ".", "database", "pdf", "=", "self", ".", "python_date_format", "is_epoch", "=", "pdf", "in", "(", "'epo...
Getting the time component of the query
[ "Getting", "the", "time", "component", "of", "the", "query" ]
python
train
49.4
ejeschke/ginga
ginga/rv/Control.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/Control.py#L2214-L2247
def collapse_pane(self, side): """ Toggle collapsing the left or right panes. """ # TODO: this is too tied to one configuration, need to figure # out how to generalize this hsplit = self.w['hpnl'] sizes = hsplit.get_sizes() lsize, msize, rsize = sizes ...
[ "def", "collapse_pane", "(", "self", ",", "side", ")", ":", "# TODO: this is too tied to one configuration, need to figure", "# out how to generalize this", "hsplit", "=", "self", ".", "w", "[", "'hpnl'", "]", "sizes", "=", "hsplit", ".", "get_sizes", "(", ")", "lsi...
Toggle collapsing the left or right panes.
[ "Toggle", "collapsing", "the", "left", "or", "right", "panes", "." ]
python
train
32.264706
flowersteam/explauto
explauto/models/gmminf.py
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/models/gmminf.py#L18-L30
def conditional(mean, covar, dims_in, dims_out, covariance_type='full'): """ Return a function f such that f(x) = p(dims_out | dims_in = x) (f actually returns the mean and covariance of the conditional distribution """ in_in = covar[ix_(dims_in, dims_in)] in_out = covar[ix_(dims_in, dims_out)] out_...
[ "def", "conditional", "(", "mean", ",", "covar", ",", "dims_in", ",", "dims_out", ",", "covariance_type", "=", "'full'", ")", ":", "in_in", "=", "covar", "[", "ix_", "(", "dims_in", ",", "dims_in", ")", "]", "in_out", "=", "covar", "[", "ix_", "(", "...
Return a function f such that f(x) = p(dims_out | dims_in = x) (f actually returns the mean and covariance of the conditional distribution
[ "Return", "a", "function", "f", "such", "that", "f", "(", "x", ")", "=", "p", "(", "dims_out", "|", "dims_in", "=", "x", ")", "(", "f", "actually", "returns", "the", "mean", "and", "covariance", "of", "the", "conditional", "distribution" ]
python
train
50.692308
pypa/pipenv
pipenv/patched/notpip/_vendor/pkg_resources/__init__.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L658-L664
def run_script(self, requires, script_name): """Locate distribution for `requires` and run `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name self.require(requires)[0].run_script(script_name, ns)
[ "def", "run_script", "(", "self", ",", "requires", ",", "script_name", ")", ":", "ns", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "name", "=", "ns", "[", "'__name__'", "]", "ns", ".", "clear", "(", ")", "ns", "[", "'__name__'", ...
Locate distribution for `requires` and run `script_name` script
[ "Locate", "distribution", "for", "requires", "and", "run", "script_name", "script" ]
python
train
42.428571
jaraco/path.py
path/__init__.py
https://github.com/jaraco/path.py/blob/bbe7d99e7a64a004f866ace9ec12bd9b296908f5/path/__init__.py#L362-L375
def splitext(self): """ p.splitext() -> Return ``(p.stripext(), p.ext)``. Split the filename extension from this path and return the two parts. Either part may be empty. The extension is everything from ``'.'`` to the end of the last path segment. This has the property that i...
[ "def", "splitext", "(", "self", ")", ":", "filename", ",", "ext", "=", "self", ".", "module", ".", "splitext", "(", "self", ")", "return", "self", ".", "_next_class", "(", "filename", ")", ",", "ext" ]
p.splitext() -> Return ``(p.stripext(), p.ext)``. Split the filename extension from this path and return the two parts. Either part may be empty. The extension is everything from ``'.'`` to the end of the last path segment. This has the property that if ``(a, b) == p.splitext...
[ "p", ".", "splitext", "()", "-", ">", "Return", "(", "p", ".", "stripext", "()", "p", ".", "ext", ")", "." ]
python
train
37.285714
pettarin/ipapy
ipapy/data/__init__.py
https://github.com/pettarin/ipapy/blob/ede4b3c40636f6eb90068369d31a2e75c7115324/ipapy/data/__init__.py#L93-L124
def convert_raw_tuple(value_tuple, format_string): """ Convert a tuple of raw values, according to the given line format. :param tuple value_tuple: the tuple of raw values :param str format_string: the format of the tuple :rtype: list of tuples """ values = [] for v, c in zip(value_tup...
[ "def", "convert_raw_tuple", "(", "value_tuple", ",", "format_string", ")", ":", "values", "=", "[", "]", "for", "v", ",", "c", "in", "zip", "(", "value_tuple", ",", "format_string", ")", ":", "if", "v", "is", "None", ":", "# append None", "values", ".", ...
Convert a tuple of raw values, according to the given line format. :param tuple value_tuple: the tuple of raw values :param str format_string: the format of the tuple :rtype: list of tuples
[ "Convert", "a", "tuple", "of", "raw", "values", "according", "to", "the", "given", "line", "format", "." ]
python
train
30.0625
ninuxorg/nodeshot
nodeshot/community/notifications/registrars/nodes.py
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/community/notifications/registrars/nodes.py#L26-L36
def node_created_handler(sender, **kwargs): """ send notification when a new node is created according to users's settings """ if kwargs['created']: obj = kwargs['instance'] queryset = exclude_owner_of_node(obj) create_notifications.delay(**{ "users": queryset, "n...
[ "def", "node_created_handler", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", "[", "'created'", "]", ":", "obj", "=", "kwargs", "[", "'instance'", "]", "queryset", "=", "exclude_owner_of_node", "(", "obj", ")", "create_notifications", ".",...
send notification when a new node is created according to users's settings
[ "send", "notification", "when", "a", "new", "node", "is", "created", "according", "to", "users", "s", "settings" ]
python
train
39.727273
spyder-ide/spyder
spyder/plugins/ipythonconsole/plugin.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/plugin.py#L1321-L1324
def tab_name_editor(self): """Trigger the tab name editor.""" index = self.tabwidget.currentIndex() self.tabwidget.tabBar().tab_name_editor.edit_tab(index)
[ "def", "tab_name_editor", "(", "self", ")", ":", "index", "=", "self", ".", "tabwidget", ".", "currentIndex", "(", ")", "self", ".", "tabwidget", ".", "tabBar", "(", ")", ".", "tab_name_editor", ".", "edit_tab", "(", "index", ")" ]
Trigger the tab name editor.
[ "Trigger", "the", "tab", "name", "editor", "." ]
python
train
44.75
exa-analytics/exa
exa/util/utility.py
https://github.com/exa-analytics/exa/blob/40fb3c22b531d460dbc51e603de75b856cc28f0d/exa/util/utility.py#L69-L77
def get_internal_modules(key='exa'): """ Get a list of modules belonging to the given package. Args: key (str): Package or library name (e.g. "exa") """ key += '.' return [v for k, v in sys.modules.items() if k.startswith(key)]
[ "def", "get_internal_modules", "(", "key", "=", "'exa'", ")", ":", "key", "+=", "'.'", "return", "[", "v", "for", "k", ",", "v", "in", "sys", ".", "modules", ".", "items", "(", ")", "if", "k", ".", "startswith", "(", "key", ")", "]" ]
Get a list of modules belonging to the given package. Args: key (str): Package or library name (e.g. "exa")
[ "Get", "a", "list", "of", "modules", "belonging", "to", "the", "given", "package", "." ]
python
train
28
DLR-RM/RAFCON
source/rafcon/gui/controllers/library_tree.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/library_tree.py#L241-L252
def on_drag_data_get(self, widget, context, data, info, time): """dragged state is inserted and its state_id sent to the receiver :param widget: :param context: :param data: SelectionData: contains state_id :param info: :param time: """ library_state = se...
[ "def", "on_drag_data_get", "(", "self", ",", "widget", ",", "context", ",", "data", ",", "info", ",", "time", ")", ":", "library_state", "=", "self", ".", "_get_selected_library_state", "(", ")", "import", "rafcon", ".", "gui", ".", "helpers", ".", "state_...
dragged state is inserted and its state_id sent to the receiver :param widget: :param context: :param data: SelectionData: contains state_id :param info: :param time:
[ "dragged", "state", "is", "inserted", "and", "its", "state_id", "sent", "to", "the", "receiver" ]
python
train
41.5
crunchyroll/ef-open
efopen/ef_aws_resolver.py
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L133-L163
def ec2_elasticip_elasticip_ipaddress(self, lookup, default=None): """ Args: lookup: the CloudFormation resource name of the Elastic IP address to look up default: the optional value to return if lookup failed; returns None if not set Returns: The IP address of the first Elastic IP found w...
[ "def", "ec2_elasticip_elasticip_ipaddress", "(", "self", ",", "lookup", ",", "default", "=", "None", ")", ":", "# Extract environment from resource ID to build stack name", "m", "=", "re", ".", "search", "(", "'ElasticIp([A-Z]?[a-z]+[0-9]?)\\w+'", ",", "lookup", ")", "#...
Args: lookup: the CloudFormation resource name of the Elastic IP address to look up default: the optional value to return if lookup failed; returns None if not set Returns: The IP address of the first Elastic IP found with a description matching 'lookup' or default/None if no match
[ "Args", ":", "lookup", ":", "the", "CloudFormation", "resource", "name", "of", "the", "Elastic", "IP", "address", "to", "look", "up", "default", ":", "the", "optional", "value", "to", "return", "if", "lookup", "failed", ";", "returns", "None", "if", "not",...
python
train
42.290323
Zimbra-Community/python-zimbra
pythonzimbra/tools/auth.py
https://github.com/Zimbra-Community/python-zimbra/blob/8b839143c64b0507a30a9908ff39066ae4ef5d03/pythonzimbra/tools/auth.py#L15-L119
def authenticate(url, account, key, by='name', expires=0, timestamp=None, timeout=None, request_type="xml", admin_auth=False, use_password=False, raise_on_error=False): """ Authenticate to the Zimbra server :param url: URL of Zimbra SOAP service :param account: The accoun...
[ "def", "authenticate", "(", "url", ",", "account", ",", "key", ",", "by", "=", "'name'", ",", "expires", "=", "0", ",", "timestamp", "=", "None", ",", "timeout", "=", "None", ",", "request_type", "=", "\"xml\"", ",", "admin_auth", "=", "False", ",", ...
Authenticate to the Zimbra server :param url: URL of Zimbra SOAP service :param account: The account to be authenticated against :param key: The preauth key of the domain of the account or a password (if admin_auth or use_password is True) :param by: If the account is specified as a name, an ID o...
[ "Authenticate", "to", "the", "Zimbra", "server" ]
python
train
26.028571
bububa/pyTOP
pyTOP/systime.py
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/systime.py#L17-L23
def get(self): '''taobao.time.get 获取前台展示的店铺类目 获取淘宝系统当前时间''' request = TOPRequest('taobao.time.get') self.create(self.execute(request)) return self.time
[ "def", "get", "(", "self", ")", ":", "request", "=", "TOPRequest", "(", "'taobao.time.get'", ")", "self", ".", "create", "(", "self", ".", "execute", "(", "request", ")", ")", "return", "self", ".", "time" ]
taobao.time.get 获取前台展示的店铺类目 获取淘宝系统当前时间
[ "taobao", ".", "time", ".", "get", "获取前台展示的店铺类目", "获取淘宝系统当前时间" ]
python
train
27.714286
tehmaze/natural
natural/date.py
https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/date.py#L266-L310
def day(t, now=None, format='%B %d'): ''' Date delta compared to ``t``. You can override ``now`` to specify what date to compare to. You can override the date format by supplying a ``format`` parameter. :param t: timestamp, :class:`datetime.date` or :class:`datetime.datetime` object ...
[ "def", "day", "(", "t", ",", "now", "=", "None", ",", "format", "=", "'%B %d'", ")", ":", "t1", "=", "_to_date", "(", "t", ")", "t2", "=", "_to_date", "(", "now", "or", "datetime", ".", "datetime", ".", "now", "(", ")", ")", "diff", "=", "t1", ...
Date delta compared to ``t``. You can override ``now`` to specify what date to compare to. You can override the date format by supplying a ``format`` parameter. :param t: timestamp, :class:`datetime.date` or :class:`datetime.datetime` object :param now: default ``None``, optionally a :cl...
[ "Date", "delta", "compared", "to", "t", ".", "You", "can", "override", "now", "to", "specify", "what", "date", "to", "compare", "to", "." ]
python
train
26.266667
OzymandiasTheGreat/python-libinput
libinput/device.py
https://github.com/OzymandiasTheGreat/python-libinput/blob/1f477ee9f1d56b284b20e0317ea8967c64ef1218/libinput/device.py#L1687-L1698
def name(self): """The descriptive device name as advertised by the kernel and/or the hardware itself. To get the sysname for this device, use :attr:`sysname`. Returns: str: The device name. """ pchar = self._libinput.libinput_device_get_name(self._handle) return string_at(pchar).decode()
[ "def", "name", "(", "self", ")", ":", "pchar", "=", "self", ".", "_libinput", ".", "libinput_device_get_name", "(", "self", ".", "_handle", ")", "return", "string_at", "(", "pchar", ")", ".", "decode", "(", ")" ]
The descriptive device name as advertised by the kernel and/or the hardware itself. To get the sysname for this device, use :attr:`sysname`. Returns: str: The device name.
[ "The", "descriptive", "device", "name", "as", "advertised", "by", "the", "kernel", "and", "/", "or", "the", "hardware", "itself", "." ]
python
train
24.833333
vmware/pyvmomi
pyVim/task.py
https://github.com/vmware/pyvmomi/blob/3ffcb23bf77d757175c0d5216ba9a25345d824cd/pyVim/task.py#L247-L266
def CreateTasksFilter(pc, tasks): """ Create property collector filter for tasks """ if not tasks: return None # First create the object specification as the task object. objspecs = [vmodl.query.PropertyCollector.ObjectSpec(obj=task) for task in tasks] # Next, create the pr...
[ "def", "CreateTasksFilter", "(", "pc", ",", "tasks", ")", ":", "if", "not", "tasks", ":", "return", "None", "# First create the object specification as the task object.", "objspecs", "=", "[", "vmodl", ".", "query", ".", "PropertyCollector", ".", "ObjectSpec", "(", ...
Create property collector filter for tasks
[ "Create", "property", "collector", "filter", "for", "tasks" ]
python
train
35.7
kensho-technologies/graphql-compiler
graphql_compiler/compiler/ir_lowering_common.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/ir_lowering_common.py#L42-L53
def to_match(self): """Return a unicode object with the MATCH representation of this expression.""" self.validate() mark_name, field_name = self.location.get_location_name() validate_safe_string(mark_name) if field_name is not None: raise AssertionError(u'Vertex loc...
[ "def", "to_match", "(", "self", ")", ":", "self", ".", "validate", "(", ")", "mark_name", ",", "field_name", "=", "self", ".", "location", ".", "get_location_name", "(", ")", "validate_safe_string", "(", "mark_name", ")", "if", "field_name", "is", "not", "...
Return a unicode object with the MATCH representation of this expression.
[ "Return", "a", "unicode", "object", "with", "the", "MATCH", "representation", "of", "this", "expression", "." ]
python
train
37
CalebBell/fluids
fluids/design_climate.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/design_climate.py#L139-L186
def geocode(address): '''Query function to obtain a latitude and longitude from a location string such as `Houston, TX` or`Colombia`. This uses an online lookup, currently wrapping the `geopy` library, and providing an on-disk cache of queries. Parameters ---------- address : str ...
[ "def", "geocode", "(", "address", ")", ":", "loc_tuple", "=", "None", "try", ":", "cache", "=", "geopy_cache", "(", ")", "loc_tuple", "=", "cache", ".", "cached_address", "(", "address", ")", "except", ":", "# Handle bugs in the cache, i.e. if there is no space on...
Query function to obtain a latitude and longitude from a location string such as `Houston, TX` or`Colombia`. This uses an online lookup, currently wrapping the `geopy` library, and providing an on-disk cache of queries. Parameters ---------- address : str Search string to retrieve t...
[ "Query", "function", "to", "obtain", "a", "latitude", "and", "longitude", "from", "a", "location", "string", "such", "as", "Houston", "TX", "or", "Colombia", ".", "This", "uses", "an", "online", "lookup", "currently", "wrapping", "the", "geopy", "library", "...
python
train
28.604167
google/grumpy
third_party/pythonparser/parser.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L1363-L1370
def old_lambdef(self, lambda_loc, args_opt, colon_loc, body): """(2.6, 2.7) old_lambdef: 'lambda' [varargslist] ':' old_test""" if args_opt is None: args_opt = self._arguments() args_opt.loc = colon_loc.begin() return ast.Lambda(args=args_opt, body=body, ...
[ "def", "old_lambdef", "(", "self", ",", "lambda_loc", ",", "args_opt", ",", "colon_loc", ",", "body", ")", ":", "if", "args_opt", "is", "None", ":", "args_opt", "=", "self", ".", "_arguments", "(", ")", "args_opt", ".", "loc", "=", "colon_loc", ".", "b...
(2.6, 2.7) old_lambdef: 'lambda' [varargslist] ':' old_test
[ "(", "2", ".", "6", "2", ".", "7", ")", "old_lambdef", ":", "lambda", "[", "varargslist", "]", ":", "old_test" ]
python
valid
52.75
coin-or/GiMPy
src/gimpy/graph.py
https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L2640-L2670
def simplex_optimal(self, t): ''' API: simplex_optimal(self, t) Description: Checks if the current solution is optimal, if yes returns True, False otherwise. Pre: 'flow' attributes represents a solution. Input: t: Graph ...
[ "def", "simplex_optimal", "(", "self", ",", "t", ")", ":", "for", "e", "in", "self", ".", "edge_attr", ":", "if", "e", "in", "t", ".", "edge_attr", ":", "continue", "flow_ij", "=", "self", ".", "edge_attr", "[", "e", "]", "[", "'flow'", "]", "poten...
API: simplex_optimal(self, t) Description: Checks if the current solution is optimal, if yes returns True, False otherwise. Pre: 'flow' attributes represents a solution. Input: t: Graph instance tat reperesents spanning tree solution. ...
[ "API", ":", "simplex_optimal", "(", "self", "t", ")", "Description", ":", "Checks", "if", "the", "current", "solution", "is", "optimal", "if", "yes", "returns", "True", "False", "otherwise", ".", "Pre", ":", "flow", "attributes", "represents", "a", "solution...
python
train
36.774194
limdauto/drf_openapi
drf_openapi/entities.py
https://github.com/limdauto/drf_openapi/blob/1673c6e039eec7f089336a83bdc31613f32f7e21/drf_openapi/entities.py#L278-L292
def get_serializer_class(self, view, method_func): """ Try to get the serializer class from view method. If view method don't have request serializer, fallback to serializer_class on view class """ if hasattr(method_func, 'request_serializer'): return getattr(method_f...
[ "def", "get_serializer_class", "(", "self", ",", "view", ",", "method_func", ")", ":", "if", "hasattr", "(", "method_func", ",", "'request_serializer'", ")", ":", "return", "getattr", "(", "method_func", ",", "'request_serializer'", ")", "if", "hasattr", "(", ...
Try to get the serializer class from view method. If view method don't have request serializer, fallback to serializer_class on view class
[ "Try", "to", "get", "the", "serializer", "class", "from", "view", "method", ".", "If", "view", "method", "don", "t", "have", "request", "serializer", "fallback", "to", "serializer_class", "on", "view", "class" ]
python
train
37.533333
alpha-xone/xbbg
xbbg/blp.py
https://github.com/alpha-xone/xbbg/blob/70226eb19a72a08144b5d8cea9db4913200f7bc5/xbbg/blp.py#L162-L256
def bdh( tickers, flds=None, start_date=None, end_date='today', adjust=None, **kwargs ) -> pd.DataFrame: """ Bloomberg historical data Args: tickers: ticker(s) flds: field(s) start_date: start date end_date: end date - default today adjust: `all`, `dvd`, `nor...
[ "def", "bdh", "(", "tickers", ",", "flds", "=", "None", ",", "start_date", "=", "None", ",", "end_date", "=", "'today'", ",", "adjust", "=", "None", ",", "*", "*", "kwargs", ")", "->", "pd", ".", "DataFrame", ":", "logger", "=", "logs", ".", "get_l...
Bloomberg historical data Args: tickers: ticker(s) flds: field(s) start_date: start date end_date: end date - default today adjust: `all`, `dvd`, `normal`, `abn` (=abnormal), `split`, `-` or None exact match of above words will adjust for corresponding events...
[ "Bloomberg", "historical", "data" ]
python
valid
37.294737
PolicyStat/docx2html
docx2html/core.py
https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L599-L613
def whole_line_styled(p): """ Checks to see if the whole p tag will end up being bold or italics. Returns a tuple (boolean, boolean). The first boolean will be True if the whole line is bold, False otherwise. The second boolean will be True if the whole line is italics, False otherwise. """ ...
[ "def", "whole_line_styled", "(", "p", ")", ":", "r_tags", "=", "p", ".", "xpath", "(", "'.//w:r'", ",", "namespaces", "=", "p", ".", "nsmap", ")", "tags_are_bold", "=", "[", "is_bold", "(", "r", ")", "or", "is_underlined", "(", "r", ")", "for", "r", ...
Checks to see if the whole p tag will end up being bold or italics. Returns a tuple (boolean, boolean). The first boolean will be True if the whole line is bold, False otherwise. The second boolean will be True if the whole line is italics, False otherwise.
[ "Checks", "to", "see", "if", "the", "whole", "p", "tag", "will", "end", "up", "being", "bold", "or", "italics", ".", "Returns", "a", "tuple", "(", "boolean", "boolean", ")", ".", "The", "first", "boolean", "will", "be", "True", "if", "the", "whole", ...
python
test
37.133333
MostAwesomeDude/gentleman
gentleman/base.py
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1077-L1097
def RepairNodeStorageUnits(r, node, storage_type, name): """ Repairs a storage unit on the node. @type node: str @param node: node whose storage units to repair @type storage_type: str @param storage_type: storage type to repair @type name: str @param name: name of the storage unit to r...
[ "def", "RepairNodeStorageUnits", "(", "r", ",", "node", ",", "storage_type", ",", "name", ")", ":", "query", "=", "{", "\"storage_type\"", ":", "storage_type", ",", "\"name\"", ":", "name", ",", "}", "return", "r", ".", "request", "(", "\"put\"", ",", "\...
Repairs a storage unit on the node. @type node: str @param node: node whose storage units to repair @type storage_type: str @param storage_type: storage type to repair @type name: str @param name: name of the storage unit to repair @rtype: int @return: job id
[ "Repairs", "a", "storage", "unit", "on", "the", "node", "." ]
python
train
24.285714
deepmipt/DeepPavlov
deeppavlov/core/models/keras_model.py
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L61-L71
def _config_session(): """ Configure session for particular device Returns: tensorflow.Session """ config = tf.ConfigProto() config.gpu_options.allow_growth = True config.gpu_options.visible_device_list = '0' return tf.Session(config=config)
[ "def", "_config_session", "(", ")", ":", "config", "=", "tf", ".", "ConfigProto", "(", ")", "config", ".", "gpu_options", ".", "allow_growth", "=", "True", "config", ".", "gpu_options", ".", "visible_device_list", "=", "'0'", "return", "tf", ".", "Session", ...
Configure session for particular device Returns: tensorflow.Session
[ "Configure", "session", "for", "particular", "device" ]
python
test
28
bitprophet/spec
spec/plugin.py
https://github.com/bitprophet/spec/blob/d9646c5daf8e479937f970d21ebe185ad936a35a/spec/plugin.py#L82-L94
def complete_english(string): """ >>> complete_english('dont do this') "don't do this" >>> complete_english('doesnt is matched as well') "doesn't is matched as well" """ for x, y in [("dont", "don't"), ("doesnt", "doesn't"), ("wont", "won't"), ...
[ "def", "complete_english", "(", "string", ")", ":", "for", "x", ",", "y", "in", "[", "(", "\"dont\"", ",", "\"don't\"", ")", ",", "(", "\"doesnt\"", ",", "\"doesn't\"", ")", ",", "(", "\"wont\"", ",", "\"won't\"", ")", ",", "(", "\"wasnt\"", ",", "\"...
>>> complete_english('dont do this') "don't do this" >>> complete_english('doesnt is matched as well') "doesn't is matched as well"
[ ">>>", "complete_english", "(", "dont", "do", "this", ")", "don", "t", "do", "this", ">>>", "complete_english", "(", "doesnt", "is", "matched", "as", "well", ")", "doesn", "t", "is", "matched", "as", "well" ]
python
valid
29.615385
Neurosim-lab/netpyne
netpyne/analysis/spikes.py
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/spikes.py#L295-L549
def plotRaster (include = ['allCells'], timeRange = None, maxSpikes = 1e8, orderBy = 'gid', orderInverse = False, labels = 'legend', popRates = False, spikeHist=None, spikeHistBin=5, syncLines=False, lw=2, marker='|', markerSize=5, popColors=None, figSize=(10, 8), fontSize=12, dpi = 100, saveData = None...
[ "def", "plotRaster", "(", "include", "=", "[", "'allCells'", "]", ",", "timeRange", "=", "None", ",", "maxSpikes", "=", "1e8", ",", "orderBy", "=", "'gid'", ",", "orderInverse", "=", "False", ",", "labels", "=", "'legend'", ",", "popRates", "=", "False",...
Raster plot of network cells - include (['all',|'allCells',|'allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Cells to include (default: 'allCells') - timeRange ([start:stop]): Time range of spikes shown; if None shows all (default: None) - maxSpikes (int): maximum number of spikes that ...
[ "Raster", "plot", "of", "network", "cells", "-", "include", "(", "[", "all", "|", "allCells", "|", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "Cells", "to", "i...
python
train
46.576471
saltstack/salt
salt/modules/memcached.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/memcached.py#L213-L239
def increment(key, delta=1, host=DEFAULT_HOST, port=DEFAULT_PORT): ''' Increment the value of a key CLI Example: .. code-block:: bash salt '*' memcached.increment <key> salt '*' memcached.increment <key> 2 ''' conn = _connect(host, port) _check_stats(conn) cur = get(ke...
[ "def", "increment", "(", "key", ",", "delta", "=", "1", ",", "host", "=", "DEFAULT_HOST", ",", "port", "=", "DEFAULT_PORT", ")", ":", "conn", "=", "_connect", "(", "host", ",", "port", ")", "_check_stats", "(", "conn", ")", "cur", "=", "get", "(", ...
Increment the value of a key CLI Example: .. code-block:: bash salt '*' memcached.increment <key> salt '*' memcached.increment <key> 2
[ "Increment", "the", "value", "of", "a", "key" ]
python
train
27
lobocv/crashreporter
crashreporter/tools.py
https://github.com/lobocv/crashreporter/blob/a5bbb3f37977dc64bc865dfedafc365fd5469ef8/crashreporter/tools.py#L73-L91
def get_object_references(tb, source, max_string_length=1000): """ Find the values of referenced attributes of objects within the traceback scope. :param tb: traceback :return: list of tuples containing (variable name, value) """ global obj_ref_regex referenced_attr = set() for line in ...
[ "def", "get_object_references", "(", "tb", ",", "source", ",", "max_string_length", "=", "1000", ")", ":", "global", "obj_ref_regex", "referenced_attr", "=", "set", "(", ")", "for", "line", "in", "source", ".", "split", "(", "'\\n'", ")", ":", "referenced_at...
Find the values of referenced attributes of objects within the traceback scope. :param tb: traceback :return: list of tuples containing (variable name, value)
[ "Find", "the", "values", "of", "referenced", "attributes", "of", "objects", "within", "the", "traceback", "scope", "." ]
python
train
36.947368
lensacom/sparkit-learn
splearn/pipeline.py
https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/pipeline.py#L264-L298
def transform(self, Z): """TODO: rewrite docstring Transform X separately by each transformer, concatenate results. Parameters ---------- X : array-like or sparse matrix, shape (n_samples, n_features) Input data to be transformed. Returns ------- ...
[ "def", "transform", "(", "self", ",", "Z", ")", ":", "if", "isinstance", "(", "Z", ",", "DictRDD", ")", ":", "X", "=", "Z", "[", ":", ",", "'X'", "]", "else", ":", "X", "=", "Z", "Zs", "=", "[", "_transform_one", "(", "trans", ",", "name", ",...
TODO: rewrite docstring Transform X separately by each transformer, concatenate results. Parameters ---------- X : array-like or sparse matrix, shape (n_samples, n_features) Input data to be transformed. Returns ------- X_t : array-like or sparse matri...
[ "TODO", ":", "rewrite", "docstring", "Transform", "X", "separately", "by", "each", "transformer", "concatenate", "results", ".", "Parameters", "----------", "X", ":", "array", "-", "like", "or", "sparse", "matrix", "shape", "(", "n_samples", "n_features", ")", ...
python
test
35.8
PyGithub/PyGithub
github/AuthenticatedUser.py
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/AuthenticatedUser.py#L893-L903
def get_orgs(self): """ :calls: `GET /user/orgs <http://developer.github.com/v3/orgs>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Organization.Organization` """ return github.PaginatedList.PaginatedList( github.Organization.Organization, ...
[ "def", "get_orgs", "(", "self", ")", ":", "return", "github", ".", "PaginatedList", ".", "PaginatedList", "(", "github", ".", "Organization", ".", "Organization", ",", "self", ".", "_requester", ",", "\"/user/orgs\"", ",", "None", ")" ]
:calls: `GET /user/orgs <http://developer.github.com/v3/orgs>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Organization.Organization`
[ ":", "calls", ":", "GET", "/", "user", "/", "orgs", "<http", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "orgs", ">", "_", ":", "rtype", ":", ":", "class", ":", "github", ".", "PaginatedList", ".", "PaginatedList", "of", ":",...
python
train
35.363636
elsampsa/valkka-live
valkka/mvision/multiprocess.py
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/mvision/multiprocess.py#L334-L340
def deactivate_(self): """Init shmem variables to None """ self.preDeactivate_() self.active = False self.image_dimensions = None self.client = None
[ "def", "deactivate_", "(", "self", ")", ":", "self", ".", "preDeactivate_", "(", ")", "self", ".", "active", "=", "False", "self", ".", "image_dimensions", "=", "None", "self", ".", "client", "=", "None" ]
Init shmem variables to None
[ "Init", "shmem", "variables", "to", "None" ]
python
train
27.142857
airspeed-velocity/asv
asv/extern/asizeof.py
https://github.com/airspeed-velocity/asv/blob/d23bb8b74e8adacbfa3cf5724bda55fb39d56ba6/asv/extern/asizeof.py#L858-L865
def _claskey(obj, style): '''Wrap an old- or new-style class object. ''' i = id(obj) k = _claskeys.get(i, None) if not k: _claskeys[i] = k = _Claskey(obj, style) return k
[ "def", "_claskey", "(", "obj", ",", "style", ")", ":", "i", "=", "id", "(", "obj", ")", "k", "=", "_claskeys", ".", "get", "(", "i", ",", "None", ")", "if", "not", "k", ":", "_claskeys", "[", "i", "]", "=", "k", "=", "_Claskey", "(", "obj", ...
Wrap an old- or new-style class object.
[ "Wrap", "an", "old", "-", "or", "new", "-", "style", "class", "object", "." ]
python
train
24.5
torre76/gd_shortener
gdshortener/gdshortener.py
https://github.com/torre76/gd_shortener/blob/a34becf15512e6193960c93edad6258928705bfa/gdshortener/gdshortener.py#L161-L208
def lookup(self, short_url): ''' Lookup an URL shortened with `is.gd - v.gd url service <http://is.gd/developers.php>`_ and return the real url :param short_url: the url shortened with .gd service :type short_url: str. :returns: str. -- T...
[ "def", "lookup", "(", "self", ",", "short_url", ")", ":", "if", "short_url", "is", "None", "or", "not", "isinstance", "(", "short_url", ",", "basestring", ")", "or", "len", "(", "short_url", ".", "strip", "(", ")", ")", "==", "0", ":", "raise", "GDMa...
Lookup an URL shortened with `is.gd - v.gd url service <http://is.gd/developers.php>`_ and return the real url :param short_url: the url shortened with .gd service :type short_url: str. :returns: str. -- The original url that was shortened with .gd service ...
[ "Lookup", "an", "URL", "shortened", "with", "is", ".", "gd", "-", "v", ".", "gd", "url", "service", "<http", ":", "//", "is", ".", "gd", "/", "developers", ".", "php", ">", "_", "and", "return", "the", "real", "url", ":", "param", "short_url", ":",...
python
train
48.104167
tgsmith61591/pmdarima
pmdarima/arima/arima.py
https://github.com/tgsmith61591/pmdarima/blob/a133de78ba5bd68da9785b061f519ba28cd514cc/pmdarima/arima/arima.py#L1057-L1181
def plot_diagnostics(self, variable=0, lags=10, fig=None, figsize=None): """Plot an ARIMA's diagnostics. Diagnostic plots for standardized residuals of one endogenous variable Parameters ---------- variable : integer, optional Index of the endogenous variable for wh...
[ "def", "plot_diagnostics", "(", "self", ",", "variable", "=", "0", ",", "lags", "=", "10", ",", "fig", "=", "None", ",", "figsize", "=", "None", ")", ":", "# implicitly checks whether installed, and does our backend magic:", "_get_plt", "(", ")", "# We originally ...
Plot an ARIMA's diagnostics. Diagnostic plots for standardized residuals of one endogenous variable Parameters ---------- variable : integer, optional Index of the endogenous variable for which the diagnostic plots should be created. Default is 0. lags ...
[ "Plot", "an", "ARIMA", "s", "diagnostics", "." ]
python
train
38.056
HazyResearch/metal
metal/tuners/tuner.py
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/tuners/tuner.py#L219-L255
def search( self, search_space, valid_data, init_args=[], train_args=[], init_kwargs={}, train_kwargs={}, module_args={}, module_kwargs={}, max_search=None, shuffle=True, verbose=True, **score_kwargs, ): ...
[ "def", "search", "(", "self", ",", "search_space", ",", "valid_data", ",", "init_args", "=", "[", "]", ",", "train_args", "=", "[", "]", ",", "init_kwargs", "=", "{", "}", ",", "train_kwargs", "=", "{", "}", ",", "module_args", "=", "{", "}", ",", ...
Args: search_space: see config_generator() documentation valid_data: a tuple of Tensors (X,Y), a Dataset, or a DataLoader of X (data) and Y (labels) for the dev split init_args: (list) positional args for initializing the model train_args: (list) positiona...
[ "Args", ":", "search_space", ":", "see", "config_generator", "()", "documentation", "valid_data", ":", "a", "tuple", "of", "Tensors", "(", "X", "Y", ")", "a", "Dataset", "or", "a", "DataLoader", "of", "X", "(", "data", ")", "and", "Y", "(", "labels", "...
python
train
38.810811
maartenbreddels/ipyvolume
ipyvolume/widgets.py
https://github.com/maartenbreddels/ipyvolume/blob/e68b72852b61276f8e6793bc8811f5b2432a155f/ipyvolume/widgets.py#L387-L431
def quickvolshow( data, lighting=False, data_min=None, data_max=None, max_shape=256, level=[0.1, 0.5, 0.9], opacity=[0.01, 0.05, 0.1], level_width=0.1, extent=None, memorder='C', **kwargs ): """Visualize a 3d array using volume rendering. :param data: 3d numpy array ...
[ "def", "quickvolshow", "(", "data", ",", "lighting", "=", "False", ",", "data_min", "=", "None", ",", "data_max", "=", "None", ",", "max_shape", "=", "256", ",", "level", "=", "[", "0.1", ",", "0.5", ",", "0.9", "]", ",", "opacity", "=", "[", "0.01...
Visualize a 3d array using volume rendering. :param data: 3d numpy array :param lighting: boolean, to use lighting or not, if set to false, lighting parameters will be overriden :param data_min: minimum value to consider for data, if None, computed using np.nanmin :param data_max: maximum value to cons...
[ "Visualize", "a", "3d", "array", "using", "volume", "rendering", "." ]
python
train
36.377778
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_ip_policy.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_ip_policy.py#L673-L696
def hide_routemap_holder_route_map_content_set_ipv6_next_vrf_next_vrf_list_vrf(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") hide_routemap_holder = ET.SubElement(config, "hide-routemap-holder", xmlns="urn:brocade.com:mgmt:brocade-ip-policy") route_map ...
[ "def", "hide_routemap_holder_route_map_content_set_ipv6_next_vrf_next_vrf_list_vrf", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "hide_routemap_holder", "=", "ET", ".", "SubElement", "(", "config", ","...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
50.708333
GoogleCloudPlatform/google-cloud-datastore
python/googledatastore/helper.py
https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/a23940d0634d7f537faf01ad9e60598046bcb40a/python/googledatastore/helper.py#L322-L325
def set_kind(query_proto, kind): """Set the kind constraint for the given datastore.Query proto message.""" del query_proto.kind[:] query_proto.kind.add().name = kind
[ "def", "set_kind", "(", "query_proto", ",", "kind", ")", ":", "del", "query_proto", ".", "kind", "[", ":", "]", "query_proto", ".", "kind", ".", "add", "(", ")", ".", "name", "=", "kind" ]
Set the kind constraint for the given datastore.Query proto message.
[ "Set", "the", "kind", "constraint", "for", "the", "given", "datastore", ".", "Query", "proto", "message", "." ]
python
train
42.25
portfors-lab/sparkle
sparkle/gui/plotting/pyqtgraph_widgets.py
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/pyqtgraph_widgets.py#L811-L814
def setWindowSize(self, winsz): """Sets the size of scroll window""" self.tracePlot.setWindowSize(winsz) self.stimPlot.setWindowSize(winsz)
[ "def", "setWindowSize", "(", "self", ",", "winsz", ")", ":", "self", ".", "tracePlot", ".", "setWindowSize", "(", "winsz", ")", "self", ".", "stimPlot", ".", "setWindowSize", "(", "winsz", ")" ]
Sets the size of scroll window
[ "Sets", "the", "size", "of", "scroll", "window" ]
python
train
40
saltstack/salt
salt/pillar/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L653-L665
def sort_top_targets(self, top, orders): ''' Returns the sorted high data from the merged top files ''' sorted_top = collections.defaultdict(OrderedDict) # pylint: disable=cell-var-from-loop for saltenv, targets in six.iteritems(top): sorted_targets = sorted(t...
[ "def", "sort_top_targets", "(", "self", ",", "top", ",", "orders", ")", ":", "sorted_top", "=", "collections", ".", "defaultdict", "(", "OrderedDict", ")", "# pylint: disable=cell-var-from-loop", "for", "saltenv", ",", "targets", "in", "six", ".", "iteritems", "...
Returns the sorted high data from the merged top files
[ "Returns", "the", "sorted", "high", "data", "from", "the", "merged", "top", "files" ]
python
train
42.538462
chemlab/chemlab
chemlab/qc/one.py
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/qc/one.py#L67-L92
def V(a,b,C): """ Simple interface to the nuclear attraction function. >>> from pyquante2 import pgbf,cgbf >>> s = pgbf(1) >>> isclose(V(s,s,(0,0,0)),-1.595769) True >>> sc = cgbf(exps=[1],coefs=[1]) >>> isclose(V(sc,sc,(0,0,0)),-1.595769) True >>> sc = cgbf(exps=[1],coefs=[1])...
[ "def", "V", "(", "a", ",", "b", ",", "C", ")", ":", "if", "b", ".", "contracted", ":", "return", "sum", "(", "cb", "*", "V", "(", "pb", ",", "a", ",", "C", ")", "for", "(", "cb", ",", "pb", ")", "in", "b", ")", "elif", "a", ".", "contra...
Simple interface to the nuclear attraction function. >>> from pyquante2 import pgbf,cgbf >>> s = pgbf(1) >>> isclose(V(s,s,(0,0,0)),-1.595769) True >>> sc = cgbf(exps=[1],coefs=[1]) >>> isclose(V(sc,sc,(0,0,0)),-1.595769) True >>> sc = cgbf(exps=[1],coefs=[1]) >>> isclose(V(sc,s,(0...
[ "Simple", "interface", "to", "the", "nuclear", "attraction", "function", ".", ">>>", "from", "pyquante2", "import", "pgbf", "cgbf", ">>>", "s", "=", "pgbf", "(", "1", ")", ">>>", "isclose", "(", "V", "(", "s", "s", "(", "0", "0", "0", "))", "-", "1...
python
train
27.038462
ternaris/marv
docs/tutorial/code/marv_tutorial/__init__.py
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/docs/tutorial/code/marv_tutorial/__init__.py#L124-L147
def gallery_section(images, title): """Create detail section with gallery. Args: title (str): Title to be displayed for detail section. images: stream of marv image files Returns One detail section. """ # pull all images imgs = [] while True: img = yield mar...
[ "def", "gallery_section", "(", "images", ",", "title", ")", ":", "# pull all images", "imgs", "=", "[", "]", "while", "True", ":", "img", "=", "yield", "marv", ".", "pull", "(", "images", ")", "if", "img", "is", "None", ":", "break", "imgs", ".", "ap...
Create detail section with gallery. Args: title (str): Title to be displayed for detail section. images: stream of marv image files Returns One detail section.
[ "Create", "detail", "section", "with", "gallery", "." ]
python
train
26.208333
inspirehep/refextract
refextract/references/text.py
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/text.py#L145-L152
def match_pagination(ref_line): """Remove footer pagination from references lines""" pattern = ur'\(?\[?(\d{1,4})\]?\)?\.?\s*$' re_footer = re.compile(pattern, re.UNICODE) match = re_footer.match(ref_line) if match: return int(match.group(1)) return None
[ "def", "match_pagination", "(", "ref_line", ")", ":", "pattern", "=", "ur'\\(?\\[?(\\d{1,4})\\]?\\)?\\.?\\s*$'", "re_footer", "=", "re", ".", "compile", "(", "pattern", ",", "re", ".", "UNICODE", ")", "match", "=", "re_footer", ".", "match", "(", "ref_line", "...
Remove footer pagination from references lines
[ "Remove", "footer", "pagination", "from", "references", "lines" ]
python
train
34.875
bcbio/bcbio-nextgen
bcbio/upload/__init__.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/upload/__init__.py#L29-L37
def from_sample(sample): """Upload results of processing from an analysis pipeline sample. """ upload_config = sample.get("upload") if upload_config: approach = _approaches[upload_config.get("method", "filesystem")] for finfo in _get_files(sample): approach.update_file(finfo,...
[ "def", "from_sample", "(", "sample", ")", ":", "upload_config", "=", "sample", ".", "get", "(", "\"upload\"", ")", "if", "upload_config", ":", "approach", "=", "_approaches", "[", "upload_config", ".", "get", "(", "\"method\"", ",", "\"filesystem\"", ")", "]...
Upload results of processing from an analysis pipeline sample.
[ "Upload", "results", "of", "processing", "from", "an", "analysis", "pipeline", "sample", "." ]
python
train
39.666667