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
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
arcade/sprite.py
python
Sprite._from_radians
(self, new_value: float)
Converts a radian value into degrees and stores it into angle.
Converts a radian value into degrees and stores it into angle.
[ "Converts", "a", "radian", "value", "into", "degrees", "and", "stores", "it", "into", "angle", "." ]
def _from_radians(self, new_value: float): """ Converts a radian value into degrees and stores it into angle. """ self.angle = new_value * 180.0 / math.pi
[ "def", "_from_radians", "(", "self", ",", "new_value", ":", "float", ")", ":", "self", ".", "angle", "=", "new_value", "*", "180.0", "/", "math", ".", "pi" ]
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/sprite.py#L725-L729
scikit-learn/scikit-learn
1d1aadd0711b87d2a11c80aad15df6f8cf156712
sklearn/feature_selection/_base.py
python
SelectorMixin._get_support_mask
(self)
Get the boolean mask indicating which features are selected Returns ------- support : boolean array of shape [# input features] An element is True iff its corresponding feature is selected for retention.
Get the boolean mask indicating which features are selected
[ "Get", "the", "boolean", "mask", "indicating", "which", "features", "are", "selected" ]
def _get_support_mask(self): """ Get the boolean mask indicating which features are selected Returns ------- support : boolean array of shape [# input features] An element is True iff its corresponding feature is selected for retention. """
[ "def", "_get_support_mask", "(", "self", ")", ":" ]
https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/feature_selection/_base.py#L57-L66
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/pdb.py
python
Pdb.do_alias
(self, arg)
alias [name [command [parameter parameter ...] ]] Create an alias called 'name' that executes 'command'. The command must *not* be enclosed in quotes. Replaceable parameters can be indicated by %1, %2, and so on, while %* is replaced by all the parameters. If no command is given, the ...
alias [name [command [parameter parameter ...] ]] Create an alias called 'name' that executes 'command'. The command must *not* be enclosed in quotes. Replaceable parameters can be indicated by %1, %2, and so on, while %* is replaced by all the parameters. If no command is given, the ...
[ "alias", "[", "name", "[", "command", "[", "parameter", "parameter", "...", "]", "]]", "Create", "an", "alias", "called", "name", "that", "executes", "command", ".", "The", "command", "must", "*", "not", "*", "be", "enclosed", "in", "quotes", ".", "Repla...
def do_alias(self, arg): """alias [name [command [parameter parameter ...] ]] Create an alias called 'name' that executes 'command'. The command must *not* be enclosed in quotes. Replaceable parameters can be indicated by %1, %2, and so on, while %* is replaced by all the param...
[ "def", "do_alias", "(", "self", ",", "arg", ")", ":", "args", "=", "arg", ".", "split", "(", ")", "if", "len", "(", "args", ")", "==", "0", ":", "keys", "=", "sorted", "(", "self", ".", "aliases", ".", "keys", "(", ")", ")", "for", "alias", "...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/pdb.py#L1374-L1407
ansible-collections/community.general
3faffe8f47968a2400ba3c896c8901c03001a194
plugins/modules/ejabberd_user.py
python
EjabberdUser.run_command
(self, cmd, options)
return self.module.run_command(cmd)
This method will run the any command specified and return the returns using the Ansible common module
This method will run the any command specified and return the returns using the Ansible common module
[ "This", "method", "will", "run", "the", "any", "command", "specified", "and", "return", "the", "returns", "using", "the", "Ansible", "common", "module" ]
def run_command(self, cmd, options): """ This method will run the any command specified and return the returns using the Ansible common module """ cmd = [self.module.get_bin_path('ejabberdctl'), cmd] + options self.log('command: %s' % " ".join(cmd)) return self.module.run...
[ "def", "run_command", "(", "self", ",", "cmd", ",", "options", ")", ":", "cmd", "=", "[", "self", ".", "module", ".", "get_bin_path", "(", "'ejabberdctl'", ")", ",", "cmd", "]", "+", "options", "self", ".", "log", "(", "'command: %s'", "%", "\" \"", ...
https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/modules/ejabberd_user.py#L113-L119
NeuralEnsemble/python-neo
34d4db8fb0dc950dbbc6defd7fb75e99ea877286
neo/rawio/baserawio.py
python
BaseRawIO.channel_name_to_index
(self, stream_index, channel_names)
return channel_indexes
Inside a stream, transform channel_names to channel_indexes. Based on self.header['signal_channels'] channel_indexes are zero-based offsets within the stream
Inside a stream, transform channel_names to channel_indexes. Based on self.header['signal_channels'] channel_indexes are zero-based offsets within the stream
[ "Inside", "a", "stream", "transform", "channel_names", "to", "channel_indexes", ".", "Based", "on", "self", ".", "header", "[", "signal_channels", "]", "channel_indexes", "are", "zero", "-", "based", "offsets", "within", "the", "stream" ]
def channel_name_to_index(self, stream_index, channel_names): """ Inside a stream, transform channel_names to channel_indexes. Based on self.header['signal_channels'] channel_indexes are zero-based offsets within the stream """ stream_id = self.header['signal_streams'][st...
[ "def", "channel_name_to_index", "(", "self", ",", "stream_index", ",", "channel_names", ")", ":", "stream_id", "=", "self", ".", "header", "[", "'signal_streams'", "]", "[", "stream_index", "]", "[", "'id'", "]", "mask", "=", "self", ".", "header", "[", "'...
https://github.com/NeuralEnsemble/python-neo/blob/34d4db8fb0dc950dbbc6defd7fb75e99ea877286/neo/rawio/baserawio.py#L455-L467
ycszen/TorchSeg
62eeb159aee77972048d9d7688a28249d3c56735
model/bisenet/cityscapes.bisenet.X39/network.py
python
BiSeNetHead.__init__
(self, in_planes, out_planes, scale, is_aux=False, norm_layer=nn.BatchNorm2d)
[]
def __init__(self, in_planes, out_planes, scale, is_aux=False, norm_layer=nn.BatchNorm2d): super(BiSeNetHead, self).__init__() if is_aux: self.conv_3x3 = ConvBnRelu(in_planes, 128, 3, 1, 1, has_bn=True, norm_layer=norm_layer, ...
[ "def", "__init__", "(", "self", ",", "in_planes", ",", "out_planes", ",", "scale", ",", "is_aux", "=", "False", ",", "norm_layer", "=", "nn", ".", "BatchNorm2d", ")", ":", "super", "(", "BiSeNetHead", ",", "self", ")", ".", "__init__", "(", ")", "if", ...
https://github.com/ycszen/TorchSeg/blob/62eeb159aee77972048d9d7688a28249d3c56735/model/bisenet/cityscapes.bisenet.X39/network.py#L139-L157
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/clusterfuzz/_internal/protos/untrusted_runner_pb2_grpc.py
python
UntrustedRunnerServicer.RunAndWait
(self, request, context)
Run command using new_process.ProcessRunner
Run command using new_process.ProcessRunner
[ "Run", "command", "using", "new_process", ".", "ProcessRunner" ]
def RunAndWait(self, request, context): """Run command using new_process.ProcessRunner """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
[ "def", "RunAndWait", "(", "self", ",", "request", ",", "context", ")", ":", "context", ".", "set_code", "(", "grpc", ".", "StatusCode", ".", "UNIMPLEMENTED", ")", "context", ".", "set_details", "(", "'Method not implemented!'", ")", "raise", "NotImplementedError...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/protos/untrusted_runner_pb2_grpc.py#L159-L164
pyparsing/pyparsing
1ccf846394a055924b810faaf9628dac53633848
pyparsing/core.py
python
ParserElement.split
( self, instring: str, maxsplit: int = _MAX_INT, include_separators: bool = False, *, includeSeparators=False, )
Generator method to split a string using the given expression as a separator. May be called with optional ``maxsplit`` argument, to limit the number of splits; and the optional ``include_separators`` argument (default= ``False``), if the separating matching text should be included in the split r...
Generator method to split a string using the given expression as a separator. May be called with optional ``maxsplit`` argument, to limit the number of splits; and the optional ``include_separators`` argument (default= ``False``), if the separating matching text should be included in the split r...
[ "Generator", "method", "to", "split", "a", "string", "using", "the", "given", "expression", "as", "a", "separator", ".", "May", "be", "called", "with", "optional", "maxsplit", "argument", "to", "limit", "the", "number", "of", "splits", ";", "and", "the", "...
def split( self, instring: str, maxsplit: int = _MAX_INT, include_separators: bool = False, *, includeSeparators=False, ) -> Generator[str, None, None]: """ Generator method to split a string using the given expression as a separator. May be ca...
[ "def", "split", "(", "self", ",", "instring", ":", "str", ",", "maxsplit", ":", "int", "=", "_MAX_INT", ",", "include_separators", ":", "bool", "=", "False", ",", "*", ",", "includeSeparators", "=", "False", ",", ")", "->", "Generator", "[", "str", ","...
https://github.com/pyparsing/pyparsing/blob/1ccf846394a055924b810faaf9628dac53633848/pyparsing/core.py#L1313-L1343
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/cpython/randomimpl.py
python
poisson_impl
(context, builder, sig, args)
return impl_ret_untracked(context, builder, sig.return_type, res)
[]
def poisson_impl(context, builder, sig, args): state_ptr = get_np_state_ptr(context, builder) retptr = cgutils.alloca_once(builder, int64_t, name="ret") bbcont = builder.append_basic_block("bbcont") bbend = builder.append_basic_block("bbend") if len(args) == 1: lam, = args big_lam ...
[ "def", "poisson_impl", "(", "context", ",", "builder", ",", "sig", ",", "args", ")", ":", "state_ptr", "=", "get_np_state_ptr", "(", "context", ",", "builder", ")", "retptr", "=", "cgutils", ".", "alloca_once", "(", "builder", ",", "int64_t", ",", "name", ...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cpython/randomimpl.py#L1048-L1105
stacked-git/stgit
8254ffb2eee53f97e9c6210078db55c15340ead3
stgit/out.py
python
MessagePrinter.start
(self, msg)
Start a long-running operation.
Start a long-running operation.
[ "Start", "a", "long", "-", "running", "operation", "." ]
def start(self, msg): """Start a long-running operation.""" self._stderr.single_line('%s ... ' % msg, print_newline=False) self._stderr.level += 1
[ "def", "start", "(", "self", ",", "msg", ")", ":", "self", ".", "_stderr", ".", "single_line", "(", "'%s ... '", "%", "msg", ",", "print_newline", "=", "False", ")", "self", ".", "_stderr", ".", "level", "+=", "1" ]
https://github.com/stacked-git/stgit/blob/8254ffb2eee53f97e9c6210078db55c15340ead3/stgit/out.py#L116-L119
getavalon/core
31e8cb4760e00e3db64443f6f932b7fd8e96d41d
avalon/vendor/requests/sessions.py
python
Session.close
(self)
Closes all adapters and as such the session
Closes all adapters and as such the session
[ "Closes", "all", "adapters", "and", "as", "such", "the", "session" ]
def close(self): """Closes all adapters and as such the session""" for v in self.adapters.values(): v.close()
[ "def", "close", "(", "self", ")", ":", "for", "v", "in", "self", ".", "adapters", ".", "values", "(", ")", ":", "v", ".", "close", "(", ")" ]
https://github.com/getavalon/core/blob/31e8cb4760e00e3db64443f6f932b7fd8e96d41d/avalon/vendor/requests/sessions.py#L719-L722
21dotco/two1-python
4e833300fd5a58363e3104ed4c097631e5d296d3
two1/bitserv/payment_server.py
python
PaymentServer.close
(self, deposit_txid, deposit_txid_signature)
return str(payment_tx.hash)
Close a payment channel. Args: deposit_txid (string): string representation of the deposit transaction hash. This is used to look up the payment channel. deposit_txid_signature (two1.bitcoin.Signature): a signature consisting solely of the deposit_txid to...
Close a payment channel.
[ "Close", "a", "payment", "channel", "." ]
def close(self, deposit_txid, deposit_txid_signature): """Close a payment channel. Args: deposit_txid (string): string representation of the deposit transaction hash. This is used to look up the payment channel. deposit_txid_signature (two1.bitcoin.Signature): a ...
[ "def", "close", "(", "self", ",", "deposit_txid", ",", "deposit_txid_signature", ")", ":", "channel", "=", "self", ".", "_db", ".", "pc", ".", "lookup", "(", "deposit_txid", ")", "# Verify that the requested channel exists", "if", "not", "channel", ":", "raise",...
https://github.com/21dotco/two1-python/blob/4e833300fd5a58363e3104ed4c097631e5d296d3/two1/bitserv/payment_server.py#L340-L384
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
source/openerp/report/render/rml2txt/rml2txt.py
python
textbox.renderlines
(self,pad=0)
return result
Returns a list of lines, from the current object pad: all lines must be at least pad characters.
Returns a list of lines, from the current object pad: all lines must be at least pad characters.
[ "Returns", "a", "list", "of", "lines", "from", "the", "current", "object", "pad", ":", "all", "lines", "must", "be", "at", "least", "pad", "characters", "." ]
def renderlines(self,pad=0): """Returns a list of lines, from the current object pad: all lines must be at least pad characters. """ result = [] lineoff = "" for i in range(self.posx): lineoff+=" " for l in self.lines: lpad = "" ...
[ "def", "renderlines", "(", "self", ",", "pad", "=", "0", ")", ":", "result", "=", "[", "]", "lineoff", "=", "\"\"", "for", "i", "in", "range", "(", "self", ".", "posx", ")", ":", "lineoff", "+=", "\" \"", "for", "l", "in", "self", ".", "lines", ...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/openerp/report/render/rml2txt/rml2txt.py#L90-L105
maartenbreddels/ipyvolume
71eded3085ed5f00a961c90db8b84fde13a6dee3
setup.py
python
skip_if_exists
(paths, CommandClass)
return SkipIfExistCommand
Skip a command if list of paths exists.
Skip a command if list of paths exists.
[ "Skip", "a", "command", "if", "list", "of", "paths", "exists", "." ]
def skip_if_exists(paths, CommandClass): """Skip a command if list of paths exists.""" def should_skip(): return any(not Path(path).exist() for path in paths) class SkipIfExistCommand(Command): def initialize_options(self): if not should_skip: self.command = Comma...
[ "def", "skip_if_exists", "(", "paths", ",", "CommandClass", ")", ":", "def", "should_skip", "(", ")", ":", "return", "any", "(", "not", "Path", "(", "path", ")", ".", "exist", "(", ")", "for", "path", "in", "paths", ")", "class", "SkipIfExistCommand", ...
https://github.com/maartenbreddels/ipyvolume/blob/71eded3085ed5f00a961c90db8b84fde13a6dee3/setup.py#L20-L40
openyou/emokit
7f25321a1c3a240f5b64a1572e5f106807b1beea
python/key_solver.py
python
counter_check
(file_data, cipher, swap_data=False)
[]
def counter_check(file_data, cipher, swap_data=False): counter_misses = 0 counter_checks = 0 last_counter = 0 lines = 258 i = 0 for line in file_data: i += 1 if i > lines: continue data = line.split(',')[1:] data = [int(value, 2) for value in data] ...
[ "def", "counter_check", "(", "file_data", ",", "cipher", ",", "swap_data", "=", "False", ")", ":", "counter_misses", "=", "0", "counter_checks", "=", "0", "last_counter", "=", "0", "lines", "=", "258", "i", "=", "0", "for", "line", "in", "file_data", ":"...
https://github.com/openyou/emokit/blob/7f25321a1c3a240f5b64a1572e5f106807b1beea/python/key_solver.py#L154-L188
Blosc/bloscpack
5efdadf5b6f61e995df1817943afb9629ce28c89
bloscpack/numpy_io.py
python
unpack_ndarray
(source)
return sink.ndarray
Deserialize a Numpy array. Parameters ---------- source : CompressedSource the source containing the serialized Numpy array Returns ------- ndarray : ndarray the Numpy array Raises ------ NotANumpyArray if the source doesn't seem to contain a Numpy array
Deserialize a Numpy array.
[ "Deserialize", "a", "Numpy", "array", "." ]
def unpack_ndarray(source): """ Deserialize a Numpy array. Parameters ---------- source : CompressedSource the source containing the serialized Numpy array Returns ------- ndarray : ndarray the Numpy array Raises ------ NotANumpyArray if the source does...
[ "def", "unpack_ndarray", "(", "source", ")", ":", "sink", "=", "PlainNumpySink", "(", "source", ".", "metadata", ")", "unpack", "(", "source", ",", "sink", ")", "return", "sink", ".", "ndarray" ]
https://github.com/Blosc/bloscpack/blob/5efdadf5b6f61e995df1817943afb9629ce28c89/bloscpack/numpy_io.py#L286-L307
django/djangosnippets.org
0b273ce13135e157267009631d460835387d9975
cab/views/popular.py
python
top_authors
(request)
return object_list( request, queryset=Snippet.objects.top_authors(), template_name="cab/top_authors.html", paginate_by=20 )
[]
def top_authors(request): return object_list( request, queryset=Snippet.objects.top_authors(), template_name="cab/top_authors.html", paginate_by=20 )
[ "def", "top_authors", "(", "request", ")", ":", "return", "object_list", "(", "request", ",", "queryset", "=", "Snippet", ".", "objects", ".", "top_authors", "(", ")", ",", "template_name", "=", "\"cab/top_authors.html\"", ",", "paginate_by", "=", "20", ")" ]
https://github.com/django/djangosnippets.org/blob/0b273ce13135e157267009631d460835387d9975/cab/views/popular.py#L5-L8
google-research/bert
eedf5716ce1268e56f0a50264a88cafad334ac61
tokenization.py
python
convert_to_unicode
(text)
Converts `text` to Unicode (if it's not already), assuming utf-8 input.
Converts `text` to Unicode (if it's not already), assuming utf-8 input.
[ "Converts", "text", "to", "Unicode", "(", "if", "it", "s", "not", "already", ")", "assuming", "utf", "-", "8", "input", "." ]
def convert_to_unicode(text): """Converts `text` to Unicode (if it's not already), assuming utf-8 input.""" if six.PY3: if isinstance(text, str): return text elif isinstance(text, bytes): return text.decode("utf-8", "ignore") else: raise ValueError("Unsupported string type: %s" % (type...
[ "def", "convert_to_unicode", "(", "text", ")", ":", "if", "six", ".", "PY3", ":", "if", "isinstance", "(", "text", ",", "str", ")", ":", "return", "text", "elif", "isinstance", "(", "text", ",", "bytes", ")", ":", "return", "text", ".", "decode", "("...
https://github.com/google-research/bert/blob/eedf5716ce1268e56f0a50264a88cafad334ac61/tokenization.py#L78-L95
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail_bak/contrib/modeladmin/menus.py
python
SubMenu.__init__
(self, menuitem_list)
[]
def __init__(self, menuitem_list): self._registered_menu_items = menuitem_list self.construct_hook_name = None
[ "def", "__init__", "(", "self", ",", "menuitem_list", ")", ":", "self", ".", "_registered_menu_items", "=", "menuitem_list", "self", ".", "construct_hook_name", "=", "None" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/contrib/modeladmin/menus.py#L52-L54
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/redis/client.py
python
StrictRedis.zrange
(self, name, start, end, desc=False, withscores=False, score_cast_func=float)
return self.execute_command(*pieces, **options)
Return a range of values from sorted set ``name`` between ``start`` and ``end`` sorted in ascending order. ``start`` and ``end`` can be negative, indicating the end of the range. ``desc`` a boolean indicating whether to sort the results descendingly ``withscores`` indicates to return ...
Return a range of values from sorted set ``name`` between ``start`` and ``end`` sorted in ascending order.
[ "Return", "a", "range", "of", "values", "from", "sorted", "set", "name", "between", "start", "and", "end", "sorted", "in", "ascending", "order", "." ]
def zrange(self, name, start, end, desc=False, withscores=False, score_cast_func=float): """ Return a range of values from sorted set ``name`` between ``start`` and ``end`` sorted in ascending order. ``start`` and ``end`` can be negative, indicating the end of the range. ...
[ "def", "zrange", "(", "self", ",", "name", ",", "start", ",", "end", ",", "desc", "=", "False", ",", "withscores", "=", "False", ",", "score_cast_func", "=", "float", ")", ":", "if", "desc", ":", "return", "self", ".", "zrevrange", "(", "name", ",", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/redis/client.py#L1729-L1754
Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks
40c985b9a9ff1189ddf278462440b120cf96b196
libs/scapy/contrib/bgp.py
python
has_extended_length
(flags)
return flags & _BGP_PA_EXTENDED_LENGTH == _BGP_PA_EXTENDED_LENGTH
Used in BGPPathAttr to check if the extended-length flag is set.
Used in BGPPathAttr to check if the extended-length flag is set.
[ "Used", "in", "BGPPathAttr", "to", "check", "if", "the", "extended", "-", "length", "flag", "is", "set", "." ]
def has_extended_length(flags): """ Used in BGPPathAttr to check if the extended-length flag is set. """ return flags & _BGP_PA_EXTENDED_LENGTH == _BGP_PA_EXTENDED_LENGTH
[ "def", "has_extended_length", "(", "flags", ")", ":", "return", "flags", "&", "_BGP_PA_EXTENDED_LENGTH", "==", "_BGP_PA_EXTENDED_LENGTH" ]
https://github.com/Matheus-Garbelini/sweyntooth_bluetooth_low_energy_attacks/blob/40c985b9a9ff1189ddf278462440b120cf96b196/libs/scapy/contrib/bgp.py#L193-L199
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
arcade/examples/sprite_bouncing_coins.py
python
MyGame.on_draw
(self)
Render the screen.
Render the screen.
[ "Render", "the", "screen", "." ]
def on_draw(self): """ Render the screen. """ # This command has to happen before we start drawing arcade.start_render() # Draw all the sprites. self.wall_list.draw() self.coin_list.draw()
[ "def", "on_draw", "(", "self", ")", ":", "# This command has to happen before we start drawing", "arcade", ".", "start_render", "(", ")", "# Draw all the sprites.", "self", ".", "wall_list", ".", "draw", "(", ")", "self", ".", "coin_list", ".", "draw", "(", ")" ]
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/examples/sprite_bouncing_coins.py#L98-L108
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/base.py
python
_bind_or_error
(schemaitem, msg=None)
return bind
[]
def _bind_or_error(schemaitem, msg=None): bind = schemaitem.bind if not bind: name = schemaitem.__class__.__name__ label = getattr(schemaitem, 'fullname', getattr(schemaitem, 'name', None)) if label: item = '%s object %r' % (name, label) else: ...
[ "def", "_bind_or_error", "(", "schemaitem", ",", "msg", "=", "None", ")", ":", "bind", "=", "schemaitem", ".", "bind", "if", "not", "bind", ":", "name", "=", "schemaitem", ".", "__class__", ".", "__name__", "label", "=", "getattr", "(", "schemaitem", ","...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/base.py#L622-L637
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/difflib.py
python
HtmlDiff._line_wrapper
(self,diffs)
Returns iterator that splits (wraps) mdiff text lines
Returns iterator that splits (wraps) mdiff text lines
[ "Returns", "iterator", "that", "splits", "(", "wraps", ")", "mdiff", "text", "lines" ]
def _line_wrapper(self,diffs): """Returns iterator that splits (wraps) mdiff text lines""" # pull from/to data and flags from mdiff iterator for fromdata,todata,flag in diffs: # check for context separators and pass them through if flag is None: yield fro...
[ "def", "_line_wrapper", "(", "self", ",", "diffs", ")", ":", "# pull from/to data and flags from mdiff iterator", "for", "fromdata", ",", "todata", ",", "flag", "in", "diffs", ":", "# check for context separators and pass them through", "if", "flag", "is", "None", ":", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/difflib.py#L1851-L1877
RasaHQ/rasa
54823b68c1297849ba7ae841a4246193cd1223a1
rasa/shared/core/training_data/story_writer/story_writer.py
python
StoryWriter.dump
( target: Union[Text, Path, yaml.StringIO], story_steps: List["StoryStep"], is_appendable: bool = False, is_test_story: bool = False, )
Writes Story steps into a target file/stream. Args: target: name of the target file/stream to write the string to. story_steps: Original story steps to be converted to the string. is_appendable: Specify if result should not contain high level keys/...
Writes Story steps into a target file/stream.
[ "Writes", "Story", "steps", "into", "a", "target", "file", "/", "stream", "." ]
def dump( target: Union[Text, Path, yaml.StringIO], story_steps: List["StoryStep"], is_appendable: bool = False, is_test_story: bool = False, ) -> None: """Writes Story steps into a target file/stream. Args: target: name of the target file/stream to write...
[ "def", "dump", "(", "target", ":", "Union", "[", "Text", ",", "Path", ",", "yaml", ".", "StringIO", "]", ",", "story_steps", ":", "List", "[", "\"StoryStep\"", "]", ",", "is_appendable", ":", "bool", "=", "False", ",", "is_test_story", ":", "bool", "="...
https://github.com/RasaHQ/rasa/blob/54823b68c1297849ba7ae841a4246193cd1223a1/rasa/shared/core/training_data/story_writer/story_writer.py#L34-L51
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v8/services/services/detail_placement_view_service/client.py
python
DetailPlacementViewServiceClient.parse_common_billing_account_path
(path: str)
return m.groupdict() if m else {}
Parse a billing_account path into its component segments.
Parse a billing_account path into its component segments.
[ "Parse", "a", "billing_account", "path", "into", "its", "component", "segments", "." ]
def parse_common_billing_account_path(path: str) -> Dict[str, str]: """Parse a billing_account path into its component segments.""" m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path) return m.groupdict() if m else {}
[ "def", "parse_common_billing_account_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^billingAccounts/(?P<billing_account>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdict", ...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/detail_placement_view_service/client.py#L191-L194
CERT-Polska/mquery
517598112e56f7b716ed0ed52b30b328df42affd
src/db.py
python
MatchInfo.to_json
(self)
return json.dumps( {"file": self.file, "meta": self.meta, "matches": self.matches} )
Converts match info to json
Converts match info to json
[ "Converts", "match", "info", "to", "json" ]
def to_json(self) -> str: """ Converts match info to json """ return json.dumps( {"file": self.file, "meta": self.meta, "matches": self.matches} )
[ "def", "to_json", "(", "self", ")", "->", "str", ":", "return", "json", ".", "dumps", "(", "{", "\"file\"", ":", "self", ".", "file", ",", "\"meta\"", ":", "self", ".", "meta", ",", "\"matches\"", ":", "self", ".", "matches", "}", ")" ]
https://github.com/CERT-Polska/mquery/blob/517598112e56f7b716ed0ed52b30b328df42affd/src/db.py#L58-L62
Epistimio/orion
732e739d99561020dbe620760acf062ade746006
src/orion/client/experiment.py
python
ExperimentClient.metadata
(self)
return self._experiment.metadata
Metadata of the experiment.
Metadata of the experiment.
[ "Metadata", "of", "the", "experiment", "." ]
def metadata(self): """Metadata of the experiment.""" return self._experiment.metadata
[ "def", "metadata", "(", "self", ")", ":", "return", "self", ".", "_experiment", ".", "metadata" ]
https://github.com/Epistimio/orion/blob/732e739d99561020dbe620760acf062ade746006/src/orion/client/experiment.py#L146-L148
nerdvegas/rez
d392c65bf63b4bca8106f938cec49144ba54e770
src/rez/vendor/pika/adapters/base_connection.py
python
BaseConnection._adapter_emit_data
(self, data)
Take ownership of data and send it to AMQP server as soon as possible. :param bytes data:
Take ownership of data and send it to AMQP server as soon as possible.
[ "Take", "ownership", "of", "data", "and", "send", "it", "to", "AMQP", "server", "as", "soon", "as", "possible", "." ]
def _adapter_emit_data(self, data): """Take ownership of data and send it to AMQP server as soon as possible. :param bytes data: """ self._transport.write(data)
[ "def", "_adapter_emit_data", "(", "self", ",", "data", ")", ":", "self", ".", "_transport", ".", "write", "(", "data", ")" ]
https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/vendor/pika/adapters/base_connection.py#L377-L384
biopython/biopython
2dd97e71762af7b046d7f7f8a4f1e38db6b06c86
Bio/SearchIO/ExonerateIO/_base.py
python
_get_fragments_phase
(frags)
return [(3 - (x % 3)) % 3 for x in _get_fragments_coord(frags)]
Return the phases of the given list of 3-letter amino acid fragments (PRIVATE). This is an internal private function and is meant for parsing Exonerate's three-letter amino acid output. >>> from Bio.SearchIO.ExonerateIO._base import _get_fragments_phase >>> _get_fragments_phase(['Thr', 'Ser', 'Ala']) ...
Return the phases of the given list of 3-letter amino acid fragments (PRIVATE).
[ "Return", "the", "phases", "of", "the", "given", "list", "of", "3", "-", "letter", "amino", "acid", "fragments", "(", "PRIVATE", ")", "." ]
def _get_fragments_phase(frags): """Return the phases of the given list of 3-letter amino acid fragments (PRIVATE). This is an internal private function and is meant for parsing Exonerate's three-letter amino acid output. >>> from Bio.SearchIO.ExonerateIO._base import _get_fragments_phase >>> _get...
[ "def", "_get_fragments_phase", "(", "frags", ")", ":", "return", "[", "(", "3", "-", "(", "x", "%", "3", ")", ")", "%", "3", "for", "x", "in", "_get_fragments_coord", "(", "frags", ")", "]" ]
https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/SearchIO/ExonerateIO/_base.py#L85-L104
yaqwsx/PcbDraw
09720d46f3fdb8b01c2b0e2eca39d964552e94a0
versioneer.py
python
get_versions
(verbose=False)
return {"version": "0+unknown", "full-revisionid": None, "dirty": None, "error": "unable to compute version", "date": None}
Get the project version from whatever source is available. Returns dict with two keys: 'version' and 'full'.
Get the project version from whatever source is available.
[ "Get", "the", "project", "version", "from", "whatever", "source", "is", "available", "." ]
def get_versions(verbose=False): """Get the project version from whatever source is available. Returns dict with two keys: 'version' and 'full'. """ if "versioneer" in sys.modules: # see the discussion in cmdclass.py:get_cmdclass() del sys.modules["versioneer"] root = get_root() ...
[ "def", "get_versions", "(", "verbose", "=", "False", ")", ":", "if", "\"versioneer\"", "in", "sys", ".", "modules", ":", "# see the discussion in cmdclass.py:get_cmdclass()", "del", "sys", ".", "modules", "[", "\"versioneer\"", "]", "root", "=", "get_root", "(", ...
https://github.com/yaqwsx/PcbDraw/blob/09720d46f3fdb8b01c2b0e2eca39d964552e94a0/versioneer.py#L1402-L1475
VainF/pytorch-msssim
6ceec02d64447216881423dd7428b68a2ad0905f
pytorch_msssim/ssim.py
python
MS_SSIM.__init__
( self, data_range=255, size_average=True, win_size=11, win_sigma=1.5, channel=3, spatial_dims=2, weights=None, K=(0.01, 0.03), )
r""" class for ms-ssim Args: data_range (float or int, optional): value range of input images. (usually 1.0 or 255) size_average (bool, optional): if size_average=True, ssim of all images will be averaged as a scalar win_size: (int, optional): the size of gauss kernel ...
r""" class for ms-ssim Args: data_range (float or int, optional): value range of input images. (usually 1.0 or 255) size_average (bool, optional): if size_average=True, ssim of all images will be averaged as a scalar win_size: (int, optional): the size of gauss kernel ...
[ "r", "class", "for", "ms", "-", "ssim", "Args", ":", "data_range", "(", "float", "or", "int", "optional", ")", ":", "value", "range", "of", "input", "images", ".", "(", "usually", "1", ".", "0", "or", "255", ")", "size_average", "(", "bool", "optiona...
def __init__( self, data_range=255, size_average=True, win_size=11, win_sigma=1.5, channel=3, spatial_dims=2, weights=None, K=(0.01, 0.03), ): r""" class for ms-ssim Args: data_range (float or int, optional): value r...
[ "def", "__init__", "(", "self", ",", "data_range", "=", "255", ",", "size_average", "=", "True", ",", "win_size", "=", "11", ",", "win_sigma", "=", "1.5", ",", "channel", "=", "3", ",", "spatial_dims", "=", "2", ",", "weights", "=", "None", ",", "K",...
https://github.com/VainF/pytorch-msssim/blob/6ceec02d64447216881423dd7428b68a2ad0905f/pytorch_msssim/ssim.py#L277-L305
django-oscar/django-oscar
ffcc530844d40283b6b1552778a140536b904f5f
src/oscar/templatetags/shipping_tags.py
python
shipping_charge_discount
(method, basket)
return method.discount(basket)
Template tag for calculating the shipping discount for a given shipping method and basket, and injecting it into the template context.
Template tag for calculating the shipping discount for a given shipping method and basket, and injecting it into the template context.
[ "Template", "tag", "for", "calculating", "the", "shipping", "discount", "for", "a", "given", "shipping", "method", "and", "basket", "and", "injecting", "it", "into", "the", "template", "context", "." ]
def shipping_charge_discount(method, basket): """ Template tag for calculating the shipping discount for a given shipping method and basket, and injecting it into the template context. """ return method.discount(basket)
[ "def", "shipping_charge_discount", "(", "method", ",", "basket", ")", ":", "return", "method", ".", "discount", "(", "basket", ")" ]
https://github.com/django-oscar/django-oscar/blob/ffcc530844d40283b6b1552778a140536b904f5f/src/oscar/templatetags/shipping_tags.py#L16-L21
arizvisa/ida-minsc
8627a60f047b5e55d3efeecde332039cd1a16eea
base/instruction.py
python
op_structure
(ea, opnum, sptr, *path, **force)
return op_structure(insn.ea, opnum)
Apply the structure identified by `sptr` along with the members in `path` to the instruction operand `opnum` at the address `ea`.
Apply the structure identified by `sptr` along with the members in `path` to the instruction operand `opnum` at the address `ea`.
[ "Apply", "the", "structure", "identified", "by", "sptr", "along", "with", "the", "members", "in", "path", "to", "the", "instruction", "operand", "opnum", "at", "the", "address", "ea", "." ]
def op_structure(ea, opnum, sptr, *path, **force): '''Apply the structure identified by `sptr` along with the members in `path` to the instruction operand `opnum` at the address `ea`.''' ea = interface.address.inside(ea) if not database.type.is_code(ea): raise E.InvalidTypeOrValueError(u"{:s}.op_str...
[ "def", "op_structure", "(", "ea", ",", "opnum", ",", "sptr", ",", "*", "path", ",", "*", "*", "force", ")", ":", "ea", "=", "interface", ".", "address", ".", "inside", "(", "ea", ")", "if", "not", "database", ".", "type", ".", "is_code", "(", "ea...
https://github.com/arizvisa/ida-minsc/blob/8627a60f047b5e55d3efeecde332039cd1a16eea/base/instruction.py#L1225-L1445
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/conversations/v1/credential.py
python
CredentialPage.get_instance
(self, payload)
return CredentialInstance(self._version, payload, )
Build an instance of CredentialInstance :param dict payload: Payload response from the API :returns: twilio.rest.conversations.v1.credential.CredentialInstance :rtype: twilio.rest.conversations.v1.credential.CredentialInstance
Build an instance of CredentialInstance
[ "Build", "an", "instance", "of", "CredentialInstance" ]
def get_instance(self, payload): """ Build an instance of CredentialInstance :param dict payload: Payload response from the API :returns: twilio.rest.conversations.v1.credential.CredentialInstance :rtype: twilio.rest.conversations.v1.credential.CredentialInstance """ ...
[ "def", "get_instance", "(", "self", ",", "payload", ")", ":", "return", "CredentialInstance", "(", "self", ".", "_version", ",", "payload", ",", ")" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/conversations/v1/credential.py#L191-L200
1040003585/WebScrapingWithPython
a770fa5b03894076c8c9539b1ffff34424ffc016
ResourceCode/wswp-places-c573d29efa3a/modules/Captcha/Visual/Text.py
python
FontFactory.pick
(self)
return (fileName, size)
Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()
Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()
[ "Returns", "a", "(", "fileName", "size", ")", "tuple", "that", "can", "be", "passed", "to", "ImageFont", ".", "truetype", "()" ]
def pick(self): """Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()""" fileName = File.RandomFileFactory.pick(self) size = int(random.uniform(self.minSize, self.maxSize) + 0.5) return (fileName, size)
[ "def", "pick", "(", "self", ")", ":", "fileName", "=", "File", ".", "RandomFileFactory", ".", "pick", "(", "self", ")", "size", "=", "int", "(", "random", ".", "uniform", "(", "self", ".", "minSize", ",", "self", ".", "maxSize", ")", "+", "0.5", ")...
https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/ResourceCode/wswp-places-c573d29efa3a/modules/Captcha/Visual/Text.py#L34-L38
kirthevasank/nasbot
3c745dc986be30e3721087c8fa768099032a0802
opt/gpb_acquisitions.py
python
_get_ucb_beta_th
(dim, time_step)
return np.sqrt(0.5 * dim * np.log(2 * dim * time_step + 1))
Computes the beta t for UCB based methods.
Computes the beta t for UCB based methods.
[ "Computes", "the", "beta", "t", "for", "UCB", "based", "methods", "." ]
def _get_ucb_beta_th(dim, time_step): """ Computes the beta t for UCB based methods. """ return np.sqrt(0.5 * dim * np.log(2 * dim * time_step + 1))
[ "def", "_get_ucb_beta_th", "(", "dim", ",", "time_step", ")", ":", "return", "np", ".", "sqrt", "(", "0.5", "*", "dim", "*", "np", ".", "log", "(", "2", "*", "dim", "*", "time_step", "+", "1", ")", ")" ]
https://github.com/kirthevasank/nasbot/blob/3c745dc986be30e3721087c8fa768099032a0802/opt/gpb_acquisitions.py#L65-L67
mylar3/mylar3
fce4771c5b627f8de6868dd4ab6bc53f7b22d303
lib/comictaggerlib/comicvinetalker.py
python
ComicVineTalker.cleanup_html
(self, string, remove_html_tables)
return newstring
converter = html2text.HTML2Text() #converter.emphasis_mark = '*' #converter.ignore_links = True converter.body_width = 0 print(html2text.html2text(string)) return string #return converter.handle(string)
converter = html2text.HTML2Text() #converter.emphasis_mark = '*' #converter.ignore_links = True converter.body_width = 0
[ "converter", "=", "html2text", ".", "HTML2Text", "()", "#converter", ".", "emphasis_mark", "=", "*", "#converter", ".", "ignore_links", "=", "True", "converter", ".", "body_width", "=", "0" ]
def cleanup_html(self, string, remove_html_tables): """ converter = html2text.HTML2Text() #converter.emphasis_mark = '*' #converter.ignore_links = True converter.body_width = 0 print(html2text.html2text(string)) return string #return converter.handle(stri...
[ "def", "cleanup_html", "(", "self", ",", "string", ",", "remove_html_tables", ")", ":", "if", "string", "is", "None", ":", "return", "\"\"", "# find any tables", "soup", "=", "BeautifulSoup", "(", "string", ",", "\"html.parser\"", ")", "tables", "=", "soup", ...
https://github.com/mylar3/mylar3/blob/fce4771c5b627f8de6868dd4ab6bc53f7b22d303/lib/comictaggerlib/comicvinetalker.py#L564-L657
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/idlelib/PyShell.py
python
PyShell._close
(self)
Extend EditorWindow._close(), shut down debugger and execution server
Extend EditorWindow._close(), shut down debugger and execution server
[ "Extend", "EditorWindow", ".", "_close", "()", "shut", "down", "debugger", "and", "execution", "server" ]
def _close(self): "Extend EditorWindow._close(), shut down debugger and execution server" self.close_debugger() if use_subprocess: self.interp.kill_subprocess() # Restore std streams sys.stdout = self.save_stdout sys.stderr = self.save_stderr sys.stdin...
[ "def", "_close", "(", "self", ")", ":", "self", ".", "close_debugger", "(", ")", "if", "use_subprocess", ":", "self", ".", "interp", ".", "kill_subprocess", "(", ")", "# Restore std streams", "sys", ".", "stdout", "=", "self", ".", "save_stdout", "sys", "....
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/idlelib/PyShell.py#L997-L1011
pyansys/pymapdl
c07291fc062b359abf0e92b95a92d753a95ef3d7
ansys/mapdl/core/_commands/session/processor_entry.py
python
ProcessorEntry.aux12
(self, **kwargs)
return self.run(command, **kwargs)
Enters the radiation processor. APDL Command: /AUX12 Notes ----- Enters the radiation processor (ANSYS auxiliary processor AUX12). This processor supports the Radiation Matrix and the Radiosity Solver methods. This command is valid only at the Begin Level.
Enters the radiation processor.
[ "Enters", "the", "radiation", "processor", "." ]
def aux12(self, **kwargs): """Enters the radiation processor. APDL Command: /AUX12 Notes ----- Enters the radiation processor (ANSYS auxiliary processor AUX12). This processor supports the Radiation Matrix and the Radiosity Solver methods. This command...
[ "def", "aux12", "(", "self", ",", "*", "*", "kwargs", ")", ":", "command", "=", "\"/AUX12,\"", "return", "self", ".", "run", "(", "command", ",", "*", "*", "kwargs", ")" ]
https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/session/processor_entry.py#L38-L52
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/calendar.py
python
TextCalendar.formatweekday
(self, day, width)
return names[day][:width].center(width)
Returns a formatted week day name.
Returns a formatted week day name.
[ "Returns", "a", "formatted", "week", "day", "name", "." ]
def formatweekday(self, day, width): """ Returns a formatted week day name. """ if width >= 9: names = day_name else: names = day_abbr return names[day][:width].center(width)
[ "def", "formatweekday", "(", "self", ",", "day", ",", "width", ")", ":", "if", "width", ">=", "9", ":", "names", "=", "day_name", "else", ":", "names", "=", "day_abbr", "return", "names", "[", "day", "]", "[", ":", "width", "]", ".", "center", "(",...
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/calendar.py#L321-L329
GNS3/gns3-server
aff06572d4173df945ad29ea8feb274f7885d9e4
gns3server/utils/asyncio/aiozipstream.py
python
ZipFile._run_in_executor
(self, task, *args, **kwargs)
return await loop.run_in_executor(futures.ThreadPoolExecutor(max_workers=1), task, *args, **kwargs)
Run synchronous task in separate thread and await for result.
Run synchronous task in separate thread and await for result.
[ "Run", "synchronous", "task", "in", "separate", "thread", "and", "await", "for", "result", "." ]
async def _run_in_executor(self, task, *args, **kwargs): """ Run synchronous task in separate thread and await for result. """ loop = asyncio.get_event_loop() return await loop.run_in_executor(futures.ThreadPoolExecutor(max_workers=1), task, *args, **kwargs)
[ "async", "def", "_run_in_executor", "(", "self", ",", "task", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "return", "await", "loop", ".", "run_in_executor", "(", "futures", ".", "ThreadPoo...
https://github.com/GNS3/gns3-server/blob/aff06572d4173df945ad29ea8feb274f7885d9e4/gns3server/utils/asyncio/aiozipstream.py#L174-L180
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/combinatorics/util.py
python
_remove_gens
(base, strong_gens, basic_orbits=None, strong_gens_distr=None)
return res
Remove redundant generators from a strong generating set. Parameters ========== ``base`` - a base ``strong_gens`` - a strong generating set relative to ``base`` ``basic_orbits`` - basic orbits ``strong_gens_distr`` - strong generators distributed by membership in basic stabilizers Ret...
Remove redundant generators from a strong generating set.
[ "Remove", "redundant", "generators", "from", "a", "strong", "generating", "set", "." ]
def _remove_gens(base, strong_gens, basic_orbits=None, strong_gens_distr=None): """ Remove redundant generators from a strong generating set. Parameters ========== ``base`` - a base ``strong_gens`` - a strong generating set relative to ``base`` ``basic_orbits`` - basic orbits ``strong_...
[ "def", "_remove_gens", "(", "base", ",", "strong_gens", ",", "basic_orbits", "=", "None", ",", "strong_gens_distr", "=", "None", ")", ":", "from", "sympy", ".", "combinatorics", ".", "perm_groups", "import", "_orbit", "base_len", "=", "len", "(", "base", ")"...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/combinatorics/util.py#L315-L384
mu-editor/mu
5a5d7723405db588f67718a63a0ec0ecabebae33
mu/interface/main.py
python
Window.stop_timer
(self)
Stop the repeating timer.
Stop the repeating timer.
[ "Stop", "the", "repeating", "timer", "." ]
def stop_timer(self): """ Stop the repeating timer. """ if self.timer: self.timer.stop() self.timer = None
[ "def", "stop_timer", "(", "self", ")", ":", "if", "self", ".", "timer", ":", "self", ".", "timer", ".", "stop", "(", ")", "self", ".", "timer", "=", "None" ]
https://github.com/mu-editor/mu/blob/5a5d7723405db588f67718a63a0ec0ecabebae33/mu/interface/main.py#L1201-L1207
RJT1990/pyflux
297f2afc2095acd97c12e827dd500e8ea5da0c0f
pyflux/garch/lmegarch.py
python
LMEGARCH._create_latent_variables
(self)
Creates model latent variables Returns ---------- None (changes model attributes)
Creates model latent variables
[ "Creates", "model", "latent", "variables" ]
def _create_latent_variables(self): """ Creates model latent variables Returns ---------- None (changes model attributes) """ self.latent_variables.add_z('Vol Constant', fam.Normal(0,3,transform=None), fam.Normal(0,3)) for component in range(2): inc...
[ "def", "_create_latent_variables", "(", "self", ")", ":", "self", ".", "latent_variables", ".", "add_z", "(", "'Vol Constant'", ",", "fam", ".", "Normal", "(", "0", ",", "3", ",", "transform", "=", "None", ")", ",", "fam", ".", "Normal", "(", "0", ",",...
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/garch/lmegarch.py#L59-L87
vilcans/screenplain
b3b4ab5716470449ad4845a34b959e0ef2301359
screenplain/richstring.py
python
RichString.__unicode__
(self)
return ''.join(str(s) for s in self.segments)
[]
def __unicode__(self): return ''.join(str(s) for s in self.segments)
[ "def", "__unicode__", "(", "self", ")", ":", "return", "''", ".", "join", "(", "str", "(", "s", ")", "for", "s", "in", "self", ".", "segments", ")" ]
https://github.com/vilcans/screenplain/blob/b3b4ab5716470449ad4845a34b959e0ef2301359/screenplain/richstring.py#L36-L37
cisco/mindmeld
809c36112e9ea8019fe29d54d136ca14eb4fd8db
mindmeld/system_entity_recognizer.py
python
DucklingRecognizer.get_response
(self, data)
Send a post request to Duckling, data is a dictionary with field `text`. Return a tuple consisting the JSON response and a response code. Args: data (dict) Returns: (dict, int)
Send a post request to Duckling, data is a dictionary with field `text`. Return a tuple consisting the JSON response and a response code.
[ "Send", "a", "post", "request", "to", "Duckling", "data", "is", "a", "dictionary", "with", "field", "text", ".", "Return", "a", "tuple", "consisting", "the", "JSON", "response", "and", "a", "response", "code", "." ]
def get_response(self, data): """ Send a post request to Duckling, data is a dictionary with field `text`. Return a tuple consisting the JSON response and a response code. Args: data (dict) Returns: (dict, int) """ try: respon...
[ "def", "get_response", "(", "self", ",", "data", ")", ":", "try", ":", "response", "=", "requests", ".", "request", "(", "\"POST\"", ",", "self", ".", "url", ",", "data", "=", "data", ",", "timeout", "=", "float", "(", "SYS_ENTITY_REQUEST_TIMEOUT", ")", ...
https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/system_entity_recognizer.py#L268-L312
vmware-archive/vsphere-storage-for-docker
96d2ce72457047af4ef05cb0a8794cf623803865
esx_service/utils/auth_api.py
python
get_default_datastore_url
(name)
return error_info, default_datastore_url
Get default_datastore url for given tenant Return value: --- error_info: return None on success or error info on failure --- default_datastore: return name of default_datastore on success or None on failure
Get default_datastore url for given tenant Return value: --- error_info: return None on success or error info on failure --- default_datastore: return name of default_datastore on success or None on failure
[ "Get", "default_datastore", "url", "for", "given", "tenant", "Return", "value", ":", "---", "error_info", ":", "return", "None", "on", "success", "or", "error", "info", "on", "failure", "---", "default_datastore", ":", "return", "name", "of", "default_datastore"...
def get_default_datastore_url(name): """ Get default_datastore url for given tenant Return value: --- error_info: return None on success or error info on failure --- default_datastore: return name of default_datastore on success or None on failure """ logging.debug("auth_api....
[ "def", "get_default_datastore_url", "(", "name", ")", ":", "logging", ".", "debug", "(", "\"auth_api.get_default_datastore_url: for tenant with name=%s\"", ",", "name", ")", "error_info", ",", "auth_mgr", "=", "get_auth_mgr_object", "(", ")", "if", "error_info", ":", ...
https://github.com/vmware-archive/vsphere-storage-for-docker/blob/96d2ce72457047af4ef05cb0a8794cf623803865/esx_service/utils/auth_api.py#L319-L351
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twill/twill/other_packages/_mechanize_dist/_beautifulsoup.py
python
Tag.__eq__
(self, other)
return True
Returns true iff this tag has the same name, the same attributes, and the same contents (recursively) as the given tag. NOTE: right now this will return false if two tags have the same attributes in a different order. Should this be fixed?
Returns true iff this tag has the same name, the same attributes, and the same contents (recursively) as the given tag.
[ "Returns", "true", "iff", "this", "tag", "has", "the", "same", "name", "the", "same", "attributes", "and", "the", "same", "contents", "(", "recursively", ")", "as", "the", "given", "tag", "." ]
def __eq__(self, other): """Returns true iff this tag has the same name, the same attributes, and the same contents (recursively) as the given tag. NOTE: right now this will return false if two tags have the same attributes in a different order. Should this be fixed?""" if not h...
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "hasattr", "(", "other", ",", "'name'", ")", "or", "not", "hasattr", "(", "other", ",", "'attrs'", ")", "or", "not", "hasattr", "(", "other", ",", "'contents'", ")", "or", "self", "...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twill/twill/other_packages/_mechanize_dist/_beautifulsoup.py#L355-L366
SolidCode/SolidPython
4715c827ad90db26ee37df57bc425e6f2de3cf8d
solid/solidpython.py
python
OpenSCADObject._repr_png_
(self)
return png_data
Allow rich clients such as the IPython Notebook, to display the current OpenSCAD rendering of this object.
Allow rich clients such as the IPython Notebook, to display the current OpenSCAD rendering of this object.
[ "Allow", "rich", "clients", "such", "as", "the", "IPython", "Notebook", "to", "display", "the", "current", "OpenSCAD", "rendering", "of", "this", "object", "." ]
def _repr_png_(self) -> Optional[bytes]: """ Allow rich clients such as the IPython Notebook, to display the current OpenSCAD rendering of this object. """ png_data = None tmp = tempfile.NamedTemporaryFile(suffix=".scad", delete=False) tmp_png = tempfile.NamedTemp...
[ "def", "_repr_png_", "(", "self", ")", "->", "Optional", "[", "bytes", "]", ":", "png_data", "=", "None", "tmp", "=", "tempfile", ".", "NamedTemporaryFile", "(", "suffix", "=", "\".scad\"", ",", "delete", "=", "False", ")", "tmp_png", "=", "tempfile", "....
https://github.com/SolidCode/SolidPython/blob/4715c827ad90db26ee37df57bc425e6f2de3cf8d/solid/solidpython.py#L335-L361
wbond/package_control
cfaaeb57612023e3679ecb7f8cd7ceac9f57990d
package_control/deps/asn1crypto/x509.py
python
Certificate._get_http_crl_distribution_points
(self, crl_distribution_points)
return output
Fetches the DistributionPoint object for non-relative, HTTP CRLs referenced by the certificate :param crl_distribution_points: A CRLDistributionPoints object to grab the DistributionPoints from :return: A list of zero or more DistributionPoint objects
Fetches the DistributionPoint object for non-relative, HTTP CRLs referenced by the certificate
[ "Fetches", "the", "DistributionPoint", "object", "for", "non", "-", "relative", "HTTP", "CRLs", "referenced", "by", "the", "certificate" ]
def _get_http_crl_distribution_points(self, crl_distribution_points): """ Fetches the DistributionPoint object for non-relative, HTTP CRLs referenced by the certificate :param crl_distribution_points: A CRLDistributionPoints object to grab the DistributionPoints from ...
[ "def", "_get_http_crl_distribution_points", "(", "self", ",", "crl_distribution_points", ")", ":", "output", "=", "[", "]", "if", "crl_distribution_points", "is", "None", ":", "return", "[", "]", "for", "distribution_point", "in", "crl_distribution_points", ":", "di...
https://github.com/wbond/package_control/blob/cfaaeb57612023e3679ecb7f8cd7ceac9f57990d/package_control/deps/asn1crypto/x509.py#L2665-L2694
Pymol-Scripts/Pymol-script-repo
bcd7bb7812dc6db1595953dfa4471fa15fb68c77
modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/Utility.py
python
ElementProxy.createElementNS
(self, namespace, qname)
return ElementProxy(self.sw, node)
Keyword arguments: namespace -- namespace of element to create qname -- qualified name of new element
Keyword arguments: namespace -- namespace of element to create qname -- qualified name of new element
[ "Keyword", "arguments", ":", "namespace", "--", "namespace", "of", "element", "to", "create", "qname", "--", "qualified", "name", "of", "new", "element" ]
def createElementNS(self, namespace, qname): ''' Keyword arguments: namespace -- namespace of element to create qname -- qualified name of new element ''' document = self._getOwnerDocument() node = document.createElementNS(namespace, qname) return ...
[ "def", "createElementNS", "(", "self", ",", "namespace", ",", "qname", ")", ":", "document", "=", "self", ".", "_getOwnerDocument", "(", ")", "node", "=", "document", ".", "createElementNS", "(", "namespace", ",", "qname", ")", "return", "ElementProxy", "(",...
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/Utility.py#L1012-L1020
marcosfede/algorithms
1ee7c815f9d556c9cef4d4b0d21ee3a409d21629
adventofcode/2018/21/d21.py
python
gtrr
(r, a, b)
return 1 if r[a] > r[b] else 0
[]
def gtrr(r, a, b): return 1 if r[a] > r[b] else 0
[ "def", "gtrr", "(", "r", ",", "a", ",", "b", ")", ":", "return", "1", "if", "r", "[", "a", "]", ">", "r", "[", "b", "]", "else", "0" ]
https://github.com/marcosfede/algorithms/blob/1ee7c815f9d556c9cef4d4b0d21ee3a409d21629/adventofcode/2018/21/d21.py#L50-L51
bashtage/linearmodels
9256269f01ff8c5f85e65342d66149a5636661b6
linearmodels/panel/model.py
python
_PanelModelBase.not_null
(self)
return self._not_null
Locations of non-missing observations
Locations of non-missing observations
[ "Locations", "of", "non", "-", "missing", "observations" ]
def not_null(self) -> Float64Array: """Locations of non-missing observations""" return self._not_null
[ "def", "not_null", "(", "self", ")", "->", "Float64Array", ":", "return", "self", ".", "_not_null" ]
https://github.com/bashtage/linearmodels/blob/9256269f01ff8c5f85e65342d66149a5636661b6/linearmodels/panel/model.py#L690-L692
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
arcade/examples/sprite_face_left_or_right.py
python
MyGame.on_key_release
(self, key, modifiers)
Called when the user releases a key.
Called when the user releases a key.
[ "Called", "when", "the", "user", "releases", "a", "key", "." ]
def on_key_release(self, key, modifiers): """Called when the user releases a key. """ if key == arcade.key.UP or key == arcade.key.DOWN: self.player_sprite.change_y = 0 elif key == arcade.key.LEFT or key == arcade.key.RIGHT: self.player_sprite.change_x = 0
[ "def", "on_key_release", "(", "self", ",", "key", ",", "modifiers", ")", ":", "if", "key", "==", "arcade", ".", "key", ".", "UP", "or", "key", "==", "arcade", ".", "key", ".", "DOWN", ":", "self", ".", "player_sprite", ".", "change_y", "=", "0", "e...
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/examples/sprite_face_left_or_right.py#L122-L128
xtiankisutsa/MARA_Framework
ac4ac88bfd38f33ae8780a606ed09ab97177c562
tools/androguard/androguard/core/bytecodes/dvm.py
python
ClassDefItem.get_access_flags
(self)
return self.access_flags
Return the access flags for the class (public, final, etc.) :rtype: int
Return the access flags for the class (public, final, etc.)
[ "Return", "the", "access", "flags", "for", "the", "class", "(", "public", "final", "etc", ".", ")" ]
def get_access_flags(self): """ Return the access flags for the class (public, final, etc.) :rtype: int """ return self.access_flags
[ "def", "get_access_flags", "(", "self", ")", ":", "return", "self", ".", "access_flags" ]
https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/androguard/androguard/core/bytecodes/dvm.py#L3506-L3512
CalebBell/thermo
572a47d1b03d49fe609b8d5f826fa6a7cde00828
thermo/interface.py
python
SurfaceTension.test_method_validity
(self, T, method)
return validity
r'''Method to check the validity of a method. Follows the given ranges for all coefficient-based methods. For CSP methods, the models are considered valid from 0 K to the critical point. For tabular data, extrapolation outside of the range is used if :obj:`tabular_extrapolation_permitted...
r'''Method to check the validity of a method. Follows the given ranges for all coefficient-based methods. For CSP methods, the models are considered valid from 0 K to the critical point. For tabular data, extrapolation outside of the range is used if :obj:`tabular_extrapolation_permitted...
[ "r", "Method", "to", "check", "the", "validity", "of", "a", "method", ".", "Follows", "the", "given", "ranges", "for", "all", "coefficient", "-", "based", "methods", ".", "For", "CSP", "methods", "the", "models", "are", "considered", "valid", "from", "0", ...
def test_method_validity(self, T, method): r'''Method to check the validity of a method. Follows the given ranges for all coefficient-based methods. For CSP methods, the models are considered valid from 0 K to the critical point. For tabular data, extrapolation outside of the range is us...
[ "def", "test_method_validity", "(", "self", ",", "T", ",", "method", ")", ":", "validity", "=", "True", "if", "method", "==", "STREFPROP", ":", "if", "T", "<", "self", ".", "STREFPROP_Tmin", "or", "T", ">", "self", ".", "STREFPROP_Tmax", ":", "validity",...
https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/interface.py#L429-L477
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/html5lib/_tokenizer.py
python
HTMLTokenizer.scriptDataEndTagNameState
(self)
return True
[]
def scriptDataEndTagNameState(self): appropriate = self.currentToken and self.currentToken["name"].lower() == self.temporaryBuffer.lower() data = self.stream.char() if data in spaceCharacters and appropriate: self.currentToken = {"type": tokenTypes["EndTag"], ...
[ "def", "scriptDataEndTagNameState", "(", "self", ")", ":", "appropriate", "=", "self", ".", "currentToken", "and", "self", ".", "currentToken", "[", "\"name\"", "]", ".", "lower", "(", ")", "==", "self", ".", "temporaryBuffer", ".", "lower", "(", ")", "dat...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/html5lib/_tokenizer.py#L567-L593
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/inject_meta_charset.py
python
Filter.__iter__
(self)
[]
def __iter__(self): state = "pre_head" meta_found = (self.encoding is None) pending = [] for token in base.Filter.__iter__(self): type = token["type"] if type == "StartTag": if token["name"].lower() == "head": state = "in_head"...
[ "def", "__iter__", "(", "self", ")", ":", "state", "=", "\"pre_head\"", "meta_found", "=", "(", "self", ".", "encoding", "is", "None", ")", "pending", "=", "[", "]", "for", "token", "in", "base", ".", "Filter", ".", "__iter__", "(", "self", ")", ":",...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/inject_meta_charset.py#L11-L65
seppius-xbmc-repo/ru
d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2
plugin.video.online.anidub.com/resources/lib/BeautifulSoup.py
python
BeautifulStoneSoup.popTag
(self)
return self.currentTag
[]
def popTag(self): tag = self.tagStack.pop() #print "Pop", tag.name if self.tagStack: self.currentTag = self.tagStack[-1] return self.currentTag
[ "def", "popTag", "(", "self", ")", ":", "tag", "=", "self", ".", "tagStack", ".", "pop", "(", ")", "#print \"Pop\", tag.name", "if", "self", ".", "tagStack", ":", "self", ".", "currentTag", "=", "self", ".", "tagStack", "[", "-", "1", "]", "return", ...
https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.online.anidub.com/resources/lib/BeautifulSoup.py#L1221-L1227
tav/pylibs
3c16b843681f54130ee6a022275289cadb2f2a69
paramiko/pkey.py
python
PKey.get_fingerprint
(self)
return MD5.new(str(self)).digest()
Return an MD5 fingerprint of the public part of this key. Nothing secret is revealed. @return: a 16-byte string (binary) of the MD5 fingerprint, in SSH format. @rtype: str
Return an MD5 fingerprint of the public part of this key. Nothing secret is revealed.
[ "Return", "an", "MD5", "fingerprint", "of", "the", "public", "part", "of", "this", "key", ".", "Nothing", "secret", "is", "revealed", "." ]
def get_fingerprint(self): """ Return an MD5 fingerprint of the public part of this key. Nothing secret is revealed. @return: a 16-byte string (binary) of the MD5 fingerprint, in SSH format. @rtype: str """ return MD5.new(str(self)).digest()
[ "def", "get_fingerprint", "(", "self", ")", ":", "return", "MD5", ".", "new", "(", "str", "(", "self", ")", ")", ".", "digest", "(", ")" ]
https://github.com/tav/pylibs/blob/3c16b843681f54130ee6a022275289cadb2f2a69/paramiko/pkey.py#L124-L133
sktime/sktime-dl
e519bf5983f9ed60b04b0d14f4fe3fa049a82f04
sktime_dl/utils/layer_utils.py
python
_time_distributed_dense
(x, w, b=None, dropout=None, input_dim=None, output_dim=None, timesteps=None, training=None)
return x
Apply `y . w + b` for every temporal slice y of x. # Arguments x: input tensor. w: weight matrix. b: optional bias vector. dropout: wether to apply dropout (same dropout mask for every temporal slice of the input). input_dim: integer; optional dimensionality of th...
Apply `y . w + b` for every temporal slice y of x. # Arguments x: input tensor. w: weight matrix. b: optional bias vector. dropout: wether to apply dropout (same dropout mask for every temporal slice of the input). input_dim: integer; optional dimensionality of th...
[ "Apply", "y", ".", "w", "+", "b", "for", "every", "temporal", "slice", "y", "of", "x", ".", "#", "Arguments", "x", ":", "input", "tensor", ".", "w", ":", "weight", "matrix", ".", "b", ":", "optional", "bias", "vector", ".", "dropout", ":", "wether"...
def _time_distributed_dense(x, w, b=None, dropout=None, input_dim=None, output_dim=None, timesteps=None, training=None): """Apply `y . w + b` for every temporal slice y of x. # Arguments x: input tensor. w: weight matrix. b: optiona...
[ "def", "_time_distributed_dense", "(", "x", ",", "w", ",", "b", "=", "None", ",", "dropout", "=", "None", ",", "input_dim", "=", "None", ",", "output_dim", "=", "None", ",", "timesteps", "=", "None", ",", "training", "=", "None", ")", ":", "if", "not...
https://github.com/sktime/sktime-dl/blob/e519bf5983f9ed60b04b0d14f4fe3fa049a82f04/sktime_dl/utils/layer_utils.py#L15-L57
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/gdata/Crypto/PublicKey/qNEW.py
python
qNEWobj.has_private
(self)
return hasattr(self, 'x')
Return a Boolean denoting whether the object contains private components.
Return a Boolean denoting whether the object contains private components.
[ "Return", "a", "Boolean", "denoting", "whether", "the", "object", "contains", "private", "components", "." ]
def has_private(self): """Return a Boolean denoting whether the object contains private components.""" return hasattr(self, 'x')
[ "def", "has_private", "(", "self", ")", ":", "return", "hasattr", "(", "self", ",", "'x'", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/gdata/Crypto/PublicKey/qNEW.py#L152-L155
Nekmo/amazon-dash
ac2b2f98282ec08036e1671fe937dfda381a911f
amazon_dash/exceptions.py
python
InvalidConfig.__init__
(self, file=None, extra_body='')
:param str file: Path to config file :param extra_body: complementary message
:param str file: Path to config file :param extra_body: complementary message
[ ":", "param", "str", "file", ":", "Path", "to", "config", "file", ":", "param", "extra_body", ":", "complementary", "message" ]
def __init__(self, file=None, extra_body=''): """ :param str file: Path to config file :param extra_body: complementary message """ body = 'The configuration file is invalid' if file: file = os.path.abspath(file) body += ' ({})'.format(file) ...
[ "def", "__init__", "(", "self", ",", "file", "=", "None", ",", "extra_body", "=", "''", ")", ":", "body", "=", "'The configuration file is invalid'", "if", "file", ":", "file", "=", "os", ".", "path", ".", "abspath", "(", "file", ")", "body", "+=", "' ...
https://github.com/Nekmo/amazon-dash/blob/ac2b2f98282ec08036e1671fe937dfda381a911f/amazon_dash/exceptions.py#L41-L53
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/operator.py
python
indexOf
(a, b)
Return the first index of b in a.
Return the first index of b in a.
[ "Return", "the", "first", "index", "of", "b", "in", "a", "." ]
def indexOf(a, b): "Return the first index of b in a." for i, j in enumerate(a): if j is b or j == b: return i else: raise ValueError('sequence.index(x): x not in sequence')
[ "def", "indexOf", "(", "a", ",", "b", ")", ":", "for", "i", ",", "j", "in", "enumerate", "(", "a", ")", ":", "if", "j", "is", "b", "or", "j", "==", "b", ":", "return", "i", "else", ":", "raise", "ValueError", "(", "'sequence.index(x): x not in sequ...
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/operator.py#L173-L179
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/appengine/libs/handler.py
python
check_user_access
(need_privileged_access)
return decorator
Wrap a handler with check_user_access. This decorator must be below post(..) and get(..) when used.
Wrap a handler with check_user_access.
[ "Wrap", "a", "handler", "with", "check_user_access", "." ]
def check_user_access(need_privileged_access): """Wrap a handler with check_user_access. This decorator must be below post(..) and get(..) when used. """ def decorator(func): """Decorator.""" @functools.wraps(func) def wrapper(self, *args, **kwargs): """Wrapper.""" if not access.has_a...
[ "def", "check_user_access", "(", "need_privileged_access", ")", ":", "def", "decorator", "(", "func", ")", ":", "\"\"\"Decorator.\"\"\"", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwa...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/appengine/libs/handler.py#L307-L326
Digital-Sapphire/PyUpdater
d408f54a38ab63ab5f4bcf6471ac1a546357b29f
pyupdater/_version.py
python
render_pep440_pre
(pieces)
return rendered
TAG[.post0.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post0.devDISTANCE
TAG[.post0.devDISTANCE] -- No -dirty.
[ "TAG", "[", ".", "post0", ".", "devDISTANCE", "]", "--", "No", "-", "dirty", "." ]
def render_pep440_pre(pieces): """TAG[.post0.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post0.devDISTANCE """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += ".post0.dev%d" % pieces["distance"] else: # e...
[ "def", "render_pep440_pre", "(", "pieces", ")", ":", "if", "pieces", "[", "\"closest-tag\"", "]", ":", "rendered", "=", "pieces", "[", "\"closest-tag\"", "]", "if", "pieces", "[", "\"distance\"", "]", ":", "rendered", "+=", "\".post0.dev%d\"", "%", "pieces", ...
https://github.com/Digital-Sapphire/PyUpdater/blob/d408f54a38ab63ab5f4bcf6471ac1a546357b29f/pyupdater/_version.py#L369-L382
maas/maas
db2f89970c640758a51247c59bf1ec6f60cf4ab5
src/maasserver/api/ssl_keys.py
python
SSLKeyHandler.read
(self, request, id)
return key
@description-title Retrieve an SSL key @description Retrieves an SSL key with the given ID. @param (int) "id" [required=true] An SSL key ID. @success (http-status-code) "200" 200 @success (json) "success-json" A JSON object containing a list of imported keys. @success-e...
@description-title Retrieve an SSL key @description Retrieves an SSL key with the given ID.
[ "@description", "-", "title", "Retrieve", "an", "SSL", "key", "@description", "Retrieves", "an", "SSL", "key", "with", "the", "given", "ID", "." ]
def read(self, request, id): """@description-title Retrieve an SSL key @description Retrieves an SSL key with the given ID. @param (int) "id" [required=true] An SSL key ID. @success (http-status-code) "200" 200 @success (json) "success-json" A JSON object containing a list of ...
[ "def", "read", "(", "self", ",", "request", ",", "id", ")", ":", "key", "=", "get_object_or_404", "(", "SSLKey", ",", "id", "=", "id", ")", "if", "key", ".", "user", "!=", "request", ".", "user", ":", "return", "HttpResponseForbidden", "(", "\"Can't ge...
https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/api/ssl_keys.py#L95-L120
kbandla/ImmunityDebugger
2abc03fb15c8f3ed0914e1175c4d8933977c73e3
1.83/Libs/immlib.py
python
Debugger.setComment
(self, address, comment)
return debugger.set_comment(address, comment)
Set a comment. @type address: DWORD @param address: Address of the Comment @type comment: STRING @param comment: Comment to add
Set a comment.
[ "Set", "a", "comment", "." ]
def setComment(self, address, comment): """ Set a comment. @type address: DWORD @param address: Address of the Comment @type comment: STRING @param comment: Comment to add """ return debugger.set_comment(address, comment)
[ "def", "setComment", "(", "self", ",", "address", ",", "comment", ")", ":", "return", "debugger", ".", "set_comment", "(", "address", ",", "comment", ")" ]
https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.83/Libs/immlib.py#L1783-L1793
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/core/interface.py
python
Interface.substrate_indicies
(self)
return sub_indicies
Site indicies for the substrate atoms
Site indicies for the substrate atoms
[ "Site", "indicies", "for", "the", "substrate", "atoms" ]
def substrate_indicies(self) -> List[int]: """ Site indicies for the substrate atoms """ sub_indicies = [i for i, tag in enumerate(self.site_properties["interface_label"]) if "substrate" in tag] return sub_indicies
[ "def", "substrate_indicies", "(", "self", ")", "->", "List", "[", "int", "]", ":", "sub_indicies", "=", "[", "i", "for", "i", ",", "tag", "in", "enumerate", "(", "self", ".", "site_properties", "[", "\"interface_label\"", "]", ")", "if", "\"substrate\"", ...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/core/interface.py#L151-L156
metabrainz/picard
535bf8c7d9363ffc7abb3f69418ec11823c38118
picard/ui/options/releases.py
python
TipSlider.showEvent
(self, event)
[]
def showEvent(self, event): super().showEvent(event) if not IS_WIN: self.valueChanged.connect(self.show_tip)
[ "def", "showEvent", "(", "self", ",", "event", ")", ":", "super", "(", ")", ".", "showEvent", "(", "event", ")", "if", "not", "IS_WIN", ":", "self", ".", "valueChanged", ".", "connect", "(", "self", ".", "show_tip", ")" ]
https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/ui/options/releases.py#L80-L83
Azure/blobxfer
c6c6c143e8ee413d09a1110abafdb92e9e8afc39
blobxfer/models/resume.py
python
SyncCopy.src_block_list
(self)
return self._src_block_list
Source committed block list :param SyncCopy self: this :rtype: list :return: source committed block list
Source committed block list :param SyncCopy self: this :rtype: list :return: source committed block list
[ "Source", "committed", "block", "list", ":", "param", "SyncCopy", "self", ":", "this", ":", "rtype", ":", "list", ":", "return", ":", "source", "committed", "block", "list" ]
def src_block_list(self): # type: (SyncCopy) -> list """Source committed block list :param SyncCopy self: this :rtype: list :return: source committed block list """ return self._src_block_list
[ "def", "src_block_list", "(", "self", ")", ":", "# type: (SyncCopy) -> list", "return", "self", ".", "_src_block_list" ]
https://github.com/Azure/blobxfer/blob/c6c6c143e8ee413d09a1110abafdb92e9e8afc39/blobxfer/models/resume.py#L326-L333
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/pupylib/payloads/dependencies.py
python
bundle
(platform, arch)
return ZipFile(arch_bundle, 'r')
[]
def bundle(platform, arch): arch_bundle = os.path.join( 'payload_templates', platform+'-'+arch+'.zip' ) if not os.path.isfile(arch_bundle): arch_bundle = os.path.join( ROOT, 'payload_templates', platform+'-'+arch+'.zip' ) if not os.path.exists(arch_bundle): ...
[ "def", "bundle", "(", "platform", ",", "arch", ")", ":", "arch_bundle", "=", "os", ".", "path", ".", "join", "(", "'payload_templates'", ",", "platform", "+", "'-'", "+", "arch", "+", "'.zip'", ")", "if", "not", "os", ".", "path", ".", "isfile", "(",...
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/pupylib/payloads/dependencies.py#L664-L677
hasegaw/IkaLog
bd476da541fcc296f792d4db76a6b9174c4777ad
ikalog/outputs/twitter.py
python
Twitter.refresh_ui
(self)
[]
def refresh_ui(self): self._internal_update = True self.checkEnable.SetValue(self.enabled) self.checkAttachImage.SetValue(self.attach_image) self.checkTweetKd.SetValue(self.tweet_kd) self.checkTweetMyScore.SetValue(self.tweet_my_score) self.checkTweetUdemae.SetValue(self....
[ "def", "refresh_ui", "(", "self", ")", ":", "self", ".", "_internal_update", "=", "True", "self", ".", "checkEnable", ".", "SetValue", "(", "self", ".", "enabled", ")", "self", ".", "checkAttachImage", ".", "SetValue", "(", "self", ".", "attach_image", ")"...
https://github.com/hasegaw/IkaLog/blob/bd476da541fcc296f792d4db76a6b9174c4777ad/ikalog/outputs/twitter.py#L93-L135
schaul/py-vgdl
b595d3f94d286a8a3369786b055a2f7a554bb982
vgdl/ontology.py
python
conveySprite
(sprite, partner, game)
Moves the partner in target direction by some step size.
Moves the partner in target direction by some step size.
[ "Moves", "the", "partner", "in", "target", "direction", "by", "some", "step", "size", "." ]
def conveySprite(sprite, partner, game): """ Moves the partner in target direction by some step size. """ tmp = sprite.lastrect v = unitVector(partner.orientation) sprite.physics.activeMovement(sprite, v, speed=partner.strength) sprite.lastrect = tmp game._updateCollisionDict(sprite)
[ "def", "conveySprite", "(", "sprite", ",", "partner", ",", "game", ")", ":", "tmp", "=", "sprite", ".", "lastrect", "v", "=", "unitVector", "(", "partner", ".", "orientation", ")", "sprite", ".", "physics", ".", "activeMovement", "(", "sprite", ",", "v",...
https://github.com/schaul/py-vgdl/blob/b595d3f94d286a8a3369786b055a2f7a554bb982/vgdl/ontology.py#L752-L758
explosion/srsly
8617ecc099d1f34a60117b5287bef5424ea2c837
srsly/ruamel_yaml/comments.py
python
CommentedMap.merge
(self)
return getattr(self, merge_attrib)
[]
def merge(self): # type: () -> Any if not hasattr(self, merge_attrib): setattr(self, merge_attrib, []) return getattr(self, merge_attrib)
[ "def", "merge", "(", "self", ")", ":", "# type: () -> Any", "if", "not", "hasattr", "(", "self", ",", "merge_attrib", ")", ":", "setattr", "(", "self", ",", "merge_attrib", ",", "[", "]", ")", "return", "getattr", "(", "self", ",", "merge_attrib", ")" ]
https://github.com/explosion/srsly/blob/8617ecc099d1f34a60117b5287bef5424ea2c837/srsly/ruamel_yaml/comments.py#L911-L915
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/words/finite_word.py
python
FiniteWord_class.is_proper_prefix
(self, other)
return self.is_prefix(other) and self.length() < other.length()
r""" Return ``True`` if ``self`` is a proper prefix of ``other``, and ``False`` otherwise. EXAMPLES:: sage: Word('12').is_proper_prefix(Word('123')) True sage: Word('12').is_proper_prefix(Word('12')) False sage: Word().is_proper_prefix(Word('...
r""" Return ``True`` if ``self`` is a proper prefix of ``other``, and ``False`` otherwise.
[ "r", "Return", "True", "if", "self", "is", "a", "proper", "prefix", "of", "other", "and", "False", "otherwise", "." ]
def is_proper_prefix(self, other): r""" Return ``True`` if ``self`` is a proper prefix of ``other``, and ``False`` otherwise. EXAMPLES:: sage: Word('12').is_proper_prefix(Word('123')) True sage: Word('12').is_proper_prefix(Word('12')) False ...
[ "def", "is_proper_prefix", "(", "self", ",", "other", ")", ":", "return", "self", ".", "is_prefix", "(", "other", ")", "and", "self", ".", "length", "(", ")", "<", "other", ".", "length", "(", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/words/finite_word.py#L1001-L1018
pan-unit42/public_tools
9ef8b06fdf18784d1729c8b9d7f804190a2d68c7
macro_loader/olevba.py
python
is_printable
(s)
return set(s).issubset(_PRINTABLE_SET)
returns True if string s only contains printable ASCII characters (i.e. contained in string.printable) This is similar to Python 3's str.isprintable, for Python 2.x. :param s: str :return: bool
returns True if string s only contains printable ASCII characters (i.e. contained in string.printable) This is similar to Python 3's str.isprintable, for Python 2.x. :param s: str :return: bool
[ "returns", "True", "if", "string", "s", "only", "contains", "printable", "ASCII", "characters", "(", "i", ".", "e", ".", "contained", "in", "string", ".", "printable", ")", "This", "is", "similar", "to", "Python", "3", "s", "str", ".", "isprintable", "fo...
def is_printable(s): """ returns True if string s only contains printable ASCII characters (i.e. contained in string.printable) This is similar to Python 3's str.isprintable, for Python 2.x. :param s: str :return: bool """ # inspired from http://stackoverflow.com/questions/3636928/test-i...
[ "def", "is_printable", "(", "s", ")", ":", "# inspired from http://stackoverflow.com/questions/3636928/test-if-a-python-string-is-printable", "# check if the set of chars from s is contained into the set of printable chars:", "return", "set", "(", "s", ")", ".", "issubset", "(", "_PR...
https://github.com/pan-unit42/public_tools/blob/9ef8b06fdf18784d1729c8b9d7f804190a2d68c7/macro_loader/olevba.py#L727-L737
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/psutil/_pswindows.py
python
Process._get_raw_meminfo
(self)
[]
def _get_raw_meminfo(self): try: return cext.proc_memory_info(self.pid) except OSError as err: if is_permission_err(err): # TODO: the C ext can probably be refactored in order # to get this from cext.proc_info() info = self._proc_in...
[ "def", "_get_raw_meminfo", "(", "self", ")", ":", "try", ":", "return", "cext", ".", "proc_memory_info", "(", "self", ".", "pid", ")", "except", "OSError", "as", "err", ":", "if", "is_permission_err", "(", "err", ")", ":", "# TODO: the C ext can probably be re...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/psutil/_pswindows.py#L807-L827
pyglet/pyglet
2833c1df902ca81aeeffa786c12e7e87d402434b
pyglet/image/__init__.py
python
ImageData.set_data
(self, fmt, pitch, data)
Set the byte data of the image. :Parameters: `fmt` : str Format string of the return data. `pitch` : int Number of bytes per row. Negative values indicate a top-to-bottom arrangement. `data` : str or sequence of bytes ...
Set the byte data of the image.
[ "Set", "the", "byte", "data", "of", "the", "image", "." ]
def set_data(self, fmt, pitch, data): """Set the byte data of the image. :Parameters: `fmt` : str Format string of the return data. `pitch` : int Number of bytes per row. Negative values indicate a top-to-bottom arrangement. ...
[ "def", "set_data", "(", "self", ",", "fmt", ",", "pitch", ",", "data", ")", ":", "self", ".", "_current_format", "=", "fmt", "self", ".", "_current_pitch", "=", "pitch", "self", ".", "_current_data", "=", "data", "self", ".", "_current_texture", "=", "No...
https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/image/__init__.py#L721-L739
udacity/artificial-intelligence
d8bc7ee2511f8aff486e0fba010a7f12a7d268d4
Projects/2_Classical Planning/layers.py
python
makeNoOp
(literal)
return (Action(action, [set([literal]), []], [set([literal]), []]), Action(~action, [set([~literal]), []], [set([~literal]), []]))
Create so-called 'no-op' actions, which only exist in a planning graph (they are not real actions in the problem domain) to persist a literal from one layer of the planning graph to the next. no-op actions are created such that logical negation is correctly evaluated. i.e., the no-op action of the nega...
Create so-called 'no-op' actions, which only exist in a planning graph (they are not real actions in the problem domain) to persist a literal from one layer of the planning graph to the next.
[ "Create", "so", "-", "called", "no", "-", "op", "actions", "which", "only", "exist", "in", "a", "planning", "graph", "(", "they", "are", "not", "real", "actions", "in", "the", "problem", "domain", ")", "to", "persist", "a", "literal", "from", "one", "l...
def makeNoOp(literal): """ Create so-called 'no-op' actions, which only exist in a planning graph (they are not real actions in the problem domain) to persist a literal from one layer of the planning graph to the next. no-op actions are created such that logical negation is correctly evaluated. i.e...
[ "def", "makeNoOp", "(", "literal", ")", ":", "action", "=", "Expr", "(", "\"NoOp::\"", "+", "literal", ".", "op", ",", "literal", ".", "args", ")", "return", "(", "Action", "(", "action", ",", "[", "set", "(", "[", "literal", "]", ")", ",", "[", ...
https://github.com/udacity/artificial-intelligence/blob/d8bc7ee2511f8aff486e0fba010a7f12a7d268d4/Projects/2_Classical Planning/layers.py#L28-L41
SebKuzminsky/pycam
55e3129f518e470040e79bb00515b4bfcf36c172
pycam/Plugins/OpenGLWindow.py
python
Camera.scale_distance
(self, scale)
[]
def scale_distance(self, scale): if scale != 0: scale = number(scale) dist = self.view["distance"] self.view["distance"] = (scale * dist[0], scale * dist[1], scale * dist[2])
[ "def", "scale_distance", "(", "self", ",", "scale", ")", ":", "if", "scale", "!=", "0", ":", "scale", "=", "number", "(", "scale", ")", "dist", "=", "self", ".", "view", "[", "\"distance\"", "]", "self", ".", "view", "[", "\"distance\"", "]", "=", ...
https://github.com/SebKuzminsky/pycam/blob/55e3129f518e470040e79bb00515b4bfcf36c172/pycam/Plugins/OpenGLWindow.py#L797-L801
GPflow/GPflowOpt
3d86bcc000b0367f19e9f03f4458f5641e5dde60
gpflowopt/acquisition/pof.py
python
ProbabilityOfFeasibility.__init__
(self, model, threshold=0.0, minimum_pof=0.5)
:param model: GPflow model (single output) representing our belief of the constraint :param threshold: Observed values lower than the threshold are considered valid :param minimum_pof: minimum pof score required for a point to be valid. For more information, see docstring of feasible_data_in...
:param model: GPflow model (single output) representing our belief of the constraint :param threshold: Observed values lower than the threshold are considered valid :param minimum_pof: minimum pof score required for a point to be valid. For more information, see docstring of feasible_data_in...
[ ":", "param", "model", ":", "GPflow", "model", "(", "single", "output", ")", "representing", "our", "belief", "of", "the", "constraint", ":", "param", "threshold", ":", "Observed", "values", "lower", "than", "the", "threshold", "are", "considered", "valid", ...
def __init__(self, model, threshold=0.0, minimum_pof=0.5): """ :param model: GPflow model (single output) representing our belief of the constraint :param threshold: Observed values lower than the threshold are considered valid :param minimum_pof: minimum pof score required for a point t...
[ "def", "__init__", "(", "self", ",", "model", ",", "threshold", "=", "0.0", ",", "minimum_pof", "=", "0.5", ")", ":", "super", "(", "ProbabilityOfFeasibility", ",", "self", ")", ".", "__init__", "(", "model", ")", "self", ".", "threshold", "=", "threshol...
https://github.com/GPflow/GPflowOpt/blob/3d86bcc000b0367f19e9f03f4458f5641e5dde60/gpflowopt/acquisition/pof.py#L49-L58
bnpy/bnpy
d5b311e8f58ccd98477f4a0c8a4d4982e3fca424
bnpy/obsmodel/ZeroMeanGaussObsModel.py
python
ZeroMeanGaussObsModel.getDatasetScale
(self, SS)
return SS.N.sum() * SS.D
Get number of observed scalars in dataset from suff stats. Used for normalizing the ELBO so it has reasonable range. Returns --------- s : scalar positive integer
Get number of observed scalars in dataset from suff stats.
[ "Get", "number", "of", "observed", "scalars", "in", "dataset", "from", "suff", "stats", "." ]
def getDatasetScale(self, SS): ''' Get number of observed scalars in dataset from suff stats. Used for normalizing the ELBO so it has reasonable range. Returns --------- s : scalar positive integer ''' return SS.N.sum() * SS.D
[ "def", "getDatasetScale", "(", "self", ",", "SS", ")", ":", "return", "SS", ".", "N", ".", "sum", "(", ")", "*", "SS", ".", "D" ]
https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/obsmodel/ZeroMeanGaussObsModel.py#L463-L472
vsjha18/nsetools
b0e99c8decac0cba0bc19427428fd2d7b8836eaf
datemgr.py
python
get_nearest_business_day
(d)
takes datetime object
takes datetime object
[ "takes", "datetime", "object" ]
def get_nearest_business_day(d): """ takes datetime object""" if d.isoweekday() is 7 or d.isoweekday() is 6: d = d - relativedelta(days=1) return get_nearest_business_day(d) # republic day elif d.month is 1 and d.day is 26: d = d - relativedelta(days=1) return get_neares...
[ "def", "get_nearest_business_day", "(", "d", ")", ":", "if", "d", ".", "isoweekday", "(", ")", "is", "7", "or", "d", ".", "isoweekday", "(", ")", "is", "6", ":", "d", "=", "d", "-", "relativedelta", "(", "days", "=", "1", ")", "return", "get_neares...
https://github.com/vsjha18/nsetools/blob/b0e99c8decac0cba0bc19427428fd2d7b8836eaf/datemgr.py#L8-L35
largelymfs/topical_word_embeddings
1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6
TWE-3/gensim/corpora/hashdictionary.py
python
HashDictionary.__len__
(self)
return self.id_range
Return the number of distinct ids = the entire dictionary size.
Return the number of distinct ids = the entire dictionary size.
[ "Return", "the", "number", "of", "distinct", "ids", "=", "the", "entire", "dictionary", "size", "." ]
def __len__(self): """ Return the number of distinct ids = the entire dictionary size. """ return self.id_range
[ "def", "__len__", "(", "self", ")", ":", "return", "self", ".", "id_range" ]
https://github.com/largelymfs/topical_word_embeddings/blob/1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6/TWE-3/gensim/corpora/hashdictionary.py#L97-L101
NetEaseGame/ATX
f4415c57b45cb0730e08899cbc92a2af1c047ffb
atx/drivers/mixin.py
python
DeviceMixin.click_image
(self, pattern, timeout=20.0, action='click', safe=False, desc=None, delay=None, **match_kwargs)
return point
Simulate click according image position Args: - pattern (str or Pattern): filename or an opencv image object. - timeout (float): if image not found during this time, ImageNotFoundError will raise. - action (str): click or long_click - safe (bool): if safe is True...
Simulate click according image position
[ "Simulate", "click", "according", "image", "position" ]
def click_image(self, pattern, timeout=20.0, action='click', safe=False, desc=None, delay=None, **match_kwargs): """Simulate click according image position Args: - pattern (str or Pattern): filename or an opencv image object. - timeout (float): if image not found during this tim...
[ "def", "click_image", "(", "self", ",", "pattern", ",", "timeout", "=", "20.0", ",", "action", "=", "'click'", ",", "safe", "=", "False", ",", "desc", "=", "None", ",", "delay", "=", "None", ",", "*", "*", "match_kwargs", ")", ":", "pattern", "=", ...
https://github.com/NetEaseGame/ATX/blob/f4415c57b45cb0730e08899cbc92a2af1c047ffb/atx/drivers/mixin.py#L503-L555
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/idlelib/searchengine.py
python
SearchEngine.getcookedpat
(self)
return pat
[]
def getcookedpat(self): pat = self.getpat() if not self.isre(): # if True, see setcookedpat pat = re.escape(pat) if self.isword(): pat = r"\b%s\b" % pat return pat
[ "def", "getcookedpat", "(", "self", ")", ":", "pat", "=", "self", ".", "getpat", "(", ")", "if", "not", "self", ".", "isre", "(", ")", ":", "# if True, see setcookedpat", "pat", "=", "re", ".", "escape", "(", "pat", ")", "if", "self", ".", "isword", ...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/idlelib/searchengine.py#L67-L73
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
src/outwiker/gui/controls/ultimatelistctrl.py
python
UltimateListMainWindow.GetSubItemRect
(self, item, subItem)
return rect
Returns the rectangle representing the size and position, in physical coordinates, of the given subitem, i.e. the part of the row `item` in the column `subItem`. :param `item`: the row in which the item lives; :param `subItem`: the column in which the item lives. If set equal to the special ...
Returns the rectangle representing the size and position, in physical coordinates, of the given subitem, i.e. the part of the row `item` in the column `subItem`.
[ "Returns", "the", "rectangle", "representing", "the", "size", "and", "position", "in", "physical", "coordinates", "of", "the", "given", "subitem", "i", ".", "e", ".", "the", "part", "of", "the", "row", "item", "in", "the", "column", "subItem", "." ]
def GetSubItemRect(self, item, subItem): """ Returns the rectangle representing the size and position, in physical coordinates, of the given subitem, i.e. the part of the row `item` in the column `subItem`. :param `item`: the row in which the item lives; :param `subItem`: the co...
[ "def", "GetSubItemRect", "(", "self", ",", "item", ",", "subItem", ")", ":", "if", "not", "self", ".", "InReportView", "(", ")", "and", "subItem", "==", "ULC_GETSUBITEMRECT_WHOLEITEM", ":", "raise", "Exception", "(", "\"GetSubItemRect only meaningful in report view\...
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L9509-L9546
behave/behave
e6364fe3d62c2befe34bc56471cfb317a218cd01
behave/matchers.py
python
Matcher.regex_pattern
(self)
return self.pattern
Return the used textual regex pattern.
Return the used textual regex pattern.
[ "Return", "the", "used", "textual", "regex", "pattern", "." ]
def regex_pattern(self): """Return the used textual regex pattern.""" # -- ASSUMPTION: pattern attribute provides regex-pattern # NOTE: Method must be overridden if assumption is not met. return self.pattern
[ "def", "regex_pattern", "(", "self", ")", ":", "# -- ASSUMPTION: pattern attribute provides regex-pattern", "# NOTE: Method must be overridden if assumption is not met.", "return", "self", ".", "pattern" ]
https://github.com/behave/behave/blob/e6364fe3d62c2befe34bc56471cfb317a218cd01/behave/matchers.py#L177-L181
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/fallback_lib_py352/asyncio/sslproto.py
python
_SSLPipe.feed_eof
(self)
Send a potentially "ragged" EOF. This method will raise an SSL_ERROR_EOF exception if the EOF is unexpected.
Send a potentially "ragged" EOF.
[ "Send", "a", "potentially", "ragged", "EOF", "." ]
def feed_eof(self): """Send a potentially "ragged" EOF. This method will raise an SSL_ERROR_EOF exception if the EOF is unexpected. """ self._incoming.write_eof() ssldata, appdata = self.feed_ssldata(b'') assert appdata == [] or appdata == [b'']
[ "def", "feed_eof", "(", "self", ")", ":", "self", ".", "_incoming", ".", "write_eof", "(", ")", "ssldata", ",", "appdata", "=", "self", ".", "feed_ssldata", "(", "b''", ")", "assert", "appdata", "==", "[", "]", "or", "appdata", "==", "[", "b''", "]" ...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/fallback_lib_py352/asyncio/sslproto.py#L147-L155
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/tomlkit/exceptions.py
python
ParseError.line
(self)
return self._line
[]
def line(self): return self._line
[ "def", "line", "(", "self", ")", ":", "return", "self", ".", "_line" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/tomlkit/exceptions.py#L32-L33
wbond/package_control
cfaaeb57612023e3679ecb7f8cd7ceac9f57990d
package_control/deps/asn1crypto/ocsp.py
python
Request.critical_extensions
(self)
return self._critical_extensions
Returns a set of the names (or OID if not a known extension) of the extensions marked as critical :return: A set of unicode strings
Returns a set of the names (or OID if not a known extension) of the extensions marked as critical
[ "Returns", "a", "set", "of", "the", "names", "(", "or", "OID", "if", "not", "a", "known", "extension", ")", "of", "the", "extensions", "marked", "as", "critical" ]
def critical_extensions(self): """ Returns a set of the names (or OID if not a known extension) of the extensions marked as critical :return: A set of unicode strings """ if not self._processed_extensions: self._set_extensions() return se...
[ "def", "critical_extensions", "(", "self", ")", ":", "if", "not", "self", ".", "_processed_extensions", ":", "self", ".", "_set_extensions", "(", ")", "return", "self", ".", "_critical_extensions" ]
https://github.com/wbond/package_control/blob/cfaaeb57612023e3679ecb7f8cd7ceac9f57990d/package_control/deps/asn1crypto/ocsp.py#L114-L125
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/mailbox.py
python
Mailbox.unlock
(self)
Unlock the mailbox if it is locked.
Unlock the mailbox if it is locked.
[ "Unlock", "the", "mailbox", "if", "it", "is", "locked", "." ]
def unlock(self): """Unlock the mailbox if it is locked.""" raise NotImplementedError('Method must be implemented by subclass')
[ "def", "unlock", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'Method must be implemented by subclass'", ")" ]
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/mailbox.py#L188-L190
tensorflow/datasets
2e496976d7d45550508395fb2f35cf958c8a3414
tensorflow_datasets/core/as_dataframe.py
python
_get_feature
( path: Tuple[str, ...], feature: features.FeatureConnector, )
return feature, sequence_rank
Recursively extracts the feature and sequence rank (plain, ragged, ...).
Recursively extracts the feature and sequence rank (plain, ragged, ...).
[ "Recursively", "extracts", "the", "feature", "and", "sequence", "rank", "(", "plain", "ragged", "...", ")", "." ]
def _get_feature( path: Tuple[str, ...], feature: features.FeatureConnector, ) -> Tuple[features.FeatureConnector, int]: """Recursively extracts the feature and sequence rank (plain, ragged, ...).""" sequence_rank = 0 # Collapse the nested sequences while isinstance(feature, features.Sequence): # S...
[ "def", "_get_feature", "(", "path", ":", "Tuple", "[", "str", ",", "...", "]", ",", "feature", ":", "features", ".", "FeatureConnector", ",", ")", "->", "Tuple", "[", "features", ".", "FeatureConnector", ",", "int", "]", ":", "sequence_rank", "=", "0", ...
https://github.com/tensorflow/datasets/blob/2e496976d7d45550508395fb2f35cf958c8a3414/tensorflow_datasets/core/as_dataframe.py#L97-L122
broadinstitute/viral-ngs
e144969e4c57060d53f38a4c3a270e8227feace1
util/file.py
python
mkdir_p
(dirpath)
Verify that the directory given exists, and if not, create it.
Verify that the directory given exists, and if not, create it.
[ "Verify", "that", "the", "directory", "given", "exists", "and", "if", "not", "create", "it", "." ]
def mkdir_p(dirpath): ''' Verify that the directory given exists, and if not, create it. ''' try: os.makedirs(dirpath) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(dirpath): pass else: raise
[ "def", "mkdir_p", "(", "dirpath", ")", ":", "try", ":", "os", ".", "makedirs", "(", "dirpath", ")", "except", "OSError", "as", "exc", ":", "# Python >2.5", "if", "exc", ".", "errno", "==", "errno", ".", "EEXIST", "and", "os", ".", "path", ".", "isdir...
https://github.com/broadinstitute/viral-ngs/blob/e144969e4c57060d53f38a4c3a270e8227feace1/util/file.py#L311-L320
jbjorne/TEES
caf19a4a1352ac59f5dc13a8684cc42ce4342d9d
Utils/Connection/UnixConnection.py
python
UnixConnection.addCommand
(self, string)
[]
def addCommand(self, string): self.commands.append(string)
[ "def", "addCommand", "(", "self", ",", "string", ")", ":", "self", ".", "commands", ".", "append", "(", "string", ")" ]
https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/Utils/Connection/UnixConnection.py#L278-L279
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.3/django/db/backends/creation.py
python
BaseDatabaseCreation.sql_for_pending_references
(self, model, style, pending_references)
return final_output
Returns any ALTER TABLE statements to add constraints after the fact.
Returns any ALTER TABLE statements to add constraints after the fact.
[ "Returns", "any", "ALTER", "TABLE", "statements", "to", "add", "constraints", "after", "the", "fact", "." ]
def sql_for_pending_references(self, model, style, pending_references): "Returns any ALTER TABLE statements to add constraints after the fact." from django.db.backends.util import truncate_name if not model._meta.managed or model._meta.proxy: return [] qn = self.connection.o...
[ "def", "sql_for_pending_references", "(", "self", ",", "model", ",", "style", ",", "pending_references", ")", ":", "from", "django", ".", "db", ".", "backends", ".", "util", "import", "truncate_name", "if", "not", "model", ".", "_meta", ".", "managed", "or",...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/db/backends/creation.py#L109-L133
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/tornado/httputil.py
python
parse_request_start_line
(line: str)
return RequestStartLine(method, path, version)
Returns a (method, path, version) tuple for an HTTP 1.x request line. The response is a `collections.namedtuple`. >>> parse_request_start_line("GET /foo HTTP/1.1") RequestStartLine(method='GET', path='/foo', version='HTTP/1.1')
Returns a (method, path, version) tuple for an HTTP 1.x request line.
[ "Returns", "a", "(", "method", "path", "version", ")", "tuple", "for", "an", "HTTP", "1", ".", "x", "request", "line", "." ]
def parse_request_start_line(line: str) -> RequestStartLine: """Returns a (method, path, version) tuple for an HTTP 1.x request line. The response is a `collections.namedtuple`. >>> parse_request_start_line("GET /foo HTTP/1.1") RequestStartLine(method='GET', path='/foo', version='HTTP/1.1') """ ...
[ "def", "parse_request_start_line", "(", "line", ":", "str", ")", "->", "RequestStartLine", ":", "try", ":", "method", ",", "path", ",", "version", "=", "line", ".", "split", "(", "\" \"", ")", "except", "ValueError", ":", "# https://tools.ietf.org/html/rfc7230#s...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/tornado/httputil.py#L899-L917
pygments/pygments
cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7
pygments/lexers/__init__.py
python
_iter_lexerclasses
(plugins=True)
Return an iterator over all lexer classes.
Return an iterator over all lexer classes.
[ "Return", "an", "iterator", "over", "all", "lexer", "classes", "." ]
def _iter_lexerclasses(plugins=True): """Return an iterator over all lexer classes.""" for key in sorted(LEXERS): module_name, name = LEXERS[key][:2] if name not in _lexer_cache: _load_lexers(module_name) yield _lexer_cache[name] if plugins: yield from find_plugin...
[ "def", "_iter_lexerclasses", "(", "plugins", "=", "True", ")", ":", "for", "key", "in", "sorted", "(", "LEXERS", ")", ":", "module_name", ",", "name", "=", "LEXERS", "[", "key", "]", "[", ":", "2", "]", "if", "name", "not", "in", "_lexer_cache", ":",...
https://github.com/pygments/pygments/blob/cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7/pygments/lexers/__init__.py#L229-L237