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
Project-MONAI/MONAI
83f8b06372a3803ebe9281300cb794a1f3395018
monai/losses/dice.py
python
MaskedDiceLoss.forward
(self, input: torch.Tensor, target: torch.Tensor, mask: Optional[torch.Tensor] = None)
return self.spatial_weighted(input=input, target=target, mask=mask)
Args: input: the shape should be BNH[WD]. target: the shape should be BNH[WD]. mask: the shape should B1H[WD] or 11H[WD].
Args: input: the shape should be BNH[WD]. target: the shape should be BNH[WD]. mask: the shape should B1H[WD] or 11H[WD].
[ "Args", ":", "input", ":", "the", "shape", "should", "be", "BNH", "[", "WD", "]", ".", "target", ":", "the", "shape", "should", "be", "BNH", "[", "WD", "]", ".", "mask", ":", "the", "shape", "should", "B1H", "[", "WD", "]", "or", "11H", "[", "W...
def forward(self, input: torch.Tensor, target: torch.Tensor, mask: Optional[torch.Tensor] = None): """ Args: input: the shape should be BNH[WD]. target: the shape should be BNH[WD]. mask: the shape should B1H[WD] or 11H[WD]. """ return self.spatial_wei...
[ "def", "forward", "(", "self", ",", "input", ":", "torch", ".", "Tensor", ",", "target", ":", "torch", ".", "Tensor", ",", "mask", ":", "Optional", "[", "torch", ".", "Tensor", "]", "=", "None", ")", ":", "return", "self", ".", "spatial_weighted", "(...
https://github.com/Project-MONAI/MONAI/blob/83f8b06372a3803ebe9281300cb794a1f3395018/monai/losses/dice.py#L213-L220
isislovecruft/python-gnupg
784571449032e811587249743e183fc5e908a673
pretty_bad_protocol/gnupg.py
python
GPG.expire
(self, keyid, expiration_time='1y', passphrase=None, expire_subkeys=True)
return result
Changes GnuPG key expiration by passing in new time period (from now) through subprocess's stdin >>> import gnupg >>> gpg = gnupg.GPG(homedir="doctests") >>> key_input = gpg.gen_key_input() >>> key = gpg.gen_key(key_input) >>> gpg.expire(key.fingerprint, '2w', 'good ...
Changes GnuPG key expiration by passing in new time period (from now) through subprocess's stdin
[ "Changes", "GnuPG", "key", "expiration", "by", "passing", "in", "new", "time", "period", "(", "from", "now", ")", "through", "subprocess", "s", "stdin" ]
def expire(self, keyid, expiration_time='1y', passphrase=None, expire_subkeys=True): """Changes GnuPG key expiration by passing in new time period (from now) through subprocess's stdin >>> import gnupg >>> gpg = gnupg.GPG(homedir="doctests") >>> key_input = gpg.gen_key_input...
[ "def", "expire", "(", "self", ",", "keyid", ",", "expiration_time", "=", "'1y'", ",", "passphrase", "=", "None", ",", "expire_subkeys", "=", "True", ")", ":", "passphrase", "=", "passphrase", ".", "encode", "(", "self", ".", "_encoding", ")", "if", "pass...
https://github.com/isislovecruft/python-gnupg/blob/784571449032e811587249743e183fc5e908a673/pretty_bad_protocol/gnupg.py#L602-L640
inasafe/inasafe
355eb2ce63f516b9c26af0c86a24f99e53f63f87
safe/impact_function/impact_function.py
python
ImpactFunction.is_equal
(self, other)
return True, ''
Equality checker with message :param other: Other Impact Function to be compared. :type other: ImpactFunction :returns: True if both are the same IF, other wise False and the message. :rtype: bool, str
Equality checker with message
[ "Equality", "checker", "with", "message" ]
def is_equal(self, other): """Equality checker with message :param other: Other Impact Function to be compared. :type other: ImpactFunction :returns: True if both are the same IF, other wise False and the message. :rtype: bool, str """ properties = [...
[ "def", "is_equal", "(", "self", ",", "other", ")", ":", "properties", "=", "[", "'debug_mode'", ",", "'use_rounding'", ",", "'requested_extent'", ",", "'crs'", ",", "'analysis_extent'", ",", "'datastore'", ",", "'name'", ",", "'title'", ",", "'start_datetime'", ...
https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/impact_function/impact_function.py#L335-L450
hacs/integration
8ad321da6de4bf5ffa06bdaff1802e25edae5705
custom_components/hacs/repositories/base.py
python
HacsRepository.display_status
(self)
return status
Return display_status.
Return display_status.
[ "Return", "display_status", "." ]
def display_status(self) -> str: """Return display_status.""" if self.data.new: status = "new" elif self.pending_restart: status = "pending-restart" elif self.pending_update: status = "pending-upgrade" elif self.data.installed: stat...
[ "def", "display_status", "(", "self", ")", "->", "str", ":", "if", "self", ".", "data", ".", "new", ":", "status", "=", "\"new\"", "elif", "self", ".", "pending_restart", ":", "status", "=", "\"pending-restart\"", "elif", "self", ".", "pending_update", ":"...
https://github.com/hacs/integration/blob/8ad321da6de4bf5ffa06bdaff1802e25edae5705/custom_components/hacs/repositories/base.py#L337-L349
hivesolutions/netius
c6fa76292be0367557518462e0b2bccd852b0d3d
src/netius/common/http2.py
python
HTTP2Stream.remote_update
(self, increment)
Updates the remote window value, the remote windows is the window that controls the output stream of bytes and should represent the number of available bytes in the remote peer that can be immediately processed. :type increment: int :param increment: The increment in bytes to be...
Updates the remote window value, the remote windows is the window that controls the output stream of bytes and should represent the number of available bytes in the remote peer that can be immediately processed.
[ "Updates", "the", "remote", "window", "value", "the", "remote", "windows", "is", "the", "window", "that", "controls", "the", "output", "stream", "of", "bytes", "and", "should", "represent", "the", "number", "of", "available", "bytes", "in", "the", "remote", ...
def remote_update(self, increment): """ Updates the remote window value, the remote windows is the window that controls the output stream of bytes and should represent the number of available bytes in the remote peer that can be immediately processed. :type increment: in...
[ "def", "remote_update", "(", "self", ",", "increment", ")", ":", "self", ".", "window", "+=", "increment" ]
https://github.com/hivesolutions/netius/blob/c6fa76292be0367557518462e0b2bccd852b0d3d/src/netius/common/http2.py#L1189-L1201
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/flatnotebook.py
python
FNBRendererDefault.__init__
(self)
Default class constructor.
Default class constructor.
[ "Default", "class", "constructor", "." ]
def __init__(self): """ Default class constructor. """ FNBRenderer.__init__(self)
[ "def", "__init__", "(", "self", ")", ":", "FNBRenderer", ".", "__init__", "(", "self", ")" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/flatnotebook.py#L2546-L2549
gevent/gevent
ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31
src/gevent/pywsgi.py
python
WSGIHandler.handle
(self)
The main request handling method, called by the server. This method runs a request handling loop, calling :meth:`handle_one_request` until all requests on the connection have been handled (that is, it implements keep-alive).
The main request handling method, called by the server.
[ "The", "main", "request", "handling", "method", "called", "by", "the", "server", "." ]
def handle(self): """ The main request handling method, called by the server. This method runs a request handling loop, calling :meth:`handle_one_request` until all requests on the connection have been handled (that is, it implements keep-alive). """ try:...
[ "def", "handle", "(", "self", ")", ":", "try", ":", "while", "self", ".", "socket", "is", "not", "None", ":", "self", ".", "time_start", "=", "time", ".", "time", "(", ")", "self", ".", "time_finish", "=", "0", "result", "=", "self", ".", "handle_o...
https://github.com/gevent/gevent/blob/ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31/src/gevent/pywsgi.py#L450-L492
DigitalSlideArchive/HistomicsTK
db2ceb4831bec0efa557cf5b18078ae790253de5
histomicstk/segmentation/nuclear/min_model.py
python
cut
(Mask, x1, y1, x2, y2)
return Cut
Performs a cut across a binary mask, zeroing pixels that round to positions on the line (x1, y1)->(x2, y2). Returns ------- Cut : array_like A version of input Mask modified by cutting the line (x1, y1)->(x2, y2) See Also -------- SplitConcavities References ---------- ...
Performs a cut across a binary mask, zeroing pixels that round to positions on the line (x1, y1)->(x2, y2).
[ "Performs", "a", "cut", "across", "a", "binary", "mask", "zeroing", "pixels", "that", "round", "to", "positions", "on", "the", "line", "(", "x1", "y1", ")", "-", ">", "(", "x2", "y2", ")", "." ]
def cut(Mask, x1, y1, x2, y2): """Performs a cut across a binary mask, zeroing pixels that round to positions on the line (x1, y1)->(x2, y2). Returns ------- Cut : array_like A version of input Mask modified by cutting the line (x1, y1)->(x2, y2) See Also -------- SplitConcavit...
[ "def", "cut", "(", "Mask", ",", "x1", ",", "y1", ",", "x2", ",", "y2", ")", ":", "# copy input", "Cut", "=", "Mask", ".", "copy", "(", ")", "# calculate angle of line", "if", "(", "x1", "<", "x2", ")", ":", "theta", "=", "np", ".", "arctan2", "("...
https://github.com/DigitalSlideArchive/HistomicsTK/blob/db2ceb4831bec0efa557cf5b18078ae790253de5/histomicstk/segmentation/nuclear/min_model.py#L789-L851
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/spin.py
python
SpinOpBase._apply_operator_JyKet
(self, ket, **options)
return self._apply_op(ket, 'Jy', **options)
[]
def _apply_operator_JyKet(self, ket, **options): return self._apply_op(ket, 'Jy', **options)
[ "def", "_apply_operator_JyKet", "(", "self", ",", "ket", ",", "*", "*", "options", ")", ":", "return", "self", ".", "_apply_op", "(", "ket", ",", "'Jy'", ",", "*", "*", "options", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/spin.py#L121-L122
Qirky/FoxDot
76318f9630bede48ff3994146ed644affa27bfa4
FoxDot/lib/Code/foxdot_when_statement.py
python
_whenStatement.__exit__
(self, *args)
return self
[]
def __exit__(self, *args): when.editing = None return self
[ "def", "__exit__", "(", "self", ",", "*", "args", ")", ":", "when", ".", "editing", "=", "None", "return", "self" ]
https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/Code/foxdot_when_statement.py#L68-L70
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/turtledemo/lindenmayer.py
python
draw
( commands, rules )
[]
def draw( commands, rules ): for b in commands: try: rules[b]() except TypeError: try: draw(rules[b], rules) except: pass
[ "def", "draw", "(", "commands", ",", "rules", ")", ":", "for", "b", "in", "commands", ":", "try", ":", "rules", "[", "b", "]", "(", ")", "except", "TypeError", ":", "try", ":", "draw", "(", "rules", "[", "b", "]", ",", "rules", ")", "except", "...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/turtledemo/lindenmayer.py#L38-L46
Zehaos/MobileNet
bb02b10fbd211d717f7a207245feac229f6bb23e
nets/inception_resnet_v2.py
python
block8
(net, scale=1.0, activation_fn=tf.nn.relu, scope=None, reuse=None)
return net
Builds the 8x8 resnet block.
Builds the 8x8 resnet block.
[ "Builds", "the", "8x8", "resnet", "block", "." ]
def block8(net, scale=1.0, activation_fn=tf.nn.relu, scope=None, reuse=None): """Builds the 8x8 resnet block.""" with tf.variable_scope(scope, 'Block8', [net], reuse=reuse): with tf.variable_scope('Branch_0'): tower_conv = slim.conv2d(net, 192, 1, scope='Conv2d_1x1') with tf.variable_scope('Branch_1')...
[ "def", "block8", "(", "net", ",", "scale", "=", "1.0", ",", "activation_fn", "=", "tf", ".", "nn", ".", "relu", ",", "scope", "=", "None", ",", "reuse", "=", "None", ")", ":", "with", "tf", ".", "variable_scope", "(", "scope", ",", "'Block8'", ",",...
https://github.com/Zehaos/MobileNet/blob/bb02b10fbd211d717f7a207245feac229f6bb23e/nets/inception_resnet_v2.py#L74-L91
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
amqpstorm/io.py
python
IO._create_socket
(self, socket_family)
return sock
Create Socket. :param int socket_family: :rtype: socket.socket
Create Socket.
[ "Create", "Socket", "." ]
def _create_socket(self, socket_family): """Create Socket. :param int socket_family: :rtype: socket.socket """ sock = socket.socket(socket_family, socket.SOCK_STREAM, 0) sock.settimeout(self._parameters['timeout'] or None) if self.use_ssl: if not comp...
[ "def", "_create_socket", "(", "self", ",", "socket_family", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket_family", ",", "socket", ".", "SOCK_STREAM", ",", "0", ")", "sock", ".", "settimeout", "(", "self", ".", "_parameters", "[", "'timeout'"...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/amqpstorm/io.py#L181-L195
Lawouach/WebSocket-for-Python
a3e6d157b7bb1da1009e66aa750170f1c07aa143
ws4py/websocket.py
python
Heartbeat.__init__
(self, websocket, frequency=2.0)
Runs at a periodic interval specified by `frequency` by sending an unsolicitated pong message to the connected peer. If the message fails to be sent and a socket error is raised, we close the websocket socket automatically, triggering the `closed` handler.
Runs at a periodic interval specified by `frequency` by sending an unsolicitated pong message to the connected peer.
[ "Runs", "at", "a", "periodic", "interval", "specified", "by", "frequency", "by", "sending", "an", "unsolicitated", "pong", "message", "to", "the", "connected", "peer", "." ]
def __init__(self, websocket, frequency=2.0): """ Runs at a periodic interval specified by `frequency` by sending an unsolicitated pong message to the connected peer. If the message fails to be sent and a socket error is raised, we close the websocket socket auto...
[ "def", "__init__", "(", "self", ",", "websocket", ",", "frequency", "=", "2.0", ")", ":", "threading", ".", "Thread", ".", "__init__", "(", "self", ")", "self", ".", "websocket", "=", "websocket", "self", ".", "frequency", "=", "frequency" ]
https://github.com/Lawouach/WebSocket-for-Python/blob/a3e6d157b7bb1da1009e66aa750170f1c07aa143/ws4py/websocket.py#L30-L43
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/decimal.py
python
Context.next_minus
(self, a)
return a.next_minus(context=self)
Returns the largest representable number smaller than a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> ExtendedContext.next_minus(Decimal('1')) Decimal('0.999999999') >>> c.next_minus(Decimal('1E-1007')) Decimal('0E-1007') >>> Exte...
Returns the largest representable number smaller than a.
[ "Returns", "the", "largest", "representable", "number", "smaller", "than", "a", "." ]
def next_minus(self, a): """Returns the largest representable number smaller than a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> ExtendedContext.next_minus(Decimal('1')) Decimal('0.999999999') >>> c.next_minus(Decimal('1E-1007')) ...
[ "def", "next_minus", "(", "self", ",", "a", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "return", "a", ".", "next_minus", "(", "context", "=", "self", ")" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/decimal.py#L4771-L4789
jobovy/galpy
8e6a230bbe24ce16938db10053f92eb17fe4bb52
galpy/potential/SpiralArmsPotential.py
python
SpiralArmsPotential._B
(self, R)
return HNn_R / self._sin_alpha * (0.4 * HNn_R / self._sin_alpha + 1)
Return numpy array from B1 up to and including Bn. (eqn. 6)
Return numpy array from B1 up to and including Bn. (eqn. 6)
[ "Return", "numpy", "array", "from", "B1", "up", "to", "and", "including", "Bn", ".", "(", "eqn", ".", "6", ")" ]
def _B(self, R): """Return numpy array from B1 up to and including Bn. (eqn. 6)""" HNn_R = self._HNn / R return HNn_R / self._sin_alpha * (0.4 * HNn_R / self._sin_alpha + 1)
[ "def", "_B", "(", "self", ",", "R", ")", ":", "HNn_R", "=", "self", ".", "_HNn", "/", "R", "return", "HNn_R", "/", "self", ".", "_sin_alpha", "*", "(", "0.4", "*", "HNn_R", "/", "self", ".", "_sin_alpha", "+", "1", ")" ]
https://github.com/jobovy/galpy/blob/8e6a230bbe24ce16938db10053f92eb17fe4bb52/galpy/potential/SpiralArmsPotential.py#L662-L666
tensorflow/lingvo
ce10019243d954c3c3ebe739f7589b5eebfdf907
lingvo/core/attention.py
python
AdditiveAttention.PackSource
(self, theta, source_vecs, source_contexts, source_padding, source_segment_id=None)
return py_utils.NestedMap( # [time, batch_size, hidden_dim]. source_vecs=concated_source_vecs, # [batch_size, time, context_dim]. # Note the mismatch between `source_vecs` and `source_contexts`. In # `source_vecs`, time is the first dim, while it is the second dim in # `s...
Packs source vectors. Does not change attention state. Args: theta: A `.NestedMap` object containing weights' values of this layer and its children layers. source_vecs: A single tensor of shape [time, batch_size, source_dim]. source_contexts: A single tensor of shape [time, batch_siz...
Packs source vectors.
[ "Packs", "source", "vectors", "." ]
def PackSource(self, theta, source_vecs, source_contexts, source_padding, source_segment_id=None): """Packs source vectors. Does not change attention state. Args: theta: A `.NestedMap` object containing weights' val...
[ "def", "PackSource", "(", "self", ",", "theta", ",", "source_vecs", ",", "source_contexts", ",", "source_padding", ",", "source_segment_id", "=", "None", ")", ":", "with", "tf", ".", "name_scope", "(", "self", ".", "params", ".", "name", ")", ":", "if", ...
https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/attention.py#L702-L740
MozillaSecurity/funfuzz
fe5cc4710f82e68a171bf1255f43519f9c1bf784
src/funfuzz/js/compile_shell.py
python
CompiledShell.get_js_cfg_path
(self)
return self.js_cfg_file
Retrieve the configure file in a js/src directory. Returns: Path: Full path to the configure file
Retrieve the configure file in a js/src directory.
[ "Retrieve", "the", "configure", "file", "in", "a", "js", "/", "src", "directory", "." ]
def get_js_cfg_path(self): """Retrieve the configure file in a js/src directory. Returns: Path: Full path to the configure file """ self.js_cfg_file = self.get_repo_dir() / "js" / "src" / "configure" return self.js_cfg_file
[ "def", "get_js_cfg_path", "(", "self", ")", ":", "self", ".", "js_cfg_file", "=", "self", ".", "get_repo_dir", "(", ")", "/", "\"js\"", "/", "\"src\"", "/", "\"configure\"", "return", "self", ".", "js_cfg_file" ]
https://github.com/MozillaSecurity/funfuzz/blob/fe5cc4710f82e68a171bf1255f43519f9c1bf784/src/funfuzz/js/compile_shell.py#L194-L201
dickreuter/Poker
b7642f0277e267e1a44eab957c4c7d1d8f50f4ee
poker/gui/plots/funds_change_plot.py
python
FundsChangePlot.drawfigure
(self, my_computer_only)
[]
def drawfigure(self, my_computer_only): LogFilename = 'log' L = GameLogger(LogFilename) p_name = str(self.ui_analyser.combobox_strategy.currentText()) data = L.get_fundschange_chart(p_name, my_computer_only) self.fig.clf() self.axes = self.fig.add_subplot(111) # create a...
[ "def", "drawfigure", "(", "self", ",", "my_computer_only", ")", ":", "LogFilename", "=", "'log'", "L", "=", "GameLogger", "(", "LogFilename", ")", "p_name", "=", "str", "(", "self", ".", "ui_analyser", ".", "combobox_strategy", ".", "currentText", "(", ")", ...
https://github.com/dickreuter/Poker/blob/b7642f0277e267e1a44eab957c4c7d1d8f50f4ee/poker/gui/plots/funds_change_plot.py#L18-L30
nccgroup/BLESuite
0e2e534f7d9beaa8e9d76223959a60b064f61e22
blesuite/gatt_procedures.py
python
gatt_procedure_read_handle_async
(stack_connection, connection_handle, handle, timeout=15 * 1000)
return request
Read data from target attribute handle and returns a GATTRequest object that contains either a GATTResponse for a GATTError. This is an asynchronous function that issues the request and returns a GATTRequest object. The GATTRequest can then be manually managed using the has_response and has_error class inst...
Read data from target attribute handle and returns a GATTRequest object that contains either a GATTResponse for a GATTError. This is an asynchronous function that issues the request and returns a GATTRequest object. The GATTRequest can then be manually managed using the has_response and has_error class inst...
[ "Read", "data", "from", "target", "attribute", "handle", "and", "returns", "a", "GATTRequest", "object", "that", "contains", "either", "a", "GATTResponse", "for", "a", "GATTError", ".", "This", "is", "an", "asynchronous", "function", "that", "issues", "the", "...
def gatt_procedure_read_handle_async(stack_connection, connection_handle, handle, timeout=15 * 1000): """ Read data from target attribute handle and returns a GATTRequest object that contains either a GATTResponse for a GATTError. This is an asynchronous function that issues the request and returns a GA...
[ "def", "gatt_procedure_read_handle_async", "(", "stack_connection", ",", "connection_handle", ",", "handle", ",", "timeout", "=", "15", "*", "1000", ")", ":", "request", "=", "stack_connection", ".", "read_async", "(", "handle", ",", "connection_handle", ",", "tim...
https://github.com/nccgroup/BLESuite/blob/0e2e534f7d9beaa8e9d76223959a60b064f61e22/blesuite/gatt_procedures.py#L225-L245
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/threading.py
python
enumerate
()
Return a list of all Thread objects currently alive. The list includes daemonic threads, dummy thread objects created by current_thread(), and the main thread. It excludes terminated threads and threads that have not yet been started.
Return a list of all Thread objects currently alive.
[ "Return", "a", "list", "of", "all", "Thread", "objects", "currently", "alive", "." ]
def enumerate(): """Return a list of all Thread objects currently alive. The list includes daemonic threads, dummy thread objects created by current_thread(), and the main thread. It excludes terminated threads and threads that have not yet been started. """ with _active_limbo_lock: re...
[ "def", "enumerate", "(", ")", ":", "with", "_active_limbo_lock", ":", "return", "list", "(", "_active", ".", "values", "(", ")", ")", "+", "list", "(", "_limbo", ".", "values", "(", ")", ")" ]
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/threading.py#L1336-L1345
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
medusa/indexers/ui.py
python
BaseUI.select_series
(self, all_series)
return all_series[0]
Return all series.
Return all series.
[ "Return", "all", "series", "." ]
def select_series(self, all_series): """Return all series.""" return all_series[0]
[ "def", "select_series", "(", "self", ",", "all_series", ")", ":", "return", "all_series", "[", "0", "]" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/indexers/ui.py#L31-L33
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/_collections_abc.py
python
MutableSet.discard
(self, value)
Remove an element. Do not raise an exception if absent.
Remove an element. Do not raise an exception if absent.
[ "Remove", "an", "element", ".", "Do", "not", "raise", "an", "exception", "if", "absent", "." ]
def discard(self, value): """Remove an element. Do not raise an exception if absent.""" raise NotImplementedError
[ "def", "discard", "(", "self", ",", "value", ")", ":", "raise", "NotImplementedError" ]
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/_collections_abc.py#L576-L578
stlehmann/pyads
fe0067952560ac697ce7ba992018ceee10074704
pyads/ads.py
python
open_port
()
return port
Connect to the TwinCAT message router. :rtype: int :return: port number
Connect to the TwinCAT message router.
[ "Connect", "to", "the", "TwinCAT", "message", "router", "." ]
def open_port() -> int: """Connect to the TwinCAT message router. :rtype: int :return: port number """ global port port = port or adsPortOpenEx() return port
[ "def", "open_port", "(", ")", "->", "int", ":", "global", "port", "port", "=", "port", "or", "adsPortOpenEx", "(", ")", "return", "port" ]
https://github.com/stlehmann/pyads/blob/fe0067952560ac697ce7ba992018ceee10074704/pyads/ads.py#L100-L110
Arachnid/bloggart
ba2b60417102fe14a77b1bcd809b9b801d3a96e2
lib/docutils/statemachine.py
python
StateMachine.check_line
(self, context, state, transitions=None)
Examine one line of input for a transition match & execute its method. Parameters: - `context`: application-dependent storage. - `state`: a `State` object, the current state. - `transitions`: an optional ordered list of transition names to try, instead of ``state.transition_o...
Examine one line of input for a transition match & execute its method.
[ "Examine", "one", "line", "of", "input", "for", "a", "transition", "match", "&", "execute", "its", "method", "." ]
def check_line(self, context, state, transitions=None): """ Examine one line of input for a transition match & execute its method. Parameters: - `context`: application-dependent storage. - `state`: a `State` object, the current state. - `transitions`: an optional ordere...
[ "def", "check_line", "(", "self", ",", "context", ",", "state", ",", "transitions", "=", "None", ")", ":", "if", "transitions", "is", "None", ":", "transitions", "=", "state", ".", "transition_order", "state_correction", "=", "None", "if", "self", ".", "de...
https://github.com/Arachnid/bloggart/blob/ba2b60417102fe14a77b1bcd809b9b801d3a96e2/lib/docutils/statemachine.py#L385-L427
F5Networks/f5-ansible
d61253b0980eb0feab448fcb977e3b089d49b79a
ansible_collections/f5networks/f5_modules/plugins/modules/bigip_user.py
python
ModuleManager.is_version_less_than_13
(self)
Checks to see if the TMOS version is less than 13 Anything less than BIG-IP 13.x does not support users on different partitions. :return: Bool
Checks to see if the TMOS version is less than 13
[ "Checks", "to", "see", "if", "the", "TMOS", "version", "is", "less", "than", "13" ]
def is_version_less_than_13(self): """Checks to see if the TMOS version is less than 13 Anything less than BIG-IP 13.x does not support users on different partitions. :return: Bool """ version = tmos_version(self.client) if LooseVersion(version) < LooseVersion('...
[ "def", "is_version_less_than_13", "(", "self", ")", ":", "version", "=", "tmos_version", "(", "self", ".", "client", ")", "if", "LooseVersion", "(", "version", ")", "<", "LooseVersion", "(", "'13.0.0'", ")", ":", "return", "True", "else", ":", "return", "F...
https://github.com/F5Networks/f5-ansible/blob/d61253b0980eb0feab448fcb977e3b089d49b79a/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_user.py#L463-L475
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
vendor/oauth2client/appengine.py
python
AppAssertionCredentials.from_json
(cls, json)
return AppAssertionCredentials(data['scope'])
[]
def from_json(cls, json): data = simplejson.loads(json) return AppAssertionCredentials(data['scope'])
[ "def", "from_json", "(", "cls", ",", "json", ")", ":", "data", "=", "simplejson", ".", "loads", "(", "json", ")", "return", "AppAssertionCredentials", "(", "data", "[", "'scope'", "]", ")" ]
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/vendor/oauth2client/appengine.py#L85-L87
pythonanywhere/dirigible-spreadsheet
c771e9a391708f3b219248bf9974e05b1582fdd0
dirigible/registration/views.py
python
register
(request, success_url=None, form_class=RegistrationForm, profile_callback=None, template_name='registration/registration_form.html', extra_context=None)
return render_to_response(template_name, { 'form': form }, context_instance=context)
Allow a new user to register an account. Following successful registration, issue a redirect; by default, this will be whatever URL corresponds to the named URL pattern ``registration_complete``, which will be ``/accounts/register/complete/`` if using the included URLConf. To change this, point...
Allow a new user to register an account. Following successful registration, issue a redirect; by default, this will be whatever URL corresponds to the named URL pattern ``registration_complete``, which will be ``/accounts/register/complete/`` if using the included URLConf. To change this, point...
[ "Allow", "a", "new", "user", "to", "register", "an", "account", ".", "Following", "successful", "registration", "issue", "a", "redirect", ";", "by", "default", "this", "will", "be", "whatever", "URL", "corresponds", "to", "the", "named", "URL", "pattern", "r...
def register(request, success_url=None, form_class=RegistrationForm, profile_callback=None, template_name='registration/registration_form.html', extra_context=None): """ Allow a new user to register an account. Following successful registration, issue a redirect; ...
[ "def", "register", "(", "request", ",", "success_url", "=", "None", ",", "form_class", "=", "RegistrationForm", ",", "profile_callback", "=", "None", ",", "template_name", "=", "'registration/registration_form.html'", ",", "extra_context", "=", "None", ")", ":", "...
https://github.com/pythonanywhere/dirigible-spreadsheet/blob/c771e9a391708f3b219248bf9974e05b1582fdd0/dirigible/registration/views.py#L76-L164
gkrizek/bash-lambda-layer
703b0ade8174022d44779d823172ab7ac33a5505
bin/s3transfer/processpool.py
python
TransferMonitor.poll_for_result
(self, transfer_id)
return None
Poll for the result of a transfer :param transfer_id: Unique identifier for the transfer :return: If the transfer succeeded, it will return the result. If the transfer failed, it will raise the exception associated to the failure.
Poll for the result of a transfer
[ "Poll", "for", "the", "result", "of", "a", "transfer" ]
def poll_for_result(self, transfer_id): """Poll for the result of a transfer :param transfer_id: Unique identifier for the transfer :return: If the transfer succeeded, it will return the result. If the transfer failed, it will raise the exception associated to the failur...
[ "def", "poll_for_result", "(", "self", ",", "transfer_id", ")", ":", "self", ".", "_transfer_states", "[", "transfer_id", "]", ".", "wait_till_done", "(", ")", "exception", "=", "self", ".", "_transfer_states", "[", "transfer_id", "]", ".", "exception", "if", ...
https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/s3transfer/processpool.py#L606-L618
freewym/espresso
6671c507350295269e38add57dbe601dcb8e6ecf
examples/simultaneous_translation/models/transformer_monotonic_attention.py
python
TransformerMonotonicDecoder.extract_features
( self, prev_output_tokens, encoder_out: Optional[Dict[str, List[Tensor]]], incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] = None, full_context_alignment: bool = False, # unused alignment_layer: Optional[int] = None, # unused alignment_heads...
return x, TransformerMonotonicDecoderOut( action=1, p_choose=p_choose, attn_list=attn_list, encoder_out=encoder_out, encoder_padding_mask=encoder_padding_mask, )
Similar to *forward* but only return features. Returns: tuple: - the decoder's features of shape `(batch, tgt_len, embed_dim)` - a dictionary with any model-specific outputs
Similar to *forward* but only return features.
[ "Similar", "to", "*", "forward", "*", "but", "only", "return", "features", "." ]
def extract_features( self, prev_output_tokens, encoder_out: Optional[Dict[str, List[Tensor]]], incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] = None, full_context_alignment: bool = False, # unused alignment_layer: Optional[int] = None, # unused ...
[ "def", "extract_features", "(", "self", ",", "prev_output_tokens", ",", "encoder_out", ":", "Optional", "[", "Dict", "[", "str", ",", "List", "[", "Tensor", "]", "]", "]", ",", "incremental_state", ":", "Optional", "[", "Dict", "[", "str", ",", "Dict", "...
https://github.com/freewym/espresso/blob/6671c507350295269e38add57dbe601dcb8e6ecf/examples/simultaneous_translation/models/transformer_monotonic_attention.py#L185-L260
chainer/chainercv
7159616642e0be7c5b3ef380b848e16b7e99355b
chainercv/functions/ps_roi_average_align_2d.py
python
_pair
(x)
return x, x
[]
def _pair(x): if isinstance(x, chainer.utils.collections_abc.Iterable): return x return x, x
[ "def", "_pair", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "chainer", ".", "utils", ".", "collections_abc", ".", "Iterable", ")", ":", "return", "x", "return", "x", ",", "x" ]
https://github.com/chainer/chainercv/blob/7159616642e0be7c5b3ef380b848e16b7e99355b/chainercv/functions/ps_roi_average_align_2d.py#L32-L35
9miao/Firefly
fd2795b8c26de6ab63bbec23d11f18c3dfb39a50
gfirefly/distributed/child.py
python
Child.callbackChildForResult
(self,*args,**kw)
return recvdata
回调子节点的接口\n return a Defered Object (recvdata)
回调子节点的接口\n return a Defered Object (recvdata)
[ "回调子节点的接口", "\\", "n", "return", "a", "Defered", "Object", "(", "recvdata", ")" ]
def callbackChildForResult(self,*args,**kw): '''回调子节点的接口\n return a Defered Object (recvdata) ''' remote = self._transport.getRootObject() recvdata = remote.callRemoteForResult('callChild',*args,**kw) return recvdata
[ "def", "callbackChildForResult", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "remote", "=", "self", ".", "_transport", ".", "getRootObject", "(", ")", "recvdata", "=", "remote", ".", "callRemoteForResult", "(", "'callChild'", ",", "*", ...
https://github.com/9miao/Firefly/blob/fd2795b8c26de6ab63bbec23d11f18c3dfb39a50/gfirefly/distributed/child.py#L37-L43
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/ecdsa/six.py
python
_LazyDescr.__get__
(self, obj, tp)
return result
[]
def __get__(self, obj, tp): result = self._resolve() setattr(obj, self.name, result) # This is a bit ugly, but it avoids running this again. delattr(tp, self.name) return result
[ "def", "__get__", "(", "self", ",", "obj", ",", "tp", ")", ":", "result", "=", "self", ".", "_resolve", "(", ")", "setattr", "(", "obj", ",", "self", ".", "name", ",", "result", ")", "# This is a bit ugly, but it avoids running this again.", "delattr", "(", ...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/ecdsa/six.py#L83-L88
tensorflow/federated
5a60a032360087b8f4c7fcfd97ed1c0131c3eac3
tensorflow_federated/python/core/backends/mapreduce/form_utils.py
python
get_broadcast_form_for_computation
( comp: computation_base.Computation, grappler_config: tf.compat.v1.ConfigProto = _GRAPPLER_DEFAULT_CONFIG )
return forms.BroadcastForm( compute_server_context, client_processing, server_data_label=server_data_label, client_data_label=client_data_label)
Constructs `tff.backends.mapreduce.BroadcastForm` given a computation. Args: comp: An instance of `tff.Computation` that is compatible with broadcast form. Computations are only compatible if they take in a single value placed at server, return a single value placed at clients, and do not conta...
Constructs `tff.backends.mapreduce.BroadcastForm` given a computation.
[ "Constructs", "tff", ".", "backends", ".", "mapreduce", ".", "BroadcastForm", "given", "a", "computation", "." ]
def get_broadcast_form_for_computation( comp: computation_base.Computation, grappler_config: tf.compat.v1.ConfigProto = _GRAPPLER_DEFAULT_CONFIG ) -> forms.BroadcastForm: """Constructs `tff.backends.mapreduce.BroadcastForm` given a computation. Args: comp: An instance of `tff.Computation` that is compa...
[ "def", "get_broadcast_form_for_computation", "(", "comp", ":", "computation_base", ".", "Computation", ",", "grappler_config", ":", "tf", ".", "compat", ".", "v1", ".", "ConfigProto", "=", "_GRAPPLER_DEFAULT_CONFIG", ")", "->", "forms", ".", "BroadcastForm", ":", ...
https://github.com/tensorflow/federated/blob/5a60a032360087b8f4c7fcfd97ed1c0131c3eac3/tensorflow_federated/python/core/backends/mapreduce/form_utils.py#L821-L879
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
lib/spack/external/jinja2/sandbox.py
python
SandboxedEnvironment.getattr
(self, obj, attribute)
return self.undefined(obj=obj, name=attribute)
Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring.
Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring.
[ "Subscribe", "an", "object", "from", "sandboxed", "code", "and", "prefer", "the", "attribute", ".", "The", "attribute", "passed", "*", "must", "*", "be", "a", "bytestring", "." ]
def getattr(self, obj, attribute): """Subscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring. """ try: value = getattr(obj, attribute) except AttributeError: try: return obj[attribute]...
[ "def", "getattr", "(", "self", ",", "obj", ",", "attribute", ")", ":", "try", ":", "value", "=", "getattr", "(", "obj", ",", "attribute", ")", "except", "AttributeError", ":", "try", ":", "return", "obj", "[", "attribute", "]", "except", "(", "TypeErro...
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/external/jinja2/sandbox.py#L402-L417
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/sqlalchemy/dialects/mssql/base.py
python
MSSQLStrictCompiler.render_literal_value
(self, value, type_)
For date and datetime values, convert to a string format acceptable to MSSQL. That seems to be the so-called ODBC canonical date format which looks like this: yyyy-mm-dd hh:mi:ss.mmm(24h) For other data types, call the base class implementation.
For date and datetime values, convert to a string format acceptable to MSSQL. That seems to be the so-called ODBC canonical date format which looks like this:
[ "For", "date", "and", "datetime", "values", "convert", "to", "a", "string", "format", "acceptable", "to", "MSSQL", ".", "That", "seems", "to", "be", "the", "so", "-", "called", "ODBC", "canonical", "date", "format", "which", "looks", "like", "this", ":" ]
def render_literal_value(self, value, type_): """ For date and datetime values, convert to a string format acceptable to MSSQL. That seems to be the so-called ODBC canonical date format which looks like this: yyyy-mm-dd hh:mi:ss.mmm(24h) For other data types...
[ "def", "render_literal_value", "(", "self", ",", "value", ",", "type_", ")", ":", "# datetime and date are both subclasses of datetime.date", "if", "issubclass", "(", "type", "(", "value", ")", ",", "datetime", ".", "date", ")", ":", "# SQL Server wants single quotes ...
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/dialects/mssql/base.py#L958-L975
zhanghe06/python
a678ce38a3770c91ad12e617810bf9f5ccf7898b
tools/postgres.py
python
Postgres.get_count
(self, table_name, condition=None)
获取记录总数 :return:
获取记录总数 :return:
[ "获取记录总数", ":", "return", ":" ]
def get_count(self, table_name, condition=None): """ 获取记录总数 :return: """ if self.is_conn_open() is False: logger.error('连接已断开') return 0 # 参数判断 if table_name is None: logger.error('查询表名缺少参数') return 0 if cond...
[ "def", "get_count", "(", "self", ",", "table_name", ",", "condition", "=", "None", ")", ":", "if", "self", ".", "is_conn_open", "(", ")", "is", "False", ":", "logger", ".", "error", "(", "'连接已断开')", "", "return", "0", "# 参数判断", "if", "table_name", "is"...
https://github.com/zhanghe06/python/blob/a678ce38a3770c91ad12e617810bf9f5ccf7898b/tools/postgres.py#L191-L223
soeaver/Parsing-R-CNN
8c4d940dcd322bf7a8671f8b0faaabb3259bd384
rcnn/modeling/fpn/FPN.py
python
get_min_max_levels
()
return min_level, max_level
The min and max FPN levels required for supporting RPN and/or RoI transform operations on multiple FPN levels.
The min and max FPN levels required for supporting RPN and/or RoI transform operations on multiple FPN levels.
[ "The", "min", "and", "max", "FPN", "levels", "required", "for", "supporting", "RPN", "and", "/", "or", "RoI", "transform", "operations", "on", "multiple", "FPN", "levels", "." ]
def get_min_max_levels(): """The min and max FPN levels required for supporting RPN and/or RoI transform operations on multiple FPN levels. """ min_level = cfg.FPN.LOWEST_BACKBONE_LVL max_level = cfg.FPN.HIGHEST_BACKBONE_LVL if cfg.FPN.MULTILEVEL_RPN and not cfg.FPN.MULTILEVEL_ROIS: max_...
[ "def", "get_min_max_levels", "(", ")", ":", "min_level", "=", "cfg", ".", "FPN", ".", "LOWEST_BACKBONE_LVL", "max_level", "=", "cfg", ".", "FPN", ".", "HIGHEST_BACKBONE_LVL", "if", "cfg", ".", "FPN", ".", "MULTILEVEL_RPN", "and", "not", "cfg", ".", "FPN", ...
https://github.com/soeaver/Parsing-R-CNN/blob/8c4d940dcd322bf7a8671f8b0faaabb3259bd384/rcnn/modeling/fpn/FPN.py#L124-L139
httpie/httpie
4c56d894ba9e2bb1c097a3a6067006843ac2944d
httpie/config.py
python
Config.plugins_dir
(self)
return Path(self.get('plugins_dir', self.directory / 'plugins')).resolve()
[]
def plugins_dir(self) -> Path: return Path(self.get('plugins_dir', self.directory / 'plugins')).resolve()
[ "def", "plugins_dir", "(", "self", ")", "->", "Path", ":", "return", "Path", "(", "self", ".", "get", "(", "'plugins_dir'", ",", "self", ".", "directory", "/", "'plugins'", ")", ")", ".", "resolve", "(", ")" ]
https://github.com/httpie/httpie/blob/4c56d894ba9e2bb1c097a3a6067006843ac2944d/httpie/config.py#L133-L134
googleapis/google-api-python-client
f48a01fde4dae27aa62412364f47411684562d23
googleapiclient/http.py
python
_StreamSlice.__init__
(self, stream, begin, chunksize)
Constructor. Args: stream: (io.Base, file object), the stream to wrap. begin: int, the seek position the chunk begins at. chunksize: int, the size of the chunk.
Constructor.
[ "Constructor", "." ]
def __init__(self, stream, begin, chunksize): """Constructor. Args: stream: (io.Base, file object), the stream to wrap. begin: int, the seek position the chunk begins at. chunksize: int, the size of the chunk. """ self._stream = stream self._begin =...
[ "def", "__init__", "(", "self", ",", "stream", ",", "begin", ",", "chunksize", ")", ":", "self", ".", "_stream", "=", "stream", "self", ".", "_begin", "=", "begin", "self", ".", "_chunksize", "=", "chunksize", "self", ".", "_stream", ".", "seek", "(", ...
https://github.com/googleapis/google-api-python-client/blob/f48a01fde4dae27aa62412364f47411684562d23/googleapiclient/http.py#L792-L803
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Django/django/db/models/query.py
python
QuerySet.create
(self, **kwargs)
return obj
Creates a new object with the given kwargs, saving it to the database and returning the created object.
Creates a new object with the given kwargs, saving it to the database and returning the created object.
[ "Creates", "a", "new", "object", "with", "the", "given", "kwargs", "saving", "it", "to", "the", "database", "and", "returning", "the", "created", "object", "." ]
def create(self, **kwargs): """ Creates a new object with the given kwargs, saving it to the database and returning the created object. """ obj = self.model(**kwargs) self._for_write = True obj.save(force_insert=True, using=self.db) return obj
[ "def", "create", "(", "self", ",", "*", "*", "kwargs", ")", ":", "obj", "=", "self", ".", "model", "(", "*", "*", "kwargs", ")", "self", ".", "_for_write", "=", "True", "obj", ".", "save", "(", "force_insert", "=", "True", ",", "using", "=", "sel...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/db/models/query.py#L409-L417
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/treebeard/mp_tree.py
python
MP_Node.is_child_of
(self, node)
return (self.path.startswith(node.path) and self.depth == node.depth + 1)
:returns: ``True`` is the node if a child of another node given as an argument, else, returns ``False``
:returns: ``True`` is the node if a child of another node given as an argument, else, returns ``False``
[ ":", "returns", ":", "True", "is", "the", "node", "if", "a", "child", "of", "another", "node", "given", "as", "an", "argument", "else", "returns", "False" ]
def is_child_of(self, node): """ :returns: ``True`` is the node if a child of another node given as an argument, else, returns ``False`` """ return (self.path.startswith(node.path) and self.depth == node.depth + 1)
[ "def", "is_child_of", "(", "self", ",", "node", ")", ":", "return", "(", "self", ".", "path", ".", "startswith", "(", "node", ".", "path", ")", "and", "self", ".", "depth", "==", "node", ".", "depth", "+", "1", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/treebeard/mp_tree.py#L986-L992
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/combinatorics/subsets.py
python
Subset.prev_lexicographic
(self)
return Subset(ret_set, super_set)
Generates the previous lexicographically ordered subset. Examples ======== >>> from sympy.combinatorics.subsets import Subset >>> a = Subset([], ['a', 'b', 'c', 'd']) >>> a.prev_lexicographic().subset ['d'] >>> a = Subset(['c','d'], ['a', 'b', 'c', 'd']) ...
Generates the previous lexicographically ordered subset.
[ "Generates", "the", "previous", "lexicographically", "ordered", "subset", "." ]
def prev_lexicographic(self): """ Generates the previous lexicographically ordered subset. Examples ======== >>> from sympy.combinatorics.subsets import Subset >>> a = Subset([], ['a', 'b', 'c', 'd']) >>> a.prev_lexicographic().subset ['d'] >>> a...
[ "def", "prev_lexicographic", "(", "self", ")", ":", "i", "=", "self", ".", "superset_size", "-", "1", "indices", "=", "Subset", ".", "subset_indices", "(", "self", ".", "subset", ",", "self", ".", "superset", ")", "while", "i", "not", "in", "indices", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/combinatorics/subsets.py#L183-L221
MycroftAI/adapt
4445f3cc875009ef31f03dba0e8355a085a655b3
adapt/intent.py
python
IntentBuilder.require
(self, entity_type, attribute_name=None)
return self
The intent parser should require an entity of the provided type. Args: entity_type(str): an entity type attribute_name(str): the name of the attribute on the parsed intent. Defaults to match entity_type. Returns: self: to continue modifications.
The intent parser should require an entity of the provided type.
[ "The", "intent", "parser", "should", "require", "an", "entity", "of", "the", "provided", "type", "." ]
def require(self, entity_type, attribute_name=None): """ The intent parser should require an entity of the provided type. Args: entity_type(str): an entity type attribute_name(str): the name of the attribute on the parsed intent. Defaults to match entity_type...
[ "def", "require", "(", "self", ",", "entity_type", ",", "attribute_name", "=", "None", ")", ":", "if", "not", "attribute_name", ":", "attribute_name", "=", "entity_type", "self", ".", "requires", "+=", "[", "(", "entity_type", ",", "attribute_name", ")", "]"...
https://github.com/MycroftAI/adapt/blob/4445f3cc875009ef31f03dba0e8355a085a655b3/adapt/intent.py#L263-L278
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/homology/hochschild_complex.py
python
HochschildComplex.cohomology
(self, d)
return ker.quotient_module(im_retract)
r""" Return the ``d``-th cohomology group. EXAMPLES:: sage: E.<x,y> = ExteriorAlgebra(QQ) sage: H = E.hochschild_complex(E) sage: H.cohomology(0) Vector space of dimension 3 over Rational Field sage: H.cohomology(1) Vector space o...
r""" Return the ``d``-th cohomology group.
[ "r", "Return", "the", "d", "-", "th", "cohomology", "group", "." ]
def cohomology(self, d): r""" Return the ``d``-th cohomology group. EXAMPLES:: sage: E.<x,y> = ExteriorAlgebra(QQ) sage: H = E.hochschild_complex(E) sage: H.cohomology(0) Vector space of dimension 3 over Rational Field sage: H.cohomol...
[ "def", "cohomology", "(", "self", ",", "d", ")", ":", "if", "self", ".", "_A", ".", "category", "(", ")", "is", "not", "self", ".", "_A", ".", "category", "(", ")", ".", "FiniteDimensional", "(", ")", ":", "raise", "NotImplementedError", "(", "\"the ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/homology/hochschild_complex.py#L404-L456
devbisme/skidl
458709a10b28a864d25ae2c2b44c6103d4ddb291
skidl/package.py
python
Package.__call__
(self, *args, **kwargs)
return pckg
Create a copy of a package.
Create a copy of a package.
[ "Create", "a", "copy", "of", "a", "package", "." ]
def __call__(self, *args, **kwargs): """Create a copy of a package.""" # Get circuit that will contain the package subcircuitry. circuit = kwargs.pop("circuit", default_circuit) # See if this package should be instantiated into the netlist or used as a template. dest = kwargs.p...
[ "def", "__call__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Get circuit that will contain the package subcircuitry.", "circuit", "=", "kwargs", ".", "pop", "(", "\"circuit\"", ",", "default_circuit", ")", "# See if this package should be in...
https://github.com/devbisme/skidl/blob/458709a10b28a864d25ae2c2b44c6103d4ddb291/skidl/package.py#L41-L76
XanaduAI/quantum-neural-networks
d28e68b2faa8578362117a160a224a24cd97128e
function_fitting/function_fitting.py
python
f1
(x, eps=0.0)
return np.abs(x) + eps * np.random.normal(size=x.shape)
The function f(x)=|x|+noise
The function f(x)=|x|+noise
[ "The", "function", "f", "(", "x", ")", "=", "|x|", "+", "noise" ]
def f1(x, eps=0.0): """The function f(x)=|x|+noise""" return np.abs(x) + eps * np.random.normal(size=x.shape)
[ "def", "f1", "(", "x", ",", "eps", "=", "0.0", ")", ":", "return", "np", ".", "abs", "(", "x", ")", "+", "eps", "*", "np", ".", "random", ".", "normal", "(", "size", "=", "x", ".", "shape", ")" ]
https://github.com/XanaduAI/quantum-neural-networks/blob/d28e68b2faa8578362117a160a224a24cd97128e/function_fitting/function_fitting.py#L67-L69
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
tensorflow2/tf2cv/models/shufflenetv2b.py
python
shufflenetv2b_w1
(**kwargs)
return get_shufflenetv2b( width_scale=1.0, shuffle_group_first=True, model_name="shufflenetv2b_w1", **kwargs)
ShuffleNetV2(b) 1x model from 'ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design,' https://arxiv.org/abs/1807.11164. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.tensorflow/models' ...
ShuffleNetV2(b) 1x model from 'ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design,' https://arxiv.org/abs/1807.11164.
[ "ShuffleNetV2", "(", "b", ")", "1x", "model", "from", "ShuffleNet", "V2", ":", "Practical", "Guidelines", "for", "Efficient", "CNN", "Architecture", "Design", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1807", ".", "11164", "." ]
def shufflenetv2b_w1(**kwargs): """ ShuffleNetV2(b) 1x model from 'ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design,' https://arxiv.org/abs/1807.11164. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ...
[ "def", "shufflenetv2b_w1", "(", "*", "*", "kwargs", ")", ":", "return", "get_shufflenetv2b", "(", "width_scale", "=", "1.0", ",", "shuffle_group_first", "=", "True", ",", "model_name", "=", "\"shufflenetv2b_w1\"", ",", "*", "*", "kwargs", ")" ]
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/tensorflow2/tf2cv/models/shufflenetv2b.py#L333-L349
duo-labs/isthislegit
5d51fd2e0fe070cacd1ee169ca8a371a72e005ef
dashboard/lib/flanker/addresslib/address.py
python
parse_list
(address_list, strict=False, as_tuple=False, metrics=False)
return _parse_list_result(as_tuple, AddressList(), [address_list], mtimes)
Given an string or list of email addresses and/or urls seperated by a delimiter (comma (,) or semi-colon (;)), returns an AddressList object (an iterable list representing parsed email addresses and urls). Given a list of email addresses, the strict parameter is passed to the parse call for each elemen...
Given an string or list of email addresses and/or urls seperated by a delimiter (comma (,) or semi-colon (;)), returns an AddressList object (an iterable list representing parsed email addresses and urls).
[ "Given", "an", "string", "or", "list", "of", "email", "addresses", "and", "/", "or", "urls", "seperated", "by", "a", "delimiter", "(", "comma", "(", ")", "or", "semi", "-", "colon", "(", ";", "))", "returns", "an", "AddressList", "object", "(", "an", ...
def parse_list(address_list, strict=False, as_tuple=False, metrics=False): """ Given an string or list of email addresses and/or urls seperated by a delimiter (comma (,) or semi-colon (;)), returns an AddressList object (an iterable list representing parsed email addresses and urls). Given a list o...
[ "def", "parse_list", "(", "address_list", ",", "strict", "=", "False", ",", "as_tuple", "=", "False", ",", "metrics", "=", "False", ")", ":", "mtimes", "=", "{", "'parsing'", ":", "0", "}", "if", "not", "address_list", ":", "return", "_parse_list_result", ...
https://github.com/duo-labs/isthislegit/blob/5d51fd2e0fe070cacd1ee169ca8a371a72e005ef/dashboard/lib/flanker/addresslib/address.py#L189-L257
IdentityPython/pysaml2
6badb32d212257bd83ffcc816f9b625f68281b47
src/saml2/ws/wssec.py
python
factory
(tag, **kwargs)
return ELEMENT_BY_TAG[tag](**kwargs)
[]
def factory(tag, **kwargs): return ELEMENT_BY_TAG[tag](**kwargs)
[ "def", "factory", "(", "tag", ",", "*", "*", "kwargs", ")", ":", "return", "ELEMENT_BY_TAG", "[", "tag", "]", "(", "*", "*", "kwargs", ")" ]
https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/ws/wssec.py#L544-L545
nschaetti/EchoTorch
cba209c49e0fda73172d2e853b85c747f9f5117e
echotorch/data_tensors.py
python
DataTensor._build_keys
(self, keys: List[Any])
return key_indexers
r"""Build data indexers
r"""Build data indexers
[ "r", "Build", "data", "indexers" ]
def _build_keys(self, keys: List[Any]): r"""Build data indexers """ key_indexers = list() for key in keys: if key is not None: key_indexers.append(DataIndexer(key)) else: key_indexers.append(None) # end if # end ...
[ "def", "_build_keys", "(", "self", ",", "keys", ":", "List", "[", "Any", "]", ")", ":", "key_indexers", "=", "list", "(", ")", "for", "key", "in", "keys", ":", "if", "key", "is", "not", "None", ":", "key_indexers", ".", "append", "(", "DataIndexer", ...
https://github.com/nschaetti/EchoTorch/blob/cba209c49e0fda73172d2e853b85c747f9f5117e/echotorch/data_tensors.py#L367-L378
williamSYSU/TextGAN-PyTorch
891635af6845edfee382de147faa4fc00c7e90eb
metrics/clas_acc.py
python
ACC.__init__
(self, if_use=True, gpu=True)
[]
def __init__(self, if_use=True, gpu=True): super(ACC, self).__init__('clas_acc') self.if_use = if_use self.model = None self.data_loader = None self.gpu = gpu
[ "def", "__init__", "(", "self", ",", "if_use", "=", "True", ",", "gpu", "=", "True", ")", ":", "super", "(", "ACC", ",", "self", ")", ".", "__init__", "(", "'clas_acc'", ")", "self", ".", "if_use", "=", "if_use", "self", ".", "model", "=", "None", ...
https://github.com/williamSYSU/TextGAN-PyTorch/blob/891635af6845edfee382de147faa4fc00c7e90eb/metrics/clas_acc.py#L16-L22
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/distutils/system_info.py
python
system_info.calc_extra_info
(self)
return info
Updates the information in the current information with respect to these flags: extra_compile_args extra_link_args
Updates the information in the current information with respect to these flags: extra_compile_args extra_link_args
[ "Updates", "the", "information", "in", "the", "current", "information", "with", "respect", "to", "these", "flags", ":", "extra_compile_args", "extra_link_args" ]
def calc_extra_info(self): """ Updates the information in the current information with respect to these flags: extra_compile_args extra_link_args """ info = {} for key in ['extra_compile_args', 'extra_link_args']: # Get values opt = sel...
[ "def", "calc_extra_info", "(", "self", ")", ":", "info", "=", "{", "}", "for", "key", "in", "[", "'extra_compile_args'", ",", "'extra_link_args'", "]", ":", "# Get values", "opt", "=", "self", ".", "cp", ".", "get", "(", "self", ".", "section", ",", "k...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/distutils/system_info.py#L538-L551
fuzzbunch/fuzzbunch
4b60a6c7cf9f84cf389d3fcdb9281de84ffb5802
fuzzbunch/pyreadline/console/console.py
python
Console.rectangle
(self, rect, attr=None, fill=' ')
Fill Rectangle.
Fill Rectangle.
[ "Fill", "Rectangle", "." ]
def rectangle(self, rect, attr=None, fill=' '): '''Fill Rectangle.''' log_sock("rect:%s"%[rect]) x0, y0, x1, y1 = rect n = c_int(0) if attr is None: attr = self.attr for y in range(y0, y1): pos = self.fixcoord(x0, y) self.FillConsoleOut...
[ "def", "rectangle", "(", "self", ",", "rect", ",", "attr", "=", "None", ",", "fill", "=", "' '", ")", ":", "log_sock", "(", "\"rect:%s\"", "%", "[", "rect", "]", ")", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "rect", "n", "=", "c_int", "(", ...
https://github.com/fuzzbunch/fuzzbunch/blob/4b60a6c7cf9f84cf389d3fcdb9281de84ffb5802/fuzzbunch/pyreadline/console/console.py#L436-L446
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/tornado-4.3b2-py3.3-win-amd64.egg/tornado/web.py
python
StaticFileHandler.get_absolute_path
(cls, root, path)
return abspath
Returns the absolute location of ``path`` relative to ``root``. ``root`` is the path configured for this `StaticFileHandler` (in most cases the ``static_path`` `Application` setting). This class method may be overridden in subclasses. By default it returns a filesystem path, but other...
Returns the absolute location of ``path`` relative to ``root``.
[ "Returns", "the", "absolute", "location", "of", "path", "relative", "to", "root", "." ]
def get_absolute_path(cls, root, path): """Returns the absolute location of ``path`` relative to ``root``. ``root`` is the path configured for this `StaticFileHandler` (in most cases the ``static_path`` `Application` setting). This class method may be overridden in subclasses. By defa...
[ "def", "get_absolute_path", "(", "cls", ",", "root", ",", "path", ")", ":", "abspath", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "root", ",", "path", ")", ")", "return", "abspath" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/tornado-4.3b2-py3.3-win-amd64.egg/tornado/web.py#L2395-L2409
zaxlct/imooc-django
daf1ced745d3d21989e8191b658c293a511b37fd
extra_apps/xadmin/plugins/relfield.py
python
ForeignKeySearchWidget.media
(self)
return vendor('select.js', 'select.css', 'xadmin.widget.select.js')
[]
def media(self): return vendor('select.js', 'select.css', 'xadmin.widget.select.js')
[ "def", "media", "(", "self", ")", ":", "return", "vendor", "(", "'select.js'", ",", "'select.css'", ",", "'xadmin.widget.select.js'", ")" ]
https://github.com/zaxlct/imooc-django/blob/daf1ced745d3d21989e8191b658c293a511b37fd/extra_apps/xadmin/plugins/relfield.py#L56-L57
bbfamily/abu
2de85ae57923a720dac99a545b4f856f6b87304b
abupy/ExtBu/joblib/numpy_pickle_utils.py
python
BinaryZlibFile.closed
(self)
return self._mode == _MODE_CLOSED
True if this file is closed.
True if this file is closed.
[ "True", "if", "this", "file", "is", "closed", "." ]
def closed(self): """True if this file is closed.""" return self._mode == _MODE_CLOSED
[ "def", "closed", "(", "self", ")", ":", "return", "self", ".", "_mode", "==", "_MODE_CLOSED" ]
https://github.com/bbfamily/abu/blob/2de85ae57923a720dac99a545b4f856f6b87304b/abupy/ExtBu/joblib/numpy_pickle_utils.py#L340-L342
aneisch/home-assistant-config
86e381fde9609cb8871c439c433c12989e4e225d
custom_components/pfsense/__init__.py
python
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
return unload_ok
Unload a config entry.
Unload a config entry.
[ "Unload", "a", "config", "entry", "." ]
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" platforms = hass.data[DOMAIN][entry.entry_id][LOADED_PLATFORMS] unload_ok = await hass.config_entries.async_unload_platforms(entry, platforms) for listener in hass.data[DOMAIN][entry.entry_id][UN...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "platforms", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "[", "LOADED_PLATFORMS", "]", ...
https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_components/pfsense/__init__.py#L166-L177
mozilla/mozilla-django-oidc
95090b1709fa02d2fe084314e748ca1a8913d141
mozilla_django_oidc/auth.py
python
OIDCAuthenticationBackend.__init__
(self, *args, **kwargs)
Initialize settings.
Initialize settings.
[ "Initialize", "settings", "." ]
def __init__(self, *args, **kwargs): """Initialize settings.""" self.OIDC_OP_TOKEN_ENDPOINT = self.get_settings('OIDC_OP_TOKEN_ENDPOINT') self.OIDC_OP_USER_ENDPOINT = self.get_settings('OIDC_OP_USER_ENDPOINT') self.OIDC_OP_JWKS_ENDPOINT = self.get_settings('OIDC_OP_JWKS_ENDPOINT', None) ...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "OIDC_OP_TOKEN_ENDPOINT", "=", "self", ".", "get_settings", "(", "'OIDC_OP_TOKEN_ENDPOINT'", ")", "self", ".", "OIDC_OP_USER_ENDPOINT", "=", "self", ".", "get_s...
https://github.com/mozilla/mozilla-django-oidc/blob/95090b1709fa02d2fe084314e748ca1a8913d141/mozilla_django_oidc/auth.py#L46-L61
pannous/tensorflow-ocr
52579ae55549429a1631193b2e6218087d0c60de
extensions.py
python
load_binary
(file)
return open(file, 'rb').read()
[]
def load_binary(file): return open(file, 'rb').read()
[ "def", "load_binary", "(", "file", ")", ":", "return", "open", "(", "file", ",", "'rb'", ")", ".", "read", "(", ")" ]
https://github.com/pannous/tensorflow-ocr/blob/52579ae55549429a1631193b2e6218087d0c60de/extensions.py#L1399-L1400
IngoScholtes/pathpy
857f97d1b5a7eec8466775adfed29c28f32f87aa
pathpy/Paths.py
python
Paths.addPathTuple
(self, path, expandSubPaths=True, frequency=(0,1))
Adds a tuple of elements as a path. If the elements are not strings, a conversion to strings will be made. This function can be used to to set custom subpath statistics, via the frequency tuple (see below). @path: The path tuple to be added, e.g. ('a', 'b', 'c') @expandSubPaths: Wheth...
Adds a tuple of elements as a path. If the elements are not strings, a conversion to strings will be made. This function can be used to to set custom subpath statistics, via the frequency tuple (see below).
[ "Adds", "a", "tuple", "of", "elements", "as", "a", "path", ".", "If", "the", "elements", "are", "not", "strings", "a", "conversion", "to", "strings", "will", "be", "made", ".", "This", "function", "can", "be", "used", "to", "to", "set", "custom", "subp...
def addPathTuple(self, path, expandSubPaths=True, frequency=(0,1)): """ Adds a tuple of elements as a path. If the elements are not strings, a conversion to strings will be made. This function can be used to to set custom subpath statistics, via the frequency tuple (see below). ...
[ "def", "addPathTuple", "(", "self", ",", "path", ",", "expandSubPaths", "=", "True", ",", "frequency", "=", "(", "0", ",", "1", ")", ")", ":", "assert", "len", "(", "path", ")", ">", "0", ",", "'Error: paths needs to contain at least one element'", "if", "...
https://github.com/IngoScholtes/pathpy/blob/857f97d1b5a7eec8466775adfed29c28f32f87aa/pathpy/Paths.py#L488-L519
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
lib/spack/external/jinja2/sandbox.py
python
is_internal_attribute
(obj, attr)
return attr.startswith("__")
Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >>> from jinja2.sandbox import is_internal_att...
Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
[ "Test", "if", "the", "attribute", "given", "is", "an", "internal", "python", "attribute", ".", "For", "example", "this", "function", "returns", "True", "for", "the", "func_code", "attribute", "of", "python", "objects", ".", "This", "is", "useful", "if", "the...
def is_internal_attribute(obj, attr): """Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >...
[ "def", "is_internal_attribute", "(", "obj", ",", "attr", ")", ":", "if", "isinstance", "(", "obj", ",", "types", ".", "FunctionType", ")", ":", "if", "attr", "in", "UNSAFE_FUNCTION_ATTRIBUTES", ":", "return", "True", "elif", "isinstance", "(", "obj", ",", ...
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/external/jinja2/sandbox.py#L194-L228
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/ldap3/core/tls.py
python
check_hostname
(sock, server_name, additional_names)
[]
def check_hostname(sock, server_name, additional_names): server_certificate = sock.getpeercert() if log_enabled(NETWORK): log(NETWORK, 'certificate found for %s: %s', sock, server_certificate) if additional_names: host_names = [server_name] + (additional_names if isinstance(additional_names,...
[ "def", "check_hostname", "(", "sock", ",", "server_name", ",", "additional_names", ")", ":", "server_certificate", "=", "sock", ".", "getpeercert", "(", ")", "if", "log_enabled", "(", "NETWORK", ")", ":", "log", "(", "NETWORK", ",", "'certificate found for %s: %...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/ldap3/core/tls.py#L293-L321
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/misc/common.py
python
lena
()
Function that previously returned an example image .. note:: Removed in 0.17 Parameters ---------- None Returns ------- None Raises ------ RuntimeError This functionality has been removed due to licensing reasons. Notes ----- The image previously returned...
Function that previously returned an example image
[ "Function", "that", "previously", "returned", "an", "example", "image" ]
def lena(): """ Function that previously returned an example image .. note:: Removed in 0.17 Parameters ---------- None Returns ------- None Raises ------ RuntimeError This functionality has been removed due to licensing reasons. Notes ----- The i...
[ "def", "lena", "(", ")", ":", "raise", "RuntimeError", "(", "'lena() is no longer included in SciPy, please use '", "'ascent() or face() instead'", ")" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/misc/common.py#L306-L335
Gallopsled/pwntools
1573957cc8b1957399b7cc9bfae0c6f80630d5d4
pwnlib/constants/__init__.py
python
ConstantsModule.eval
(self, string)
return Constant('(%s)' % string, val)
eval(string) -> value Evaluates a string in the context of values of this module. Example: >>> with context.local(arch = 'i386', os = 'linux'): ... print(13 == constants.eval('SYS_execve + PROT_WRITE')) True >>> with context.local(arch = 'amd64', os ...
eval(string) -> value
[ "eval", "(", "string", ")", "-", ">", "value" ]
def eval(self, string): """eval(string) -> value Evaluates a string in the context of values of this module. Example: >>> with context.local(arch = 'i386', os = 'linux'): ... print(13 == constants.eval('SYS_execve + PROT_WRITE')) True >>> wit...
[ "def", "eval", "(", "self", ",", "string", ")", ":", "if", "not", "isinstance", "(", "string", ",", "str", ")", ":", "return", "string", "simple", "=", "getattr", "(", "self", ",", "string", ",", "None", ")", "if", "simple", "is", "not", "None", ":...
https://github.com/Gallopsled/pwntools/blob/1573957cc8b1957399b7cc9bfae0c6f80630d5d4/pwnlib/constants/__init__.py#L119-L154
w3h/isf
6faf0a3df185465ec17369c90ccc16e2a03a1870
lib/thirdparty/kitty/targets/server.py
python
ServerTarget.post_test
(self, test_num)
Called after each test :param test_num: the test number
Called after each test
[ "Called", "after", "each", "test" ]
def post_test(self, test_num): ''' Called after each test :param test_num: the test number ''' super(ServerTarget, self).post_test(test_num) if self.send_failure: self.report.failed('send failure') elif self.expect_response and self.receive_failure: ...
[ "def", "post_test", "(", "self", ",", "test_num", ")", ":", "super", "(", "ServerTarget", ",", "self", ")", ".", "post_test", "(", "test_num", ")", "if", "self", ".", "send_failure", ":", "self", ".", "report", ".", "failed", "(", "'send failure'", ")", ...
https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/kitty/targets/server.py#L122-L132
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/tcl/tkinter/ttk.py
python
Treeview.index
(self, item)
return self.tk.getint(self.tk.call(self._w, "index", item))
Returns the integer index of item within its parent's list of children.
Returns the integer index of item within its parent's list of children.
[ "Returns", "the", "integer", "index", "of", "item", "within", "its", "parent", "s", "list", "of", "children", "." ]
def index(self, item): """Returns the integer index of item within its parent's list of children.""" return self.tk.getint(self.tk.call(self._w, "index", item))
[ "def", "index", "(", "self", ",", "item", ")", ":", "return", "self", ".", "tk", ".", "getint", "(", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "\"index\"", ",", "item", ")", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/tcl/tkinter/ttk.py#L1340-L1343
HazyResearch/fonduer
c9fd6b91998cd708ab95aeee3dfaf47b9e549ffd
src/fonduer/candidates/candidates.py
python
CandidateExtractorUDF.apply
( # type: ignore self, doc: Document, split: int, **kwargs: Any )
return doc
Extract candidates from the given Context. :param doc: A document to process. :param split: Which split to use.
Extract candidates from the given Context.
[ "Extract", "candidates", "from", "the", "given", "Context", "." ]
def apply( # type: ignore self, doc: Document, split: int, **kwargs: Any ) -> Document: """Extract candidates from the given Context. :param doc: A document to process. :param split: Which split to use. """ logger.debug(f"Document: {doc}") # Iterate over eac...
[ "def", "apply", "(", "# type: ignore", "self", ",", "doc", ":", "Document", ",", "split", ":", "int", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Document", ":", "logger", ".", "debug", "(", "f\"Document: {doc}\"", ")", "# Iterate over each candidate cl...
https://github.com/HazyResearch/fonduer/blob/c9fd6b91998cd708ab95aeee3dfaf47b9e549ffd/src/fonduer/candidates/candidates.py#L248-L325
scanny/python-pptx
71d1ca0b2b3b9178d64cdab565e8503a25a54e0b
pptx/oxml/chart/series.py
python
CT_SeriesComposite._new_dPt
(self)
return CT_DPt.new_dPt()
Overrides the metaclass generated method to get `c:dPt` with minimal subtree.
Overrides the metaclass generated method to get `c:dPt` with minimal subtree.
[ "Overrides", "the", "metaclass", "generated", "method", "to", "get", "c", ":", "dPt", "with", "minimal", "subtree", "." ]
def _new_dPt(self): """ Overrides the metaclass generated method to get `c:dPt` with minimal subtree. """ return CT_DPt.new_dPt()
[ "def", "_new_dPt", "(", "self", ")", ":", "return", "CT_DPt", ".", "new_dPt", "(", ")" ]
https://github.com/scanny/python-pptx/blob/71d1ca0b2b3b9178d64cdab565e8503a25a54e0b/pptx/oxml/chart/series.py#L236-L241
simonacca/zatt
ec4748599dd8365d4d808dc9131cc71dd28f9cbf
zatt/server/states.py
python
Leader.send_client_append_response
(self)
Respond to client upon commitment of log entries.
Respond to client upon commitment of log entries.
[ "Respond", "to", "client", "upon", "commitment", "of", "log", "entries", "." ]
def send_client_append_response(self): """Respond to client upon commitment of log entries.""" to_delete = [] for client_index, clients in self.waiting_clients.items(): if client_index <= self.log.commitIndex: for client in clients: client.send({'t...
[ "def", "send_client_append_response", "(", "self", ")", ":", "to_delete", "=", "[", "]", "for", "client_index", ",", "clients", "in", "self", ".", "waiting_clients", ".", "items", "(", ")", ":", "if", "client_index", "<=", "self", ".", "log", ".", "commitI...
https://github.com/simonacca/zatt/blob/ec4748599dd8365d4d808dc9131cc71dd28f9cbf/zatt/server/states.py#L325-L336
leancloud/satori
701caccbd4fe45765001ca60435c0cb499477c03
satori-rules/plugin/libs/requests/packages/urllib3/fields.py
python
RequestField._render_part
(self, name, value)
return format_header_param(name, value)
Overridable helper function to format a single header parameter. :param name: The name of the parameter, a string expected to be ASCII only. :param value: The value of the parameter, provided as a unicode string.
Overridable helper function to format a single header parameter.
[ "Overridable", "helper", "function", "to", "format", "a", "single", "header", "parameter", "." ]
def _render_part(self, name, value): """ Overridable helper function to format a single header parameter. :param name: The name of the parameter, a string expected to be ASCII only. :param value: The value of the parameter, provided as a unicode string. "...
[ "def", "_render_part", "(", "self", ",", "name", ",", "value", ")", ":", "return", "format_header_param", "(", "name", ",", "value", ")" ]
https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/requests/packages/urllib3/fields.py#L105-L114
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/plot/plotcanvas.py
python
PlotCanvas.SetEnableDrag
(self, value)
Set the enableDrag value. .. deprecated:: Feb 27, 2016 Use the :attr:`~wx.lib.plot.plotcanvas.PlotCanvas.enableDrag` property instead.
Set the enableDrag value.
[ "Set", "the", "enableDrag", "value", "." ]
def SetEnableDrag(self, value): """ Set the enableDrag value. .. deprecated:: Feb 27, 2016 Use the :attr:`~wx.lib.plot.plotcanvas.PlotCanvas.enableDrag` property instead. """ pendingDeprecation("self.enableDrag property") self.enableDrag = value
[ "def", "SetEnableDrag", "(", "self", ",", "value", ")", ":", "pendingDeprecation", "(", "\"self.enableDrag property\"", ")", "self", ".", "enableDrag", "=", "value" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/plot/plotcanvas.py#L846-L856
bnpy/bnpy
d5b311e8f58ccd98477f4a0c8a4d4982e3fca424
bnpy/allocmodel/topics/FiniteTopicModel.py
python
L_entropy
(Data=None, LP=None, resp=None, returnVector=0)
return Hvec.sum()
Calculate entropy of soft assignments term in ELBO objective. Returns ------- L_entropy : scalar float
Calculate entropy of soft assignments term in ELBO objective.
[ "Calculate", "entropy", "of", "soft", "assignments", "term", "in", "ELBO", "objective", "." ]
def L_entropy(Data=None, LP=None, resp=None, returnVector=0): """ Calculate entropy of soft assignments term in ELBO objective. Returns ------- L_entropy : scalar float """ spR = None if LP is not None: if 'resp' in LP: resp = LP['resp'] elif 'spR' in LP: ...
[ "def", "L_entropy", "(", "Data", "=", "None", ",", "LP", "=", "None", ",", "resp", "=", "None", ",", "returnVector", "=", "0", ")", ":", "spR", "=", "None", "if", "LP", "is", "not", "None", ":", "if", "'resp'", "in", "LP", ":", "resp", "=", "LP...
https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/allocmodel/topics/FiniteTopicModel.py#L315-L353
OpenMined/PySyft
f181ca02d307d57bfff9477610358df1a12e3ac9
packages/syft/src/syft/ast/klass.py
python
wrap_len
(attrs: Dict[str, Union[str, CallableT, property]])
Add method to access pointer len to `attr[__len__]`. Args: attrs: Dict of `Attribute`s of node. Raises: AttributeError: Base `__len__` is not callable.
Add method to access pointer len to `attr[__len__]`.
[ "Add", "method", "to", "access", "pointer", "len", "to", "attr", "[", "__len__", "]", "." ]
def wrap_len(attrs: Dict[str, Union[str, CallableT, property]]) -> None: """Add method to access pointer len to `attr[__len__]`. Args: attrs: Dict of `Attribute`s of node. Raises: AttributeError: Base `__len__` is not callable. """ def wrap_len(len_func: CallableT) -> CallableT: ...
[ "def", "wrap_len", "(", "attrs", ":", "Dict", "[", "str", ",", "Union", "[", "str", ",", "CallableT", ",", "property", "]", "]", ")", "->", "None", ":", "def", "wrap_len", "(", "len_func", ":", "CallableT", ")", "->", "CallableT", ":", "\"\"\"Add wrapp...
https://github.com/OpenMined/PySyft/blob/f181ca02d307d57bfff9477610358df1a12e3ac9/packages/syft/src/syft/ast/klass.py#L421-L480
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_beego/go/src/runtime/runtime-gdb.py
python
MapTypePrinter.to_string
(self)
return str(self.val.type)
[]
def to_string(self): return str(self.val.type)
[ "def", "to_string", "(", "self", ")", ":", "return", "str", "(", "self", ".", "val", ".", "type", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_beego/go/src/runtime/runtime-gdb.py#L113-L114
geigi/cozy
5006ea7097534e18adf525d1d0ec384ddc000404
cozy/tools.py
python
is_elementary
()
Currently we are only checking for elementaryOS
Currently we are only checking for elementaryOS
[ "Currently", "we", "are", "only", "checking", "for", "elementaryOS" ]
def is_elementary(): """ Currently we are only checking for elementaryOS """ dist = distro.linux_distribution(full_distribution_name=False) log.debug(dist) if '"elementary"' in dist or 'elementary' in dist: return True else: return False
[ "def", "is_elementary", "(", ")", ":", "dist", "=", "distro", ".", "linux_distribution", "(", "full_distribution_name", "=", "False", ")", "log", ".", "debug", "(", "dist", ")", "if", "'\"elementary\"'", "in", "dist", "or", "'elementary'", "in", "dist", ":",...
https://github.com/geigi/cozy/blob/5006ea7097534e18adf525d1d0ec384ddc000404/cozy/tools.py#L34-L43
praw-dev/praw
d1280b132f509ad115f3941fb55f13f979068377
praw/models/reddit/poll.py
python
PollData.__setattr__
(self, attribute: str, value: Any)
Objectify the options attribute, and save user_selection.
Objectify the options attribute, and save user_selection.
[ "Objectify", "the", "options", "attribute", "and", "save", "user_selection", "." ]
def __setattr__(self, attribute: str, value: Any): """Objectify the options attribute, and save user_selection.""" if attribute == "options" and isinstance(value, list): value = [PollOption(self._reddit, option) for option in value] elif attribute == "user_selection": att...
[ "def", "__setattr__", "(", "self", ",", "attribute", ":", "str", ",", "value", ":", "Any", ")", ":", "if", "attribute", "==", "\"options\"", "and", "isinstance", "(", "value", ",", "list", ")", ":", "value", "=", "[", "PollOption", "(", "self", ".", ...
https://github.com/praw-dev/praw/blob/d1280b132f509ad115f3941fb55f13f979068377/praw/models/reddit/poll.py#L86-L92
JBakamovic/cxxd
142c19649b036bd6f6bdcd4684de735ea11a6c94
service.py
python
Service.__init__
(self, service_plugin)
[]
def __init__(self, service_plugin): self.queue = Queue() self.service_plugin = service_plugin self.action = { 0x0 : self.__startup_request, 0x1 : self.__shutdown_request, 0x2 : self.__request } self.started_up = False logging.info("Acti...
[ "def", "__init__", "(", "self", ",", "service_plugin", ")", ":", "self", ".", "queue", "=", "Queue", "(", ")", "self", ".", "service_plugin", "=", "service_plugin", "self", ".", "action", "=", "{", "0x0", ":", "self", ".", "__startup_request", ",", "0x1"...
https://github.com/JBakamovic/cxxd/blob/142c19649b036bd6f6bdcd4684de735ea11a6c94/service.py#L8-L17
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/library/yedit.py
python
Yedit._write
(filename, contents)
Actually write the file contents to disk. This helps with mocking.
Actually write the file contents to disk. This helps with mocking.
[ "Actually", "write", "the", "file", "contents", "to", "disk", ".", "This", "helps", "with", "mocking", "." ]
def _write(filename, contents): ''' Actually write the file contents to disk. This helps with mocking. ''' tmp_filename = filename + '.yedit' with open(tmp_filename, 'w') as yfd: fcntl.flock(yfd, fcntl.LOCK_EX | fcntl.LOCK_NB) yfd.write(contents) fcntl.flock...
[ "def", "_write", "(", "filename", ",", "contents", ")", ":", "tmp_filename", "=", "filename", "+", "'.yedit'", "with", "open", "(", "tmp_filename", ",", "'w'", ")", "as", "yfd", ":", "fcntl", ".", "flock", "(", "yfd", ",", "fcntl", ".", "LOCK_EX", "|",...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/library/yedit.py#L410-L420
Naman-ntc/Pytorch-Human-Pose-Estimation
11525c3d48ed92e0a44ff2f8bcc89c12d37f4360
datasets/COCO/coco.py
python
COCODataset.image_path_from_index
(self, index)
return image_path
example: images / train2017 / 000000119993.jpg
example: images / train2017 / 000000119993.jpg
[ "example", ":", "images", "/", "train2017", "/", "000000119993", ".", "jpg" ]
def image_path_from_index(self, index): """ example: images / train2017 / 000000119993.jpg """ file_name = '%012d.jpg' % index if '2014' in self.image_set: file_name = 'COCO_%s_' % self.image_set + file_name prefix = 'test2017' if 'test' in self.image_set else self.image_set...
[ "def", "image_path_from_index", "(", "self", ",", "index", ")", ":", "file_name", "=", "'%012d.jpg'", "%", "index", "if", "'2014'", "in", "self", ".", "image_set", ":", "file_name", "=", "'COCO_%s_'", "%", "self", ".", "image_set", "+", "file_name", "prefix"...
https://github.com/Naman-ntc/Pytorch-Human-Pose-Estimation/blob/11525c3d48ed92e0a44ff2f8bcc89c12d37f4360/datasets/COCO/coco.py#L215-L228
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/returners/slack_webhook_return.py
python
_sprinkle
(config_str)
return "".join(parts)
Sprinkle with grains of salt, that is convert "test {id} test {host} " types of strings :param config_str: The string to be sprinkled :return: The string sprinkled
Sprinkle with grains of salt, that is convert "test {id} test {host} " types of strings :param config_str: The string to be sprinkled :return: The string sprinkled
[ "Sprinkle", "with", "grains", "of", "salt", "that", "is", "convert", "test", "{", "id", "}", "test", "{", "host", "}", "types", "of", "strings", ":", "param", "config_str", ":", "The", "string", "to", "be", "sprinkled", ":", "return", ":", "The", "stri...
def _sprinkle(config_str): """ Sprinkle with grains of salt, that is convert "test {id} test {host} " types of strings :param config_str: The string to be sprinkled :return: The string sprinkled """ parts = [x for sub in config_str.split("{") for x in sub.split("}")] for i in range(1, l...
[ "def", "_sprinkle", "(", "config_str", ")", ":", "parts", "=", "[", "x", "for", "sub", "in", "config_str", ".", "split", "(", "\"{\"", ")", "for", "x", "in", "sub", ".", "split", "(", "\"}\"", ")", "]", "for", "i", "in", "range", "(", "1", ",", ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/returners/slack_webhook_return.py#L123-L134
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/zoombar.py
python
ZoomBar.OnLeftUp
(self, event)
Handles the ``wx.EVT_LEFT_UP`` event for :class:`ZoomBar`. :param `event`: a :class:`MouseEvent` event to be processed.
Handles the ``wx.EVT_LEFT_UP`` event for :class:`ZoomBar`.
[ "Handles", "the", "wx", ".", "EVT_LEFT_UP", "event", "for", ":", "class", ":", "ZoomBar", "." ]
def OnLeftUp(self, event): """ Handles the ``wx.EVT_LEFT_UP`` event for :class:`ZoomBar`. :param `event`: a :class:`MouseEvent` event to be processed. """ if self.HitTest(event.GetPosition()) != self._currentHit: return if not self.IsButtonEnabled(self._cur...
[ "def", "OnLeftUp", "(", "self", ",", "event", ")", ":", "if", "self", ".", "HitTest", "(", "event", ".", "GetPosition", "(", ")", ")", "!=", "self", ".", "_currentHit", ":", "return", "if", "not", "self", ".", "IsButtonEnabled", "(", "self", ".", "_c...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/zoombar.py#L1302-L1319
MISP/PyMISP
75cb39e0ca2019a961c2642fe2768734971dfa1b
examples/show_sightings.py
python
init
(url, key, verifycert)
return ExpandedPyMISP(url, key, verifycert, 'json')
Template to get MISP module started
Template to get MISP module started
[ "Template", "to", "get", "MISP", "module", "started" ]
def init(url, key, verifycert): ''' Template to get MISP module started ''' return ExpandedPyMISP(url, key, verifycert, 'json')
[ "def", "init", "(", "url", ",", "key", ",", "verifycert", ")", ":", "return", "ExpandedPyMISP", "(", "url", ",", "key", ",", "verifycert", ",", "'json'", ")" ]
https://github.com/MISP/PyMISP/blob/75cb39e0ca2019a961c2642fe2768734971dfa1b/examples/show_sightings.py#L28-L32
vaexio/vaex
6c1571f4f1ac030eb7128c1b35b2ccbb5dd29cac
packages/vaex-core/vaex/dataframe.py
python
DataFrame.add_variable
(self, name, expression, overwrite=True, unique=True)
Add a variable to a DataFrame. A variable may refer to other variables, and virtual columns and expression may refer to variables. Example >>> df.add_variable('center', 0) >>> df.add_virtual_column('x_prime', 'x-center') >>> df.select('x_prime < 0') :param: str name: ...
Add a variable to a DataFrame.
[ "Add", "a", "variable", "to", "a", "DataFrame", "." ]
def add_variable(self, name, expression, overwrite=True, unique=True): """Add a variable to a DataFrame. A variable may refer to other variables, and virtual columns and expression may refer to variables. Example >>> df.add_variable('center', 0) >>> df.add_virtual_column('x_pr...
[ "def", "add_variable", "(", "self", ",", "name", ",", "expression", ",", "overwrite", "=", "True", ",", "unique", "=", "True", ")", ":", "if", "unique", "or", "overwrite", "or", "name", "not", "in", "self", ".", "variables", ":", "existing_names", "=", ...
https://github.com/vaexio/vaex/blob/6c1571f4f1ac030eb7128c1b35b2ccbb5dd29cac/packages/vaex-core/vaex/dataframe.py#L3756-L3776
meduza-corp/interstellar
40a801ccd7856491726f5a126621d9318cabe2e1
gsutil/gslib/commands/setmeta.py
python
SetMetaCommand.RunCommand
(self)
return 0
Command entry point for the setmeta command.
Command entry point for the setmeta command.
[ "Command", "entry", "point", "for", "the", "setmeta", "command", "." ]
def RunCommand(self): """Command entry point for the setmeta command.""" headers = [] if self.sub_opts: for o, a in self.sub_opts: if o == '-n': self.logger.warning( 'Warning: gsutil setmeta -n is now on by default, and will be ' 'removed in the future.\nP...
[ "def", "RunCommand", "(", "self", ")", ":", "headers", "=", "[", "]", "if", "self", ".", "sub_opts", ":", "for", "o", ",", "a", "in", "self", ".", "sub_opts", ":", "if", "o", "==", "'-n'", ":", "self", ".", "logger", ".", "warning", "(", "'Warnin...
https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/gslib/commands/setmeta.py#L153-L203
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/flaskbb/markup.py
python
make_renderer
(classes)
return lambda text: Markup(markup.render(text))
[]
def make_renderer(classes): RenderCls = type('FlaskBBRenderer', tuple(classes), {}) markup = mistune.Markdown(renderer=RenderCls(escape=True, hard_wrap=True)) return lambda text: Markup(markup.render(text))
[ "def", "make_renderer", "(", "classes", ")", ":", "RenderCls", "=", "type", "(", "'FlaskBBRenderer'", ",", "tuple", "(", "classes", ")", ",", "{", "}", ")", "markup", "=", "mistune", ".", "Markdown", "(", "renderer", "=", "RenderCls", "(", "escape", "=",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/flaskbb/markup.py#L89-L93
tomerfiliba/plumbum
20cdda5e8bbd9f83d64b154f6b4fcd28216c63e1
plumbum/colorlib/styles.py
python
Color.to_representation
(self, val)
return other
Converts a color to any representation
Converts a color to any representation
[ "Converts", "a", "color", "to", "any", "representation" ]
def to_representation(self, val): """Converts a color to any representation""" other = copy(self) other.representation = val if self.isreset: return other other.number = None other._init_number() return other
[ "def", "to_representation", "(", "self", ",", "val", ")", ":", "other", "=", "copy", "(", "self", ")", "other", ".", "representation", "=", "val", "if", "self", ".", "isreset", ":", "return", "other", "other", ".", "number", "=", "None", "other", ".", ...
https://github.com/tomerfiliba/plumbum/blob/20cdda5e8bbd9f83d64b154f6b4fcd28216c63e1/plumbum/colorlib/styles.py#L324-L332
zeromq/pyzmq
29aded1bf017385866dcbf7b92a954f272360060
zmq/ssh/tunnel.py
python
try_passwordless_ssh
(server, keyfile, paramiko=None)
return f(server, keyfile)
Attempt to make an ssh connection without a password. This is mainly used for requiring password input only once when many tunnels may be connected to the same server. If paramiko is None, the default for the platform is chosen.
Attempt to make an ssh connection without a password. This is mainly used for requiring password input only once when many tunnels may be connected to the same server.
[ "Attempt", "to", "make", "an", "ssh", "connection", "without", "a", "password", ".", "This", "is", "mainly", "used", "for", "requiring", "password", "input", "only", "once", "when", "many", "tunnels", "may", "be", "connected", "to", "the", "same", "server", ...
def try_passwordless_ssh(server, keyfile, paramiko=None): """Attempt to make an ssh connection without a password. This is mainly used for requiring password input only once when many tunnels may be connected to the same server. If paramiko is None, the default for the platform is chosen. """ i...
[ "def", "try_passwordless_ssh", "(", "server", ",", "keyfile", ",", "paramiko", "=", "None", ")", ":", "if", "paramiko", "is", "None", ":", "paramiko", "=", "sys", ".", "platform", "==", "'win32'", "if", "not", "paramiko", ":", "f", "=", "_try_passwordless_...
https://github.com/zeromq/pyzmq/blob/29aded1bf017385866dcbf7b92a954f272360060/zmq/ssh/tunnel.py#L64-L77
furioussoul/machine-learning
f0a57fd018eef2a23b5d13fef2cfd3d2c71b97f7
deeplearning/hw1.py
python
image2vector
(image)
return v
Argument: image -- a numpy array of shape (length, height, depth) Returns: v -- a vector of shape (length*height*depth, 1)
Argument: image -- a numpy array of shape (length, height, depth)
[ "Argument", ":", "image", "--", "a", "numpy", "array", "of", "shape", "(", "length", "height", "depth", ")" ]
def image2vector(image): """ Argument: image -- a numpy array of shape (length, height, depth) Returns: v -- a vector of shape (length*height*depth, 1) """ ### START CODE HERE ### (≈ 1 line of code) v = None v = image.reshape((image.shape[0] * image.shape[1] * image.shape[2], 1)) ...
[ "def", "image2vector", "(", "image", ")", ":", "### START CODE HERE ### (≈ 1 line of code)", "v", "=", "None", "v", "=", "image", ".", "reshape", "(", "(", "image", ".", "shape", "[", "0", "]", "*", "image", ".", "shape", "[", "1", "]", "*", "image", "...
https://github.com/furioussoul/machine-learning/blob/f0a57fd018eef2a23b5d13fef2cfd3d2c71b97f7/deeplearning/hw1.py#L55-L69
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/io/vasp/outputs.py
python
Waveder.__init__
(self, filename, gamma_only=False)
Args: filename: Name of file containing WAVEDER.
Args: filename: Name of file containing WAVEDER.
[ "Args", ":", "filename", ":", "Name", "of", "file", "containing", "WAVEDER", "." ]
def __init__(self, filename, gamma_only=False): """ Args: filename: Name of file containing WAVEDER. """ with open(filename, "rb") as fp: def readData(dtype): """Read records from Fortran binary file and convert to np.array of give...
[ "def", "__init__", "(", "self", ",", "filename", ",", "gamma_only", "=", "False", ")", ":", "with", "open", "(", "filename", ",", "\"rb\"", ")", "as", "fp", ":", "def", "readData", "(", "dtype", ")", ":", "\"\"\"Read records from Fortran binary file and conver...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/io/vasp/outputs.py#L5514-L5552
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/orm/nodes/data/structure.py
python
StructureData.kinds
(self)
return [Kind(raw=i) for i in raw_kinds]
Returns a list of kinds.
Returns a list of kinds.
[ "Returns", "a", "list", "of", "kinds", "." ]
def kinds(self): """ Returns a list of kinds. """ try: raw_kinds = self.get_attribute('kinds') except AttributeError: raw_kinds = [] return [Kind(raw=i) for i in raw_kinds]
[ "def", "kinds", "(", "self", ")", ":", "try", ":", "raw_kinds", "=", "self", ".", "get_attribute", "(", "'kinds'", ")", "except", "AttributeError", ":", "raw_kinds", "=", "[", "]", "return", "[", "Kind", "(", "raw", "=", "i", ")", "for", "i", "in", ...
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/nodes/data/structure.py#L1526-L1534
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/polynomial/multi_polynomial_element.py
python
MPolynomial_polydict._floordiv_
(self, right)
return Q
r""" Quotient of division of self by other. This is denoted //. .. note:: It's not clear to me that this is well-defined if ``self`` is not exactly divisible by other. EXAMPLES:: sage: R.<x,y>=QQbar[] sage: 2*x*y//y 2*x sa...
r""" Quotient of division of self by other. This is denoted //.
[ "r", "Quotient", "of", "division", "of", "self", "by", "other", ".", "This", "is", "denoted", "//", "." ]
def _floordiv_(self, right): r""" Quotient of division of self by other. This is denoted //. .. note:: It's not clear to me that this is well-defined if ``self`` is not exactly divisible by other. EXAMPLES:: sage: R.<x,y>=QQbar[] sage: 2*...
[ "def", "_floordiv_", "(", "self", ",", "right", ")", ":", "# handle division by monomials without using Singular", "if", "len", "(", "right", ".", "dict", "(", ")", ")", "==", "1", ":", "P", "=", "self", ".", "parent", "(", ")", "ret", "=", "P", "(", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/polynomial/multi_polynomial_element.py#L1585-L1618
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/ext.py
python
build
(base_dir, rebuild=False, debug=False)
return proc.returncode == 0
Build a bokeh extension in the given directory. Arguments: base_dir (str) : The location of the extension. rebuild (bool) : Ignore caches and rebuild from scratch. debug (bool) : Allow for remote debugging. Returns: bool
Build a bokeh extension in the given directory.
[ "Build", "a", "bokeh", "extension", "in", "the", "given", "directory", "." ]
def build(base_dir, rebuild=False, debug=False): """ Build a bokeh extension in the given directory. Arguments: base_dir (str) : The location of the extension. rebuild (bool) : Ignore caches and rebuild from scratch. debug (bool) : Allow for remote debugging. Returns: ...
[ "def", "build", "(", "base_dir", ",", "rebuild", "=", "False", ",", "debug", "=", "False", ")", ":", "args", "=", "[", "]", "if", "rebuild", ":", "args", ".", "append", "(", "\"--rebuild\"", ")", "proc", "=", "_run_command", "(", "\"build\"", ",", "b...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/ext.py#L66-L85
pyqteval/evlal_win
ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92
Clicked_Controller/requests/packages/urllib3/packages/six.py
python
with_metaclass
(meta, base=object)
return meta("NewBase", (base,), {})
Create a base class with a metaclass.
Create a base class with a metaclass.
[ "Create", "a", "base", "class", "with", "a", "metaclass", "." ]
def with_metaclass(meta, base=object): """Create a base class with a metaclass.""" return meta("NewBase", (base,), {})
[ "def", "with_metaclass", "(", "meta", ",", "base", "=", "object", ")", ":", "return", "meta", "(", "\"NewBase\"", ",", "(", "base", ",", ")", ",", "{", "}", ")" ]
https://github.com/pyqteval/evlal_win/blob/ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92/Clicked_Controller/requests/packages/urllib3/packages/six.py#L383-L385
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/datatypes/binary.py
python
Meryldb.sniff
(self, filename)
return False
Try to guess if the file is a Cel file. >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('affy_v_agcc.cel') >>> Meryldb().sniff(fname) False >>> fname = get_test_fname('read-db.meryldb') >>> Meryldb().sniff(fname) True
Try to guess if the file is a Cel file. >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('affy_v_agcc.cel') >>> Meryldb().sniff(fname) False >>> fname = get_test_fname('read-db.meryldb') >>> Meryldb().sniff(fname) True
[ "Try", "to", "guess", "if", "the", "file", "is", "a", "Cel", "file", ".", ">>>", "from", "galaxy", ".", "datatypes", ".", "sniff", "import", "get_test_fname", ">>>", "fname", "=", "get_test_fname", "(", "affy_v_agcc", ".", "cel", ")", ">>>", "Meryldb", "...
def sniff(self, filename): """ Try to guess if the file is a Cel file. >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('affy_v_agcc.cel') >>> Meryldb().sniff(fname) False >>> fname = get_test_fname('read-db.meryldb') >>> Me...
[ "def", "sniff", "(", "self", ",", "filename", ")", ":", "try", ":", "if", "filename", "and", "tarfile", ".", "is_tarfile", "(", "filename", ")", ":", "with", "tarfile", ".", "open", "(", "filename", ",", "'r'", ")", "as", "temptar", ":", "_tar_content"...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/datatypes/binary.py#L219-L240
mit-ll/LL-Fuzzer
7c532a55cfd7dba9445afa39bd25574a320e1a69
nfc/ndef/handover.py
python
Carrier.record
(self)
return self._record
A carrier configuration record. Recognized and further interpreted records are: :class:`HandoverCarrierRecord`, :class:`BluetoothConfigRecord`, :class:`WifiConfigRecord`, :class:`WifiPasswordRecord`.
A carrier configuration record. Recognized and further interpreted records are: :class:`HandoverCarrierRecord`, :class:`BluetoothConfigRecord`, :class:`WifiConfigRecord`, :class:`WifiPasswordRecord`.
[ "A", "carrier", "configuration", "record", ".", "Recognized", "and", "further", "interpreted", "records", "are", ":", ":", "class", ":", "HandoverCarrierRecord", ":", "class", ":", "BluetoothConfigRecord", ":", "class", ":", "WifiConfigRecord", ":", "class", ":", ...
def record(self): """A carrier configuration record. Recognized and further interpreted records are: :class:`HandoverCarrierRecord`, :class:`BluetoothConfigRecord`, :class:`WifiConfigRecord`, :class:`WifiPasswordRecord`.""" return self._record
[ "def", "record", "(", "self", ")", ":", "return", "self", ".", "_record" ]
https://github.com/mit-ll/LL-Fuzzer/blob/7c532a55cfd7dba9445afa39bd25574a320e1a69/nfc/ndef/handover.py#L748-L753
vispy/vispy
26256fdc2574259dd227022fbce0767cae4e244b
vispy/app/canvas.py
python
Canvas.dpi
(self)
return self._dpi
The physical resolution of the canvas in dots per inch.
The physical resolution of the canvas in dots per inch.
[ "The", "physical", "resolution", "of", "the", "canvas", "in", "dots", "per", "inch", "." ]
def dpi(self): """The physical resolution of the canvas in dots per inch.""" return self._dpi
[ "def", "dpi", "(", "self", ")", ":", "return", "self", ".", "_dpi" ]
https://github.com/vispy/vispy/blob/26256fdc2574259dd227022fbce0767cae4e244b/vispy/app/canvas.py#L296-L298
lanl/qmasm
2222dff00753e6c34c44be2dadf4844ec5caa504
src/qmasm/solve.py
python
Sampler.show_properties
(self, verbose)
Output either short or all solver properties.
Output either short or all solver properties.
[ "Output", "either", "short", "or", "all", "solver", "properties", "." ]
def show_properties(self, verbose): "Output either short or all solver properties." if verbose == 0: return # Determine the width of the widest key. props = self.client_info.copy() max_key_len = len("Parameter") prop_keys = sorted(props) for k in prop...
[ "def", "show_properties", "(", "self", ",", "verbose", ")", ":", "if", "verbose", "==", "0", ":", "return", "# Determine the width of the widest key.", "props", "=", "self", ".", "client_info", ".", "copy", "(", ")", "max_key_len", "=", "len", "(", "\"Paramete...
https://github.com/lanl/qmasm/blob/2222dff00753e6c34c44be2dadf4844ec5caa504/src/qmasm/solve.py#L177-L209
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
rpython/translator/simplify.py
python
simplify_exceptions
(graph)
The exception handling caused by non-implicit exceptions starts with an exitswitch on Exception, followed by a lengthy chain of is_/issubtype tests. We collapse them all into the block's single list of exits.
The exception handling caused by non-implicit exceptions starts with an exitswitch on Exception, followed by a lengthy chain of is_/issubtype tests. We collapse them all into the block's single list of exits.
[ "The", "exception", "handling", "caused", "by", "non", "-", "implicit", "exceptions", "starts", "with", "an", "exitswitch", "on", "Exception", "followed", "by", "a", "lengthy", "chain", "of", "is_", "/", "issubtype", "tests", ".", "We", "collapse", "them", "...
def simplify_exceptions(graph): """The exception handling caused by non-implicit exceptions starts with an exitswitch on Exception, followed by a lengthy chain of is_/issubtype tests. We collapse them all into the block's single list of exits. """ renaming = {} for block in graph.iterblocks(...
[ "def", "simplify_exceptions", "(", "graph", ")", ":", "renaming", "=", "{", "}", "for", "block", "in", "graph", ".", "iterblocks", "(", ")", ":", "if", "not", "(", "block", ".", "canraise", "and", "block", ".", "exits", "[", "-", "1", "]", ".", "ex...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/rpython/translator/simplify.py#L110-L170
allegroai/clearml-server
bc2c2ebbfdcc43f56520630eb004278642f27309
apiserver/bll/project/sub_projects.py
python
_ensure_project
(company: str, user: str, name: str)
return project
Makes sure that the project with the given name exists If needed auto-create the project and all the missing projects in the path to it Return the project
Makes sure that the project with the given name exists If needed auto-create the project and all the missing projects in the path to it Return the project
[ "Makes", "sure", "that", "the", "project", "with", "the", "given", "name", "exists", "If", "needed", "auto", "-", "create", "the", "project", "and", "all", "the", "missing", "projects", "in", "the", "path", "to", "it", "Return", "the", "project" ]
def _ensure_project(company: str, user: str, name: str) -> Optional[Project]: """ Makes sure that the project with the given name exists If needed auto-create the project and all the missing projects in the path to it Return the project """ name = name.strip(name_separator) if not name: ...
[ "def", "_ensure_project", "(", "company", ":", "str", ",", "user", ":", "str", ",", "name", ":", "str", ")", "->", "Optional", "[", "Project", "]", ":", "name", "=", "name", ".", "strip", "(", "name_separator", ")", "if", "not", "name", ":", "return"...
https://github.com/allegroai/clearml-server/blob/bc2c2ebbfdcc43f56520630eb004278642f27309/apiserver/bll/project/sub_projects.py#L28-L58