repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
agoragames/haigha
haigha/frames/frame.py
https://github.com/agoragames/haigha/blob/7b004e1c0316ec14b94fec1c54554654c38b1a25/haigha/frames/frame.py#L49-L84
def read_frames(cls, reader): ''' Read one or more frames from an IO stream. Buffer must support file object interface. After reading, caller will need to check if there are bytes remaining in the stream. If there are, then that implies that there is one or more incompl...
[ "def", "read_frames", "(", "cls", ",", "reader", ")", ":", "rval", "=", "deque", "(", ")", "while", "True", ":", "frame_start_pos", "=", "reader", ".", "tell", "(", ")", "try", ":", "frame", "=", "Frame", ".", "_read_frame", "(", "reader", ")", "exce...
Read one or more frames from an IO stream. Buffer must support file object interface. After reading, caller will need to check if there are bytes remaining in the stream. If there are, then that implies that there is one or more incomplete frames and more data needs to be read. The po...
[ "Read", "one", "or", "more", "frames", "from", "an", "IO", "stream", ".", "Buffer", "must", "support", "file", "object", "interface", "." ]
python
train
smarie/python-parsyfiles
parsyfiles/parsing_registries.py
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_registries.py#L1351-L1413
def get_all_conversion_chains(self, from_type: Type[Any] = JOKER, to_type: Type[Any] = JOKER) \ -> Tuple[List[Converter], List[Converter], List[Converter]]: """ Utility method to find matching converters or conversion chains. :param from_type: a required type of input object, or JOK...
[ "def", "get_all_conversion_chains", "(", "self", ",", "from_type", ":", "Type", "[", "Any", "]", "=", "JOKER", ",", "to_type", ":", "Type", "[", "Any", "]", "=", "JOKER", ")", "->", "Tuple", "[", "List", "[", "Converter", "]", ",", "List", "[", "Conv...
Utility method to find matching converters or conversion chains. :param from_type: a required type of input object, or JOKER for 'wildcard'(*) . WARNING: "from_type=AnyObject/object/Any" means "all converters able to source from anything", which is different from "from_type=JOKER" which means "...
[ "Utility", "method", "to", "find", "matching", "converters", "or", "conversion", "chains", "." ]
python
train
jf-parent/brome
brome/core/selector.py
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/selector.py#L105-L174
def resolve_selector(self): """Resolve the selector variable in place """ effective_selector_list = [] for current_selector in self._selector_list: # INLINE SELECTOR if self.get_type(current_selector) != 'selector_variable': effective_selector_li...
[ "def", "resolve_selector", "(", "self", ")", ":", "effective_selector_list", "=", "[", "]", "for", "current_selector", "in", "self", ".", "_selector_list", ":", "# INLINE SELECTOR", "if", "self", ".", "get_type", "(", "current_selector", ")", "!=", "'selector_vari...
Resolve the selector variable in place
[ "Resolve", "the", "selector", "variable", "in", "place" ]
python
train
4degrees/riffle
source/riffle/model.py
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L105-L122
def fetchChildren(self): '''Fetch and return new children. Will only fetch children whilst canFetchMore is True. .. note:: It is the caller's responsibility to add each fetched child to this parent if desired using :py:meth:`Item.addChild`. ''' if not ...
[ "def", "fetchChildren", "(", "self", ")", ":", "if", "not", "self", ".", "canFetchMore", "(", ")", ":", "return", "[", "]", "children", "=", "self", ".", "_fetchChildren", "(", ")", "self", ".", "_fetched", "=", "True", "return", "children" ]
Fetch and return new children. Will only fetch children whilst canFetchMore is True. .. note:: It is the caller's responsibility to add each fetched child to this parent if desired using :py:meth:`Item.addChild`.
[ "Fetch", "and", "return", "new", "children", "." ]
python
test
blockstack/blockstack-core
blockstack/blockstackd.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/blockstackd.py#L884-L904
def rpc_is_name_zonefile_hash(self, name, zonefile_hash, **con_info): """ Was a zone file hash issued by a name? Return {'result': True/False} """ if not check_name(name) and not check_subdomain(name): return {'error': 'invalid name', 'http_status': 400} if not chec...
[ "def", "rpc_is_name_zonefile_hash", "(", "self", ",", "name", ",", "zonefile_hash", ",", "*", "*", "con_info", ")", ":", "if", "not", "check_name", "(", "name", ")", "and", "not", "check_subdomain", "(", "name", ")", ":", "return", "{", "'error'", ":", "...
Was a zone file hash issued by a name? Return {'result': True/False}
[ "Was", "a", "zone", "file", "hash", "issued", "by", "a", "name?", "Return", "{", "result", ":", "True", "/", "False", "}" ]
python
train
materialsproject/pymatgen
pymatgen/analysis/local_env.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/local_env.py#L1119-L1158
def get_nn_info(self, structure, n): """ Get all near-neighbor sites as well as the associated image locations and weights of the site with index n using the closest neighbor distance-based method. Args: structure (Structure): input structure. n (integer)...
[ "def", "get_nn_info", "(", "self", ",", "structure", ",", "n", ")", ":", "site", "=", "structure", "[", "n", "]", "neighs_dists", "=", "structure", ".", "get_neighbors", "(", "site", ",", "self", ".", "cutoff", ")", "siw", "=", "[", "]", "if", "self"...
Get all near-neighbor sites as well as the associated image locations and weights of the site with index n using the closest neighbor distance-based method. Args: structure (Structure): input structure. n (integer): index of site for which to determine near ...
[ "Get", "all", "near", "-", "neighbor", "sites", "as", "well", "as", "the", "associated", "image", "locations", "and", "weights", "of", "the", "site", "with", "index", "n", "using", "the", "closest", "neighbor", "distance", "-", "based", "method", "." ]
python
train
TestInABox/stackInABox
stackinabox/services/service.py
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/services/service.py#L267-L290
def get_service_regex(base_url, service_url, sub_service): """Get the regex for a given service. :param base_url: string - Base URI :param service_url: string - Service URI under the Base URI :param sub_service: boolean - is the Service URI for a sub-service? :returns: Python R...
[ "def", "get_service_regex", "(", "base_url", ",", "service_url", ",", "sub_service", ")", ":", "# if the specified service_url is already a regex", "# then just use. Otherwise create what we need", "if", "StackInABoxService", ".", "is_regex", "(", "service_url", ")", ":", "lo...
Get the regex for a given service. :param base_url: string - Base URI :param service_url: string - Service URI under the Base URI :param sub_service: boolean - is the Service URI for a sub-service? :returns: Python Regex object containing the regex for the Service
[ "Get", "the", "regex", "for", "a", "given", "service", "." ]
python
train
DataDog/integrations-core
datadog_checks_base/datadog_checks/base/checks/base.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/base.py#L707-L736
def normalize(self, metric, prefix=None, fix_case=False): """ Turn a metric into a well-formed metric name prefix.b.c :param metric The metric name to normalize :param prefix A prefix to to add to the normalized name, default None :param fix_case A boolean, indicating whe...
[ "def", "normalize", "(", "self", ",", "metric", ",", "prefix", "=", "None", ",", "fix_case", "=", "False", ")", ":", "if", "isinstance", "(", "metric", ",", "text_type", ")", ":", "metric", "=", "unicodedata", ".", "normalize", "(", "'NFKD'", ",", "met...
Turn a metric into a well-formed metric name prefix.b.c :param metric The metric name to normalize :param prefix A prefix to to add to the normalized name, default None :param fix_case A boolean, indicating whether to make sure that the metric name returned is in "snake_case"
[ "Turn", "a", "metric", "into", "a", "well", "-", "formed", "metric", "name", "prefix", ".", "b", ".", "c", ":", "param", "metric", "The", "metric", "name", "to", "normalize", ":", "param", "prefix", "A", "prefix", "to", "to", "add", "to", "the", "nor...
python
train
karel-brinda/rnftools
rnftools/rnfformat/FqMerger.py
https://github.com/karel-brinda/rnftools/blob/25510798606fbc803a622a1abfcecf06d00d47a9/rnftools/rnfformat/FqMerger.py#L88-L119
def run(self): """Run merging. """ print("", file=sys.stderr) print("Going to merge/convert RNF-FASTQ files.", file=sys.stderr) print("", file=sys.stderr) print(" mode: ", self.mode, file=sys.stderr) print(" input files: ", ", ".join(self.input_files_fn)...
[ "def", "run", "(", "self", ")", ":", "print", "(", "\"\"", ",", "file", "=", "sys", ".", "stderr", ")", "print", "(", "\"Going to merge/convert RNF-FASTQ files.\"", ",", "file", "=", "sys", ".", "stderr", ")", "print", "(", "\"\"", ",", "file", "=", "s...
Run merging.
[ "Run", "merging", "." ]
python
train
osrg/ryu
ryu/services/protocols/bgp/bgpspeaker.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/bgpspeaker.py#L1077-L1112
def vrfs_get(self, subcommand='routes', route_dist=None, route_family='all', format='json'): """ This method returns the existing vrfs. ``subcommand`` specifies one of the following. - 'routes': shows routes present for vrf - 'summary': shows configuration and summary ...
[ "def", "vrfs_get", "(", "self", ",", "subcommand", "=", "'routes'", ",", "route_dist", "=", "None", ",", "route_family", "=", "'all'", ",", "format", "=", "'json'", ")", ":", "show", "=", "{", "'format'", ":", "format", ",", "}", "if", "route_family", ...
This method returns the existing vrfs. ``subcommand`` specifies one of the following. - 'routes': shows routes present for vrf - 'summary': shows configuration and summary of vrf ``route_dist`` specifies a route distinguisher value. If route_family is not 'all', this value mus...
[ "This", "method", "returns", "the", "existing", "vrfs", "." ]
python
train
paulovn/sparql-kernel
sparqlkernel/connection.py
https://github.com/paulovn/sparql-kernel/blob/1d2d155ff5da72070cb2a98fae33ea8113fac782/sparqlkernel/connection.py#L208-L220
def rdf_iterator(graph, lang, add_vtype=False): """ Convert a Graph response into a double iterable, by triples and elements. Optionally add element type, and filter triples by language (on literals) """ # Return the header row hdr = ('subject', 'predicate', 'object') yield hdr if not add_vt...
[ "def", "rdf_iterator", "(", "graph", ",", "lang", ",", "add_vtype", "=", "False", ")", ":", "# Return the header row", "hdr", "=", "(", "'subject'", ",", "'predicate'", ",", "'object'", ")", "yield", "hdr", "if", "not", "add_vtype", "else", "(", "(", "h", ...
Convert a Graph response into a double iterable, by triples and elements. Optionally add element type, and filter triples by language (on literals)
[ "Convert", "a", "Graph", "response", "into", "a", "double", "iterable", "by", "triples", "and", "elements", ".", "Optionally", "add", "element", "type", "and", "filter", "triples", "by", "language", "(", "on", "literals", ")" ]
python
train
rosenbrockc/ci
pyci/server.py
https://github.com/rosenbrockc/ci/blob/4d5a60291424a83124d1d962d17fb4c7718cde2b/pyci/server.py#L240-L255
def uninstall(self, xmlpath): """Uninstalls the repository with the specified XML path from the server. """ from os import path fullpath = path.abspath(path.expanduser(xmlpath)) if fullpath in self.installed: repo = RepositorySettings(self, fullpath) if re...
[ "def", "uninstall", "(", "self", ",", "xmlpath", ")", ":", "from", "os", "import", "path", "fullpath", "=", "path", ".", "abspath", "(", "path", ".", "expanduser", "(", "xmlpath", ")", ")", "if", "fullpath", "in", "self", ".", "installed", ":", "repo",...
Uninstalls the repository with the specified XML path from the server.
[ "Uninstalls", "the", "repository", "with", "the", "specified", "XML", "path", "from", "the", "server", "." ]
python
train
CLARIAH/grlc
src/utils.py
https://github.com/CLARIAH/grlc/blob/f5664e34f039010c00ef8ebb69917c05e8ce75d7/src/utils.py#L30-L36
def getLoader(user, repo, sha=None, prov=None): """Build a fileLoader (LocalLoader or GithubLoader) for the given repository.""" if user is None and repo is None: loader = LocalLoader() else: loader = GithubLoader(user, repo, sha, prov) return loader
[ "def", "getLoader", "(", "user", ",", "repo", ",", "sha", "=", "None", ",", "prov", "=", "None", ")", ":", "if", "user", "is", "None", "and", "repo", "is", "None", ":", "loader", "=", "LocalLoader", "(", ")", "else", ":", "loader", "=", "GithubLoad...
Build a fileLoader (LocalLoader or GithubLoader) for the given repository.
[ "Build", "a", "fileLoader", "(", "LocalLoader", "or", "GithubLoader", ")", "for", "the", "given", "repository", "." ]
python
train
czepluch/pysecp256k1
c_secp256k1/__init__.py
https://github.com/czepluch/pysecp256k1/blob/164cb305857c5ba7a26adb6bd85459c5ea32ddd1/c_secp256k1/__init__.py#L213-L233
def ecdsa_sign_compact(msg32, seckey): """ Takes the same message and seckey as _ecdsa_sign_recoverable Returns an unsigned char array of length 65 containing the signed message """ # Assign 65 bytes to output output64 = ffi.new("unsigned char[65]") # ffi definition of recid reci...
[ "def", "ecdsa_sign_compact", "(", "msg32", ",", "seckey", ")", ":", "# Assign 65 bytes to output", "output64", "=", "ffi", ".", "new", "(", "\"unsigned char[65]\"", ")", "# ffi definition of recid", "recid", "=", "ffi", ".", "new", "(", "\"int *\"", ")", "lib", ...
Takes the same message and seckey as _ecdsa_sign_recoverable Returns an unsigned char array of length 65 containing the signed message
[ "Takes", "the", "same", "message", "and", "seckey", "as", "_ecdsa_sign_recoverable", "Returns", "an", "unsigned", "char", "array", "of", "length", "65", "containing", "the", "signed", "message" ]
python
train
quintusdias/glymur
glymur/jp2box.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L436-L448
def write(self, fptr): """Write an Colour Specification box to file. """ self._write_validate() length = 15 if self.icc_profile is None else 11 + len(self.icc_profile) fptr.write(struct.pack('>I4s', length, b'colr')) read_buffer = struct.pack('>BBBI', ...
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "self", ".", "_write_validate", "(", ")", "length", "=", "15", "if", "self", ".", "icc_profile", "is", "None", "else", "11", "+", "len", "(", "self", ".", "icc_profile", ")", "fptr", ".", "write", ...
Write an Colour Specification box to file.
[ "Write", "an", "Colour", "Specification", "box", "to", "file", "." ]
python
train
mlperf/training
translation/tensorflow/transformer/utils/tokenizer.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/utils/tokenizer.py#L216-L221
def _unicode_to_native(s): """Convert string from unicode to native format (required in Python 2).""" if six.PY2: return s.encode("utf-8") if isinstance(s, unicode) else s else: return s
[ "def", "_unicode_to_native", "(", "s", ")", ":", "if", "six", ".", "PY2", ":", "return", "s", ".", "encode", "(", "\"utf-8\"", ")", "if", "isinstance", "(", "s", ",", "unicode", ")", "else", "s", "else", ":", "return", "s" ]
Convert string from unicode to native format (required in Python 2).
[ "Convert", "string", "from", "unicode", "to", "native", "format", "(", "required", "in", "Python", "2", ")", "." ]
python
train
mapillary/mapillary_tools
mapillary_tools/process_video.py
https://github.com/mapillary/mapillary_tools/blob/816785e90c589cae6e8e34a5530ce8417d29591c/mapillary_tools/process_video.py#L194-L209
def get_video_end_time(video_file): """Get video end time in seconds""" if not os.path.isfile(video_file): print("Error, video file {} does not exist".format(video_file)) return None try: time_string = FFProbe(video_file).video[0].creation_time try: creation_time ...
[ "def", "get_video_end_time", "(", "video_file", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "video_file", ")", ":", "print", "(", "\"Error, video file {} does not exist\"", ".", "format", "(", "video_file", ")", ")", "return", "None", "try", ...
Get video end time in seconds
[ "Get", "video", "end", "time", "in", "seconds" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/data_generators/algorithmic_math.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/algorithmic_math.py#L158-L211
def algebra_inverse_solve(left, right, var, solve_ops): """Solves for the value of the given var in an expression. Args: left: The root of the ExprNode tree on the left side of the equals sign. right: The root of the ExprNode tree on the right side of the equals sign. var: A char. The variable to solve...
[ "def", "algebra_inverse_solve", "(", "left", ",", "right", ",", "var", ",", "solve_ops", ")", ":", "is_in_left", "=", "is_in_expr", "(", "left", ",", "var", ")", "is_in_right", "=", "is_in_expr", "(", "right", ",", "var", ")", "if", "is_in_left", "==", "...
Solves for the value of the given var in an expression. Args: left: The root of the ExprNode tree on the left side of the equals sign. right: The root of the ExprNode tree on the right side of the equals sign. var: A char. The variable to solve for. solve_ops: A dictionary with the following properti...
[ "Solves", "for", "the", "value", "of", "the", "given", "var", "in", "an", "expression", "." ]
python
train
inspirehep/inspire-schemas
inspire_schemas/builders/literature.py
https://github.com/inspirehep/inspire-schemas/blob/34bc124b62fba565b6b40d1a3c15103a23a05edb/inspire_schemas/builders/literature.py#L319-L333
def add_book_series(self, title, volume=None): """ :param volume: the volume of the book :type volume: string :param title: the title of the book :type title: string """ book_series = {} if title is not None: book_series['title'] = title ...
[ "def", "add_book_series", "(", "self", ",", "title", ",", "volume", "=", "None", ")", ":", "book_series", "=", "{", "}", "if", "title", "is", "not", "None", ":", "book_series", "[", "'title'", "]", "=", "title", "if", "volume", "is", "not", "None", "...
:param volume: the volume of the book :type volume: string :param title: the title of the book :type title: string
[ ":", "param", "volume", ":", "the", "volume", "of", "the", "book", ":", "type", "volume", ":", "string" ]
python
train
fbcotter/py3nvml
py3nvml/py3nvml.py
https://github.com/fbcotter/py3nvml/blob/47f0f2c0eee56dec4e4beebec26b734e01d357b7/py3nvml/py3nvml.py#L2590-L2615
def nvmlDeviceGetPciInfo(handle): r""" /** * Retrieves the PCI attributes of this device. * * For all products. * * See \ref nvmlPciInfo_t for details on the available PCI info. * * @param device The identifier of the target device * @param p...
[ "def", "nvmlDeviceGetPciInfo", "(", "handle", ")", ":", "c_info", "=", "nvmlPciInfo_t", "(", ")", "fn", "=", "_nvmlGetFunctionPointer", "(", "\"nvmlDeviceGetPciInfo_v2\"", ")", "ret", "=", "fn", "(", "handle", ",", "byref", "(", "c_info", ")", ")", "_nvmlCheck...
r""" /** * Retrieves the PCI attributes of this device. * * For all products. * * See \ref nvmlPciInfo_t for details on the available PCI info. * * @param device The identifier of the target device * @param pci Re...
[ "r", "/", "**", "*", "Retrieves", "the", "PCI", "attributes", "of", "this", "device", ".", "*", "*", "For", "all", "products", ".", "*", "*", "See", "\\", "ref", "nvmlPciInfo_t", "for", "details", "on", "the", "available", "PCI", "info", ".", "*", "*...
python
train
MechanicalSoup/MechanicalSoup
mechanicalsoup/stateful_browser.py
https://github.com/MechanicalSoup/MechanicalSoup/blob/027a270febf5bcda6a75db60ea9838d631370f4b/mechanicalsoup/stateful_browser.py#L335-L366
def download_link(self, link=None, file=None, *args, **kwargs): """Downloads the contents of a link to a file. This function behaves similarly to :func:`follow_link`, but the browser state will not change when calling this function. :param file: Filesystem path where the page contents w...
[ "def", "download_link", "(", "self", ",", "link", "=", "None", ",", "file", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "link", "=", "self", ".", "_find_link_internal", "(", "link", ",", "args", ",", "kwargs", ")", "url", "=",...
Downloads the contents of a link to a file. This function behaves similarly to :func:`follow_link`, but the browser state will not change when calling this function. :param file: Filesystem path where the page contents will be downloaded. If the file already exists, it will be overw...
[ "Downloads", "the", "contents", "of", "a", "link", "to", "a", "file", ".", "This", "function", "behaves", "similarly", "to", ":", "func", ":", "follow_link", "but", "the", "browser", "state", "will", "not", "change", "when", "calling", "this", "function", ...
python
train
dailymuse/oz
oz/error_pages/middleware.py
https://github.com/dailymuse/oz/blob/4329f6a207dc9d2a8fbeb4d16d415dbe4570b5bd/oz/error_pages/middleware.py#L16-L44
def _on_error_page_write_error(self, status_code, **kwargs): """Replaces the default Tornado error page with a Django-styled one""" if oz.settings.get('debug'): exception_type, exception_value, tback = sys.exc_info() is_breakpoint = isinstance(exception_value, oz.error_pages.Deb...
[ "def", "_on_error_page_write_error", "(", "self", ",", "status_code", ",", "*", "*", "kwargs", ")", ":", "if", "oz", ".", "settings", ".", "get", "(", "'debug'", ")", ":", "exception_type", ",", "exception_value", ",", "tback", "=", "sys", ".", "exc_info",...
Replaces the default Tornado error page with a Django-styled one
[ "Replaces", "the", "default", "Tornado", "error", "page", "with", "a", "Django", "-", "styled", "one" ]
python
train
EUDAT-B2SAFE/B2HANDLE
b2handle/handleclient.py
https://github.com/EUDAT-B2SAFE/B2HANDLE/blob/a6d216d459644e01fbdfd5b318a535950bc5cdbb/b2handle/handleclient.py#L365-L402
def is_10320LOC_empty(self, handle, handlerecord_json=None): ''' Checks if there is a 10320/LOC entry in the handle record. *Note:* In the unlikely case that there is a 10320/LOC entry, but it does not contain any locations, it is treated as if there was none. :param handle: The...
[ "def", "is_10320LOC_empty", "(", "self", ",", "handle", ",", "handlerecord_json", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "'is_10320LOC_empty...'", ")", "handlerecord_json", "=", "self", ".", "__get_handle_record_if_necessary", "(", "handle", ",", "han...
Checks if there is a 10320/LOC entry in the handle record. *Note:* In the unlikely case that there is a 10320/LOC entry, but it does not contain any locations, it is treated as if there was none. :param handle: The handle. :param handlerecord_json: Optional. The content of the response ...
[ "Checks", "if", "there", "is", "a", "10320", "/", "LOC", "entry", "in", "the", "handle", "record", ".", "*", "Note", ":", "*", "In", "the", "unlikely", "case", "that", "there", "is", "a", "10320", "/", "LOC", "entry", "but", "it", "does", "not", "c...
python
train
markovmodel/PyEMMA
setup_util.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/setup_util.py#L114-L128
def has_flag(compiler, flagname): """Return a boolean indicating whether a flag name is supported on the specified compiler. """ with TemporaryDirectory() as tmpdir, \ stdchannel_redirected(sys.stderr, os.devnull), \ stdchannel_redirected(sys.stdout, os.devnull): f = temp...
[ "def", "has_flag", "(", "compiler", ",", "flagname", ")", ":", "with", "TemporaryDirectory", "(", ")", "as", "tmpdir", ",", "stdchannel_redirected", "(", "sys", ".", "stderr", ",", "os", ".", "devnull", ")", ",", "stdchannel_redirected", "(", "sys", ".", "...
Return a boolean indicating whether a flag name is supported on the specified compiler.
[ "Return", "a", "boolean", "indicating", "whether", "a", "flag", "name", "is", "supported", "on", "the", "specified", "compiler", "." ]
python
train
dhermes/bezier
docs/make_images.py
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/docs/make_images.py#L48-L57
def save_image(figure, filename): """Save an image to the docs images directory. Args: filename (str): The name of the file (not containing directory info). """ path = os.path.join(IMAGES_DIR, filename) figure.savefig(path, bbox_inches="tight") plt.close(figure)
[ "def", "save_image", "(", "figure", ",", "filename", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "IMAGES_DIR", ",", "filename", ")", "figure", ".", "savefig", "(", "path", ",", "bbox_inches", "=", "\"tight\"", ")", "plt", ".", "close", ...
Save an image to the docs images directory. Args: filename (str): The name of the file (not containing directory info).
[ "Save", "an", "image", "to", "the", "docs", "images", "directory", "." ]
python
train
xtuml/pyxtuml
bridgepoint/oal.py
https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1572-L1580
def p_select_from_where_statement_2(self, p): ''' statement : SELECT ANY variable_name FROM identifier WHERE expression | SELECT MANY variable_name FROM identifier WHERE expression ''' p[0] = SelectFromWhereNode(cardinality=p[2], varia...
[ "def", "p_select_from_where_statement_2", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "SelectFromWhereNode", "(", "cardinality", "=", "p", "[", "2", "]", ",", "variable_name", "=", "p", "[", "3", "]", ",", "key_letter", "=", "p", "[", "...
statement : SELECT ANY variable_name FROM identifier WHERE expression | SELECT MANY variable_name FROM identifier WHERE expression
[ "statement", ":", "SELECT", "ANY", "variable_name", "FROM", "identifier", "WHERE", "expression", "|", "SELECT", "MANY", "variable_name", "FROM", "identifier", "WHERE", "expression" ]
python
test
xsleonard/pystmark
pystmark.py
https://github.com/xsleonard/pystmark/blob/329ccae1a7c8d57f28fa72cd8dbbee3e39413ed6/pystmark.py#L379-L387
def add_header(self, name, value): '''Attach an email header to send with the message. :param name: The name of the header value. :param value: The header value. ''' if self.headers is None: self.headers = [] self.headers.append(dict(Name=name, Value=value))
[ "def", "add_header", "(", "self", ",", "name", ",", "value", ")", ":", "if", "self", ".", "headers", "is", "None", ":", "self", ".", "headers", "=", "[", "]", "self", ".", "headers", ".", "append", "(", "dict", "(", "Name", "=", "name", ",", "Val...
Attach an email header to send with the message. :param name: The name of the header value. :param value: The header value.
[ "Attach", "an", "email", "header", "to", "send", "with", "the", "message", "." ]
python
train
openid/python-openid
openid/consumer/consumer.py
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/consumer/consumer.py#L592-L608
def begin(self, service_endpoint): """Create an AuthRequest object for the specified service_endpoint. This method will create an association if necessary.""" if self.store is None: assoc = None else: assoc = self._getAssociation(service_endpoint) ...
[ "def", "begin", "(", "self", ",", "service_endpoint", ")", ":", "if", "self", ".", "store", "is", "None", ":", "assoc", "=", "None", "else", ":", "assoc", "=", "self", ".", "_getAssociation", "(", "service_endpoint", ")", "request", "=", "AuthRequest", "...
Create an AuthRequest object for the specified service_endpoint. This method will create an association if necessary.
[ "Create", "an", "AuthRequest", "object", "for", "the", "specified", "service_endpoint", ".", "This", "method", "will", "create", "an", "association", "if", "necessary", "." ]
python
train
bodylabs/lace
lace/meshviewer.py
https://github.com/bodylabs/lace/blob/b68f4a60a4cac66c0607ffbae38ef9d07d37f459/lace/meshviewer.py#L840-L869
def on_click(self, button, button_state, cursor_x, cursor_y): """ Mouse button clicked. Glut calls this function when a mouse button is clicked or released. """ self.isdragging = False if button == glut.GLUT_LEFT_BUTTON and button_state == glut.GLUT_UP: ...
[ "def", "on_click", "(", "self", ",", "button", ",", "button_state", ",", "cursor_x", ",", "cursor_y", ")", ":", "self", ".", "isdragging", "=", "False", "if", "button", "==", "glut", ".", "GLUT_LEFT_BUTTON", "and", "button_state", "==", "glut", ".", "GLUT_...
Mouse button clicked. Glut calls this function when a mouse button is clicked or released.
[ "Mouse", "button", "clicked", ".", "Glut", "calls", "this", "function", "when", "a", "mouse", "button", "is", "clicked", "or", "released", "." ]
python
train
thespacedoctor/transientNamer
transientNamer/search.py
https://github.com/thespacedoctor/transientNamer/blob/39be410c84275ed4669632f5df67e728d66a318f/transientNamer/search.py#L973-L1106
def _parse_photometry_data( self, content, TNSId): """*parse photometry data from a row in the tns results content* **Key Arguments:** - ``content`` -- a table row from the TNS results page - ``TNSId`` -- the tns id of the transient ...
[ "def", "_parse_photometry_data", "(", "self", ",", "content", ",", "TNSId", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``_parse_photometry_data`` method'", ")", "photData", "=", "[", "]", "relatedFilesTable", "=", "[", "]", "# AT REPORT BLOCK",...
*parse photometry data from a row in the tns results content* **Key Arguments:** - ``content`` -- a table row from the TNS results page - ``TNSId`` -- the tns id of the transient **Return:** - ``photData`` -- a list of dictionaries of the photometry data ...
[ "*", "parse", "photometry", "data", "from", "a", "row", "in", "the", "tns", "results", "content", "*" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_qos.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_qos.py#L226-L239
def qos_map_cos_mutation_cos4(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") qos = ET.SubElement(config, "qos", xmlns="urn:brocade.com:mgmt:brocade-qos") map = ET.SubElement(qos, "map") cos_mutation = ET.SubElement(map, "cos-mutation") n...
[ "def", "qos_map_cos_mutation_cos4", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "qos", "=", "ET", ".", "SubElement", "(", "config", ",", "\"qos\"", ",", "xmlns", "=", "\"urn:brocade.com:mgmt:...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
auth0/auth0-python
auth0/v3/management/client_grants.py
https://github.com/auth0/auth0-python/blob/34adad3f342226aaaa6071387fa405ab840e5c02/auth0/v3/management/client_grants.py#L27-L54
def all(self, audience=None, page=None, per_page=None, include_totals=False, client_id=None): """Retrieves all client grants. Args: audience (str, optional): URL encoded audience of a Resource Server to filter page (int, optional): The result's page number (zero...
[ "def", "all", "(", "self", ",", "audience", "=", "None", ",", "page", "=", "None", ",", "per_page", "=", "None", ",", "include_totals", "=", "False", ",", "client_id", "=", "None", ")", ":", "params", "=", "{", "'audience'", ":", "audience", ",", "'p...
Retrieves all client grants. Args: audience (str, optional): URL encoded audience of a Resource Server to filter page (int, optional): The result's page number (zero based). per_page (int, optional): The amount of entries per page. include_tota...
[ "Retrieves", "all", "client", "grants", "." ]
python
train
fastai/fastai
fastai/data_block.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/data_block.py#L294-L302
def label_from_re(self, pat:str, full_path:bool=False, label_cls:Callable=None, **kwargs)->'LabelList': "Apply the re in `pat` to determine the label of every filename. If `full_path`, search in the full name." pat = re.compile(pat) def _inner(o): s = str((os.path.join(self.path,o) ...
[ "def", "label_from_re", "(", "self", ",", "pat", ":", "str", ",", "full_path", ":", "bool", "=", "False", ",", "label_cls", ":", "Callable", "=", "None", ",", "*", "*", "kwargs", ")", "->", "'LabelList'", ":", "pat", "=", "re", ".", "compile", "(", ...
Apply the re in `pat` to determine the label of every filename. If `full_path`, search in the full name.
[ "Apply", "the", "re", "in", "pat", "to", "determine", "the", "label", "of", "every", "filename", ".", "If", "full_path", "search", "in", "the", "full", "name", "." ]
python
train
aparo/pyes
pyes/orm/queryset.py
https://github.com/aparo/pyes/blob/712eb6095961755067b2b5baa262008ade6584b3/pyes/orm/queryset.py#L1158-L1164
def size(self, size): """ Set the query size of this QuerySet should execute its query against. """ clone = self._clone() clone._size = size return clone
[ "def", "size", "(", "self", ",", "size", ")", ":", "clone", "=", "self", ".", "_clone", "(", ")", "clone", ".", "_size", "=", "size", "return", "clone" ]
Set the query size of this QuerySet should execute its query against.
[ "Set", "the", "query", "size", "of", "this", "QuerySet", "should", "execute", "its", "query", "against", "." ]
python
train
tommyod/streprogen
streprogen/utils.py
https://github.com/tommyod/streprogen/blob/21b903618e8b2d398bceb394d18d7c74ca984def/streprogen/utils.py#L197-L224
def min_between(min_reps=3, max_reps=8, percentile=0.33): """Function to decide the minimum number of reps to perform given `min_reps` and `max_rep`. Parameters ---------- min_reps The minimum number of repeitions. max_reps The maximum number of repetitions. percentile ...
[ "def", "min_between", "(", "min_reps", "=", "3", ",", "max_reps", "=", "8", ",", "percentile", "=", "0.33", ")", ":", "higher_limit", "=", "min_reps", "+", "(", "max_reps", "-", "min_reps", ")", "*", "percentile", "return", "min_reps", ",", "math", ".", ...
Function to decide the minimum number of reps to perform given `min_reps` and `max_rep`. Parameters ---------- min_reps The minimum number of repeitions. max_reps The maximum number of repetitions. percentile The percentile to cap at. Return ------- (low, ...
[ "Function", "to", "decide", "the", "minimum", "number", "of", "reps", "to", "perform", "given", "min_reps", "and", "max_rep", "." ]
python
train
ericmjl/hiveplot
hiveplot/hiveplot.py
https://github.com/ericmjl/hiveplot/blob/f465a7118b7f005c83ab054d400deb02bd9f7410/hiveplot/hiveplot.py#L105-L110
def initialize_major_angle(self): """ Computes the major angle: 2pi radians / number of groups. """ num_groups = len(self.nodes.keys()) self.major_angle = 2 * np.pi / num_groups
[ "def", "initialize_major_angle", "(", "self", ")", ":", "num_groups", "=", "len", "(", "self", ".", "nodes", ".", "keys", "(", ")", ")", "self", ".", "major_angle", "=", "2", "*", "np", ".", "pi", "/", "num_groups" ]
Computes the major angle: 2pi radians / number of groups.
[ "Computes", "the", "major", "angle", ":", "2pi", "radians", "/", "number", "of", "groups", "." ]
python
valid
pypa/pipenv
tasks/vendoring/__init__.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/tasks/vendoring/__init__.py#L588-L600
def license_fallback(vendor_dir, sdist_name): """Hardcoded license URLs. Check when updating if those are still needed""" libname = libname_from_dir(sdist_name) if libname not in HARDCODED_LICENSE_URLS: raise ValueError('No hardcoded URL for {} license'.format(libname)) url = HARDCODED_LICENSE_...
[ "def", "license_fallback", "(", "vendor_dir", ",", "sdist_name", ")", ":", "libname", "=", "libname_from_dir", "(", "sdist_name", ")", "if", "libname", "not", "in", "HARDCODED_LICENSE_URLS", ":", "raise", "ValueError", "(", "'No hardcoded URL for {} license'", ".", ...
Hardcoded license URLs. Check when updating if those are still needed
[ "Hardcoded", "license", "URLs", ".", "Check", "when", "updating", "if", "those", "are", "still", "needed" ]
python
train
numenta/nupic
src/nupic/database/client_jobs_dao.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L2064-L2094
def jobsGetFields(self, jobIDs, fields, requireAll=True): """ Fetch the values of 1 or more fields from a sequence of job records. Here, 'fields' is a sequence (list or tuple) with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as ...
[ "def", "jobsGetFields", "(", "self", ",", "jobIDs", ",", "fields", ",", "requireAll", "=", "True", ")", ":", "assert", "isinstance", "(", "jobIDs", ",", "self", ".", "_SEQUENCE_TYPES", ")", "assert", "len", "(", "jobIDs", ")", ">=", "1", "rows", "=", "...
Fetch the values of 1 or more fields from a sequence of job records. Here, 'fields' is a sequence (list or tuple) with the names of the fields to fetch. The names are the public names of the fields (camelBack, not the lower_case_only form as stored in the DB). WARNING!!!: The order of the results are N...
[ "Fetch", "the", "values", "of", "1", "or", "more", "fields", "from", "a", "sequence", "of", "job", "records", ".", "Here", "fields", "is", "a", "sequence", "(", "list", "or", "tuple", ")", "with", "the", "names", "of", "the", "fields", "to", "fetch", ...
python
valid
ewels/MultiQC
multiqc/modules/dedup/dedup.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/dedup/dedup.py#L83-L98
def dedup_general_stats_table(self): """ Take the parsed stats from the DeDup report and add it to the basic stats table at the top of the report """ headers = OrderedDict() headers['duplication_rate'] = { 'title': 'Duplication Rate', 'description': 'Percentage o...
[ "def", "dedup_general_stats_table", "(", "self", ")", ":", "headers", "=", "OrderedDict", "(", ")", "headers", "[", "'duplication_rate'", "]", "=", "{", "'title'", ":", "'Duplication Rate'", ",", "'description'", ":", "'Percentage of reads categorised as a technical dup...
Take the parsed stats from the DeDup report and add it to the basic stats table at the top of the report
[ "Take", "the", "parsed", "stats", "from", "the", "DeDup", "report", "and", "add", "it", "to", "the", "basic", "stats", "table", "at", "the", "top", "of", "the", "report" ]
python
train
evonove/django-money-rates
djmoney_rates/utils.py
https://github.com/evonove/django-money-rates/blob/ac1f7636b9a38d3e153eb833019342c4d88634c2/djmoney_rates/utils.py#L24-L32
def get_rate_source(): """Get the default Rate Source and return it.""" backend = money_rates_settings.DEFAULT_BACKEND() try: return RateSource.objects.get(name=backend.get_source_name()) except RateSource.DoesNotExist: raise CurrencyConversionException( "Rate for %s source d...
[ "def", "get_rate_source", "(", ")", ":", "backend", "=", "money_rates_settings", ".", "DEFAULT_BACKEND", "(", ")", "try", ":", "return", "RateSource", ".", "objects", ".", "get", "(", "name", "=", "backend", ".", "get_source_name", "(", ")", ")", "except", ...
Get the default Rate Source and return it.
[ "Get", "the", "default", "Rate", "Source", "and", "return", "it", "." ]
python
train
python-gitlab/python-gitlab
gitlab/v4/objects.py
https://github.com/python-gitlab/python-gitlab/blob/16de1b03fde3dbbe8f851614dd1d8c09de102fe5/gitlab/v4/objects.py#L1696-L1716
def list(self, **kwargs): """Retrieve a list of objects. Args: all (bool): If True, return all the items, without pagination per_page (int): Number of items to retrieve per request page (int): ID of the page to return (starts with page 1) as_list (bool): ...
[ "def", "list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "path", "=", "self", ".", "_compute_path", "(", "'/projects/%(project_id)s/forks'", ")", "return", "ListMixin", ".", "list", "(", "self", ",", "path", "=", "path", ",", "*", "*", "kwargs", ...
Retrieve a list of objects. Args: all (bool): If True, return all the items, without pagination per_page (int): Number of items to retrieve per request page (int): ID of the page to return (starts with page 1) as_list (bool): If set to False and no pagination opt...
[ "Retrieve", "a", "list", "of", "objects", "." ]
python
train
theno/fabsetup
fabsetup/fabutils.py
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L725-L732
def uncomment_or_update_or_append_line(filename, prefix, new_line, comment='#', keep_backup=True): '''Remove the comment of an commented out line and make the line "active". If such an commented out line not exists it would be appended. ''' return uua_local(filena...
[ "def", "uncomment_or_update_or_append_line", "(", "filename", ",", "prefix", ",", "new_line", ",", "comment", "=", "'#'", ",", "keep_backup", "=", "True", ")", ":", "return", "uua_local", "(", "filename", ",", "prefix", ",", "new_line", ",", "comment", ",", ...
Remove the comment of an commented out line and make the line "active". If such an commented out line not exists it would be appended.
[ "Remove", "the", "comment", "of", "an", "commented", "out", "line", "and", "make", "the", "line", "active", "." ]
python
train
niemasd/TreeSwift
treeswift/Tree.py
https://github.com/niemasd/TreeSwift/blob/7e0cbc770fcc2ee1194ef7c2a0ab9fb82f089917/treeswift/Tree.py#L111-L128
def coalescence_waiting_times(self, backward=True): '''Generator over the waiting times of successive coalescence events Args: ``backward`` (``bool``): ``True`` to go backward in time (i.e., leaves to root), otherwise ``False`` ''' if not isinstance(backward, bool): ...
[ "def", "coalescence_waiting_times", "(", "self", ",", "backward", "=", "True", ")", ":", "if", "not", "isinstance", "(", "backward", ",", "bool", ")", ":", "raise", "TypeError", "(", "\"backward must be a bool\"", ")", "times", "=", "list", "(", ")", "lowest...
Generator over the waiting times of successive coalescence events Args: ``backward`` (``bool``): ``True`` to go backward in time (i.e., leaves to root), otherwise ``False``
[ "Generator", "over", "the", "waiting", "times", "of", "successive", "coalescence", "events" ]
python
train
smarie/python-parsyfiles
parsyfiles/filesystem_mapping.py
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/filesystem_mapping.py#L67-L84
def create(location: str, simpleobjects_found = None, complexobject_attributes_found = None): # -> ObjectNotFoundOnFileSystemError: """ Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests https://github.com/nose-devs/nose/issues/725 ...
[ "def", "create", "(", "location", ":", "str", ",", "simpleobjects_found", "=", "None", ",", "complexobject_attributes_found", "=", "None", ")", ":", "# -> ObjectNotFoundOnFileSystemError:", "if", "len", "(", "complexobject_attributes_found", ")", ">", "0", "or", "le...
Helper method provided because we actually can't put that in the constructor, it creates a bug in Nose tests https://github.com/nose-devs/nose/issues/725 :param location: :return:
[ "Helper", "method", "provided", "because", "we", "actually", "can", "t", "put", "that", "in", "the", "constructor", "it", "creates", "a", "bug", "in", "Nose", "tests", "https", ":", "//", "github", ".", "com", "/", "nose", "-", "devs", "/", "nose", "/"...
python
train
flatangle/flatlib
flatlib/dignities/accidental.py
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/dignities/accidental.py#L74-L122
def haiz(obj, chart): """ Returns if an object is in Haiz. """ objGender = obj.gender() objFaction = obj.faction() if obj.id == const.MERCURY: # Gender and faction of mercury depends on orientality sun = chart.getObject(const.SUN) orientalityM = orientality(obj, sun) ...
[ "def", "haiz", "(", "obj", ",", "chart", ")", ":", "objGender", "=", "obj", ".", "gender", "(", ")", "objFaction", "=", "obj", ".", "faction", "(", ")", "if", "obj", ".", "id", "==", "const", ".", "MERCURY", ":", "# Gender and faction of mercury depends ...
Returns if an object is in Haiz.
[ "Returns", "if", "an", "object", "is", "in", "Haiz", "." ]
python
train
totalgood/nlpia
src/nlpia/clean_alice.py
https://github.com/totalgood/nlpia/blob/efa01126275e9cd3c3a5151a644f1c798a9ec53f/src/nlpia/clean_alice.py#L85-L98
def extract_aiml(path='aiml-en-us-foundation-alice.v1-9'): """ Extract an aiml.zip file if it hasn't been already and return a list of aiml file paths """ path = find_data_path(path) or path if os.path.isdir(path): paths = os.listdir(path) paths = [os.path.join(path, p) for p in paths] e...
[ "def", "extract_aiml", "(", "path", "=", "'aiml-en-us-foundation-alice.v1-9'", ")", ":", "path", "=", "find_data_path", "(", "path", ")", "or", "path", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "paths", "=", "os", ".", "listdir", "(",...
Extract an aiml.zip file if it hasn't been already and return a list of aiml file paths
[ "Extract", "an", "aiml", ".", "zip", "file", "if", "it", "hasn", "t", "been", "already", "and", "return", "a", "list", "of", "aiml", "file", "paths" ]
python
train
kwikteam/phy
phy/gui/widgets.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/gui/widgets.py#L309-L312
def sort_by(self, name, sort_dir='asc'): """Sort by a given variable.""" logger.log(5, "Sort by `%s` %s.", name, sort_dir) self.eval_js('table.sortBy("{}", "{}");'.format(name, sort_dir))
[ "def", "sort_by", "(", "self", ",", "name", ",", "sort_dir", "=", "'asc'", ")", ":", "logger", ".", "log", "(", "5", ",", "\"Sort by `%s` %s.\"", ",", "name", ",", "sort_dir", ")", "self", ".", "eval_js", "(", "'table.sortBy(\"{}\", \"{}\");'", ".", "forma...
Sort by a given variable.
[ "Sort", "by", "a", "given", "variable", "." ]
python
train
estnltk/estnltk
estnltk/wordnet/wn.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/wordnet/wn.py#L775-L787
def examples(self): """Returns the examples of the synset. Returns ------- list of str List of its variants' examples. """ examples = [] for example in [variant.examples for variant in self._raw_synset.variants if len(variant.examples)...
[ "def", "examples", "(", "self", ")", ":", "examples", "=", "[", "]", "for", "example", "in", "[", "variant", ".", "examples", "for", "variant", "in", "self", ".", "_raw_synset", ".", "variants", "if", "len", "(", "variant", ".", "examples", ")", "]", ...
Returns the examples of the synset. Returns ------- list of str List of its variants' examples.
[ "Returns", "the", "examples", "of", "the", "synset", ".", "Returns", "-------", "list", "of", "str", "List", "of", "its", "variants", "examples", "." ]
python
train
obriencj/python-javatools
javatools/__init__.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/__init__.py#L714-L727
def get_innerclasses(self): """ sequence of JavaInnerClassInfo instances describing the inner classes of this class definition reference: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.6 """ # noqa buff = self.get_attribute("InnerClasses") ...
[ "def", "get_innerclasses", "(", "self", ")", ":", "# noqa", "buff", "=", "self", ".", "get_attribute", "(", "\"InnerClasses\"", ")", "if", "buff", "is", "None", ":", "return", "tuple", "(", ")", "with", "unpack", "(", "buff", ")", "as", "up", ":", "ret...
sequence of JavaInnerClassInfo instances describing the inner classes of this class definition reference: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.6
[ "sequence", "of", "JavaInnerClassInfo", "instances", "describing", "the", "inner", "classes", "of", "this", "class", "definition" ]
python
train
bunq/sdk_python
bunq/sdk/model/generated/endpoint.py
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/generated/endpoint.py#L3431-L3457
def is_all_field_none(self): """ :rtype: bool """ if self._color is not None: return False if self._alias is not None: return False if self._description is not None: return False if self._attachment is not None: ...
[ "def", "is_all_field_none", "(", "self", ")", ":", "if", "self", ".", "_color", "is", "not", "None", ":", "return", "False", "if", "self", ".", "_alias", "is", "not", "None", ":", "return", "False", "if", "self", ".", "_description", "is", "not", "None...
:rtype: bool
[ ":", "rtype", ":", "bool" ]
python
train
trolldbois/ctypeslib
ctypeslib/codegen/cursorhandler.py
https://github.com/trolldbois/ctypeslib/blob/2aeb1942a5a32a5cc798c287cd0d9e684a0181a8/ctypeslib/codegen/cursorhandler.py#L132-L140
def ENUM_CONSTANT_DECL(self, cursor): """Gets the enumeration values""" name = cursor.displayname value = cursor.enum_value pname = self.get_unique_name(cursor.semantic_parent) parent = self.get_registered(pname) obj = typedesc.EnumValue(name, value, parent) paren...
[ "def", "ENUM_CONSTANT_DECL", "(", "self", ",", "cursor", ")", ":", "name", "=", "cursor", ".", "displayname", "value", "=", "cursor", ".", "enum_value", "pname", "=", "self", ".", "get_unique_name", "(", "cursor", ".", "semantic_parent", ")", "parent", "=", ...
Gets the enumeration values
[ "Gets", "the", "enumeration", "values" ]
python
train
roclark/sportsreference
sportsreference/ncaab/schedule.py
https://github.com/roclark/sportsreference/blob/ea0bae432be76450e137671d2998eb38f962dffd/sportsreference/ncaab/schedule.py#L137-L165
def dataframe(self): """ Returns a pandas DataFrame containing all other class properties and values. The index for the DataFrame is the boxscore string. """ if self._points_for is None and self._points_against is None: return None fields_to_include = { ...
[ "def", "dataframe", "(", "self", ")", ":", "if", "self", ".", "_points_for", "is", "None", "and", "self", ".", "_points_against", "is", "None", ":", "return", "None", "fields_to_include", "=", "{", "'arena'", ":", "self", ".", "arena", ",", "'boxscore_inde...
Returns a pandas DataFrame containing all other class properties and values. The index for the DataFrame is the boxscore string.
[ "Returns", "a", "pandas", "DataFrame", "containing", "all", "other", "class", "properties", "and", "values", ".", "The", "index", "for", "the", "DataFrame", "is", "the", "boxscore", "string", "." ]
python
train
Enteee/pdml2flow
pdml2flow/autovivification.py
https://github.com/Enteee/pdml2flow/blob/bc9efe379b0b2406bfbbbd8e0f678b1f63805c66/pdml2flow/autovivification.py#L21-L34
def clean_empty(self, d=DEFAULT): """Returns a copy of d without empty leaves. https://stackoverflow.com/questions/27973988/python-how-to-remove-all-empty-fields-in-a-nested-dict/35263074 """ if d is DEFAULT: d = self if isinstance(d, list): return [v for...
[ "def", "clean_empty", "(", "self", ",", "d", "=", "DEFAULT", ")", ":", "if", "d", "is", "DEFAULT", ":", "d", "=", "self", "if", "isinstance", "(", "d", ",", "list", ")", ":", "return", "[", "v", "for", "v", "in", "(", "self", ".", "clean_empty", ...
Returns a copy of d without empty leaves. https://stackoverflow.com/questions/27973988/python-how-to-remove-all-empty-fields-in-a-nested-dict/35263074
[ "Returns", "a", "copy", "of", "d", "without", "empty", "leaves", "." ]
python
train
tehmaze/natural
natural/data.py
https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/data.py#L78-L97
def printable(sequence): ''' Return a printable string from the input ``sequence`` :param sequence: byte or string sequence >>> print(printable('\\x1b[1;34mtest\\x1b[0m')) .[1;34mtest.[0m >>> printable('\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x06') == '........' True >>> print(printable(...
[ "def", "printable", "(", "sequence", ")", ":", "return", "''", ".", "join", "(", "list", "(", "map", "(", "lambda", "c", ":", "c", "if", "c", "in", "PRINTABLE", "else", "'.'", ",", "sequence", ")", ")", ")" ]
Return a printable string from the input ``sequence`` :param sequence: byte or string sequence >>> print(printable('\\x1b[1;34mtest\\x1b[0m')) .[1;34mtest.[0m >>> printable('\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x06') == '........' True >>> print(printable('12345678')) 12345678 >>> pri...
[ "Return", "a", "printable", "string", "from", "the", "input", "sequence" ]
python
train
a1ezzz/wasp-general
wasp_general/network/messenger/onion.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/messenger/onion.py#L69-L72
def layers_names(self): """ :meth:`.WMessengerOnionProto.layer_names` method implementation. """ return list(self.__class__.__builtin_layers__.keys()) + list(self.__layers.keys())
[ "def", "layers_names", "(", "self", ")", ":", "return", "list", "(", "self", ".", "__class__", ".", "__builtin_layers__", ".", "keys", "(", ")", ")", "+", "list", "(", "self", ".", "__layers", ".", "keys", "(", ")", ")" ]
:meth:`.WMessengerOnionProto.layer_names` method implementation.
[ ":", "meth", ":", ".", "WMessengerOnionProto", ".", "layer_names", "method", "implementation", "." ]
python
train
sys-git/certifiable
certifiable/complex.py
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/complex.py#L84-L160
def certify_dict( value, schema=None, allow_extra=False, required=True, key_certifier=None, value_certifier=None, include_collections=False, ): """ Certifies a dictionary, checking it against an optional schema. The schema should be a dictionary, with keys corresponding to the expected keys in `val...
[ "def", "certify_dict", "(", "value", ",", "schema", "=", "None", ",", "allow_extra", "=", "False", ",", "required", "=", "True", ",", "key_certifier", "=", "None", ",", "value_certifier", "=", "None", ",", "include_collections", "=", "False", ",", ")", ":"...
Certifies a dictionary, checking it against an optional schema. The schema should be a dictionary, with keys corresponding to the expected keys in `value`, but with the values replaced by functions which will be called to with the corresponding value in the input. A simple example: >>> certif...
[ "Certifies", "a", "dictionary", "checking", "it", "against", "an", "optional", "schema", "." ]
python
train
adaptive-learning/proso-apps
proso_models/models.py
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_models/models.py#L712-L726
def get_reference_fields(self, exclude_models=None): """ Get all Django model fields which reference the Item model. """ if exclude_models is None: exclude_models = [] result = [] for django_model in django.apps.apps.get_models(): if any([issubclas...
[ "def", "get_reference_fields", "(", "self", ",", "exclude_models", "=", "None", ")", ":", "if", "exclude_models", "is", "None", ":", "exclude_models", "=", "[", "]", "result", "=", "[", "]", "for", "django_model", "in", "django", ".", "apps", ".", "apps", ...
Get all Django model fields which reference the Item model.
[ "Get", "all", "Django", "model", "fields", "which", "reference", "the", "Item", "model", "." ]
python
train
CalebBell/thermo
thermo/safety.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/safety.py#L329-L365
def STEL(CASRN, AvailableMethods=False, Method=None): # pragma: no cover '''This function handles the retrieval of Short-term Exposure Limit on worker exposure to dangerous chemicals. This API is considered experimental, and is expected to be removed in a future release in favor of a more complete obj...
[ "def", "STEL", "(", "CASRN", ",", "AvailableMethods", "=", "False", ",", "Method", "=", "None", ")", ":", "# pragma: no cover", "def", "list_methods", "(", ")", ":", "methods", "=", "[", "]", "if", "CASRN", "in", "_OntarioExposureLimits", "and", "(", "_Ont...
This function handles the retrieval of Short-term Exposure Limit on worker exposure to dangerous chemicals. This API is considered experimental, and is expected to be removed in a future release in favor of a more complete object-oriented interface. >>> STEL('67-64-1') (750.0, 'ppm') >>> STEL(...
[ "This", "function", "handles", "the", "retrieval", "of", "Short", "-", "term", "Exposure", "Limit", "on", "worker", "exposure", "to", "dangerous", "chemicals", "." ]
python
valid
grangier/python-goose
goose/outputformatters.py
https://github.com/grangier/python-goose/blob/09023ec9f5ef26a628a2365616c0a7c864f0ecea/goose/outputformatters.py#L113-L133
def remove_fewwords_paragraphs(self): """\ remove paragraphs that have less than x number of words, would indicate that it's some sort of link """ all_nodes = self.parser.getElementsByTags(self.get_top_node(), ['*']) all_nodes.reverse() for el in all_nodes: ...
[ "def", "remove_fewwords_paragraphs", "(", "self", ")", ":", "all_nodes", "=", "self", ".", "parser", ".", "getElementsByTags", "(", "self", ".", "get_top_node", "(", ")", ",", "[", "'*'", "]", ")", "all_nodes", ".", "reverse", "(", ")", "for", "el", "in"...
\ remove paragraphs that have less than x number of words, would indicate that it's some sort of link
[ "\\", "remove", "paragraphs", "that", "have", "less", "than", "x", "number", "of", "words", "would", "indicate", "that", "it", "s", "some", "sort", "of", "link" ]
python
train
woolfson-group/isambard
isambard/ampal/specifications/assembly_specs/solenoid.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/specifications/assembly_specs/solenoid.py#L61-L68
def build(self): """Builds a `HelixPair` using the defined attributes.""" for i in range(2): self._molecules.append( self.make_helix(self.aas[i], self.axis_distances[i], self.z_shifts[i], self.phis[i], self.splays[i], ...
[ "def", "build", "(", "self", ")", ":", "for", "i", "in", "range", "(", "2", ")", ":", "self", ".", "_molecules", ".", "append", "(", "self", ".", "make_helix", "(", "self", ".", "aas", "[", "i", "]", ",", "self", ".", "axis_distances", "[", "i", ...
Builds a `HelixPair` using the defined attributes.
[ "Builds", "a", "HelixPair", "using", "the", "defined", "attributes", "." ]
python
train
materialsproject/pymatgen-db
matgendb/query_engine.py
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/query_engine.py#L574-L586
def _wrapper(self, func): """ This function wraps all callable objects returned by self.__getattr__. If the result is a cursor, wrap it into a QueryResults object so that you can invoke postprocess functions in self._pproc """ def wrapped(*args, **kwargs): ret...
[ "def", "_wrapper", "(", "self", ",", "func", ")", ":", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ret_val", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "isinstance", "(", "ret_val", ",", "pymong...
This function wraps all callable objects returned by self.__getattr__. If the result is a cursor, wrap it into a QueryResults object so that you can invoke postprocess functions in self._pproc
[ "This", "function", "wraps", "all", "callable", "objects", "returned", "by", "self", ".", "__getattr__", ".", "If", "the", "result", "is", "a", "cursor", "wrap", "it", "into", "a", "QueryResults", "object", "so", "that", "you", "can", "invoke", "postprocess"...
python
train
twilio/twilio-python
twilio/base/serialize.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/base/serialize.py#L35-L55
def prefixed_collapsible_map(m, prefix): """ Return a dict of params corresponding to those in m with the added prefix """ if m == values.unset: return {} def flatten_dict(d, result={}, prv_keys=[]): for k, v in d.items(): if isinstance(v, dict): flatten_...
[ "def", "prefixed_collapsible_map", "(", "m", ",", "prefix", ")", ":", "if", "m", "==", "values", ".", "unset", ":", "return", "{", "}", "def", "flatten_dict", "(", "d", ",", "result", "=", "{", "}", ",", "prv_keys", "=", "[", "]", ")", ":", "for", ...
Return a dict of params corresponding to those in m with the added prefix
[ "Return", "a", "dict", "of", "params", "corresponding", "to", "those", "in", "m", "with", "the", "added", "prefix" ]
python
train
rcsb/mmtf-python
mmtf/converters/numpy_converters.py
https://github.com/rcsb/mmtf-python/blob/899bb877ca1b32a9396803d38c5bf38a2520754e/mmtf/converters/numpy_converters.py#L17-L23
def decode_chain_list(in_bytes): """Convert a list of bytes to a list of strings. Each string is of length mmtf.CHAIN_LEN :param in_bytes: the input bytes :return the decoded list of strings""" bstrings = numpy.frombuffer(in_bytes, numpy.dtype('S' + str(mmtf.utils.constants.CHAIN_LEN))) return [s.d...
[ "def", "decode_chain_list", "(", "in_bytes", ")", ":", "bstrings", "=", "numpy", ".", "frombuffer", "(", "in_bytes", ",", "numpy", ".", "dtype", "(", "'S'", "+", "str", "(", "mmtf", ".", "utils", ".", "constants", ".", "CHAIN_LEN", ")", ")", ")", "retu...
Convert a list of bytes to a list of strings. Each string is of length mmtf.CHAIN_LEN :param in_bytes: the input bytes :return the decoded list of strings
[ "Convert", "a", "list", "of", "bytes", "to", "a", "list", "of", "strings", ".", "Each", "string", "is", "of", "length", "mmtf", ".", "CHAIN_LEN" ]
python
train
workforce-data-initiative/skills-utils
skills_utils/es.py
https://github.com/workforce-data-initiative/skills-utils/blob/4cf9b7c2938984f34bbcc33d45482d23c52c7539/skills_utils/es.py#L154-L159
def replace(self): """Replace index with a new one zero_downtime_index for safety and rollback """ with zero_downtime_index(self.alias_name, self.index_config()) as target_index: self.index_all(target_index)
[ "def", "replace", "(", "self", ")", ":", "with", "zero_downtime_index", "(", "self", ".", "alias_name", ",", "self", ".", "index_config", "(", ")", ")", "as", "target_index", ":", "self", ".", "index_all", "(", "target_index", ")" ]
Replace index with a new one zero_downtime_index for safety and rollback
[ "Replace", "index", "with", "a", "new", "one", "zero_downtime_index", "for", "safety", "and", "rollback" ]
python
train
iKevinY/EulerPy
EulerPy/euler.py
https://github.com/iKevinY/EulerPy/blob/739c1c67fa7b32af9140ca51e4b4a07733e057a6/EulerPy/euler.py#L70-L74
def skip(num): """Generates Python file for the next problem.""" click.echo("Current problem is problem %i." % num) generate(num + 1, prompt_default=False) Problem(num).file.change_suffix('-skipped')
[ "def", "skip", "(", "num", ")", ":", "click", ".", "echo", "(", "\"Current problem is problem %i.\"", "%", "num", ")", "generate", "(", "num", "+", "1", ",", "prompt_default", "=", "False", ")", "Problem", "(", "num", ")", ".", "file", ".", "change_suffi...
Generates Python file for the next problem.
[ "Generates", "Python", "file", "for", "the", "next", "problem", "." ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L14997-L15015
def vrelg(v1, v2, ndim): """ Return the relative difference between two vectors of general dimension. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/vrelg_c.html :param v1: First vector :type v1: Array of floats :param v2: Second vector :type v2: Array of floats :param ndim:...
[ "def", "vrelg", "(", "v1", ",", "v2", ",", "ndim", ")", ":", "v1", "=", "stypes", ".", "toDoubleVector", "(", "v1", ")", "v2", "=", "stypes", ".", "toDoubleVector", "(", "v2", ")", "ndim", "=", "ctypes", ".", "c_int", "(", "ndim", ")", "return", ...
Return the relative difference between two vectors of general dimension. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/vrelg_c.html :param v1: First vector :type v1: Array of floats :param v2: Second vector :type v2: Array of floats :param ndim: Dimension of v1 and v2. :type nd...
[ "Return", "the", "relative", "difference", "between", "two", "vectors", "of", "general", "dimension", "." ]
python
train
wrobstory/vincent
vincent/visualization.py
https://github.com/wrobstory/vincent/blob/c5a06e50179015fbb788a7a42e4570ff4467a9e9/vincent/visualization.py#L241-L258
def common_axis_properties(self, color=None, title_size=None): """Set common axis properties such as color Parameters ---------- color: str, default None Hex color str, etc """ if self.axes: for axis in self.axes: self._set_axis_pr...
[ "def", "common_axis_properties", "(", "self", ",", "color", "=", "None", ",", "title_size", "=", "None", ")", ":", "if", "self", ".", "axes", ":", "for", "axis", "in", "self", ".", "axes", ":", "self", ".", "_set_axis_properties", "(", "axis", ")", "se...
Set common axis properties such as color Parameters ---------- color: str, default None Hex color str, etc
[ "Set", "common", "axis", "properties", "such", "as", "color" ]
python
train
aiidalab/aiidalab-widgets-base
aiidalab_widgets_base/computers.py
https://github.com/aiidalab/aiidalab-widgets-base/blob/291a9b159eac902aee655862322670ec1b0cd5b1/aiidalab_widgets_base/computers.py#L247-L308
def on_setup_ssh(self, b): """ATTENTION: modifying the order of operations in this function can lead to unexpected problems""" with self._setup_ssh_out: clear_output() self._ssh_keygen() #temporary passwords password = self.__password proxy_pa...
[ "def", "on_setup_ssh", "(", "self", ",", "b", ")", ":", "with", "self", ".", "_setup_ssh_out", ":", "clear_output", "(", ")", "self", ".", "_ssh_keygen", "(", ")", "#temporary passwords", "password", "=", "self", ".", "__password", "proxy_password", "=", "se...
ATTENTION: modifying the order of operations in this function can lead to unexpected problems
[ "ATTENTION", ":", "modifying", "the", "order", "of", "operations", "in", "this", "function", "can", "lead", "to", "unexpected", "problems" ]
python
train
MrYsLab/pymata-aio
pymata_aio/pymata_core.py
https://github.com/MrYsLab/pymata-aio/blob/015081a4628b9d47dfe3f8d6c698ff903f107810/pymata_aio/pymata_core.py#L1298-L1318
async def stepper_step(self, motor_speed, number_of_steps): """ Move a stepper motor for the number of steps at the specified speed This is a FirmataPlus feature. :param motor_speed: 21 bits of data to set motor speed :param number_of_steps: 14 bits for number of steps & direct...
[ "async", "def", "stepper_step", "(", "self", ",", "motor_speed", ",", "number_of_steps", ")", ":", "if", "number_of_steps", ">", "0", ":", "direction", "=", "1", "else", ":", "direction", "=", "0", "abs_number_of_steps", "=", "abs", "(", "number_of_steps", "...
Move a stepper motor for the number of steps at the specified speed This is a FirmataPlus feature. :param motor_speed: 21 bits of data to set motor speed :param number_of_steps: 14 bits for number of steps & direction positive is forward, negative is reverse ...
[ "Move", "a", "stepper", "motor", "for", "the", "number", "of", "steps", "at", "the", "specified", "speed", "This", "is", "a", "FirmataPlus", "feature", "." ]
python
train
MostAwesomeDude/gentleman
gentleman/base.py
https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L545-L588
def ReplaceInstanceDisks(r, instance, disks=None, mode=REPLACE_DISK_AUTO, remote_node=None, iallocator=None, dry_run=False): """ Replaces disks on an instance. @type instance: str @param instance: instance whose disks to replace @type disks: list of ints @param disks: I...
[ "def", "ReplaceInstanceDisks", "(", "r", ",", "instance", ",", "disks", "=", "None", ",", "mode", "=", "REPLACE_DISK_AUTO", ",", "remote_node", "=", "None", ",", "iallocator", "=", "None", ",", "dry_run", "=", "False", ")", ":", "if", "mode", "not", "in"...
Replaces disks on an instance. @type instance: str @param instance: instance whose disks to replace @type disks: list of ints @param disks: Indexes of disks to replace @type mode: str @param mode: replacement mode to use (defaults to replace_auto) @type remote_node: str or None @param r...
[ "Replaces", "disks", "on", "an", "instance", "." ]
python
train
kushaldas/retask
retask/queue.py
https://github.com/kushaldas/retask/blob/5c955b8386653d3f0591ca2f4b1a213ff4b5a018/retask/queue.py#L130-L162
def wait(self, wait_time=0): """ Returns a :class:`~retask.task.Task` object from the queue. Returns ``False`` if it timeouts. :arg wait_time: Time in seconds to wait, default is infinite. :return: :class:`~retask.task.Task` object from the queue or False if it timeouts. .. do...
[ "def", "wait", "(", "self", ",", "wait_time", "=", "0", ")", ":", "if", "not", "self", ".", "connected", ":", "raise", "ConnectionError", "(", "'Queue is not connected'", ")", "data", "=", "self", ".", "rdb", ".", "brpop", "(", "self", ".", "_name", ",...
Returns a :class:`~retask.task.Task` object from the queue. Returns ``False`` if it timeouts. :arg wait_time: Time in seconds to wait, default is infinite. :return: :class:`~retask.task.Task` object from the queue or False if it timeouts. .. doctest:: >>> from retask import Queue ...
[ "Returns", "a", ":", "class", ":", "~retask", ".", "task", ".", "Task", "object", "from", "the", "queue", ".", "Returns", "False", "if", "it", "timeouts", "." ]
python
train
inasafe/inasafe
safe/gui/widgets/dock.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L1660-L1699
def remove_provenance_project_variables(): """Removing variables from provenance data.""" project_context_scope = QgsExpressionContextUtils.projectScope( QgsProject.instance()) existing_variable_names = project_context_scope.variableNames() # Save the existing variables that's not provenance va...
[ "def", "remove_provenance_project_variables", "(", ")", ":", "project_context_scope", "=", "QgsExpressionContextUtils", ".", "projectScope", "(", "QgsProject", ".", "instance", "(", ")", ")", "existing_variable_names", "=", "project_context_scope", ".", "variableNames", "...
Removing variables from provenance data.
[ "Removing", "variables", "from", "provenance", "data", "." ]
python
train
skorch-dev/skorch
examples/cli/train.py
https://github.com/skorch-dev/skorch/blob/5b9b8b7b7712cb6e5aaa759d9608ea6269d5bcd3/examples/cli/train.py#L137-L144
def save_model(model, output_file): """Save model to output_file, if given""" if not output_file: return with open(output_file, 'wb') as f: pickle.dump(model, f) print("Saved model to file '{}'.".format(output_file))
[ "def", "save_model", "(", "model", ",", "output_file", ")", ":", "if", "not", "output_file", ":", "return", "with", "open", "(", "output_file", ",", "'wb'", ")", "as", "f", ":", "pickle", ".", "dump", "(", "model", ",", "f", ")", "print", "(", "\"Sav...
Save model to output_file, if given
[ "Save", "model", "to", "output_file", "if", "given" ]
python
train
pyannote/pyannote-metrics
pyannote/metrics/base.py
https://github.com/pyannote/pyannote-metrics/blob/b433fec3bd37ca36fe026a428cd72483d646871a/pyannote/metrics/base.py#L144-L219
def report(self, display=False): """Evaluation report Parameters ---------- display : bool, optional Set to True to print the report to stdout. Returns ------- report : pandas.DataFrame Dataframe with one column per metric component, one ...
[ "def", "report", "(", "self", ",", "display", "=", "False", ")", ":", "report", "=", "[", "]", "uris", "=", "[", "]", "percent", "=", "'total'", "in", "self", ".", "metric_components", "(", ")", "for", "uri", ",", "components", "in", "self", ".", "...
Evaluation report Parameters ---------- display : bool, optional Set to True to print the report to stdout. Returns ------- report : pandas.DataFrame Dataframe with one column per metric component, one row per evaluated item, and one ...
[ "Evaluation", "report" ]
python
train
lpantano/seqcluster
seqcluster/db/__init__.py
https://github.com/lpantano/seqcluster/blob/774e23add8cd4fdc83d626cea3bd1f458e7d060d/seqcluster/db/__init__.py#L78-L96
def _insert_data(con, data): """ insert line for each cluster """ with con: cur = con.cursor() cur.execute("DROP TABLE IF EXISTS clusters;") cur.execute("CREATE TABLE clusters(Id INT, Description TEXT, Locus TEXT, Annotation TEXT, Sequences TEXT, Profile TXT, Precursor TXT)") ...
[ "def", "_insert_data", "(", "con", ",", "data", ")", ":", "with", "con", ":", "cur", "=", "con", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"DROP TABLE IF EXISTS clusters;\"", ")", "cur", ".", "execute", "(", "\"CREATE TABLE clusters(Id INT, Descri...
insert line for each cluster
[ "insert", "line", "for", "each", "cluster" ]
python
train
jbm950/pygame_toolbox
pygame_toolbox/graphics/__init__.py
https://github.com/jbm950/pygame_toolbox/blob/3fe32145fc149e4dd0963c30a2b6a4dddd4fac0e/pygame_toolbox/graphics/__init__.py#L396-L439
def set_offset(self, offset, mid=None): """This method will allow the menu to be placed anywhere in the open window instead of just the upper left corner. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Inputs: offset - This is the x,y tuple of the...
[ "def", "set_offset", "(", "self", ",", "offset", ",", "mid", "=", "None", ")", ":", "if", "mid", ":", "imagesize", "=", "self", ".", "image", ".", "get_size", "(", ")", "imagemidp", "=", "(", "int", "(", "imagesize", "[", "0", "]", "*", "0.5", ")...
This method will allow the menu to be placed anywhere in the open window instead of just the upper left corner. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Inputs: offset - This is the x,y tuple of the position that you want to move the...
[ "This", "method", "will", "allow", "the", "menu", "to", "be", "placed", "anywhere", "in", "the", "open", "window", "instead", "of", "just", "the", "upper", "left", "corner", ".", "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", "Inputs", ":"...
python
train
PyCQA/pylint-django
pylint_django/augmentations/__init__.py
https://github.com/PyCQA/pylint-django/blob/0bbee433519f48134df4a797341c4196546a454e/pylint_django/augmentations/__init__.py#L483-L498
def _attribute_is_magic(node, attrs, parents): """Checks that node is an attribute used inside one of allowed parents""" if node.attrname not in attrs: return False if not node.last_child(): return False try: for cls in node.last_child().inferred(): if isinstance(cls...
[ "def", "_attribute_is_magic", "(", "node", ",", "attrs", ",", "parents", ")", ":", "if", "node", ".", "attrname", "not", "in", "attrs", ":", "return", "False", "if", "not", "node", ".", "last_child", "(", ")", ":", "return", "False", "try", ":", "for",...
Checks that node is an attribute used inside one of allowed parents
[ "Checks", "that", "node", "is", "an", "attribute", "used", "inside", "one", "of", "allowed", "parents" ]
python
train
odlgroup/odl
odl/contrib/mrc/mrc.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/contrib/mrc/mrc.py#L477-L589
def read_extended_header(self, groupby='field', force_type=''): """Read the extended header according to `extended_header_type`. Currently, only the FEI extended header format is supported. See `print_fei_ext_header_spec` or `this homepage`_ for the format specification. The ex...
[ "def", "read_extended_header", "(", "self", ",", "groupby", "=", "'field'", ",", "force_type", "=", "''", ")", ":", "ext_header_type", "=", "str", "(", "force_type", ")", ".", "upper", "(", ")", "or", "self", ".", "extended_header_type", "if", "ext_header_ty...
Read the extended header according to `extended_header_type`. Currently, only the FEI extended header format is supported. See `print_fei_ext_header_spec` or `this homepage`_ for the format specification. The extended header usually has one header section per image (slice), in ...
[ "Read", "the", "extended", "header", "according", "to", "extended_header_type", "." ]
python
train
openearth/mmi-python
mmi/runner.py
https://github.com/openearth/mmi-python/blob/a2f4ac96b1e7f2fa903f668b3e05c4e86ad42e8d/mmi/runner.py#L123-L146
def create_bmi_model(self, engine, bmi_class=None, wrapper_kwargs=None): """initialize a bmi mode using an optional class""" if wrapper_kwargs is None: wrapper_kwargs = {} if bmi_class is None: wrapper_class = bmi.wrapper.BMIWrapper else: wrapper_class...
[ "def", "create_bmi_model", "(", "self", ",", "engine", ",", "bmi_class", "=", "None", ",", "wrapper_kwargs", "=", "None", ")", ":", "if", "wrapper_kwargs", "is", "None", ":", "wrapper_kwargs", "=", "{", "}", "if", "bmi_class", "is", "None", ":", "wrapper_c...
initialize a bmi mode using an optional class
[ "initialize", "a", "bmi", "mode", "using", "an", "optional", "class" ]
python
train
ga4gh/ga4gh-server
ga4gh/server/datamodel/datasets.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/datasets.py#L171-L178
def getVariantSetByName(self, name): """ Returns a VariantSet with the specified name, or raises a VariantSetNameNotFoundException if it does not exist. """ if name not in self._variantSetNameMap: raise exceptions.VariantSetNameNotFoundException(name) return s...
[ "def", "getVariantSetByName", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "_variantSetNameMap", ":", "raise", "exceptions", ".", "VariantSetNameNotFoundException", "(", "name", ")", "return", "self", ".", "_variantSetNameMap", "["...
Returns a VariantSet with the specified name, or raises a VariantSetNameNotFoundException if it does not exist.
[ "Returns", "a", "VariantSet", "with", "the", "specified", "name", "or", "raises", "a", "VariantSetNameNotFoundException", "if", "it", "does", "not", "exist", "." ]
python
train
lago-project/lago
lago/prefix.py
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/prefix.py#L949-L1046
def _ova_to_spec(self, filename): """ Retrieve the given ova and makes a template of it. Creates a disk from network provided ova. Calculates the needed memory from the ovf. The disk will be cached in the template repo Args: filename(str): the url to retrive ...
[ "def", "_ova_to_spec", "(", "self", ",", "filename", ")", ":", "# extract if needed", "ova_extracted_dir", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "0", "]", "if", "not", "os", ".", "path", ".", "exists", "(", "ova_extracted_dir"...
Retrieve the given ova and makes a template of it. Creates a disk from network provided ova. Calculates the needed memory from the ovf. The disk will be cached in the template repo Args: filename(str): the url to retrive the data from TODO: * Add hash ch...
[ "Retrieve", "the", "given", "ova", "and", "makes", "a", "template", "of", "it", ".", "Creates", "a", "disk", "from", "network", "provided", "ova", ".", "Calculates", "the", "needed", "memory", "from", "the", "ovf", ".", "The", "disk", "will", "be", "cach...
python
train
idlesign/uwsgiconf
uwsgiconf/options/routing.py
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing.py#L386-L394
def header_remove(self, value): """Automatically remove specified HTTP header from the response. :param str|unicode value: """ self._set('del-header', value, multi=True) return self._section
[ "def", "header_remove", "(", "self", ",", "value", ")", ":", "self", ".", "_set", "(", "'del-header'", ",", "value", ",", "multi", "=", "True", ")", "return", "self", ".", "_section" ]
Automatically remove specified HTTP header from the response. :param str|unicode value:
[ "Automatically", "remove", "specified", "HTTP", "header", "from", "the", "response", "." ]
python
train
MacHu-GWU/constant2-project
constant2/_constant2.py
https://github.com/MacHu-GWU/constant2-project/blob/ccf7e14b0e23f9f4bfd13a3e2ce4a1142e570d4f/constant2/_constant2.py#L105-L139
def items(self): """non-class attributes ordered by alphabetical order. :: >>> class MyClass(Constant): ... a = 1 # non-class attributre ... b = 2 # non-class attributre ... ... class C(Constant): ... pass ...
[ "def", "items", "(", "self", ")", ":", "l", "=", "list", "(", ")", "# 为什么这里是 get_all_attributes(self.__class__) 而不是", "# get_all_attributes(self) ? 因为有些实例不支持", "# get_all_attributes(instance) 方法, 会报错。", "# 所以我们从类里得到所有的属性信息, 然后获得这些属性在实例中", "# 对应的值。", "for", "attr", ",", "value",...
non-class attributes ordered by alphabetical order. :: >>> class MyClass(Constant): ... a = 1 # non-class attributre ... b = 2 # non-class attributre ... ... class C(Constant): ... pass ... ... ...
[ "non", "-", "class", "attributes", "ordered", "by", "alphabetical", "order", "." ]
python
train
ssalentin/plip
plip/modules/preparation.py
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/preparation.py#L906-L945
def find_charged(self, mol): """Looks for positive charges in arginine, histidine or lysine, for negative in aspartic and glutamic acid.""" data = namedtuple('pcharge', 'atoms atoms_orig_idx type center restype resnr reschain') a_set = [] # Iterate through all residue, exclude those in c...
[ "def", "find_charged", "(", "self", ",", "mol", ")", ":", "data", "=", "namedtuple", "(", "'pcharge'", ",", "'atoms atoms_orig_idx type center restype resnr reschain'", ")", "a_set", "=", "[", "]", "# Iterate through all residue, exclude those in chains defined as peptides", ...
Looks for positive charges in arginine, histidine or lysine, for negative in aspartic and glutamic acid.
[ "Looks", "for", "positive", "charges", "in", "arginine", "histidine", "or", "lysine", "for", "negative", "in", "aspartic", "and", "glutamic", "acid", "." ]
python
train
fabiobatalha/crossrefapi
crossref/restful.py
https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L901-L959
def doi(self, doi, only_message=True): """ This method retrieve the DOI metadata related to a given DOI number. args: Crossref DOI id (String) return: JSON Example: >>> from crossref.restful import Works >>> works = Works() >>> works...
[ "def", "doi", "(", "self", ",", "doi", ",", "only_message", "=", "True", ")", ":", "request_url", "=", "build_url_endpoint", "(", "'/'", ".", "join", "(", "[", "self", ".", "ENDPOINT", ",", "doi", "]", ")", ")", "request_params", "=", "{", "}", "resu...
This method retrieve the DOI metadata related to a given DOI number. args: Crossref DOI id (String) return: JSON Example: >>> from crossref.restful import Works >>> works = Works() >>> works.doi('10.1590/S0004-28032013005000001') {'is-re...
[ "This", "method", "retrieve", "the", "DOI", "metadata", "related", "to", "a", "given", "DOI", "number", "." ]
python
train
tensorforce/tensorforce
tensorforce/contrib/game_2048.py
https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/contrib/game_2048.py#L127-L137
def do_action(self, action): """Execute action, add a new tile, update the score & return the reward.""" temp_state = np.rot90(self._state, action) reward = self._do_action_left(temp_state) self._state = np.rot90(temp_state, -action) self._score += reward self.add_rando...
[ "def", "do_action", "(", "self", ",", "action", ")", ":", "temp_state", "=", "np", ".", "rot90", "(", "self", ".", "_state", ",", "action", ")", "reward", "=", "self", ".", "_do_action_left", "(", "temp_state", ")", "self", ".", "_state", "=", "np", ...
Execute action, add a new tile, update the score & return the reward.
[ "Execute", "action", "add", "a", "new", "tile", "update", "the", "score", "&", "return", "the", "reward", "." ]
python
valid
yamcs/yamcs-python
yamcs-client/yamcs/client.py
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/client.py#L242-L250
def list_instance_templates(self): """ List the available instance templates. """ response = self.get_proto(path='/instance-templates') message = rest_pb2.ListInstanceTemplatesResponse() message.ParseFromString(response.content) templates = getattr(message, 'templ...
[ "def", "list_instance_templates", "(", "self", ")", ":", "response", "=", "self", ".", "get_proto", "(", "path", "=", "'/instance-templates'", ")", "message", "=", "rest_pb2", ".", "ListInstanceTemplatesResponse", "(", ")", "message", ".", "ParseFromString", "(", ...
List the available instance templates.
[ "List", "the", "available", "instance", "templates", "." ]
python
train
python-thumbnails/python-thumbnails
thumbnails/engines/base.py
https://github.com/python-thumbnails/python-thumbnails/blob/d8dc0ff5410f730de2a0e5759e8a818b19de35b9/thumbnails/engines/base.py#L174-L186
def parse_size(size): """ Parses size string into a tuple :param size: String on the form '100', 'x100 or '100x200' :return: Tuple of two integers for width and height :rtype: tuple """ if size.startswith('x'): return None, int(size.replace('x', '')) ...
[ "def", "parse_size", "(", "size", ")", ":", "if", "size", ".", "startswith", "(", "'x'", ")", ":", "return", "None", ",", "int", "(", "size", ".", "replace", "(", "'x'", ",", "''", ")", ")", "if", "'x'", "in", "size", ":", "return", "int", "(", ...
Parses size string into a tuple :param size: String on the form '100', 'x100 or '100x200' :return: Tuple of two integers for width and height :rtype: tuple
[ "Parses", "size", "string", "into", "a", "tuple" ]
python
train
bluedazzle/wechat_sender
wechat_sender/utils.py
https://github.com/bluedazzle/wechat_sender/blob/21d861735509153d6b34408157911c25a5d7018b/wechat_sender/utils.py#L22-L28
def _read_config_list(): """ 配置列表读取 """ with codecs.open('conf.ini', 'w+', encoding='utf-8') as f1: conf_list = [conf for conf in f1.read().split('\n') if conf != ''] return conf_list
[ "def", "_read_config_list", "(", ")", ":", "with", "codecs", ".", "open", "(", "'conf.ini'", ",", "'w+'", ",", "encoding", "=", "'utf-8'", ")", "as", "f1", ":", "conf_list", "=", "[", "conf", "for", "conf", "in", "f1", ".", "read", "(", ")", ".", "...
配置列表读取
[ "配置列表读取" ]
python
train
openpaperwork/paperwork-backend
paperwork_backend/docimport.py
https://github.com/openpaperwork/paperwork-backend/blob/114b831e94e039e68b339751fd18250877abad76/paperwork_backend/docimport.py#L407-L417
def can_import(self, file_uris, current_doc=None): """ Check that the specified file looks like an image supported by PIL """ if len(file_uris) <= 0: return False for file_uri in file_uris: file_uri = self.fs.safe(file_uri) if not self.check_fi...
[ "def", "can_import", "(", "self", ",", "file_uris", ",", "current_doc", "=", "None", ")", ":", "if", "len", "(", "file_uris", ")", "<=", "0", ":", "return", "False", "for", "file_uri", "in", "file_uris", ":", "file_uri", "=", "self", ".", "fs", ".", ...
Check that the specified file looks like an image supported by PIL
[ "Check", "that", "the", "specified", "file", "looks", "like", "an", "image", "supported", "by", "PIL" ]
python
train
adamziel/python_translate
python_translate/loaders.py
https://github.com/adamziel/python_translate/blob/0aee83f434bd2d1b95767bcd63adb7ac7036c7df/python_translate/loaders.py#L271-L286
def _load_contents(self, polib, resource): """ Parses machine object (MO) format using polib @type resource: str @param resource: resource @rtype: list """ import struct try: return polib.mofile(resource) except (ValueError, Attribute...
[ "def", "_load_contents", "(", "self", ",", "polib", ",", "resource", ")", ":", "import", "struct", "try", ":", "return", "polib", ".", "mofile", "(", "resource", ")", "except", "(", "ValueError", ",", "AttributeError", ",", "struct", ".", "error", ")", "...
Parses machine object (MO) format using polib @type resource: str @param resource: resource @rtype: list
[ "Parses", "machine", "object", "(", "MO", ")", "format", "using", "polib" ]
python
train
brutus/boozelib
boozelib/boozelib.py
https://github.com/brutus/boozelib/blob/02a4aa03ac54b411ef5ac2be85eee0a9af1e60df/boozelib/boozelib.py#L163-L168
def gramm_to_promille(gramm, age, weight, height, sex): """Return the blood alcohol content (per mill) for a person with the given body stats and amount of alcohol (in gramm) in blood """ bw = calculate_bw(age, weight, height, sex) return (gramm * W) / (PB * bw)
[ "def", "gramm_to_promille", "(", "gramm", ",", "age", ",", "weight", ",", "height", ",", "sex", ")", ":", "bw", "=", "calculate_bw", "(", "age", ",", "weight", ",", "height", ",", "sex", ")", "return", "(", "gramm", "*", "W", ")", "/", "(", "PB", ...
Return the blood alcohol content (per mill) for a person with the given body stats and amount of alcohol (in gramm) in blood
[ "Return", "the", "blood", "alcohol", "content", "(", "per", "mill", ")", "for", "a", "person", "with", "the", "given", "body", "stats", "and", "amount", "of", "alcohol", "(", "in", "gramm", ")", "in", "blood" ]
python
train
zblz/naima
naima/radiative.py
https://github.com/zblz/naima/blob/d6a6781d73bf58fd8269e8b0e3b70be22723cd5b/naima/radiative.py#L1739-L1765
def _calc_specpp_hiE(self, Egamma): """ Spectrum computed as in Eq. 42 for Egamma >= 0.1 TeV """ # Fixed quad with n=40 is about 15 times faster and is always within # 0.5% of the result of adaptive quad for Egamma>0.1 # WARNING: It also produces artifacts for steep distr...
[ "def", "_calc_specpp_hiE", "(", "self", ",", "Egamma", ")", ":", "# Fixed quad with n=40 is about 15 times faster and is always within", "# 0.5% of the result of adaptive quad for Egamma>0.1", "# WARNING: It also produces artifacts for steep distributions (e.g.", "# Maxwellian) at ~500 GeV. Re...
Spectrum computed as in Eq. 42 for Egamma >= 0.1 TeV
[ "Spectrum", "computed", "as", "in", "Eq", ".", "42", "for", "Egamma", ">", "=", "0", ".", "1", "TeV" ]
python
train
intelligenia/modeltranslation
modeltranslation/models.py
https://github.com/intelligenia/modeltranslation/blob/64d6adeb537747321d5020efedf5d7e0d135862d/modeltranslation/models.py#L222-L235
def delete_orphan_translations(condition=None): """ Delete orphan translations. This method needs refactoring to be improve its performance. """ if condition is None: condition = {} # TODO: optimize using one SQL sentence translations = FieldTranslation.objects.all() for translation in translations: ...
[ "def", "delete_orphan_translations", "(", "condition", "=", "None", ")", ":", "if", "condition", "is", "None", ":", "condition", "=", "{", "}", "# TODO: optimize using one SQL sentence", "translations", "=", "FieldTranslation", ".", "objects", ".", "all", "(", ")"...
Delete orphan translations. This method needs refactoring to be improve its performance.
[ "Delete", "orphan", "translations", ".", "This", "method", "needs", "refactoring", "to", "be", "improve", "its", "performance", "." ]
python
train
vpelletier/pprofile
pprofile.py
https://github.com/vpelletier/pprofile/blob/51a36896727565faf23e5abccc9204e5f935fe1e/pprofile.py#L207-L230
def call(self, code, line, callee_file_timing, callee, duration, frame): """ A call originating from this file returned. code (code) caller's code object line (int) caller's line number callee_file_timing (FileTiming) callee's FileTiming cal...
[ "def", "call", "(", "self", ",", "code", ",", "line", ",", "callee_file_timing", ",", "callee", ",", "duration", ",", "frame", ")", ":", "try", ":", "entry", "=", "self", ".", "call_dict", "[", "(", "code", ",", "line", ",", "callee", ")", "]", "ex...
A call originating from this file returned. code (code) caller's code object line (int) caller's line number callee_file_timing (FileTiming) callee's FileTiming callee (code) callee's code object duration (float) duration of the ...
[ "A", "call", "originating", "from", "this", "file", "returned", "." ]
python
train
oasis-open/cti-stix-validator
stix2validator/v21/shoulds.py
https://github.com/oasis-open/cti-stix-validator/blob/a607014e3fa500a7678f8b61b278456ca581f9d0/stix2validator/v21/shoulds.py#L81-L97
def custom_property_prefix_strict(instance): """Ensure custom properties follow strict naming style conventions. Does not check property names in custom objects. """ for prop_name in instance.keys(): if (instance['type'] in enums.PROPERTIES and prop_name not in enums.PROPERTIES[...
[ "def", "custom_property_prefix_strict", "(", "instance", ")", ":", "for", "prop_name", "in", "instance", ".", "keys", "(", ")", ":", "if", "(", "instance", "[", "'type'", "]", "in", "enums", ".", "PROPERTIES", "and", "prop_name", "not", "in", "enums", ".",...
Ensure custom properties follow strict naming style conventions. Does not check property names in custom objects.
[ "Ensure", "custom", "properties", "follow", "strict", "naming", "style", "conventions", "." ]
python
train
numenta/nupic
examples/network/hierarchy_network_demo.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/hierarchy_network_demo.py#L191-L266
def createNetwork(dataSource): """Creates and returns a new Network with a sensor region reading data from 'dataSource'. There are two hierarchical levels, each with one SP and one TM. @param dataSource - A RecordStream containing the input data @returns a Network ready to run """ network = Network() # C...
[ "def", "createNetwork", "(", "dataSource", ")", ":", "network", "=", "Network", "(", ")", "# Create and add a record sensor and a SP region", "sensor", "=", "createRecordSensor", "(", "network", ",", "name", "=", "_RECORD_SENSOR", ",", "dataSource", "=", "dataSource",...
Creates and returns a new Network with a sensor region reading data from 'dataSource'. There are two hierarchical levels, each with one SP and one TM. @param dataSource - A RecordStream containing the input data @returns a Network ready to run
[ "Creates", "and", "returns", "a", "new", "Network", "with", "a", "sensor", "region", "reading", "data", "from", "dataSource", ".", "There", "are", "two", "hierarchical", "levels", "each", "with", "one", "SP", "and", "one", "TM", "." ]
python
valid
improbable-research/keanu
keanu-python/keanu/vertex/generated.py
https://github.com/improbable-research/keanu/blob/73189a8f569078e156168e795f82c7366c59574b/keanu-python/keanu/vertex/generated.py#L812-L818
def IntegerSum(input_vertex: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Performs a sum across all dimensions :param input_vertex: the vertex to have its values summed """ return Integer(context.jvm_view().IntegerSumVertex, label, cast_to_integer_vertex(input_verte...
[ "def", "IntegerSum", "(", "input_vertex", ":", "vertex_constructor_param_types", ",", "label", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Vertex", ":", "return", "Integer", "(", "context", ".", "jvm_view", "(", ")", ".", "IntegerSumVertex", "...
Performs a sum across all dimensions :param input_vertex: the vertex to have its values summed
[ "Performs", "a", "sum", "across", "all", "dimensions", ":", "param", "input_vertex", ":", "the", "vertex", "to", "have", "its", "values", "summed" ]
python
train
saltstack/salt
salt/returners/couchdb_return.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L96-L136
def _get_options(ret=None): ''' Get the couchdb options from salt. ''' attrs = {'url': 'url', 'db': 'db', 'user': 'user', 'passwd': 'passwd', 'redact_pws': 'redact_pws', 'minimum_return': 'minimum_return'} _options = salt.returners.ge...
[ "def", "_get_options", "(", "ret", "=", "None", ")", ":", "attrs", "=", "{", "'url'", ":", "'url'", ",", "'db'", ":", "'db'", ",", "'user'", ":", "'user'", ",", "'passwd'", ":", "'passwd'", ",", "'redact_pws'", ":", "'redact_pws'", ",", "'minimum_return'...
Get the couchdb options from salt.
[ "Get", "the", "couchdb", "options", "from", "salt", "." ]
python
train
numenta/htmresearch
projects/sequence_prediction/continuous_sequence/errorMetrics.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/sequence_prediction/continuous_sequence/errorMetrics.py#L31-L47
def NRMSE_sliding(data, pred, windowSize): """ Computing NRMSE in a sliding window :param data: :param pred: :param windowSize: :return: (window_center, NRMSE) """ halfWindowSize = int(round(float(windowSize)/2)) window_center = range(halfWindowSize, len(data)-halfWindowSize, int(round(float(halfWind...
[ "def", "NRMSE_sliding", "(", "data", ",", "pred", ",", "windowSize", ")", ":", "halfWindowSize", "=", "int", "(", "round", "(", "float", "(", "windowSize", ")", "/", "2", ")", ")", "window_center", "=", "range", "(", "halfWindowSize", ",", "len", "(", ...
Computing NRMSE in a sliding window :param data: :param pred: :param windowSize: :return: (window_center, NRMSE)
[ "Computing", "NRMSE", "in", "a", "sliding", "window", ":", "param", "data", ":", ":", "param", "pred", ":", ":", "param", "windowSize", ":", ":", "return", ":", "(", "window_center", "NRMSE", ")" ]
python
train