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
seequent/properties
properties/handlers.py
https://github.com/seequent/properties/blob/096b07012fff86b0a880c8c018320c3b512751b9/properties/handlers.py#L89-L98
def _set_listener(instance, obs): """Add listeners to a HasProperties instance""" if obs.names is everything: names = list(instance._props) else: names = obs.names for name in names: if name not in instance._listeners: instance._listeners[name] = {typ: [] for typ in L...
[ "def", "_set_listener", "(", "instance", ",", "obs", ")", ":", "if", "obs", ".", "names", "is", "everything", ":", "names", "=", "list", "(", "instance", ".", "_props", ")", "else", ":", "names", "=", "obs", ".", "names", "for", "name", "in", "names"...
Add listeners to a HasProperties instance
[ "Add", "listeners", "to", "a", "HasProperties", "instance" ]
python
train
37.8
lark-parser/lark
lark/parsers/cyk.py
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L242-L247
def get_any_nt_unit_rule(g): """Returns a non-terminal unit rule from 'g', or None if there is none.""" for rule in g.rules: if len(rule.rhs) == 1 and isinstance(rule.rhs[0], NT): return rule return None
[ "def", "get_any_nt_unit_rule", "(", "g", ")", ":", "for", "rule", "in", "g", ".", "rules", ":", "if", "len", "(", "rule", ".", "rhs", ")", "==", "1", "and", "isinstance", "(", "rule", ".", "rhs", "[", "0", "]", ",", "NT", ")", ":", "return", "r...
Returns a non-terminal unit rule from 'g', or None if there is none.
[ "Returns", "a", "non", "-", "terminal", "unit", "rule", "from", "g", "or", "None", "if", "there", "is", "none", "." ]
python
train
38.333333
dhermes/bezier
src/bezier/curved_polygon.py
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/curved_polygon.py#L220-L252
def area(self): r"""The area of the current curved polygon. This assumes, but does not check, that the current curved polygon is valid (i.e. it is bounded by the edges). This computes the area via Green's theorem. Using the vector field :math:`\mathbf{F} = \left[-y, x\right]^T`...
[ "def", "area", "(", "self", ")", ":", "edges", "=", "tuple", "(", "edge", ".", "_nodes", "for", "edge", "in", "self", ".", "_edges", ")", "return", "_surface_helpers", ".", "compute_area", "(", "edges", ")" ]
r"""The area of the current curved polygon. This assumes, but does not check, that the current curved polygon is valid (i.e. it is bounded by the edges). This computes the area via Green's theorem. Using the vector field :math:`\mathbf{F} = \left[-y, x\right]^T`, since :math:`\...
[ "r", "The", "area", "of", "the", "current", "curved", "polygon", "." ]
python
train
34.969697
jmoiron/johnny-cache
johnny/cache.py
https://github.com/jmoiron/johnny-cache/blob/d96ea94c5dfcde517ff8f65d6ba4e435d8a0168c/johnny/cache.py#L222-L230
def get_single_generation(self, table, db='default'): """Creates a random generation value for a single table name""" key = self.keygen.gen_table_key(table, db) val = self.cache_backend.get(key, None, db) #if local.get('in_test', None): print force_bytes(val).ljust(32), key if va...
[ "def", "get_single_generation", "(", "self", ",", "table", ",", "db", "=", "'default'", ")", ":", "key", "=", "self", ".", "keygen", ".", "gen_table_key", "(", "table", ",", "db", ")", "val", "=", "self", ".", "cache_backend", ".", "get", "(", "key", ...
Creates a random generation value for a single table name
[ "Creates", "a", "random", "generation", "value", "for", "a", "single", "table", "name" ]
python
train
52
rm-hull/luma.core
luma/core/image_composition.py
https://github.com/rm-hull/luma.core/blob/034b628fb304a01e77732a299c0b42e94d6443db/luma/core/image_composition.py#L111-L124
def _crop_box(self, size): """ Helper that calculates the crop box for the offset within the image. :param size: The width and height of the image composition. :type size: tuple :returns: The bounding box of the image, given ``size``. :rtype: tuple """ (l...
[ "def", "_crop_box", "(", "self", ",", "size", ")", ":", "(", "left", ",", "top", ")", "=", "self", ".", "offset", "right", "=", "left", "+", "min", "(", "size", "[", "0", "]", ",", "self", ".", "width", ")", "bottom", "=", "top", "+", "min", ...
Helper that calculates the crop box for the offset within the image. :param size: The width and height of the image composition. :type size: tuple :returns: The bounding box of the image, given ``size``. :rtype: tuple
[ "Helper", "that", "calculates", "the", "crop", "box", "for", "the", "offset", "within", "the", "image", "." ]
python
train
33.571429
pymupdf/PyMuPDF
fitz/fitz.py
https://github.com/pymupdf/PyMuPDF/blob/917f2d83482510e26ba0ff01fd2392c26f3a8e90/fitz/fitz.py#L4300-L4321
def _extractText(self, format): """_extractText(self, format) -> PyObject *""" val = _fitz.TextPage__extractText(self, format) if format != 2: return val import base64, json class b64encode(json.JSONEncoder): def default(self,s): if not f...
[ "def", "_extractText", "(", "self", ",", "format", ")", ":", "val", "=", "_fitz", ".", "TextPage__extractText", "(", "self", ",", "format", ")", "if", "format", "!=", "2", ":", "return", "val", "import", "base64", ",", "json", "class", "b64encode", "(", ...
_extractText(self, format) -> PyObject *
[ "_extractText", "(", "self", "format", ")", "-", ">", "PyObject", "*" ]
python
train
31.590909
mistio/mist.client
src/mistclient/model.py
https://github.com/mistio/mist.client/blob/bc190af2cba358fa556a69b205c12a77a34eb2a8/src/mistclient/model.py#L90-L103
def disable(self): """ Disable the Cloud. :returns: A list of mist.clients' updated clouds. """ payload = { "new_state": "0" } data = json.dumps(payload) req = self.request(self.mist_client.uri+'/clouds/'+self.id, data=data) req.post(...
[ "def", "disable", "(", "self", ")", ":", "payload", "=", "{", "\"new_state\"", ":", "\"0\"", "}", "data", "=", "json", ".", "dumps", "(", "payload", ")", "req", "=", "self", ".", "request", "(", "self", ".", "mist_client", ".", "uri", "+", "'/clouds/...
Disable the Cloud. :returns: A list of mist.clients' updated clouds.
[ "Disable", "the", "Cloud", "." ]
python
train
27
urschrei/pyzotero
pyzotero/zotero.py
https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L512-L517
def fulltext_item(self, itemkey, **kwargs): """ Get full-text content for an item""" query_string = "/{t}/{u}/items/{itemkey}/fulltext".format( t=self.library_type, u=self.library_id, itemkey=itemkey ) return self._build_query(query_string)
[ "def", "fulltext_item", "(", "self", ",", "itemkey", ",", "*", "*", "kwargs", ")", ":", "query_string", "=", "\"/{t}/{u}/items/{itemkey}/fulltext\"", ".", "format", "(", "t", "=", "self", ".", "library_type", ",", "u", "=", "self", ".", "library_id", ",", ...
Get full-text content for an item
[ "Get", "full", "-", "text", "content", "for", "an", "item" ]
python
valid
46.5
googleapis/google-auth-library-python
google/auth/_default.py
https://github.com/googleapis/google-auth-library-python/blob/2c6ad78917e936f38f87c946209c8031166dc96e/google/auth/_default.py#L173-L187
def _get_gae_credentials(): """Gets Google App Engine App Identity credentials and project ID.""" # While this library is normally bundled with app_engine, there are # some cases where it's not available, so we tolerate ImportError. try: import google.auth.app_engine as app_engine except Imp...
[ "def", "_get_gae_credentials", "(", ")", ":", "# While this library is normally bundled with app_engine, there are", "# some cases where it's not available, so we tolerate ImportError.", "try", ":", "import", "google", ".", "auth", ".", "app_engine", "as", "app_engine", "except", ...
Gets Google App Engine App Identity credentials and project ID.
[ "Gets", "Google", "App", "Engine", "App", "Identity", "credentials", "and", "project", "ID", "." ]
python
train
36.066667
noxdafox/clipspy
clips/facts.py
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L238-L247
def assertit(self): """Assert the fact within CLIPS.""" data = clips.data.DataObject(self._env) data.value = list(self._multifield) if lib.EnvPutFactSlot( self._env, self._fact, ffi.NULL, data.byref) != 1: raise CLIPSError(self._env) super(ImpliedFac...
[ "def", "assertit", "(", "self", ")", ":", "data", "=", "clips", ".", "data", ".", "DataObject", "(", "self", ".", "_env", ")", "data", ".", "value", "=", "list", "(", "self", ".", "_multifield", ")", "if", "lib", ".", "EnvPutFactSlot", "(", "self", ...
Assert the fact within CLIPS.
[ "Assert", "the", "fact", "within", "CLIPS", "." ]
python
train
33
semiversus/python-broqer
broqer/publisher.py
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/publisher.py#L45-L68
def subscribe(self, subscriber: 'Subscriber', prepend: bool = False) -> SubscriptionDisposable: """ Subscribing the given subscriber. :param subscriber: subscriber to add :param prepend: For internal use - usually the subscribers will be added at the end of a list....
[ "def", "subscribe", "(", "self", ",", "subscriber", ":", "'Subscriber'", ",", "prepend", ":", "bool", "=", "False", ")", "->", "SubscriptionDisposable", ":", "# `subscriber in self._subscriptions` is not working because", "# tuple.__contains__ is using __eq__ which is overwritt...
Subscribing the given subscriber. :param subscriber: subscriber to add :param prepend: For internal use - usually the subscribers will be added at the end of a list. When prepend is True, it will be added in front of the list. This will habe an effect in the order the ...
[ "Subscribing", "the", "given", "subscriber", "." ]
python
train
43.708333
omza/azurestoragewrap
azurestoragewrap/queue.py
https://github.com/omza/azurestoragewrap/blob/976878e95d82ff0f7d8a00a5e4a7a3fb6268ab08/azurestoragewrap/queue.py#L75-L92
def mergemessage(self, message): """ parse OueueMessage in Model vars """ if isinstance(message, QueueMessage): """ merge queue message vars """ for key, value in vars(message).items(): if not value is None: setattr(self, key, value) ...
[ "def", "mergemessage", "(", "self", ",", "message", ")", ":", "if", "isinstance", "(", "message", ",", "QueueMessage", ")", ":", "\"\"\" merge queue message vars \"\"\"", "for", "key", ",", "value", "in", "vars", "(", "message", ")", ".", "items", "(", ")", ...
parse OueueMessage in Model vars
[ "parse", "OueueMessage", "in", "Model", "vars" ]
python
train
60.388889
xoolive/traffic
traffic/core/aero.py
https://github.com/xoolive/traffic/blob/d1a8878098f16759f6b6e0e8d8b8f32e34a680a8/traffic/core/aero.py#L102-L106
def veas2tas(eas, h): """ Equivalent airspeed to true airspeed """ rho = vdensity(h) tas = eas * np.sqrt(rho0 / rho) return tas
[ "def", "veas2tas", "(", "eas", ",", "h", ")", ":", "rho", "=", "vdensity", "(", "h", ")", "tas", "=", "eas", "*", "np", ".", "sqrt", "(", "rho0", "/", "rho", ")", "return", "tas" ]
Equivalent airspeed to true airspeed
[ "Equivalent", "airspeed", "to", "true", "airspeed" ]
python
train
27.8
trevisanj/a99
a99/gui/xmisc.py
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/gui/xmisc.py#L432-L444
def connect_all(self): """[Re-]connects all signals and slots. If already in "connected" state, ignores the call. """ if self.__connected: return # assert not self.__connected, "connect_all() already in \"connected\" state" with self.__lock: for ...
[ "def", "connect_all", "(", "self", ")", ":", "if", "self", ".", "__connected", ":", "return", "# assert not self.__connected, \"connect_all() already in \\\"connected\\\" state\"\r", "with", "self", ".", "__lock", ":", "for", "signal", "in", "self", ".", "__signals", ...
[Re-]connects all signals and slots. If already in "connected" state, ignores the call.
[ "[", "Re", "-", "]", "connects", "all", "signals", "and", "slots", ".", "If", "already", "in", "connected", "state", "ignores", "the", "call", "." ]
python
train
41.153846
GoogleCloudPlatform/google-cloud-datastore
python/googledatastore/datastore_emulator.py
https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/a23940d0634d7f537faf01ad9e60598046bcb40a/python/googledatastore/datastore_emulator.py#L170-L198
def _WaitForStartup(self, deadline): """Waits for the emulator to start. Args: deadline: deadline in seconds Returns: True if the emulator responds within the deadline, False otherwise. """ start = time.time() sleep = 0.05 def Elapsed(): return time.time() - start w...
[ "def", "_WaitForStartup", "(", "self", ",", "deadline", ")", ":", "start", "=", "time", ".", "time", "(", ")", "sleep", "=", "0.05", "def", "Elapsed", "(", ")", ":", "return", "time", ".", "time", "(", ")", "-", "start", "while", "True", ":", "try"...
Waits for the emulator to start. Args: deadline: deadline in seconds Returns: True if the emulator responds within the deadline, False otherwise.
[ "Waits", "for", "the", "emulator", "to", "start", "." ]
python
train
24.344828
pandas-dev/pandas
pandas/io/parsers.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/parsers.py#L2858-L2892
def _next_iter_line(self, row_num): """ Wrapper around iterating through `self.data` (CSV source). When a CSV error is raised, we check for specific error messages that allow us to customize the error message displayed to the user. Parameters ---------- ...
[ "def", "_next_iter_line", "(", "self", ",", "row_num", ")", ":", "try", ":", "return", "next", "(", "self", ".", "data", ")", "except", "csv", ".", "Error", "as", "e", ":", "if", "self", ".", "warn_bad_lines", "or", "self", ".", "error_bad_lines", ":",...
Wrapper around iterating through `self.data` (CSV source). When a CSV error is raised, we check for specific error messages that allow us to customize the error message displayed to the user. Parameters ---------- row_num : The row number of the line being parsed.
[ "Wrapper", "around", "iterating", "through", "self", ".", "data", "(", "CSV", "source", ")", "." ]
python
train
37.142857
tomturner/django-tenants
django_tenants/models.py
https://github.com/tomturner/django-tenants/blob/f3e06e2b0facee7ed797e5694bcac433df3e5315/django_tenants/models.py#L148-L154
def delete(self, force_drop=False, *args, **kwargs): """ Deletes this row. Drops the tenant's schema if the attribute auto_drop_schema set to True. """ self._drop_schema(force_drop) super().delete(*args, **kwargs)
[ "def", "delete", "(", "self", ",", "force_drop", "=", "False", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_drop_schema", "(", "force_drop", ")", "super", "(", ")", ".", "delete", "(", "*", "args", ",", "*", "*", "kwargs", ...
Deletes this row. Drops the tenant's schema if the attribute auto_drop_schema set to True.
[ "Deletes", "this", "row", ".", "Drops", "the", "tenant", "s", "schema", "if", "the", "attribute", "auto_drop_schema", "set", "to", "True", "." ]
python
train
36.428571
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/model_booster/queryable_mixin.py
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/model_booster/queryable_mixin.py#L135-L174
def _preprocess_params(cls, kwargs): """Returns a preprocessed dictionary of parameters. Use this to filter the kwargs passed to `new`, `create`, `build` methods. Args: **kwargs: a dictionary of parameters """ # kwargs.pop('csrf_token', None) for att...
[ "def", "_preprocess_params", "(", "cls", ",", "kwargs", ")", ":", "# kwargs.pop('csrf_token', None)", "for", "attr", ",", "val", "in", "kwargs", ".", "items", "(", ")", ":", "if", "cls", ".", "is_the_primary_key", "(", "attr", ")", "and", "cls", ".", "_pre...
Returns a preprocessed dictionary of parameters. Use this to filter the kwargs passed to `new`, `create`, `build` methods. Args: **kwargs: a dictionary of parameters
[ "Returns", "a", "preprocessed", "dictionary", "of", "parameters", ".", "Use", "this", "to", "filter", "the", "kwargs", "passed", "to", "new", "create", "build", "methods", "." ]
python
train
51.425
thiagopbueno/rddl2tf
rddl2tf/compiler.py
https://github.com/thiagopbueno/rddl2tf/blob/f7c03d3a74d2663807c1e23e04eeed2e85166b71/rddl2tf/compiler.py#L260-L279
def compile_state_action_constraints(self, state: Sequence[tf.Tensor], action: Sequence[tf.Tensor]) -> List[TensorFluent]: '''Compiles the state-action constraints given current `state` and `action` fluents. Args: state (Sequence[tf.Tensor]): The current state fluent...
[ "def", "compile_state_action_constraints", "(", "self", ",", "state", ":", "Sequence", "[", "tf", ".", "Tensor", "]", ",", "action", ":", "Sequence", "[", "tf", ".", "Tensor", "]", ")", "->", "List", "[", "TensorFluent", "]", ":", "scope", "=", "self", ...
Compiles the state-action constraints given current `state` and `action` fluents. Args: state (Sequence[tf.Tensor]): The current state fluents. action (Sequence[tf.Tensor]): The action fluents. Returns: A list of :obj:`rddl2tf.fluent.TensorFluent`.
[ "Compiles", "the", "state", "-", "action", "constraints", "given", "current", "state", "and", "action", "fluents", "." ]
python
train
41.5
opengridcc/opengrid
opengrid/library/utils.py
https://github.com/opengridcc/opengrid/blob/69b8da3c8fcea9300226c45ef0628cd6d4307651/opengrid/library/utils.py#L10-L47
def week_schedule(index, on_time=None, off_time=None, off_days=None): """ Return boolean time series following given week schedule. Parameters ---------- index : pandas.DatetimeIndex Datetime index on_time : str or datetime.time Daily opening time. Default: '09:00' off_time : st...
[ "def", "week_schedule", "(", "index", ",", "on_time", "=", "None", ",", "off_time", "=", "None", ",", "off_days", "=", "None", ")", ":", "if", "on_time", "is", "None", ":", "on_time", "=", "'9:00'", "if", "off_time", "is", "None", ":", "off_time", "=",...
Return boolean time series following given week schedule. Parameters ---------- index : pandas.DatetimeIndex Datetime index on_time : str or datetime.time Daily opening time. Default: '09:00' off_time : str or datetime.time Daily closing time. Default: '17:00' off_days :...
[ "Return", "boolean", "time", "series", "following", "given", "week", "schedule", "." ]
python
train
33.973684
saltstack/salt
salt/modules/swift.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swift.py#L107-L124
def delete(cont, path=None, profile=None): ''' Delete a container, or delete an object from a container. CLI Example to delete a container:: salt myminion swift.delete mycontainer CLI Example to delete an object from a container:: salt myminion swift.delete mycontainer remoteobject ...
[ "def", "delete", "(", "cont", ",", "path", "=", "None", ",", "profile", "=", "None", ")", ":", "swift_conn", "=", "_auth", "(", "profile", ")", "if", "path", "is", "None", ":", "return", "swift_conn", ".", "delete_container", "(", "cont", ")", "else", ...
Delete a container, or delete an object from a container. CLI Example to delete a container:: salt myminion swift.delete mycontainer CLI Example to delete an object from a container:: salt myminion swift.delete mycontainer remoteobject
[ "Delete", "a", "container", "or", "delete", "an", "object", "from", "a", "container", "." ]
python
train
26.333333
numenta/htmresearch
htmresearch/algorithms/TM.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/algorithms/TM.py#L1200-L1375
def learn(self, bottomUpInput): """ Parameters: -------------------------------------------- input: Current bottom-up input retval: ? """ self.lrnIterationIdx = self.lrnIterationIdx + 1 self.iterationIdx = self.iterationIdx + 1 if self.verbosity >= 3: print "\n===...
[ "def", "learn", "(", "self", ",", "bottomUpInput", ")", ":", "self", ".", "lrnIterationIdx", "=", "self", ".", "lrnIterationIdx", "+", "1", "self", ".", "iterationIdx", "=", "self", ".", "iterationIdx", "+", "1", "if", "self", ".", "verbosity", ">=", "3"...
Parameters: -------------------------------------------- input: Current bottom-up input retval: ?
[ "Parameters", ":", "--------------------------------------------", "input", ":", "Current", "bottom", "-", "up", "input", "retval", ":", "?" ]
python
train
39.857955
LogicalDash/LiSE
allegedb/allegedb/query.py
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L468-L474
def exist_edge(self, graph, orig, dest, idx, branch, turn, tick, extant): """Declare whether or not this edge exists.""" if (branch, turn, tick) in self._btts: raise TimeError self._btts.add((branch, turn, tick)) graph, orig, dest = map(self.pack, (graph, orig, dest)) ...
[ "def", "exist_edge", "(", "self", ",", "graph", ",", "orig", ",", "dest", ",", "idx", ",", "branch", ",", "turn", ",", "tick", ",", "extant", ")", ":", "if", "(", "branch", ",", "turn", ",", "tick", ")", "in", "self", ".", "_btts", ":", "raise", ...
Declare whether or not this edge exists.
[ "Declare", "whether", "or", "not", "this", "edge", "exists", "." ]
python
train
55.857143
briancappello/flask-unchained
flask_unchained/bundles/controller/utils.py
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/controller/utils.py#L263-L284
def _url_for(endpoint: str, **values) -> Union[str, None]: """ The same as flask's url_for, except this also supports building external urls for hosts that are different from app.config.SERVER_NAME. One case where this is especially useful is for single page apps, where the frontend is not hosted by...
[ "def", "_url_for", "(", "endpoint", ":", "str", ",", "*", "*", "values", ")", "->", "Union", "[", "str", ",", "None", "]", ":", "_external_host", "=", "values", ".", "pop", "(", "'_external_host'", ",", "None", ")", "is_external", "=", "bool", "(", "...
The same as flask's url_for, except this also supports building external urls for hosts that are different from app.config.SERVER_NAME. One case where this is especially useful is for single page apps, where the frontend is not hosted by the same server as the backend, but the backend still needs to gen...
[ "The", "same", "as", "flask", "s", "url_for", "except", "this", "also", "supports", "building", "external", "urls", "for", "hosts", "that", "are", "different", "from", "app", ".", "config", ".", "SERVER_NAME", ".", "One", "case", "where", "this", "is", "es...
python
train
46.954545
dls-controls/pymalcolm
malcolm/core/context.py
https://github.com/dls-controls/pymalcolm/blob/80ea667e4da26365a6cebc0249f52fdc744bd983/malcolm/core/context.py#L362-L373
def sleep(self, seconds): """Services all futures while waiting Args: seconds (float): Time to wait """ until = time.time() + seconds try: while True: self._service_futures([], until) except TimeoutError: return
[ "def", "sleep", "(", "self", ",", "seconds", ")", ":", "until", "=", "time", ".", "time", "(", ")", "+", "seconds", "try", ":", "while", "True", ":", "self", ".", "_service_futures", "(", "[", "]", ",", "until", ")", "except", "TimeoutError", ":", ...
Services all futures while waiting Args: seconds (float): Time to wait
[ "Services", "all", "futures", "while", "waiting" ]
python
train
25.083333
project-rig/rig
rig/machine_control/machine_controller.py
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/machine_control/machine_controller.py#L677-L718
def read_struct_field(self, struct_name, field_name, x, y, p=0): """Read the value out of a struct maintained by SARK. This method is particularly useful for reading fields from the ``sv`` struct which, for example, holds information about system status. See ``sark.h`` for details. ...
[ "def", "read_struct_field", "(", "self", ",", "struct_name", ",", "field_name", ",", "x", ",", "y", ",", "p", "=", "0", ")", ":", "# Look up the struct and field", "field", ",", "address", ",", "pack_chars", "=", "self", ".", "_get_struct_field_and_address", "...
Read the value out of a struct maintained by SARK. This method is particularly useful for reading fields from the ``sv`` struct which, for example, holds information about system status. See ``sark.h`` for details. Parameters ---------- struct_name : string ...
[ "Read", "the", "value", "out", "of", "a", "struct", "maintained", "by", "SARK", "." ]
python
train
31.380952
opendatateam/udata
udata/harvest/backends/base.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/harvest/backends/base.py#L265-L304
def validate(self, data, schema): '''Perform a data validation against a given schema. :param data: an object to validate :param schema: a Voluptous schema to validate against ''' try: return schema(data) except MultipleInvalid as ie: errors = [] ...
[ "def", "validate", "(", "self", ",", "data", ",", "schema", ")", ":", "try", ":", "return", "schema", "(", "data", ")", "except", "MultipleInvalid", "as", "ie", ":", "errors", "=", "[", "]", "for", "error", "in", "ie", ".", "errors", ":", "if", "er...
Perform a data validation against a given schema. :param data: an object to validate :param schema: a Voluptous schema to validate against
[ "Perform", "a", "data", "validation", "against", "a", "given", "schema", "." ]
python
train
38.1
hollenstein/maspy
maspy/core.py
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L1804-L1835
def getArrays(self, attr=None, specfiles=None, sort=False, reverse=False, selector=None, defaultValue=None): """Return a condensed array of data selected from :class:`Fi` instances from ``self.container`` for fast and convenient data processing. :param attr: list of :class:`Fi...
[ "def", "getArrays", "(", "self", ",", "attr", "=", "None", ",", "specfiles", "=", "None", ",", "sort", "=", "False", ",", "reverse", "=", "False", ",", "selector", "=", "None", ",", "defaultValue", "=", "None", ")", ":", "selector", "=", "(", "lambda...
Return a condensed array of data selected from :class:`Fi` instances from ``self.container`` for fast and convenient data processing. :param attr: list of :class:`Fi` item attributes that should be added to the returned array. The attributes "id" and "specfile" are always includ...
[ "Return", "a", "condensed", "array", "of", "data", "selected", "from", ":", "class", ":", "Fi", "instances", "from", "self", ".", "container", "for", "fast", "and", "convenient", "data", "processing", "." ]
python
train
55.375
tradenity/python-sdk
tradenity/resources/product.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/product.py#L1195-L1215
def delete_product_by_id(cls, product_id, **kwargs): """Delete Product Delete an instance of Product by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.delete_product_by_id(product_id,...
[ "def", "delete_product_by_id", "(", "cls", ",", "product_id", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", "_delete_product_by_id_w...
Delete Product Delete an instance of Product by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.delete_product_by_id(product_id, async=True) >>> result = thread.get() :param a...
[ "Delete", "Product" ]
python
train
40.952381
codelv/enaml-native
src/enamlnative/android/android_swipe_refresh_layout.py
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_swipe_refresh_layout.py#L52-L68
def init_widget(self): """ Initialize the underlying widget. """ super(AndroidSwipeRefreshLayout, self).init_widget() d = self.declaration w = self.widget if not d.enabled: self.set_enabled(d.enabled) if d.indicator_background_color: self....
[ "def", "init_widget", "(", "self", ")", ":", "super", "(", "AndroidSwipeRefreshLayout", ",", "self", ")", ".", "init_widget", "(", ")", "d", "=", "self", ".", "declaration", "w", "=", "self", ".", "widget", "if", "not", "d", ".", "enabled", ":", "self"...
Initialize the underlying widget.
[ "Initialize", "the", "underlying", "widget", "." ]
python
train
36.823529
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L6106-L6162
def gfposc(target, inframe, abcorr, obsrvr, crdsys, coord, relate, refval, adjust, step, nintvals, cnfine, result=None): """ Determine time intervals for which a coordinate of an observer-target position vector satisfies a numerical constraint. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/...
[ "def", "gfposc", "(", "target", ",", "inframe", ",", "abcorr", ",", "obsrvr", ",", "crdsys", ",", "coord", ",", "relate", ",", "refval", ",", "adjust", ",", "step", ",", "nintvals", ",", "cnfine", ",", "result", "=", "None", ")", ":", "assert", "isin...
Determine time intervals for which a coordinate of an observer-target position vector satisfies a numerical constraint. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfposc_c.html :param target: Name of the target body. :type target: str :param inframe: Name of the reference frame for co...
[ "Determine", "time", "intervals", "for", "which", "a", "coordinate", "of", "an", "observer", "-", "target", "position", "vector", "satisfies", "a", "numerical", "constraint", "." ]
python
train
39.982456
marcomusy/vtkplotter
vtkplotter/analysis.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/analysis.py#L457-L485
def normalLines(actor, ratio=1, c=(0.6, 0.6, 0.6), alpha=0.8): """ Build an ``vtkActor`` made of the normals at vertices shown as lines. """ maskPts = vtk.vtkMaskPoints() maskPts.SetOnRatio(ratio) maskPts.RandomModeOff() actor = actor.computeNormals() src = actor.polydata() maskPts.S...
[ "def", "normalLines", "(", "actor", ",", "ratio", "=", "1", ",", "c", "=", "(", "0.6", ",", "0.6", ",", "0.6", ")", ",", "alpha", "=", "0.8", ")", ":", "maskPts", "=", "vtk", ".", "vtkMaskPoints", "(", ")", "maskPts", ".", "SetOnRatio", "(", "rat...
Build an ``vtkActor`` made of the normals at vertices shown as lines.
[ "Build", "an", "vtkActor", "made", "of", "the", "normals", "at", "vertices", "shown", "as", "lines", "." ]
python
train
34.827586
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py#L222-L277
def execute(self, code, silent=False, user_variables=None, user_expressions=None, allow_stdin=None): """Execute code in the kernel. Parameters ---------- code : str A string of Python code. silent : bool, optional (default False) If set, ...
[ "def", "execute", "(", "self", ",", "code", ",", "silent", "=", "False", ",", "user_variables", "=", "None", ",", "user_expressions", "=", "None", ",", "allow_stdin", "=", "None", ")", ":", "if", "user_variables", "is", "None", ":", "user_variables", "=", ...
Execute code in the kernel. Parameters ---------- code : str A string of Python code. silent : bool, optional (default False) If set, the kernel will execute the code as quietly possible. user_variables : list, optional A list of variable na...
[ "Execute", "code", "in", "the", "kernel", "." ]
python
test
36.928571
anchore/anchore
anchore/util/resources.py
https://github.com/anchore/anchore/blob/8a4d5b9708e27856312d303aae3f04f3c72039d6/anchore/util/resources.py#L271-L315
def _load(self, url): """ Load from remote, but check local file content to identify duplicate content. If local file is found with same hash then it is used with metadata from remote object to avoid fetching full content. :param url: :return: """ self._logger.de...
[ "def", "_load", "(", "self", ",", "url", ")", ":", "self", ".", "_logger", ".", "debug", "(", "'Loading url %s into resource cache'", "%", "url", ")", "retriever", "=", "get_resource_retriever", "(", "url", ")", "content_path", "=", "os", ".", "path", ".", ...
Load from remote, but check local file content to identify duplicate content. If local file is found with same hash then it is used with metadata from remote object to avoid fetching full content. :param url: :return:
[ "Load", "from", "remote", "but", "check", "local", "file", "content", "to", "identify", "duplicate", "content", ".", "If", "local", "file", "is", "found", "with", "same", "hash", "then", "it", "is", "used", "with", "metadata", "from", "remote", "object", "...
python
train
43.022222
phoebe-project/phoebe2
phoebe/dependencies/autofig/call.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/call.py#L1491-L1526
def _sort_by_indep(self, func='get_value', i=None, iunit=None, unit=None, uncover=None, trail=None, linebreak=None, sort_by_indep=None): """ must be called before (or within) _do_linebreak """ if sort_by_indep is None: # TODO: a...
[ "def", "_sort_by_indep", "(", "self", ",", "func", "=", "'get_value'", ",", "i", "=", "None", ",", "iunit", "=", "None", ",", "unit", "=", "None", ",", "uncover", "=", "None", ",", "trail", "=", "None", ",", "linebreak", "=", "None", ",", "sort_by_in...
must be called before (or within) _do_linebreak
[ "must", "be", "called", "before", "(", "or", "within", ")", "_do_linebreak" ]
python
train
40.805556
AirtestProject/Poco
poco/proxy.py
https://github.com/AirtestProject/Poco/blob/2c559a586adf3fd11ee81cabc446d4d3f6f2d119/poco/proxy.py#L826-L840
def get_bounds(self): """ Get the parameters of bounding box of the UI element. Returns: :obj:`list` <:obj:`float`>: 4-list (top, right, bottom, left) coordinates related to the edge of screen in NormalizedCoordinate system """ size = self.get_size() ...
[ "def", "get_bounds", "(", "self", ")", ":", "size", "=", "self", ".", "get_size", "(", ")", "top_left", "=", "self", ".", "get_position", "(", "[", "0", ",", "0", "]", ")", "# t, r, b, l", "bounds", "=", "[", "top_left", "[", "1", "]", ",", "top_le...
Get the parameters of bounding box of the UI element. Returns: :obj:`list` <:obj:`float`>: 4-list (top, right, bottom, left) coordinates related to the edge of screen in NormalizedCoordinate system
[ "Get", "the", "parameters", "of", "bounding", "box", "of", "the", "UI", "element", "." ]
python
train
32.066667
grahame/sedge
sedge/engine.py
https://github.com/grahame/sedge/blob/60dc6a0c5ef3bf802fe48a2571a8524a6ea33878/sedge/engine.py#L175-L184
def host_stanzas(self, config_access): """ returns a list of host definitions """ defn_lines = self.resolve_defn(config_access) for val_dict in self.variable_iter(config_access.get_variables()): subst = list(self.apply_substitutions(defn_lines, val_dict)) ...
[ "def", "host_stanzas", "(", "self", ",", "config_access", ")", ":", "defn_lines", "=", "self", ".", "resolve_defn", "(", "config_access", ")", "for", "val_dict", "in", "self", ".", "variable_iter", "(", "config_access", ".", "get_variables", "(", ")", ")", "...
returns a list of host definitions
[ "returns", "a", "list", "of", "host", "definitions" ]
python
train
42.7
riga/law
law/util.py
https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/util.py#L746-L762
def send_mail(recipient, sender, subject="", content="", smtp_host="127.0.0.1", smtp_port=25): """ Lightweight mail functionality. Sends an mail from *sender* to *recipient* with *subject* and *content*. *smtp_host* and *smtp_port* are forwarded to the ``smtplib.SMTP`` constructor. *True* is returned on...
[ "def", "send_mail", "(", "recipient", ",", "sender", ",", "subject", "=", "\"\"", ",", "content", "=", "\"\"", ",", "smtp_host", "=", "\"127.0.0.1\"", ",", "smtp_port", "=", "25", ")", ":", "try", ":", "server", "=", "smtplib", ".", "SMTP", "(", "smtp_...
Lightweight mail functionality. Sends an mail from *sender* to *recipient* with *subject* and *content*. *smtp_host* and *smtp_port* are forwarded to the ``smtplib.SMTP`` constructor. *True* is returned on success, *False* otherwise.
[ "Lightweight", "mail", "functionality", ".", "Sends", "an", "mail", "from", "*", "sender", "*", "to", "*", "recipient", "*", "with", "*", "subject", "*", "and", "*", "content", "*", ".", "*", "smtp_host", "*", "and", "*", "smtp_port", "*", "are", "forw...
python
train
42.764706
saltstack/salt
salt/states/docker_container.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_container.py#L2618-L2647
def mod_watch(name, sfun=None, **kwargs): ''' The docker_container watcher, called to invoke the watch command. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function sho...
[ "def", "mod_watch", "(", "name", ",", "sfun", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "sfun", "==", "'running'", ":", "watch_kwargs", "=", "copy", ".", "deepcopy", "(", "kwargs", ")", "if", "watch_kwargs", ".", "get", "(", "'watch_action'...
The docker_container watcher, called to invoke the watch command. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be set by the state being triggered.
[ "The", "docker_container", "watcher", "called", "to", "invoke", "the", "watch", "command", "." ]
python
train
34.866667
jjjake/internetarchive
internetarchive/session.py
https://github.com/jjjake/internetarchive/blob/7c0c71bfe52490927a37ade15bd09b2733fea660/internetarchive/session.py#L303-L352
def get_tasks(self, identifier=None, task_id=None, task_type=None, params=None, config=None, verbose=None, request_kwargs=None): """Get tasks from the Archive.org catalog. ``internetarch...
[ "def", "get_tasks", "(", "self", ",", "identifier", "=", "None", ",", "task_id", "=", "None", ",", "task_type", "=", "None", ",", "params", "=", "None", ",", "config", "=", "None", ",", "verbose", "=", "None", ",", "request_kwargs", "=", "None", ")", ...
Get tasks from the Archive.org catalog. ``internetarchive`` must be configured with your logged-in-* cookies to use this function. If no arguments are provided, all queued tasks for the user will be returned. :type identifier: str :param identifier: (optional) The Archive.org identifier...
[ "Get", "tasks", "from", "the", "Archive", ".", "org", "catalog", ".", "internetarchive", "must", "be", "configured", "with", "your", "logged", "-", "in", "-", "*", "cookies", "to", "use", "this", "function", ".", "If", "no", "arguments", "are", "provided",...
python
train
43.02
sorgerlab/indra
indra/explanation/model_checker.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L942-L1006
def _find_sources(im, target, sources, polarity): """Get the subset of source nodes with paths to the target. Given a target, a list of sources, and a path polarity, perform a breadth-first search upstream from the target to determine whether any of the queried sources have paths to the target with the...
[ "def", "_find_sources", "(", "im", ",", "target", ",", "sources", ",", "polarity", ")", ":", "# First, create a list of visited nodes", "# Adapted from", "# networkx.algorithms.traversal.breadth_first_search.bfs_edges", "visited", "=", "set", "(", "[", "(", "target", ",",...
Get the subset of source nodes with paths to the target. Given a target, a list of sources, and a path polarity, perform a breadth-first search upstream from the target to determine whether any of the queried sources have paths to the target with the appropriate polarity. For efficiency, does not retur...
[ "Get", "the", "subset", "of", "source", "nodes", "with", "paths", "to", "the", "target", "." ]
python
train
45.4
Genida/archan
src/archan/printing.py
https://github.com/Genida/archan/blob/a026d3105c7e86f30e6c9507b93ceb736684bfdc/src/archan/printing.py#L111-L130
def print(self): """Print self.""" print( '{dim}Identifier:{none} {cyan}{identifier}{none}\n' '{dim}Name:{none} {name}\n' '{dim}Description:{none}\n{description}'.format( dim=Style.DIM, cyan=Fore.CYAN, none=Style.RESET_A...
[ "def", "print", "(", "self", ")", ":", "print", "(", "'{dim}Identifier:{none} {cyan}{identifier}{none}\\n'", "'{dim}Name:{none} {name}\\n'", "'{dim}Description:{none}\\n{description}'", ".", "format", "(", "dim", "=", "Style", ".", "DIM", ",", "cyan", "=", "Fore", ".", ...
Print self.
[ "Print", "self", "." ]
python
train
36.95
ReFirmLabs/binwalk
src/binwalk/core/display.py
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/display.py#L155-L178
def _append_to_data_parts(self, data, start, end): ''' Intelligently appends data to self.string_parts. For use by self._format. ''' try: while data[start] == ' ': start += 1 if start == end: end = len(data[start:]) ...
[ "def", "_append_to_data_parts", "(", "self", ",", "data", ",", "start", ",", "end", ")", ":", "try", ":", "while", "data", "[", "start", "]", "==", "' '", ":", "start", "+=", "1", "if", "start", "==", "end", ":", "end", "=", "len", "(", "data", "...
Intelligently appends data to self.string_parts. For use by self._format.
[ "Intelligently", "appends", "data", "to", "self", ".", "string_parts", ".", "For", "use", "by", "self", ".", "_format", "." ]
python
train
26.708333
Dallinger/Dallinger
dallinger/mturk.py
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/mturk.py#L317-L321
def dispose_qualification_type(self, qualification_id): """Remove a qualification type we created""" return self._is_ok( self.mturk.delete_qualification_type(QualificationTypeId=qualification_id) )
[ "def", "dispose_qualification_type", "(", "self", ",", "qualification_id", ")", ":", "return", "self", ".", "_is_ok", "(", "self", ".", "mturk", ".", "delete_qualification_type", "(", "QualificationTypeId", "=", "qualification_id", ")", ")" ]
Remove a qualification type we created
[ "Remove", "a", "qualification", "type", "we", "created" ]
python
train
45.8
pgjones/quart
quart/blueprints.py
https://github.com/pgjones/quart/blob/7cb2d3bd98e8746025764f2b933abc12041fa175/quart/blueprints.py#L359-L375
def before_app_websocket(self, func: Callable) -> Callable: """Add a before request websocket to the App. This is designed to be used as a decorator, and has the same arguments as :meth:`~quart.Quart.before_websocket`. It applies to all requests to the app this blueprint is registered o...
[ "def", "before_app_websocket", "(", "self", ",", "func", ":", "Callable", ")", "->", "Callable", ":", "self", ".", "record_once", "(", "lambda", "state", ":", "state", ".", "app", ".", "before_websocket", "(", "func", ")", ")", "return", "func" ]
Add a before request websocket to the App. This is designed to be used as a decorator, and has the same arguments as :meth:`~quart.Quart.before_websocket`. It applies to all requests to the app this blueprint is registered on. An example usage, .. code-block:: python bluep...
[ "Add", "a", "before", "request", "websocket", "to", "the", "App", "." ]
python
train
35.117647
havardgulldahl/jottalib
src/jottalib/JFS.py
https://github.com/havardgulldahl/jottalib/blob/4d015e4309b1d9055e561ec757363fb2632b4eb7/src/jottalib/JFS.py#L387-L396
def factory(fileobject, jfs, parentpath): # fileobject from lxml.objectify 'Class method to get the correct file class instatiated' if hasattr(fileobject, 'currentRevision'): # a normal file return JFSFile(fileobject, jfs, parentpath) elif str(fileobject.latestRevision.state) == Prot...
[ "def", "factory", "(", "fileobject", ",", "jfs", ",", "parentpath", ")", ":", "# fileobject from lxml.objectify", "if", "hasattr", "(", "fileobject", ",", "'currentRevision'", ")", ":", "# a normal file", "return", "JFSFile", "(", "fileobject", ",", "jfs", ",", ...
Class method to get the correct file class instatiated
[ "Class", "method", "to", "get", "the", "correct", "file", "class", "instatiated" ]
python
train
68.3
pybel/pybel
src/pybel/manager/cache_manager.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/manager/cache_manager.py#L108-L113
def _normalize_url(graph: BELGraph, keyword: str) -> Optional[str]: # FIXME move to utilities and unit test """Normalize a URL for the BEL graph.""" if keyword == BEL_DEFAULT_NAMESPACE and BEL_DEFAULT_NAMESPACE not in graph.namespace_url: return BEL_DEFAULT_NAMESPACE_URL return graph.namespace_url...
[ "def", "_normalize_url", "(", "graph", ":", "BELGraph", ",", "keyword", ":", "str", ")", "->", "Optional", "[", "str", "]", ":", "# FIXME move to utilities and unit test", "if", "keyword", "==", "BEL_DEFAULT_NAMESPACE", "and", "BEL_DEFAULT_NAMESPACE", "not", "in", ...
Normalize a URL for the BEL graph.
[ "Normalize", "a", "URL", "for", "the", "BEL", "graph", "." ]
python
train
54.666667
materialsproject/pymatgen
pymatgen/electronic_structure/core.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L163-L177
def from_global_moment_and_saxis(cls, global_moment, saxis): """ Convenience method to initialize Magmom from a given global magnetic moment, i.e. magnetic moment with saxis=(0,0,1), and provided saxis. Method is useful if you do not know the components of your m...
[ "def", "from_global_moment_and_saxis", "(", "cls", ",", "global_moment", ",", "saxis", ")", ":", "magmom", "=", "Magmom", "(", "global_moment", ")", "return", "cls", "(", "magmom", ".", "get_moment", "(", "saxis", "=", "saxis", ")", ",", "saxis", "=", "sax...
Convenience method to initialize Magmom from a given global magnetic moment, i.e. magnetic moment with saxis=(0,0,1), and provided saxis. Method is useful if you do not know the components of your magnetic moment in frame of your desired saxis. :param global_mom...
[ "Convenience", "method", "to", "initialize", "Magmom", "from", "a", "given", "global", "magnetic", "moment", "i", ".", "e", ".", "magnetic", "moment", "with", "saxis", "=", "(", "0", "0", "1", ")", "and", "provided", "saxis", ".", "Method", "is", "useful...
python
train
37.4
pbrisk/businessdate
businessdate/businessdate.py
https://github.com/pbrisk/businessdate/blob/79a0c5a4e557cbacca82a430403b18413404a9bc/businessdate/businessdate.py#L260-L267
def to_date(self): """ construct datetime.date instance represented calendar date of BusinessDate instance :return datetime.date: """ y, m, d = self.to_ymd() return date(y, m, d)
[ "def", "to_date", "(", "self", ")", ":", "y", ",", "m", ",", "d", "=", "self", ".", "to_ymd", "(", ")", "return", "date", "(", "y", ",", "m", ",", "d", ")" ]
construct datetime.date instance represented calendar date of BusinessDate instance :return datetime.date:
[ "construct", "datetime", ".", "date", "instance", "represented", "calendar", "date", "of", "BusinessDate", "instance" ]
python
valid
27.5
stefanbraun-private/visitoolkit_eventsystem
visitoolkit_eventsystem/eventsystem.py
https://github.com/stefanbraun-private/visitoolkit_eventsystem/blob/d606a167ac3b8edc5bfbd8de7fb7063a9a1922f1/visitoolkit_eventsystem/eventsystem.py#L130-L134
def handle(self, handler): """ register a handler (add a callback function) """ with self._hlock: self._handler_list.append(handler) return self
[ "def", "handle", "(", "self", ",", "handler", ")", ":", "with", "self", ".", "_hlock", ":", "self", ".", "_handler_list", ".", "append", "(", "handler", ")", "return", "self" ]
register a handler (add a callback function)
[ "register", "a", "handler", "(", "add", "a", "callback", "function", ")" ]
python
train
35.2
nicolargo/glances
glances/config.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L304-L309
def get_float_value(self, section, option, default=0.0): """Get the float value of an option, if it exists.""" try: return self.parser.getfloat(section, option) except NoOptionError: return float(default)
[ "def", "get_float_value", "(", "self", ",", "section", ",", "option", ",", "default", "=", "0.0", ")", ":", "try", ":", "return", "self", ".", "parser", ".", "getfloat", "(", "section", ",", "option", ")", "except", "NoOptionError", ":", "return", "float...
Get the float value of an option, if it exists.
[ "Get", "the", "float", "value", "of", "an", "option", "if", "it", "exists", "." ]
python
train
41.166667
rbuffat/pyepw
pyepw/epw.py
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L2546-L2567
def db_en010(self, value=None): """ Corresponds to IDD Field `db_en010` mean coincident dry-bulb temperature to Enthalpy corresponding to 1.0% annual cumulative frequency of occurrence Args: value (float): value for IDD Field `db_en010` Unit: C ...
[ "def", "db_en010", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type float...
Corresponds to IDD Field `db_en010` mean coincident dry-bulb temperature to Enthalpy corresponding to 1.0% annual cumulative frequency of occurrence Args: value (float): value for IDD Field `db_en010` Unit: C if `value` is None it will not be checked ...
[ "Corresponds", "to", "IDD", "Field", "db_en010", "mean", "coincident", "dry", "-", "bulb", "temperature", "to", "Enthalpy", "corresponding", "to", "1", ".", "0%", "annual", "cumulative", "frequency", "of", "occurrence" ]
python
train
36.136364
mbedmicro/pyOCD
pyocd/__main__.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/__main__.py#L518-L567
def do_gdbserver(self): """! @brief Handle 'gdbserver' subcommand.""" self._process_commands(self._args.commands) gdbs = [] try: # Build dict of session options. sessionOptions = convert_session_options(self._args.options) sessionOptions.update({ ...
[ "def", "do_gdbserver", "(", "self", ")", ":", "self", ".", "_process_commands", "(", "self", ".", "_args", ".", "commands", ")", "gdbs", "=", "[", "]", "try", ":", "# Build dict of session options.", "sessionOptions", "=", "convert_session_options", "(", "self",...
! @brief Handle 'gdbserver' subcommand.
[ "!" ]
python
train
43
jiasir/playback
playback/cli/manila_share.py
https://github.com/jiasir/playback/blob/58b2a5d669dcfaa8cad50c544a4b068dcacf9b69/playback/cli/manila_share.py#L102-L113
def make(parser): """provison Manila Share with HA""" s = parser.add_subparsers( title='commands', metavar='COMMAND', help='description', ) def install_f(args): install(args) install_parser = install_subparser(s) install_parser.set_defaults(func=install_f)
[ "def", "make", "(", "parser", ")", ":", "s", "=", "parser", ".", "add_subparsers", "(", "title", "=", "'commands'", ",", "metavar", "=", "'COMMAND'", ",", "help", "=", "'description'", ",", ")", "def", "install_f", "(", "args", ")", ":", "install", "("...
provison Manila Share with HA
[ "provison", "Manila", "Share", "with", "HA" ]
python
train
25.5
gwastro/pycbc-glue
pycbc_glue/pipeline.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/pipeline.py#L863-L871
def add_var_condor_cmd(self, command): """ Add a condor command to the submit file that allows variable (macro) arguments to be passes to the executable. """ if command not in self.__var_cmds: self.__var_cmds.append(command) macro = self.__bad_macro_chars.sub( r'', command ) ...
[ "def", "add_var_condor_cmd", "(", "self", ",", "command", ")", ":", "if", "command", "not", "in", "self", ".", "__var_cmds", ":", "self", ".", "__var_cmds", ".", "append", "(", "command", ")", "macro", "=", "self", ".", "__bad_macro_chars", ".", "sub", "...
Add a condor command to the submit file that allows variable (macro) arguments to be passes to the executable.
[ "Add", "a", "condor", "command", "to", "the", "submit", "file", "that", "allows", "variable", "(", "macro", ")", "arguments", "to", "be", "passes", "to", "the", "executable", "." ]
python
train
40.555556
lepture/terminal
terminal/command.py
https://github.com/lepture/terminal/blob/5226d1cac53077f12624aa51f64de7b5b05d9cb8/terminal/command.py#L40-L127
def parse(self, name, description): """ Parse option name. :param name: option's name :param description: option's description Parsing acceptable names: * -f: shortname * --force: longname * -f, --force: shortname and longname * ...
[ "def", "parse", "(", "self", ",", "name", ",", "description", ")", ":", "name", "=", "name", ".", "strip", "(", ")", "if", "'<'", "in", "name", ":", "self", ".", "required", "=", "True", "self", ".", "boolean", "=", "False", "name", "=", "name", ...
Parse option name. :param name: option's name :param description: option's description Parsing acceptable names: * -f: shortname * --force: longname * -f, --force: shortname and longname * -o <output>: shortname and a required value ...
[ "Parse", "option", "name", "." ]
python
train
27.863636
productml/blurr
blurr/core/base.py
https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/base.py#L68-L76
def validate_number_attribute(self, attribute: str, value_type: Union[Type[int], Type[float]] = int, minimum: Optional[Union[int, float]] = None, maximum: Optional[Union[int, float]] =...
[ "def", "validate_number_attribute", "(", "self", ",", "attribute", ":", "str", ",", "value_type", ":", "Union", "[", "Type", "[", "int", "]", ",", "Type", "[", "float", "]", "]", "=", "int", ",", "minimum", ":", "Optional", "[", "Union", "[", "int", ...
Validates that the attribute contains a numeric value within boundaries if specified
[ "Validates", "that", "the", "attribute", "contains", "a", "numeric", "value", "within", "boundaries", "if", "specified" ]
python
train
67.777778
lepture/terminal
terminal/log.py
https://github.com/lepture/terminal/blob/5226d1cac53077f12624aa51f64de7b5b05d9cb8/terminal/log.py#L128-L142
def end(self, *args): """ End a nested log. """ if self._is_verbose: # verbose log has no end method return self if not args: self._indent -= 1 return self self.writeln('end', *args) self._indent -= 1 retur...
[ "def", "end", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "_is_verbose", ":", "# verbose log has no end method", "return", "self", "if", "not", "args", ":", "self", ".", "_indent", "-=", "1", "return", "self", "self", ".", "writeln", "(",...
End a nested log.
[ "End", "a", "nested", "log", "." ]
python
train
20.8
django-danceschool/django-danceschool
danceschool/vouchers/models.py
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/models.py#L66-L79
def create_new_code(cls,**kwargs): ''' Creates a new Voucher with a unique voucherId ''' prefix = kwargs.pop('prefix','') new = False while not new: # Standard is a ten-letter random string of uppercase letters random_string = ''.join(random.choic...
[ "def", "create_new_code", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "prefix", "=", "kwargs", ".", "pop", "(", "'prefix'", ",", "''", ")", "new", "=", "False", "while", "not", "new", ":", "# Standard is a ten-letter random string of uppercase letters", "ra...
Creates a new Voucher with a unique voucherId
[ "Creates", "a", "new", "Voucher", "with", "a", "unique", "voucherId" ]
python
train
40.5
varikin/Tigre
tigre/tigre.py
https://github.com/varikin/Tigre/blob/6ffac1de52f087cf92cbf368997b336c35a0e3c0/tigre/tigre.py#L108-L116
def sync(self, folders): """Syncs a list of folders to their assicated buckets. folders: A list of 2-tuples in the form (folder, bucket) """ if not folders: raise ValueError("No folders to sync given") for folder in folders: self.sync_folder(*fold...
[ "def", "sync", "(", "self", ",", "folders", ")", ":", "if", "not", "folders", ":", "raise", "ValueError", "(", "\"No folders to sync given\"", ")", "for", "folder", "in", "folders", ":", "self", ".", "sync_folder", "(", "*", "folder", ")" ]
Syncs a list of folders to their assicated buckets. folders: A list of 2-tuples in the form (folder, bucket)
[ "Syncs", "a", "list", "of", "folders", "to", "their", "assicated", "buckets", ".", "folders", ":", "A", "list", "of", "2", "-", "tuples", "in", "the", "form", "(", "folder", "bucket", ")" ]
python
test
35
hvac/hvac
hvac/api/auth_methods/kubernetes.py
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/api/auth_methods/kubernetes.py#L16-L68
def configure(self, kubernetes_host, kubernetes_ca_cert='', token_reviewer_jwt='', pem_keys=None, mount_point=DEFAULT_MOUNT_POINT): """Configure the connection parameters for Kubernetes. This path honors the distinction between the create and update capabilities inside ACL policies. ...
[ "def", "configure", "(", "self", ",", "kubernetes_host", ",", "kubernetes_ca_cert", "=", "''", ",", "token_reviewer_jwt", "=", "''", ",", "pem_keys", "=", "None", ",", "mount_point", "=", "DEFAULT_MOUNT_POINT", ")", ":", "if", "pem_keys", "is", "None", ":", ...
Configure the connection parameters for Kubernetes. This path honors the distinction between the create and update capabilities inside ACL policies. Supported methods: POST: /auth/{mount_point}/config. Produces: 204 (empty body) :param kubernetes_host: Host must be a host string, ...
[ "Configure", "the", "connection", "parameters", "for", "Kubernetes", "." ]
python
train
45.716981
onnx/onnxmltools
onnxmltools/utils/utils_backend_onnxruntime.py
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxmltools/utils/utils_backend_onnxruntime.py#L218-L295
def _compare_expected(expected, output, sess, onnx, decimal=5, onnx_shape=None, **kwargs): """ Compares the expected output against the runtime outputs. This is specific to *onnxruntime* due to variable *sess* of type *onnxruntime.InferenceSession*. """ tested = 0 if isinstance(expected, lis...
[ "def", "_compare_expected", "(", "expected", ",", "output", ",", "sess", ",", "onnx", ",", "decimal", "=", "5", ",", "onnx_shape", "=", "None", ",", "*", "*", "kwargs", ")", ":", "tested", "=", "0", "if", "isinstance", "(", "expected", ",", "list", "...
Compares the expected output against the runtime outputs. This is specific to *onnxruntime* due to variable *sess* of type *onnxruntime.InferenceSession*.
[ "Compares", "the", "expected", "output", "against", "the", "runtime", "outputs", ".", "This", "is", "specific", "to", "*", "onnxruntime", "*", "due", "to", "variable", "*", "sess", "*", "of", "type", "*", "onnxruntime", ".", "InferenceSession", "*", "." ]
python
train
50.974359
noahbenson/pimms
pimms/immutable.py
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/immutable.py#L231-L246
def _imm_delattr(self, name): ''' A persistent immutable's delattr allows the object's value-caches to be invalidated, otherwise raises an exception. ''' if _imm_is_persist(self): values = _imm_value_data(self) if name in values: dd = object.__getattribute__(self, '__dict...
[ "def", "_imm_delattr", "(", "self", ",", "name", ")", ":", "if", "_imm_is_persist", "(", "self", ")", ":", "values", "=", "_imm_value_data", "(", "self", ")", "if", "name", "in", "values", ":", "dd", "=", "object", ".", "__getattribute__", "(", "self", ...
A persistent immutable's delattr allows the object's value-caches to be invalidated, otherwise raises an exception.
[ "A", "persistent", "immutable", "s", "delattr", "allows", "the", "object", "s", "value", "-", "caches", "to", "be", "invalidated", "otherwise", "raises", "an", "exception", "." ]
python
train
38
JasonKessler/scattertext
scattertext/characteristic/DenseRankCharacteristicness.py
https://github.com/JasonKessler/scattertext/blob/cacf1f687d218ee8cae3fc05cc901db824bb1b81/scattertext/characteristic/DenseRankCharacteristicness.py#L37-L74
def get_scores(self, corpus): ''' Parameters ---------- corpus Returns ------- float, pd.Series float: point on x-axis at even characteristicness pd.Series: term -> value between 0 and 1, sorted by score in a descending manner Background scores from corpus ''' term_ranks = self.term_ranker(corp...
[ "def", "get_scores", "(", "self", ",", "corpus", ")", ":", "term_ranks", "=", "self", ".", "term_ranker", "(", "corpus", ")", ".", "get_ranks", "(", ")", "freq_df", "=", "pd", ".", "DataFrame", "(", "{", "'corpus'", ":", "term_ranks", ".", "sum", "(", ...
Parameters ---------- corpus Returns ------- float, pd.Series float: point on x-axis at even characteristicness pd.Series: term -> value between 0 and 1, sorted by score in a descending manner Background scores from corpus
[ "Parameters", "----------", "corpus" ]
python
train
31.921053
LEMS/pylems
lems/parser/LEMS.py
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1185-L1214
def parse_parameter(self, node): """ Parses <Parameter> @param node: Node containing the <Parameter> element @type node: xml.etree.Element @raise ParseError: Raised when the parameter does not have a name. @raise ParseError: Raised when the parameter does not have a ...
[ "def", "parse_parameter", "(", "self", ",", "node", ")", ":", "if", "self", ".", "current_component_type", "==", "None", ":", "self", ".", "raise_error", "(", "'Parameters can only be defined in '", "+", "'a component type'", ")", "try", ":", "name", "=", "node"...
Parses <Parameter> @param node: Node containing the <Parameter> element @type node: xml.etree.Element @raise ParseError: Raised when the parameter does not have a name. @raise ParseError: Raised when the parameter does not have a dimension.
[ "Parses", "<Parameter", ">" ]
python
train
30.266667
genepattern/genepattern-python
gp/core.py
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L457-L470
def wait_until_done(self): """ This method will not return until the job is either complete or has reached an error state. This queries the server periodically to check for an update in status. """ wait = 1 while True: time.sleep(wait) self...
[ "def", "wait_until_done", "(", "self", ")", ":", "wait", "=", "1", "while", "True", ":", "time", ".", "sleep", "(", "wait", ")", "self", ".", "get_info", "(", ")", "if", "self", ".", "info", "[", "'status'", "]", "[", "'isFinished'", "]", ":", "bre...
This method will not return until the job is either complete or has reached an error state. This queries the server periodically to check for an update in status.
[ "This", "method", "will", "not", "return", "until", "the", "job", "is", "either", "complete", "or", "has", "reached", "an", "error", "state", ".", "This", "queries", "the", "server", "periodically", "to", "check", "for", "an", "update", "in", "status", "."...
python
train
34.357143
pycontribs/pyrax
pyrax/cloudloadbalancers.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudloadbalancers.py#L1312-L1326
def update(self, loadbalancer, name=None, algorithm=None, protocol=None, halfClosed=None, port=None, timeout=None, httpsRedirect=None): """ Provides a way to modify the following attributes of a load balancer: - name - algorithm - protocol - ha...
[ "def", "update", "(", "self", ",", "loadbalancer", ",", "name", "=", "None", ",", "algorithm", "=", "None", ",", "protocol", "=", "None", ",", "halfClosed", "=", "None", ",", "port", "=", "None", ",", "timeout", "=", "None", ",", "httpsRedirect", "=", ...
Provides a way to modify the following attributes of a load balancer: - name - algorithm - protocol - halfClosed - port - timeout - httpsRedirect
[ "Provides", "a", "way", "to", "modify", "the", "following", "attributes", "of", "a", "load", "balancer", ":", "-", "name", "-", "algorithm", "-", "protocol", "-", "halfClosed", "-", "port", "-", "timeout", "-", "httpsRedirect" ]
python
train
40.533333
chemlab/chemlab
chemlab/core/spacegroup/spacegroup.py
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/core/spacegroup/spacegroup.py#L302-L387
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites. Parameters: scaled_positions: list | array List of non-equivalent sites given in unit cell coordinates. ...
[ "def", "equivalent_sites", "(", "self", ",", "scaled_positions", ",", "ondublicates", "=", "'error'", ",", "symprec", "=", "1e-3", ")", ":", "kinds", "=", "[", "]", "sites", "=", "[", "]", "symprec2", "=", "symprec", "**", "2", "scaled", "=", "np", "."...
Returns the scaled positions and all their equivalent sites. Parameters: scaled_positions: list | array List of non-equivalent sites given in unit cell coordinates. ondublicates : 'keep' | 'replace' | 'warn' | 'error' Action if `scaled_positions` contain symmetry-equiva...
[ "Returns", "the", "scaled", "positions", "and", "all", "their", "equivalent", "sites", "." ]
python
train
37.395349
timstaley/voeventdb
voeventdb/server/restapi/v1/views.py
https://github.com/timstaley/voeventdb/blob/e37b176d65fced4ca4f059109a95d6974bb8a091/voeventdb/server/restapi/v1/views.py#L82-L105
def apiv1_root_view(): """ API root url. Shows a list of active endpoints. """ docs_url = current_app.config.get('DOCS_URL', 'http://' + request.host + '/docs') message = "Welcome to the voeventdb REST API, " \ "interface version '{}'.".format( ...
[ "def", "apiv1_root_view", "(", ")", ":", "docs_url", "=", "current_app", ".", "config", ".", "get", "(", "'DOCS_URL'", ",", "'http://'", "+", "request", ".", "host", "+", "'/docs'", ")", "message", "=", "\"Welcome to the voeventdb REST API, \"", "\"interface versi...
API root url. Shows a list of active endpoints.
[ "API", "root", "url", ".", "Shows", "a", "list", "of", "active", "endpoints", "." ]
python
train
34.916667
pypa/pipenv
pipenv/vendor/distlib/database.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L1154-L1184
def to_dot(self, f, skip_disconnected=True): """Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations ...
[ "def", "to_dot", "(", "self", ",", "f", ",", "skip_disconnected", "=", "True", ")", ":", "disconnected", "=", "[", "]", "f", ".", "write", "(", "\"digraph dependencies {\\n\"", ")", "for", "dist", ",", "adjs", "in", "self", ".", "adjacency_list", ".", "i...
Writes a DOT output for the graph to the provided file *f*. If *skip_disconnected* is set to ``True``, then all distributions that are not dependent on any other distribution are skipped. :type f: has to support ``file``-like operations :type skip_disconnected: ``bool``
[ "Writes", "a", "DOT", "output", "for", "the", "graph", "to", "the", "provided", "file", "*", "f", "*", "." ]
python
train
39.225806
saltstack/salt
salt/modules/k8s.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/k8s.py#L457-L491
def get_namespaces(namespace="", apiserver_url=None): ''' .. versionadded:: 2016.3.0 Get one or all kubernetes namespaces. If namespace parameter is omitted, all namespaces will be returned back to user, similar to following kubectl example: .. code-block:: bash kubectl get namespaces -o...
[ "def", "get_namespaces", "(", "namespace", "=", "\"\"", ",", "apiserver_url", "=", "None", ")", ":", "# Try to get kubernetes master", "apiserver_url", "=", "_guess_apiserver", "(", "apiserver_url", ")", "if", "apiserver_url", "is", "None", ":", "return", "False", ...
.. versionadded:: 2016.3.0 Get one or all kubernetes namespaces. If namespace parameter is omitted, all namespaces will be returned back to user, similar to following kubectl example: .. code-block:: bash kubectl get namespaces -o json In case namespace is set by user, the output will be si...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
python
train
24.542857
pyQode/pyqode.core
pyqode/core/widgets/splittable_tab_widget.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/splittable_tab_widget.py#L971-L979
def count(self): """ Returns the number of widgets currently displayed (takes child splits into account). """ c = self.main_tab_widget.count() for child in self.child_splitters: c += child.count() return c
[ "def", "count", "(", "self", ")", ":", "c", "=", "self", ".", "main_tab_widget", ".", "count", "(", ")", "for", "child", "in", "self", ".", "child_splitters", ":", "c", "+=", "child", ".", "count", "(", ")", "return", "c" ]
Returns the number of widgets currently displayed (takes child splits into account).
[ "Returns", "the", "number", "of", "widgets", "currently", "displayed", "(", "takes", "child", "splits", "into", "account", ")", "." ]
python
train
29.444444
Azure/msrest-for-python
msrest/service_client.py
https://github.com/Azure/msrest-for-python/blob/0732bc90bdb290e5f58c675ffdd7dbfa9acefc93/msrest/service_client.py#L318-L347
def send(self, request, headers=None, content=None, **kwargs): """Prepare and send request object according to configuration. :param ClientRequest request: The request object to be sent. :param dict headers: Any headers to add to the request. :param content: Any body data to add to the ...
[ "def", "send", "(", "self", ",", "request", ",", "headers", "=", "None", ",", "content", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# \"content\" and \"headers\" are deprecated, only old SDK", "if", "headers", ":", "request", ".", "headers", ".", "update...
Prepare and send request object according to configuration. :param ClientRequest request: The request object to be sent. :param dict headers: Any headers to add to the request. :param content: Any body data to add to the request. :param config: Any specific config overrides
[ "Prepare", "and", "send", "request", "object", "according", "to", "configuration", "." ]
python
train
48.7
mitsei/dlkit
dlkit/json_/commenting/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/objects.py#L569-L580
def get_book(self): """Gets the ``Book`` at this node. return: (osid.commenting.Book) - the book represented by this node *compliance: mandatory -- This method must be implemented.* """ if self._lookup_session is None: mgr = get_provider_manager('COM...
[ "def", "get_book", "(", "self", ")", ":", "if", "self", ".", "_lookup_session", "is", "None", ":", "mgr", "=", "get_provider_manager", "(", "'COMMENTING'", ",", "runtime", "=", "self", ".", "_runtime", ",", "proxy", "=", "self", ".", "_proxy", ")", "self...
Gets the ``Book`` at this node. return: (osid.commenting.Book) - the book represented by this node *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "Book", "at", "this", "node", "." ]
python
train
44.083333
genepattern/genepattern-python
gp/data.py
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/data.py#L251-L260
def _apply_odf_properties(df, headers, model): """ Attach properties to the Dataframe to carry along ODF metadata :param df: The dataframe to be modified :param headers: The ODF header lines :param model: The ODF model type """ df.headers = headers df.model = model
[ "def", "_apply_odf_properties", "(", "df", ",", "headers", ",", "model", ")", ":", "df", ".", "headers", "=", "headers", "df", ".", "model", "=", "model" ]
Attach properties to the Dataframe to carry along ODF metadata :param df: The dataframe to be modified :param headers: The ODF header lines :param model: The ODF model type
[ "Attach", "properties", "to", "the", "Dataframe", "to", "carry", "along", "ODF", "metadata" ]
python
train
28.9
horazont/aioxmpp
aioxmpp/muc/service.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1641-L1662
def kick(self, member, reason=None): """ Kick an occupant from the MUC. :param member: The member to kick. :type member: :class:`Occupant` :param reason: A reason to show to the members of the conversation including the kicked member. :type reason: :class:`st...
[ "def", "kick", "(", "self", ",", "member", ",", "reason", "=", "None", ")", ":", "yield", "from", "self", ".", "muc_set_role", "(", "member", ".", "nick", ",", "\"none\"", ",", "reason", "=", "reason", ")" ]
Kick an occupant from the MUC. :param member: The member to kick. :type member: :class:`Occupant` :param reason: A reason to show to the members of the conversation including the kicked member. :type reason: :class:`str` :raises aioxmpp.errors.XMPPError: if the serve...
[ "Kick", "an", "occupant", "from", "the", "MUC", "." ]
python
train
31.363636
KenjiTakahashi/td
td/model.py
https://github.com/KenjiTakahashi/td/blob/7311eabc63efe6fe6600687c3026f0837454c2e4/td/model.py#L266-L279
def get(self, index): """Gets data values for specified :index:. :index: Index for which to get data. :returns: A list in form [parent, name, priority, comment, done, children]. """ data = self.data index2 = self._split(index) for c in index2[:-1]: ...
[ "def", "get", "(", "self", ",", "index", ")", ":", "data", "=", "self", ".", "data", "index2", "=", "self", ".", "_split", "(", "index", ")", "for", "c", "in", "index2", "[", ":", "-", "1", "]", ":", "i", "=", "int", "(", "c", ")", "-", "1"...
Gets data values for specified :index:. :index: Index for which to get data. :returns: A list in form [parent, name, priority, comment, done, children].
[ "Gets", "data", "values", "for", "specified", ":", "index", ":", "." ]
python
train
29.928571
fedora-infra/fedmsg-atomic-composer
fedmsg_atomic_composer/composer.py
https://github.com/fedora-infra/fedmsg-atomic-composer/blob/9be9fd4955af0568f8743d7a1a243cd8f70020c3/fedmsg_atomic_composer/composer.py#L101-L117
def update_configs(self, release): """ Update the fedora-atomic.git repositories for a given release """ git_repo = release['git_repo'] git_cache = release['git_cache'] if not os.path.isdir(git_cache): self.call(['git', 'clone', '--mirror', git_repo, git_cache]) else:...
[ "def", "update_configs", "(", "self", ",", "release", ")", ":", "git_repo", "=", "release", "[", "'git_repo'", "]", "git_cache", "=", "release", "[", "'git_cache'", "]", "if", "not", "os", ".", "path", ".", "isdir", "(", "git_cache", ")", ":", "self", ...
Update the fedora-atomic.git repositories for a given release
[ "Update", "the", "fedora", "-", "atomic", ".", "git", "repositories", "for", "a", "given", "release" ]
python
train
49.647059
python-rope/rope
rope/refactor/extract.py
https://github.com/python-rope/rope/blob/1c9f9cd5964b099a99a9111e998f0dc728860688/rope/refactor/extract.py#L55-L73
def get_changes(self, extracted_name, similar=False, global_=False): """Get the changes this refactoring makes :parameters: - `similar`: if `True`, similar expressions/statements are also replaced. - `global_`: if `True`, the extracted method/variable will ...
[ "def", "get_changes", "(", "self", ",", "extracted_name", ",", "similar", "=", "False", ",", "global_", "=", "False", ")", ":", "info", "=", "_ExtractInfo", "(", "self", ".", "project", ",", "self", ".", "resource", ",", "self", ".", "start_offset", ",",...
Get the changes this refactoring makes :parameters: - `similar`: if `True`, similar expressions/statements are also replaced. - `global_`: if `True`, the extracted method/variable will be global.
[ "Get", "the", "changes", "this", "refactoring", "makes" ]
python
train
43.526316
manahl/arctic
arctic/arctic.py
https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L216-L229
def _list_libraries_cached(self, newer_than_secs=-1): """ Returns ------- List of Arctic library names from a cached collection (global per mongo cluster) in mongo. Long term list_libraries should have a use_cached argument. """ _ = self._conn # Ensures the conne...
[ "def", "_list_libraries_cached", "(", "self", ",", "newer_than_secs", "=", "-", "1", ")", ":", "_", "=", "self", ".", "_conn", "# Ensures the connection exists and cache is initialized with it.", "cache_data", "=", "self", ".", "_cache", ".", "get", "(", "'list_libr...
Returns ------- List of Arctic library names from a cached collection (global per mongo cluster) in mongo. Long term list_libraries should have a use_cached argument.
[ "Returns", "-------", "List", "of", "Arctic", "library", "names", "from", "a", "cached", "collection", "(", "global", "per", "mongo", "cluster", ")", "in", "mongo", ".", "Long", "term", "list_libraries", "should", "have", "a", "use_cached", "argument", "." ]
python
train
40.928571
cag/sphinxcontrib-soliditydomain
sphinxcontrib/soliditydomain/domain.py
https://github.com/cag/sphinxcontrib-soliditydomain/blob/b004b6e43727771027b4065fab18fcb9ccb2c826/sphinxcontrib/soliditydomain/domain.py#L351-L370
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): # type: (BuildEnvironment, unicode, Builder, unicode, unicode, nodes.Node, nodes.Node) -> nodes.Node # NOQA """Resolve the pending_xref *node* with the given *typ* and *target*. This method sho...
[ "def", "resolve_xref", "(", "self", ",", "env", ",", "fromdocname", ",", "builder", ",", "typ", ",", "target", ",", "node", ",", "contnode", ")", ":", "# type: (BuildEnvironment, unicode, Builder, unicode, unicode, nodes.Node, nodes.Node) -> nodes.Node # NOQA", "for", "f...
Resolve the pending_xref *node* with the given *typ* and *target*. This method should return a new node, to replace the xref node, containing the *contnode* which is the markup content of the cross-reference. If no resolution can be found, None can be returned; the xref node will ...
[ "Resolve", "the", "pending_xref", "*", "node", "*", "with", "the", "given", "*", "typ", "*", "and", "*", "target", "*", "." ]
python
train
52.5
inveniosoftware/invenio-files-rest
invenio_files_rest/models.py
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/models.py#L979-L1002
def set_contents(self, stream, chunk_size=None, size=None, size_limit=None, progress_callback=None): """Save contents of stream to file instance. If a file instance has already been set, this methods raises an ``FileInstanceAlreadySetError`` exception. :param strea...
[ "def", "set_contents", "(", "self", ",", "stream", ",", "chunk_size", "=", "None", ",", "size", "=", "None", ",", "size_limit", "=", "None", ",", "progress_callback", "=", "None", ")", ":", "if", "size_limit", "is", "None", ":", "size_limit", "=", "self"...
Save contents of stream to file instance. If a file instance has already been set, this methods raises an ``FileInstanceAlreadySetError`` exception. :param stream: File-like stream. :param size: Size of stream if known. :param chunk_size: Desired chunk size to read stream in. I...
[ "Save", "contents", "of", "stream", "to", "file", "instance", "." ]
python
train
39.5
yohell/python-tui
tui/__init__.py
https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L1550-L1599
def launch(self, argv=None, showusageonnoargs=False, width=0, helphint="Use with --help for more information.\n", debug_parser=False): """Do the usual stuff to initiallize the program. Read config files and parse argumen...
[ "def", "launch", "(", "self", ",", "argv", "=", "None", ",", "showusageonnoargs", "=", "False", ",", "width", "=", "0", ",", "helphint", "=", "\"Use with --help for more information.\\n\"", ",", "debug_parser", "=", "False", ")", ":", "if", "showusageonnoargs", ...
Do the usual stuff to initiallize the program. Read config files and parse arguments, and if the user has used any of the help/version/settings options, display help and exit. If debug_parser is false, don't catch ParseErrors and exit with user friendly help. Crash wit...
[ "Do", "the", "usual", "stuff", "to", "initiallize", "the", "program", ".", "Read", "config", "files", "and", "parse", "arguments", "and", "if", "the", "user", "has", "used", "any", "of", "the", "help", "/", "version", "/", "settings", "options", "display",...
python
valid
40.9
mitsei/dlkit
dlkit/records/osid/base_records.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1574-L1580
def get_time_as_string(self): """stub""" if self.has_time(): return (str(self.time['hours']).zfill(2) + ':' + str(self.time['minutes']).zfill(2) + ':' + str(self.time['seconds']).zfill(2)) raise IllegalState()
[ "def", "get_time_as_string", "(", "self", ")", ":", "if", "self", ".", "has_time", "(", ")", ":", "return", "(", "str", "(", "self", ".", "time", "[", "'hours'", "]", ")", ".", "zfill", "(", "2", ")", "+", "':'", "+", "str", "(", "self", ".", "...
stub
[ "stub" ]
python
train
39.857143
klingtnet/sblgntparser
sblgntparser/tools.py
https://github.com/klingtnet/sblgntparser/blob/535931a833203e5d9065072ec988c575b493d67f/sblgntparser/tools.py#L10-L21
def filelist(folderpath, ext=None): ''' Returns a list of all the files contained in the folder specified by `folderpath`. To filter the files by extension simply add a list containing all the extension with `.` as the second argument. If `flat` is False, then the Path objects are returned. ''' ...
[ "def", "filelist", "(", "folderpath", ",", "ext", "=", "None", ")", ":", "if", "not", "ext", ":", "ext", "=", "[", "]", "if", "os", ".", "path", ".", "exists", "(", "folderpath", ")", "and", "os", ".", "path", ".", "isdir", "(", "folderpath", ")"...
Returns a list of all the files contained in the folder specified by `folderpath`. To filter the files by extension simply add a list containing all the extension with `.` as the second argument. If `flat` is False, then the Path objects are returned.
[ "Returns", "a", "list", "of", "all", "the", "files", "contained", "in", "the", "folder", "specified", "by", "folderpath", ".", "To", "filter", "the", "files", "by", "extension", "simply", "add", "a", "list", "containing", "all", "the", "extension", "with", ...
python
train
54.416667
tanghaibao/goatools
goatools/godag/go_tasks.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/godag/go_tasks.py#L62-L72
def _get_id2children(id2children, item_id, item_obj): """Add the child item IDs for one item object and their children.""" if item_id in id2children: return id2children[item_id] child_ids = set() for child_obj in item_obj.children: child_id = child_obj.item_id child_ids.add(child...
[ "def", "_get_id2children", "(", "id2children", ",", "item_id", ",", "item_obj", ")", ":", "if", "item_id", "in", "id2children", ":", "return", "id2children", "[", "item_id", "]", "child_ids", "=", "set", "(", ")", "for", "child_obj", "in", "item_obj", ".", ...
Add the child item IDs for one item object and their children.
[ "Add", "the", "child", "item", "IDs", "for", "one", "item", "object", "and", "their", "children", "." ]
python
train
40.363636
wavycloud/pyboto3
pyboto3/cognitoidentityprovider.py
https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/cognitoidentityprovider.py#L1411-L1688
def create_user_pool(PoolName=None, Policies=None, LambdaConfig=None, AutoVerifiedAttributes=None, AliasAttributes=None, SmsVerificationMessage=None, EmailVerificationMessage=None, EmailVerificationSubject=None, SmsAuthenticationMessage=None, MfaConfiguration=None, DeviceConfiguration=None, EmailConfiguration=None, Sms...
[ "def", "create_user_pool", "(", "PoolName", "=", "None", ",", "Policies", "=", "None", ",", "LambdaConfig", "=", "None", ",", "AutoVerifiedAttributes", "=", "None", ",", "AliasAttributes", "=", "None", ",", "SmsVerificationMessage", "=", "None", ",", "EmailVerif...
Creates a new Amazon Cognito user pool and sets the password policy for the pool. See also: AWS API Documentation :example: response = client.create_user_pool( PoolName='string', Policies={ 'PasswordPolicy': { 'MinimumLength': 123, 'RequireUp...
[ "Creates", "a", "new", "Amazon", "Cognito", "user", "pool", "and", "sets", "the", "password", "policy", "for", "the", "pool", ".", "See", "also", ":", "AWS", "API", "Documentation", ":", "example", ":", "response", "=", "client", ".", "create_user_pool", "...
python
train
45.158273
ThreatConnect-Inc/tcex
tcex/tcex_ti/mappings/tag.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti/mappings/tag.py#L67-L75
def victims(self, filters=None, params=None): """ Gets all victims from a tag. """ victim = self._tcex.ti.victim(None) for v in self.tc_requests.victims_from_tag( victim, self.name, filters=filters, params=params ): yield v
[ "def", "victims", "(", "self", ",", "filters", "=", "None", ",", "params", "=", "None", ")", ":", "victim", "=", "self", ".", "_tcex", ".", "ti", ".", "victim", "(", "None", ")", "for", "v", "in", "self", ".", "tc_requests", ".", "victims_from_tag", ...
Gets all victims from a tag.
[ "Gets", "all", "victims", "from", "a", "tag", "." ]
python
train
31.888889
phaethon/kamene
kamene/contrib/gsm_um.py
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/contrib/gsm_um.py#L2468-L2482
def authenticationAndCipheringResponse( AuthenticationParameterSRES_presence=0, MobileId_presence=0): """AUTHENTICATION AND CIPHERING RESPONSE Section 9.4.10""" a = TpPd(pd=0x3) b = MessageType(mesType=0x13) # 00010011 c = Ac...
[ "def", "authenticationAndCipheringResponse", "(", "AuthenticationParameterSRES_presence", "=", "0", ",", "MobileId_presence", "=", "0", ")", ":", "a", "=", "TpPd", "(", "pd", "=", "0x3", ")", "b", "=", "MessageType", "(", "mesType", "=", "0x13", ")", "# 000100...
AUTHENTICATION AND CIPHERING RESPONSE Section 9.4.10
[ "AUTHENTICATION", "AND", "CIPHERING", "RESPONSE", "Section", "9", ".", "4", ".", "10" ]
python
train
41.6
saltstack/salt
salt/modules/dracr.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dracr.py#L617-L636
def deploy_snmp(snmp, host=None, admin_username=None, admin_password=None, module=None): ''' Change the QuickDeploy SNMP community string, used for switches as well CLI Example: .. code-block:: bash salt dell dracr.deploy_snmp SNMP_STRING host=<remote DRAC or CMC> ...
[ "def", "deploy_snmp", "(", "snmp", ",", "host", "=", "None", ",", "admin_username", "=", "None", ",", "admin_password", "=", "None", ",", "module", "=", "None", ")", ":", "return", "__execute_cmd", "(", "'deploy -v SNMPv2 {0} ro'", ".", "format", "(", "snmp"...
Change the QuickDeploy SNMP community string, used for switches as well CLI Example: .. code-block:: bash salt dell dracr.deploy_snmp SNMP_STRING host=<remote DRAC or CMC> admin_username=<DRAC user> admin_password=<DRAC PW> salt dell dracr.deploy_password diana secret
[ "Change", "the", "QuickDeploy", "SNMP", "community", "string", "used", "for", "switches", "as", "well" ]
python
train
33.95
T-002/pycast
pycast/methods/regression.py
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/regression.py#L174-L200
def lstsq(cls, a, b): """Return the least-squares solution to a linear matrix equation. :param Matrix a: Design matrix with the values of the independent variables. :param Matrix b: Matrix with the "dependent variable" values. b can only have one column. ...
[ "def", "lstsq", "(", "cls", ",", "a", ",", "b", ")", ":", "# Check if the size of the input matrices matches", "if", "a", ".", "get_height", "(", ")", "!=", "b", ".", "get_height", "(", ")", ":", "raise", "ValueError", "(", "\"Size of input matrices does not mat...
Return the least-squares solution to a linear matrix equation. :param Matrix a: Design matrix with the values of the independent variables. :param Matrix b: Matrix with the "dependent variable" values. b can only have one column. :raise: Raises an ...
[ "Return", "the", "least", "-", "squares", "solution", "to", "a", "linear", "matrix", "equation", "." ]
python
train
46.074074
i3visio/osrframework
osrframework/utils/general.py
https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/general.py#L72-L266
def _generateTabularData(res, oldTabularData = {}, isTerminal=False, canUnicode=True): """ Method that recovers the values and columns from the current structure This method is used by: - usufyToCsvExport - usufyToOdsExport - usufyToXlsExport - usufyToXlsxExport Args: ...
[ "def", "_generateTabularData", "(", "res", ",", "oldTabularData", "=", "{", "}", ",", "isTerminal", "=", "False", ",", "canUnicode", "=", "True", ")", ":", "def", "_grabbingNewHeader", "(", "h", ")", ":", "\"\"\"\n Updates the headers to be general.\n\n ...
Method that recovers the values and columns from the current structure This method is used by: - usufyToCsvExport - usufyToOdsExport - usufyToXlsExport - usufyToXlsxExport Args: ----- res: New data to export. oldTabularData: The previous data stored. ...
[ "Method", "that", "recovers", "the", "values", "and", "columns", "from", "the", "current", "structure" ]
python
train
31.25641
opencobra/memote
memote/support/annotation.py
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/annotation.py#L125-L143
def find_components_without_annotation(model, components): """ Find model components with empty annotation attributes. Parameters ---------- model : cobra.Model A cobrapy metabolic model. components : {"metabolites", "reactions", "genes"} A string denoting `cobra.Model` componen...
[ "def", "find_components_without_annotation", "(", "model", ",", "components", ")", ":", "return", "[", "elem", "for", "elem", "in", "getattr", "(", "model", ",", "components", ")", "if", "elem", ".", "annotation", "is", "None", "or", "len", "(", "elem", "....
Find model components with empty annotation attributes. Parameters ---------- model : cobra.Model A cobrapy metabolic model. components : {"metabolites", "reactions", "genes"} A string denoting `cobra.Model` components. Returns ------- list The components without an...
[ "Find", "model", "components", "with", "empty", "annotation", "attributes", "." ]
python
train
27.368421
shakefu/pyconfig
pyconfig/scripts.py
https://github.com/shakefu/pyconfig/blob/000cb127db51e03cb4070aae6943e956193cbad5/pyconfig/scripts.py#L475-L553
def _parse_file(filename, relpath=None): """ Return a list of :class:`_PyconfigCall` from parsing `filename`. :param filename: A file to parse :param relpath: Relative directory to strip (optional) :type filename: str :type relpath: str """ with open(filename, 'r') as source: s...
[ "def", "_parse_file", "(", "filename", ",", "relpath", "=", "None", ")", ":", "with", "open", "(", "filename", ",", "'r'", ")", "as", "source", ":", "source", "=", "source", ".", "read", "(", ")", "pyconfig_calls", "=", "[", "]", "try", ":", "nodes",...
Return a list of :class:`_PyconfigCall` from parsing `filename`. :param filename: A file to parse :param relpath: Relative directory to strip (optional) :type filename: str :type relpath: str
[ "Return", "a", "list", "of", ":", "class", ":", "_PyconfigCall", "from", "parsing", "filename", "." ]
python
valid
30.822785
pixelogik/NearPy
nearpy/hashes/randombinaryprojections.py
https://github.com/pixelogik/NearPy/blob/1b534b864d320d875508e95cd2b76b6d8c07a90b/nearpy/hashes/randombinaryprojections.py#L61-L79
def hash_vector(self, v, querying=False): """ Hashes the vector and returns the binary bucket key as string. """ if scipy.sparse.issparse(v): # If vector is sparse, make sure we have the CSR representation # of the projection matrix if self.normals_csr...
[ "def", "hash_vector", "(", "self", ",", "v", ",", "querying", "=", "False", ")", ":", "if", "scipy", ".", "sparse", ".", "issparse", "(", "v", ")", ":", "# If vector is sparse, make sure we have the CSR representation", "# of the projection matrix", "if", "self", ...
Hashes the vector and returns the binary bucket key as string.
[ "Hashes", "the", "vector", "and", "returns", "the", "binary", "bucket", "key", "as", "string", "." ]
python
train
46.473684
googleads/googleads-python-lib
examples/adwords/adwords_appengine_demo/handlers/api_handler.py
https://github.com/googleads/googleads-python-lib/blob/aa3b1b474b0f9789ca55ca46f4b2b57aeae38874/examples/adwords/adwords_appengine_demo/handlers/api_handler.py#L213-L252
def GetCampaigns(self, client_customer_id): """Returns a client account's Campaigns that haven't been removed. Args: client_customer_id: str Client Customer Id used to retrieve Campaigns. Returns: list List of Campaign data objects. """ self.client.SetClientCustomerId(client_customer_i...
[ "def", "GetCampaigns", "(", "self", ",", "client_customer_id", ")", ":", "self", ".", "client", ".", "SetClientCustomerId", "(", "client_customer_id", ")", "# A somewhat hackish workaround for \"The read operation timed out\" error,", "# which could be triggered on AppEngine's end ...
Returns a client account's Campaigns that haven't been removed. Args: client_customer_id: str Client Customer Id used to retrieve Campaigns. Returns: list List of Campaign data objects.
[ "Returns", "a", "client", "account", "s", "Campaigns", "that", "haven", "t", "been", "removed", "." ]
python
train
32.575
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/templatetags/wagtailrelations_tags.py
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/templatetags/wagtailrelations_tags.py#L17-L30
def get_related(page): """ Returns list of related Entry instances for specified page. :param page: the page instance. :rtype: list. """ related = [] entry = Entry.get_for_model(page) if entry: related = entry.related return related
[ "def", "get_related", "(", "page", ")", ":", "related", "=", "[", "]", "entry", "=", "Entry", ".", "get_for_model", "(", "page", ")", "if", "entry", ":", "related", "=", "entry", ".", "related", "return", "related" ]
Returns list of related Entry instances for specified page. :param page: the page instance. :rtype: list.
[ "Returns", "list", "of", "related", "Entry", "instances", "for", "specified", "page", "." ]
python
train
19.142857
nrcharles/caelum
caelum/tools.py
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L32-L46
def download_extract(url): """download and extract file.""" logger.info("Downloading %s", url) request = urllib2.Request(url) request.add_header('User-Agent', 'caelum/0.1 +https://github.com/nrcharles/caelum') opener = urllib2.build_opener() with tempfile.TemporaryFile(suf...
[ "def", "download_extract", "(", "url", ")", ":", "logger", ".", "info", "(", "\"Downloading %s\"", ",", "url", ")", "request", "=", "urllib2", ".", "Request", "(", "url", ")", "request", ".", "add_header", "(", "'User-Agent'", ",", "'caelum/0.1 +https://github...
download and extract file.
[ "download", "and", "extract", "file", "." ]
python
train
46.333333
tensorforce/tensorforce
tensorforce/execution/base_runner.py
https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/tensorforce/execution/base_runner.py#L53-L67
def reset(self, history=None): """ Resets the Runner's internal stats counters. If history is empty, use default values in history.get(). Args: history (dict): A dictionary containing an already run experiment's results. Keys should be: episode_rewards (list ...
[ "def", "reset", "(", "self", ",", "history", "=", "None", ")", ":", "if", "not", "history", ":", "history", "=", "dict", "(", ")", "self", ".", "episode_rewards", "=", "history", ".", "get", "(", "\"episode_rewards\"", ",", "list", "(", ")", ")", "se...
Resets the Runner's internal stats counters. If history is empty, use default values in history.get(). Args: history (dict): A dictionary containing an already run experiment's results. Keys should be: episode_rewards (list of rewards), episode_timesteps (lengths of episodes...
[ "Resets", "the", "Runner", "s", "internal", "stats", "counters", ".", "If", "history", "is", "empty", "use", "default", "values", "in", "history", ".", "get", "()", "." ]
python
valid
44.066667
mwgielen/jackal
jackal/scripts/dns_discover.py
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/dns_discover.py#L48-L70
def zone_transfer(address, dns_name): """ Tries to perform a zone transfer. """ ips = [] try: print_notification("Attempting dns zone transfer for {} on {}".format(dns_name, address)) z = dns.zone.from_xfr(dns.query.xfr(address, dns_name)) except dns.exception.FormError: ...
[ "def", "zone_transfer", "(", "address", ",", "dns_name", ")", ":", "ips", "=", "[", "]", "try", ":", "print_notification", "(", "\"Attempting dns zone transfer for {} on {}\"", ".", "format", "(", "dns_name", ",", "address", ")", ")", "z", "=", "dns", ".", "...
Tries to perform a zone transfer.
[ "Tries", "to", "perform", "a", "zone", "transfer", "." ]
python
valid
36.043478