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/monasca-common
monasca_common/kafka_lib/protocol.py
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/kafka_lib/protocol.py#L197-L235
def encode_produce_request(cls, client_id, correlation_id, payloads=None, acks=1, timeout=1000): """ Encode some ProduceRequest structs Arguments: client_id: string correlation_id: int payloads: list of ProduceRequest ...
[ "def", "encode_produce_request", "(", "cls", ",", "client_id", ",", "correlation_id", ",", "payloads", "=", "None", ",", "acks", "=", "1", ",", "timeout", "=", "1000", ")", ":", "payloads", "=", "[", "]", "if", "payloads", "is", "None", "else", "payloads...
Encode some ProduceRequest structs Arguments: client_id: string correlation_id: int payloads: list of ProduceRequest acks: How "acky" you want the request to be 0: immediate response 1: written to disk by the leader ...
[ "Encode", "some", "ProduceRequest", "structs" ]
python
train
43.128205
jaraco/irc
irc/client.py
https://github.com/jaraco/irc/blob/571c1f448d5d5bb92bbe2605c33148bf6e698413/irc/client.py#L844-L848
def disconnect_all(self, message=""): """Disconnects all connections.""" with self.mutex: for conn in self.connections: conn.disconnect(message)
[ "def", "disconnect_all", "(", "self", ",", "message", "=", "\"\"", ")", ":", "with", "self", ".", "mutex", ":", "for", "conn", "in", "self", ".", "connections", ":", "conn", ".", "disconnect", "(", "message", ")" ]
Disconnects all connections.
[ "Disconnects", "all", "connections", "." ]
python
train
36.8
peerplays-network/python-peerplays
peerplays/cli/account.py
https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/cli/account.py#L187-L190
def changememokey(ctx, key, account): """ Change the memo key of an account """ pprint(ctx.blockchain.update_memo_key(key, account=account))
[ "def", "changememokey", "(", "ctx", ",", "key", ",", "account", ")", ":", "pprint", "(", "ctx", ".", "blockchain", ".", "update_memo_key", "(", "key", ",", "account", "=", "account", ")", ")" ]
Change the memo key of an account
[ "Change", "the", "memo", "key", "of", "an", "account" ]
python
train
37.25
pmacosta/pexdoc
pexdoc/exdoc.py
https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/exdoc.py#L58-L68
def _validate_fname(fname, arg_name): """Validate that a string is a valid file name.""" if fname is not None: msg = "Argument `{0}` is not valid".format(arg_name) if (not isinstance(fname, str)) or (isinstance(fname, str) and ("\0" in fname)): raise RuntimeError(msg) try: ...
[ "def", "_validate_fname", "(", "fname", ",", "arg_name", ")", ":", "if", "fname", "is", "not", "None", ":", "msg", "=", "\"Argument `{0}` is not valid\"", ".", "format", "(", "arg_name", ")", "if", "(", "not", "isinstance", "(", "fname", ",", "str", ")", ...
Validate that a string is a valid file name.
[ "Validate", "that", "a", "string", "is", "a", "valid", "file", "name", "." ]
python
train
44.272727
dgraph-io/pydgraph
pydgraph/client_stub.py
https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client_stub.py#L48-L51
def query(self, req, timeout=None, metadata=None, credentials=None): """Runs query operation.""" return self.stub.Query(req, timeout=timeout, metadata=metadata, credentials=credentials)
[ "def", "query", "(", "self", ",", "req", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ",", "credentials", "=", "None", ")", ":", "return", "self", ".", "stub", ".", "Query", "(", "req", ",", "timeout", "=", "timeout", ",", "metadata", ...
Runs query operation.
[ "Runs", "query", "operation", "." ]
python
train
57.25
autokey/autokey
lib/autokey/qtui/common.py
https://github.com/autokey/autokey/blob/35decb72f286ce68cd2a1f09ace8891a520b58d1/lib/autokey/qtui/common.py#L138-L149
def load_ui_from_file(name: str): """ Returns a tuple from uic.loadUiType(), loading the ui file with the given name. :param name: :return: """ ui_file = _get_ui_qfile(name) try: base_type = uic.loadUiType(ui_file, from_imports=True) finally: ui_file.close() return ba...
[ "def", "load_ui_from_file", "(", "name", ":", "str", ")", ":", "ui_file", "=", "_get_ui_qfile", "(", "name", ")", "try", ":", "base_type", "=", "uic", ".", "loadUiType", "(", "ui_file", ",", "from_imports", "=", "True", ")", "finally", ":", "ui_file", "....
Returns a tuple from uic.loadUiType(), loading the ui file with the given name. :param name: :return:
[ "Returns", "a", "tuple", "from", "uic", ".", "loadUiType", "()", "loading", "the", "ui", "file", "with", "the", "given", "name", ".", ":", "param", "name", ":", ":", "return", ":" ]
python
train
26.333333
PMEAL/OpenPNM
openpnm/algorithms/ReactiveTransport.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/algorithms/ReactiveTransport.py#L122-L147
def set_source(self, propname, pores): r""" Applies a given source term to the specified pores Parameters ---------- propname : string The property name of the source term model to be applied pores : array_like The pore indices where the source t...
[ "def", "set_source", "(", "self", ",", "propname", ",", "pores", ")", ":", "locs", "=", "self", ".", "tomask", "(", "pores", "=", "pores", ")", "if", "(", "not", "np", ".", "all", "(", "np", ".", "isnan", "(", "self", "[", "'pore.bc_value'", "]", ...
r""" Applies a given source term to the specified pores Parameters ---------- propname : string The property name of the source term model to be applied pores : array_like The pore indices where the source term should be applied Notes --...
[ "r", "Applies", "a", "given", "source", "term", "to", "the", "specified", "pores" ]
python
train
35.692308
spyder-ide/spyder
spyder/app/mainwindow.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2127-L2141
def get_focus_widget_properties(self): """Get properties of focus widget Returns tuple (widget, properties) where properties is a tuple of booleans: (is_console, not_readonly, readwrite_editor)""" from spyder.plugins.editor.widgets.editor import TextEditBaseWidget from spyde...
[ "def", "get_focus_widget_properties", "(", "self", ")", ":", "from", "spyder", ".", "plugins", ".", "editor", ".", "widgets", ".", "editor", "import", "TextEditBaseWidget", "from", "spyder", ".", "plugins", ".", "ipythonconsole", ".", "widgets", "import", "Contr...
Get properties of focus widget Returns tuple (widget, properties) where properties is a tuple of booleans: (is_console, not_readonly, readwrite_editor)
[ "Get", "properties", "of", "focus", "widget", "Returns", "tuple", "(", "widget", "properties", ")", "where", "properties", "is", "a", "tuple", "of", "booleans", ":", "(", "is_console", "not_readonly", "readwrite_editor", ")" ]
python
train
53.466667
bitshares/uptick
uptick/markets.py
https://github.com/bitshares/uptick/blob/66c102200fdbf96cef4fd55cc69d00e690f62001/uptick/markets.py#L379-L382
def settle(ctx, symbol, amount, account): """ Fund the fee pool of an asset """ print_tx(ctx.bitshares.asset_settle(Amount(amount, symbol), account=account))
[ "def", "settle", "(", "ctx", ",", "symbol", ",", "amount", ",", "account", ")", ":", "print_tx", "(", "ctx", ".", "bitshares", ".", "asset_settle", "(", "Amount", "(", "amount", ",", "symbol", ")", ",", "account", "=", "account", ")", ")" ]
Fund the fee pool of an asset
[ "Fund", "the", "fee", "pool", "of", "an", "asset" ]
python
train
41.5
peterbrittain/asciimatics
asciimatics/widgets.py
https://github.com/peterbrittain/asciimatics/blob/f471427d7786ce2d5f1eeb2dae0e67d19e46e085/asciimatics/widgets.py#L1455-L1462
def register_frame(self, frame): """ Register the Frame that owns this Widget. :param frame: The owning Frame. """ self._frame = frame self.string_len = wcswidth if self._frame.canvas.unicode_aware else len
[ "def", "register_frame", "(", "self", ",", "frame", ")", ":", "self", ".", "_frame", "=", "frame", "self", ".", "string_len", "=", "wcswidth", "if", "self", ".", "_frame", ".", "canvas", ".", "unicode_aware", "else", "len" ]
Register the Frame that owns this Widget. :param frame: The owning Frame.
[ "Register", "the", "Frame", "that", "owns", "this", "Widget", "." ]
python
train
31
Toilal/rebulk
rebulk/rebulk.py
https://github.com/Toilal/rebulk/blob/7511a4671f2fd9493e3df1e5177b7656789069e8/rebulk/rebulk.py#L272-L290
def matches(self, string, context=None): """ Search for all matches with current configuration against input_string :param string: string to search into :type string: str :param context: context to use :type context: dict :return: A custom list of matches ...
[ "def", "matches", "(", "self", ",", "string", ",", "context", "=", "None", ")", ":", "matches", "=", "Matches", "(", "input_string", "=", "string", ")", "if", "context", "is", "None", ":", "context", "=", "{", "}", "self", ".", "_matches_patterns", "("...
Search for all matches with current configuration against input_string :param string: string to search into :type string: str :param context: context to use :type context: dict :return: A custom list of matches :rtype: Matches
[ "Search", "for", "all", "matches", "with", "current", "configuration", "against", "input_string", ":", "param", "string", ":", "string", "to", "search", "into", ":", "type", "string", ":", "str", ":", "param", "context", ":", "context", "to", "use", ":", "...
python
train
28.947368
SmokinCaterpillar/pypet
examples/example_24_large_scale_brian2_simulation/clusternet.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L197-L240
def _build_model(self, traj, brian_list, network_dict): """Builds the neuron groups from `traj`. Adds the neuron groups to `brian_list` and `network_dict`. """ model = traj.parameters.model # Create the equations for both models eqs_dict = self._build_model_eqs(traj) ...
[ "def", "_build_model", "(", "self", ",", "traj", ",", "brian_list", ",", "network_dict", ")", ":", "model", "=", "traj", ".", "parameters", ".", "model", "# Create the equations for both models", "eqs_dict", "=", "self", ".", "_build_model_eqs", "(", "traj", ")"...
Builds the neuron groups from `traj`. Adds the neuron groups to `brian_list` and `network_dict`.
[ "Builds", "the", "neuron", "groups", "from", "traj", "." ]
python
test
35.818182
cds-astro/mocpy
mocpy/tmoc/tmoc.py
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/tmoc/tmoc.py#L302-L350
def contains(self, times, keep_inside=True, delta_t=DEFAULT_OBSERVATION_TIME): """ Get a mask array (e.g. a numpy boolean array) of times being inside (or outside) the TMOC instance. Parameters ---------- times : `astropy.time.Time` astropy times to check whe...
[ "def", "contains", "(", "self", ",", "times", ",", "keep_inside", "=", "True", ",", "delta_t", "=", "DEFAULT_OBSERVATION_TIME", ")", ":", "# the requested order for filtering the astropy observations table is more precise than the order", "# of the TimeMoc object", "current_max_o...
Get a mask array (e.g. a numpy boolean array) of times being inside (or outside) the TMOC instance. Parameters ---------- times : `astropy.time.Time` astropy times to check whether they are contained in the TMOC or not. keep_inside : bool, optional True b...
[ "Get", "a", "mask", "array", "(", "e", ".", "g", ".", "a", "numpy", "boolean", "array", ")", "of", "times", "being", "inside", "(", "or", "outside", ")", "the", "TMOC", "instance", "." ]
python
train
46.265306
klahnakoski/pyLibrary
jx_python/jx.py
https://github.com/klahnakoski/pyLibrary/blob/fa2dcbc48fda8d26999baef400e9a98149e0b982/jx_python/jx.py#L206-L238
def tuple(data, field_name): """ RETURN LIST OF TUPLES """ if isinstance(data, Cube): Log.error("not supported yet") if isinstance(data, FlatList): Log.error("not supported yet") if is_data(field_name) and "value" in field_name: # SIMPLIFY {"value":value} AS STRING ...
[ "def", "tuple", "(", "data", ",", "field_name", ")", ":", "if", "isinstance", "(", "data", ",", "Cube", ")", ":", "Log", ".", "error", "(", "\"not supported yet\"", ")", "if", "isinstance", "(", "data", ",", "FlatList", ")", ":", "Log", ".", "error", ...
RETURN LIST OF TUPLES
[ "RETURN", "LIST", "OF", "TUPLES" ]
python
train
29.878788
istresearch/scrapy-cluster
utils/scutils/stats_collector.py
https://github.com/istresearch/scrapy-cluster/blob/13aaed2349af5d792d6bcbfcadc5563158aeb599/utils/scutils/stats_collector.py#L329-L340
def _main_loop(self): ''' Main loop for the stats collector ''' while self.active: self.expire() if self.roll and self.is_expired(): self.start_time = self.start_time + self.window self._set_key() self.purge_old() ...
[ "def", "_main_loop", "(", "self", ")", ":", "while", "self", ".", "active", ":", "self", ".", "expire", "(", ")", "if", "self", ".", "roll", "and", "self", ".", "is_expired", "(", ")", ":", "self", ".", "start_time", "=", "self", ".", "start_time", ...
Main loop for the stats collector
[ "Main", "loop", "for", "the", "stats", "collector" ]
python
train
30.583333
ming060/robotframework-uiautomatorlibrary
uiautomatorlibrary/Mobile.py
https://github.com/ming060/robotframework-uiautomatorlibrary/blob/b70202b6a8aa68b4efd9d029c2845407fb33451a/uiautomatorlibrary/Mobile.py#L390-L396
def fling_forward_horizontally(self, *args, **selectors): """ Perform fling forward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be fling or not. """ return self.device(**selectors).fling.horiz.forward()
[ "def", "fling_forward_horizontally", "(", "self", ",", "*", "args", ",", "*", "*", "selectors", ")", ":", "return", "self", ".", "device", "(", "*", "*", "selectors", ")", ".", "fling", ".", "horiz", ".", "forward", "(", ")" ]
Perform fling forward (horizontally)action on the object which has *selectors* attributes. Return whether the object can be fling or not.
[ "Perform", "fling", "forward", "(", "horizontally", ")", "action", "on", "the", "object", "which", "has", "*", "selectors", "*", "attributes", "." ]
python
train
41.714286
theislab/scvelo
scvelo/datasets.py
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/datasets.py#L68-L80
def forebrain(): """Developing human forebrain. Forebrain tissue of a week 10 embryo, focusing on the glutamatergic neuronal lineage. Returns ------- Returns `adata` object """ filename = 'data/ForebrainGlut/hgForebrainGlut.loom' url = 'http://pklab.med.harvard.edu/velocyto/hgForebrainG...
[ "def", "forebrain", "(", ")", ":", "filename", "=", "'data/ForebrainGlut/hgForebrainGlut.loom'", "url", "=", "'http://pklab.med.harvard.edu/velocyto/hgForebrainGlut/hgForebrainGlut.loom'", "adata", "=", "read", "(", "filename", ",", "backup_url", "=", "url", ",", "cleanup",...
Developing human forebrain. Forebrain tissue of a week 10 embryo, focusing on the glutamatergic neuronal lineage. Returns ------- Returns `adata` object
[ "Developing", "human", "forebrain", ".", "Forebrain", "tissue", "of", "a", "week", "10", "embryo", "focusing", "on", "the", "glutamatergic", "neuronal", "lineage", "." ]
python
train
35.846154
saltstack/salt
salt/spm/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L1015-L1077
def _build(self, args): ''' Build a package ''' if len(args) < 2: raise SPMInvocationError('A path to a formula must be specified') self.abspath = args[1].rstrip('/') comps = self.abspath.split('/') self.relpath = comps[-1] formula_path = '{0...
[ "def", "_build", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "2", ":", "raise", "SPMInvocationError", "(", "'A path to a formula must be specified'", ")", "self", ".", "abspath", "=", "args", "[", "1", "]", ".", "rstrip", "(",...
Build a package
[ "Build", "a", "package" ]
python
train
42.952381
hardbyte/python-can
can/interfaces/ixxat/canlib.py
https://github.com/hardbyte/python-can/blob/cdc5254d96072df7739263623f3e920628a7d214/can/interfaces/ixxat/canlib.py#L557-L566
def start(self): """Start transmitting message (add to list if needed).""" if self._index is None: self._index = ctypes.c_uint32() _canlib.canSchedulerAddMessage(self._scheduler, self._msg, self...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "_index", "is", "None", ":", "self", ".", "_index", "=", "ctypes", ".", "c_uint32", "(", ")", "_canlib", ".", "canSchedulerAddMessage", "(", "self", ".", "_scheduler", ",", "self", ".", "_msg", ...
Start transmitting message (add to list if needed).
[ "Start", "transmitting", "message", "(", "add", "to", "list", "if", "needed", ")", "." ]
python
train
48.5
agoragames/leaderboard-python
leaderboard/leaderboard.py
https://github.com/agoragames/leaderboard-python/blob/ec309859b197a751ac0322374b36d134d8c5522f/leaderboard/leaderboard.py#L608-L616
def page_for(self, member, page_size=DEFAULT_PAGE_SIZE): ''' Determine the page where a member falls in the leaderboard. @param member [String] Member name. @param page_size [int] Page size to be used in determining page location. @return the page where a member falls in the lea...
[ "def", "page_for", "(", "self", ",", "member", ",", "page_size", "=", "DEFAULT_PAGE_SIZE", ")", ":", "return", "self", ".", "page_for_in", "(", "self", ".", "leaderboard_name", ",", "member", ",", "page_size", ")" ]
Determine the page where a member falls in the leaderboard. @param member [String] Member name. @param page_size [int] Page size to be used in determining page location. @return the page where a member falls in the leaderboard.
[ "Determine", "the", "page", "where", "a", "member", "falls", "in", "the", "leaderboard", "." ]
python
train
45.222222
quantumlib/Cirq
cirq/protocols/decompose.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/protocols/decompose.py#L155-L270
def decompose( val: TValue, *, intercepting_decomposer: Callable[['cirq.Operation'], Union[None, NotImplementedType, 'cirq.OP_TREE']] = None, fallback_decomposer: Callable[['cirq...
[ "def", "decompose", "(", "val", ":", "TValue", ",", "*", ",", "intercepting_decomposer", ":", "Callable", "[", "[", "'cirq.Operation'", "]", ",", "Union", "[", "None", ",", "NotImplementedType", ",", "'cirq.OP_TREE'", "]", "]", "=", "None", ",", "fallback_de...
Recursively decomposes a value into `cirq.Operation`s meeting a criteria. Args: val: The value to decompose into operations. intercepting_decomposer: An optional method that is called before the default decomposer (the value's `_decompose_` method). If `intercepting_decompos...
[ "Recursively", "decomposes", "a", "value", "into", "cirq", ".", "Operation", "s", "meeting", "a", "criteria", "." ]
python
train
41.887931
droope/droopescan
dscan/plugins/silverstripe.py
https://github.com/droope/droopescan/blob/424c48a0f9d12b4536dbef5a786f0fbd4ce9519a/dscan/plugins/silverstripe.py#L119-L161
def _convert_to_folder(self, packages): """ Silverstripe's page contains a list of composer packages. This function converts those to folder names. These may be different due to installer-name. Implemented exponential backoff in order to prevent packager from ...
[ "def", "_convert_to_folder", "(", "self", ",", "packages", ")", ":", "url", "=", "'http://packagist.org/p/%s.json'", "with", "ThreadPoolExecutor", "(", "max_workers", "=", "12", ")", "as", "executor", ":", "futures", "=", "[", "]", "for", "package", "in", "pac...
Silverstripe's page contains a list of composer packages. This function converts those to folder names. These may be different due to installer-name. Implemented exponential backoff in order to prevent packager from being overly sensitive about the number of requests I w...
[ "Silverstripe", "s", "page", "contains", "a", "list", "of", "composer", "packages", ".", "This", "function", "converts", "those", "to", "folder", "names", ".", "These", "may", "be", "different", "due", "to", "installer", "-", "name", "." ]
python
train
40.255814
SpamScope/mail-parser
mailparser/utils.py
https://github.com/SpamScope/mail-parser/blob/814b56d0b803feab9dea04f054b802ce138097e2/mailparser/utils.py#L204-L241
def msgconvert(email): """ Exec msgconvert tool, to convert msg Outlook mail in eml mail format Args: email (string): file path of Outlook msg mail Returns: tuple with file path of mail converted and standard output data (unicode Python 2, str Python 3) """ log.debu...
[ "def", "msgconvert", "(", "email", ")", ":", "log", ".", "debug", "(", "\"Started converting Outlook email\"", ")", "temph", ",", "temp", "=", "tempfile", ".", "mkstemp", "(", "prefix", "=", "\"outlook_\"", ")", "command", "=", "[", "\"msgconvert\"", ",", "\...
Exec msgconvert tool, to convert msg Outlook mail in eml mail format Args: email (string): file path of Outlook msg mail Returns: tuple with file path of mail converted and standard output data (unicode Python 2, str Python 3)
[ "Exec", "msgconvert", "tool", "to", "convert", "msg", "Outlook", "mail", "in", "eml", "mail", "format" ]
python
train
30.289474
onnx/onnx-mxnet
onnx_mxnet/import_onnx.py
https://github.com/onnx/onnx-mxnet/blob/b602d75c5a01f5ed8f68b11150a06374f058a86b/onnx_mxnet/import_onnx.py#L243-L262
def _parse_attr(self, attr_proto): """Convert a list of AttributeProto to a dict, with names as keys.""" attrs = {} for a in attr_proto: for f in ['f', 'i', 's']: if a.HasField(f): attrs[a.name] = getattr(a, f) for f in ['floats', 'ints...
[ "def", "_parse_attr", "(", "self", ",", "attr_proto", ")", ":", "attrs", "=", "{", "}", "for", "a", "in", "attr_proto", ":", "for", "f", "in", "[", "'f'", ",", "'i'", ",", "'s'", "]", ":", "if", "a", ".", "HasField", "(", "f", ")", ":", "attrs"...
Convert a list of AttributeProto to a dict, with names as keys.
[ "Convert", "a", "list", "of", "AttributeProto", "to", "a", "dict", "with", "names", "as", "keys", "." ]
python
train
46.3
stephenmcd/django-forms-builder
forms_builder/forms/admin.py
https://github.com/stephenmcd/django-forms-builder/blob/89fe03100ec09a6166cc0bf0022399bbbdca6298/forms_builder/forms/admin.py#L85-L104
def get_urls(self): """ Add the entries view to urls. """ urls = super(FormAdmin, self).get_urls() extra_urls = [ re_path("^(?P<form_id>\d+)/entries/$", self.admin_site.admin_view(self.entries_view), name="form_entries"), re...
[ "def", "get_urls", "(", "self", ")", ":", "urls", "=", "super", "(", "FormAdmin", ",", "self", ")", ".", "get_urls", "(", ")", "extra_urls", "=", "[", "re_path", "(", "\"^(?P<form_id>\\d+)/entries/$\"", ",", "self", ".", "admin_site", ".", "admin_view", "(...
Add the entries view to urls.
[ "Add", "the", "entries", "view", "to", "urls", "." ]
python
train
42.05
theislab/scvelo
scvelo/tools/velocity.py
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/tools/velocity.py#L186-L217
def velocity_genes(data, vkey='velocity', min_r2=0.01, highly_variable=None, copy=False): """Estimates velocities in a gene-specific manner Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name under which to refer to the...
[ "def", "velocity_genes", "(", "data", ",", "vkey", "=", "'velocity'", ",", "min_r2", "=", "0.01", ",", "highly_variable", "=", "None", ",", "copy", "=", "False", ")", ":", "adata", "=", "data", ".", "copy", "(", ")", "if", "copy", "else", "data", "if...
Estimates velocities in a gene-specific manner Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name under which to refer to the computed velocities for `velocity_graph` and `velocity_embedding`. min_r2: `float` (default:...
[ "Estimates", "velocities", "in", "a", "gene", "-", "specific", "manner" ]
python
train
40.84375
pyviz/holoviews
holoviews/core/dimension.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/dimension.py#L424-L435
def pprint_value_string(self, value): """Pretty print the dimension value and unit. Args: value: Dimension value to format Returns: Formatted dimension value string with unit """ unit = '' if self.unit is None else ' ' + bytes_to_unicode(self.unit) ...
[ "def", "pprint_value_string", "(", "self", ",", "value", ")", ":", "unit", "=", "''", "if", "self", ".", "unit", "is", "None", "else", "' '", "+", "bytes_to_unicode", "(", "self", ".", "unit", ")", "value", "=", "self", ".", "pprint_value", "(", "value...
Pretty print the dimension value and unit. Args: value: Dimension value to format Returns: Formatted dimension value string with unit
[ "Pretty", "print", "the", "dimension", "value", "and", "unit", "." ]
python
train
36.333333
NASA-AMMOS/AIT-Core
ait/core/db.py
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/db.py#L101-L111
def use(backend): """Use the given database backend, e.g. 'MySQLdb', 'psycopg2', 'MySQLdb', etc. """ global Backend try: Backend = importlib.import_module(backend) except ImportError: msg = 'Could not import (load) database.backend: %s' % backend raise cfg.AitConfigError...
[ "def", "use", "(", "backend", ")", ":", "global", "Backend", "try", ":", "Backend", "=", "importlib", ".", "import_module", "(", "backend", ")", "except", "ImportError", ":", "msg", "=", "'Could not import (load) database.backend: %s'", "%", "backend", "raise", ...
Use the given database backend, e.g. 'MySQLdb', 'psycopg2', 'MySQLdb', etc.
[ "Use", "the", "given", "database", "backend", "e", ".", "g", ".", "MySQLdb", "psycopg2", "MySQLdb", "etc", "." ]
python
train
28.636364
base4sistemas/satcfe
satcfe/clientesathub.py
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/clientesathub.py#L202-L211
def configurar_interface_de_rede(self, configuracao): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.configurar_interface_de_rede`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSAT """ resp = self._http_post('configurarinterfacederede', co...
[ "def", "configurar_interface_de_rede", "(", "self", ",", "configuracao", ")", ":", "resp", "=", "self", ".", "_http_post", "(", "'configurarinterfacederede'", ",", "configuracao", "=", "configuracao", ".", "documento", "(", ")", ")", "conteudo", "=", "resp", "."...
Sobrepõe :meth:`~satcfe.base.FuncoesSAT.configurar_interface_de_rede`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSAT
[ "Sobrepõe", ":", "meth", ":", "~satcfe", ".", "base", ".", "FuncoesSAT", ".", "configurar_interface_de_rede", "." ]
python
train
45.9
rm-hull/luma.emulator
luma/emulator/render.py
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L45-L49
def identity(self, surface): """ Fast scale operation that does not sample the results """ return self._pygame.transform.scale(surface, self._output_size)
[ "def", "identity", "(", "self", ",", "surface", ")", ":", "return", "self", ".", "_pygame", ".", "transform", ".", "scale", "(", "surface", ",", "self", ".", "_output_size", ")" ]
Fast scale operation that does not sample the results
[ "Fast", "scale", "operation", "that", "does", "not", "sample", "the", "results" ]
python
train
36.4
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/lib/inputhookglut.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/lib/inputhookglut.py#L126-L176
def inputhook_glut(): """Run the pyglet event loop by processing pending events only. This keeps processing pending events until stdin is ready. After processing all pending events, a call to time.sleep is inserted. This is needed, otherwise, CPU usage is at 100%. This sleep time should be tuned ...
[ "def", "inputhook_glut", "(", ")", ":", "# We need to protect against a user pressing Control-C when IPython is", "# idle and this is running. We trap KeyboardInterrupt and pass.", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "glut_int_handler", ")", "try", ":", ...
Run the pyglet event loop by processing pending events only. This keeps processing pending events until stdin is ready. After processing all pending events, a call to time.sleep is inserted. This is needed, otherwise, CPU usage is at 100%. This sleep time should be tuned though for best performance.
[ "Run", "the", "pyglet", "event", "loop", "by", "processing", "pending", "events", "only", "." ]
python
test
37.588235
sveetch/boussole
boussole/parser.py
https://github.com/sveetch/boussole/blob/22cc644e9d633f41ebfc167d427a71c1726cee21/boussole/parser.py#L94-L118
def flatten_rules(self, declarations): """ Flatten returned import rules from regex. Because import rules can contains multiple items in the same rule (called multiline import rule), the regex ``REGEX_IMPORT_RULE`` return a list of unquoted items for each rule. Args: ...
[ "def", "flatten_rules", "(", "self", ",", "declarations", ")", ":", "rules", "=", "[", "]", "for", "protocole", ",", "paths", "in", "declarations", ":", "# If there is a protocole (like 'url), drop it", "if", "protocole", ":", "continue", "# Unquote and possibly split...
Flatten returned import rules from regex. Because import rules can contains multiple items in the same rule (called multiline import rule), the regex ``REGEX_IMPORT_RULE`` return a list of unquoted items for each rule. Args: declarations (list): A SCSS source. Retu...
[ "Flatten", "returned", "import", "rules", "from", "regex", "." ]
python
train
34.12
romanz/trezor-agent
libagent/gpg/protocol.py
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/gpg/protocol.py#L180-L185
def get_curve_name_by_oid(oid): """Return curve name matching specified OID, or raise KeyError.""" for curve_name, info in SUPPORTED_CURVES.items(): if info['oid'] == oid: return curve_name raise KeyError('Unknown OID: {!r}'.format(oid))
[ "def", "get_curve_name_by_oid", "(", "oid", ")", ":", "for", "curve_name", ",", "info", "in", "SUPPORTED_CURVES", ".", "items", "(", ")", ":", "if", "info", "[", "'oid'", "]", "==", "oid", ":", "return", "curve_name", "raise", "KeyError", "(", "'Unknown OI...
Return curve name matching specified OID, or raise KeyError.
[ "Return", "curve", "name", "matching", "specified", "OID", "or", "raise", "KeyError", "." ]
python
train
44
tsroten/dragonmapper
dragonmapper/transcriptions.py
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L212-L220
def accented_syllable_to_numbered(s): """Convert accented Pinyin syllable *s* to a numbered Pinyin syllable.""" if s[0] == '\u00B7': lowercase_syllable, case_memory = _lower_case(s[1:]) lowercase_syllable = '\u00B7' + lowercase_syllable else: lowercase_syllable, case_memory = _lower_...
[ "def", "accented_syllable_to_numbered", "(", "s", ")", ":", "if", "s", "[", "0", "]", "==", "'\\u00B7'", ":", "lowercase_syllable", ",", "case_memory", "=", "_lower_case", "(", "s", "[", "1", ":", "]", ")", "lowercase_syllable", "=", "'\\u00B7'", "+", "low...
Convert accented Pinyin syllable *s* to a numbered Pinyin syllable.
[ "Convert", "accented", "Pinyin", "syllable", "*", "s", "*", "to", "a", "numbered", "Pinyin", "syllable", "." ]
python
train
50.888889
qualisys/qualisys_python_sdk
examples/asyncio_everything.py
https://github.com/qualisys/qualisys_python_sdk/blob/127d7eeebc2b38b5cafdfa5d1d0198437fedd274/examples/asyncio_everything.py#L35-L44
async def packet_receiver(queue): """ Asynchronous function that processes queue until None is posted in queue """ LOG.info("Entering packet_receiver") while True: packet = await queue.get() if packet is None: break LOG.info("Framenumber %s", packet.framenumber) LOG....
[ "async", "def", "packet_receiver", "(", "queue", ")", ":", "LOG", ".", "info", "(", "\"Entering packet_receiver\"", ")", "while", "True", ":", "packet", "=", "await", "queue", ".", "get", "(", ")", "if", "packet", "is", "None", ":", "break", "LOG", ".", ...
Asynchronous function that processes queue until None is posted in queue
[ "Asynchronous", "function", "that", "processes", "queue", "until", "None", "is", "posted", "in", "queue" ]
python
valid
34.2
gem/oq-engine
openquake/hazardlib/calc/filters.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/calc/filters.py#L186-L241
def split_sources(srcs): """ :param srcs: sources :returns: a pair (split sources, split time) or just the split_sources """ from openquake.hazardlib.source import splittable sources = [] split_time = {} # src.id -> time for src in srcs: t0 = time.time() mag_a, mag_b = s...
[ "def", "split_sources", "(", "srcs", ")", ":", "from", "openquake", ".", "hazardlib", ".", "source", "import", "splittable", "sources", "=", "[", "]", "split_time", "=", "{", "}", "# src.id -> time", "for", "src", "in", "srcs", ":", "t0", "=", "time", "....
:param srcs: sources :returns: a pair (split sources, split time) or just the split_sources
[ ":", "param", "srcs", ":", "sources", ":", "returns", ":", "a", "pair", "(", "split", "sources", "split", "time", ")", "or", "just", "the", "split_sources" ]
python
train
35.035714
aiogram/aiogram
aiogram/bot/bot.py
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1091-L1106
async def export_chat_invite_link(self, chat_id: typing.Union[base.Integer, base.String]) -> base.String: """ Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the approp...
[ "async", "def", "export_chat_invite_link", "(", "self", ",", "chat_id", ":", "typing", ".", "Union", "[", "base", ".", "Integer", ",", "base", ".", "String", "]", ")", "->", "base", ".", "String", ":", "payload", "=", "generate_payload", "(", "*", "*", ...
Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Source: https://core.telegram.org/bots/api#exportchatinvitelink :param chat_id: Unique i...
[ "Use", "this", "method", "to", "generate", "a", "new", "invite", "link", "for", "a", "chat", ";", "any", "previously", "generated", "link", "is", "revoked", ".", "The", "bot", "must", "be", "an", "administrator", "in", "the", "chat", "for", "this", "to",...
python
train
51.875
apple/turicreate
deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L299-L320
def __convert_node(node, default_value='', default_flags=vsflags()): """Converts a XML node to a JSON equivalent.""" name = __get_attribute(node, 'Name') logging.debug('Found %s named %s', node.tagName, name) converted = {} converted['name'] = name converted['switch'] = __get_attribute(node, 'S...
[ "def", "__convert_node", "(", "node", ",", "default_value", "=", "''", ",", "default_flags", "=", "vsflags", "(", ")", ")", ":", "name", "=", "__get_attribute", "(", "node", ",", "'Name'", ")", "logging", ".", "debug", "(", "'Found %s named %s'", ",", "nod...
Converts a XML node to a JSON equivalent.
[ "Converts", "a", "XML", "node", "to", "a", "JSON", "equivalent", "." ]
python
train
30.681818
collectiveacuity/labPack
labpack/records/ip.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/ip.py#L28-L130
def describe_ip(ip_address, source='whatismyip'): ''' a method to get the details associated with an ip address ''' # determine url if source == 'nekudo': source_url = 'https://geoip.nekudo.com/api/%s' % ip_address elif source == 'geoip': source_url = 'https://freegeoip.net/json/%s' % ...
[ "def", "describe_ip", "(", "ip_address", ",", "source", "=", "'whatismyip'", ")", ":", "# determine url", "if", "source", "==", "'nekudo'", ":", "source_url", "=", "'https://geoip.nekudo.com/api/%s'", "%", "ip_address", "elif", "source", "==", "'geoip'", ":", "sou...
a method to get the details associated with an ip address
[ "a", "method", "to", "get", "the", "details", "associated", "with", "an", "ip", "address" ]
python
train
42.737864
ntucllab/libact
libact/models/multilabel/binary_relevance.py
https://github.com/ntucllab/libact/blob/e37e9ed6c36febe701d84b2d495c958ab02f0bc8/libact/models/multilabel/binary_relevance.py#L84-L106
def predict(self, X): r"""Predict labels. Parameters ---------- X : array-like, shape=(n_samples, n_features) Feature vector. Returns ------- pred : numpy array, shape=(n_samples, n_labels) Predicted labels of given feature vector. ...
[ "def", "predict", "(", "self", ",", "X", ")", ":", "X", "=", "np", ".", "asarray", "(", "X", ")", "if", "self", ".", "clfs_", "is", "None", ":", "raise", "ValueError", "(", "\"Train before prediction\"", ")", "if", "X", ".", "shape", "[", "1", "]",...
r"""Predict labels. Parameters ---------- X : array-like, shape=(n_samples, n_features) Feature vector. Returns ------- pred : numpy array, shape=(n_samples, n_labels) Predicted labels of given feature vector.
[ "r", "Predict", "labels", "." ]
python
train
30.521739
danielperna84/pyhomematic
pyhomematic/devicetypes/helper.py
https://github.com/danielperna84/pyhomematic/blob/8b91f3e84c83f05d289c740d507293a0d6759d8e/pyhomematic/devicetypes/helper.py#L133-L141
def set_state(self, onoff, channel=None): """Turn state on/off""" try: onoff = bool(onoff) except Exception as err: LOG.debug("HelperActorState.set_state: Exception %s" % (err,)) return False self.writeNodeData("STATE", onoff, channel)
[ "def", "set_state", "(", "self", ",", "onoff", ",", "channel", "=", "None", ")", ":", "try", ":", "onoff", "=", "bool", "(", "onoff", ")", "except", "Exception", "as", "err", ":", "LOG", ".", "debug", "(", "\"HelperActorState.set_state: Exception %s\"", "%...
Turn state on/off
[ "Turn", "state", "on", "/", "off" ]
python
train
32.888889
vimalloc/flask-jwt-extended
flask_jwt_extended/view_decorators.py
https://github.com/vimalloc/flask-jwt-extended/blob/569d3b89eb5d2586d0cff4581a346229c623cefc/flask_jwt_extended/view_decorators.py#L24-L34
def verify_jwt_in_request(): """ Ensure that the requester has a valid access token. This does not check the freshness of the access token. Raises an appropiate exception there is no token or if the token is invalid. """ if request.method not in config.exempt_methods: jwt_data = _decode_...
[ "def", "verify_jwt_in_request", "(", ")", ":", "if", "request", ".", "method", "not", "in", "config", ".", "exempt_methods", ":", "jwt_data", "=", "_decode_jwt_from_request", "(", "request_type", "=", "'access'", ")", "ctx_stack", ".", "top", ".", "jwt", "=", ...
Ensure that the requester has a valid access token. This does not check the freshness of the access token. Raises an appropiate exception there is no token or if the token is invalid.
[ "Ensure", "that", "the", "requester", "has", "a", "valid", "access", "token", ".", "This", "does", "not", "check", "the", "freshness", "of", "the", "access", "token", ".", "Raises", "an", "appropiate", "exception", "there", "is", "no", "token", "or", "if",...
python
train
43.636364
PedalPi/Application
application/controller/current_controller.py
https://github.com/PedalPi/Application/blob/3fdf6f97cfef97a7f1d90a5881dd04324c229f9d/application/controller/current_controller.py#L150-L168
def to_next_pedalboard(self): """ Change the current :class:`.Pedalboard` for the next pedalboard. If the current pedalboard is the last in the current :class:`.Bank`, the current pedalboard is will be the **first of the current Bank** .. warning:: If the current :...
[ "def", "to_next_pedalboard", "(", "self", ")", ":", "if", "self", ".", "pedalboard", "is", "None", ":", "raise", "CurrentPedalboardError", "(", "'The current pedalboard is None'", ")", "next_index", "=", "self", ".", "pedalboard", ".", "index", "+", "1", "if", ...
Change the current :class:`.Pedalboard` for the next pedalboard. If the current pedalboard is the last in the current :class:`.Bank`, the current pedalboard is will be the **first of the current Bank** .. warning:: If the current :attr:`.pedalboard` is ``None``, a :class:`.Current...
[ "Change", "the", "current", ":", "class", ":", ".", "Pedalboard", "for", "the", "next", "pedalboard", "." ]
python
train
36.526316
ManiacalLabs/BiblioPixel
bibliopixel/util/util.py
https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/util/util.py#L36-L55
def pointOnCircle(cx, cy, radius, angle): """ Calculates the coordinates of a point on a circle given the center point, radius, and angle. """ angle = math.radians(angle) - (math.pi / 2) x = cx + radius * math.cos(angle) if x < cx: x = math.ceil(x) else: x = math.floor(x)...
[ "def", "pointOnCircle", "(", "cx", ",", "cy", ",", "radius", ",", "angle", ")", ":", "angle", "=", "math", ".", "radians", "(", "angle", ")", "-", "(", "math", ".", "pi", "/", "2", ")", "x", "=", "cx", "+", "radius", "*", "math", ".", "cos", ...
Calculates the coordinates of a point on a circle given the center point, radius, and angle.
[ "Calculates", "the", "coordinates", "of", "a", "point", "on", "a", "circle", "given", "the", "center", "point", "radius", "and", "angle", "." ]
python
valid
22.3
tylertreat/BigQuery-Python
bigquery/client.py
https://github.com/tylertreat/BigQuery-Python/blob/88d99de42d954d49fc281460068f0e95003da098/bigquery/client.py#L510-L526
def check_dataset(self, dataset_id, project_id=None): """Check to see if a dataset exists. Parameters ---------- dataset_id : str Dataset unique id project_id: str, optional The project the dataset is in Returns ------- bool ...
[ "def", "check_dataset", "(", "self", ",", "dataset_id", ",", "project_id", "=", "None", ")", ":", "dataset", "=", "self", ".", "get_dataset", "(", "dataset_id", ",", "project_id", ")", "return", "bool", "(", "dataset", ")" ]
Check to see if a dataset exists. Parameters ---------- dataset_id : str Dataset unique id project_id: str, optional The project the dataset is in Returns ------- bool True if dataset at `dataset_id` exists, else Fasle
[ "Check", "to", "see", "if", "a", "dataset", "exists", "." ]
python
train
27.529412
evonove/django-stored-messages
stored_messages/views.py
https://github.com/evonove/django-stored-messages/blob/23b71f952d5d3fd03285f5e700879d05796ef7ba/stored_messages/views.py#L36-L48
def read(self, request, pk=None): """ Mark the message as read (i.e. delete from inbox) """ from .settings import stored_messages_settings backend = stored_messages_settings.STORAGE_BACKEND() try: backend.inbox_delete(request.user, pk) except MessageD...
[ "def", "read", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "from", ".", "settings", "import", "stored_messages_settings", "backend", "=", "stored_messages_settings", ".", "STORAGE_BACKEND", "(", ")", "try", ":", "backend", ".", "inbox_delete...
Mark the message as read (i.e. delete from inbox)
[ "Mark", "the", "message", "as", "read", "(", "i", ".", "e", ".", "delete", "from", "inbox", ")" ]
python
valid
33.923077
tensorflow/probability
tensorflow_probability/python/mcmc/langevin.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/mcmc/langevin.py#L872-L922
def _maybe_call_volatility_fn_and_grads(volatility_fn, state, volatility_fn_results=None, grads_volatility_fn=None, sample_shape=None, ...
[ "def", "_maybe_call_volatility_fn_and_grads", "(", "volatility_fn", ",", "state", ",", "volatility_fn_results", "=", "None", ",", "grads_volatility_fn", "=", "None", ",", "sample_shape", "=", "None", ",", "parallel_iterations", "=", "10", ")", ":", "state_parts", "=...
Helper which computes `volatility_fn` results and grads, if needed.
[ "Helper", "which", "computes", "volatility_fn", "results", "and", "grads", "if", "needed", "." ]
python
test
43.137255
instana/python-sensor
instana/meter.py
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L133-L139
def reset(self): """" Reset the state as new """ self.last_usage = None self.last_collect = None self.last_metrics = None self.snapshot_countdown = 0 self.run()
[ "def", "reset", "(", "self", ")", ":", "self", ".", "last_usage", "=", "None", "self", ".", "last_collect", "=", "None", "self", ".", "last_metrics", "=", "None", "self", ".", "snapshot_countdown", "=", "0", "self", ".", "run", "(", ")" ]
Reset the state as new
[ "Reset", "the", "state", "as", "new" ]
python
train
28.857143
eddyxu/cpp-coveralls
cpp_coveralls/coverage.py
https://github.com/eddyxu/cpp-coveralls/blob/ff7af7eea2a23828f6ab2541667ea04f94344dce/cpp_coveralls/coverage.py#L324-L342
def combine_reports(original, new): """Combines two gcov reports for a file into one by adding the number of hits on each line """ if original is None: return new report = {} report['name'] = original['name'] report['source_digest'] = original['source_digest'] coverage = [] for o...
[ "def", "combine_reports", "(", "original", ",", "new", ")", ":", "if", "original", "is", "None", ":", "return", "new", "report", "=", "{", "}", "report", "[", "'name'", "]", "=", "original", "[", "'name'", "]", "report", "[", "'source_digest'", "]", "=...
Combines two gcov reports for a file into one by adding the number of hits on each line
[ "Combines", "two", "gcov", "reports", "for", "a", "file", "into", "one", "by", "adding", "the", "number", "of", "hits", "on", "each", "line" ]
python
train
33.157895
ska-sa/katcp-python
katcp/core.py
https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L411-L430
def reply(cls, name, *args, **kwargs): """Helper method for creating reply messages. Parameters ---------- name : str The name of the message. args : list of strings The message arguments. Keyword Arguments ----------------- mid :...
[ "def", "reply", "(", "cls", ",", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "mid", "=", "kwargs", ".", "pop", "(", "'mid'", ",", "None", ")", "if", "len", "(", "kwargs", ")", ">", "0", ":", "raise", "TypeError", "(", "'Invalid...
Helper method for creating reply messages. Parameters ---------- name : str The name of the message. args : list of strings The message arguments. Keyword Arguments ----------------- mid : str or None Message ID to use or None...
[ "Helper", "method", "for", "creating", "reply", "messages", "." ]
python
train
28.85
ValvePython/vdf
vdf/__init__.py
https://github.com/ValvePython/vdf/blob/4b168702736f51318baa3a12aa5a2827d360f94a/vdf/__init__.py#L165-L178
def loads(s, **kwargs): """ Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. """ if not isinstance(s, string_type): raise TypeError("Expected s to be a str, got %s" % type(s)) try: fp = unicodeIO(s) except TypeError: ...
[ "def", "loads", "(", "s", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "s", ",", "string_type", ")", ":", "raise", "TypeError", "(", "\"Expected s to be a str, got %s\"", "%", "type", "(", "s", ")", ")", "try", ":", "fp", "=", "...
Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object.
[ "Deserialize", "s", "(", "a", "str", "or", "unicode", "instance", "containing", "a", "JSON", "document", ")", "to", "a", "Python", "object", "." ]
python
train
25.285714
CalebBell/ht
ht/boiling_nucleic.py
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/boiling_nucleic.py#L114-L184
def McNelly(rhol, rhog, kl, Cpl, Hvap, sigma, P, Te=None, q=None): r'''Calculates heat transfer coefficient for a evaporator operating in the nucleate boiling regime according to [2]_ as presented in [1]_. Either heat flux or excess temperature is required. With `Te` specified: .. math:: ...
[ "def", "McNelly", "(", "rhol", ",", "rhog", ",", "kl", ",", "Cpl", ",", "Hvap", ",", "sigma", ",", "P", ",", "Te", "=", "None", ",", "q", "=", "None", ")", ":", "if", "Te", ":", "return", "(", "0.225", "*", "(", "Te", "*", "Cpl", "/", "Hvap...
r'''Calculates heat transfer coefficient for a evaporator operating in the nucleate boiling regime according to [2]_ as presented in [1]_. Either heat flux or excess temperature is required. With `Te` specified: .. math:: h = \left(0.225\left(\frac{\Delta T_e C_{p,l}}{H_{vap}}\right)^{0.6...
[ "r", "Calculates", "heat", "transfer", "coefficient", "for", "a", "evaporator", "operating", "in", "the", "nucleate", "boiling", "regime", "according", "to", "[", "2", "]", "_", "as", "presented", "in", "[", "1", "]", "_", "." ]
python
train
30.492958
jason-weirather/py-seq-tools
seqtools/structure/transcript/__init__.py
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/transcript/__init__.py#L530-L538
def calculate_overlap(self): """Create the array that describes how junctions overlap""" overs = [] if not self.tx_obj1.range.overlaps(self.tx_obj2.range): return [] # if they dont overlap wont find anything for i in range(0,len(self.j1)): for j in range(0,len(self.j2)): if sel...
[ "def", "calculate_overlap", "(", "self", ")", ":", "overs", "=", "[", "]", "if", "not", "self", ".", "tx_obj1", ".", "range", ".", "overlaps", "(", "self", ".", "tx_obj2", ".", "range", ")", ":", "return", "[", "]", "# if they dont overlap wont find anythi...
Create the array that describes how junctions overlap
[ "Create", "the", "array", "that", "describes", "how", "junctions", "overlap" ]
python
train
46.333333
pantsbuild/pants
src/python/pants/reporting/reporting_server.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/reporting/reporting_server.py#L329-L339
def _maybe_handle(self, prefix, handler, path, params, data=None): """Apply the handler if the prefix matches.""" if path.startswith(prefix): relpath = path[len(prefix):] if data: handler(relpath, params, data) else: handler(relpath, params) return True else: re...
[ "def", "_maybe_handle", "(", "self", ",", "prefix", ",", "handler", ",", "path", ",", "params", ",", "data", "=", "None", ")", ":", "if", "path", ".", "startswith", "(", "prefix", ")", ":", "relpath", "=", "path", "[", "len", "(", "prefix", ")", ":...
Apply the handler if the prefix matches.
[ "Apply", "the", "handler", "if", "the", "prefix", "matches", "." ]
python
train
29.090909
Kortemme-Lab/klab
klab/bio/relatrix.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/relatrix.py#L218-L229
def _validate_fasta_vs_seqres(self): '''Check that the FASTA and SEQRES sequences agree (they sometimes differ)''' pdb_id = self.pdb_id for chain_id, sequence in self.pdb.seqres_sequences.iteritems(): if str(sequence) != self.FASTA[pdb_id][chain_id]: if self.pdb_id in...
[ "def", "_validate_fasta_vs_seqres", "(", "self", ")", ":", "pdb_id", "=", "self", ".", "pdb_id", "for", "chain_id", ",", "sequence", "in", "self", ".", "pdb", ".", "seqres_sequences", ".", "iteritems", "(", ")", ":", "if", "str", "(", "sequence", ")", "!...
Check that the FASTA and SEQRES sequences agree (they sometimes differ)
[ "Check", "that", "the", "FASTA", "and", "SEQRES", "sequences", "agree", "(", "they", "sometimes", "differ", ")" ]
python
train
90
bschollnick/semantic_url
semantic_url/__init__.py
https://github.com/bschollnick/semantic_url/blob/3c9b9e24354c0d4c5a2ce82006e610c5980395ad/semantic_url/__init__.py#L400-L414
def return_current_uri_page_only(self): """ Args: * None Returns: String - Returns the full postpath & semantic components *NOTE* may not contain the server & port numbers. That depends on what was provided to the parser. """ uri = post...
[ "def", "return_current_uri_page_only", "(", "self", ")", ":", "uri", "=", "post_slash", "(", "\"%s%s\"", "%", "(", "post_slash", "(", "self", ".", "current_dir", "(", ")", ")", ",", "self", ".", "slots", "[", "'page'", "]", ")", ")", "return", "uri" ]
Args: * None Returns: String - Returns the full postpath & semantic components *NOTE* may not contain the server & port numbers. That depends on what was provided to the parser.
[ "Args", ":", "*", "None" ]
python
train
27.933333
dave-shawley/glinda
glinda/content.py
https://github.com/dave-shawley/glinda/blob/6dec43549d5b1767467174aa3d7fa2425bc25f66/glinda/content.py#L177-L222
def send_response(self, response_dict): """ Encode a response according to the request. :param dict response_dict: the response to send :raises: :class:`tornado.web.HTTPError` if no acceptable content type exists This method will encode `response_dict` using the mo...
[ "def", "send_response", "(", "self", ",", "response_dict", ")", ":", "accept", "=", "headers", ".", "parse_http_accept_header", "(", "self", ".", "request", ".", "headers", ".", "get", "(", "'Accept'", ",", "'*/*'", ")", ")", "try", ":", "selected", ",", ...
Encode a response according to the request. :param dict response_dict: the response to send :raises: :class:`tornado.web.HTTPError` if no acceptable content type exists This method will encode `response_dict` using the most appropriate encoder based on the :mailheader:`Acc...
[ "Encode", "a", "response", "according", "to", "the", "request", "." ]
python
train
44.956522
lowandrew/OLCTools
spadespipeline/quality.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L653-L665
def perform_pilon(self): """ Determine if pilon polishing should be attempted. Do not perform polishing if confindr determines that the sample is contaminated or if there are > 500 contigs """ for sample in self.metadata: try: if sample[self.analysisty...
[ "def", "perform_pilon", "(", "self", ")", ":", "for", "sample", "in", "self", ".", "metadata", ":", "try", ":", "if", "sample", "[", "self", ".", "analysistype", "]", ".", "num_contigs", ">", "500", "or", "sample", ".", "confindr", ".", "contam_status", ...
Determine if pilon polishing should be attempted. Do not perform polishing if confindr determines that the sample is contaminated or if there are > 500 contigs
[ "Determine", "if", "pilon", "polishing", "should", "be", "attempted", ".", "Do", "not", "perform", "polishing", "if", "confindr", "determines", "that", "the", "sample", "is", "contaminated", "or", "if", "there", "are", ">", "500", "contigs" ]
python
train
44.769231
Robpol86/libnl
libnl/nl80211/iw_scan.py
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/nl80211/iw_scan.py#L420-L436
def get_capabilities(_, data): """http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17#n796. Positional arguments: data -- bytearray data to read. Returns: List. """ answers = list() for i in range(len(data)): base = i * 8 for bit in range(8): ...
[ "def", "get_capabilities", "(", "_", ",", "data", ")", ":", "answers", "=", "list", "(", ")", "for", "i", "in", "range", "(", "len", "(", "data", ")", ")", ":", "base", "=", "i", "*", "8", "for", "bit", "in", "range", "(", "8", ")", ":", "if"...
http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17#n796. Positional arguments: data -- bytearray data to read. Returns: List.
[ "http", ":", "//", "git", ".", "kernel", ".", "org", "/", "cgit", "/", "linux", "/", "kernel", "/", "git", "/", "jberg", "/", "iw", ".", "git", "/", "tree", "/", "scan", ".", "c?id", "=", "v3", ".", "17#n796", "." ]
python
train
25.941176
6809/MC6809
MC6809/components/mc6809_ops_logic.py
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L277-L289
def ROL(self, a): """ Rotates all bits of the register one place left through the C (carry) bit. This is a 9-bit rotation. source code forms: ROL Q; ROLA; ROLB CC bits "HNZVC": -aaas """ r = (a << 1) | self.C self.clear_NZVC() self.update_NZVC_8(...
[ "def", "ROL", "(", "self", ",", "a", ")", ":", "r", "=", "(", "a", "<<", "1", ")", "|", "self", ".", "C", "self", ".", "clear_NZVC", "(", ")", "self", ".", "update_NZVC_8", "(", "a", ",", "a", ",", "r", ")", "return", "r" ]
Rotates all bits of the register one place left through the C (carry) bit. This is a 9-bit rotation. source code forms: ROL Q; ROLA; ROLB CC bits "HNZVC": -aaas
[ "Rotates", "all", "bits", "of", "the", "register", "one", "place", "left", "through", "the", "C", "(", "carry", ")", "bit", ".", "This", "is", "a", "9", "-", "bit", "rotation", "." ]
python
train
25.615385
merantix/picasso
picasso/interfaces/rest.py
https://github.com/merantix/picasso/blob/d276b9b7408dd1032fe0ccb84ea9b6604a32915e/picasso/interfaces/rest.py#L84-L109
def images(): """Upload images via REST interface Check if file upload was successful and sanatize user input. TODO: return file URL instead of filename """ if request.method == 'POST': file_upload = request.files['file'] if file_upload: image = dict() imag...
[ "def", "images", "(", ")", ":", "if", "request", ".", "method", "==", "'POST'", ":", "file_upload", "=", "request", ".", "files", "[", "'file'", "]", "if", "file_upload", ":", "image", "=", "dict", "(", ")", "image", "[", "'filename'", "]", "=", "sec...
Upload images via REST interface Check if file upload was successful and sanatize user input. TODO: return file URL instead of filename
[ "Upload", "images", "via", "REST", "interface" ]
python
train
39.5
dj-stripe/dj-stripe
djstripe/event_handlers.py
https://github.com/dj-stripe/dj-stripe/blob/a5308a3808cd6e2baba49482f7a699f3a8992518/djstripe/event_handlers.py#L76-L94
def customer_source_webhook_handler(event): """Handle updates to customer payment-source objects. Docs: https://stripe.com/docs/api#customer_object-sources. """ customer_data = event.data.get("object", {}) source_type = customer_data.get("object", {}) # TODO: handle other types of sources (https://stripe.com/do...
[ "def", "customer_source_webhook_handler", "(", "event", ")", ":", "customer_data", "=", "event", ".", "data", ".", "get", "(", "\"object\"", ",", "{", "}", ")", "source_type", "=", "customer_data", ".", "get", "(", "\"object\"", ",", "{", "}", ")", "# TODO...
Handle updates to customer payment-source objects. Docs: https://stripe.com/docs/api#customer_object-sources.
[ "Handle", "updates", "to", "customer", "payment", "-", "source", "objects", "." ]
python
train
48.315789
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L14472-L14490
def vaddg(v1, v2, ndim): """ Add two n-dimensional vectors http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/vaddg_c.html :param v1: First vector to be added. :type v1: list[ndim] :param v2: Second vector to be added. :type v2: list[ndim] :param ndim: Dimension of v1 and v2. :t...
[ "def", "vaddg", "(", "v1", ",", "v2", ",", "ndim", ")", ":", "v1", "=", "stypes", ".", "toDoubleVector", "(", "v1", ")", "v2", "=", "stypes", ".", "toDoubleVector", "(", "v2", ")", "vout", "=", "stypes", ".", "emptyDoubleVector", "(", "ndim", ")", ...
Add two n-dimensional vectors http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/vaddg_c.html :param v1: First vector to be added. :type v1: list[ndim] :param v2: Second vector to be added. :type v2: list[ndim] :param ndim: Dimension of v1 and v2. :type ndim: int :return: v1+v2 ...
[ "Add", "two", "n", "-", "dimensional", "vectors", "http", ":", "//", "naif", ".", "jpl", ".", "nasa", ".", "gov", "/", "pub", "/", "naif", "/", "toolkit_docs", "/", "C", "/", "cspice", "/", "vaddg_c", ".", "html" ]
python
train
30.947368
coderholic/pyradio
pyradio/player.py
https://github.com/coderholic/pyradio/blob/c5219d350bccbccd49dbd627c1f886a952ea1963/pyradio/player.py#L285-L319
def play(self, name, streamUrl, encoding = ''): """ use a multimedia player to play a stream """ self.close() self.name = name self.oldUserInput = {'Input': '', 'Volume': '', 'Title': ''} self.muted = False self.show_volume = True self.title_prefix = '' se...
[ "def", "play", "(", "self", ",", "name", ",", "streamUrl", ",", "encoding", "=", "''", ")", ":", "self", ".", "close", "(", ")", "self", ".", "name", "=", "name", "self", ".", "oldUserInput", "=", "{", "'Input'", ":", "''", ",", "'Volume'", ":", ...
use a multimedia player to play a stream
[ "use", "a", "multimedia", "player", "to", "play", "a", "stream" ]
python
train
46.8
peterbrittain/asciimatics
asciimatics/screen.py
https://github.com/peterbrittain/asciimatics/blob/f471427d7786ce2d5f1eeb2dae0e67d19e46e085/asciimatics/screen.py#L817-L932
def draw(self, x, y, char=None, colour=7, bg=0, thin=False): """ Draw a line from drawing cursor to the specified position. This uses a modified Bressenham algorithm, interpolating twice as many points to render down to anti-aliased characters when no character is specified, or ...
[ "def", "draw", "(", "self", ",", "x", ",", "y", ",", "char", "=", "None", ",", "colour", "=", "7", ",", "bg", "=", "0", ",", "thin", "=", "False", ")", ":", "# Decide what type of line drawing to use.", "line_chars", "=", "(", "self", ".", "_uni_line_c...
Draw a line from drawing cursor to the specified position. This uses a modified Bressenham algorithm, interpolating twice as many points to render down to anti-aliased characters when no character is specified, or uses standard algorithm plotting with the specified character. :param x:...
[ "Draw", "a", "line", "from", "drawing", "cursor", "to", "the", "specified", "position", "." ]
python
train
37.232759
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L6896-L6953
def illumf(method, target, ilusrc, et, fixref, abcorr, obsrvr, spoint): """ Compute the illumination angles---phase, incidence, and emission---at a specified point on a target body. Return logical flags indicating whether the surface point is visible from the observer's position and whether the surf...
[ "def", "illumf", "(", "method", ",", "target", ",", "ilusrc", ",", "et", ",", "fixref", ",", "abcorr", ",", "obsrvr", ",", "spoint", ")", ":", "method", "=", "stypes", ".", "stringToCharP", "(", "method", ")", "target", "=", "stypes", ".", "stringToCha...
Compute the illumination angles---phase, incidence, and emission---at a specified point on a target body. Return logical flags indicating whether the surface point is visible from the observer's position and whether the surface point is illuminated. The target body's surface is represented using to...
[ "Compute", "the", "illumination", "angles", "---", "phase", "incidence", "and", "emission", "---", "at", "a", "specified", "point", "on", "a", "target", "body", ".", "Return", "logical", "flags", "indicating", "whether", "the", "surface", "point", "is", "visib...
python
train
41.948276
DataDog/integrations-core
cacti/datadog_checks/cacti/cacti.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/cacti/datadog_checks/cacti/cacti.py#L166-L214
def _fetch_rrd_meta(self, connection, rrd_path_root, whitelist, field_names, tags): ''' Fetch metadata about each RRD in this Cacti DB, returning a list of tuples of (hostname, device_name, rrd_path) ''' def _in_whitelist(rrd): path = rrd.replace('<path_rra>/', '') ...
[ "def", "_fetch_rrd_meta", "(", "self", ",", "connection", ",", "rrd_path_root", ",", "whitelist", ",", "field_names", ",", "tags", ")", ":", "def", "_in_whitelist", "(", "rrd", ")", ":", "path", "=", "rrd", ".", "replace", "(", "'<path_rra>/'", ",", "''", ...
Fetch metadata about each RRD in this Cacti DB, returning a list of tuples of (hostname, device_name, rrd_path)
[ "Fetch", "metadata", "about", "each", "RRD", "in", "this", "Cacti", "DB", "returning", "a", "list", "of", "tuples", "of", "(", "hostname", "device_name", "rrd_path", ")" ]
python
train
38.979592
Caramel/treacle
treacle/treacle.py
https://github.com/Caramel/treacle/blob/70f85a505c0f345659850aec1715c46c687d0e48/treacle/treacle.py#L202-L230
def in_hours(self, office=None, when=None): """ Finds if it is business hours in the given office. :param office: Office ID to look up, or None to check if any office is in business hours. :type office: str or None :param datetime.datetime when: When to check the office is open, or None for now. :returns...
[ "def", "in_hours", "(", "self", ",", "office", "=", "None", ",", "when", "=", "None", ")", ":", "if", "when", "==", "None", ":", "when", "=", "datetime", ".", "now", "(", "tz", "=", "utc", ")", "if", "office", "==", "None", ":", "for", "office", ...
Finds if it is business hours in the given office. :param office: Office ID to look up, or None to check if any office is in business hours. :type office: str or None :param datetime.datetime when: When to check the office is open, or None for now. :returns: True if it is business hours, False otherwise. :...
[ "Finds", "if", "it", "is", "business", "hours", "in", "the", "given", "office", "." ]
python
train
23.172414
frawau/aiolifx
aiolifx/aiolifx.py
https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L1150-L1156
def start(self, listen_ip=LISTEN_IP, listen_port=0): """Start discovery task.""" coro = self.loop.create_datagram_endpoint( lambda: self, local_addr=(listen_ip, listen_port)) self.task = self.loop.create_task(coro) return self.task
[ "def", "start", "(", "self", ",", "listen_ip", "=", "LISTEN_IP", ",", "listen_port", "=", "0", ")", ":", "coro", "=", "self", ".", "loop", ".", "create_datagram_endpoint", "(", "lambda", ":", "self", ",", "local_addr", "=", "(", "listen_ip", ",", "listen...
Start discovery task.
[ "Start", "discovery", "task", "." ]
python
train
38.571429
elastic/elasticsearch-py
elasticsearch/client/utils.py
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/utils.py#L12-L41
def _escape(value): """ Escape a single value of a URL string or a query parameter. If it is a list or tuple, turn it into a comma-separated string first. """ # make sequences into comma-separated stings if isinstance(value, (list, tuple)): value = ",".join(value) # dates and datet...
[ "def", "_escape", "(", "value", ")", ":", "# make sequences into comma-separated stings", "if", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ")", ")", ":", "value", "=", "\",\"", ".", "join", "(", "value", ")", "# dates and datetimes into isoforma...
Escape a single value of a URL string or a query parameter. If it is a list or tuple, turn it into a comma-separated string first.
[ "Escape", "a", "single", "value", "of", "a", "URL", "string", "or", "a", "query", "parameter", ".", "If", "it", "is", "a", "list", "or", "tuple", "turn", "it", "into", "a", "comma", "-", "separated", "string", "first", "." ]
python
train
28.633333
pyroscope/pyrocore
src/pyrocore/daemon/webapp.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/src/pyrocore/daemon/webapp.py#L237-L253
def make_app(httpd_config): """ Factory for the monitoring webapp. """ #mimetypes.add_type('image/vnd.microsoft.icon', '.ico') # Default paths to serve static file from htdocs_paths = [ os.path.realpath(os.path.join(config.config_dir, "htdocs")), os.path.join(os.path.dirname(config....
[ "def", "make_app", "(", "httpd_config", ")", ":", "#mimetypes.add_type('image/vnd.microsoft.icon', '.ico')", "# Default paths to serve static file from", "htdocs_paths", "=", "[", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "join", "(", "config", ...
Factory for the monitoring webapp.
[ "Factory", "for", "the", "monitoring", "webapp", "." ]
python
train
40.470588
proycon/pynlpl
pynlpl/formats/folia.py
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L7396-L7424
def pendingvalidation(self, warnonly=None): """Perform any pending validations Parameters: warnonly (bool): Warn only (True) or raise exceptions (False). If set to None then this value will be determined based on the document's FoLiA version (Warn only before FoLiA v1.5) Returns: ...
[ "def", "pendingvalidation", "(", "self", ",", "warnonly", "=", "None", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "\"[PyNLPl FoLiA DEBUG] Processing pending validations (if any)\"", ",", "file", "=", "stderr", ")", "if", "warnonly", "is", "None", "...
Perform any pending validations Parameters: warnonly (bool): Warn only (True) or raise exceptions (False). If set to None then this value will be determined based on the document's FoLiA version (Warn only before FoLiA v1.5) Returns: bool
[ "Perform", "any", "pending", "validations" ]
python
train
53.551724
thespacedoctor/fundamentals
fundamentals/mysql/insert_list_of_dictionaries_into_database_tables.py
https://github.com/thespacedoctor/fundamentals/blob/1d2c007ac74442ec2eabde771cfcacdb9c1ab382/fundamentals/mysql/insert_list_of_dictionaries_into_database_tables.py#L161-L314
def _insert_single_batch_into_database( batchIndex, log, dbTableName, uniqueKeyList, dateModified, replace, batchSize, reDatetime, dateCreated): """*summary of function* **Key Arguments:** - ``batchIndex`` -- the index of the batch...
[ "def", "_insert_single_batch_into_database", "(", "batchIndex", ",", "log", ",", "dbTableName", ",", "uniqueKeyList", ",", "dateModified", ",", "replace", ",", "batchSize", ",", "reDatetime", ",", "dateCreated", ")", ":", "log", ".", "debug", "(", "'starting the `...
*summary of function* **Key Arguments:** - ``batchIndex`` -- the index of the batch to insert - ``dbConn`` -- mysql database connection - ``log`` -- logger **Return:** - None **Usage:** .. todo:: add usage info create a sublime snippet for ...
[ "*", "summary", "of", "function", "*" ]
python
train
28.448052
ph4r05/monero-serialize
monero_serialize/core/versioning.py
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/core/versioning.py#L18-L28
def is_elementary_type(elem_type): """ Returns True if the type is elementary - not versioned :param elem_type: :return: """ if not oh.is_type(elem_type, bt.XmrType): return False if oh.is_type(elem_type, (bt.UVarintType, bt.IntType, mt.UnicodeType)): ...
[ "def", "is_elementary_type", "(", "elem_type", ")", ":", "if", "not", "oh", ".", "is_type", "(", "elem_type", ",", "bt", ".", "XmrType", ")", ":", "return", "False", "if", "oh", ".", "is_type", "(", "elem_type", ",", "(", "bt", ".", "UVarintType", ",",...
Returns True if the type is elementary - not versioned :param elem_type: :return:
[ "Returns", "True", "if", "the", "type", "is", "elementary", "-", "not", "versioned", ":", "param", "elem_type", ":", ":", "return", ":" ]
python
train
32.181818
qiniu/python-sdk
qiniu/services/compute/app.py
https://github.com/qiniu/python-sdk/blob/a69fbef4e3e6ea1ebe09f4610a5b18bb2c17de59/qiniu/services/compute/app.py#L115-L127
def get_account_info(self): """获得当前账号的信息 查看当前请求方(请求鉴权使用的 AccessKey 的属主)的账号信息。 Returns: 返回一个tuple对象,其格式为(<result>, <ResponseInfo>) - result 成功返回用户信息,失败返回None - ResponseInfo 请求的Response信息 """ url = '{0}/v3/info'.format(self.host) ...
[ "def", "get_account_info", "(", "self", ")", ":", "url", "=", "'{0}/v3/info'", ".", "format", "(", "self", ".", "host", ")", "return", "http", ".", "_get_with_qiniu_mac", "(", "url", ",", "None", ",", "self", ".", "auth", ")" ]
获得当前账号的信息 查看当前请求方(请求鉴权使用的 AccessKey 的属主)的账号信息。 Returns: 返回一个tuple对象,其格式为(<result>, <ResponseInfo>) - result 成功返回用户信息,失败返回None - ResponseInfo 请求的Response信息
[ "获得当前账号的信息" ]
python
train
28.307692
tjcsl/ion
intranet/apps/welcome/views.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/welcome/views.py#L13-L19
def student_welcome_view(request): """Welcome/first run page for students.""" if not request.user.is_student: return redirect("index") # context = {"first_login": request.session["first_login"] if "first_login" in request.session else False} # return render(request, "welcome/old_student.html", c...
[ "def", "student_welcome_view", "(", "request", ")", ":", "if", "not", "request", ".", "user", ".", "is_student", ":", "return", "redirect", "(", "\"index\"", ")", "# context = {\"first_login\": request.session[\"first_login\"] if \"first_login\" in request.session else False}",...
Welcome/first run page for students.
[ "Welcome", "/", "first", "run", "page", "for", "students", "." ]
python
train
53.571429
wiredrive/wtframework
wtframework/wtf/web/webdriver.py
https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L163-L195
def __create_driver_from_browser_config(self): ''' Reads the config value for browser type. ''' try: browser_type = self._config_reader.get( WebDriverFactory.BROWSER_TYPE_CONFIG) except KeyError: _wtflog("%s missing is missing from config f...
[ "def", "__create_driver_from_browser_config", "(", "self", ")", ":", "try", ":", "browser_type", "=", "self", ".", "_config_reader", ".", "get", "(", "WebDriverFactory", ".", "BROWSER_TYPE_CONFIG", ")", "except", "KeyError", ":", "_wtflog", "(", "\"%s missing is mis...
Reads the config value for browser type.
[ "Reads", "the", "config", "value", "for", "browser", "type", "." ]
python
train
40.757576
rytilahti/python-songpal
songpal/device.py
https://github.com/rytilahti/python-songpal/blob/0443de6b3d960b9067a851d82261ca00e46b4618/songpal/device.py#L410-L413
async def set_speaker_settings(self, target: str, value: str): """Set speaker settings.""" params = {"settings": [{"target": target, "value": value}]} return await self.services["audio"]["setSpeakerSettings"](params)
[ "async", "def", "set_speaker_settings", "(", "self", ",", "target", ":", "str", ",", "value", ":", "str", ")", ":", "params", "=", "{", "\"settings\"", ":", "[", "{", "\"target\"", ":", "target", ",", "\"value\"", ":", "value", "}", "]", "}", "return",...
Set speaker settings.
[ "Set", "speaker", "settings", "." ]
python
train
59.25
Microsoft/botbuilder-python
libraries/botframework-connector/azure_bdist_wheel.py
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botframework-connector/azure_bdist_wheel.py#L153-L156
def wheel_dist_name(self): """Return distribution full name with - replaced with _""" return '-'.join((safer_name(self.distribution.get_name()), safer_version(self.distribution.get_version())))
[ "def", "wheel_dist_name", "(", "self", ")", ":", "return", "'-'", ".", "join", "(", "(", "safer_name", "(", "self", ".", "distribution", ".", "get_name", "(", ")", ")", ",", "safer_version", "(", "self", ".", "distribution", ".", "get_version", "(", ")",...
Return distribution full name with - replaced with _
[ "Return", "distribution", "full", "name", "with", "-", "replaced", "with", "_" ]
python
test
57.75
osrg/ryu
ryu/services/protocols/bgp/core.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core.py#L297-L356
def _compute_rtfilter_map(self): """Returns neighbor's RT filter (permit/allow filter based on RT). Walks RT filter tree and computes current RT filters for each peer that have advertised RT NLRIs. Returns: dict of peer, and `set` of rts that a particular neighbor is ...
[ "def", "_compute_rtfilter_map", "(", "self", ")", ":", "rtfilter_map", "=", "{", "}", "def", "get_neigh_filter", "(", "neigh", ")", ":", "neigh_filter", "=", "rtfilter_map", ".", "get", "(", "neigh", ")", "# Lazy creation of neighbor RT filter", "if", "neigh_filte...
Returns neighbor's RT filter (permit/allow filter based on RT). Walks RT filter tree and computes current RT filters for each peer that have advertised RT NLRIs. Returns: dict of peer, and `set` of rts that a particular neighbor is interested in.
[ "Returns", "neighbor", "s", "RT", "filter", "(", "permit", "/", "allow", "filter", "based", "on", "RT", ")", "." ]
python
train
43.25
oauthlib/oauthlib
oauthlib/common.py
https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L104-L113
def decode_params_utf8(params): """Ensures that all parameters in a list of 2-element tuples are decoded to unicode using UTF-8. """ decoded = [] for k, v in params: decoded.append(( k.decode('utf-8') if isinstance(k, bytes) else k, v.decode('utf-8') if isinstance(v, ...
[ "def", "decode_params_utf8", "(", "params", ")", ":", "decoded", "=", "[", "]", "for", "k", ",", "v", "in", "params", ":", "decoded", ".", "append", "(", "(", "k", ".", "decode", "(", "'utf-8'", ")", "if", "isinstance", "(", "k", ",", "bytes", ")",...
Ensures that all parameters in a list of 2-element tuples are decoded to unicode using UTF-8.
[ "Ensures", "that", "all", "parameters", "in", "a", "list", "of", "2", "-", "element", "tuples", "are", "decoded", "to", "unicode", "using", "UTF", "-", "8", "." ]
python
train
34.5
Cymmetria/honeycomb
honeycomb/commands/service/stop.py
https://github.com/Cymmetria/honeycomb/blob/33ea91b5cf675000e4e85dd02efe580ea6e95c86/honeycomb/commands/service/stop.py#L24-L57
def stop(ctx, service, editable): """Stop a running service daemon.""" logger.debug("running command %s (%s)", ctx.command.name, ctx.params, extra={"command": ctx.command.name, "params": ctx.params}) home = ctx.obj["HOME"] service_path = plugin_utils.get_plugin_path(home, SERVICES, ser...
[ "def", "stop", "(", "ctx", ",", "service", ",", "editable", ")", ":", "logger", ".", "debug", "(", "\"running command %s (%s)\"", ",", "ctx", ".", "command", ".", "name", ",", "ctx", ".", "params", ",", "extra", "=", "{", "\"command\"", ":", "ctx", "."...
Stop a running service daemon.
[ "Stop", "a", "running", "service", "daemon", "." ]
python
train
42.558824
OpenGov/carpenter
carpenter/blocks/cellanalyzer.py
https://github.com/OpenGov/carpenter/blob/0ab3c54c05133b9b0468c63e834a7ce3a6fb575b/carpenter/blocks/cellanalyzer.py#L44-L54
def check_cell_type(cell, cell_type): ''' Checks the cell type to see if it represents the cell_type passed in. Args: cell_type: The type id for a cell match or None for empty match. ''' if cell_type == None or cell_type == type(None): return cell == None or (isinstance(cell, basest...
[ "def", "check_cell_type", "(", "cell", ",", "cell_type", ")", ":", "if", "cell_type", "==", "None", "or", "cell_type", "==", "type", "(", "None", ")", ":", "return", "cell", "==", "None", "or", "(", "isinstance", "(", "cell", ",", "basestring", ")", "a...
Checks the cell type to see if it represents the cell_type passed in. Args: cell_type: The type id for a cell match or None for empty match.
[ "Checks", "the", "cell", "type", "to", "see", "if", "it", "represents", "the", "cell_type", "passed", "in", "." ]
python
train
34.727273
decryptus/sonicprobe
sonicprobe/libs/xys.py
https://github.com/decryptus/sonicprobe/blob/72f73f3a40d2982d79ad68686e36aa31d94b76f8/sonicprobe/libs/xys.py#L278-L282
def _split_params(tag_prefix, tag_suffix): "Split comma-separated tag_suffix[:-1] and map with _maybe_int" if tag_suffix[-1:] != ')': raise ValueError, "unbalanced parenthesis in type %s%s" % (tag_prefix, tag_suffix) return map(_maybe_int, tag_suffix[:-1].split(','))
[ "def", "_split_params", "(", "tag_prefix", ",", "tag_suffix", ")", ":", "if", "tag_suffix", "[", "-", "1", ":", "]", "!=", "')'", ":", "raise", "ValueError", ",", "\"unbalanced parenthesis in type %s%s\"", "%", "(", "tag_prefix", ",", "tag_suffix", ")", "retur...
Split comma-separated tag_suffix[:-1] and map with _maybe_int
[ "Split", "comma", "-", "separated", "tag_suffix", "[", ":", "-", "1", "]", "and", "map", "with", "_maybe_int" ]
python
train
56.6
csparpa/pyowm
pyowm/weatherapi25/owm25.py
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/weatherapi25/owm25.py#L210-L232
def weather_at_place(self, name): """ Queries the OWM Weather API for the currently observed weather at the specified toponym (eg: "London,uk") :param name: the location's toponym :type name: str or unicode :returns: an *Observation* instance or ``None`` if no weather da...
[ "def", "weather_at_place", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "str", ")", ",", "\"Value must be a string\"", "encoded_name", "=", "name", "params", "=", "{", "'q'", ":", "encoded_name", ",", "'lang'", ":", "self", ...
Queries the OWM Weather API for the currently observed weather at the specified toponym (eg: "London,uk") :param name: the location's toponym :type name: str or unicode :returns: an *Observation* instance or ``None`` if no weather data is available :raises: *ParseRes...
[ "Queries", "the", "OWM", "Weather", "API", "for", "the", "currently", "observed", "weather", "at", "the", "specified", "toponym", "(", "eg", ":", "London", "uk", ")" ]
python
train
46.043478
OCR-D/core
ocrd_validators/ocrd_validators/ocrd_zip_validator.py
https://github.com/OCR-D/core/blob/57e68c578526cb955fd2e368207f5386c459d91d/ocrd_validators/ocrd_validators/ocrd_zip_validator.py#L44-L49
def _validate_profile(self, bag): """ Validate against OCRD BagIt profile (bag-info fields, algos etc) """ if not self.profile_validator.validate(bag): raise Exception(str(self.profile_validator.report))
[ "def", "_validate_profile", "(", "self", ",", "bag", ")", ":", "if", "not", "self", ".", "profile_validator", ".", "validate", "(", "bag", ")", ":", "raise", "Exception", "(", "str", "(", "self", ".", "profile_validator", ".", "report", ")", ")" ]
Validate against OCRD BagIt profile (bag-info fields, algos etc)
[ "Validate", "against", "OCRD", "BagIt", "profile", "(", "bag", "-", "info", "fields", "algos", "etc", ")" ]
python
train
40.333333
ihgazni2/edict
edict/edict.py
https://github.com/ihgazni2/edict/blob/44a08ccc10b196aa3854619b4c51ddb246778a34/edict/edict.py#L1193-L1220
def _setitem_via_pathlist(external_dict,path_list,value,**kwargs): ''' y = {'c': {'b': {}}} _setitem_via_pathlist(y,['c','b'],200) ''' if('s2n' in kwargs): s2n = kwargs['s2n'] else: s2n = 0 if('n2s' in kwargs): n2s = kwargs['n2s'] else: n2s = 0 ...
[ "def", "_setitem_via_pathlist", "(", "external_dict", ",", "path_list", ",", "value", ",", "*", "*", "kwargs", ")", ":", "if", "(", "'s2n'", "in", "kwargs", ")", ":", "s2n", "=", "kwargs", "[", "'s2n'", "]", "else", ":", "s2n", "=", "0", "if", "(", ...
y = {'c': {'b': {}}} _setitem_via_pathlist(y,['c','b'],200)
[ "y", "=", "{", "c", ":", "{", "b", ":", "{}", "}}", "_setitem_via_pathlist", "(", "y", "[", "c", "b", "]", "200", ")" ]
python
train
24.678571
openstates/billy
billy/web/public/views/bills.py
https://github.com/openstates/billy/blob/5fc795347f12a949e410a8cfad0c911ea6bced67/billy/web/public/views/bills.py#L360-L401
def bill(request, abbr, session, bill_id): ''' Context: - vote_preview_row_template - abbr - metadata - bill - show_all_sponsors - sponsors - sources - nav_active Templates: - billy/web/public/bill.html - billy/web/public/vote_...
[ "def", "bill", "(", "request", ",", "abbr", ",", "session", ",", "bill_id", ")", ":", "# get fixed version", "fixed_bill_id", "=", "fix_bill_id", "(", "bill_id", ")", "# redirect if URL's id isn't fixed id without spaces", "if", "fixed_bill_id", ".", "replace", "(", ...
Context: - vote_preview_row_template - abbr - metadata - bill - show_all_sponsors - sponsors - sources - nav_active Templates: - billy/web/public/bill.html - billy/web/public/vote_preview_row.html
[ "Context", ":", "-", "vote_preview_row_template", "-", "abbr", "-", "metadata", "-", "bill", "-", "show_all_sponsors", "-", "sponsors", "-", "sources", "-", "nav_active" ]
python
train
33.119048
lingthio/Flask-User
flask_user/user_manager__utils.py
https://github.com/lingthio/Flask-User/blob/a379fa0a281789618c484b459cb41236779b95b1/flask_user/user_manager__utils.py#L54-L72
def make_safe_url(self, url): """Makes a URL safe by removing optional hostname and port. Example: | ``make_safe_url('https://hostname:80/path1/path2?q1=v1&q2=v2#fragment')`` | returns ``'/path1/path2?q1=v1&q2=v2#fragment'`` Override this method if you need to allow a ...
[ "def", "make_safe_url", "(", "self", ",", "url", ")", ":", "# Split the URL into scheme, netloc, path, query and fragment", "parts", "=", "list", "(", "urlsplit", "(", "url", ")", ")", "# Clear scheme and netloc and rebuild URL", "parts", "[", "0", "]", "=", "''", "...
Makes a URL safe by removing optional hostname and port. Example: | ``make_safe_url('https://hostname:80/path1/path2?q1=v1&q2=v2#fragment')`` | returns ``'/path1/path2?q1=v1&q2=v2#fragment'`` Override this method if you need to allow a list of safe hostnames.
[ "Makes", "a", "URL", "safe", "by", "removing", "optional", "hostname", "and", "port", "." ]
python
train
34.210526
matrix-org/matrix-python-sdk
matrix_client/room.py
https://github.com/matrix-org/matrix-python-sdk/blob/e734cce3ccd35f2d355c6a19a7a701033472498a/matrix_client/room.py#L189-L202
def send_location(self, geo_uri, name, thumb_url=None, **thumb_info): """Send a location to the room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-location for thumb_info Args: geo_uri (str): The geo uri representing the location. name (str): Desc...
[ "def", "send_location", "(", "self", ",", "geo_uri", ",", "name", ",", "thumb_url", "=", "None", ",", "*", "*", "thumb_info", ")", ":", "return", "self", ".", "client", ".", "api", ".", "send_location", "(", "self", ".", "room_id", ",", "geo_uri", ",",...
Send a location to the room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-location for thumb_info Args: geo_uri (str): The geo uri representing the location. name (str): Description for the location. thumb_url (str): URL to the thumbnail of th...
[ "Send", "a", "location", "to", "the", "room", "." ]
python
train
44.714286
kislyuk/aegea
aegea/packages/github3/repos/repo.py
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L314-L338
def archive(self, format, path='', ref='master'): """Get the tarball or zipball archive for this repo at ref. See: http://developer.github.com/v3/repos/contents/#get-archive-link :param str format: (required), accepted values: ('tarball', 'zipball') :param path: (optional),...
[ "def", "archive", "(", "self", ",", "format", ",", "path", "=", "''", ",", "ref", "=", "'master'", ")", ":", "resp", "=", "None", "if", "format", "in", "(", "'tarball'", ",", "'zipball'", ")", ":", "url", "=", "self", ".", "_build_url", "(", "forma...
Get the tarball or zipball archive for this repo at ref. See: http://developer.github.com/v3/repos/contents/#get-archive-link :param str format: (required), accepted values: ('tarball', 'zipball') :param path: (optional), path where the file should be saved to, default ...
[ "Get", "the", "tarball", "or", "zipball", "archive", "for", "this", "repo", "at", "ref", "." ]
python
train
39.64
numenta/nupic
src/nupic/swarming/hypersearch/particle.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch/particle.py#L332-L366
def copyVarStatesFrom(self, particleState, varNames): """Copy specific variables from particleState into this particle. Parameters: -------------------------------------------------------------- particleState: dict produced by a particle's getState() method varNames: which variab...
[ "def", "copyVarStatesFrom", "(", "self", ",", "particleState", ",", "varNames", ")", ":", "# Set this to false if you don't want the variable to move anymore", "# after we set the state", "allowedToMove", "=", "True", "for", "varName", "in", "particleState", "[", "'varStates...
Copy specific variables from particleState into this particle. Parameters: -------------------------------------------------------------- particleState: dict produced by a particle's getState() method varNames: which variables to copy
[ "Copy", "specific", "variables", "from", "particleState", "into", "this", "particle", "." ]
python
valid
36.771429
pyamg/pyamg
pyamg/aggregation/rootnode.py
https://github.com/pyamg/pyamg/blob/89dc54aa27e278f65d2f54bdaf16ab97d7768fa6/pyamg/aggregation/rootnode.py#L29-L310
def rootnode_solver(A, B=None, BH=None, symmetry='hermitian', strength='symmetric', aggregate='standard', smooth='energy', presmoother=('block_gauss_seidel', {'sweep': 'symmetric'}), postsmoother=('block_gau...
[ "def", "rootnode_solver", "(", "A", ",", "B", "=", "None", ",", "BH", "=", "None", ",", "symmetry", "=", "'hermitian'", ",", "strength", "=", "'symmetric'", ",", "aggregate", "=", "'standard'", ",", "smooth", "=", "'energy'", ",", "presmoother", "=", "("...
Create a multilevel solver using root-node based Smoothed Aggregation (SA). See the notes below, for the major differences with the classical-style smoothed aggregation solver in aggregation.smoothed_aggregation_solver. Parameters ---------- A : csr_matrix, bsr_matrix Sparse NxN matrix in ...
[ "Create", "a", "multilevel", "solver", "using", "root", "-", "node", "based", "Smoothed", "Aggregation", "(", "SA", ")", "." ]
python
train
44.70922
cstatz/maui
maui/mesh/rectilinear.py
https://github.com/cstatz/maui/blob/db99986e93699ee20c5cffdd5b4ee446f8607c5d/maui/mesh/rectilinear.py#L154-L165
def minimum_pitch(self): """ Returns the minimal pitch between two neighboring nodes of the mesh in each direction. :return: Minimal pitch in each direction. """ pitch = self.pitch minimal_pitch = [] for p in pitch: minimal_pitch.append(min(p)) retu...
[ "def", "minimum_pitch", "(", "self", ")", ":", "pitch", "=", "self", ".", "pitch", "minimal_pitch", "=", "[", "]", "for", "p", "in", "pitch", ":", "minimal_pitch", ".", "append", "(", "min", "(", "p", ")", ")", "return", "min", "(", "minimal_pitch", ...
Returns the minimal pitch between two neighboring nodes of the mesh in each direction. :return: Minimal pitch in each direction.
[ "Returns", "the", "minimal", "pitch", "between", "two", "neighboring", "nodes", "of", "the", "mesh", "in", "each", "direction", "." ]
python
train
27.5
timothyb0912/pylogit
pylogit/base_multinomial_cm_v2.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/base_multinomial_cm_v2.py#L1513-L1554
def fit_mle(self, init_vals, print_res=True, method="BFGS", loss_tol=1e-06, gradient_tol=1e-06, maxiter=1000, ridge=None, *args): """ Parameters ---------- init...
[ "def", "fit_mle", "(", "self", ",", "init_vals", ",", "print_res", "=", "True", ",", "method", "=", "\"BFGS\"", ",", "loss_tol", "=", "1e-06", ",", "gradient_tol", "=", "1e-06", ",", "maxiter", "=", "1000", ",", "ridge", "=", "None", ",", "*", "args", ...
Parameters ---------- init_vals : 1D ndarray. The initial values to start the optimizatin process with. There should be one value for each utility coefficient, outside intercept parameter, shape parameter, and nest parameter being estimated. print_res : bool, ...
[ "Parameters", "----------", "init_vals", ":", "1D", "ndarray", ".", "The", "initial", "values", "to", "start", "the", "optimizatin", "process", "with", ".", "There", "should", "be", "one", "value", "for", "each", "utility", "coefficient", "outside", "intercept",...
python
train
44.595238
philgyford/django-spectator
spectator/events/models.py
https://github.com/philgyford/django-spectator/blob/f3c72004f9caa1fde0f5a3b2f0d2bf285fc01ada/spectator/events/models.py#L231-L233
def kind_name(self): "e.g. 'Gig' or 'Movie'." return {k:v for (k,v) in self.KIND_CHOICES}[self.kind]
[ "def", "kind_name", "(", "self", ")", ":", "return", "{", "k", ":", "v", "for", "(", "k", ",", "v", ")", "in", "self", ".", "KIND_CHOICES", "}", "[", "self", ".", "kind", "]" ]
e.g. 'Gig' or 'Movie'.
[ "e", ".", "g", ".", "Gig", "or", "Movie", "." ]
python
train
38
amatellanes/fixerio
fixerio/client.py
https://github.com/amatellanes/fixerio/blob/0890e0ee3d39a2a3a2396d934c32bc9ed5f4c974/fixerio/client.py#L69-L97
def historical_rates(self, date, symbols=None): """ Get historical rates for any day since `date`. :param date: a date :type date: date or str :param symbols: currency symbols to request specific exchange rates. :type symbols: list or tuple :return: the historica...
[ "def", "historical_rates", "(", "self", ",", "date", ",", "symbols", "=", "None", ")", ":", "try", ":", "if", "isinstance", "(", "date", ",", "datetime", ".", "date", ")", ":", "# Convert date to ISO 8601 format.", "date", "=", "date", ".", "isoformat", "(...
Get historical rates for any day since `date`. :param date: a date :type date: date or str :param symbols: currency symbols to request specific exchange rates. :type symbols: list or tuple :return: the historical rates for any day since `date`. :rtype: dict :rais...
[ "Get", "historical", "rates", "for", "any", "day", "since", "date", "." ]
python
train
32.655172
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels_ext.py#L370-L383
def get_tunnel_statistics_input_filter_type_filter_by_gateway_gw_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_tunnel_statistics = ET.Element("get_tunnel_statistics") config = get_tunnel_statistics input = ET.SubElement(get_tunnel_stat...
[ "def", "get_tunnel_statistics_input_filter_type_filter_by_gateway_gw_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_tunnel_statistics", "=", "ET", ".", "Element", "(", "\"get_tunnel_statistics\"...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
46.785714
numenta/htmresearch
projects/union_path_integration/capacity_simulation.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/union_path_integration/capacity_simulation.py#L70-L255
def doExperiment(locationModuleWidth, bumpType, cellCoordinateOffsets, initialIncrement, minAccuracy, capacityResolution, capacityPercentageResolution, featuresPerObject, objectWidth, ...
[ "def", "doExperiment", "(", "locationModuleWidth", ",", "bumpType", ",", "cellCoordinateOffsets", ",", "initialIncrement", ",", "minAccuracy", ",", "capacityResolution", ",", "capacityPercentageResolution", ",", "featuresPerObject", ",", "objectWidth", ",", "numFeatures", ...
Finds the capacity of the specified model and object configuration. The algorithm has two stages. First it finds an upper bound for the capacity by repeatedly incrementing the number of objects by initialIncrement. After it finds a number of objects that is above capacity, it begins the second stage: performing...
[ "Finds", "the", "capacity", "of", "the", "specified", "model", "and", "object", "configuration", ".", "The", "algorithm", "has", "two", "stages", ".", "First", "it", "finds", "an", "upper", "bound", "for", "the", "capacity", "by", "repeatedly", "incrementing",...
python
train
31.607527
arne-cl/discoursegraphs
src/discoursegraphs/readwrite/rst/rs3/rs3filewriter.py
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/readwrite/rst/rs3/rs3filewriter.py#L221-L253
def get_relname_and_parent(self, treepos): """Return the (relation name, parent ID) tuple that a node is in. Return None if this node is not in a relation. """ node = self.dgtree[treepos] node_type = get_node_type(node) assert node_type in (TreeNodeTypes.relation_node, Tr...
[ "def", "get_relname_and_parent", "(", "self", ",", "treepos", ")", ":", "node", "=", "self", ".", "dgtree", "[", "treepos", "]", "node_type", "=", "get_node_type", "(", "node", ")", "assert", "node_type", "in", "(", "TreeNodeTypes", ".", "relation_node", ","...
Return the (relation name, parent ID) tuple that a node is in. Return None if this node is not in a relation.
[ "Return", "the", "(", "relation", "name", "parent", "ID", ")", "tuple", "that", "a", "node", "is", "in", ".", "Return", "None", "if", "this", "node", "is", "not", "in", "a", "relation", "." ]
python
train
45.939394