repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
openstack/networking-cisco
networking_cisco/ml2_drivers/nexus/nexus_helpers.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_helpers.py#L43-L71
def split_interface_name(interface, ch_grp=0): """Method to split interface type, id from name. Takes an interface name or just interface suffix and returns interface type and number separately. :param interface: interface name or just suffix :param ch_grp: if non-zero, ignore interface ...
[ "def", "split_interface_name", "(", "interface", ",", "ch_grp", "=", "0", ")", ":", "interface", "=", "interface", ".", "lower", "(", ")", "if", "ch_grp", "!=", "0", ":", "intf_type", "=", "'port-channel'", "port", "=", "str", "(", "ch_grp", ")", "elif",...
Method to split interface type, id from name. Takes an interface name or just interface suffix and returns interface type and number separately. :param interface: interface name or just suffix :param ch_grp: if non-zero, ignore interface name and return 'port-channel' grp :retur...
[ "Method", "to", "split", "interface", "type", "id", "from", "name", "." ]
python
train
35.241379
trailofbits/manticore
manticore/core/manticore.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/core/manticore.py#L390-L400
def get_profiling_stats(self): """ Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`. Otherwise, returns `None`. """ profile_file_path = os.path.join(self.workspace, 'profiling.bin') try: return pstats.Stats(p...
[ "def", "get_profiling_stats", "(", "self", ")", ":", "profile_file_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "workspace", ",", "'profiling.bin'", ")", "try", ":", "return", "pstats", ".", "Stats", "(", "profile_file_path", ")", "except", ...
Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`. Otherwise, returns `None`.
[ "Returns", "a", "pstat", ".", "Stats", "instance", "with", "profiling", "results", "if", "run", "was", "called", "with", "should_profile", "=", "True", ".", "Otherwise", "returns", "None", "." ]
python
valid
40.545455
hearsaycorp/normalize
normalize/diff.py
https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/diff.py#L793-L875
def compare_list_iter(propval_a, propval_b, fs_a=None, fs_b=None, options=None): """Generator for comparing 'simple' lists when they are encountered. This does not currently recurse further. Arguments are as per other ``compare_``\ *X* functions. """ if fs_a is None: ...
[ "def", "compare_list_iter", "(", "propval_a", ",", "propval_b", ",", "fs_a", "=", "None", ",", "fs_b", "=", "None", ",", "options", "=", "None", ")", ":", "if", "fs_a", "is", "None", ":", "fs_a", "=", "FieldSelector", "(", "tuple", "(", ")", ")", "fs...
Generator for comparing 'simple' lists when they are encountered. This does not currently recurse further. Arguments are as per other ``compare_``\ *X* functions.
[ "Generator", "for", "comparing", "simple", "lists", "when", "they", "are", "encountered", ".", "This", "does", "not", "currently", "recurse", "further", ".", "Arguments", "are", "as", "per", "other", "compare_", "\\", "*", "X", "*", "functions", "." ]
python
train
32.084337
SiLab-Bonn/pixel_clusterizer
pixel_clusterizer/clusterizer.py
https://github.com/SiLab-Bonn/pixel_clusterizer/blob/d2c8c3072fb03ebb7c6a3e8c57350fbbe38efd4d/pixel_clusterizer/clusterizer.py#L169-L188
def set_cluster_fields(self, cluster_fields): ''' Tell the clusterizer the meaning of the field names. The cluster_fields parameter is a dict, e.g., {"new filed name": "standard field name"}. ''' if not cluster_fields: cluster_fields_mapping_inverse = {} cluster_...
[ "def", "set_cluster_fields", "(", "self", ",", "cluster_fields", ")", ":", "if", "not", "cluster_fields", ":", "cluster_fields_mapping_inverse", "=", "{", "}", "cluster_fields_mapping", "=", "{", "}", "else", ":", "# Create also the inverse dictionary for faster lookup", ...
Tell the clusterizer the meaning of the field names. The cluster_fields parameter is a dict, e.g., {"new filed name": "standard field name"}.
[ "Tell", "the", "clusterizer", "the", "meaning", "of", "the", "field", "names", "." ]
python
test
49.2
nickmckay/LiPD-utilities
Python/lipd/tables.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/tables.py#L13-L55
def addTable(D): """ Add any table type to the given dataset. Use prompts to determine index locations and table type. :param dict D: Metadata (dataset) :param dict dat: Metadata (table) :return dict D: Metadata (dataset) """ _swap = { "1": "measurement", "2": "summary", ...
[ "def", "addTable", "(", "D", ")", ":", "_swap", "=", "{", "\"1\"", ":", "\"measurement\"", ",", "\"2\"", ":", "\"summary\"", ",", "\"3\"", ":", "\"ensemble\"", ",", "\"4\"", ":", "\"distribution\"", "}", "print", "(", "\"What type of table would you like to add?...
Add any table type to the given dataset. Use prompts to determine index locations and table type. :param dict D: Metadata (dataset) :param dict dat: Metadata (table) :return dict D: Metadata (dataset)
[ "Add", "any", "table", "type", "to", "the", "given", "dataset", ".", "Use", "prompts", "to", "determine", "index", "locations", "and", "table", "type", "." ]
python
train
30.139535
bspaans/python-mingus
mingus/midi/pyfluidsynth.py
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/pyfluidsynth.py#L164-L194
def start(self, driver=None): """Start audio output driver in separate background thread. Call this function any time after creating the Synth object. If you don't call this function, use get_samples() to generate samples. Optional keyword argument: driver: which audi...
[ "def", "start", "(", "self", ",", "driver", "=", "None", ")", ":", "if", "driver", "is", "not", "None", ":", "assert", "driver", "in", "[", "'alsa'", ",", "'oss'", ",", "'jack'", ",", "'portaudio'", ",", "'sndmgr'", ",", "'coreaudio'", ",", "'Direct So...
Start audio output driver in separate background thread. Call this function any time after creating the Synth object. If you don't call this function, use get_samples() to generate samples. Optional keyword argument: driver: which audio driver to use for output ...
[ "Start", "audio", "output", "driver", "in", "separate", "background", "thread", "." ]
python
train
38.129032
cloudera/cm_api
python/src/cm_api/endpoints/services.py
https://github.com/cloudera/cm_api/blob/5d2512375bd94684b4da36df9e0d9177865ffcbb/python/src/cm_api/endpoints/services.py#L59-L68
def get_all_services(resource_root, cluster_name="default", view=None): """ Get all services @param resource_root: The root Resource object. @param cluster_name: Cluster name @return: A list of ApiService objects. """ return call(resource_root.get, SERVICES_PATH % (cluster_name,), ApiService, ...
[ "def", "get_all_services", "(", "resource_root", ",", "cluster_name", "=", "\"default\"", ",", "view", "=", "None", ")", ":", "return", "call", "(", "resource_root", ".", "get", ",", "SERVICES_PATH", "%", "(", "cluster_name", ",", ")", ",", "ApiService", ","...
Get all services @param resource_root: The root Resource object. @param cluster_name: Cluster name @return: A list of ApiService objects.
[ "Get", "all", "services" ]
python
train
35.7
estnltk/estnltk
estnltk/converters/gt_conversion.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/converters/gt_conversion.py#L441-L477
def get_analysis_dict( root, pos, form ): ''' Takes *root*, *pos* and *form* from Filosoft's mrf input and reformats as EstNLTK's analysis dict: { "clitic": string, "ending": string, "form": string, "partofspeech": string, ...
[ "def", "get_analysis_dict", "(", "root", ",", "pos", ",", "form", ")", ":", "import", "sys", "result", "=", "{", "CLITIC", ":", "\"\"", ",", "ENDING", ":", "\"\"", ",", "FORM", ":", "form", ",", "POSTAG", ":", "pos", ",", "ROOT", ":", "\"\"", "}", ...
Takes *root*, *pos* and *form* from Filosoft's mrf input and reformats as EstNLTK's analysis dict: { "clitic": string, "ending": string, "form": string, "partofspeech": string, "root": string }, ...
[ "Takes", "*", "root", "*", "*", "pos", "*", "and", "*", "form", "*", "from", "Filosoft", "s", "mrf", "input", "and", "reformats", "as", "EstNLTK", "s", "analysis", "dict", ":", "{", "clitic", ":", "string", "ending", ":", "string", "form", ":", "stri...
python
train
36.945946
yyuu/botornado
boto/https_connection.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/https_connection.py#L62-L79
def ValidateCertificateHostname(cert, hostname): """Validates that a given hostname is valid for an SSL certificate. Args: cert: A dictionary representing an SSL certificate. hostname: The hostname to test. Returns: bool: Whether or not the hostname is valid for this certificate. """ hosts = GetV...
[ "def", "ValidateCertificateHostname", "(", "cert", ",", "hostname", ")", ":", "hosts", "=", "GetValidHostsForCert", "(", "cert", ")", "boto", ".", "log", ".", "debug", "(", "\"validating server certificate: hostname=%s, certificate hosts=%s\"", ",", "hostname", ",", "...
Validates that a given hostname is valid for an SSL certificate. Args: cert: A dictionary representing an SSL certificate. hostname: The hostname to test. Returns: bool: Whether or not the hostname is valid for this certificate.
[ "Validates", "that", "a", "given", "hostname", "is", "valid", "for", "an", "SSL", "certificate", "." ]
python
train
33.833333
programa-stic/barf-project
barf/analysis/gadgets/classifier.py
https://github.com/programa-stic/barf-project/blob/18ed9e5eace55f7bf6015ec57f037c364099021c/barf/analysis/gadgets/classifier.py#L104-L121
def classify(self, gadget): """Classify gadgets. """ typed_gadgets = [] for g_type, g_classifier in self._classifiers.items(): try: typed_gadgets += self._classify(gadget, g_classifier, g_type, self._emu_iters) except: import trace...
[ "def", "classify", "(", "self", ",", "gadget", ")", ":", "typed_gadgets", "=", "[", "]", "for", "g_type", ",", "g_classifier", "in", "self", ".", "_classifiers", ".", "items", "(", ")", ":", "try", ":", "typed_gadgets", "+=", "self", ".", "_classify", ...
Classify gadgets.
[ "Classify", "gadgets", "." ]
python
train
30.777778
dtmilano/AndroidViewClient
src/com/dtmilano/android/culebron.py
https://github.com/dtmilano/AndroidViewClient/blob/7e6e83fde63af99e5e4ab959712ecf94f9881aa2/src/com/dtmilano/android/culebron.py#L1110-L1124
def toggleLongTouchPoint(self): ''' Toggles the long touch point operation. ''' if not self.isLongTouchingPoint: msg = 'Long touching point' self.toast(msg, background=Color.GREEN) self.statusBar.set(msg) self.isLongTouchingPoint = True ...
[ "def", "toggleLongTouchPoint", "(", "self", ")", ":", "if", "not", "self", ".", "isLongTouchingPoint", ":", "msg", "=", "'Long touching point'", "self", ".", "toast", "(", "msg", ",", "background", "=", "Color", ".", "GREEN", ")", "self", ".", "statusBar", ...
Toggles the long touch point operation.
[ "Toggles", "the", "long", "touch", "point", "operation", "." ]
python
train
34.933333
blackecho/Deep-Learning-TensorFlow
yadlt/core/model.py
https://github.com/blackecho/Deep-Learning-TensorFlow/blob/ddeb1f2848da7b7bee166ad2152b4afc46bb2086/yadlt/core/model.py#L107-L125
def get_parameters(self, params, graph=None): """Get the parameters of the model. :param params: dictionary of keys (str names) and values (tensors). :return: evaluated tensors in params """ g = graph if graph is not None else self.tf_graph with g.as_default(): ...
[ "def", "get_parameters", "(", "self", ",", "params", ",", "graph", "=", "None", ")", ":", "g", "=", "graph", "if", "graph", "is", "not", "None", "else", "self", ".", "tf_graph", "with", "g", ".", "as_default", "(", ")", ":", "with", "tf", ".", "Ses...
Get the parameters of the model. :param params: dictionary of keys (str names) and values (tensors). :return: evaluated tensors in params
[ "Get", "the", "parameters", "of", "the", "model", "." ]
python
train
39.842105
shoebot/shoebot
lib/web/BeautifulSoup.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/BeautifulSoup.py#L787-L794
def _getAttrMap(self): """Initializes a map representation of this tag's attributes, if not already initialized.""" if not getattr(self, 'attrMap'): self.attrMap = {} for (key, value) in self.attrs: self.attrMap[key] = value return self.attrMap
[ "def", "_getAttrMap", "(", "self", ")", ":", "if", "not", "getattr", "(", "self", ",", "'attrMap'", ")", ":", "self", ".", "attrMap", "=", "{", "}", "for", "(", "key", ",", "value", ")", "in", "self", ".", "attrs", ":", "self", ".", "attrMap", "[...
Initializes a map representation of this tag's attributes, if not already initialized.
[ "Initializes", "a", "map", "representation", "of", "this", "tag", "s", "attributes", "if", "not", "already", "initialized", "." ]
python
valid
38.625
openid/JWTConnect-Python-OidcService
src/oidcservice/service.py
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service.py#L498-L511
def get_conf_attr(self, attr, default=None): """ Get the value of a attribute in the configuration :param attr: The attribute :param default: If the attribute doesn't appear in the configuration return this value :return: The value of attribute in the configuration o...
[ "def", "get_conf_attr", "(", "self", ",", "attr", ",", "default", "=", "None", ")", ":", "if", "attr", "in", "self", ".", "conf", ":", "return", "self", ".", "conf", "[", "attr", "]", "else", ":", "return", "default" ]
Get the value of a attribute in the configuration :param attr: The attribute :param default: If the attribute doesn't appear in the configuration return this value :return: The value of attribute in the configuration or the default value
[ "Get", "the", "value", "of", "a", "attribute", "in", "the", "configuration" ]
python
train
32.571429
agoragames/haigha
haigha/connection.py
https://github.com/agoragames/haigha/blob/7b004e1c0316ec14b94fec1c54554654c38b1a25/haigha/connection.py#L359-L375
def close(self, reply_code=0, reply_text='', class_id=0, method_id=0, disconnect=False): ''' Close this connection. ''' self._close_info = { 'reply_code': reply_code, 'reply_text': reply_text, 'class_id': class_id, 'method_id'...
[ "def", "close", "(", "self", ",", "reply_code", "=", "0", ",", "reply_text", "=", "''", ",", "class_id", "=", "0", ",", "method_id", "=", "0", ",", "disconnect", "=", "False", ")", ":", "self", ".", "_close_info", "=", "{", "'reply_code'", ":", "repl...
Close this connection.
[ "Close", "this", "connection", "." ]
python
train
29.235294
rwl/godot
godot/ui/graph_view_model.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/ui/graph_view_model.py#L213-L235
def open_file(self, info): """ Handles the open action. """ if not info.initialized: return # Escape. # retval = self.edit_traits(parent=info.ui.control, view="file_view") dlg = FileDialog( action = "open", wildcard = "Graphviz Files (*.dot, *.xdot, *.txt)|" ...
[ "def", "open_file", "(", "self", ",", "info", ")", ":", "if", "not", "info", ".", "initialized", ":", "return", "# Escape.", "# retval = self.edit_traits(parent=info.ui.control, view=\"file_view\")", "dlg", "=", "FileDialog", "(", "action", "=", "\"open\"", ","...
Handles the open action.
[ "Handles", "the", "open", "action", "." ]
python
test
30.478261
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L551-L561
def get_all_yep(self): """Cascading style sheet (CSS) extension points. :returns: dict: {yep: [css...], ...} """ yeps = {} for p in self.get_enabled_plugins: for e, v in p["plugin_yep"].items(): yep = yeps.get(e, []) + v yeps[e] = yep ...
[ "def", "get_all_yep", "(", "self", ")", ":", "yeps", "=", "{", "}", "for", "p", "in", "self", ".", "get_enabled_plugins", ":", "for", "e", ",", "v", "in", "p", "[", "\"plugin_yep\"", "]", ".", "items", "(", ")", ":", "yep", "=", "yeps", ".", "get...
Cascading style sheet (CSS) extension points. :returns: dict: {yep: [css...], ...}
[ "Cascading", "style", "sheet", "(", "CSS", ")", "extension", "points", "." ]
python
train
29.909091
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site.py#L133-L141
def addbuilddir(): """Append ./build/lib.<platform> in case we're running in the build dir (especially for Guido :-)""" from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) if hasattr(sys, 'gettotalrefcount'): s += '-pydebug' s = os.path.join(os...
[ "def", "addbuilddir", "(", ")", ":", "from", "distutils", ".", "util", "import", "get_platform", "s", "=", "\"build/lib.%s-%.3s\"", "%", "(", "get_platform", "(", ")", ",", "sys", ".", "version", ")", "if", "hasattr", "(", "sys", ",", "'gettotalrefcount'", ...
Append ./build/lib.<platform> in case we're running in the build dir (especially for Guido :-)
[ "Append", ".", "/", "build", "/", "lib", ".", "<platform", ">", "in", "case", "we", "re", "running", "in", "the", "build", "dir", "(", "especially", "for", "Guido", ":", "-", ")" ]
python
test
40.666667
pycontribs/pyrax
pyrax/clouddns.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddns.py#L576-L586
def delete(self, domain, delete_subdomains=False): """ Deletes the specified domain and all of its resource records. If the domain has subdomains, each subdomain will now become a root domain. If you wish to also delete any subdomains, pass True to 'delete_subdomains'. """ ...
[ "def", "delete", "(", "self", ",", "domain", ",", "delete_subdomains", "=", "False", ")", ":", "uri", "=", "\"/%s/%s\"", "%", "(", "self", ".", "uri_base", ",", "utils", ".", "get_id", "(", "domain", ")", ")", "if", "delete_subdomains", ":", "uri", "="...
Deletes the specified domain and all of its resource records. If the domain has subdomains, each subdomain will now become a root domain. If you wish to also delete any subdomains, pass True to 'delete_subdomains'.
[ "Deletes", "the", "specified", "domain", "and", "all", "of", "its", "resource", "records", ".", "If", "the", "domain", "has", "subdomains", "each", "subdomain", "will", "now", "become", "a", "root", "domain", ".", "If", "you", "wish", "to", "also", "delete...
python
train
53.272727
timster/peewee-validates
peewee_validates.py
https://github.com/timster/peewee-validates/blob/417f0fafb87fe9209439d65bc279d86a3d9e8028/peewee_validates.py#L337-L345
def isiterable_notstring(value): """ Returns True if the value is iterable but not a string. Otherwise returns False. :param value: Value to check. """ if isinstance(value, str): return False return isinstance(value, Iterable) or isgeneratorfunction(value) or isgenerator(value)
[ "def", "isiterable_notstring", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "return", "False", "return", "isinstance", "(", "value", ",", "Iterable", ")", "or", "isgeneratorfunction", "(", "value", ")", "or", "isgenerator",...
Returns True if the value is iterable but not a string. Otherwise returns False. :param value: Value to check.
[ "Returns", "True", "if", "the", "value", "is", "iterable", "but", "not", "a", "string", ".", "Otherwise", "returns", "False", "." ]
python
train
33.666667
Neurita/boyle
boyle/storage.py
https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/storage.py#L37-L52
def sav_to_pandas_savreader(input_file): """ SPSS .sav files to Pandas DataFrame through savreader module :param input_file: string :return: """ from savReaderWriter import SavReader lines = [] with SavReader(input_file, returnHeader=True) as reader: header = next(reader) ...
[ "def", "sav_to_pandas_savreader", "(", "input_file", ")", ":", "from", "savReaderWriter", "import", "SavReader", "lines", "=", "[", "]", "with", "SavReader", "(", "input_file", ",", "returnHeader", "=", "True", ")", "as", "reader", ":", "header", "=", "next", ...
SPSS .sav files to Pandas DataFrame through savreader module :param input_file: string :return:
[ "SPSS", ".", "sav", "files", "to", "Pandas", "DataFrame", "through", "savreader", "module" ]
python
valid
25.6875
wavefrontHQ/python-client
wavefront_api_client/api/search_api.py
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/api/search_api.py#L915-L935
def search_cloud_integration_entities(self, **kwargs): # noqa: E501 """Search over a customer's non-deleted cloud integrations # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True ...
[ "def", "search_cloud_integration_entities", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "search_cl...
Search over a customer's non-deleted cloud integrations # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.search_cloud_integration_entities(async_req=True) >>> r...
[ "Search", "over", "a", "customer", "s", "non", "-", "deleted", "cloud", "integrations", "#", "noqa", ":", "E501" ]
python
train
45.809524
projecthamster/hamster
src/hamster/client.py
https://github.com/projecthamster/hamster/blob/ca5254eff53172796ddafc72226c394ed1858245/src/hamster/client.py#L232-L236
def get_category_activities(self, category_id = None): """Return activities for category. If category is not specified, will return activities that have no category""" category_id = category_id or -1 return self._to_dict(('id', 'name', 'category_id', 'category'), self.conn.GetCategoryAct...
[ "def", "get_category_activities", "(", "self", ",", "category_id", "=", "None", ")", ":", "category_id", "=", "category_id", "or", "-", "1", "return", "self", ".", "_to_dict", "(", "(", "'id'", ",", "'name'", ",", "'category_id'", ",", "'category'", ")", "...
Return activities for category. If category is not specified, will return activities that have no category
[ "Return", "activities", "for", "category", ".", "If", "category", "is", "not", "specified", "will", "return", "activities", "that", "have", "no", "category" ]
python
train
67.4
aws/chalice
chalice/deploy/packager.py
https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/deploy/packager.py#L760-L775
def download_manylinux_wheels(self, abi, packages, directory): # type: (str, List[str], str) -> None """Download wheel files for manylinux for all the given packages.""" # If any one of these dependencies fails pip will bail out. Since we # are only interested in all the ones we can down...
[ "def", "download_manylinux_wheels", "(", "self", ",", "abi", ",", "packages", ",", "directory", ")", ":", "# type: (str, List[str], str) -> None", "# If any one of these dependencies fails pip will bail out. Since we", "# are only interested in all the ones we can download, we need to fe...
Download wheel files for manylinux for all the given packages.
[ "Download", "wheel", "files", "for", "manylinux", "for", "all", "the", "given", "packages", "." ]
python
train
65.125
Azure/azure-kusto-python
azure-kusto-data/azure/kusto/data/_converters.py
https://github.com/Azure/azure-kusto-python/blob/92466a2ae175d6353d1dee3496a02517b2a71a86/azure-kusto-data/azure/kusto/data/_converters.py#L22-L41
def to_timedelta(value): """Converts a string to a timedelta.""" if value is None: return None if isinstance(value, (six.integer_types, float)): return timedelta(microseconds=(float(value) / 10)) match = _TIMESPAN_PATTERN.match(value) if match: if match.group(1) == "-": ...
[ "def", "to_timedelta", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "if", "isinstance", "(", "value", ",", "(", "six", ".", "integer_types", ",", "float", ")", ")", ":", "return", "timedelta", "(", "microseconds", "=", "(...
Converts a string to a timedelta.
[ "Converts", "a", "string", "to", "a", "timedelta", "." ]
python
train
33.25
google/python-gflags
gflags/flagvalues.py
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L265-L279
def _GetFlagsDefinedByModule(self, module): """Returns the list of flags defined by a module. Args: module: A module object or a module name (a string). Returns: A new list of Flag objects. Caller may update this list as he wishes: none of those changes will affect the internals of this...
[ "def", "_GetFlagsDefinedByModule", "(", "self", ",", "module", ")", ":", "if", "not", "isinstance", "(", "module", ",", "str", ")", ":", "module", "=", "module", ".", "__name__", "return", "list", "(", "self", ".", "FlagsByModuleDict", "(", ")", ".", "ge...
Returns the list of flags defined by a module. Args: module: A module object or a module name (a string). Returns: A new list of Flag objects. Caller may update this list as he wishes: none of those changes will affect the internals of this FlagValue object.
[ "Returns", "the", "list", "of", "flags", "defined", "by", "a", "module", "." ]
python
train
30.933333
Azure/Azure-MachineLearning-ClientLibrary-Python
azureml/services.py
https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python/blob/d1211b289747671898eb063013e0dc53d3c80acd/azureml/services.py#L394-L412
def find_globals(code): """walks the byte code to find the variables which are actually globals""" cur_byte = 0 byte_code = code.co_code names = set() while cur_byte < len(byte_code): op = ord(byte_code[cur_byte]) if op >= dis.HAVE_ARGUMENT: ...
[ "def", "find_globals", "(", "code", ")", ":", "cur_byte", "=", "0", "byte_code", "=", "code", ".", "co_code", "names", "=", "set", "(", ")", "while", "cur_byte", "<", "len", "(", "byte_code", ")", ":", "op", "=", "ord", "(", "byte_code", "[", "cur_by...
walks the byte code to find the variables which are actually globals
[ "walks", "the", "byte", "code", "to", "find", "the", "variables", "which", "are", "actually", "globals" ]
python
test
31.684211
log2timeline/plaso
plaso/lib/lexer.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/lib/lexer.py#L171-L178
def PushBack(self, string='', **unused_kwargs): """Push the match back on the stream. Args: string: optional data. """ self.buffer = string + self.buffer self.processed_buffer = self.processed_buffer[:-len(string)]
[ "def", "PushBack", "(", "self", ",", "string", "=", "''", ",", "*", "*", "unused_kwargs", ")", ":", "self", ".", "buffer", "=", "string", "+", "self", ".", "buffer", "self", ".", "processed_buffer", "=", "self", ".", "processed_buffer", "[", ":", "-", ...
Push the match back on the stream. Args: string: optional data.
[ "Push", "the", "match", "back", "on", "the", "stream", "." ]
python
train
29.25
jonhadfield/creds
lib/creds/users.py
https://github.com/jonhadfield/creds/blob/b2053b43516cf742c6e4c2b79713bc625592f47c/lib/creds/users.py#L227-L232
def to_dict(self): """ Return a dict of the users. """ users = dict(users=list()) for user in self: users['users'].append(user.to_dict()) return users
[ "def", "to_dict", "(", "self", ")", ":", "users", "=", "dict", "(", "users", "=", "list", "(", ")", ")", "for", "user", "in", "self", ":", "users", "[", "'users'", "]", ".", "append", "(", "user", ".", "to_dict", "(", ")", ")", "return", "users" ...
Return a dict of the users.
[ "Return", "a", "dict", "of", "the", "users", "." ]
python
train
31.5
playpauseandstop/rororo
rororo/timedelta.py
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/timedelta.py#L165-L178
def timedelta_div(first: datetime.timedelta, second: datetime.timedelta) -> Optional[float]: """Implement divison for timedelta instances. :param first: First timedelta instance. :param second: Second timedelta instance. """ first_seconds = timedelta_seconds(first) second_seco...
[ "def", "timedelta_div", "(", "first", ":", "datetime", ".", "timedelta", ",", "second", ":", "datetime", ".", "timedelta", ")", "->", "Optional", "[", "float", "]", ":", "first_seconds", "=", "timedelta_seconds", "(", "first", ")", "second_seconds", "=", "ti...
Implement divison for timedelta instances. :param first: First timedelta instance. :param second: Second timedelta instance.
[ "Implement", "divison", "for", "timedelta", "instances", "." ]
python
train
30.642857
radjkarl/imgProcessor
imgProcessor/measure/sharpness/_base.py
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/measure/sharpness/_base.py#L33-L62
def MTF(self, px_per_mm): ''' px_per_mm = cam_resolution / image_size ''' res = 100 #numeric resolution r = 4 #range +-r*std #size of 1 px: px_size = 1 / px_per_mm #standard deviation of the point-spread-function (PSF) as normal...
[ "def", "MTF", "(", "self", ",", "px_per_mm", ")", ":", "res", "=", "100", "#numeric resolution\r", "r", "=", "4", "#range +-r*std\r", "#size of 1 px:\r", "px_size", "=", "1", "/", "px_per_mm", "#standard deviation of the point-spread-function (PSF) as normal distributed:\...
px_per_mm = cam_resolution / image_size
[ "px_per_mm", "=", "cam_resolution", "/", "image_size" ]
python
train
36.6
StackStorm/pybind
pybind/slxos/v17s_1_02/mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/__init__.py#L513-L534
def _set_lsp_traffic_engineering(self, v, load=False): """ Setter method for lsp_traffic_engineering, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/lsp_traffic_engineering (container) If this variable is read-only (config: false) in the source YANG file, then _se...
[ "def", "_set_lsp_traffic_engineering", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ...
Setter method for lsp_traffic_engineering, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/lsp_traffic_engineering (container) If this variable is read-only (config: false) in the source YANG file, then _set_lsp_traffic_engineering is considered as a private method. Ba...
[ "Setter", "method", "for", "lsp_traffic_engineering", "mapped", "from", "YANG", "variable", "/", "mpls_config", "/", "router", "/", "mpls", "/", "mpls_cmds_holder", "/", "lsp", "/", "secondary_path", "/", "lsp_traffic_engineering", "(", "container", ")", "If", "th...
python
train
95.227273
dropbox/stone
stone/ir/data_types.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/ir/data_types.py#L981-L988
def all_optional_fields(self): """ Returns an iterator that traverses optional fields in all super types first, and then for this type. """ def optional_check(f): return is_nullable_type(f.data_type) or f.has_default return self._filter_fields(optional_check)
[ "def", "all_optional_fields", "(", "self", ")", ":", "def", "optional_check", "(", "f", ")", ":", "return", "is_nullable_type", "(", "f", ".", "data_type", ")", "or", "f", ".", "has_default", "return", "self", ".", "_filter_fields", "(", "optional_check", ")...
Returns an iterator that traverses optional fields in all super types first, and then for this type.
[ "Returns", "an", "iterator", "that", "traverses", "optional", "fields", "in", "all", "super", "types", "first", "and", "then", "for", "this", "type", "." ]
python
train
39
HDI-Project/RDT
rdt/transformers/category.py
https://github.com/HDI-Project/RDT/blob/b28fdd671a1d7fbd14983eefe0cfbd8d87ded92a/rdt/transformers/category.py#L165-L179
def fit_transform(self, col): """Prepare the transformer and return processed data. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame """ if self.anonymize: col = self.anonymize_column(col) self._fit(col) ...
[ "def", "fit_transform", "(", "self", ",", "col", ")", ":", "if", "self", ".", "anonymize", ":", "col", "=", "self", ".", "anonymize_column", "(", "col", ")", "self", ".", "_fit", "(", "col", ")", "return", "self", ".", "transform", "(", "col", ")" ]
Prepare the transformer and return processed data. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame
[ "Prepare", "the", "transformer", "and", "return", "processed", "data", "." ]
python
train
22.466667
atlassian-api/atlassian-python-api
atlassian/confluence.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/confluence.py#L432-L451
def is_page_content_is_already_updated(self, page_id, body): """ Compare content and check is already updated or not :param page_id: Content ID for retrieve storage value :param body: Body for compare it :return: True if the same """ confluence_content = (self.get...
[ "def", "is_page_content_is_already_updated", "(", "self", ",", "page_id", ",", "body", ")", ":", "confluence_content", "=", "(", "self", ".", "get_page_by_id", "(", "page_id", ",", "expand", "=", "'body.storage'", ")", ".", "get", "(", "'body'", ")", "or", "...
Compare content and check is already updated or not :param page_id: Content ID for retrieve storage value :param body: Body for compare it :return: True if the same
[ "Compare", "content", "and", "check", "is", "already", "updated", "or", "not", ":", "param", "page_id", ":", "Content", "ID", "for", "retrieve", "storage", "value", ":", "param", "body", ":", "Body", "for", "compare", "it", ":", "return", ":", "True", "i...
python
train
44.75
kolypto/py-asynctools
asynctools/threading/Parallel.py
https://github.com/kolypto/py-asynctools/blob/04ff42d13b54d200d8cc88b3639937b63278e57c/asynctools/threading/Parallel.py#L36-L55
def _thread(self): """ Thread entry point: does the job once, stored results, and dies. """ # Get args, kwargs = self._jobs.get() # Stop thread when (None, None) comes in if args is None and kwargs is None: return None # Wrappers should exit as well # Work ...
[ "def", "_thread", "(", "self", ")", ":", "# Get", "args", ",", "kwargs", "=", "self", ".", "_jobs", ".", "get", "(", ")", "# Stop thread when (None, None) comes in", "if", "args", "is", "None", "and", "kwargs", "is", "None", ":", "return", "None", "# Wrapp...
Thread entry point: does the job once, stored results, and dies.
[ "Thread", "entry", "point", ":", "does", "the", "job", "once", "stored", "results", "and", "dies", "." ]
python
train
31.15
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAFetch/QAQuery.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery.py#L373-L416
def QA_fetch_future_min( code, start, end, format='numpy', frequence='1min', collections=DATABASE.future_min): '获取股票分钟线' if frequence in ['1min', '1m']: frequence = '1min' elif frequence in ['5min', '5m']: frequence = '5min' elif frequence in ['15m...
[ "def", "QA_fetch_future_min", "(", "code", ",", "start", ",", "end", ",", "format", "=", "'numpy'", ",", "frequence", "=", "'1min'", ",", "collections", "=", "DATABASE", ".", "future_min", ")", ":", "if", "frequence", "in", "[", "'1min'", ",", "'1m'", "]...
获取股票分钟线
[ "获取股票分钟线" ]
python
train
38.090909
lsst-sqre/zenodio
zenodio/harvest.py
https://github.com/lsst-sqre/zenodio/blob/24283e84bee5714450e4f206ec024c4d32f2e761/zenodio/harvest.py#L258-L317
def _pluralize(value, item_key): """"Force the value of a datacite3 key to be a list. >>> _pluralize(xml_input['authors'], 'author') ['Sick, Jonathan', 'Economou, Frossie'] Background ---------- When `xmltodict` proceses metadata, it turns XML tags into new key-value pairs whenever possibl...
[ "def", "_pluralize", "(", "value", ",", "item_key", ")", ":", "v", "=", "value", "[", "item_key", "]", "if", "not", "isinstance", "(", "v", ",", "list", ")", ":", "# Force a singular value to be a list", "return", "[", "v", "]", "else", ":", "return", "v...
Force the value of a datacite3 key to be a list. >>> _pluralize(xml_input['authors'], 'author') ['Sick, Jonathan', 'Economou, Frossie'] Background ---------- When `xmltodict` proceses metadata, it turns XML tags into new key-value pairs whenever possible, even if the value should semantically ...
[ "Force", "the", "value", "of", "a", "datacite3", "key", "to", "be", "a", "list", "." ]
python
train
24.116667
inasafe/inasafe
safe/report/expressions/map_report.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L288-L292
def disclaimer_title_header_element(feature, parent): """Retrieve disclaimer title header string from definitions.""" _ = feature, parent # NOQA header = disclaimer_title_header['string_format'] return header.capitalize()
[ "def", "disclaimer_title_header_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "disclaimer_title_header", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve disclaimer title header string from definitions.
[ "Retrieve", "disclaimer", "title", "header", "string", "from", "definitions", "." ]
python
train
46.8
dj-stripe/dj-stripe
djstripe/decorators.py
https://github.com/dj-stripe/dj-stripe/blob/a5308a3808cd6e2baba49482f7a699f3a8992518/djstripe/decorators.py#L38-L51
def subscription_payment_required( function=None, plan=None, pay_page=SUBSCRIPTION_REDIRECT ): """ Decorator for views that require subscription payment. Redirects to `pay_page` if necessary. """ actual_decorator = subscriber_passes_pay_test( subscriber_has_active_subscription, plan=plan, pay_page=pay_page ) ...
[ "def", "subscription_payment_required", "(", "function", "=", "None", ",", "plan", "=", "None", ",", "pay_page", "=", "SUBSCRIPTION_REDIRECT", ")", ":", "actual_decorator", "=", "subscriber_passes_pay_test", "(", "subscriber_has_active_subscription", ",", "plan", "=", ...
Decorator for views that require subscription payment. Redirects to `pay_page` if necessary.
[ "Decorator", "for", "views", "that", "require", "subscription", "payment", "." ]
python
train
27.214286
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L469-L477
def write(self, s): """Write string s to the stream. """ if self.comptype == "gz": self.crc = self.zlib.crc32(s, self.crc) self.pos += len(s) if self.comptype != "tar": s = self.cmp.compress(s) self.__write(s)
[ "def", "write", "(", "self", ",", "s", ")", ":", "if", "self", ".", "comptype", "==", "\"gz\"", ":", "self", ".", "crc", "=", "self", ".", "zlib", ".", "crc32", "(", "s", ",", "self", ".", "crc", ")", "self", ".", "pos", "+=", "len", "(", "s"...
Write string s to the stream.
[ "Write", "string", "s", "to", "the", "stream", "." ]
python
train
30.333333
andrewda/frc-livescore
livescore/simpleocr_utils/segmentation_aux.py
https://github.com/andrewda/frc-livescore/blob/71594cd6d2c8b6c5feb3889bb05552d09b8128b1/livescore/simpleocr_utils/segmentation_aux.py#L11-L21
def _process(self, segments): """sort segments in read order - left to right, up to down""" # sort_f= lambda r: max_line_width*(r[1]/max_line_height)+r[0] # segments= sorted(segments, key=sort_f) # segments= segments_to_numpy( segments ) # return segments mlh, mlw = self....
[ "def", "_process", "(", "self", ",", "segments", ")", ":", "# sort_f= lambda r: max_line_width*(r[1]/max_line_height)+r[0]", "# segments= sorted(segments, key=sort_f)", "# segments= segments_to_numpy( segments )", "# return segments", "mlh", ",", "mlw", "=", "self", ".", "max_lin...
sort segments in read order - left to right, up to down
[ "sort", "segments", "in", "read", "order", "-", "left", "to", "right", "up", "to", "down" ]
python
train
48.727273
DLR-RM/RAFCON
source/rafcon/gui/views/logging_console.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/views/logging_console.py#L150-L153
def _auto_scroll(self, *args): """ Scroll to the end of the text view """ adj = self['scrollable'].get_vadjustment() adj.set_value(adj.get_upper() - adj.get_page_size())
[ "def", "_auto_scroll", "(", "self", ",", "*", "args", ")", ":", "adj", "=", "self", "[", "'scrollable'", "]", ".", "get_vadjustment", "(", ")", "adj", ".", "set_value", "(", "adj", ".", "get_upper", "(", ")", "-", "adj", ".", "get_page_size", "(", ")...
Scroll to the end of the text view
[ "Scroll", "to", "the", "end", "of", "the", "text", "view" ]
python
train
47.5
blockstack/blockstack-core
blockstack/lib/fast_sync.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/fast_sync.py#L183-L220
def fast_sync_snapshot_compress( snapshot_dir, export_path ): """ Given the path to a directory, compress it and export it to the given path. Return {'status': True} on success Return {'error': ...} on failure """ snapshot_dir = os.path.abspath(snapshot_dir) export_path = os.path.abspa...
[ "def", "fast_sync_snapshot_compress", "(", "snapshot_dir", ",", "export_path", ")", ":", "snapshot_dir", "=", "os", ".", "path", ".", "abspath", "(", "snapshot_dir", ")", "export_path", "=", "os", ".", "path", ".", "abspath", "(", "export_path", ")", "if", "...
Given the path to a directory, compress it and export it to the given path. Return {'status': True} on success Return {'error': ...} on failure
[ "Given", "the", "path", "to", "a", "directory", "compress", "it", "and", "export", "it", "to", "the", "given", "path", "." ]
python
train
24.263158
cons3rt/pycons3rt
pycons3rt/aliasip.py
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/aliasip.py#L32-L61
def validate_ip_address(ip_address): """Validate the ip_address :param ip_address: (str) IP address :return: (bool) True if the ip_address is valid """ # Validate the IP address log = logging.getLogger(mod_logger + '.validate_ip_address') if not isinstance(ip_address, basestring): l...
[ "def", "validate_ip_address", "(", "ip_address", ")", ":", "# Validate the IP address", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.validate_ip_address'", ")", "if", "not", "isinstance", "(", "ip_address", ",", "basestring", ")", ":", "log"...
Validate the ip_address :param ip_address: (str) IP address :return: (bool) True if the ip_address is valid
[ "Validate", "the", "ip_address" ]
python
train
29.666667
simonvh/genomepy
genomepy/provider.py
https://github.com/simonvh/genomepy/blob/abace2366511dbe855fe1430b1f7d9ec4cbf6d29/genomepy/provider.py#L73-L80
def register_provider(cls, provider): """Register method to keep list of providers.""" def decorator(subclass): """Register as decorator function.""" cls._providers[provider] = subclass subclass.name = provider return subclass return decorator
[ "def", "register_provider", "(", "cls", ",", "provider", ")", ":", "def", "decorator", "(", "subclass", ")", ":", "\"\"\"Register as decorator function.\"\"\"", "cls", ".", "_providers", "[", "provider", "]", "=", "subclass", "subclass", ".", "name", "=", "provi...
Register method to keep list of providers.
[ "Register", "method", "to", "keep", "list", "of", "providers", "." ]
python
train
38.5
dslackw/slpkg
slpkg/sbo/check.py
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/sbo/check.py#L60-L67
def sbo_list(): """Return all SBo packages """ sbo_packages = [] for pkg in os.listdir(_meta_.pkg_path): if pkg.endswith("_SBo"): sbo_packages.append(pkg) return sbo_packages
[ "def", "sbo_list", "(", ")", ":", "sbo_packages", "=", "[", "]", "for", "pkg", "in", "os", ".", "listdir", "(", "_meta_", ".", "pkg_path", ")", ":", "if", "pkg", ".", "endswith", "(", "\"_SBo\"", ")", ":", "sbo_packages", ".", "append", "(", "pkg", ...
Return all SBo packages
[ "Return", "all", "SBo", "packages" ]
python
train
25.875
pyhys/minimalmodbus
minimalmodbus.py
https://github.com/pyhys/minimalmodbus/blob/e99f4d74c83258c6039073082955ac9bed3f2155/minimalmodbus.py#L1665-L1692
def _hexencode(bytestring, insert_spaces = False): """Convert a byte string to a hex encoded string. For example 'J' will return '4A', and ``'\\x04'`` will return '04'. Args: bytestring (str): Can be for example ``'A\\x01B\\x45'``. insert_spaces (bool): Insert space characters between pair...
[ "def", "_hexencode", "(", "bytestring", ",", "insert_spaces", "=", "False", ")", ":", "_checkString", "(", "bytestring", ",", "description", "=", "'byte string'", ")", "separator", "=", "''", "if", "not", "insert_spaces", "else", "' '", "# Use plain string formatt...
Convert a byte string to a hex encoded string. For example 'J' will return '4A', and ``'\\x04'`` will return '04'. Args: bytestring (str): Can be for example ``'A\\x01B\\x45'``. insert_spaces (bool): Insert space characters between pair of characters to increase readability. Returns: ...
[ "Convert", "a", "byte", "string", "to", "a", "hex", "encoded", "string", "." ]
python
train
33.857143
CalebBell/fpi
fpi/drag.py
https://github.com/CalebBell/fpi/blob/6e6da3b9d0c17e10cc0886c97bc1bb8aeba2cca5/fpi/drag.py#L383-L424
def Flemmer_Banks(Re): r'''Calculates drag coefficient of a smooth sphere using the method in [1]_ as described in [2]_. .. math:: C_D = \frac{24}{Re}10^E E = 0.383Re^{0.356}-0.207Re^{0.396} - \frac{0.143}{1+(\log_{10} Re)^2} Parameters ---------- Re : float Reynolds n...
[ "def", "Flemmer_Banks", "(", "Re", ")", ":", "E", "=", "0.383", "*", "Re", "**", "0.356", "-", "0.207", "*", "Re", "**", "0.396", "-", "0.143", "/", "(", "1", "+", "(", "log10", "(", "Re", ")", ")", "**", "2", ")", "Cd", "=", "24.", "/", "R...
r'''Calculates drag coefficient of a smooth sphere using the method in [1]_ as described in [2]_. .. math:: C_D = \frac{24}{Re}10^E E = 0.383Re^{0.356}-0.207Re^{0.396} - \frac{0.143}{1+(\log_{10} Re)^2} Parameters ---------- Re : float Reynolds number of the sphere, [-] ...
[ "r", "Calculates", "drag", "coefficient", "of", "a", "smooth", "sphere", "using", "the", "method", "in", "[", "1", "]", "_", "as", "described", "in", "[", "2", "]", "_", "." ]
python
train
27.547619
line/line-bot-sdk-python
linebot/http_client.py
https://github.com/line/line-bot-sdk-python/blob/1b38bfc2497ff3e3c75be4b50e0f1b7425a07ce0/linebot/http_client.py#L254-L260
def iter_content(self, chunk_size=1024, decode_unicode=False): """Get request body as iterator content (stream). :param int chunk_size: :param bool decode_unicode: """ return self.response.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode)
[ "def", "iter_content", "(", "self", ",", "chunk_size", "=", "1024", ",", "decode_unicode", "=", "False", ")", ":", "return", "self", ".", "response", ".", "iter_content", "(", "chunk_size", "=", "chunk_size", ",", "decode_unicode", "=", "decode_unicode", ")" ]
Get request body as iterator content (stream). :param int chunk_size: :param bool decode_unicode:
[ "Get", "request", "body", "as", "iterator", "content", "(", "stream", ")", "." ]
python
train
41.428571
h2oai/h2o-3
h2o-py/h2o/frame.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L697-L707
def mult(self, matrix): """ Multiply this frame, viewed as a matrix, by another matrix. :param matrix: another frame that you want to multiply the current frame by; must be compatible with the current frame (i.e. its number of rows must be the same as number of columns in the curren...
[ "def", "mult", "(", "self", ",", "matrix", ")", ":", "if", "self", ".", "ncols", "!=", "matrix", ".", "nrows", ":", "raise", "H2OValueError", "(", "\"Matrix is not compatible for multiplication with the current frame\"", ")", "return", "H2OFrame", ".", "_expr", "(...
Multiply this frame, viewed as a matrix, by another matrix. :param matrix: another frame that you want to multiply the current frame by; must be compatible with the current frame (i.e. its number of rows must be the same as number of columns in the current frame). :returns: new H2OFrame, wh...
[ "Multiply", "this", "frame", "viewed", "as", "a", "matrix", "by", "another", "matrix", "." ]
python
test
57.818182
log2timeline/plaso
plaso/cli/helpers/profiling.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/cli/helpers/profiling.py#L70-L117
def ParseOptions(cls, options, configuration_object): """Parses and validates options. Args: options (argparse.Namespace): parser options. configuration_object (CLITool): object to be configured by the argument helper. Raises: BadConfigObject: when the configuration object is o...
[ "def", "ParseOptions", "(", "cls", ",", "options", ",", "configuration_object", ")", ":", "if", "not", "isinstance", "(", "configuration_object", ",", "tools", ".", "CLITool", ")", ":", "raise", "errors", ".", "BadConfigObject", "(", "'Configuration object is not ...
Parses and validates options. Args: options (argparse.Namespace): parser options. configuration_object (CLITool): object to be configured by the argument helper. Raises: BadConfigObject: when the configuration object is of the wrong type.
[ "Parses", "and", "validates", "options", "." ]
python
train
39.583333
night-crawler/django-docker-helpers
django_docker_helpers/config/backends/mpt_redis_parser.py
https://github.com/night-crawler/django-docker-helpers/blob/b64f8009101a8eb61d3841124ba19e3ab881aa2f/django_docker_helpers/config/backends/mpt_redis_parser.py#L75-L112
def get(self, variable_path: str, default: t.Optional[t.Any] = None, coerce_type: t.Optional[t.Type] = None, coercer: t.Optional[t.Callable] = None, **kwargs): """ :param variable_path: a delimiter-separated path to a nested value :para...
[ "def", "get", "(", "self", ",", "variable_path", ":", "str", ",", "default", ":", "t", ".", "Optional", "[", "t", ".", "Any", "]", "=", "None", ",", "coerce_type", ":", "t", ".", "Optional", "[", "t", ".", "Type", "]", "=", "None", ",", "coercer"...
:param variable_path: a delimiter-separated path to a nested value :param default: default value if there's no object by specified path :param coerce_type: cast a type of a value to a specified one :param coercer: perform a type casting with specified callback :param kwargs: additional a...
[ ":", "param", "variable_path", ":", "a", "delimiter", "-", "separated", "path", "to", "a", "nested", "value", ":", "param", "default", ":", "default", "value", "if", "there", "s", "no", "object", "by", "specified", "path", ":", "param", "coerce_type", ":",...
python
train
39.447368
pypa/pipenv
pipenv/vendor/vistir/path.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L499-L551
def get_converted_relative_path(path, relative_to=None): """Convert `path` to be relative. Given a vague relative path, return the path relative to the given location. :param str path: The location of a target path :param str relative_to: The starting path to build against, optional :returns: ...
[ "def", "get_converted_relative_path", "(", "path", ",", "relative_to", "=", "None", ")", ":", "from", ".", "misc", "import", "to_text", ",", "to_bytes", "# noqa", "if", "not", "relative_to", ":", "relative_to", "=", "os", ".", "getcwdu", "(", ")", "if", "s...
Convert `path` to be relative. Given a vague relative path, return the path relative to the given location. :param str path: The location of a target path :param str relative_to: The starting path to build against, optional :returns: A relative posix-style path with a leading `./` This perfor...
[ "Convert", "path", "to", "be", "relative", "." ]
python
train
37.018868
odlgroup/odl
odl/ufunc_ops/ufunc_ops.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/ufunc_ops/ufunc_ops.py#L157-L209
def derivative_factory(name): """Create derivative function for some ufuncs.""" if name == 'sin': def derivative(self, point): """Return the derivative operator.""" return MultiplyOperator(cos(self.domain)(point)) elif name == 'cos': def derivative(self, point): ...
[ "def", "derivative_factory", "(", "name", ")", ":", "if", "name", "==", "'sin'", ":", "def", "derivative", "(", "self", ",", "point", ")", ":", "\"\"\"Return the derivative operator.\"\"\"", "return", "MultiplyOperator", "(", "cos", "(", "self", ".", "domain", ...
Create derivative function for some ufuncs.
[ "Create", "derivative", "function", "for", "some", "ufuncs", "." ]
python
train
38.754717
PetrochukM/PyTorch-NLP
torchnlp/encoders/text/subword_encoder.py
https://github.com/PetrochukM/PyTorch-NLP/blob/5f7320da5c8d781df072fab3f7e421c6347e5bfa/torchnlp/encoders/text/subword_encoder.py#L111-L121
def decode(self, encoded): """ Decodes a tensor into a sequence. Args: encoded (torch.Tensor): Encoded sequence. Returns: str: Sequence decoded from ``encoded``. """ encoded = super().decode(encoded) return self.tokenizer.decode([self.itos[index]...
[ "def", "decode", "(", "self", ",", "encoded", ")", ":", "encoded", "=", "super", "(", ")", ".", "decode", "(", "encoded", ")", "return", "self", ".", "tokenizer", ".", "decode", "(", "[", "self", ".", "itos", "[", "index", "]", "for", "index", "in"...
Decodes a tensor into a sequence. Args: encoded (torch.Tensor): Encoded sequence. Returns: str: Sequence decoded from ``encoded``.
[ "Decodes", "a", "tensor", "into", "a", "sequence", "." ]
python
train
30.272727
Parsl/parsl
parsl/channels/ssh/ssh.py
https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/channels/ssh/ssh.py#L147-L185
def push_file(self, local_source, remote_dir): ''' Transport a local file to a directory on a remote machine Args: - local_source (string): Path - remote_dir (string): Remote path Returns: - str: Path to copied file on remote machine Raises: ...
[ "def", "push_file", "(", "self", ",", "local_source", ",", "remote_dir", ")", ":", "remote_dest", "=", "remote_dir", "+", "'/'", "+", "os", ".", "path", ".", "basename", "(", "local_source", ")", "try", ":", "self", ".", "makedirs", "(", "remote_dir", ",...
Transport a local file to a directory on a remote machine Args: - local_source (string): Path - remote_dir (string): Remote path Returns: - str: Path to copied file on remote machine Raises: - BadScriptPath : if script path on the remote side is...
[ "Transport", "a", "local", "file", "to", "a", "directory", "on", "a", "remote", "machine" ]
python
valid
40.179487
standage/tag
tag/transcript.py
https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/transcript.py#L96-L154
def primary_transcript(entrystream, parenttype='gene', logstream=stderr): """ Select a single transcript as a representative for each gene. This function is a generalization of the `primary_mrna` function that attempts, under certain conditions, to select a single transcript as a representative for...
[ "def", "primary_transcript", "(", "entrystream", ",", "parenttype", "=", "'gene'", ",", "logstream", "=", "stderr", ")", ":", "for", "entry", "in", "entrystream", ":", "if", "not", "isinstance", "(", "entry", ",", "tag", ".", "Feature", ")", ":", "yield", ...
Select a single transcript as a representative for each gene. This function is a generalization of the `primary_mrna` function that attempts, under certain conditions, to select a single transcript as a representative for each gene. If a gene encodes multiple transcript types, one of those types must b...
[ "Select", "a", "single", "transcript", "as", "a", "representative", "for", "each", "gene", "." ]
python
train
41.813559
bykof/billomapy
billomapy/billomapy.py
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L596-L611
def get_all_supplier_properties(self, params=None): """ Get all supplier properties This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list ...
[ "def", "get_all_supplier_properties", "(", "self", ",", "params", "=", "None", ")", ":", "if", "not", "params", ":", "params", "=", "{", "}", "return", "self", ".", "_iterate_through_pages", "(", "get_function", "=", "self", ".", "get_supplier_properties_per_pag...
Get all supplier properties This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list
[ "Get", "all", "supplier", "properties", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "will", "get",...
python
train
34.6875
Miserlou/django-knockout-modeler
knockout_modeler/ko.py
https://github.com/Miserlou/django-knockout-modeler/blob/714d21cc5ed008f132cea01dbae9f214c2bf1b76/knockout_modeler/ko.py#L40-L71
def get_object_data(obj, fields, safe): """ Given an object and a list of fields, recursively build an object for serialization. Returns a dictionary. """ temp_dict = dict() for field in fields: try: attribute = getattr(obj, str(field)) if isinstance(attribute,...
[ "def", "get_object_data", "(", "obj", ",", "fields", ",", "safe", ")", ":", "temp_dict", "=", "dict", "(", ")", "for", "field", "in", "fields", ":", "try", ":", "attribute", "=", "getattr", "(", "obj", ",", "str", "(", "field", ")", ")", "if", "isi...
Given an object and a list of fields, recursively build an object for serialization. Returns a dictionary.
[ "Given", "an", "object", "and", "a", "list", "of", "fields", "recursively", "build", "an", "object", "for", "serialization", "." ]
python
train
35.875
google/grr
grr/server/grr_response_server/databases/mysql_paths.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_paths.py#L186-L191
def WritePathInfos(self, client_id, path_infos): """Writes a collection of path_info records for a client.""" try: self._MultiWritePathInfos({client_id: path_infos}) except MySQLdb.IntegrityError as error: raise db.UnknownClientError(client_id=client_id, cause=error)
[ "def", "WritePathInfos", "(", "self", ",", "client_id", ",", "path_infos", ")", ":", "try", ":", "self", ".", "_MultiWritePathInfos", "(", "{", "client_id", ":", "path_infos", "}", ")", "except", "MySQLdb", ".", "IntegrityError", "as", "error", ":", "raise",...
Writes a collection of path_info records for a client.
[ "Writes", "a", "collection", "of", "path_info", "records", "for", "a", "client", "." ]
python
train
47.666667
facelessuser/backrefs
backrefs/_bre_parse.py
https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/_bre_parse.py#L1307-L1337
def handle_group(self, text, capture=None, is_format=False): """Handle groups.""" if capture is None: capture = tuple() if self.is_bytes else '' if len(self.result) > 1: self.literal_slots.append("".join(self.result)) if is_format: self.liter...
[ "def", "handle_group", "(", "self", ",", "text", ",", "capture", "=", "None", ",", "is_format", "=", "False", ")", ":", "if", "capture", "is", "None", ":", "capture", "=", "tuple", "(", ")", "if", "self", ".", "is_bytes", "else", "''", "if", "len", ...
Handle groups.
[ "Handle", "groups", "." ]
python
train
29.967742
pyQode/pyqode.core
pyqode/core/cache.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/cache.py#L51-L63
def preferred_encodings(self): """ The list of user defined encodings, for display in the encodings menu/combobox. """ default_encodings = [ locale.getpreferredencoding().lower().replace('-', '_')] if 'utf_8' not in default_encodings: default_enco...
[ "def", "preferred_encodings", "(", "self", ")", ":", "default_encodings", "=", "[", "locale", ".", "getpreferredencoding", "(", ")", ".", "lower", "(", ")", ".", "replace", "(", "'-'", ",", "'_'", ")", "]", "if", "'utf_8'", "not", "in", "default_encodings"...
The list of user defined encodings, for display in the encodings menu/combobox.
[ "The", "list", "of", "user", "defined", "encodings", "for", "display", "in", "the", "encodings", "menu", "/", "combobox", "." ]
python
train
38.615385
apple/turicreate
src/unity/python/turicreate/toolkits/object_detector/object_detector.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/object_detector/object_detector.py#L1006-L1134
def evaluate(self, dataset, metric='auto', output_type='dict', iou_threshold=None, confidence_threshold=None, verbose=True): """ Evaluate the model by making predictions and comparing these to ground truth bounding box annotations. Parameters ---------- ...
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "output_type", "=", "'dict'", ",", "iou_threshold", "=", "None", ",", "confidence_threshold", "=", "None", ",", "verbose", "=", "True", ")", ":", "if", "iou_threshold", "is"...
Evaluate the model by making predictions and comparing these to ground truth bounding box annotations. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same names as the annotations and feature used for model train...
[ "Evaluate", "the", "model", "by", "making", "predictions", "and", "comparing", "these", "to", "ground", "truth", "bounding", "box", "annotations", "." ]
python
train
43.581395
f213/rumetr-client
rumetr/scrapy/pipeline.py
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/scrapy/pipeline.py#L81-L86
def c(self): """Caching client for not repeapting checks""" if self._client is None: self._parse_settings() self._client = Rumetr(**self.settings) return self._client
[ "def", "c", "(", "self", ")", ":", "if", "self", ".", "_client", "is", "None", ":", "self", ".", "_parse_settings", "(", ")", "self", ".", "_client", "=", "Rumetr", "(", "*", "*", "self", ".", "settings", ")", "return", "self", ".", "_client" ]
Caching client for not repeapting checks
[ "Caching", "client", "for", "not", "repeapting", "checks" ]
python
train
34.833333
django-extensions/django-extensions
django_extensions/db/fields/__init__.py
https://github.com/django-extensions/django-extensions/blob/7e0bef97ea6cb7f9eea5e2528e3a985a83a7b9b8/django_extensions/db/fields/__init__.py#L134-L144
def _slug_strip(self, value): """ Clean up a slug by removing slug separator characters that occur at the beginning or end of a slug. If an alternate separator is used, it will also replace any instances of the default '-' separator with the new separator. """ re...
[ "def", "_slug_strip", "(", "self", ",", "value", ")", ":", "re_sep", "=", "'(?:-|%s)'", "%", "re", ".", "escape", "(", "self", ".", "separator", ")", "value", "=", "re", ".", "sub", "(", "'%s+'", "%", "re_sep", ",", "self", ".", "separator", ",", "...
Clean up a slug by removing slug separator characters that occur at the beginning or end of a slug. If an alternate separator is used, it will also replace any instances of the default '-' separator with the new separator.
[ "Clean", "up", "a", "slug", "by", "removing", "slug", "separator", "characters", "that", "occur", "at", "the", "beginning", "or", "end", "of", "a", "slug", "." ]
python
train
43.909091
SeleniumHQ/selenium
py/selenium/webdriver/firefox/firefox_profile.py
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/firefox_profile.py#L203-L249
def _install_extension(self, addon, unpack=True): """ Installs addon from a filepath, url or directory of addons in the profile. - path: url, absolute path to .xpi, or directory of addons - unpack: whether to unpack unless specified otherwise in the install.rdf ...
[ "def", "_install_extension", "(", "self", ",", "addon", ",", "unpack", "=", "True", ")", ":", "if", "addon", "==", "WEBDRIVER_EXT", ":", "addon", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", ...
Installs addon from a filepath, url or directory of addons in the profile. - path: url, absolute path to .xpi, or directory of addons - unpack: whether to unpack unless specified otherwise in the install.rdf
[ "Installs", "addon", "from", "a", "filepath", "url", "or", "directory", "of", "addons", "in", "the", "profile", ".", "-", "path", ":", "url", "absolute", "path", "to", ".", "xpi", "or", "directory", "of", "addons", "-", "unpack", ":", "whether", "to", ...
python
train
43.638298
nicolargo/glances
glances/client_browser.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client_browser.py#L80-L92
def __get_uri(self, server): """Return the URI for the given server dict.""" # Select the connection mode (with or without password) if server['password'] != "": if server['status'] == 'PROTECTED': # Try with the preconfigure password (only if status is PROTECTED) ...
[ "def", "__get_uri", "(", "self", ",", "server", ")", ":", "# Select the connection mode (with or without password)", "if", "server", "[", "'password'", "]", "!=", "\"\"", ":", "if", "server", "[", "'status'", "]", "==", "'PROTECTED'", ":", "# Try with the preconfigu...
Return the URI for the given server dict.
[ "Return", "the", "URI", "for", "the", "given", "server", "dict", "." ]
python
train
58.384615
idank/bashlex
bashlex/parser.py
https://github.com/idank/bashlex/blob/800cb7e3c634eaa3c81f8a8648fd7fd4e27050ac/bashlex/parser.py#L180-L194
def p_command(p): '''command : simple_command | shell_command | shell_command redirection_list | function_def | coproc''' if isinstance(p[1], ast.node): p[0] = p[1] if len(p) == 3: assert p[0].kind == 'compound' ...
[ "def", "p_command", "(", "p", ")", ":", "if", "isinstance", "(", "p", "[", "1", "]", ",", "ast", ".", "node", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "if", "len", "(", "p", ")", "==", "3", ":", "assert", "p", "[", "0", "]...
command : simple_command | shell_command | shell_command redirection_list | function_def | coproc
[ "command", ":", "simple_command", "|", "shell_command", "|", "shell_command", "redirection_list", "|", "function_def", "|", "coproc" ]
python
train
36
singularityhub/singularity-python
singularity/analysis/utils.py
https://github.com/singularityhub/singularity-python/blob/498c3433724b332f7493fec632d8daf479f47b82/singularity/analysis/utils.py#L50-L60
def update_dict(input_dict,key,value): '''update_dict will update lists in a dictionary. If the key is not included, if will add as new list. If it is, it will append. :param input_dict: the dict to update :param value: the value to update with ''' if key in input_dict: input_dict[key].a...
[ "def", "update_dict", "(", "input_dict", ",", "key", ",", "value", ")", ":", "if", "key", "in", "input_dict", ":", "input_dict", "[", "key", "]", ".", "append", "(", "value", ")", "else", ":", "input_dict", "[", "key", "]", "=", "[", "value", "]", ...
update_dict will update lists in a dictionary. If the key is not included, if will add as new list. If it is, it will append. :param input_dict: the dict to update :param value: the value to update with
[ "update_dict", "will", "update", "lists", "in", "a", "dictionary", ".", "If", "the", "key", "is", "not", "included", "if", "will", "add", "as", "new", "list", ".", "If", "it", "is", "it", "will", "append", ".", ":", "param", "input_dict", ":", "the", ...
python
train
35.272727
gwastro/pycbc
pycbc/workflow/coincidence.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/coincidence.py#L594-L662
def setup_multiifo_interval_coinc_inj(workflow, hdfbank, full_data_trig_files, inj_trig_files, stat_files, background_file, veto_file, veto_name, out_dir, pivot_ifo, fixed_ifo, tags=None): """ This function sets up exact match multiifo ...
[ "def", "setup_multiifo_interval_coinc_inj", "(", "workflow", ",", "hdfbank", ",", "full_data_trig_files", ",", "inj_trig_files", ",", "stat_files", ",", "background_file", ",", "veto_file", ",", "veto_name", ",", "out_dir", ",", "pivot_ifo", ",", "fixed_ifo", ",", "...
This function sets up exact match multiifo coincidence for injections
[ "This", "function", "sets", "up", "exact", "match", "multiifo", "coincidence", "for", "injections" ]
python
train
43.753623
bastibe/SoundFile
soundfile.py
https://github.com/bastibe/SoundFile/blob/161e930da9c9ea76579b6ee18a131e10bca8a605/soundfile.py#L1438-L1459
def _get_format_from_filename(file, mode): """Return a format string obtained from file (or file.name). If file already exists (= read mode), an empty string is returned on error. If not, an exception is raised. The return type will always be str or unicode (even if file/file.name is a bytes objec...
[ "def", "_get_format_from_filename", "(", "file", ",", "mode", ")", ":", "format", "=", "''", "file", "=", "getattr", "(", "file", ",", "'name'", ",", "file", ")", "try", ":", "# This raises an exception if file is not a (Unicode/byte) string:", "format", "=", "_os...
Return a format string obtained from file (or file.name). If file already exists (= read mode), an empty string is returned on error. If not, an exception is raised. The return type will always be str or unicode (even if file/file.name is a bytes object).
[ "Return", "a", "format", "string", "obtained", "from", "file", "(", "or", "file", ".", "name", ")", "." ]
python
train
39.863636
saeschdivara/ArangoPy
arangodb/server/endpoint.py
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/server/endpoint.py#L35-L62
def create(cls, url, databases): """ If databases is an empty list, all databases present in the server will become accessible via the endpoint, with the _system database being the default database. If databases is non-empty, only the specified databases will become availabl...
[ "def", "create", "(", "cls", ",", "url", ",", "databases", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "result", "=", "api", ".", "endpoint", ".", "post", "(", "data", "=", "{", "'endpoint'", ":", "url", ",", "'databases'...
If databases is an empty list, all databases present in the server will become accessible via the endpoint, with the _system database being the default database. If databases is non-empty, only the specified databases will become available via the endpoint. The first database name i...
[ "If", "databases", "is", "an", "empty", "list", "all", "databases", "present", "in", "the", "server", "will", "become", "accessible", "via", "the", "endpoint", "with", "the", "_system", "database", "being", "the", "default", "database", "." ]
python
train
46.214286
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L100-L110
def _post(self, *args, **kwargs): """ A wrapper for posting things. It will also json encode your 'data' parameter :returns: The response of your post :rtype: dict """ if 'data' in kwargs: kwargs['data'] = json.dumps(kwargs['data']) response = request...
[ "def", "_post", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'data'", "in", "kwargs", ":", "kwargs", "[", "'data'", "]", "=", "json", ".", "dumps", "(", "kwargs", "[", "'data'", "]", ")", "response", "=", "requests", "...
A wrapper for posting things. It will also json encode your 'data' parameter :returns: The response of your post :rtype: dict
[ "A", "wrapper", "for", "posting", "things", ".", "It", "will", "also", "json", "encode", "your", "data", "parameter" ]
python
train
33.545455
kamikaze/webdav
src/webdav/client.py
https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L625-L639
def is_dir(self, remote_path): """Checks is the remote resource directory. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :param remote_path: the path to remote resource. :return: True in case the remote resource is directory and False otherwi...
[ "def", "is_dir", "(", "self", ",", "remote_path", ")", ":", "urn", "=", "Urn", "(", "remote_path", ")", "parent_urn", "=", "Urn", "(", "urn", ".", "parent", "(", ")", ")", "if", "not", "self", ".", "check", "(", "urn", ".", "path", "(", ")", ")",...
Checks is the remote resource directory. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :param remote_path: the path to remote resource. :return: True in case the remote resource is directory and False otherwise.
[ "Checks", "is", "the", "remote", "resource", "directory", ".", "More", "information", "you", "can", "find", "by", "link", "http", ":", "//", "webdav", ".", "org", "/", "specs", "/", "rfc4918", ".", "html#METHOD_PROPFIND" ]
python
train
52.266667
HewlettPackard/python-hpOneView
hpOneView/oneview_client.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L352-L361
def fcoe_networks(self): """ Gets the FcoeNetworks API client. Returns: FcoeNetworks: """ if not self.__fcoe_networks: self.__fcoe_networks = FcoeNetworks(self.__connection) return self.__fcoe_networks
[ "def", "fcoe_networks", "(", "self", ")", ":", "if", "not", "self", ".", "__fcoe_networks", ":", "self", ".", "__fcoe_networks", "=", "FcoeNetworks", "(", "self", ".", "__connection", ")", "return", "self", ".", "__fcoe_networks" ]
Gets the FcoeNetworks API client. Returns: FcoeNetworks:
[ "Gets", "the", "FcoeNetworks", "API", "client", "." ]
python
train
26.5
Basic-Components/msgpack-rpc-protocol
python/pymprpc/server/server.py
https://github.com/Basic-Components/msgpack-rpc-protocol/blob/7983ace5d5cfd7214df6803f9b1de458df5fe3b1/python/pymprpc/server/server.py#L309-L321
def register_instance(self, instance: Any, allow_dotted_names: bool=False): """注册一个实例用于执行,注意只能注册一个. Parameters: instance (Any): - 将一个类的实例注册到rpc allow_dotted_names (bool): 是否允许带`.`号的名字 """ if self.instance: raise RuntimeError("can only register one in...
[ "def", "register_instance", "(", "self", ",", "instance", ":", "Any", ",", "allow_dotted_names", ":", "bool", "=", "False", ")", ":", "if", "self", ".", "instance", ":", "raise", "RuntimeError", "(", "\"can only register one instance\"", ")", "self", ".", "ins...
注册一个实例用于执行,注意只能注册一个. Parameters: instance (Any): - 将一个类的实例注册到rpc allow_dotted_names (bool): 是否允许带`.`号的名字
[ "注册一个实例用于执行", "注意只能注册一个", "." ]
python
train
32.461538
spookey/photon
photon/tools/git.py
https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/tools/git.py#L247-L257
def tag(self, tag): ''' .. seealso:: :attr:`tag` ''' t = self.tag if t: if not tag: tag = t[-1] if tag in t: self._checkout(treeish=tag)
[ "def", "tag", "(", "self", ",", "tag", ")", ":", "t", "=", "self", ".", "tag", "if", "t", ":", "if", "not", "tag", ":", "tag", "=", "t", "[", "-", "1", "]", "if", "tag", "in", "t", ":", "self", ".", "_checkout", "(", "treeish", "=", "tag", ...
.. seealso:: :attr:`tag`
[ "..", "seealso", "::", ":", "attr", ":", "tag" ]
python
train
20.272727
intiocean/pyinter
pyinter/interval.py
https://github.com/intiocean/pyinter/blob/fb6e904307477fa43123cc9ab326680aa1a8cd62/pyinter/interval.py#L101-L103
def copy(self): """Returns a new :class:`~pyinter.Interval` object with the same bounds and values.""" return Interval(self._lower, self._lower_value, self._upper_value, self._upper)
[ "def", "copy", "(", "self", ")", ":", "return", "Interval", "(", "self", ".", "_lower", ",", "self", ".", "_lower_value", ",", "self", ".", "_upper_value", ",", "self", ".", "_upper", ")" ]
Returns a new :class:`~pyinter.Interval` object with the same bounds and values.
[ "Returns", "a", "new", ":", "class", ":", "~pyinter", ".", "Interval", "object", "with", "the", "same", "bounds", "and", "values", "." ]
python
train
65.333333
baruwa-enterprise/BaruwaAPI
BaruwaAPI/resource.py
https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L416-L420
def create_relay(self, orgid, data): """Create relay settings""" return self.api_call( ENDPOINTS['relays']['new'], dict(orgid=orgid), body=data)
[ "def", "create_relay", "(", "self", ",", "orgid", ",", "data", ")", ":", "return", "self", ".", "api_call", "(", "ENDPOINTS", "[", "'relays'", "]", "[", "'new'", "]", ",", "dict", "(", "orgid", "=", "orgid", ")", ",", "body", "=", "data", ")" ]
Create relay settings
[ "Create", "relay", "settings" ]
python
train
36
bloomberg/bqplot
bqplot/pyplot.py
https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L407-L424
def _set_label(label, mark, dim, **kwargs): """Helper function to set labels for an axis """ if mark is None: mark = _context['last_mark'] if mark is None: return {} fig = kwargs.get('figure', current_figure()) scales = mark.scales scale_metadata = mark.scales_metadata.get(di...
[ "def", "_set_label", "(", "label", ",", "mark", ",", "dim", ",", "*", "*", "kwargs", ")", ":", "if", "mark", "is", "None", ":", "mark", "=", "_context", "[", "'last_mark'", "]", "if", "mark", "is", "None", ":", "return", "{", "}", "fig", "=", "kw...
Helper function to set labels for an axis
[ "Helper", "function", "to", "set", "labels", "for", "an", "axis" ]
python
train
31.611111
apache/incubator-heron
heron/tools/tracker/src/python/tracker.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L188-L242
def addNewTopology(self, state_manager, topologyName): """ Adds a topology in the local cache, and sets a watch on any changes on the topology. """ topology = Topology(topologyName, state_manager.name) Log.info("Adding new topology: %s, state_manager: %s", topologyName, state_manage...
[ "def", "addNewTopology", "(", "self", ",", "state_manager", ",", "topologyName", ")", ":", "topology", "=", "Topology", "(", "topologyName", ",", "state_manager", ".", "name", ")", "Log", ".", "info", "(", "\"Adding new topology: %s, state_manager: %s\"", ",", "to...
Adds a topology in the local cache, and sets a watch on any changes on the topology.
[ "Adds", "a", "topology", "in", "the", "local", "cache", "and", "sets", "a", "watch", "on", "any", "changes", "on", "the", "topology", "." ]
python
valid
38.636364
tanghaibao/jcvi
jcvi/annotation/automaton.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/annotation/automaton.py#L100-L148
def star(args): """ %prog star folder reference Run star on a folder with reads. """ p = OptionParser(star.__doc__) p.add_option("--single", default=False, action="store_true", help="Single end mapping") p.set_fastq_names() p.set_cpus() opts, args = p.parse_args(arg...
[ "def", "star", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "star", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--single\"", ",", "default", "=", "False", ",", "action", "=", "\"store_true\"", ",", "help", "=", "\"Single end mapping\"", ...
%prog star folder reference Run star on a folder with reads.
[ "%prog", "star", "folder", "reference" ]
python
train
30.571429
ejeschke/ginga
ginga/trcalc.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/trcalc.py#L925-L944
def make_filled_array(shp, dtype, order, r, g, b, a): """Return a filled array with a color value. order defines the color planes in the array. (r, g, b, a) are expected to be in the range 0..1 and are scaled to the appropriate values. shp can define a 2D or 3D array. """ # TODO: can we make t...
[ "def", "make_filled_array", "(", "shp", ",", "dtype", ",", "order", ",", "r", ",", "g", ",", "b", ",", "a", ")", ":", "# TODO: can we make this more efficient?", "maxv", "=", "np", ".", "iinfo", "(", "dtype", ")", ".", "max", "bgval", "=", "dict", "(",...
Return a filled array with a color value. order defines the color planes in the array. (r, g, b, a) are expected to be in the range 0..1 and are scaled to the appropriate values. shp can define a 2D or 3D array.
[ "Return", "a", "filled", "array", "with", "a", "color", "value", ".", "order", "defines", "the", "color", "planes", "in", "the", "array", ".", "(", "r", "g", "b", "a", ")", "are", "expected", "to", "be", "in", "the", "range", "0", "..", "1", "and",...
python
train
42.95
hydpy-dev/hydpy
hydpy/core/parametertools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/parametertools.py#L1037-L1093
def get_timefactor(cls) -> float: """Factor to adjust a new value of a time-dependent parameter. For a time-dependent parameter, its effective value depends on the simulation step size. Method |Parameter.get_timefactor| returns the fraction between the current simulation step size and ...
[ "def", "get_timefactor", "(", "cls", ")", "->", "float", ":", "try", ":", "parfactor", "=", "hydpy", ".", "pub", ".", "timegrids", ".", "parfactor", "except", "RuntimeError", ":", "if", "not", "(", "cls", ".", "parameterstep", "and", "cls", ".", "simulat...
Factor to adjust a new value of a time-dependent parameter. For a time-dependent parameter, its effective value depends on the simulation step size. Method |Parameter.get_timefactor| returns the fraction between the current simulation step size and the current parameter step size. ...
[ "Factor", "to", "adjust", "a", "new", "value", "of", "a", "time", "-", "dependent", "parameter", "." ]
python
train
39.263158
maykinmedia/django-admin-index
django_admin_index/compat/django18.py
https://github.com/maykinmedia/django-admin-index/blob/5bfd90e6945775865d722e0f5058824769f68f04/django_admin_index/compat/django18.py#L13-L76
def _build_app_dict(site, request, label=None): """ Builds the app dictionary. Takes an optional label parameters to filter models of a specific app. """ app_dict = {} if label: models = { m: m_a for m, m_a in site._registry.items() if m._meta.app_label == label ...
[ "def", "_build_app_dict", "(", "site", ",", "request", ",", "label", "=", "None", ")", ":", "app_dict", "=", "{", "}", "if", "label", ":", "models", "=", "{", "m", ":", "m_a", "for", "m", ",", "m_a", "in", "site", ".", "_registry", ".", "items", ...
Builds the app dictionary. Takes an optional label parameters to filter models of a specific app.
[ "Builds", "the", "app", "dictionary", ".", "Takes", "an", "optional", "label", "parameters", "to", "filter", "models", "of", "a", "specific", "app", "." ]
python
train
31.359375
Kortemme-Lab/klab
klab/bio/fragments/generate_fragments.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/fragments/generate_fragments.py#L723-L731
def reformat(found_sequences): '''Truncate the FASTA headers so that the first field is a 4-character ID.''' for (pdb_id, chain, file_name), sequence in sorted(found_sequences.iteritems()): header = sequence[0] assert(header[0] == '>') tokens = header.split('|') tokens[0] = token...
[ "def", "reformat", "(", "found_sequences", ")", ":", "for", "(", "pdb_id", ",", "chain", ",", "file_name", ")", ",", "sequence", "in", "sorted", "(", "found_sequences", ".", "iteritems", "(", ")", ")", ":", "header", "=", "sequence", "[", "0", "]", "as...
Truncate the FASTA headers so that the first field is a 4-character ID.
[ "Truncate", "the", "FASTA", "headers", "so", "that", "the", "first", "field", "is", "a", "4", "-", "character", "ID", "." ]
python
train
43.888889
daviddrysdale/python-phonenumbers
python/phonenumbers/phonenumbermatcher.py
https://github.com/daviddrysdale/python-phonenumbers/blob/9cc5bb4ab5e661e70789b4c64bf7a9383c7bdc20/python/phonenumbers/phonenumbermatcher.py#L209-L224
def _verify(leniency, numobj, candidate, matcher): """Returns True if number is a verified number according to the leniency.""" if leniency == Leniency.POSSIBLE: return is_possible_number(numobj) elif leniency == Leniency.VALID: if (not is_valid_number(numobj) or not _contain...
[ "def", "_verify", "(", "leniency", ",", "numobj", ",", "candidate", ",", "matcher", ")", ":", "if", "leniency", "==", "Leniency", ".", "POSSIBLE", ":", "return", "is_possible_number", "(", "numobj", ")", "elif", "leniency", "==", "Leniency", ".", "VALID", ...
Returns True if number is a verified number according to the leniency.
[ "Returns", "True", "if", "number", "is", "a", "verified", "number", "according", "to", "the", "leniency", "." ]
python
train
46.5625
inasafe/inasafe
safe/utilities/default_values.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/default_values.py#L14-L33
def set_inasafe_default_value_qsetting( qsetting, category, inasafe_field_key, value): """Helper method to set inasafe default value to qsetting. :param qsetting: QSettings. :type qsetting: QSettings :param category: Category of the default value. It can be global or recent. Global mea...
[ "def", "set_inasafe_default_value_qsetting", "(", "qsetting", ",", "category", ",", "inasafe_field_key", ",", "value", ")", ":", "key", "=", "'inasafe/default_value/%s/%s'", "%", "(", "category", ",", "inasafe_field_key", ")", "qsetting", ".", "setValue", "(", "key"...
Helper method to set inasafe default value to qsetting. :param qsetting: QSettings. :type qsetting: QSettings :param category: Category of the default value. It can be global or recent. Global means the global setting for default value. Recent means the last set custom for default value fr...
[ "Helper", "method", "to", "set", "inasafe", "default", "value", "to", "qsetting", "." ]
python
train
35.95
globality-corp/microcosm-flask
microcosm_flask/decorators/logging.py
https://github.com/globality-corp/microcosm-flask/blob/c2eaf57f03e7d041eea343751a4a90fcc80df418/microcosm_flask/decorators/logging.py#L31-L49
def show_as(**mappings): """ Show a set of request and/or response fields in logs using a different key. Example: @show_as(id="foo_id") def create_foo(): return Foo(id=uuid4()) """ def decorator(func): @wraps(func) def wrapper(*args, **kwargs): ...
[ "def", "show_as", "(", "*", "*", "mappings", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "g", ".", "show_request_fields", "=", "mappings...
Show a set of request and/or response fields in logs using a different key. Example: @show_as(id="foo_id") def create_foo(): return Foo(id=uuid4())
[ "Show", "a", "set", "of", "request", "and", "/", "or", "response", "fields", "in", "logs", "using", "a", "different", "key", "." ]
python
train
24.684211
push-things/django-th
th_wallabag/my_wallabag.py
https://github.com/push-things/django-th/blob/86c999d16bcf30b6224206e5b40824309834ac8c/th_wallabag/my_wallabag.py#L164-L189
def save_data(self, trigger_id, **data): """ let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of the sa...
[ "def", "save_data", "(", "self", ",", "trigger_id", ",", "*", "*", "data", ")", ":", "self", ".", "trigger_id", "=", "trigger_id", "trigger", "=", "Wallabag", ".", "objects", ".", "get", "(", "trigger_id", "=", "trigger_id", ")", "title", "=", "self", ...
let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of the save statement :rtype: boolean
[ "let", "s", "save", "the", "data" ]
python
train
32.769231
DataKitchen/DKCloudCommand
DKCloudCommand/modules/DKCloudAPI.py
https://github.com/DataKitchen/DKCloudCommand/blob/1cf9cb08ab02f063eef6b5c4b327af142991daa3/DKCloudCommand/modules/DKCloudAPI.py#L1021-L1057
def orderrun_detail(self, kitchen, pdict, return_all_data=False): """ api.add_resource(OrderDetailsV2, '/v2/order/details/<string:kitchenname>', methods=['POST']) :param self: DKCloudAPI :param kitchen: string :param pdict: dict :param return_all_data: boolean :rt...
[ "def", "orderrun_detail", "(", "self", ",", "kitchen", ",", "pdict", ",", "return_all_data", "=", "False", ")", ":", "rc", "=", "DKReturnCode", "(", ")", "if", "kitchen", "is", "None", "or", "isinstance", "(", "kitchen", ",", "basestring", ")", "is", "Fa...
api.add_resource(OrderDetailsV2, '/v2/order/details/<string:kitchenname>', methods=['POST']) :param self: DKCloudAPI :param kitchen: string :param pdict: dict :param return_all_data: boolean :rtype: DKReturnCode
[ "api", ".", "add_resource", "(", "OrderDetailsV2", "/", "v2", "/", "order", "/", "details", "/", "<string", ":", "kitchenname", ">", "methods", "=", "[", "POST", "]", ")", ":", "param", "self", ":", "DKCloudAPI", ":", "param", "kitchen", ":", "string", ...
python
train
39.648649
mordred-descriptor/mordred
mordred/_base/result.py
https://github.com/mordred-descriptor/mordred/blob/2848b088fd7b6735590242b5e22573babc724f10/mordred/_base/result.py#L33-L47
def fill_missing(self, value=np.nan): r"""Replace missing value to "value". Parameters: value: value that missing value is replaced Returns: Result """ return self.__class__( self.mol, [(value if is_missing(v) else v) for v in se...
[ "def", "fill_missing", "(", "self", ",", "value", "=", "np", ".", "nan", ")", ":", "return", "self", ".", "__class__", "(", "self", ".", "mol", ",", "[", "(", "value", "if", "is_missing", "(", "v", ")", "else", "v", ")", "for", "v", "in", "self",...
r"""Replace missing value to "value". Parameters: value: value that missing value is replaced Returns: Result
[ "r", "Replace", "missing", "value", "to", "value", "." ]
python
test
23.6
tensorflow/datasets
tensorflow_datasets/translate/wmt.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/translate/wmt.py#L615-L630
def subsets(self): """Subsets that make up each split of the dataset for the language pair.""" source, target = self.builder_config.language_pair filtered_subsets = {} for split, ss_names in self._subsets.items(): filtered_subsets[split] = [] for ss_name in ss_names: ds = DATASET_MAP...
[ "def", "subsets", "(", "self", ")", ":", "source", ",", "target", "=", "self", ".", "builder_config", ".", "language_pair", "filtered_subsets", "=", "{", "}", "for", "split", ",", "ss_names", "in", "self", ".", "_subsets", ".", "items", "(", ")", ":", ...
Subsets that make up each split of the dataset for the language pair.
[ "Subsets", "that", "make", "up", "each", "split", "of", "the", "dataset", "for", "the", "language", "pair", "." ]
python
train
40.75
pymc-devs/pymc
pymc/StepMethods.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/StepMethods.py#L657-L667
def competence(s): """ The competence function for MatrixMetropolis """ # MatrixMetropolis handles the Wishart family, which are valued as # _symmetric_ matrices. if any([isinstance(s, cls) for cls in [distributions.Wishart, distributions.WishartCov]]): ...
[ "def", "competence", "(", "s", ")", ":", "# MatrixMetropolis handles the Wishart family, which are valued as", "# _symmetric_ matrices.", "if", "any", "(", "[", "isinstance", "(", "s", ",", "cls", ")", "for", "cls", "in", "[", "distributions", ".", "Wishart", ",", ...
The competence function for MatrixMetropolis
[ "The", "competence", "function", "for", "MatrixMetropolis" ]
python
train
33
underworldcode/stripy
litho1pt0-src/litho1pt0/__init__.py
https://github.com/underworldcode/stripy/blob/d4c3480c3e58c88489ded695eadbe7cd5bf94b48/litho1pt0-src/litho1pt0/__init__.py#L182-L208
def crust_type_at(lat=None, lon=None): """ lat, lon (degrees) """ # Get lon into appropriate format lats = np.array(lat) lons = np.array(lon%360) iVals = ((90.0-lats)%180).astype(np.int) jVals = (lons%360.0).astype(int) # i = int((-lat+90.0)%180) # j = int(lon) t = _c1_cr...
[ "def", "crust_type_at", "(", "lat", "=", "None", ",", "lon", "=", "None", ")", ":", "# Get lon into appropriate format", "lats", "=", "np", ".", "array", "(", "lat", ")", "lons", "=", "np", ".", "array", "(", "lon", "%", "360", ")", "iVals", "=", "("...
lat, lon (degrees)
[ "lat", "lon", "(", "degrees", ")" ]
python
train
16.148148
saltstack/salt
salt/runners/queue.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/queue.py#L280-L304
def process_runner(quantity=1, queue=None, backend=None): ''' Process queued runners quantity number of runners to process queue queue to insert the runner reference into backend backend that to use for the queue CLI Example: .. code-block:: bash salt-ru...
[ "def", "process_runner", "(", "quantity", "=", "1", ",", "queue", "=", "None", ",", "backend", "=", "None", ")", ":", "queue_kwargs", "=", "__get_queue_opts", "(", "queue", "=", "queue", ",", "backend", "=", "backend", ")", "data", "=", "process_queue", ...
Process queued runners quantity number of runners to process queue queue to insert the runner reference into backend backend that to use for the queue CLI Example: .. code-block:: bash salt-run queue.process_runner salt-run queue.process_runner 5
[ "Process", "queued", "runners" ]
python
train
23.96
PmagPy/PmagPy
programs/demag_gui.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/demag_gui.py#L1373-L1459
def draw_MM0(self): """ Draws the M/M0 plot in the GUI on canvas3 """ self.fig3.clf() self.fig3.text(0.02, 0.96, 'M/M0', {'family': self.font_type, 'fontsize': 10 * self.GUI_RESOLUTION, 'style': 'normal', 'va': 'center', 'ha': 'left'}) ...
[ "def", "draw_MM0", "(", "self", ")", ":", "self", ".", "fig3", ".", "clf", "(", ")", "self", ".", "fig3", ".", "text", "(", "0.02", ",", "0.96", ",", "'M/M0'", ",", "{", "'family'", ":", "self", ".", "font_type", ",", "'fontsize'", ":", "10", "*"...
Draws the M/M0 plot in the GUI on canvas3
[ "Draws", "the", "M", "/", "M0", "plot", "in", "the", "GUI", "on", "canvas3" ]
python
train
50.16092
trailofbits/manticore
manticore/native/cpu/x86.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1325-L1385
def CMPXCHG8B(cpu, dest): """ Compares and exchanges bytes. Compares the 64-bit value in EDX:EAX (or 128-bit value in RDX:RAX if operand size is 128 bits) with the operand (destination operand). If the values are equal, the 64-bit value in ECX:EBX (or 128-bit value in RC...
[ "def", "CMPXCHG8B", "(", "cpu", ",", "dest", ")", ":", "size", "=", "dest", ".", "size", "cmp_reg_name_l", "=", "{", "64", ":", "'EAX'", ",", "128", ":", "'RAX'", "}", "[", "size", "]", "cmp_reg_name_h", "=", "{", "64", ":", "'EDX'", ",", "128", ...
Compares and exchanges bytes. Compares the 64-bit value in EDX:EAX (or 128-bit value in RDX:RAX if operand size is 128 bits) with the operand (destination operand). If the values are equal, the 64-bit value in ECX:EBX (or 128-bit value in RCX:RBX) is stored in the destination operand. ...
[ "Compares", "and", "exchanges", "bytes", "." ]
python
valid
37.934426
sorgerlab/indra
indra/tools/assemble_corpus.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1100-L1144
def filter_direct(stmts_in, **kwargs): """Filter to statements that are direct interactions Parameters ---------- stmts_in : list[indra.statements.Statement] A list of statements to filter. save : Optional[str] The name of a pickle file to save the results (stmts_out) into. Ret...
[ "def", "filter_direct", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "def", "get_is_direct", "(", "stmt", ")", ":", "\"\"\"Returns true if there is evidence that the statement is a direct\n interaction.\n\n If any of the evidences associated with the statement\n ...
Filter to statements that are direct interactions Parameters ---------- stmts_in : list[indra.statements.Statement] A list of statements to filter. save : Optional[str] The name of a pickle file to save the results (stmts_out) into. Returns ------- stmts_out : list[indra.st...
[ "Filter", "to", "statements", "that", "are", "direct", "interactions" ]
python
train
34.777778