nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
mkdocs/mkdocs
cff5b55d59aa37da5aa67aadd9673167035d9d1c
mkdocs/utils/__init__.py
python
reduce_list
(data_set)
return [item for item in data_set if item not in seen and not seen.add(item)]
Reduce duplicate items in a list and preserve order
Reduce duplicate items in a list and preserve order
[ "Reduce", "duplicate", "items", "in", "a", "list", "and", "preserve", "order" ]
def reduce_list(data_set): """ Reduce duplicate items in a list and preserve order """ seen = set() return [item for item in data_set if item not in seen and not seen.add(item)]
[ "def", "reduce_list", "(", "data_set", ")", ":", "seen", "=", "set", "(", ")", "return", "[", "item", "for", "item", "in", "data_set", "if", "item", "not", "in", "seen", "and", "not", "seen", ".", "add", "(", "item", ")", "]" ]
https://github.com/mkdocs/mkdocs/blob/cff5b55d59aa37da5aa67aadd9673167035d9d1c/mkdocs/utils/__init__.py#L119-L123
matt-graham/mici
aa209e2cf698bb9e0c7c733d7b6a5557ab5df190
mici/systems.py
python
ConstrainedEuclideanMetricSystem.__init__
( self, neg_log_dens, constr, metric=None, dens_wrt_hausdorff=True, grad_neg_log_dens=None, jacob_constr=None, )
Args: neg_log_dens (Callable[[array], float]): Function which given a position array returns the negative logarithm of an unnormalized probability density on the constrained position space with respect to the Hausdorff measure on the constraint ...
Args: neg_log_dens (Callable[[array], float]): Function which given a position array returns the negative logarithm of an unnormalized probability density on the constrained position space with respect to the Hausdorff measure on the constraint ...
[ "Args", ":", "neg_log_dens", "(", "Callable", "[[", "array", "]", "float", "]", ")", ":", "Function", "which", "given", "a", "position", "array", "returns", "the", "negative", "logarithm", "of", "an", "unnormalized", "probability", "density", "on", "the", "c...
def __init__( self, neg_log_dens, constr, metric=None, dens_wrt_hausdorff=True, grad_neg_log_dens=None, jacob_constr=None, ): """ Args: neg_log_dens (Callable[[array], float]): Function which given a position array r...
[ "def", "__init__", "(", "self", ",", "neg_log_dens", ",", "constr", ",", "metric", "=", "None", ",", "dens_wrt_hausdorff", "=", "True", ",", "grad_neg_log_dens", "=", "None", ",", "jacob_constr", "=", "None", ",", ")", ":", "super", "(", ")", ".", "__ini...
https://github.com/matt-graham/mici/blob/aa209e2cf698bb9e0c7c733d7b6a5557ab5df190/mici/systems.py#L459-L564
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Gui/GuiFunctions.py
python
PandasModel.columnCount
(self, parent=None)
return self.c
:param parent: :return:
[]
def columnCount(self, parent=None): """ :param parent: :return: """ return self.c
[ "def", "columnCount", "(", "self", ",", "parent", "=", "None", ")", ":", "return", "self", ".", "c" ]
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Gui/GuiFunctions.py#L321-L327
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/bulletin_dto.py
python
BulletinDTO.timestamp
(self, timestamp)
Sets the timestamp of this BulletinDTO. When this bulletin was generated. :param timestamp: The timestamp of this BulletinDTO. :type: str
Sets the timestamp of this BulletinDTO. When this bulletin was generated.
[ "Sets", "the", "timestamp", "of", "this", "BulletinDTO", ".", "When", "this", "bulletin", "was", "generated", "." ]
def timestamp(self, timestamp): """ Sets the timestamp of this BulletinDTO. When this bulletin was generated. :param timestamp: The timestamp of this BulletinDTO. :type: str """ self._timestamp = timestamp
[ "def", "timestamp", "(", "self", ",", "timestamp", ")", ":", "self", ".", "_timestamp", "=", "timestamp" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/bulletin_dto.py#L287-L296
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/pupylib/PupyCmd.py
python
WindowsColoredStdout.read
(self, *args, **kwargs)
[]
def read(self, *args, **kwargs): sys.stdout.read(*args, **kwargs)
[ "def", "read", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "sys", ".", "stdout", ".", "read", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/pupylib/PupyCmd.py#L144-L145
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/core/base/units_container.py
python
_PyomoUnit.__call__
(self, exception=True)
return 1.0
Unit is treated as a constant value, and this method always returns 1.0 Returns ------- : float Returns 1.0
Unit is treated as a constant value, and this method always returns 1.0
[ "Unit", "is", "treated", "as", "a", "constant", "value", "and", "this", "method", "always", "returns", "1", ".", "0" ]
def __call__(self, exception=True): """Unit is treated as a constant value, and this method always returns 1.0 Returns ------- : float Returns 1.0 """ return 1.0
[ "def", "__call__", "(", "self", ",", "exception", "=", "True", ")", ":", "return", "1.0" ]
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/core/base/units_container.py#L369-L377
hardbyte/python-can
e7a2b040ee1f0cdd7fd77fbfef0454353166b333
can/interfaces/ixxat/canlib_vcinpl.py
python
IXXATBus.flush_tx_buffer
(self)
Flushes the transmit buffer on the IXXAT
Flushes the transmit buffer on the IXXAT
[ "Flushes", "the", "transmit", "buffer", "on", "the", "IXXAT" ]
def flush_tx_buffer(self): """Flushes the transmit buffer on the IXXAT""" # TODO #64: no timeout? _canlib.canChannelWaitTxEvent(self._channel_handle, constants.INFINITE)
[ "def", "flush_tx_buffer", "(", "self", ")", ":", "# TODO #64: no timeout?", "_canlib", ".", "canChannelWaitTxEvent", "(", "self", ".", "_channel_handle", ",", "constants", ".", "INFINITE", ")" ]
https://github.com/hardbyte/python-can/blob/e7a2b040ee1f0cdd7fd77fbfef0454353166b333/can/interfaces/ixxat/canlib_vcinpl.py#L635-L638
sentinel-hub/sentinelhub-py
d7ad283cf9d4bd4c8c1a8b169cdbe37c5bc8208a
sentinelhub/sentinelhub_batch.py
python
SentinelHubBatch.delete_collection
(self, collection)
return self.client.get_json( url=self._get_collections_url(collection_id), request_type=RequestType.DELETE, use_session=True )
Delete an existing batch collection `Batch API reference <https://docs.sentinel-hub.com/api/latest/reference/#operation/deleteBatchCollection>`__ :param collection: Batch collection id or object :type collection: str or BatchCollection
Delete an existing batch collection
[ "Delete", "an", "existing", "batch", "collection" ]
def delete_collection(self, collection): """ Delete an existing batch collection `Batch API reference <https://docs.sentinel-hub.com/api/latest/reference/#operation/deleteBatchCollection>`__ :param collection: Batch collection id or object :type collection: str or BatchCollection ...
[ "def", "delete_collection", "(", "self", ",", "collection", ")", ":", "collection_id", "=", "self", ".", "_parse_collection_id", "(", "collection", ")", "return", "self", ".", "client", ".", "get_json", "(", "url", "=", "self", ".", "_get_collections_url", "("...
https://github.com/sentinel-hub/sentinelhub-py/blob/d7ad283cf9d4bd4c8c1a8b169cdbe37c5bc8208a/sentinelhub/sentinelhub_batch.py#L459-L472
openmc-dev/openmc
0cf7d9283786677e324bfbdd0984a54d1c86dacc
openmc/data/resonance_covariance.py
python
MultiLevelBreitWignerCovariance.from_endf
(cls, ev, file_obj, items, resonance)
return mlbw
Create MLBW covariance data from an ENDF evaluation. Parameters ---------- ev : openmc.data.endf.Evaluation ENDF evaluation file_obj : file-like object ENDF file positioned at the second record of a resonance range subsection in MF=32, MT=151 ...
Create MLBW covariance data from an ENDF evaluation.
[ "Create", "MLBW", "covariance", "data", "from", "an", "ENDF", "evaluation", "." ]
def from_endf(cls, ev, file_obj, items, resonance): """Create MLBW covariance data from an ENDF evaluation. Parameters ---------- ev : openmc.data.endf.Evaluation ENDF evaluation file_obj : file-like object ENDF file positioned at the second record of a r...
[ "def", "from_endf", "(", "cls", ",", "ev", ",", "file_obj", ",", "items", ",", "resonance", ")", ":", "# Read energy-dependent scattering radius if present", "energy_min", ",", "energy_max", "=", "items", "[", "0", ":", "2", "]", "nro", ",", "naps", "=", "it...
https://github.com/openmc-dev/openmc/blob/0cf7d9283786677e324bfbdd0984a54d1c86dacc/openmc/data/resonance_covariance.py#L350-L497
pyqtgraph/pyqtgraph
ac3887abfca4e529aac44f022f8e40556a2587b0
pyqtgraph/widgets/SpinBox.py
python
SpinBox.setDecimals
(self, decimals)
Set the number of decimals to be displayed when formatting numeric values.
Set the number of decimals to be displayed when formatting numeric values.
[ "Set", "the", "number", "of", "decimals", "to", "be", "displayed", "when", "formatting", "numeric", "values", "." ]
def setDecimals(self, decimals): """Set the number of decimals to be displayed when formatting numeric values. """ self.setOpts(decimals=decimals)
[ "def", "setDecimals", "(", "self", ",", "decimals", ")", ":", "self", ".", "setOpts", "(", "decimals", "=", "decimals", ")" ]
https://github.com/pyqtgraph/pyqtgraph/blob/ac3887abfca4e529aac44f022f8e40556a2587b0/pyqtgraph/widgets/SpinBox.py#L287-L291
wistbean/fxxkpython
88e16d79d8dd37236ba6ecd0d0ff11d63143968c
vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/util.py
python
EventMixin.get_subscribers
(self, event)
return iter(self._subscribers.get(event, ()))
Return an iterator for the subscribers for an event. :param event: The event to return subscribers for.
Return an iterator for the subscribers for an event. :param event: The event to return subscribers for.
[ "Return", "an", "iterator", "for", "the", "subscribers", "for", "an", "event", ".", ":", "param", "event", ":", "The", "event", "to", "return", "subscribers", "for", "." ]
def get_subscribers(self, event): """ Return an iterator for the subscribers for an event. :param event: The event to return subscribers for. """ return iter(self._subscribers.get(event, ()))
[ "def", "get_subscribers", "(", "self", ",", "event", ")", ":", "return", "iter", "(", "self", ".", "_subscribers", ".", "get", "(", "event", ",", "(", ")", ")", ")" ]
https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/util.py#L1020-L1025
PaloAltoNetworks/pan-os-python
30f6cd9e29d0e3c2549d46c722f6dcb507acd437
panos/userid.py
python
UserId.get_user_tags
(self, user=None, prefix=None)
return ans
Get the dynamic user tags. Note: PAN-OS 9.1+ Args: user: Get only this user's tags, not all users and all tags. prefix: Override class tag prefix. Returns: dict: Dict where the user is the key and the value is a list of tags.
Get the dynamic user tags.
[ "Get", "the", "dynamic", "user", "tags", "." ]
def get_user_tags(self, user=None, prefix=None): """ Get the dynamic user tags. Note: PAN-OS 9.1+ Args: user: Get only this user's tags, not all users and all tags. prefix: Override class tag prefix. Returns: dict: Dict where the user is the...
[ "def", "get_user_tags", "(", "self", ",", "user", "=", "None", ",", "prefix", "=", "None", ")", ":", "if", "prefix", "is", "None", ":", "prefix", "=", "self", ".", "prefix", "limit", "=", "500", "start", "=", "1", "start_elm", "=", "None", "msg", "...
https://github.com/PaloAltoNetworks/pan-os-python/blob/30f6cd9e29d0e3c2549d46c722f6dcb507acd437/panos/userid.py#L621-L684
openstack/neutron
fb229fb527ac8b95526412f7762d90826ac41428
neutron/db/l3_agentschedulers_db.py
python
L3AgentSchedulerDbMixin.get_routers_l3_agents_count
(self, context)
return [(self._make_router_dict(router_model), agent_count if agent_count else 0) for router_model, agent_count in l3_model_list]
Return a map between routers and agent counts for all routers.
Return a map between routers and agent counts for all routers.
[ "Return", "a", "map", "between", "routers", "and", "agent", "counts", "for", "all", "routers", "." ]
def get_routers_l3_agents_count(self, context): """Return a map between routers and agent counts for all routers.""" # TODO(sshank): This portion needs Router OVO integration when it is # merged. l3_model_list = l3_objs.RouterExtraAttributes.get_router_agents_count( context) ...
[ "def", "get_routers_l3_agents_count", "(", "self", ",", "context", ")", ":", "# TODO(sshank): This portion needs Router OVO integration when it is", "# merged.", "l3_model_list", "=", "l3_objs", ".", "RouterExtraAttributes", ".", "get_router_agents_count", "(", "context", ")", ...
https://github.com/openstack/neutron/blob/fb229fb527ac8b95526412f7762d90826ac41428/neutron/db/l3_agentschedulers_db.py#L401-L409
ioflo/ioflo
177ac656d7c4ff801aebb0d8b401db365a5248ce
ioflo/aid/aggregating.py
python
gowa
(w, wm, l=1.0)
return math.pow(s, 1/l)
Generalized Ordered Weighted Averaging Operator More info can be found here: https://pdfs.semanticscholar.org/2810/c971af0d01d085c799fb2295dc5668d055c8.pdf l = -1 = Ordered Weighted Harmonic Averaging Operator l = -.000000000001 = Ordered Weighted Geometric Averaging Operator l = 1 ...
Generalized Ordered Weighted Averaging Operator More info can be found here: https://pdfs.semanticscholar.org/2810/c971af0d01d085c799fb2295dc5668d055c8.pdf
[ "Generalized", "Ordered", "Weighted", "Averaging", "Operator", "More", "info", "can", "be", "found", "here", ":", "https", ":", "//", "pdfs", ".", "semanticscholar", ".", "org", "/", "2810", "/", "c971af0d01d085c799fb2295dc5668d055c8", ".", "pdf" ]
def gowa(w, wm, l=1.0): """ Generalized Ordered Weighted Averaging Operator More info can be found here: https://pdfs.semanticscholar.org/2810/c971af0d01d085c799fb2295dc5668d055c8.pdf l = -1 = Ordered Weighted Harmonic Averaging Operator l = -.000000000001 = Ordered Weighted Geo...
[ "def", "gowa", "(", "w", ",", "wm", ",", "l", "=", "1.0", ")", ":", "if", "len", "(", "w", ")", "!=", "len", "(", "wm", ")", ":", "raise", "ValueError", "(", "\"Weights and membership value lists must be of equal length.\"", ")", "if", "l", "==", "0", ...
https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/aid/aggregating.py#L60-L89
Ledger-Donjon/lascar
7a1fc2187a9b642efcdda5d9177f86ec2345d7ba
lascar/tools/signal_processing.py
python
running_min
(x, window=32)
return L
Returns min of consecutive windows of x, each max repeated window times
Returns min of consecutive windows of x, each max repeated window times
[ "Returns", "min", "of", "consecutive", "windows", "of", "x", "each", "max", "repeated", "window", "times" ]
def running_min(x, window=32): """ Returns min of consecutive windows of x, each max repeated window times """ n = x.shape[0] L = np.zeros(n, dtype=x.dtype) for i in range(0, n - window, window): L[i : i + window] = np.repeat(x[i : i + window].min(), window) leftover = n % window ...
[ "def", "running_min", "(", "x", ",", "window", "=", "32", ")", ":", "n", "=", "x", ".", "shape", "[", "0", "]", "L", "=", "np", ".", "zeros", "(", "n", ",", "dtype", "=", "x", ".", "dtype", ")", "for", "i", "in", "range", "(", "0", ",", "...
https://github.com/Ledger-Donjon/lascar/blob/7a1fc2187a9b642efcdda5d9177f86ec2345d7ba/lascar/tools/signal_processing.py#L144-L155
SpamScope/spamscope
ffbfc53b9a3503ef3041cee94c6726c8b899118d
src/modules/attachments/thug_analysis.py
python
CustomWatchdog.handler
(self, signum, frame)
Function that handles Thug timeout
Function that handles Thug timeout
[ "Function", "that", "handles", "Thug", "timeout" ]
def handler(self, signum, frame): """ Function that handles Thug timeout """ msg = "The analysis took more than {} seconds.".format(self.time) log.critical(msg) if self.callback: self.callback(signum, frame) log.ThugLogging.log_event() raise ...
[ "def", "handler", "(", "self", ",", "signum", ",", "frame", ")", ":", "msg", "=", "\"The analysis took more than {} seconds.\"", ".", "format", "(", "self", ".", "time", ")", "log", ".", "critical", "(", "msg", ")", "if", "self", ".", "callback", ":", "s...
https://github.com/SpamScope/spamscope/blob/ffbfc53b9a3503ef3041cee94c6726c8b899118d/src/modules/attachments/thug_analysis.py#L70-L81
noamraph/dreampie
b09ee546ec099ee6549c649692ceb129e05fb229
dreampielib/gui/tags.py
python
get_theme
(config, theme_name)
return theme
Get a theme description (a dict of tuples, see above) from a config object.
Get a theme description (a dict of tuples, see above) from a config object.
[ "Get", "a", "theme", "description", "(", "a", "dict", "of", "tuples", "see", "above", ")", "from", "a", "config", "object", "." ]
def get_theme(config, theme_name): """ Get a theme description (a dict of tuples, see above) from a config object. """ section = theme_name + THEME_POSTFIX if not config.get_bool('is-active', section): raise ValueError("Theme %s is not active" % theme_name) theme = {} for tag, _desc ...
[ "def", "get_theme", "(", "config", ",", "theme_name", ")", ":", "section", "=", "theme_name", "+", "THEME_POSTFIX", "if", "not", "config", ".", "get_bool", "(", "'is-active'", ",", "section", ")", ":", "raise", "ValueError", "(", "\"Theme %s is not active\"", ...
https://github.com/noamraph/dreampie/blob/b09ee546ec099ee6549c649692ceb129e05fb229/dreampielib/gui/tags.py#L154-L168
allegro/ralph
1e4a9e1800d5f664abaef2624b8bf7512df279ce
src/ralph/admin/mixins.py
python
BulkEditChangeListMixin.get_list_display
(self, request)
return super().get_list_display(request)
Override django admin get list display method. Set new values for fields list_editable and list_display.
Override django admin get list display method. Set new values for fields list_editable and list_display.
[ "Override", "django", "admin", "get", "list", "display", "method", ".", "Set", "new", "values", "for", "fields", "list_editable", "and", "list_display", "." ]
def get_list_display(self, request): """ Override django admin get list display method. Set new values for fields list_editable and list_display. """ self.list_editable = [] if request.GET.get(BULK_EDIT_VAR): # separate read-only and editable fields ...
[ "def", "get_list_display", "(", "self", ",", "request", ")", ":", "self", ".", "list_editable", "=", "[", "]", "if", "request", ".", "GET", ".", "get", "(", "BULK_EDIT_VAR", ")", ":", "# separate read-only and editable fields", "bulk_list_display", "=", "self", ...
https://github.com/allegro/ralph/blob/1e4a9e1800d5f664abaef2624b8bf7512df279ce/src/ralph/admin/mixins.py#L543-L573
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/modular/modsym/modsym.py
python
canonical_parameters
(group, weight, sign, base_ring)
return group, weight, sign, base_ring
Return the canonically normalized parameters associated to a choice of group, weight, sign, and base_ring. That is, normalize each of these to be of the correct type, perform all appropriate type checking, etc. EXAMPLES:: sage: p1 = sage.modular.modsym.modsym.canonical_parameters(5,int(2),1,QQ...
Return the canonically normalized parameters associated to a choice of group, weight, sign, and base_ring. That is, normalize each of these to be of the correct type, perform all appropriate type checking, etc.
[ "Return", "the", "canonically", "normalized", "parameters", "associated", "to", "a", "choice", "of", "group", "weight", "sign", "and", "base_ring", ".", "That", "is", "normalize", "each", "of", "these", "to", "be", "of", "the", "correct", "type", "perform", ...
def canonical_parameters(group, weight, sign, base_ring): """ Return the canonically normalized parameters associated to a choice of group, weight, sign, and base_ring. That is, normalize each of these to be of the correct type, perform all appropriate type checking, etc. EXAMPLES:: sa...
[ "def", "canonical_parameters", "(", "group", ",", "weight", ",", "sign", ",", "base_ring", ")", ":", "sign", "=", "rings", ".", "Integer", "(", "sign", ")", "if", "not", "(", "sign", "in", "[", "-", "1", ",", "0", ",", "1", "]", ")", ":", "raise"...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/modsym/modsym.py#L99-L145
Ultimaker/Uranium
66da853cd9a04edd3a8a03526fac81e83c03f5aa
UM/SortedList.py
python
SortedList.__delitem__
(self, index)
Remove value at `index` from sorted list. ``sl.__delitem__(index)`` <==> ``del sl[index]`` Supports slicing. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList('abcde') >>> del sl[2] >>> sl SortedList(['a', 'b', 'd', 'e']) >>> del sl[:...
Remove value at `index` from sorted list.
[ "Remove", "value", "at", "index", "from", "sorted", "list", "." ]
def __delitem__(self, index): """Remove value at `index` from sorted list. ``sl.__delitem__(index)`` <==> ``del sl[index]`` Supports slicing. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList('abcde') >>> del sl[2] >>> sl SortedList([...
[ "def", "__delitem__", "(", "self", ",", "index", ")", ":", "if", "isinstance", "(", "index", ",", "slice", ")", ":", "start", ",", "stop", ",", "step", "=", "index", ".", "indices", "(", "self", ".", "_len", ")", "if", "step", "==", "1", "and", "...
https://github.com/Ultimaker/Uranium/blob/66da853cd9a04edd3a8a03526fac81e83c03f5aa/UM/SortedList.py#L797-L846
rootpy/rootpy
3926935e1f2100d8ba68070c2ab44055d4800f73
rootpy/extern/pyparsing.py
python
ParserElement.inlineLiteralsUsing
(cls)
Set class to be used for inclusion of string literals into a parser.
Set class to be used for inclusion of string literals into a parser.
[ "Set", "class", "to", "be", "used", "for", "inclusion", "of", "string", "literals", "into", "a", "parser", "." ]
def inlineLiteralsUsing(cls): """ Set class to be used for inclusion of string literals into a parser. """ ParserElement.literalStringClass = cls
[ "def", "inlineLiteralsUsing", "(", "cls", ")", ":", "ParserElement", ".", "literalStringClass", "=", "cls" ]
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/pyparsing.py#L800-L804
iterative/dvc
13238e97168007cb5ba21966368457776274b9ca
dvc/repo/experiments/utils.py
python
resolve_name
( scm: "Git", exp_names: Union[Iterable[str], str], git_remote: Optional[str] = None, )
return result
find the ref_info of specified names.
find the ref_info of specified names.
[ "find", "the", "ref_info", "of", "specified", "names", "." ]
def resolve_name( scm: "Git", exp_names: Union[Iterable[str], str], git_remote: Optional[str] = None, ) -> Dict[str, Optional[ExpRefInfo]]: """find the ref_info of specified names.""" if isinstance(exp_names, str): exp_names = [exp_names] result = {} unresolved = set() for exp_n...
[ "def", "resolve_name", "(", "scm", ":", "\"Git\"", ",", "exp_names", ":", "Union", "[", "Iterable", "[", "str", "]", ",", "str", "]", ",", "git_remote", ":", "Optional", "[", "str", "]", "=", "None", ",", ")", "->", "Dict", "[", "str", ",", "Option...
https://github.com/iterative/dvc/blob/13238e97168007cb5ba21966368457776274b9ca/dvc/repo/experiments/utils.py#L180-L212
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/sklearn/datasets/samples_generator.py
python
make_classification
(n_samples=100, n_features=20, n_informative=2, n_redundant=2, n_repeated=0, n_classes=2, n_clusters_per_class=2, weights=None, flip_y=0.01, class_sep=1.0, hypercube=True, shift=0.0, scale=1.0, shuffle=True, random_state=Non...
return X, y
Generate a random n-class classification problem. This initially creates clusters of points normally distributed (std=1) about vertices of a `2 * class_sep`-sided hypercube, and assigns an equal number of clusters to each class. It introduces interdependence between these features and adds various type...
Generate a random n-class classification problem.
[ "Generate", "a", "random", "n", "-", "class", "classification", "problem", "." ]
def make_classification(n_samples=100, n_features=20, n_informative=2, n_redundant=2, n_repeated=0, n_classes=2, n_clusters_per_class=2, weights=None, flip_y=0.01, class_sep=1.0, hypercube=True, shift=0.0, scale=1.0, shuffle...
[ "def", "make_classification", "(", "n_samples", "=", "100", ",", "n_features", "=", "20", ",", "n_informative", "=", "2", ",", "n_redundant", "=", "2", ",", "n_repeated", "=", "0", ",", "n_classes", "=", "2", ",", "n_clusters_per_class", "=", "2", ",", "...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/datasets/samples_generator.py#L38-L247
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/core/serializers/xml_serializer.py
python
Deserializer._handle_m2m_field_node
(self, node, field)
Handle a <field> node for a ManyToManyField.
Handle a <field> node for a ManyToManyField.
[ "Handle", "a", "<field", ">", "node", "for", "a", "ManyToManyField", "." ]
def _handle_m2m_field_node(self, node, field): """ Handle a <field> node for a ManyToManyField. """ model = field.remote_field.model default_manager = model._default_manager if hasattr(default_manager, 'get_by_natural_key'): def m2m_convert(n): ...
[ "def", "_handle_m2m_field_node", "(", "self", ",", "node", ",", "field", ")", ":", "model", "=", "field", ".", "remote_field", ".", "model", "default_manager", "=", "model", ".", "_default_manager", "if", "hasattr", "(", "default_manager", ",", "'get_by_natural_...
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/core/serializers/xml_serializer.py#L285-L315
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_histogram2dcontour.py
python
Histogram2dContour.colorbar
(self)
return self["colorbar"]
The 'colorbar' property is an instance of ColorBar that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2dcontour.ColorBar` - A dict of string/value properties that will be passed to the ColorBar constructor Supported dict properties: ...
The 'colorbar' property is an instance of ColorBar that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2dcontour.ColorBar` - A dict of string/value properties that will be passed to the ColorBar constructor Supported dict properties: ...
[ "The", "colorbar", "property", "is", "an", "instance", "of", "ColorBar", "that", "may", "be", "specified", "as", ":", "-", "An", "instance", "of", ":", "class", ":", "plotly", ".", "graph_objs", ".", "histogram2dcontour", ".", "ColorBar", "-", "A", "dict",...
def colorbar(self): """ The 'colorbar' property is an instance of ColorBar that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2dcontour.ColorBar` - A dict of string/value properties that will be passed to the ColorBar constructor ...
[ "def", "colorbar", "(", "self", ")", ":", "return", "self", "[", "\"colorbar\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_histogram2dcontour.py#L224-L475
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/tornado/httpserver.py
python
_HTTPRequestContext.__init__
( self, stream: iostream.IOStream, address: Tuple, protocol: Optional[str], trusted_downstream: List[str] = None, )
[]
def __init__( self, stream: iostream.IOStream, address: Tuple, protocol: Optional[str], trusted_downstream: List[str] = None, ) -> None: self.address = address # Save the socket's address family now so we know how to # interpret self.address even after...
[ "def", "__init__", "(", "self", ",", "stream", ":", "iostream", ".", "IOStream", ",", "address", ":", "Tuple", ",", "protocol", ":", "Optional", "[", "str", "]", ",", "trusted_downstream", ":", "List", "[", "str", "]", "=", "None", ",", ")", "->", "N...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/tornado/httpserver.py#L287-L319
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/urllib3/exceptions.py
python
InvalidChunkLength.__repr__
(self)
return "InvalidChunkLength(got length %r, %i bytes read)" % ( self.length, self.partial, )
[]
def __repr__(self): return "InvalidChunkLength(got length %r, %i bytes read)" % ( self.length, self.partial, )
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"InvalidChunkLength(got length %r, %i bytes read)\"", "%", "(", "self", ".", "length", ",", "self", ".", "partial", ",", ")" ]
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/urllib3/exceptions.py#L273-L277
webpy/webpy
62245f7da4aab8f8607c192b98d5ef93873f995b
web/webapi.py
python
debug
(*args)
return ""
Prints a prettyprinted version of `args` to stderr.
Prints a prettyprinted version of `args` to stderr.
[ "Prints", "a", "prettyprinted", "version", "of", "args", "to", "stderr", "." ]
def debug(*args): """ Prints a prettyprinted version of `args` to stderr. """ try: out = ctx.environ["wsgi.errors"] except: out = sys.stderr for arg in args: print(pprint.pformat(arg), file=out) return ""
[ "def", "debug", "(", "*", "args", ")", ":", "try", ":", "out", "=", "ctx", ".", "environ", "[", "\"wsgi.errors\"", "]", "except", ":", "out", "=", "sys", ".", "stderr", "for", "arg", "in", "args", ":", "print", "(", "pprint", ".", "pformat", "(", ...
https://github.com/webpy/webpy/blob/62245f7da4aab8f8607c192b98d5ef93873f995b/web/webapi.py#L605-L615
zeropointdynamics/zelos
0c5bd57b4bab56c23c27dc5301ba1a42ee054726
src/zelos/scheduler.py
python
Scheduler.stop
(self, stop_reason: str)
Stops execution of the running processes, exiting the run loop. If there is no process running, this will prevent the next run. Args: stop_reason: A string passed in for debugging purposes to indicate what caused Zelos to stop.
Stops execution of the running processes, exiting the run loop. If there is no process running, this will prevent the next run.
[ "Stops", "execution", "of", "the", "running", "processes", "exiting", "the", "run", "loop", ".", "If", "there", "is", "no", "process", "running", "this", "will", "prevent", "the", "next", "run", "." ]
def stop(self, stop_reason: str) -> None: """ Stops execution of the running processes, exiting the run loop. If there is no process running, this will prevent the next run. Args: stop_reason: A string passed in for debugging purposes to indicate what caused ...
[ "def", "stop", "(", "self", ",", "stop_reason", ":", "str", ")", "->", "None", ":", "self", ".", "stop_and_exec", "(", "stop_reason", ",", "lambda", ":", "False", ")" ]
https://github.com/zeropointdynamics/zelos/blob/0c5bd57b4bab56c23c27dc5301ba1a42ee054726/src/zelos/scheduler.py#L50-L60
pyjanitor-devs/pyjanitor
2207c0bddbf7e23f56e87892de0405787b11621e
janitor/functions/utils.py
python
_column_sel_dispatch
(columns_to_select, df)
return [*df.columns[filtered_columns]]
Base function for column selection. Applies only to callables. The callable is applied to every column in the dataframe. Either True or False is expected per column. A list of column names is returned.
Base function for column selection. Applies only to callables. The callable is applied to every column in the dataframe. Either True or False is expected per column. A list of column names is returned.
[ "Base", "function", "for", "column", "selection", ".", "Applies", "only", "to", "callables", ".", "The", "callable", "is", "applied", "to", "every", "column", "in", "the", "dataframe", ".", "Either", "True", "or", "False", "is", "expected", "per", "column", ...
def _column_sel_dispatch(columns_to_select, df): # noqa: F811 """ Base function for column selection. Applies only to callables. The callable is applied to every column in the dataframe. Either True or False is expected per column. A list of column names is returned. """ # the function ...
[ "def", "_column_sel_dispatch", "(", "columns_to_select", ",", "df", ")", ":", "# noqa: F811", "# the function will be applied per series.", "# this allows filtration based on the contents of the series", "# or based on the name of the series,", "# which happens to be a column name as well.",...
https://github.com/pyjanitor-devs/pyjanitor/blob/2207c0bddbf7e23f56e87892de0405787b11621e/janitor/functions/utils.py#L419-L444
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/species/generating_series.py
python
ExponentialGeneratingSeriesRing
(R)
return ExponentialGeneratingSeriesRing_class(R)
Return the ring of exponential generating series over ``R``. Note that it is just a :class:`LazyPowerSeriesRing` whose elements have some extra methods. EXAMPLES:: sage: from sage.combinat.species.generating_series import ExponentialGeneratingSeriesRing sage: R = ExponentialGenerating...
Return the ring of exponential generating series over ``R``.
[ "Return", "the", "ring", "of", "exponential", "generating", "series", "over", "R", "." ]
def ExponentialGeneratingSeriesRing(R): """ Return the ring of exponential generating series over ``R``. Note that it is just a :class:`LazyPowerSeriesRing` whose elements have some extra methods. EXAMPLES:: sage: from sage.combinat.species.generating_series import ExponentialGenerati...
[ "def", "ExponentialGeneratingSeriesRing", "(", "R", ")", ":", "return", "ExponentialGeneratingSeriesRing_class", "(", "R", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/species/generating_series.py#L167-L194
Yelp/clusterman
54beef89c01a2681aafd1fbb93b6ad5f6252d6cf
clusterman/simulator/simulated_spot_fleet_resource_group.py
python
SimulatedSpotFleetResourceGroup._get_resource_group_tags
(self)
return {}
[]
def _get_resource_group_tags(self): return {}
[ "def", "_get_resource_group_tags", "(", "self", ")", ":", "return", "{", "}" ]
https://github.com/Yelp/clusterman/blob/54beef89c01a2681aafd1fbb93b6ad5f6252d6cf/clusterman/simulator/simulated_spot_fleet_resource_group.py#L212-L213
avocado-framework/avocado
1f9b3192e8ba47d029c33fe21266bd113d17811f
avocado/utils/asset.py
python
Asset._verify_hash
(self, asset_path)
return self._has_valid_hash(asset_path, self.asset_hash)
Verify if the `asset_path` hash matches the hash in the hash file. :param asset_path: full path of the asset file. :returns: True when self.asset_hash is None or when it has the same value as the hash of the asset_file, otherwise return False. :rtype: bool
Verify if the `asset_path` hash matches the hash in the hash file.
[ "Verify", "if", "the", "asset_path", "hash", "matches", "the", "hash", "in", "the", "hash", "file", "." ]
def _verify_hash(self, asset_path): """ Verify if the `asset_path` hash matches the hash in the hash file. :param asset_path: full path of the asset file. :returns: True when self.asset_hash is None or when it has the same value as the hash of the asset_file, otherwise return Fa...
[ "def", "_verify_hash", "(", "self", ",", "asset_path", ")", ":", "return", "self", ".", "_has_valid_hash", "(", "asset_path", ",", "self", ".", "asset_hash", ")" ]
https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/avocado/utils/asset.py#L330-L339
PyHDI/veriloggen
2382d200deabf59cfcfd741f5eba371010aaf2bb
veriloggen/dataflow/visitor.py
python
InputVisitor.visit__Variable
(self, node)
return set([node])
[]
def visit__Variable(self, node): if isinstance(node.input_data, dtypes._Numeric): return self.visit(node.input_data) return set([node])
[ "def", "visit__Variable", "(", "self", ",", "node", ")", ":", "if", "isinstance", "(", "node", ".", "input_data", ",", "dtypes", ".", "_Numeric", ")", ":", "return", "self", ".", "visit", "(", "node", ".", "input_data", ")", "return", "set", "(", "[", ...
https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/dataflow/visitor.py#L107-L110
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/typing.py
python
_subs_tree
(cls, tvars=None, args=None)
return tree_args
Calculate substitution tree for generic cls after replacing its type parameters with substitutions in tvars -> args (if any). Repeat the same cyclicaly following __origin__'s.
Calculate substitution tree for generic cls after replacing its type parameters with substitutions in tvars -> args (if any). Repeat the same cyclicaly following __origin__'s.
[ "Calculate", "substitution", "tree", "for", "generic", "cls", "after", "replacing", "its", "type", "parameters", "with", "substitutions", "in", "tvars", "-", ">", "args", "(", "if", "any", ")", ".", "Repeat", "the", "same", "cyclicaly", "following", "__origin_...
def _subs_tree(cls, tvars=None, args=None): """ Calculate substitution tree for generic cls after replacing its type parameters with substitutions in tvars -> args (if any). Repeat the same cyclicaly following __origin__'s. """ if cls.__origin__ is None: return cls # Make of chain of or...
[ "def", "_subs_tree", "(", "cls", ",", "tvars", "=", "None", ",", "args", "=", "None", ")", ":", "if", "cls", ".", "__origin__", "is", "None", ":", "return", "cls", "# Make of chain of origins (i.e. cls -> cls.__origin__)", "current", "=", "cls", ".", "__origin...
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/typing.py#L582-L606
NVIDIA/OpenSeq2Seq
8681d381ed404fde516e2c1b823de5a213c59aba
open_seq2seq/parts/rnns/attention_wrapper.py
python
AttentionWrapper.__init__
( self, cell, attention_mechanism, attention_layer_size=None, alignment_history=False, cell_input_fn=None, output_attention=True, initial_cell_state=None, name=None )
Construct the `AttentionWrapper`. **NOTE** If you are using the `BeamSearchDecoder` with a cell wrapped in `AttentionWrapper`, then you must ensure that: - The encoder output has been tiled to `beam_width` via @{tf.contrib.seq2seq.tile_batch} (NOT `tf.tile`). - The `batch_size` argument passed t...
Construct the `AttentionWrapper`.
[ "Construct", "the", "AttentionWrapper", "." ]
def __init__( self, cell, attention_mechanism, attention_layer_size=None, alignment_history=False, cell_input_fn=None, output_attention=True, initial_cell_state=None, name=None ): """Construct the `AttentionWrapper`. **NOTE** If you are using the `BeamSea...
[ "def", "__init__", "(", "self", ",", "cell", ",", "attention_mechanism", ",", "attention_layer_size", "=", "None", ",", "alignment_history", "=", "False", ",", "cell_input_fn", "=", "None", ",", "output_attention", "=", "True", ",", "initial_cell_state", "=", "N...
https://github.com/NVIDIA/OpenSeq2Seq/blob/8681d381ed404fde516e2c1b823de5a213c59aba/open_seq2seq/parts/rnns/attention_wrapper.py#L1422-L1593
jbjorne/TEES
caf19a4a1352ac59f5dc13a8684cc42ce4342d9d
ExampleBuilders/ExampleStats.py
python
ExampleStats.printStats
(self)
[]
def printStats(self): print >> sys.stderr, "Example Statistics (total/filtered)" #print >> sys.stderr, self.examplesByClass.keys() counts = [0,0] for className in sorted(self.examplesByClass.keys()): if self.filteredByClassByFilter.has_key(className): filterSt...
[ "def", "printStats", "(", "self", ")", ":", "print", ">>", "sys", ".", "stderr", ",", "\"Example Statistics (total/filtered)\"", "#print >> sys.stderr, self.examplesByClass.keys()", "counts", "=", "[", "0", ",", "0", "]", "for", "className", "in", "sorted", "(", "...
https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/ExampleBuilders/ExampleStats.py#L64-L84
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/profile.py
python
ProfileMenuSaveListener.__init__
( self, menu, window )
Set the menu.
Set the menu.
[ "Set", "the", "menu", "." ]
def __init__( self, menu, window ): "Set the menu." self.menu = menu addToProfileMenu( menu ) euclidean.addElementToListTableIfNotThere( self, window, settings.globalProfileSaveListenerListTable )
[ "def", "__init__", "(", "self", ",", "menu", ",", "window", ")", ":", "self", ".", "menu", "=", "menu", "addToProfileMenu", "(", "menu", ")", "euclidean", ".", "addElementToListTableIfNotThere", "(", "self", ",", "window", ",", "settings", ".", "globalProfil...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/profile.py#L109-L113
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/transaction.py
python
PartialTxInput.already_has_some_signatures
(self)
return (self.part_sigs or self.script_sig is not None or self.witness is not None)
Returns whether progress has been made towards completing this input.
Returns whether progress has been made towards completing this input.
[ "Returns", "whether", "progress", "has", "been", "made", "towards", "completing", "this", "input", "." ]
def already_has_some_signatures(self) -> bool: """Returns whether progress has been made towards completing this input.""" return (self.part_sigs or self.script_sig is not None or self.witness is not None)
[ "def", "already_has_some_signatures", "(", "self", ")", "->", "bool", ":", "return", "(", "self", ".", "part_sigs", "or", "self", ".", "script_sig", "is", "not", "None", "or", "self", ".", "witness", "is", "not", "None", ")" ]
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/transaction.py#L1558-L1562
FrancoisSchnell/GPicSync
07d7c4b7da44e4e6665abb94bbb9ef6da0e779d1
src/gpicsync-GUI.py
python
GUI.geoWriterFrame
(self,evt)
Frame to manually write latitude/longitude in the EXIF header of the picture
Frame to manually write latitude/longitude in the EXIF header of the picture
[ "Frame", "to", "manually", "write", "latitude", "/", "longitude", "in", "the", "EXIF", "header", "of", "the", "picture" ]
def geoWriterFrame(self,evt): """ Frame to manually write latitude/longitude in the EXIF header of the picture""" self.winGeoFrame=wx.Frame(win,size=(300,300),title=("Manual latitude/longitude EXIF writer")) bkg=wx.Panel(self.winGeoFrame) instructionLabel = wx.StaticText(bkg, -1,("Enter ...
[ "def", "geoWriterFrame", "(", "self", ",", "evt", ")", ":", "self", ".", "winGeoFrame", "=", "wx", ".", "Frame", "(", "win", ",", "size", "=", "(", "300", ",", "300", ")", ",", "title", "=", "(", "\"Manual latitude/longitude EXIF writer\"", ")", ")", "...
https://github.com/FrancoisSchnell/GPicSync/blob/07d7c4b7da44e4e6665abb94bbb9ef6da0e779d1/src/gpicsync-GUI.py#L649-L674
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/utils/__init__.py
python
get_password_strength_level
(password)
return calculate_bitwise(num)
[]
def get_password_strength_level(password): num = 0 for letter in password: # get ascii dec # bitwise OR num |= get_char_mode(ord(letter)) return calculate_bitwise(num)
[ "def", "get_password_strength_level", "(", "password", ")", ":", "num", "=", "0", "for", "letter", "in", "password", ":", "# get ascii dec", "# bitwise OR", "num", "|=", "get_char_mode", "(", "ord", "(", "letter", ")", ")", "return", "calculate_bitwise", "(", ...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/utils/__init__.py#L1195-L1203
landlab/landlab
a5dd80b8ebfd03d1ba87ef6c4368c409485f222c
landlab/components/species_evolution/record.py
python
Record.latest_time
(self)
return max(self.times)
The latest time in the record.
The latest time in the record.
[ "The", "latest", "time", "in", "the", "record", "." ]
def latest_time(self): """The latest time in the record.""" return max(self.times)
[ "def", "latest_time", "(", "self", ")", ":", "return", "max", "(", "self", ".", "times", ")" ]
https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/components/species_evolution/record.py#L62-L64
mgear-dev/mgear
06ddc26c5adb5eab07ca470c7fafa77404c8a1de
scripts/mgear/maya/shifter/component/hydraulic_01/__init__.py
python
Component.addOperators
(self)
Create operators and set the relations for the component rig Apply operators, constraints, expressions to the hierarchy. In order to keep the code clean and easier to debug, we shouldn't create any new object in this method.
Create operators and set the relations for the component rig
[ "Create", "operators", "and", "set", "the", "relations", "for", "the", "component", "rig" ]
def addOperators(self): """Create operators and set the relations for the component rig Apply operators, constraints, expressions to the hierarchy. In order to keep the code clean and easier to debug, we shouldn't create any new object in this method. """ applyop.aimCns...
[ "def", "addOperators", "(", "self", ")", ":", "applyop", ".", "aimCns", "(", "self", ".", "ref_base", ",", "self", ".", "tip_ctl", ",", "axis", "=", "\"yx\"", ",", "wupType", "=", "2", ",", "wupVector", "=", "[", "1", ",", "0", ",", "0", "]", ","...
https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/shifter/component/hydraulic_01/__init__.py#L93-L128
openstack/ironic
b392dc19bcd29cef5a69ec00d2f18a7a19a679e5
ironic/api/controllers/v1/port.py
python
PortsController._check_allowed_port_fields
(self, fields)
Check if fetching a particular field of a port is allowed. Check if the required version is being requested for fields that are only allowed to be fetched in a particular API version. :param fields: list or set of fields to check :raises: NotAcceptable if a field is not allowed
Check if fetching a particular field of a port is allowed.
[ "Check", "if", "fetching", "a", "particular", "field", "of", "a", "port", "is", "allowed", "." ]
def _check_allowed_port_fields(self, fields): """Check if fetching a particular field of a port is allowed. Check if the required version is being requested for fields that are only allowed to be fetched in a particular API version. :param fields: list or set of fields to check ...
[ "def", "_check_allowed_port_fields", "(", "self", ",", "fields", ")", ":", "if", "fields", "is", "None", ":", "return", "if", "(", "not", "api_utils", ".", "allow_port_advanced_net_fields", "(", ")", "and", "set", "(", "fields", ")", ".", "intersection", "("...
https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/api/controllers/v1/port.py#L316-L346
fastavro/fastavro
dc1179d6d0e63c1d6e7cbeb5e0886bf70672745f
fastavro/_logical_writers_py.py
python
prepare_time_millis
(data, schema)
Convert datetime.time to int timestamp with milliseconds
Convert datetime.time to int timestamp with milliseconds
[ "Convert", "datetime", ".", "time", "to", "int", "timestamp", "with", "milliseconds" ]
def prepare_time_millis(data, schema): """Convert datetime.time to int timestamp with milliseconds""" if isinstance(data, datetime.time): return int( data.hour * MLS_PER_HOUR + data.minute * MLS_PER_MINUTE + data.second * MLS_PER_SECOND + int(data.microsec...
[ "def", "prepare_time_millis", "(", "data", ",", "schema", ")", ":", "if", "isinstance", "(", "data", ",", "datetime", ".", "time", ")", ":", "return", "int", "(", "data", ".", "hour", "*", "MLS_PER_HOUR", "+", "data", ".", "minute", "*", "MLS_PER_MINUTE"...
https://github.com/fastavro/fastavro/blob/dc1179d6d0e63c1d6e7cbeb5e0886bf70672745f/fastavro/_logical_writers_py.py#L224-L234
BillBillBillBill/Tickeys-linux
2df31b8665004c58a5d4ab05277f245267d96364
tickeys/kivy_32/kivy/base.py
python
ExceptionManagerBase.add_handler
(self, cls)
Add a new exception handler to the stack.
Add a new exception handler to the stack.
[ "Add", "a", "new", "exception", "handler", "to", "the", "stack", "." ]
def add_handler(self, cls): '''Add a new exception handler to the stack.''' if not cls in self.handlers: self.handlers.append(cls)
[ "def", "add_handler", "(", "self", ",", "cls", ")", ":", "if", "not", "cls", "in", "self", ".", "handlers", ":", "self", ".", "handlers", ".", "append", "(", "cls", ")" ]
https://github.com/BillBillBillBill/Tickeys-linux/blob/2df31b8665004c58a5d4ab05277f245267d96364/tickeys/kivy_32/kivy/base.py#L72-L75
PaddlePaddle/X2Paddle
b492545f61446af69e5d5d6288bc3a43a9a3931e
x2paddle/project_convertor/pytorch/models/resnet.py
python
resnet152
(pretrained: bool=False, progress: bool=True, **kwargs: Any)
return _resnet('resnet152', Bottleneck, [3, 8, 36, 3], pretrained, **kwargs)
r"""ResNet-152 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
r"""ResNet-152 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_.
[ "r", "ResNet", "-", "152", "model", "from", "Deep", "Residual", "Learning", "for", "Image", "Recognition", "<https", ":", "//", "arxiv", ".", "org", "/", "pdf", "/", "1512", ".", "03385", ".", "pdf", ">", "_", "." ]
def resnet152(pretrained: bool=False, progress: bool=True, **kwargs: Any) -> ResNet: r"""ResNet-152 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet pr...
[ "def", "resnet152", "(", "pretrained", ":", "bool", "=", "False", ",", "progress", ":", "bool", "=", "True", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "ResNet", ":", "return", "_resnet", "(", "'resnet152'", ",", "Bottleneck", ",", "[", "3", ","...
https://github.com/PaddlePaddle/X2Paddle/blob/b492545f61446af69e5d5d6288bc3a43a9a3931e/x2paddle/project_convertor/pytorch/models/resnet.py#L358-L367
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/table/column.py
python
col_copy
(col, copy_indices=True)
return newcol
Mixin-safe version of Column.copy() (with copy_data=True). Parameters ---------- col : Column or mixin column Input column copy_indices : bool Copy the column ``indices`` attribute Returns ------- col : Copy of input column
Mixin-safe version of Column.copy() (with copy_data=True).
[ "Mixin", "-", "safe", "version", "of", "Column", ".", "copy", "()", "(", "with", "copy_data", "=", "True", ")", "." ]
def col_copy(col, copy_indices=True): """ Mixin-safe version of Column.copy() (with copy_data=True). Parameters ---------- col : Column or mixin column Input column copy_indices : bool Copy the column ``indices`` attribute Returns ------- col : Copy of input column ...
[ "def", "col_copy", "(", "col", ",", "copy_indices", "=", "True", ")", ":", "if", "isinstance", "(", "col", ",", "BaseColumn", ")", ":", "return", "col", ".", "copy", "(", ")", "# The new column should have None for the parent_table ref. If the", "# original parent_...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/table/column.py#L59-L98
opendevops-cn/codo-admin
7328acab38e71332136cc6684918f534d8e30948
mg/handlers/users_handler.py
python
UserHandler.put
(self, *args, **kwargs)
[]
def put(self, *args, **kwargs): data = json.loads(self.request.body.decode("utf-8")) key = data.get('key', None) value = data.get('value', None) user_id = data.get('user_id', None) if not key or not value or not user_id: return self.write(dict(code=-1, msg='不能为空')) ...
[ "def", "put", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "json", ".", "loads", "(", "self", ".", "request", ".", "body", ".", "decode", "(", "\"utf-8\"", ")", ")", "key", "=", "data", ".", "get", "(", "'key'"...
https://github.com/opendevops-cn/codo-admin/blob/7328acab38e71332136cc6684918f534d8e30948/mg/handlers/users_handler.py#L132-L147
PyHDI/veriloggen
2382d200deabf59cfcfd741f5eba371010aaf2bb
veriloggen/types/axi.py
python
AxiLiteWriteAddress.__init__
(self, m, name=None, datawidth=32, addrwidth=32, itype=None, otype=None)
[]
def __init__(self, m, name=None, datawidth=32, addrwidth=32, itype=None, otype=None): AxiLiteInterfaceBase.__init__(self, m, name, datawidth, addrwidth, itype, otype) self.awaddr = util.make_port( m, self.otype, name + '_awaddr', self....
[ "def", "__init__", "(", "self", ",", "m", ",", "name", "=", "None", ",", "datawidth", "=", "32", ",", "addrwidth", "=", "32", ",", "itype", "=", "None", ",", "otype", "=", "None", ")", ":", "AxiLiteInterfaceBase", ".", "__init__", "(", "self", ",", ...
https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/types/axi.py#L148-L163
Aceinna/gnss-ins-sim
e8a0495af21c12628cdf106a7c54a0fc7bd0b12a
gnss_ins_sim/sim/ins_sim.py
python
Sim.__convert_pos
(self, data, units, ref_frame)
return data, units
Convert position data into a proper form. For example, if units are [deg deg m] or [rad rad m] and ref_frame is 1, convertion is needed. LLA form position will be converted to [x y z] form. Vice Versa. Args: data: nx3 numpy array, can be in [Lat Lon Alt] or [x y z] form. ...
Convert position data into a proper form. For example, if units are [deg deg m] or [rad rad m] and ref_frame is 1, convertion is needed. LLA form position will be converted to [x y z] form. Vice Versa. Args: data: nx3 numpy array, can be in [Lat Lon Alt] or [x y z] form. ...
[ "Convert", "position", "data", "into", "a", "proper", "form", ".", "For", "example", "if", "units", "are", "[", "deg", "deg", "m", "]", "or", "[", "rad", "rad", "m", "]", "and", "ref_frame", "is", "1", "convertion", "is", "needed", ".", "LLA", "form"...
def __convert_pos(self, data, units, ref_frame): ''' Convert position data into a proper form. For example, if units are [deg deg m] or [rad rad m] and ref_frame is 1, convertion is needed. LLA form position will be converted to [x y z] form. Vice Versa. Args: data: n...
[ "def", "__convert_pos", "(", "self", ",", "data", ",", "units", ",", "ref_frame", ")", ":", "if", "ref_frame", "==", "1", ":", "# deg to rad", "if", "units", "==", "[", "'deg'", ",", "'deg'", ",", "'m'", "]", ":", "units", "=", "[", "'rad'", ",", "...
https://github.com/Aceinna/gnss-ins-sim/blob/e8a0495af21c12628cdf106a7c54a0fc7bd0b12a/gnss_ins_sim/sim/ins_sim.py#L796-L832
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/mfi/switch.py
python
MfiSwitch.turn_off
(self, **kwargs)
Turn the switch off.
Turn the switch off.
[ "Turn", "the", "switch", "off", "." ]
def turn_off(self, **kwargs): """Turn the switch off.""" self._port.control(False) self._target_state = False
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_port", ".", "control", "(", "False", ")", "self", ".", "_target_state", "=", "False" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/mfi/switch.py#L109-L112
dulwich/dulwich
1f66817d712e3563ce1ff53b1218491a2eae39da
dulwich/pack.py
python
Pack.data
(self)
return self._data
The pack data object being used.
The pack data object being used.
[ "The", "pack", "data", "object", "being", "used", "." ]
def data(self): """The pack data object being used.""" if self._data is None: self._data = self._data_load() self._data.pack = self self.check_length_and_checksum() return self._data
[ "def", "data", "(", "self", ")", ":", "if", "self", ".", "_data", "is", "None", ":", "self", ".", "_data", "=", "self", ".", "_data_load", "(", ")", "self", ".", "_data", ".", "pack", "=", "self", "self", ".", "check_length_and_checksum", "(", ")", ...
https://github.com/dulwich/dulwich/blob/1f66817d712e3563ce1ff53b1218491a2eae39da/dulwich/pack.py#L2004-L2010
stepjam/PyRep
d778d5d4ffa3be366d4e699f6e2941553fd47ecc
pyrep/robots/robot_component.py
python
RobotComponent.set_motor_locked_at_zero_velocity
(self, value: bool)
Sets if motor is locked when target velocity is zero for all joints. When enabled in velocity mode and its target velocity is zero, then the joint is locked in place. :param value: If the motors should be locked at zero velocity.
Sets if motor is locked when target velocity is zero for all joints.
[ "Sets", "if", "motor", "is", "locked", "when", "target", "velocity", "is", "zero", "for", "all", "joints", "." ]
def set_motor_locked_at_zero_velocity(self, value: bool) -> None: """Sets if motor is locked when target velocity is zero for all joints. When enabled in velocity mode and its target velocity is zero, then the joint is locked in place. :param value: If the motors should be locked at ze...
[ "def", "set_motor_locked_at_zero_velocity", "(", "self", ",", "value", ":", "bool", ")", "->", "None", ":", "[", "j", ".", "set_motor_locked_at_zero_velocity", "(", "value", ")", "# type: ignore", "for", "j", "in", "self", ".", "joints", "]" ]
https://github.com/stepjam/PyRep/blob/d778d5d4ffa3be366d4e699f6e2941553fd47ecc/pyrep/robots/robot_component.py#L233-L242
cokelaer/bioservices
b491e8d71e285f9006e0af0a56f0cc5128cb86fa
src/bioservices/services.py
python
Service.on_web
(self, url)
Open a URL into a browser
Open a URL into a browser
[ "Open", "a", "URL", "into", "a", "browser" ]
def on_web(self, url): """Open a URL into a browser""" import webbrowser webbrowser.open(url)
[ "def", "on_web", "(", "self", ",", "url", ")", ":", "import", "webbrowser", "webbrowser", ".", "open", "(", "url", ")" ]
https://github.com/cokelaer/bioservices/blob/b491e8d71e285f9006e0af0a56f0cc5128cb86fa/src/bioservices/services.py#L235-L239
scikit-learn/scikit-learn
1d1aadd0711b87d2a11c80aad15df6f8cf156712
sklearn/feature_selection/_from_model.py
python
SelectFromModel.fit
(self, X, y=None, **fit_params)
return self
Fit the SelectFromModel meta-transformer. Parameters ---------- X : array-like of shape (n_samples, n_features) The training input samples. y : array-like of shape (n_samples,), default=None The target values (integers that correspond to classes in c...
Fit the SelectFromModel meta-transformer.
[ "Fit", "the", "SelectFromModel", "meta", "-", "transformer", "." ]
def fit(self, X, y=None, **fit_params): """Fit the SelectFromModel meta-transformer. Parameters ---------- X : array-like of shape (n_samples, n_features) The training input samples. y : array-like of shape (n_samples,), default=None The target values (i...
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "fit_params", ")", ":", "if", "self", ".", "max_features", "is", "not", "None", ":", "if", "not", "isinstance", "(", "self", ".", "max_features", ",", "numbers", ".", "Integ...
https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/feature_selection/_from_model.py#L229-L274
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pylibs/osx64/Cryptodome/Hash/SHA3_224.py
python
SHA3_224_Hash.update
(self, data)
return self
Continue hashing of a message by consuming the next chunk of data. Repeated calls are equivalent to a single call with the concatenation of all the arguments. In other words: >>> m.update(a); m.update(b) is equivalent to: >>> m.update(a+b) :Parameters: ...
Continue hashing of a message by consuming the next chunk of data.
[ "Continue", "hashing", "of", "a", "message", "by", "consuming", "the", "next", "chunk", "of", "data", "." ]
def update(self, data): """Continue hashing of a message by consuming the next chunk of data. Repeated calls are equivalent to a single call with the concatenation of all the arguments. In other words: >>> m.update(a); m.update(b) is equivalent to: >>> m.update(...
[ "def", "update", "(", "self", ",", "data", ")", ":", "if", "self", ".", "_digest_done", "and", "not", "self", ".", "_update_after_digest", ":", "raise", "TypeError", "(", "\"You can only call 'digest' or 'hexdigest' on this object\"", ")", "expect_byte_string", "(", ...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pylibs/osx64/Cryptodome/Hash/SHA3_224.py#L73-L100
avocado-framework/avocado
1f9b3192e8ba47d029c33fe21266bd113d17811f
avocado/utils/asset.py
python
Asset.name_scheme
(self)
This property will return the scheme part of the name if is an URL. Otherwise, will return None.
This property will return the scheme part of the name if is an URL.
[ "This", "property", "will", "return", "the", "scheme", "part", "of", "the", "name", "if", "is", "an", "URL", "." ]
def name_scheme(self): """This property will return the scheme part of the name if is an URL. Otherwise, will return None. """ parsed = self.parsed_name if parsed: return parsed.scheme
[ "def", "name_scheme", "(", "self", ")", ":", "parsed", "=", "self", ".", "parsed_name", "if", "parsed", ":", "return", "parsed", ".", "scheme" ]
https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/avocado/utils/asset.py#L606-L613
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/cffi/api.py
python
FFI.set_unicode
(self, enabled_flag)
Windows: if 'enabled_flag' is True, enable the UNICODE and _UNICODE defines in C, and declare the types like TCHAR and LPTCSTR to be (pointers to) wchar_t. If 'enabled_flag' is False, declare these types to be (pointers to) plain 8-bit characters. This is mostly for backward compatibili...
Windows: if 'enabled_flag' is True, enable the UNICODE and _UNICODE defines in C, and declare the types like TCHAR and LPTCSTR to be (pointers to) wchar_t. If 'enabled_flag' is False, declare these types to be (pointers to) plain 8-bit characters. This is mostly for backward compatibili...
[ "Windows", ":", "if", "enabled_flag", "is", "True", "enable", "the", "UNICODE", "and", "_UNICODE", "defines", "in", "C", "and", "declare", "the", "types", "like", "TCHAR", "and", "LPTCSTR", "to", "be", "(", "pointers", "to", ")", "wchar_t", ".", "If", "e...
def set_unicode(self, enabled_flag): """Windows: if 'enabled_flag' is True, enable the UNICODE and _UNICODE defines in C, and declare the types like TCHAR and LPTCSTR to be (pointers to) wchar_t. If 'enabled_flag' is False, declare these types to be (pointers to) plain 8-bit characters....
[ "def", "set_unicode", "(", "self", ",", "enabled_flag", ")", ":", "if", "self", ".", "_windows_unicode", "is", "not", "None", ":", "raise", "ValueError", "(", "\"set_unicode() can only be called once\"", ")", "enabled_flag", "=", "bool", "(", "enabled_flag", ")", ...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/cffi/api.py#L495-L523
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/tkinter/__init__.py
python
Toplevel.__init__
(self, master=None, cnf={}, **kw)
Construct a toplevel widget with the parent MASTER. Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.
Construct a toplevel widget with the parent MASTER.
[ "Construct", "a", "toplevel", "widget", "with", "the", "parent", "MASTER", "." ]
def __init__(self, master=None, cnf={}, **kw): """Construct a toplevel widget with the parent MASTER. Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefoc...
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "cnf", "=", "{", "}", ",", "*", "*", "kw", ")", ":", "if", "kw", ":", "cnf", "=", "_cnfmerge", "(", "(", "cnf", ",", "kw", ")", ")", "extra", "=", "(", ")", "for", "wmkey", "i...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/tkinter/__init__.py#L2098-L2122
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Override/Lib/multiprocessing/util.py
python
Finalize.still_active
(self)
return self._key in _finalizer_registry
Return whether this finalizer is still waiting to invoke callback
Return whether this finalizer is still waiting to invoke callback
[ "Return", "whether", "this", "finalizer", "is", "still", "waiting", "to", "invoke", "callback" ]
def still_active(self): ''' Return whether this finalizer is still waiting to invoke callback ''' return self._key in _finalizer_registry
[ "def", "still_active", "(", "self", ")", ":", "return", "self", ".", "_key", "in", "_finalizer_registry" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Override/Lib/multiprocessing/util.py#L217-L221
lazylibrarian/LazyLibrarian
ae3c14e9db9328ce81765e094ab2a14ed7155624
lib/requests/adapters.py
python
BaseAdapter.send
(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None)
Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up...
Sends PreparedRequest object. Returns Response object.
[ "Sends", "PreparedRequest", "object", ".", "Returns", "Response", "object", "." ]
def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. :param stream: (optional) Whether to stream the request co...
[ "def", "send", "(", "self", ",", "request", ",", "stream", "=", "False", ",", "timeout", "=", "None", ",", "verify", "=", "True", ",", "cert", "=", "None", ",", "proxies", "=", "None", ")", ":", "raise", "NotImplementedError" ]
https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/lib/requests/adapters.py#L57-L71
mrJean1/PyGeodesy
7da5ca71aa3edb7bc49e219e0b8190686e1a7965
pygeodesy/deprecated/__init__.py
python
scalar
(value, low=EPS, high=1.0, name=_scalar_, Error=ValueError)
return C_(value, name=name, Error=Error, low=low, high=high)
DEPRECATED, use class L{Number_} or L{Scalar_}. @return: New value (C{float} or C{int} for C{int} B{C{low}}). @raise Error: Invalid B{C{value}}.
DEPRECATED, use class L{Number_} or L{Scalar_}.
[ "DEPRECATED", "use", "class", "L", "{", "Number_", "}", "or", "L", "{", "Scalar_", "}", "." ]
def scalar(value, low=EPS, high=1.0, name=_scalar_, Error=ValueError): # PYCHOK no cover '''DEPRECATED, use class L{Number_} or L{Scalar_}. @return: New value (C{float} or C{int} for C{int} B{C{low}}). @raise Error: Invalid B{C{value}}. ''' from pygeodesy.basics import isint # _MODS.basics...
[ "def", "scalar", "(", "value", ",", "low", "=", "EPS", ",", "high", "=", "1.0", ",", "name", "=", "_scalar_", ",", "Error", "=", "ValueError", ")", ":", "# PYCHOK no cover", "from", "pygeodesy", ".", "basics", "import", "isint", "# _MODS.basics.isint", "C_...
https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/deprecated/__init__.py#L365-L374
onnx/sklearn-onnx
8e19d19b8a9bcae7f17d5b7cc2514cf6b89f8199
skl2onnx/common/_onnx_optimisation_common.py
python
_make_node
(op_type, inputs, outputs, name=None, doc_string=None, domain=None, attributes=None)
return node
Constructs a NodeProto. :param op_type: (string): The name of the operator to construct :param inputs: list of input names :param outputs: list of output names :param name: optional unique identifier for NodeProto :param doc_string: optional documentation string for NodeProto :param dom...
Constructs a NodeProto.
[ "Constructs", "a", "NodeProto", "." ]
def _make_node(op_type, inputs, outputs, name=None, doc_string=None, domain=None, attributes=None): """ Constructs a NodeProto. :param op_type: (string): The name of the operator to construct :param inputs: list of input names :param outputs: list of output names :param name: opt...
[ "def", "_make_node", "(", "op_type", ",", "inputs", ",", "outputs", ",", "name", "=", "None", ",", "doc_string", "=", "None", ",", "domain", "=", "None", ",", "attributes", "=", "None", ")", ":", "node", "=", "NodeProto", "(", ")", "node", ".", "op_t...
https://github.com/onnx/sklearn-onnx/blob/8e19d19b8a9bcae7f17d5b7cc2514cf6b89f8199/skl2onnx/common/_onnx_optimisation_common.py#L78-L113
pmaupin/pdfrw
6c892160e7e976b243db0c12c3e56ed8c78afc5a
examples/rl1/platypus_pdf_template.py
python
MyDocTemplate.afterFlowable
(self, flowable)
Adds Heading1 to table of contents
Adds Heading1 to table of contents
[ "Adds", "Heading1", "to", "table", "of", "contents" ]
def afterFlowable(self, flowable): """Adds Heading1 to table of contents""" if flowable.__class__.__name__ == 'Paragraph': style = flowable.style.name text = flowable.getPlainText() key = '%s' % self.seq.nextf('toc') if style == 'Heading1': ...
[ "def", "afterFlowable", "(", "self", ",", "flowable", ")", ":", "if", "flowable", ".", "__class__", ".", "__name__", "==", "'Paragraph'", ":", "style", "=", "flowable", ".", "style", ".", "name", "text", "=", "flowable", ".", "getPlainText", "(", ")", "k...
https://github.com/pmaupin/pdfrw/blob/6c892160e7e976b243db0c12c3e56ed8c78afc5a/examples/rl1/platypus_pdf_template.py#L65-L73
SINGROUP/dscribe
79a13939d66bdc858865dc050b91be9debd3c06a
dscribe/descriptors/lmbtr.py
python
LMBTR.create
( self, system, positions=None, n_jobs=1, only_physical_cores=False, verbose=False )
return output
Return the LMBTR output for the given systems and given positions. Args: system (:class:`ase.Atoms` or list of :class:`ase.Atoms`): One or many atomic structures. positions (list): Positions where to calculate LMBTR. Can be provided as cartesian positions...
Return the LMBTR output for the given systems and given positions.
[ "Return", "the", "LMBTR", "output", "for", "the", "given", "systems", "and", "given", "positions", "." ]
def create( self, system, positions=None, n_jobs=1, only_physical_cores=False, verbose=False ): """Return the LMBTR output for the given systems and given positions. Args: system (:class:`ase.Atoms` or list of :class:`ase.Atoms`): One or many atomic structures. ...
[ "def", "create", "(", "self", ",", "system", ",", "positions", "=", "None", ",", "n_jobs", "=", "1", ",", "only_physical_cores", "=", "False", ",", "verbose", "=", "False", ")", ":", "# Combine input arguments", "if", "isinstance", "(", "system", ",", "Ato...
https://github.com/SINGROUP/dscribe/blob/79a13939d66bdc858865dc050b91be9debd3c06a/dscribe/descriptors/lmbtr.py#L207-L295
deeptools/deepTools
ac42d29c298c026aa0c53c9db2553087ebc86b97
deeptools/parserCommon.py
python
gtf_options
(suppress=False)
return parser
Arguments present whenever a BED/GTF file can be used
Arguments present whenever a BED/GTF file can be used
[ "Arguments", "present", "whenever", "a", "BED", "/", "GTF", "file", "can", "be", "used" ]
def gtf_options(suppress=False): """ Arguments present whenever a BED/GTF file can be used """ if suppress: parser = argparse.ArgumentParser(add_help=False) group = parser else: parser = argparse.ArgumentParser(add_help=False) group = parser.add_argument_group('GTF/BE...
[ "def", "gtf_options", "(", "suppress", "=", "False", ")", ":", "if", "suppress", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "group", "=", "parser", "else", ":", "parser", "=", "argparse", ".", "ArgumentParser...
https://github.com/deeptools/deepTools/blob/ac42d29c298c026aa0c53c9db2553087ebc86b97/deeptools/parserCommon.py#L140-L199
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/winobject/registry.py
python
PyHKey.empty
(self)
[]
def empty(self): windows.winproxy.RegDeleteTreeW(self.phkey, None)
[ "def", "empty", "(", "self", ")", ":", "windows", ".", "winproxy", ".", "RegDeleteTreeW", "(", "self", ".", "phkey", ",", "None", ")" ]
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winobject/registry.py#L374-L375
munificent/magpie
f5138e3d316ec1a664b5eadba1bcc8573d3faca3
dep/gyp/pylib/gyp/msvs_emulation.py
python
MsvsSettings.GetOutputName
(self, config, expand_special)
return output_file
Gets the explicitly overridden output name for a target or returns None if it's not overridden.
Gets the explicitly overridden output name for a target or returns None if it's not overridden.
[ "Gets", "the", "explicitly", "overridden", "output", "name", "for", "a", "target", "or", "returns", "None", "if", "it", "s", "not", "overridden", "." ]
def GetOutputName(self, config, expand_special): """Gets the explicitly overridden output name for a target or returns None if it's not overridden.""" config = self._TargetConfig(config) type = self.spec['type'] root = 'VCLibrarianTool' if type == 'static_library' else 'VCLinkerTool' # TODO(scot...
[ "def", "GetOutputName", "(", "self", ",", "config", ",", "expand_special", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "type", "=", "self", ".", "spec", "[", "'type'", "]", "root", "=", "'VCLibrarianTool'", "if", "type", "=...
https://github.com/munificent/magpie/blob/f5138e3d316ec1a664b5eadba1bcc8573d3faca3/dep/gyp/pylib/gyp/msvs_emulation.py#L282-L293
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/handlers/presence.py
python
PresenceHandler._persist_and_notify
(self, states: List[UserPresenceState])
Persist states in the database, poke the notifier and send to interested remote servers
Persist states in the database, poke the notifier and send to interested remote servers
[ "Persist", "states", "in", "the", "database", "poke", "the", "notifier", "and", "send", "to", "interested", "remote", "servers" ]
async def _persist_and_notify(self, states: List[UserPresenceState]) -> None: """Persist states in the database, poke the notifier and send to interested remote servers """ stream_id, max_token = await self.store.update_presence(states) parties = await get_interested_parties(sel...
[ "async", "def", "_persist_and_notify", "(", "self", ",", "states", ":", "List", "[", "UserPresenceState", "]", ")", "->", "None", ":", "stream_id", ",", "max_token", "=", "await", "self", ".", "store", ".", "update_presence", "(", "states", ")", "parties", ...
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/handlers/presence.py#L1095-L1114
pycontribs/jira
09ece94f3cae7e6d0becfa87d77d6a05ce01cdf6
jira/client.py
python
JIRA.project_components
(self, project: str)
return components
Get a list of component Resources present on a project. Args: project (str): ID or key of the project to get components from Returns: List[Component]
Get a list of component Resources present on a project.
[ "Get", "a", "list", "of", "component", "Resources", "present", "on", "a", "project", "." ]
def project_components(self, project: str) -> List[Component]: """Get a list of component Resources present on a project. Args: project (str): ID or key of the project to get components from Returns: List[Component] """ r_json = self._get_json("project/"...
[ "def", "project_components", "(", "self", ",", "project", ":", "str", ")", "->", "List", "[", "Component", "]", ":", "r_json", "=", "self", ".", "_get_json", "(", "\"project/\"", "+", "project", "+", "\"/components\"", ")", "components", "=", "[", "Compone...
https://github.com/pycontribs/jira/blob/09ece94f3cae7e6d0becfa87d77d6a05ce01cdf6/jira/client.py#L2678-L2692
NifTK/NiftyNet
935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0
niftynet/contrib/csv_reader/multitask_classifseg_application.py
python
MultiClassifSegApplication.interpret_output
(self, batch_output)
return True
Specifies how the output should be decoded :param batch_output: :return:
Specifies how the output should be decoded :param batch_output: :return:
[ "Specifies", "how", "the", "output", "should", "be", "decoded", ":", "param", "batch_output", ":", ":", "return", ":" ]
def interpret_output(self, batch_output): ''' Specifies how the output should be decoded :param batch_output: :return: ''' if not self.is_training: return self.output_decoder.decode_batch( {'window_seg': batch_output['seg'], 'c...
[ "def", "interpret_output", "(", "self", ",", "batch_output", ")", ":", "if", "not", "self", ".", "is_training", ":", "return", "self", ".", "output_decoder", ".", "decode_batch", "(", "{", "'window_seg'", ":", "batch_output", "[", "'seg'", "]", ",", "'csv_cl...
https://github.com/NifTK/NiftyNet/blob/935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0/niftynet/contrib/csv_reader/multitask_classifseg_application.py#L519-L530
brianwrf/hackUtils
168123350d93b040fa0c437c9d59faf8fa65d8e6
hackUtils.py
python
php_str_noquotes
(data)
return encoded[:-1]
Convert string to chr(xx).chr(xx) for use in php
Convert string to chr(xx).chr(xx) for use in php
[ "Convert", "string", "to", "chr", "(", "xx", ")", ".", "chr", "(", "xx", ")", "for", "use", "in", "php" ]
def php_str_noquotes(data): "Convert string to chr(xx).chr(xx) for use in php" encoded = "" for char in data: encoded += "chr({0}).".format(ord(char)) return encoded[:-1]
[ "def", "php_str_noquotes", "(", "data", ")", ":", "encoded", "=", "\"\"", "for", "char", "in", "data", ":", "encoded", "+=", "\"chr({0}).\"", ".", "format", "(", "ord", "(", "char", ")", ")", "return", "encoded", "[", ":", "-", "1", "]" ]
https://github.com/brianwrf/hackUtils/blob/168123350d93b040fa0c437c9d59faf8fa65d8e6/hackUtils.py#L458-L463
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/cmds.py
python
ResetHard.confirm
(self)
return Interaction.confirm(title, question, info, ok_text)
[]
def confirm(self): title = N_('Restore Worktree and Reset All (Hard)') question = N_('Restore Worktree and Reset All?') info = self.tooltip(self.ref) ok_text = N_('Reset and Restore') return Interaction.confirm(title, question, info, ok_text)
[ "def", "confirm", "(", "self", ")", ":", "title", "=", "N_", "(", "'Restore Worktree and Reset All (Hard)'", ")", "question", "=", "N_", "(", "'Restore Worktree and Reset All?'", ")", "info", "=", "self", ".", "tooltip", "(", "self", ".", "ref", ")", "ok_text"...
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/cmds.py#L574-L579
beancount/beancount
cb3526a1af95b3b5be70347470c381b5a86055fe
beancount/core/account.py
python
sans_root
(account_name: Account)
return join(*components) if account_name else None
Get the name of the account without the root. For example, an input of 'Assets:BofA:Checking' will produce 'BofA:Checking'. Args: account_name: A string, the name of the account whose leaf name to return. Returns: A string, the name of the non-root portion of this account name.
Get the name of the account without the root.
[ "Get", "the", "name", "of", "the", "account", "without", "the", "root", "." ]
def sans_root(account_name: Account)-> Account: """Get the name of the account without the root. For example, an input of 'Assets:BofA:Checking' will produce 'BofA:Checking'. Args: account_name: A string, the name of the account whose leaf name to return. Returns: A string, the name of the...
[ "def", "sans_root", "(", "account_name", ":", "Account", ")", "->", "Account", ":", "assert", "isinstance", "(", "account_name", ",", "str", ")", "components", "=", "account_name", ".", "split", "(", "sep", ")", "[", "1", ":", "]", "return", "join", "(",...
https://github.com/beancount/beancount/blob/cb3526a1af95b3b5be70347470c381b5a86055fe/beancount/core/account.py#L107-L119
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/accounting/invoicing.py
python
LineItemFactory._is_partial_invoice
(self)
return not ( self.invoice.date_end.day == self._days_in_billing_period and self.invoice.date_start.day == 1 )
[]
def _is_partial_invoice(self): return not ( self.invoice.date_end.day == self._days_in_billing_period and self.invoice.date_start.day == 1 )
[ "def", "_is_partial_invoice", "(", "self", ")", ":", "return", "not", "(", "self", ".", "invoice", ".", "date_end", ".", "day", "==", "self", ".", "_days_in_billing_period", "and", "self", ".", "invoice", ".", "date_start", ".", "day", "==", "1", ")" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/accounting/invoicing.py#L579-L583
wal-e/wal-e
6c43976e13c619ebdddd0d869301c42ed131e983
wal_e/copyfileobj.py
python
copyfileobj
(src, dst, length=None, exception=OSError, bufsize=None)
return
Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content.
Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content.
[ "Copy", "length", "bytes", "from", "fileobj", "src", "to", "fileobj", "dst", ".", "If", "length", "is", "None", "copy", "the", "entire", "content", "." ]
def copyfileobj(src, dst, length=None, exception=OSError, bufsize=None): """Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. """ if bufsize is None: bufsize = pipebuf.PIPE_BUF_BYTES if length == 0: return if length is None: ...
[ "def", "copyfileobj", "(", "src", ",", "dst", ",", "length", "=", "None", ",", "exception", "=", "OSError", ",", "bufsize", "=", "None", ")", ":", "if", "bufsize", "is", "None", ":", "bufsize", "=", "pipebuf", ".", "PIPE_BUF_BYTES", "if", "length", "==...
https://github.com/wal-e/wal-e/blob/6c43976e13c619ebdddd0d869301c42ed131e983/wal_e/copyfileobj.py#L6-L31
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/regions.py
python
is_region_short_name
(region)
return False
[]
def is_region_short_name(region): region = region.lower() if region in REGIONS_SHORT_NAMES: return True if region in REGIONS: return False if _check_and_add_region_metadata(region): # Above call will return true if the requested region is now known, after considering additional...
[ "def", "is_region_short_name", "(", "region", ")", ":", "region", "=", "region", ".", "lower", "(", ")", "if", "region", "in", "REGIONS_SHORT_NAMES", ":", "return", "True", "if", "region", "in", "REGIONS", ":", "return", "False", "if", "_check_and_add_region_m...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/regions.py#L81-L95
CheckPointSW/Karta
b845928487b50a5b41acd532ae0399177a4356aa
src/thumbs_up/analyzers/analyzer.py
python
Analyzer.delCodePtr
(self, src, dest)
Delete a code pointer (probably was found to be a False Positive). Args: src (int) effective address for the pointer's location dest (int): effective address for the (assumed) pointed code address
Delete a code pointer (probably was found to be a False Positive).
[ "Delete", "a", "code", "pointer", "(", "probably", "was", "found", "to", "be", "a", "False", "Positive", ")", "." ]
def delCodePtr(self, src, dest): """Delete a code pointer (probably was found to be a False Positive). Args: src (int) effective address for the pointer's location dest (int): effective address for the (assumed) pointed code address """ idc.del_dref(src, dest) ...
[ "def", "delCodePtr", "(", "self", ",", "src", ",", "dest", ")", ":", "idc", ".", "del_dref", "(", "src", ",", "dest", ")", "idc", ".", "del_cref", "(", "src", ",", "dest", ",", "0", ")", "ida_bytes", ".", "del_items", "(", "src", ",", "0", ",", ...
https://github.com/CheckPointSW/Karta/blob/b845928487b50a5b41acd532ae0399177a4356aa/src/thumbs_up/analyzers/analyzer.py#L208-L217
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/share/models.py
python
PrivateFileDirShareManager.delete_private_file_dir_share
(self, from_user, to_user, repo_id, path)
[]
def delete_private_file_dir_share(self, from_user, to_user, repo_id, path): """ """ super(PrivateFileDirShareManager, self).filter( from_user=from_user, to_user=to_user, repo_id=repo_id, path=path).delete()
[ "def", "delete_private_file_dir_share", "(", "self", ",", "from_user", ",", "to_user", ",", "repo_id", ",", "path", ")", ":", "super", "(", "PrivateFileDirShareManager", ",", "self", ")", ".", "filter", "(", "from_user", "=", "from_user", ",", "to_user", "=", ...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/share/models.py#L573-L578
j4mie/micromodels
43db93afa3f7e067df13db41fa861fe0682e79c4
micromodels/models.py
python
Model.from_dict
(cls, D, is_json=False)
return instance
This factory for :class:`Model` takes either a native Python dictionary or a JSON dictionary/object if ``is_json`` is ``True``. The dictionary passed does not need to contain all of the values that the Model declares.
This factory for :class:`Model` takes either a native Python dictionary or a JSON dictionary/object if ``is_json`` is ``True``. The dictionary passed does not need to contain all of the values that the Model declares.
[ "This", "factory", "for", ":", "class", ":", "Model", "takes", "either", "a", "native", "Python", "dictionary", "or", "a", "JSON", "dictionary", "/", "object", "if", "is_json", "is", "True", ".", "The", "dictionary", "passed", "does", "not", "need", "to", ...
def from_dict(cls, D, is_json=False): '''This factory for :class:`Model` takes either a native Python dictionary or a JSON dictionary/object if ``is_json`` is ``True``. The dictionary passed does not need to contain all of the values that the Model declares. ''' instance...
[ "def", "from_dict", "(", "cls", ",", "D", ",", "is_json", "=", "False", ")", ":", "instance", "=", "cls", "(", ")", "instance", ".", "set_data", "(", "D", ",", "is_json", "=", "is_json", ")", "return", "instance" ]
https://github.com/j4mie/micromodels/blob/43db93afa3f7e067df13db41fa861fe0682e79c4/micromodels/models.py#L65-L74
JimmXinu/FanFicFare
bc149a2deb2636320fe50a3e374af6eef8f61889
fanficfare/adapters/adapter_fanfictalkcom.py
python
FanfictalkComAdapter.getSiteURLPattern
(self)
return r"https?://(archive\.hp)?"+re.escape(self.getSiteDomain())+r"(/archive)?/viewstory\.php\?sid=\d+$"
[]
def getSiteURLPattern(self): return r"https?://(archive\.hp)?"+re.escape(self.getSiteDomain())+r"(/archive)?/viewstory\.php\?sid=\d+$"
[ "def", "getSiteURLPattern", "(", "self", ")", ":", "return", "r\"https?://(archive\\.hp)?\"", "+", "re", ".", "escape", "(", "self", ".", "getSiteDomain", "(", ")", ")", "+", "r\"(/archive)?/viewstory\\.php\\?sid=\\d+$\"" ]
https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/fanficfare/adapters/adapter_fanfictalkcom.py#L76-L77
PyCQA/pylint
3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb
pylint/checkers/typecheck.py
python
TypeChecker._check_uninferable_call
(self, node)
Check that the given uninferable Call node does not call an actual function.
Check that the given uninferable Call node does not call an actual function.
[ "Check", "that", "the", "given", "uninferable", "Call", "node", "does", "not", "call", "an", "actual", "function", "." ]
def _check_uninferable_call(self, node): """Check that the given uninferable Call node does not call an actual function. """ if not isinstance(node.func, nodes.Attribute): return # Look for properties. First, obtain # the lhs of the Attribute node and search ...
[ "def", "_check_uninferable_call", "(", "self", ",", "node", ")", ":", "if", "not", "isinstance", "(", "node", ".", "func", ",", "nodes", ".", "Attribute", ")", ":", "return", "# Look for properties. First, obtain", "# the lhs of the Attribute node and search the attribu...
https://github.com/PyCQA/pylint/blob/3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb/pylint/checkers/typecheck.py#L1213-L1261
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/pupylib/PupyOffload.py
python
PupyOffloadSocket.getpeername
(self)
return self._raddr
[]
def getpeername(self): return self._raddr
[ "def", "getpeername", "(", "self", ")", ":", "return", "self", ".", "_raddr" ]
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/pupylib/PupyOffload.py#L151-L152
yangxue0827/FPN_Tensorflow
c72110d2803455e6e55020f69144d9490a3d39ad
libs/networks/slim_nets/resnet_v2.py
python
resnet_v2_101
(inputs, num_classes=None, is_training=True, global_pool=True, output_stride=None, spatial_squeeze=False, reuse=None, scope='resnet_v2_101')
return resnet_v2(inputs, blocks, num_classes, is_training=is_training, global_pool=global_pool, output_stride=output_stride, include_root_block=True, spatial_squeeze=spatial_squeeze, reuse=reuse, scope=scope)
ResNet-101 model of [1]. See resnet_v2() for arg and return description.
ResNet-101 model of [1]. See resnet_v2() for arg and return description.
[ "ResNet", "-", "101", "model", "of", "[", "1", "]", ".", "See", "resnet_v2", "()", "for", "arg", "and", "return", "description", "." ]
def resnet_v2_101(inputs, num_classes=None, is_training=True, global_pool=True, output_stride=None, spatial_squeeze=False, reuse=None, scope='resnet_v2_101'): """ResNet-101 model of [1]. See r...
[ "def", "resnet_v2_101", "(", "inputs", ",", "num_classes", "=", "None", ",", "is_training", "=", "True", ",", "global_pool", "=", "True", ",", "output_stride", "=", "None", ",", "spatial_squeeze", "=", "False", ",", "reuse", "=", "None", ",", "scope", "=",...
https://github.com/yangxue0827/FPN_Tensorflow/blob/c72110d2803455e6e55020f69144d9490a3d39ad/libs/networks/slim_nets/resnet_v2.py#L270-L288
peter-u-diehl/stdp-mnist
d527ca3ee579d4f156d25ff160c0551a5ab82cf1
Diehl&Cook_spiking_MNIST.py
python
update_performance_plot
(im, performance, current_example_num, fig)
return im, performance
[]
def update_performance_plot(im, performance, current_example_num, fig): performance = get_current_performance(performance, current_example_num) im.set_ydata(performance) fig.canvas.draw() return im, performance
[ "def", "update_performance_plot", "(", "im", ",", "performance", ",", "current_example_num", ",", "fig", ")", ":", "performance", "=", "get_current_performance", "(", "performance", ",", "current_example_num", ")", "im", ".", "set_ydata", "(", "performance", ")", ...
https://github.com/peter-u-diehl/stdp-mnist/blob/d527ca3ee579d4f156d25ff160c0551a5ab82cf1/Diehl&Cook_spiking_MNIST.py#L163-L167
w3h/isf
6faf0a3df185465ec17369c90ccc16e2a03a1870
lib/thirdparty/scapy/utils.py
python
RawPcapReader.next
(self)
return pkt
implement the iterator protocol on a set of packets in a pcap file
implement the iterator protocol on a set of packets in a pcap file
[ "implement", "the", "iterator", "protocol", "on", "a", "set", "of", "packets", "in", "a", "pcap", "file" ]
def next(self): """implement the iterator protocol on a set of packets in a pcap file""" pkt = self.read_packet() if pkt == None: raise StopIteration return pkt
[ "def", "next", "(", "self", ")", ":", "pkt", "=", "self", ".", "read_packet", "(", ")", "if", "pkt", "==", "None", ":", "raise", "StopIteration", "return", "pkt" ]
https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/scapy/utils.py#L645-L650
dpp/simply_lift
cf49f7dcce81c7f1557314dd0f0bb08aaedc73da
elyxer.py
python
ListItem.process
(self)
Set the correct type and contents.
Set the correct type and contents.
[ "Set", "the", "correct", "type", "and", "contents", "." ]
def process(self): "Set the correct type and contents." self.type = self.header[1] tag = TaggedText().complete(self.contents, 'li', True) self.contents = [tag]
[ "def", "process", "(", "self", ")", ":", "self", ".", "type", "=", "self", ".", "header", "[", "1", "]", "tag", "=", "TaggedText", "(", ")", ".", "complete", "(", "self", ".", "contents", ",", "'li'", ",", "True", ")", "self", ".", "contents", "=...
https://github.com/dpp/simply_lift/blob/cf49f7dcce81c7f1557314dd0f0bb08aaedc73da/elyxer.py#L6553-L6557
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
Misc/diff_match_patch/diff_match_patch.py
python
diff_match_patch.diff_commonSuffix
(self, text1, text2)
return pointermid
Determine the common suffix of two strings. Args: text1: First string. text2: Second string. Returns: The number of characters common to the end of each string.
Determine the common suffix of two strings.
[ "Determine", "the", "common", "suffix", "of", "two", "strings", "." ]
def diff_commonSuffix(self, text1, text2): """Determine the common suffix of two strings. Args: text1: First string. text2: Second string. Returns: The number of characters common to the end of each string. """ # Quick check for common null cases. if not text1 or not text2 or text1[-1] != text2[-...
[ "def", "diff_commonSuffix", "(", "self", ",", "text1", ",", "text2", ")", ":", "# Quick check for common null cases.", "if", "not", "text1", "or", "not", "text2", "or", "text1", "[", "-", "1", "]", "!=", "text2", "[", "-", "1", "]", ":", "return", "0", ...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/Misc/diff_match_patch/diff_match_patch.py#L480-L507
codesociety/friartuck
450adae920ac64a4d3bca5258512295d3eaecea5
my_algo.py
python
order_for_robinhood
(context, security, weight, order_type=None)
This is a custom order method for this particular algorithm and places orders based on: (1) How much of each position in context.assets we currently hold (2) How much cash we currently hold This means that if you have existing positions (e.g. AAPL), your positions in that security will not be taken...
This is a custom order method for this particular algorithm and places orders based on: (1) How much of each position in context.assets we currently hold (2) How much cash we currently hold
[ "This", "is", "a", "custom", "order", "method", "for", "this", "particular", "algorithm", "and", "places", "orders", "based", "on", ":", "(", "1", ")", "How", "much", "of", "each", "position", "in", "context", ".", "assets", "we", "currently", "hold", "(...
def order_for_robinhood(context, security, weight, order_type=None): """ This is a custom order method for this particular algorithm and places orders based on: (1) How much of each position in context.assets we currently hold (2) How much cash we currently hold This means that if you have exis...
[ "def", "order_for_robinhood", "(", "context", ",", "security", ",", "weight", ",", "order_type", "=", "None", ")", ":", "# We use .95 as the cash because all market orders are converted into", "# limit orders with a 5% buffer. So any market order placed through", "# Robinhood is subm...
https://github.com/codesociety/friartuck/blob/450adae920ac64a4d3bca5258512295d3eaecea5/my_algo.py#L138-L176
nadineproject/nadine
c41c8ef7ffe18f1853029c97eecc329039b4af6c
nadine/utils/payment_api.py
python
PaymentAPI.get_transactions
(self, year, month, day)
return clean_transactions
[]
def get_transactions(self, year, month, day): raw_transactions = self.entry_point.getTransactions(year, month, day) clean_transactions = clean_transaction_list(raw_transactions) return clean_transactions
[ "def", "get_transactions", "(", "self", ",", "year", ",", "month", ",", "day", ")", ":", "raw_transactions", "=", "self", ".", "entry_point", ".", "getTransactions", "(", "year", ",", "month", ",", "day", ")", "clean_transactions", "=", "clean_transaction_list...
https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/nadine/utils/payment_api.py#L42-L45
usnistgov/fipy
6809b180b41a11de988a48655575df7e142c93b9
fipy/tools/dimensions/physicalField.py
python
PhysicalField.arccos
(self)
return PhysicalField(value=umath.arccos(self.inDimensionless()), unit = "rad")
Return the inverse cosine of the `PhysicalField` in radians >>> print(PhysicalField(0).arccos().allclose("1.57079632679 rad")) 1 The input `PhysicalField` must be dimensionless >>> print(numerix.round_(PhysicalField("1 m").arccos(), 6)) Traceback (most recent c...
Return the inverse cosine of the `PhysicalField` in radians
[ "Return", "the", "inverse", "cosine", "of", "the", "PhysicalField", "in", "radians" ]
def arccos(self): """ Return the inverse cosine of the `PhysicalField` in radians >>> print(PhysicalField(0).arccos().allclose("1.57079632679 rad")) 1 The input `PhysicalField` must be dimensionless >>> print(numerix.round_(PhysicalField("1 m").arccos(), 6)...
[ "def", "arccos", "(", "self", ")", ":", "return", "PhysicalField", "(", "value", "=", "umath", ".", "arccos", "(", "self", ".", "inDimensionless", "(", ")", ")", ",", "unit", "=", "\"rad\"", ")" ]
https://github.com/usnistgov/fipy/blob/6809b180b41a11de988a48655575df7e142c93b9/fipy/tools/dimensions/physicalField.py#L965-L979
google-research/tensorflow_constrained_optimization
723d63f8567aaa988c4ce4761152beee2b462e1d
tensorflow_constrained_optimization/python/train/constrained_optimizer.py
python
ConstrainedOptimizerV2.num_constraints
(self, num_constraints)
Explicitly sets the number of constraints. This function plays the same role as the (optional) num_constraints constructor argument. Once the number of constraints has been set, the internal state (e.g. the Lagrange multipliers) are fixed, and subsequent calls to this method will fail if the number of ...
Explicitly sets the number of constraints.
[ "Explicitly", "sets", "the", "number", "of", "constraints", "." ]
def num_constraints(self, num_constraints): """Explicitly sets the number of constraints. This function plays the same role as the (optional) num_constraints constructor argument. Once the number of constraints has been set, the internal state (e.g. the Lagrange multipliers) are fixed, and subsequent ...
[ "def", "num_constraints", "(", "self", ",", "num_constraints", ")", ":", "# Since get_loss_fn() can infer the number of constraints from a", "# ConstrainedMinimizationProblem, it's possible that the state might have", "# been created, even while self._num_constraints is None.", "if", "self",...
https://github.com/google-research/tensorflow_constrained_optimization/blob/723d63f8567aaa988c4ce4761152beee2b462e1d/tensorflow_constrained_optimization/python/train/constrained_optimizer.py#L587-L617
robinhood/faust
01b4c0ad8390221db71751d80001b0fd879291e2
faust/sensors/prometheus.py
python
PrometheusMonitor.on_commit_completed
(self, consumer: ConsumerT, state: typing.Any)
Call when consumer commit offset operation completed.
Call when consumer commit offset operation completed.
[ "Call", "when", "consumer", "commit", "offset", "operation", "completed", "." ]
def on_commit_completed(self, consumer: ConsumerT, state: typing.Any) -> None: """Call when consumer commit offset operation completed.""" super().on_commit_completed(consumer, state) self.consumer_commit_latency.observe( self.ms_since(typing.cast(float, s...
[ "def", "on_commit_completed", "(", "self", ",", "consumer", ":", "ConsumerT", ",", "state", ":", "typing", ".", "Any", ")", "->", "None", ":", "super", "(", ")", ".", "on_commit_completed", "(", "consumer", ",", "state", ")", "self", ".", "consumer_commit_...
https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/sensors/prometheus.py#L227-L232
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/tkinter/__init__.py
python
Misc._bind
(self, what, sequence, func, add, needcleanup=1)
Internal function.
Internal function.
[ "Internal", "function", "." ]
def _bind(self, what, sequence, func, add, needcleanup=1): """Internal function.""" if isinstance(func, str): self.tk.call(what + (sequence, func)) elif func: funcid = self._register(func, self._substitute, needcleanup) cmd = ('%sif {"[...
[ "def", "_bind", "(", "self", ",", "what", ",", "sequence", ",", "func", ",", "add", ",", "needcleanup", "=", "1", ")", ":", "if", "isinstance", "(", "func", ",", "str", ")", ":", "self", ".", "tk", ".", "call", "(", "what", "+", "(", "sequence", ...
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/tkinter/__init__.py#L1036-L1052
javayhu/Gank-Alfred-Workflow
aca39bd0c7bc0c494eee204e10bca61dab760ab7
source-v1/workflow/update.py
python
install_update
(github_slug, current_version)
return True
If a newer release is available, download and install it :param github_slug: ``username/repo`` for workflow's GitHub repo :param current_version: the currently installed version of the workflow. :ref:`Semantic versioning <semver>` is required. :type current_version: ``unicode`` If an update is...
If a newer release is available, download and install it
[ "If", "a", "newer", "release", "is", "available", "download", "and", "install", "it" ]
def install_update(github_slug, current_version): """If a newer release is available, download and install it :param github_slug: ``username/repo`` for workflow's GitHub repo :param current_version: the currently installed version of the workflow. :ref:`Semantic versioning <semver>` is required. ...
[ "def", "install_update", "(", "github_slug", ",", "current_version", ")", ":", "# TODO: `github_slug` and `current_version` are both unusued.", "update_data", "=", "wf", "(", ")", ".", "cached_data", "(", "'__workflow_update_status'", ",", "max_age", "=", "0", ")", "if"...
https://github.com/javayhu/Gank-Alfred-Workflow/blob/aca39bd0c7bc0c494eee204e10bca61dab760ab7/source-v1/workflow/update.py#L320-L348
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/pkg_resources/__init__.py
python
WorkingSet.subscribe
(self, callback, existing=True)
Invoke `callback` for all distributions If `existing=True` (default), call on all existing ones, as well.
Invoke `callback` for all distributions
[ "Invoke", "callback", "for", "all", "distributions" ]
def subscribe(self, callback, existing=True): """Invoke `callback` for all distributions If `existing=True` (default), call on all existing ones, as well. """ if callback in self.callbacks: return self.callbacks.append(callback) if not existing: ...
[ "def", "subscribe", "(", "self", ",", "callback", ",", "existing", "=", "True", ")", ":", "if", "callback", "in", "self", ".", "callbacks", ":", "return", "self", ".", "callbacks", ".", "append", "(", "callback", ")", "if", "not", "existing", ":", "ret...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pkg_resources/__init__.py#L991-L1003
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/re.py
python
findall
(pattern, string, flags=0)
return _compile(pattern, flags).findall(string)
Return a list of all non-overlapping matches in the string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result.
Return a list of all non-overlapping matches in the string.
[ "Return", "a", "list", "of", "all", "non", "-", "overlapping", "matches", "in", "the", "string", "." ]
def findall(pattern, string, flags=0): """Return a list of all non-overlapping matches in the string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result.""" re...
[ "def", "findall", "(", "pattern", ",", "string", ",", "flags", "=", "0", ")", ":", "return", "_compile", "(", "pattern", ",", "flags", ")", ".", "findall", "(", "string", ")" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/re.py#L173-L181
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/setuptools/command/py36compat.py
python
sdist_add_defaults.add_defaults
(self)
Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_files. - all files defined as...
Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_files. - all files defined as...
[ "Add", "all", "the", "default", "files", "to", "self", ".", "filelist", ":", "-", "README", "or", "README", ".", "txt", "-", "setup", ".", "py", "-", "test", "/", "test", "*", ".", "py", "-", "all", "pure", "Python", "modules", "mentioned", "in", "...
def add_defaults(self): """Add all the default files to self.filelist: - README or README.txt - setup.py - test/test*.py - all pure Python modules mentioned in setup script - all files pointed by package_data (build_py) - all files defined in data_file...
[ "def", "add_defaults", "(", "self", ")", ":", "self", ".", "_add_defaults_standards", "(", ")", "self", ".", "_add_defaults_optional", "(", ")", "self", ".", "_add_defaults_python", "(", ")", "self", ".", "_add_defaults_data_files", "(", ")", "self", ".", "_ad...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/setuptools/command/py36compat.py#L18-L38
spartan-array/spartan
fdcf059ce7e48688648d793d632dc5961f4e72b5
spartan/array/distarray.py
python
_tile_mapper
(tile_id, blob, array=None, user_fn=None, **kw)
return user_fn(ex, **kw)
Invoke ``user_fn`` on ``blob``, and construct tiles from the results.
Invoke ``user_fn`` on ``blob``, and construct tiles from the results.
[ "Invoke", "user_fn", "on", "blob", "and", "construct", "tiles", "from", "the", "results", "." ]
def _tile_mapper(tile_id, blob, array=None, user_fn=None, **kw): '''Invoke ``user_fn`` on ``blob``, and construct tiles from the results.''' ex = array.extent_for_blob(tile_id) return user_fn(ex, **kw)
[ "def", "_tile_mapper", "(", "tile_id", ",", "blob", ",", "array", "=", "None", ",", "user_fn", "=", "None", ",", "*", "*", "kw", ")", ":", "ex", "=", "array", ".", "extent_for_blob", "(", "tile_id", ")", "return", "user_fn", "(", "ex", ",", "*", "*...
https://github.com/spartan-array/spartan/blob/fdcf059ce7e48688648d793d632dc5961f4e72b5/spartan/array/distarray.py#L113-L116