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
microsoft/debugpy
be8dd607f6837244e0b565345e497aff7a0c08bf
src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/process.py
python
Process.search
(self, pattern, minAddr = None, maxAddr = None)
Search for the given pattern within the process memory. @type pattern: str, compat.unicode or L{Pattern} @param pattern: Pattern to search for. It may be a byte string, a Unicode string, or an instance of L{Pattern}. The following L{Pattern} subclasses are provided...
Search for the given pattern within the process memory.
[ "Search", "for", "the", "given", "pattern", "within", "the", "process", "memory", "." ]
def search(self, pattern, minAddr = None, maxAddr = None): """ Search for the given pattern within the process memory. @type pattern: str, compat.unicode or L{Pattern} @param pattern: Pattern to search for. It may be a byte string, a Unicode string, or an instance of ...
[ "def", "search", "(", "self", ",", "pattern", ",", "minAddr", "=", "None", ",", "maxAddr", "=", "None", ")", ":", "if", "isinstance", "(", "pattern", ",", "str", ")", ":", "return", "self", ".", "search_bytes", "(", "pattern", ",", "minAddr", ",", "m...
https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/process.py#L1355-L1395
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/lib-tk/turtle.py
python
TurtleScreen.delay
(self, delay=None)
Return or set the drawing delay in milliseconds. Optional argument: delay -- positive integer Example (for a TurtleScreen instance named screen): >>> screen.delay(15) >>> screen.delay() 15
Return or set the drawing delay in milliseconds.
[ "Return", "or", "set", "the", "drawing", "delay", "in", "milliseconds", "." ]
def delay(self, delay=None): """ Return or set the drawing delay in milliseconds. Optional argument: delay -- positive integer Example (for a TurtleScreen instance named screen): >>> screen.delay(15) >>> screen.delay() 15 """ if delay is None: ...
[ "def", "delay", "(", "self", ",", "delay", "=", "None", ")", ":", "if", "delay", "is", "None", ":", "return", "self", ".", "_delayvalue", "self", ".", "_delayvalue", "=", "int", "(", "delay", ")" ]
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/lib-tk/turtle.py#L1220-L1233
capitalone/datacompy
8418a5c55fa7648764c0bca87931cf778dc19d48
datacompy/core.py
python
Compare._dataframe_merge
(self, ignore_spaces)
Merge df1 to df2 on the join columns, to get df1 - df2, df2 - df1 and df1 & df2 If ``on_index`` is True, this will join on index values, otherwise it will join on the ``join_columns``.
Merge df1 to df2 on the join columns, to get df1 - df2, df2 - df1 and df1 & df2
[ "Merge", "df1", "to", "df2", "on", "the", "join", "columns", "to", "get", "df1", "-", "df2", "df2", "-", "df1", "and", "df1", "&", "df2" ]
def _dataframe_merge(self, ignore_spaces): """Merge df1 to df2 on the join columns, to get df1 - df2, df2 - df1 and df1 & df2 If ``on_index`` is True, this will join on index values, otherwise it will join on the ``join_columns``. """ LOG.debug("Outer joining") ...
[ "def", "_dataframe_merge", "(", "self", ",", "ignore_spaces", ")", ":", "LOG", ".", "debug", "(", "\"Outer joining\"", ")", "if", "self", ".", "_any_dupes", ":", "LOG", ".", "debug", "(", "\"Duplicate rows found, deduping by order of remaining fields\"", ")", "# Bri...
https://github.com/capitalone/datacompy/blob/8418a5c55fa7648764c0bca87931cf778dc19d48/datacompy/core.py#L234-L319
ChineseGLUE/ChineseGLUE
1591b85cf5427c2ff60f718d359ecb71d2b44879
baselines/models/albert/modeling.py
python
assert_rank
(tensor, expected_rank, name=None)
Raises an exception if the tensor rank is not of the expected rank. Args: tensor: A tf.Tensor to check the rank of. expected_rank: Python integer or list of integers, expected rank. name: Optional name of the tensor for the error message. Raises: ValueError: If the expected shape doesn't match the...
Raises an exception if the tensor rank is not of the expected rank.
[ "Raises", "an", "exception", "if", "the", "tensor", "rank", "is", "not", "of", "the", "expected", "rank", "." ]
def assert_rank(tensor, expected_rank, name=None): """Raises an exception if the tensor rank is not of the expected rank. Args: tensor: A tf.Tensor to check the rank of. expected_rank: Python integer or list of integers, expected rank. name: Optional name of the tensor for the error message. Raises:...
[ "def", "assert_rank", "(", "tensor", ",", "expected_rank", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "tensor", ".", "name", "expected_rank_dict", "=", "{", "}", "if", "isinstance", "(", "expected_rank", ",", "six",...
https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/albert/modeling.py#L1045-L1072
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/threading.py
python
Semaphore
(*args, **kwargs)
return _Semaphore(*args, **kwargs)
A factory function that returns a new semaphore. Semaphores manage a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defau...
A factory function that returns a new semaphore.
[ "A", "factory", "function", "that", "returns", "a", "new", "semaphore", "." ]
def Semaphore(*args, **kwargs): """A factory function that returns a new semaphore. Semaphores manage a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter ...
[ "def", "Semaphore", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_Semaphore", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/threading.py#L412-L421
py2neo-org/py2neo
2e46bbf4d622f53282e796ffc521fc4bc6d0b60d
py2neo/client/__init__.py
python
ConnectionPool._connect
(self)
return cx
Open and return a new connection.
Open and return a new connection.
[ "Open", "and", "return", "a", "new", "connection", "." ]
def _connect(self): """ Open and return a new connection. """ cx = Connection.open(self.profile, user_agent=self.user_agent, on_release=lambda c: self.release(c), on_broken=lambda msg: self.__on_broken(msg)) self._server_agent = c...
[ "def", "_connect", "(", "self", ")", ":", "cx", "=", "Connection", ".", "open", "(", "self", ".", "profile", ",", "user_agent", "=", "self", ".", "user_agent", ",", "on_release", "=", "lambda", "c", ":", "self", ".", "release", "(", "c", ")", ",", ...
https://github.com/py2neo-org/py2neo/blob/2e46bbf4d622f53282e796ffc521fc4bc6d0b60d/py2neo/client/__init__.py#L761-L768
tomoncle/Python-notes
ce675486290c3d1c7c2e4890b57e3d0c8a1228cc
crawlers/spider/downloader.py
python
HtmlDownloader.download
(self, url, retry=-1)
return content if code == 200 else ''
:param url: :param retry: 失败重试 :return:
:param url: :param retry: 失败重试 :return:
[ ":", "param", "url", ":", ":", "param", "retry", ":", "失败重试", ":", "return", ":" ]
def download(self, url, retry=-1): """ :param url: :param retry: 失败重试 :return: """ code, content = self._request(url) if retry > 0 and code != 200: self.download(url, retry - 1) return content if code == 200 else ''
[ "def", "download", "(", "self", ",", "url", ",", "retry", "=", "-", "1", ")", ":", "code", ",", "content", "=", "self", ".", "_request", "(", "url", ")", "if", "retry", ">", "0", "and", "code", "!=", "200", ":", "self", ".", "download", "(", "u...
https://github.com/tomoncle/Python-notes/blob/ce675486290c3d1c7c2e4890b57e3d0c8a1228cc/crawlers/spider/downloader.py#L60-L69
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/importlib/_bootstrap_external.py
python
_path_join
(*path_parts)
return path_sep.join([part.rstrip(path_separators) for part in path_parts if part])
Replacement for os.path.join().
Replacement for os.path.join().
[ "Replacement", "for", "os", ".", "path", ".", "join", "()", "." ]
def _path_join(*path_parts): """Replacement for os.path.join().""" return path_sep.join([part.rstrip(path_separators) for part in path_parts if part])
[ "def", "_path_join", "(", "*", "path_parts", ")", ":", "return", "path_sep", ".", "join", "(", "[", "part", ".", "rstrip", "(", "path_separators", ")", "for", "part", "in", "path_parts", "if", "part", "]", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/importlib/_bootstrap_external.py#L62-L65
Bitmessage/PyBitmessage
97612b049e0453867d6d90aa628f8e7b007b4d85
src/shared.py
python
reloadBroadcastSendersForWhichImWatching
()
Reinitialize runtime data for the broadcasts I'm subscribed to from the config file
Reinitialize runtime data for the broadcasts I'm subscribed to from the config file
[ "Reinitialize", "runtime", "data", "for", "the", "broadcasts", "I", "m", "subscribed", "to", "from", "the", "config", "file" ]
def reloadBroadcastSendersForWhichImWatching(): """ Reinitialize runtime data for the broadcasts I'm subscribed to from the config file """ broadcastSendersForWhichImWatching.clear() MyECSubscriptionCryptorObjects.clear() queryreturn = sqlQuery('SELECT address FROM subscriptions where enable...
[ "def", "reloadBroadcastSendersForWhichImWatching", "(", ")", ":", "broadcastSendersForWhichImWatching", ".", "clear", "(", ")", "MyECSubscriptionCryptorObjects", ".", "clear", "(", ")", "queryreturn", "=", "sqlQuery", "(", "'SELECT address FROM subscriptions where enabled=1'", ...
https://github.com/Bitmessage/PyBitmessage/blob/97612b049e0453867d6d90aa628f8e7b007b4d85/src/shared.py#L150-L184
harpribot/deep-summarization
9b3bb1daae11a1db2386dbe4a71848714e6127f8
models/stacked_bidirectional.py
python
StackedBidirectional._load_optimizer
(self)
Load the SGD optimizer :return: None
Load the SGD optimizer
[ "Load", "the", "SGD", "optimizer" ]
def _load_optimizer(self): """ Load the SGD optimizer :return: None """ # loss function with tf.variable_scope("forward"): self.loss_fwd = tf.nn.seq2seq.sequence_loss(self.dec_outputs_fwd, self.labels, s...
[ "def", "_load_optimizer", "(", "self", ")", ":", "# loss function", "with", "tf", ".", "variable_scope", "(", "\"forward\"", ")", ":", "self", ".", "loss_fwd", "=", "tf", ".", "nn", ".", "seq2seq", ".", "sequence_loss", "(", "self", ".", "dec_outputs_fwd", ...
https://github.com/harpribot/deep-summarization/blob/9b3bb1daae11a1db2386dbe4a71848714e6127f8/models/stacked_bidirectional.py#L200-L221
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/smhi/config_flow.py
python
SmhiFlowHandler.async_step_user
( self, user_input: dict[str, Any] | None = None )
return await self._show_config_form()
Handle a flow initialized by the user.
Handle a flow initialized by the user.
[ "Handle", "a", "flow", "initialized", "by", "the", "user", "." ]
async def async_step_user( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle a flow initialized by the user.""" self._errors = {} if user_input is not None: is_ok = await self._check_location( user_input[CONF_LONGITUDE], user_input...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "self", ".", "_errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/smhi/config_flow.py#L38-L75
garethdmm/gryphon
73e19fa2d0b64c3fc7dac9e0036fc92e25e5b694
gryphon/lib/analysis/legacy/volatility.py
python
get_daily_core_fv_series_in_period
(db, start_time, end_time)
return fundamental_value_series
Get the daily close-close price series in this period from our core fv datums. NOTE that we use close prices for this series, not open prices like for hourly. Getting this series for the period [Nov 1st, Nov 4th) will give you three datapoints.
Get the daily close-close price series in this period from our core fv datums. NOTE that we use close prices for this series, not open prices like for hourly. Getting this series for the period [Nov 1st, Nov 4th) will give you three datapoints.
[ "Get", "the", "daily", "close", "-", "close", "price", "series", "in", "this", "period", "from", "our", "core", "fv", "datums", ".", "NOTE", "that", "we", "use", "close", "prices", "for", "this", "series", "not", "open", "prices", "like", "for", "hourly"...
def get_daily_core_fv_series_in_period(db, start_time, end_time): """ Get the daily close-close price series in this period from our core fv datums. NOTE that we use close prices for this series, not open prices like for hourly. Getting this series for the period [Nov 1st, Nov 4th) will give you three ...
[ "def", "get_daily_core_fv_series_in_period", "(", "db", ",", "start_time", ",", "end_time", ")", ":", "fundamental_value_series", "=", "[", "]", "# Getting the absolute last core_fv datum in a series of periods efficiently is", "# difficult, so this query gets the first datum in the la...
https://github.com/garethdmm/gryphon/blob/73e19fa2d0b64c3fc7dac9e0036fc92e25e5b694/gryphon/lib/analysis/legacy/volatility.py#L223-L254
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/gdata/src/gdata/tlslite/integration/AsyncStateMachine.py
python
AsyncStateMachine.setServerHandshakeOp
(self, **args)
Start a handshake operation. The arguments passed to this function will be forwarded to L{tlslite.TLSConnection.TLSConnection.handshakeServerAsync}.
Start a handshake operation.
[ "Start", "a", "handshake", "operation", "." ]
def setServerHandshakeOp(self, **args): """Start a handshake operation. The arguments passed to this function will be forwarded to L{tlslite.TLSConnection.TLSConnection.handshakeServerAsync}. """ handshaker = self.tlsConnection.handshakeServerAsync(**args) self.setHandsh...
[ "def", "setServerHandshakeOp", "(", "self", ",", "*", "*", "args", ")", ":", "handshaker", "=", "self", ".", "tlsConnection", ".", "handshakeServerAsync", "(", "*", "*", "args", ")", "self", ".", "setHandshakeOp", "(", "handshaker", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/tlslite/integration/AsyncStateMachine.py#L202-L209
cgre-aachen/gempy
6ad16c46fc6616c9f452fba85d31ce32decd8b10
gempy/plot/_vista.py
python
Vista.plot_surfaces
(self, fmts: Iterable[str] = None, **kwargs)
return meshes
Plot all geomodel surfaces. If given an iterable containing surface strings, it will plot all surfaces specified in it. Args: fmts (List[str], optional): Names of surfaces to plot. Defaults to None.
Plot all geomodel surfaces. If given an iterable containing surface strings, it will plot all surfaces specified in it. Args: fmts (List[str], optional): Names of surfaces to plot. Defaults to None.
[ "Plot", "all", "geomodel", "surfaces", ".", "If", "given", "an", "iterable", "containing", "surface", "strings", "it", "will", "plot", "all", "surfaces", "specified", "in", "it", ".", "Args", ":", "fmts", "(", "List", "[", "str", "]", "optional", ")", ":...
def plot_surfaces(self, fmts: Iterable[str] = None, **kwargs): """Plot all geomodel surfaces. If given an iterable containing surface strings, it will plot all surfaces specified in it. Args: fmts (List[str], optional): Names of surfaces to plot. Defaults to...
[ "def", "plot_surfaces", "(", "self", ",", "fmts", ":", "Iterable", "[", "str", "]", "=", "None", ",", "*", "*", "kwargs", ")", ":", "colors", "=", "self", ".", "_get_color_lot", "(", ")", "meshes", "=", "[", "]", "if", "fmts", "is", "None", ":", ...
https://github.com/cgre-aachen/gempy/blob/6ad16c46fc6616c9f452fba85d31ce32decd8b10/gempy/plot/_vista.py#L739-L756
amimo/dcc
114326ab5a082a42c7728a375726489e4709ca29
androguard/decompiler/dad/control_flow.py
python
derived_sequence
(graph)
return deriv_seq, deriv_interv
Compute the derived sequence of the graph G The intervals of G are collapsed into nodes, intervals of these nodes are built, and the process is repeated iteratively until we obtain a single node (if the graph is not irreducible)
Compute the derived sequence of the graph G The intervals of G are collapsed into nodes, intervals of these nodes are built, and the process is repeated iteratively until we obtain a single node (if the graph is not irreducible)
[ "Compute", "the", "derived", "sequence", "of", "the", "graph", "G", "The", "intervals", "of", "G", "are", "collapsed", "into", "nodes", "intervals", "of", "these", "nodes", "are", "built", "and", "the", "process", "is", "repeated", "iteratively", "until", "w...
def derived_sequence(graph): """ Compute the derived sequence of the graph G The intervals of G are collapsed into nodes, intervals of these nodes are built, and the process is repeated iteratively until we obtain a single node (if the graph is not irreducible) """ deriv_seq = [graph] de...
[ "def", "derived_sequence", "(", "graph", ")", ":", "deriv_seq", "=", "[", "graph", "]", "deriv_interv", "=", "[", "]", "single_node", "=", "False", "while", "not", "single_node", ":", "interv_graph", ",", "interv_heads", "=", "intervals", "(", "graph", ")", ...
https://github.com/amimo/dcc/blob/114326ab5a082a42c7728a375726489e4709ca29/androguard/decompiler/dad/control_flow.py#L86-L109
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/onnx/convert.py
python
export
( tokenizer: PreTrainedTokenizer, model: PreTrainedModel, config: OnnxConfig, opset: int, output: Path )
return matched_inputs, onnx_outputs
Export a PyTorch backed pipeline to ONNX Intermediate Representation (IR Args: tokenizer: model: config: opset: output: Returns:
Export a PyTorch backed pipeline to ONNX Intermediate Representation (IR
[ "Export", "a", "PyTorch", "backed", "pipeline", "to", "ONNX", "Intermediate", "Representation", "(", "IR" ]
def export( tokenizer: PreTrainedTokenizer, model: PreTrainedModel, config: OnnxConfig, opset: int, output: Path ) -> Tuple[List[str], List[str]]: """ Export a PyTorch backed pipeline to ONNX Intermediate Representation (IR Args: tokenizer: model: config: opset: ...
[ "def", "export", "(", "tokenizer", ":", "PreTrainedTokenizer", ",", "model", ":", "PreTrainedModel", ",", "config", ":", "OnnxConfig", ",", "opset", ":", "int", ",", "output", ":", "Path", ")", "->", "Tuple", "[", "List", "[", "str", "]", ",", "List", ...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/onnx/convert.py#L65-L131
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_scale.py
python
Yedit.exists
(self, path, value)
return entry == value
check if value exists at path
check if value exists at path
[ "check", "if", "value", "exists", "at", "path" ]
def exists(self, path, value): ''' check if value exists at path''' try: entry = Yedit.get_entry(self.yaml_dict, path, self.separator) except KeyError: entry = None if isinstance(entry, list): if value in entry: return True ...
[ "def", "exists", "(", "self", ",", "path", ",", "value", ")", ":", "try", ":", "entry", "=", "Yedit", ".", "get_entry", "(", "self", ".", "yaml_dict", ",", "path", ",", "self", ".", "separator", ")", "except", "KeyError", ":", "entry", "=", "None", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_scale.py#L496-L521
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/clients/client.py
python
BotClient.load_trigger_manager
(self)
[]
def load_trigger_manager(self): if self._configuration.client_configuration.triggers is not None: YLogger.debug(None, "Loading Trigger Manager") self._trigger_mgr = TriggerManager.load_trigger_manager(self._configuration.client_configuration.triggers)
[ "def", "load_trigger_manager", "(", "self", ")", ":", "if", "self", ".", "_configuration", ".", "client_configuration", ".", "triggers", "is", "not", "None", ":", "YLogger", ".", "debug", "(", "None", ",", "\"Loading Trigger Manager\"", ")", "self", ".", "_tri...
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/clients/client.py#L235-L238
Textualize/rich
d39626143036188cb2c9e1619e836540f5b627f8
rich/pretty.py
python
_get_attr_fields
(obj: Any)
return _attr_module.fields(type(obj)) if _attr_module is not None else []
Get fields for an attrs object.
Get fields for an attrs object.
[ "Get", "fields", "for", "an", "attrs", "object", "." ]
def _get_attr_fields(obj: Any) -> Iterable["_attr_module.Attribute[Any]"]: """Get fields for an attrs object.""" return _attr_module.fields(type(obj)) if _attr_module is not None else []
[ "def", "_get_attr_fields", "(", "obj", ":", "Any", ")", "->", "Iterable", "[", "\"_attr_module.Attribute[Any]\"", "]", ":", "return", "_attr_module", ".", "fields", "(", "type", "(", "obj", ")", ")", "if", "_attr_module", "is", "not", "None", "else", "[", ...
https://github.com/Textualize/rich/blob/d39626143036188cb2c9e1619e836540f5b627f8/rich/pretty.py#L61-L63
sqlmapproject/sqlmap
3b07b70864624dff4c29dcaa8a61c78e7f9189f7
thirdparty/bottle/bottle.py
python
FileUpload.__init__
(self, fileobj, name, filename, headers=None)
Wrapper for file uploads.
Wrapper for file uploads.
[ "Wrapper", "for", "file", "uploads", "." ]
def __init__(self, fileobj, name, filename, headers=None): """ Wrapper for file uploads. """ #: Open file(-like) object (BytesIO buffer or temporary file) self.file = fileobj #: Name of the upload form field self.name = name #: Raw filename as sent by the client (may cont...
[ "def", "__init__", "(", "self", ",", "fileobj", ",", "name", ",", "filename", ",", "headers", "=", "None", ")", ":", "#: Open file(-like) object (BytesIO buffer or temporary file)", "self", ".", "file", "=", "fileobj", "#: Name of the upload form field", "self", ".", ...
https://github.com/sqlmapproject/sqlmap/blob/3b07b70864624dff4c29dcaa8a61c78e7f9189f7/thirdparty/bottle/bottle.py#L2741-L2750
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/mailbox.py
python
MH.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.""" if self._locked: _unlock_file(self._file) _sync_close(self._file) del self._file self._locked = False
[ "def", "unlock", "(", "self", ")", ":", "if", "self", ".", "_locked", ":", "_unlock_file", "(", "self", ".", "_file", ")", "_sync_close", "(", "self", ".", "_file", ")", "del", "self", ".", "_file", "self", ".", "_locked", "=", "False" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/mailbox.py#L1025-L1031
linuxscout/mishkal
4f4ae0ebc2d6acbeb3de3f0303151ec7b54d2f76
mishkal/tashkeel.py
python
TashkeelClass._ajust_vocalized_result
(self, text)
return text
Ajust the resulted text after vocalization to correct some case like 'meeting of two queiscents = ألتقاء الساكنين' @param text: vocalized text @type text: unicode @return: ajusted text. @rtype: unicode
Ajust the resulted text after vocalization to correct some case like 'meeting of two queiscents = ألتقاء الساكنين'
[ "Ajust", "the", "resulted", "text", "after", "vocalization", "to", "correct", "some", "case", "like", "meeting", "of", "two", "queiscents", "=", "ألتقاء", "الساكنين" ]
def _ajust_vocalized_result(self, text): """ Ajust the resulted text after vocalization to correct some case like 'meeting of two queiscents = ألتقاء الساكنين' @param text: vocalized text @type text: unicode @return: ajusted text. @rtype: unicode """ ...
[ "def", "_ajust_vocalized_result", "(", "self", ",", "text", ")", ":", "# min = > mina", "text", "=", "re", ".", "sub", "(", "u'\\sمِنْ\\s+ا', u' ", "م", "نَ ا', text)", "", "", "", "# man = > mani", "text", "=", "re", ".", "sub", "(", "u'\\sمَنْ\\s+ا', u' ", ...
https://github.com/linuxscout/mishkal/blob/4f4ae0ebc2d6acbeb3de3f0303151ec7b54d2f76/mishkal/tashkeel.py#L510-L536
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/importlib/_bootstrap.py
python
_ModuleLock.has_deadlock
(self)
[]
def has_deadlock(self): # Deadlock avoidance for concurrent circular imports. me = _thread.get_ident() tid = self.owner while True: lock = _blocking_on.get(tid) if lock is None: return False tid = lock.owner if tid == me: ...
[ "def", "has_deadlock", "(", "self", ")", ":", "# Deadlock avoidance for concurrent circular imports.", "me", "=", "_thread", ".", "get_ident", "(", ")", "tid", "=", "self", ".", "owner", "while", "True", ":", "lock", "=", "_blocking_on", ".", "get", "(", "tid"...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/importlib/_bootstrap.py#L66-L76
OpnTec/open-event-server
a48f7e4c6002db6fb4dc06bac6508536a0dc585e
app/models/user.py
python
User.can_create_event
(self)
return True
Checks if User can create an event
Checks if User can create an event
[ "Checks", "if", "User", "can", "create", "an", "event" ]
def can_create_event(self): """Checks if User can create an event """ perm = UserPermission.query.filter_by(name='create_event').first() if not perm: return self.is_verified if self.is_verified is False: return perm.unverified_user return True
[ "def", "can_create_event", "(", "self", ")", ":", "perm", "=", "UserPermission", ".", "query", ".", "filter_by", "(", "name", "=", "'create_event'", ")", ".", "first", "(", ")", "if", "not", "perm", ":", "return", "self", ".", "is_verified", "if", "self"...
https://github.com/OpnTec/open-event-server/blob/a48f7e4c6002db6fb4dc06bac6508536a0dc585e/app/models/user.py#L128-L138
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v8/services/services/carrier_constant_service/client.py
python
CarrierConstantServiceClient.parse_common_project_path
(path: str)
return m.groupdict() if m else {}
Parse a project path into its component segments.
Parse a project path into its component segments.
[ "Parse", "a", "project", "path", "into", "its", "component", "segments", "." ]
def parse_common_project_path(path: str) -> Dict[str, str]: """Parse a project path into its component segments.""" m = re.match(r"^projects/(?P<project>.+?)$", path) return m.groupdict() if m else {}
[ "def", "parse_common_project_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^projects/(?P<project>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdict", "(", ")", "if", ...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/carrier_constant_service/client.py#L215-L218
nadineproject/nadine
c41c8ef7ffe18f1853029c97eecc329039b4af6c
nadine/forms.py
python
ProfileImageForm.save
(self)
[]
def save(self): raw_img_data = self.cleaned_data['cropped_image_data'] if not raw_img_data or len(raw_img_data) == 0: # Nothing to save here return img_data = base64.b64decode(raw_img_data) if self.cleaned_data['username']: user = get_object_or_404(Us...
[ "def", "save", "(", "self", ")", ":", "raw_img_data", "=", "self", ".", "cleaned_data", "[", "'cropped_image_data'", "]", "if", "not", "raw_img_data", "or", "len", "(", "raw_img_data", ")", "==", "0", ":", "# Nothing to save here", "return", "img_data", "=", ...
https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/nadine/forms.py#L305-L325
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/core/tracing.py
python
TLS.__init__
(self)
[]
def __init__(self): self.tracing = False self.indent = 0
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "tracing", "=", "False", "self", ".", "indent", "=", "0" ]
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/tracing.py#L12-L14
nshaud/DeepHyperX
176e582e53df92a6b4014b022c7f67034b489889
utils.py
python
padding_image
(image, patch_size=None, mode="symmetric", constant_values=0)
return padded_image
Padding an input image. Modified at 2020.11.16. If you find any issues, please email at mengxue_zhang@hhu.edu.cn with details. Args: image: 2D+ image with a shape of [h, w, ...], The array to pad patch_size: optional, a list include two integers, default is [1, 1] for pure spectra algor...
Padding an input image. Modified at 2020.11.16. If you find any issues, please email at mengxue_zhang@hhu.edu.cn with details.
[ "Padding", "an", "input", "image", ".", "Modified", "at", "2020", ".", "11", ".", "16", ".", "If", "you", "find", "any", "issues", "please", "email", "at", "mengxue_zhang@hhu", ".", "edu", ".", "cn", "with", "details", "." ]
def padding_image(image, patch_size=None, mode="symmetric", constant_values=0): """Padding an input image. Modified at 2020.11.16. If you find any issues, please email at mengxue_zhang@hhu.edu.cn with details. Args: image: 2D+ image with a shape of [h, w, ...], The array to pad patc...
[ "def", "padding_image", "(", "image", ",", "patch_size", "=", "None", ",", "mode", "=", "\"symmetric\"", ",", "constant_values", "=", "0", ")", ":", "if", "patch_size", "is", "None", ":", "patch_size", "=", "[", "1", ",", "1", "]", "h", "=", "patch_siz...
https://github.com/nshaud/DeepHyperX/blob/176e582e53df92a6b4014b022c7f67034b489889/utils.py#L225-L249
optuna/optuna
2c44c1a405ba059efd53f4b9c8e849d20fb95c0a
optuna/trial/_frozen.py
python
FrozenTrial.suggest_discrete_uniform
(self, name: str, low: float, high: float, q: float)
return self.suggest_float(name, low, high, step=q)
[]
def suggest_discrete_uniform(self, name: str, low: float, high: float, q: float) -> float: return self.suggest_float(name, low, high, step=q)
[ "def", "suggest_discrete_uniform", "(", "self", ",", "name", ":", "str", ",", "low", ":", "float", ",", "high", ":", "float", ",", "q", ":", "float", ")", "->", "float", ":", "return", "self", ".", "suggest_float", "(", "name", ",", "low", ",", "high...
https://github.com/optuna/optuna/blob/2c44c1a405ba059efd53f4b9c8e849d20fb95c0a/optuna/trial/_frozen.py#L249-L251
PowerScript/KatanaFramework
0f6ad90a88de865d58ec26941cb4460501e75496
lib/scapy/scapy/utils6.py
python
in6_cidr2mask
(m)
return ''.join(map(lambda x: struct.pack('!I', x), t))
Return the mask (bitstring) associated with provided length value. For instance if function is called on 48, return value is '\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'.
Return the mask (bitstring) associated with provided length value. For instance if function is called on 48, return value is '\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'.
[ "Return", "the", "mask", "(", "bitstring", ")", "associated", "with", "provided", "length", "value", ".", "For", "instance", "if", "function", "is", "called", "on", "48", "return", "value", "is", "\\", "xff", "\\", "xff", "\\", "xff", "\\", "xff", "\\", ...
def in6_cidr2mask(m): """ Return the mask (bitstring) associated with provided length value. For instance if function is called on 48, return value is '\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'. """ if m > 128 or m < 0: raise Scapy_Exception("value provided ...
[ "def", "in6_cidr2mask", "(", "m", ")", ":", "if", "m", ">", "128", "or", "m", "<", "0", ":", "raise", "Scapy_Exception", "(", "\"value provided to in6_cidr2mask outside [0, 128] domain (%d)\"", "%", "m", ")", "t", "=", "[", "]", "for", "i", "in", "xrange", ...
https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/scapy/scapy/utils6.py#L587-L602
cleverhans-lab/cleverhans
e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d
cleverhans_v3.1.0/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/classification_results.py
python
ResultMatrix.__getitem__
(self, key)
return self._items.get(key, self._default_value)
Returns element of the matrix indexed by given key. Args: key: tuple of (row_idx, column_idx) Returns: Element of the matrix Raises: IndexError: if key is invalid.
Returns element of the matrix indexed by given key.
[ "Returns", "element", "of", "the", "matrix", "indexed", "by", "given", "key", "." ]
def __getitem__(self, key): """Returns element of the matrix indexed by given key. Args: key: tuple of (row_idx, column_idx) Returns: Element of the matrix Raises: IndexError: if key is invalid. """ if not isinstance(key, tuple) or len(key...
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "if", "not", "isinstance", "(", "key", ",", "tuple", ")", "or", "len", "(", "key", ")", "!=", "2", ":", "raise", "IndexError", "(", "\"Invalid index: {0}\"", ".", "format", "(", "key", ")", ")"...
https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans_v3.1.0/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/classification_results.py#L167-L181
thinkle/gourmet
8af29c8ded24528030e5ae2ea3461f61c1e5a575
gourmet/Undo.py
python
MultipleUndoLists.insert
(self,*args,**kwargs)
return self.get_history().insert(*args,**kwargs)
[]
def insert (self,*args,**kwargs): return self.get_history().insert(*args,**kwargs)
[ "def", "insert", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "get_history", "(", ")", ".", "insert", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/Undo.py#L534-L534
stanfordnlp/spinn
f2f95f585328ec5cd7da071753f5e0582e7600a0
python/spinn/models/classifier.py
python
build_transition_cost
(logits, targets, num_transitions)
return cost, acc
Build a parse action prediction cost function.
Build a parse action prediction cost function.
[ "Build", "a", "parse", "action", "prediction", "cost", "function", "." ]
def build_transition_cost(logits, targets, num_transitions): """ Build a parse action prediction cost function. """ # swap seq_length dimension to front so that we can scan per timestep logits = T.swapaxes(logits, 0, 1) targets = targets.T def cost_t(logits, tgt, num_transitions): ...
[ "def", "build_transition_cost", "(", "logits", ",", "targets", ",", "num_transitions", ")", ":", "# swap seq_length dimension to front so that we can scan per timestep", "logits", "=", "T", ".", "swapaxes", "(", "logits", ",", "0", ",", "1", ")", "targets", "=", "ta...
https://github.com/stanfordnlp/spinn/blob/f2f95f585328ec5cd7da071753f5e0582e7600a0/python/spinn/models/classifier.py#L273-L310
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_component_status.py
python
V1ComponentStatus.to_str
(self)
return pprint.pformat(self.to_dict())
Returns the string representation of the model
Returns the string representation of the model
[ "Returns", "the", "string", "representation", "of", "the", "model" ]
def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pprint", ".", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_component_status.py#L184-L186
pydata/patsy
5fc881104b749b720b08e393a5505d6e69d72f95
patsy/compat_ordereddict.py
python
OrderedDict.iteritems
(self)
od.iteritems -> an iterator over the (key, value) items in od
od.iteritems -> an iterator over the (key, value) items in od
[ "od", ".", "iteritems", "-", ">", "an", "iterator", "over", "the", "(", "key", "value", ")", "items", "in", "od" ]
def iteritems(self): 'od.iteritems -> an iterator over the (key, value) items in od' for k in self: yield (k, self[k])
[ "def", "iteritems", "(", "self", ")", ":", "for", "k", "in", "self", ":", "yield", "(", "k", ",", "self", "[", "k", "]", ")" ]
https://github.com/pydata/patsy/blob/5fc881104b749b720b08e393a5505d6e69d72f95/patsy/compat_ordereddict.py#L144-L147
scrapy/scrapy
b04cfa48328d5d5749dca6f50fa34e0cfc664c89
scrapy/utils/defer.py
python
maybe_deferred_to_future
(d: Deferred)
.. versionadded:: VERSION Return *d* as an object that can be awaited from a :ref:`Scrapy callable defined as a coroutine <coroutine-support>`. What you can await in Scrapy callables defined as coroutines depends on the value of :setting:`TWISTED_REACTOR`: - When not using the asyncio reactor, ...
.. versionadded:: VERSION
[ "..", "versionadded", "::", "VERSION" ]
def maybe_deferred_to_future(d: Deferred) -> Union[Deferred, Future]: """ .. versionadded:: VERSION Return *d* as an object that can be awaited from a :ref:`Scrapy callable defined as a coroutine <coroutine-support>`. What you can await in Scrapy callables defined as coroutines depends on the ...
[ "def", "maybe_deferred_to_future", "(", "d", ":", "Deferred", ")", "->", "Union", "[", "Deferred", ",", "Future", "]", ":", "if", "not", "is_asyncio_reactor_installed", "(", ")", ":", "return", "d", "else", ":", "return", "deferred_to_future", "(", "d", ")" ...
https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/utils/defer.py#L204-L232
memray/seq2seq-keyphrase
9145c63ebdc4c3bc431f8091dc52547a46804012
emolga/dataset/build_dataset.py
python
deserialize_from_file_hdf5
(path)
return obj
[]
def deserialize_from_file_hdf5(path): f = open(path, 'r') obj = hickle.load(f) f.close() return obj
[ "def", "deserialize_from_file_hdf5", "(", "path", ")", ":", "f", "=", "open", "(", "path", ",", "'r'", ")", "obj", "=", "hickle", ".", "load", "(", "f", ")", "f", ".", "close", "(", ")", "return", "obj" ]
https://github.com/memray/seq2seq-keyphrase/blob/9145c63ebdc4c3bc431f8091dc52547a46804012/emolga/dataset/build_dataset.py#L58-L62
securityclippy/elasticintel
aa08d3e9f5ab1c000128e95161139ce97ff0e334
whois_lambda/ipwhois/whois.py
python
Whois.get_nets_other
(self, response)
return nets
The function for parsing network blocks from generic whois data. Args: response (:obj:`str`): The response from the whois/rwhois server. Returns: list of dict: Mapping of networks with start and end positions. :: [{ 'cidr' (str)...
The function for parsing network blocks from generic whois data.
[ "The", "function", "for", "parsing", "network", "blocks", "from", "generic", "whois", "data", "." ]
def get_nets_other(self, response): """ The function for parsing network blocks from generic whois data. Args: response (:obj:`str`): The response from the whois/rwhois server. Returns: list of dict: Mapping of networks with start and end positions. ...
[ "def", "get_nets_other", "(", "self", ",", "response", ")", ":", "nets", "=", "[", "]", "# Iterate through all of the networks found, storing the CIDR value", "# and the start and end positions.", "for", "match", "in", "re", ".", "finditer", "(", "r'^(inetnum|inet6num|route...
https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/whois_lambda/ipwhois/whois.py#L508-L578
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/idlelib/ColorDelegator.py
python
_color_delegator
(parent)
[]
def _color_delegator(parent): # htest # from Tkinter import Toplevel, Text from idlelib.Percolator import Percolator top = Toplevel(parent) top.title("Test ColorDelegator") top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, parent.winfo_rooty() + 150)) source = "if s...
[ "def", "_color_delegator", "(", "parent", ")", ":", "# htest #", "from", "Tkinter", "import", "Toplevel", ",", "Text", "from", "idlelib", ".", "Percolator", "import", "Percolator", "top", "=", "Toplevel", "(", "parent", ")", "top", ".", "title", "(", "\"Test...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/idlelib/ColorDelegator.py#L238-L254
gwastro/pycbc
1e1c85534b9dba8488ce42df693230317ca63dea
pycbc/waveform/ringdown.py
python
format_lmns
(lmns)
return out
Checks if the format of the parameter lmns is correct, returning the appropriate format if not, and raise an error if nmodes=0. The required format for the ringdown approximants is a list of lmn modes as a single whitespace-separated string, with n the number of overtones desired. Alternatively, a list...
Checks if the format of the parameter lmns is correct, returning the appropriate format if not, and raise an error if nmodes=0.
[ "Checks", "if", "the", "format", "of", "the", "parameter", "lmns", "is", "correct", "returning", "the", "appropriate", "format", "if", "not", "and", "raise", "an", "error", "if", "nmodes", "=", "0", "." ]
def format_lmns(lmns): """Checks if the format of the parameter lmns is correct, returning the appropriate format if not, and raise an error if nmodes=0. The required format for the ringdown approximants is a list of lmn modes as a single whitespace-separated string, with n the number of overtones ...
[ "def", "format_lmns", "(", "lmns", ")", ":", "# Catch case of lmns given as float (as int injection values are cast", "# to float by pycbc_create_injections), cast to int, then string", "if", "isinstance", "(", "lmns", ",", "float", ")", ":", "lmns", "=", "str", "(", "int", ...
https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/waveform/ringdown.py#L72-L120
zetaops/ulakbus
bcc05abf17bbd6dbeec93809e4ad30885e94e83e
ulakbus/services/personel/hitap/hitap_service.py
python
ZatoHitapService.date_filter_hitap_to_ulakbus
(date_filter_fields, response_payload)
date_filter_ulakbus_to_hitap metodunun tersi icin gereklidir. Args: date_filter_fields (list): Zato servisinde bulunan ve tarih formatinda olan field isimleri listesi response_payload (dict): gonderilen kayit degerleri
date_filter_ulakbus_to_hitap metodunun tersi icin gereklidir.
[ "date_filter_ulakbus_to_hitap", "metodunun", "tersi", "icin", "gereklidir", "." ]
def date_filter_hitap_to_ulakbus(date_filter_fields, response_payload): """ date_filter_ulakbus_to_hitap metodunun tersi icin gereklidir. Args: date_filter_fields (list): Zato servisinde bulunan ve tarih formatinda olan field isimleri listesi response_payloa...
[ "def", "date_filter_hitap_to_ulakbus", "(", "date_filter_fields", ",", "response_payload", ")", ":", "from", "datetime", "import", "datetime", "for", "field", "in", "date_filter_fields", ":", "if", "response_payload", "[", "field", "]", "==", "\"0001-01-01\"", ":", ...
https://github.com/zetaops/ulakbus/blob/bcc05abf17bbd6dbeec93809e4ad30885e94e83e/ulakbus/services/personel/hitap/hitap_service.py#L195-L213
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/priorities/tasks/task.py
python
Task.tasks
(self, tasks)
Set the stack of tasks.
Set the stack of tasks.
[ "Set", "the", "stack", "of", "tasks", "." ]
def tasks(self, tasks): """Set the stack of tasks.""" # check type if tasks is None or (isinstance(tasks, (list, tuple)) and len(tasks) == 0): tasks = [[]] if not isinstance(tasks, (list, tuple)): raise TypeError("Expecting the given 'tasks', to be a list of list ...
[ "def", "tasks", "(", "self", ",", "tasks", ")", ":", "# check type", "if", "tasks", "is", "None", "or", "(", "isinstance", "(", "tasks", ",", "(", "list", ",", "tuple", ")", ")", "and", "len", "(", "tasks", ")", "==", "0", ")", ":", "tasks", "=",...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/priorities/tasks/task.py#L193-L223
olist/correios
5494d7457665fa9a8dffbffa976cdbd2885c54e4
correios/models/user.py
python
AbstractTaxNumber.__eq__
(self, other)
return self.number == self._sanitize(other)
[]
def __eq__(self, other): return self.number == self._sanitize(other)
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "number", "==", "self", ".", "_sanitize", "(", "other", ")" ]
https://github.com/olist/correios/blob/5494d7457665fa9a8dffbffa976cdbd2885c54e4/correios/models/user.py#L82-L83
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/packaging/version.py
python
_parse_letter_version
(letter, number)
[]
def _parse_letter_version(letter, number): if letter: # We consider there to be an implicit 0 in a pre-release if there is # not a numeral associated with it. if number is None: number = 0 # We normalize any letters to their lower case form letter = letter.lower(...
[ "def", "_parse_letter_version", "(", "letter", ",", "number", ")", ":", "if", "letter", ":", "# We consider there to be an implicit 0 in a pre-release if there is", "# not a numeral associated with it.", "if", "number", "is", "None", ":", "number", "=", "0", "# We normalize...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/packaging/version.py#L346-L374
freedomofpress/securedrop
f768a1a5aa37e790077dfd38d6e7a0299a4b3a0f
admin/securedrop_admin/__init__.py
python
get_logs
(args: argparse.Namespace)
return 0
Get logs for forensics and debugging purposes
Get logs for forensics and debugging purposes
[ "Get", "logs", "for", "forensics", "and", "debugging", "purposes" ]
def get_logs(args: argparse.Namespace) -> int: """Get logs for forensics and debugging purposes""" sdlog.info("Gathering logs for forensics and debugging") ansible_cmd = [ 'ansible-playbook', os.path.join(args.ansible_path, 'securedrop-logs.yml'), ] subprocess.check_call(ansible_cmd,...
[ "def", "get_logs", "(", "args", ":", "argparse", ".", "Namespace", ")", "->", "int", ":", "sdlog", ".", "info", "(", "\"Gathering logs for forensics and debugging\"", ")", "ansible_cmd", "=", "[", "'ansible-playbook'", ",", "os", ".", "path", ".", "join", "(",...
https://github.com/freedomofpress/securedrop/blob/f768a1a5aa37e790077dfd38d6e7a0299a4b3a0f/admin/securedrop_admin/__init__.py#L1003-L1013
simonw/djangopeople.net
ed04d3c79d03b9c74f3e7f82b2af944e021f8e15
lib/yadis/discover.py
python
DiscoveryResult.usedYadisLocation
(self)
return self.normalized_uri == self.xrds_uri
Was the Yadis protocol's indirection used?
Was the Yadis protocol's indirection used?
[ "Was", "the", "Yadis", "protocol", "s", "indirection", "used?" ]
def usedYadisLocation(self): """Was the Yadis protocol's indirection used?""" return self.normalized_uri == self.xrds_uri
[ "def", "usedYadisLocation", "(", "self", ")", ":", "return", "self", ".", "normalized_uri", "==", "self", ".", "xrds_uri" ]
https://github.com/simonw/djangopeople.net/blob/ed04d3c79d03b9c74f3e7f82b2af944e021f8e15/lib/yadis/discover.py#L46-L48
openstack/barbican
a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce
barbican/plugin/snakeoil_ca.py
python
SnakeoilCA.pkcs7
(self, val)
[]
def pkcs7(self, val): if self.pkcs7_path: with open(self.pkcs7_path, 'wb') as pkcs7_fh: pkcs7_fh.write(val) else: self._pkcs7_val = val
[ "def", "pkcs7", "(", "self", ",", "val", ")", ":", "if", "self", ".", "pkcs7_path", ":", "with", "open", "(", "self", ".", "pkcs7_path", ",", "'wb'", ")", "as", "pkcs7_fh", ":", "pkcs7_fh", ".", "write", "(", "val", ")", "else", ":", "self", ".", ...
https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/plugin/snakeoil_ca.py#L186-L191
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/requests/adapters.py
python
HTTPAdapter.close
(self)
Disposes of any internal state. Currently, this just closes the PoolManager, which closes pooled connections.
Disposes of any internal state.
[ "Disposes", "of", "any", "internal", "state", "." ]
def close(self): """Disposes of any internal state. Currently, this just closes the PoolManager, which closes pooled connections. """ self.poolmanager.clear()
[ "def", "close", "(", "self", ")", ":", "self", ".", "poolmanager", ".", "clear", "(", ")" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/requests/adapters.py#L264-L270
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/flux_led/light.py
python
FluxLight._async_set_mode
(self, **kwargs: Any)
Set an effect or color mode.
Set an effect or color mode.
[ "Set", "an", "effect", "or", "color", "mode", "." ]
async def _async_set_mode(self, **kwargs: Any) -> None: """Set an effect or color mode.""" brightness = self._async_brightness(**kwargs) # Handle switch to Effect Mode if effect := kwargs.get(ATTR_EFFECT): await self._async_set_effect(effect, brightness) return ...
[ "async", "def", "_async_set_mode", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "brightness", "=", "self", ".", "_async_brightness", "(", "*", "*", "kwargs", ")", "# Handle switch to Effect Mode", "if", "effect", ":=", "kwargs", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/flux_led/light.py#L295-L340
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/oauthlib/oauth1/rfc5849/utils.py
python
filter_oauth_params
(params)
Removes all non oauth parameters from a dict or a list of params.
Removes all non oauth parameters from a dict or a list of params.
[ "Removes", "all", "non", "oauth", "parameters", "from", "a", "dict", "or", "a", "list", "of", "params", "." ]
def filter_oauth_params(params): """Removes all non oauth parameters from a dict or a list of params.""" is_oauth = lambda kv: kv[0].startswith("oauth_") if isinstance(params, dict): return list(filter(is_oauth, list(params.items()))) else: return list(filter(is_oauth, params))
[ "def", "filter_oauth_params", "(", "params", ")", ":", "is_oauth", "=", "lambda", "kv", ":", "kv", "[", "0", "]", ".", "startswith", "(", "\"oauth_\"", ")", "if", "isinstance", "(", "params", ",", "dict", ")", ":", "return", "list", "(", "filter", "(",...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/oauthlib/oauth1/rfc5849/utils.py#L31-L37
miyakogi/pyppeteer
f5313d0e7f973c57ed31fa443cea1834e223a96c
pyppeteer/chromium_downloader.py
python
chromium_executable
()
return chromiumExecutable[current_platform()]
Get path of the chromium executable.
Get path of the chromium executable.
[ "Get", "path", "of", "the", "chromium", "executable", "." ]
def chromium_executable() -> Path: """Get path of the chromium executable.""" return chromiumExecutable[current_platform()]
[ "def", "chromium_executable", "(", ")", "->", "Path", ":", "return", "chromiumExecutable", "[", "current_platform", "(", ")", "]" ]
https://github.com/miyakogi/pyppeteer/blob/f5313d0e7f973c57ed31fa443cea1834e223a96c/pyppeteer/chromium_downloader.py#L158-L160
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/modular/hecke/module.py
python
HeckeModule_free_module._eigen_nonzero
(self)
Return the smallest integer `i` such that the `i`-th entries of the entries of a basis for the dual vector space are not all 0. EXAMPLES:: sage: M = ModularSymbols(31,2) sage: M._eigen_nonzero() 0 sage: M.dual_free_module().basis() [ ...
Return the smallest integer `i` such that the `i`-th entries of the entries of a basis for the dual vector space are not all 0.
[ "Return", "the", "smallest", "integer", "i", "such", "that", "the", "i", "-", "th", "entries", "of", "the", "entries", "of", "a", "basis", "for", "the", "dual", "vector", "space", "are", "not", "all", "0", "." ]
def _eigen_nonzero(self): """ Return the smallest integer `i` such that the `i`-th entries of the entries of a basis for the dual vector space are not all 0. EXAMPLES:: sage: M = ModularSymbols(31,2) sage: M._eigen_nonzero() 0 sage: M.dua...
[ "def", "_eigen_nonzero", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__eigen_nonzero", "except", "AttributeError", ":", "pass", "V", "=", "self", ".", "dual_free_module", "(", ")", "B", "=", "V", ".", "basis", "(", ")", "for", "i", "in",...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/hecke/module.py#L569-L606
kubeflow-kale/kale
bda9d296822e56ba8fe76b0072e656005da04905
backend/kale/common/serveutils.py
python
KFServer.__repr__
(self)
Show an interactive text in notebooks.
Show an interactive text in notebooks.
[ "Show", "an", "interactive", "text", "in", "notebooks", "." ]
def __repr__(self): """Show an interactive text in notebooks.""" if utils.is_ipython(): import IPython html = ('InferenceService <pre>%s</pre> serving requests at host' ' <pre>%s</pre><br>' 'View model <a href="/models/details/%s/%s"' ...
[ "def", "__repr__", "(", "self", ")", ":", "if", "utils", ".", "is_ipython", "(", ")", ":", "import", "IPython", "html", "=", "(", "'InferenceService <pre>%s</pre> serving requests at host'", "' <pre>%s</pre><br>'", "'View model <a href=\"/models/details/%s/%s\"'", "' target...
https://github.com/kubeflow-kale/kale/blob/bda9d296822e56ba8fe76b0072e656005da04905/backend/kale/common/serveutils.py#L117-L132
ycszen/TorchSeg
62eeb159aee77972048d9d7688a28249d3c56735
furnace/tools/benchmark/compute_flops.py
python
compute_ReLU_flops
(module, inp, out)
return active_elements_count
[]
def compute_ReLU_flops(module, inp, out): assert isinstance(module, (nn.ReLU, nn.ReLU6, nn.PReLU, nn.ELU, nn.LeakyReLU, nn.Sigmoid)) batch_size = inp.size()[0] active_elements_count = batch_size for s in inp.size()[1:]: active_elements_count *= s ...
[ "def", "compute_ReLU_flops", "(", "module", ",", "inp", ",", "out", ")", ":", "assert", "isinstance", "(", "module", ",", "(", "nn", ".", "ReLU", ",", "nn", ".", "ReLU6", ",", "nn", ".", "PReLU", ",", "nn", ".", "ELU", ",", "nn", ".", "LeakyReLU", ...
https://github.com/ycszen/TorchSeg/blob/62eeb159aee77972048d9d7688a28249d3c56735/furnace/tools/benchmark/compute_flops.py#L64-L74
kubeflow/pipelines
bea751c9259ff0ae85290f873170aae89284ba8e
backend/api/python_http_client/kfp_server_api/api/experiment_service_api.py
python
ExperimentServiceApi.delete_experiment_with_http_info
(self, id, **kwargs)
return self.api_client.call_api( '/apis/v1beta1/experiments/{id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='object', # noqa: E501 ...
Deletes an experiment without deleting the experiment's runs and jobs. To avoid unexpected behaviors, delete an experiment's runs and jobs before deleting the experiment. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=T...
Deletes an experiment without deleting the experiment's runs and jobs. To avoid unexpected behaviors, delete an experiment's runs and jobs before deleting the experiment. # noqa: E501
[ "Deletes", "an", "experiment", "without", "deleting", "the", "experiment", "s", "runs", "and", "jobs", ".", "To", "avoid", "unexpected", "behaviors", "delete", "an", "experiment", "s", "runs", "and", "jobs", "before", "deleting", "the", "experiment", ".", "#",...
def delete_experiment_with_http_info(self, id, **kwargs): # noqa: E501 """Deletes an experiment without deleting the experiment's runs and jobs. To avoid unexpected behaviors, delete an experiment's runs and jobs before deleting the experiment. # noqa: E501 This method makes a synchronous HTTP reques...
[ "def", "delete_experiment_with_http_info", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "local_var_params", "=", "locals", "(", ")", "all_params", "=", "[", "'id'", "]", "all_params", ".", "extend", "(", "[", "'async_req'", ",",...
https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/backend/api/python_http_client/kfp_server_api/api/experiment_service_api.py#L315-L407
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/clusterfuzz/_internal/metrics/monitor.py
python
initialize
()
Initialize if monitoring is enabled for this bot.
Initialize if monitoring is enabled for this bot.
[ "Initialize", "if", "monitoring", "is", "enabled", "for", "this", "bot", "." ]
def initialize(): """Initialize if monitoring is enabled for this bot.""" global _monitoring_v3_client global _flusher_thread if environment.get_value('LOCAL_DEVELOPMENT'): return if not local_config.ProjectConfig().get('monitoring.enabled'): return if check_module_loaded(monitoring_v3): _ini...
[ "def", "initialize", "(", ")", ":", "global", "_monitoring_v3_client", "global", "_flusher_thread", "if", "environment", ".", "get_value", "(", "'LOCAL_DEVELOPMENT'", ")", ":", "return", "if", "not", "local_config", ".", "ProjectConfig", "(", ")", ".", "get", "(...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/metrics/monitor.py#L519-L535
mmatl/pyrender
4a289a6205c5baa623cd0e7da1be3d898bcbc4da
pyrender/shader_program.py
python
ShaderProgram.set_uniform
(self, name, value, unsigned=False)
Set a uniform value in the current shader program. Parameters ---------- name : str Name of the uniform to set. value : int, float, or ndarray Value to set the uniform to. unsigned : bool If True, ints will be treated as unsigned values.
Set a uniform value in the current shader program.
[ "Set", "a", "uniform", "value", "in", "the", "current", "shader", "program", "." ]
def set_uniform(self, name, value, unsigned=False): """Set a uniform value in the current shader program. Parameters ---------- name : str Name of the uniform to set. value : int, float, or ndarray Value to set the uniform to. unsigned : bool ...
[ "def", "set_uniform", "(", "self", ",", "name", ",", "value", ",", "unsigned", "=", "False", ")", ":", "try", ":", "# DEBUG", "# self._unif_map[name] = 1, (1,)", "loc", "=", "glGetUniformLocation", "(", "self", ".", "_program_id", ",", "name", ")", "if", "lo...
https://github.com/mmatl/pyrender/blob/4a289a6205c5baa623cd0e7da1be3d898bcbc4da/pyrender/shader_program.py#L203-L259
deepset-ai/haystack
79fdda8a7cf393d774803608a4874f2a6e63cf6f
haystack/document_stores/elasticsearch.py
python
ElasticsearchDocumentStore.update_embeddings
( self, retriever, index: Optional[str] = None, filters: Optional[Dict[str, List[str]]] = None, update_existing_embeddings: bool = True, batch_size: int = 10_000, headers: Optional[Dict[str, str]] = None )
Updates the embeddings in the the document store using the encoding model specified in the retriever. This can be useful if want to add or change the embeddings for your documents (e.g. after changing the retriever config). :param retriever: Retriever to use to update the embeddings. :param ind...
Updates the embeddings in the the document store using the encoding model specified in the retriever. This can be useful if want to add or change the embeddings for your documents (e.g. after changing the retriever config).
[ "Updates", "the", "embeddings", "in", "the", "the", "document", "store", "using", "the", "encoding", "model", "specified", "in", "the", "retriever", ".", "This", "can", "be", "useful", "if", "want", "to", "add", "or", "change", "the", "embeddings", "for", ...
def update_embeddings( self, retriever, index: Optional[str] = None, filters: Optional[Dict[str, List[str]]] = None, update_existing_embeddings: bool = True, batch_size: int = 10_000, headers: Optional[Dict[str, str]] = None ): """ Updates the ...
[ "def", "update_embeddings", "(", "self", ",", "retriever", ",", "index", ":", "Optional", "[", "str", "]", "=", "None", ",", "filters", ":", "Optional", "[", "Dict", "[", "str", ",", "List", "[", "str", "]", "]", "]", "=", "None", ",", "update_existi...
https://github.com/deepset-ai/haystack/blob/79fdda8a7cf393d774803608a4874f2a6e63cf6f/haystack/document_stores/elasticsearch.py#L1009-L1082
lmb-freiburg/netdef_models
7d3311579cf712b31d05ec29f3dc63df067aa07b
FlowNet3/CSSR-ft-sd/net.py
python
get_env
()
return env
[]
def get_env(): env = FlowNet2f_Environment(net) return env
[ "def", "get_env", "(", ")", ":", "env", "=", "FlowNet2f_Environment", "(", "net", ")", "return", "env" ]
https://github.com/lmb-freiburg/netdef_models/blob/7d3311579cf712b31d05ec29f3dc63df067aa07b/FlowNet3/CSSR-ft-sd/net.py#L144-L146
aianaconda/TensorFlow_Engineering_Implementation
cb787e359da9ac5a08d00cd2458fecb4cb5a3a31
tf2code/Chapter4/code4-10/code4-10-TF2 - 副本.py
python
load_sample
(sample_dir,shuffleflag = True)
递归读取文件。只支持一级。返回文件名、数值标签、数值对应的标签名
递归读取文件。只支持一级。返回文件名、数值标签、数值对应的标签名
[ "递归读取文件。只支持一级。返回文件名、数值标签、数值对应的标签名" ]
def load_sample(sample_dir,shuffleflag = True): '''递归读取文件。只支持一级。返回文件名、数值标签、数值对应的标签名''' print ('loading sample dataset..') lfilenames = [] labelsnames = [] for (dirpath, dirnames, filenames) in os.walk(sample_dir):#递归遍历文件夹 for filename in filenames: #遍历所有文件名 ...
[ "def", "load_sample", "(", "sample_dir", ",", "shuffleflag", "=", "True", ")", ":", "print", "(", "'loading sample dataset..'", ")", "lfilenames", "=", "[", "]", "labelsnames", "=", "[", "]", "for", "(", "dirpath", ",", "dirnames", ",", "filenames", ")", ...
https://github.com/aianaconda/TensorFlow_Engineering_Implementation/blob/cb787e359da9ac5a08d00cd2458fecb4cb5a3a31/tf2code/Chapter4/code4-10/code4-10-TF2 - 副本.py#L14-L33
ninuxorg/nodeshot
2466f0a55f522b2696026f196436ce7ba3f1e5c6
nodeshot/core/websockets/registrars/nodes.py
python
reconnect
()
reconnect signals
reconnect signals
[ "reconnect", "signals" ]
def reconnect(): """ reconnect signals """ post_save.connect(node_created_handler, sender=Node) node_status_changed.connect(node_status_changed_handler) pre_delete.connect(node_deleted_handler, sender=Node)
[ "def", "reconnect", "(", ")", ":", "post_save", ".", "connect", "(", "node_created_handler", ",", "sender", "=", "Node", ")", "node_status_changed", ".", "connect", "(", "node_status_changed_handler", ")", "pre_delete", ".", "connect", "(", "node_deleted_handler", ...
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/core/websockets/registrars/nodes.py#L49-L53
joaoventura/pylibui
2e74db787bfea533f3ae465670963daedcaec344
pylibui/libui/tab.py
python
uiTabDelete
(tab, index)
Deletes a control from the tab. :param tab: uiTab :param index: int :return: None
Deletes a control from the tab.
[ "Deletes", "a", "control", "from", "the", "tab", "." ]
def uiTabDelete(tab, index): """ Deletes a control from the tab. :param tab: uiTab :param index: int :return: None """ clibui.uiTabDelete(tab, index)
[ "def", "uiTabDelete", "(", "tab", ",", "index", ")", ":", "clibui", ".", "uiTabDelete", "(", "tab", ",", "index", ")" ]
https://github.com/joaoventura/pylibui/blob/2e74db787bfea533f3ae465670963daedcaec344/pylibui/libui/tab.py#L57-L66
jbuehl/solaredge
e1c199160488c30dc8e4ba3a839afece3c0d7e25
se/data.py
python
parseOffsetLength
(data)
return {"offset": offset, "length": length, "data": data[8:]}
[]
def parseOffsetLength(data): (offset, length) = struct.unpack("<LL", data[0:8]) logger.data("offset: %08x", offset) logger.data("length: %08x", length) return {"offset": offset, "length": length, "data": data[8:]}
[ "def", "parseOffsetLength", "(", "data", ")", ":", "(", "offset", ",", "length", ")", "=", "struct", ".", "unpack", "(", "\"<LL\"", ",", "data", "[", "0", ":", "8", "]", ")", "logger", ".", "data", "(", "\"offset: %08x\"", ",", "offset", ")", "logg...
https://github.com/jbuehl/solaredge/blob/e1c199160488c30dc8e4ba3a839afece3c0d7e25/se/data.py#L80-L84
MoyuScript/bilibili-api
a40d743089b70a0d0c73207690eb33a38cf28804
bilibili_api/dynamic.py
python
Dynamic.__init__
(self, dynamic_id: int, credential: Credential = None)
Args: dynamic_id (int): 动态 ID credential (Credential, optional): [description]. Defaults to None.
Args: dynamic_id (int): 动态 ID credential (Credential, optional): [description]. Defaults to None.
[ "Args", ":", "dynamic_id", "(", "int", ")", ":", "动态", "ID", "credential", "(", "Credential", "optional", ")", ":", "[", "description", "]", ".", "Defaults", "to", "None", "." ]
def __init__(self, dynamic_id: int, credential: Credential = None): """ Args: dynamic_id (int): 动态 ID credential (Credential, optional): [description]. Defaults to None. """ self.dynamic_id = dynamic_id self.credential = credential if credential is not Non...
[ "def", "__init__", "(", "self", ",", "dynamic_id", ":", "int", ",", "credential", ":", "Credential", "=", "None", ")", ":", "self", ".", "dynamic_id", "=", "dynamic_id", "self", ".", "credential", "=", "credential", "if", "credential", "is", "not", "None",...
https://github.com/MoyuScript/bilibili-api/blob/a40d743089b70a0d0c73207690eb33a38cf28804/bilibili_api/dynamic.py#L291-L298
mongomock/mongomock
9772f5d7e02ae96b08506abb4004a45a5f388bdf
mongomock/filtering.py
python
iter_key_candidates
(key, doc)
return iter_key_candidates(sub_key, sub_doc)
Get possible subdocuments or lists that are referred to by the key in question Returns the appropriate nested value if the key includes dot notation.
Get possible subdocuments or lists that are referred to by the key in question
[ "Get", "possible", "subdocuments", "or", "lists", "that", "are", "referred", "to", "by", "the", "key", "in", "question" ]
def iter_key_candidates(key, doc): """Get possible subdocuments or lists that are referred to by the key in question Returns the appropriate nested value if the key includes dot notation. """ if doc is None: return () if not key: return [doc] if isinstance(doc, list): ...
[ "def", "iter_key_candidates", "(", "key", ",", "doc", ")", ":", "if", "doc", "is", "None", ":", "return", "(", ")", "if", "not", "key", ":", "return", "[", "doc", "]", "if", "isinstance", "(", "doc", ",", "list", ")", ":", "return", "_iter_key_candid...
https://github.com/mongomock/mongomock/blob/9772f5d7e02ae96b08506abb4004a45a5f388bdf/mongomock/filtering.py#L203-L226
disqus/gutter
d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5
gutter/client/arguments/variables.py
python
Base.to_python
(value)
return value
[]
def to_python(value): return value
[ "def", "to_python", "(", "value", ")", ":", "return", "value" ]
https://github.com/disqus/gutter/blob/d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5/gutter/client/arguments/variables.py#L24-L25
ralphm/wokkel
76edbf80f0d314e314e2d4d1510c6e5438a538f7
wokkel/iwokkel.py
python
IPubSubService.create
(requestor, service, nodeIdentifier)
Called when a node creation request has been received. @param requestor: The entity the request originated from. @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>} @param service: The entity the request was addressed to. @type service: L{JID<twisted.words.protocols.jabber.j...
Called when a node creation request has been received.
[ "Called", "when", "a", "node", "creation", "request", "has", "been", "received", "." ]
def create(requestor, service, nodeIdentifier): """ Called when a node creation request has been received. @param requestor: The entity the request originated from. @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>} @param service: The entity the request was address...
[ "def", "create", "(", "requestor", ",", "service", ",", "nodeIdentifier", ")", ":" ]
https://github.com/ralphm/wokkel/blob/76edbf80f0d314e314e2d4d1510c6e5438a538f7/wokkel/iwokkel.py#L300-L315
PacktPublishing/Artificial-Intelligence-with-Python
03e0f39e3c0949ee219ec91e0145fdabe8ed7810
Chapter 09/code/easyAI/AI/TT.py
python
TT.lookup
(self, game)
return self.d.get(game.ttentry(), None)
Requests the entry in the table. Returns None if the entry has not been previously stored in the table.
Requests the entry in the table. Returns None if the entry has not been previously stored in the table.
[ "Requests", "the", "entry", "in", "the", "table", ".", "Returns", "None", "if", "the", "entry", "has", "not", "been", "previously", "stored", "in", "the", "table", "." ]
def lookup(self, game): """ Requests the entry in the table. Returns None if the entry has not been previously stored in the table. """ return self.d.get(game.ttentry(), None)
[ "def", "lookup", "(", "self", ",", "game", ")", ":", "return", "self", ".", "d", ".", "get", "(", "game", ".", "ttentry", "(", ")", ",", "None", ")" ]
https://github.com/PacktPublishing/Artificial-Intelligence-with-Python/blob/03e0f39e3c0949ee219ec91e0145fdabe8ed7810/Chapter 09/code/easyAI/AI/TT.py#L35-L38
joxeankoret/diaphora
dcb5a25ac9fe23a285b657e5389cf770de7ac928
diaphora_ida.py
python
CIDABinDiff.import_selected
(self, items, selected, only_auto)
[]
def import_selected(self, items, selected, only_auto): # Import all the type libraries from the diff database self.import_til() # Import all the struct and enum definitions self.import_definitions() new_items = [] for index in selected: item = items[index] name1 = item[2] if n...
[ "def", "import_selected", "(", "self", ",", "items", ",", "selected", ",", "only_auto", ")", ":", "# Import all the type libraries from the diff database", "self", ".", "import_til", "(", ")", "# Import all the struct and enum definitions", "self", ".", "import_definitions"...
https://github.com/joxeankoret/diaphora/blob/dcb5a25ac9fe23a285b657e5389cf770de7ac928/diaphora_ida.py#L1454-L1466
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_api_service_spec.py
python
V1APIServiceSpec.group_priority_minimum
(self, group_priority_minimum)
Sets the group_priority_minimum of this V1APIServiceSpec. GroupPriorityMininum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. Note that other versions of this group might specify even higher GroupPriorityMininum values suc...
Sets the group_priority_minimum of this V1APIServiceSpec.
[ "Sets", "the", "group_priority_minimum", "of", "this", "V1APIServiceSpec", "." ]
def group_priority_minimum(self, group_priority_minimum): """Sets the group_priority_minimum of this V1APIServiceSpec. GroupPriorityMininum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. Note that other versions of...
[ "def", "group_priority_minimum", "(", "self", ",", "group_priority_minimum", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "group_priority_minimum", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invali...
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_api_service_spec.py#L144-L155
s-leger/archipack
5a6243bf1edf08a6b429661ce291dacb551e5f8a
pygeos/algorithms.py
python
Angle.normalizePositive
(angle: float)
return angle
* Computes the normalized value of an angle, which is the * equivalent angle in the range ( -Pi, Pi ]. * @param angle the angle to normalize * @return an equivalent angle in the range (-Pi, Pi]
* Computes the normalized value of an angle, which is the * equivalent angle in the range ( -Pi, Pi ]. *
[ "*", "Computes", "the", "normalized", "value", "of", "an", "angle", "which", "is", "the", "*", "equivalent", "angle", "in", "the", "range", "(", "-", "Pi", "Pi", "]", ".", "*" ]
def normalizePositive(angle: float) -> float: """ * Computes the normalized value of an angle, which is the * equivalent angle in the range ( -Pi, Pi ]. * @param angle the angle to normalize * @return an equivalent angle in the range (-Pi, Pi] """ if angle < 0...
[ "def", "normalizePositive", "(", "angle", ":", "float", ")", "->", "float", ":", "if", "angle", "<", "0.0", ":", "while", "angle", "<", "0.0", ":", "angle", "+=", "Angle", ".", "PI_TIMES_2", "if", "angle", ">=", "Angle", ".", "PI_TIMES_2", ":", "angle"...
https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/algorithms.py#L605-L625
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
deep-learning/udacity-deeplearning/face_generation/helper.py
python
get_image
(image_path, width, height, mode)
return np.array(image.convert(mode))
Read image from image_path :param image_path: Path of image :param width: Width of image :param height: Height of image :param mode: Mode of image :return: Image data
Read image from image_path :param image_path: Path of image :param width: Width of image :param height: Height of image :param mode: Mode of image :return: Image data
[ "Read", "image", "from", "image_path", ":", "param", "image_path", ":", "Path", "of", "image", ":", "param", "width", ":", "Width", "of", "image", ":", "param", "height", ":", "Height", "of", "image", ":", "param", "mode", ":", "Mode", "of", "image", "...
def get_image(image_path, width, height, mode): """ Read image from image_path :param image_path: Path of image :param width: Width of image :param height: Height of image :param mode: Mode of image :return: Image data """ image = Image.open(image_path) if image.size != (width, ...
[ "def", "get_image", "(", "image_path", ",", "width", ",", "height", ",", "mode", ")", ":", "image", "=", "Image", ".", "open", "(", "image_path", ")", "if", "image", ".", "size", "!=", "(", "width", ",", "height", ")", ":", "# HACK - Check if image is fr...
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/deep-learning/udacity-deeplearning/face_generation/helper.py#L64-L83
Refefer/Dampr
340580afeff23d1f43e23019c7e3a879468aad8d
dampr/base.py
python
BlockMapper.finish
(self)
return ()
Mapping is finished. In the case of aggregations, this should yield out all remaining key-values to consume.
Mapping is finished. In the case of aggregations, this should yield out all remaining key-values to consume.
[ "Mapping", "is", "finished", ".", "In", "the", "case", "of", "aggregations", "this", "should", "yield", "out", "all", "remaining", "key", "-", "values", "to", "consume", "." ]
def finish(self): """ Mapping is finished. In the case of aggregations, this should yield out all remaining key-values to consume. """ return ()
[ "def", "finish", "(", "self", ")", ":", "return", "(", ")" ]
https://github.com/Refefer/Dampr/blob/340580afeff23d1f43e23019c7e3a879468aad8d/dampr/base.py#L83-L88
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/requests/packages/urllib3/filepost.py
python
iter_fields
(fields)
return ((k, v) for k, v in fields)
.. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples and dicts.
.. deprecated:: 1.6
[ "..", "deprecated", "::", "1", ".", "6" ]
def iter_fields(fields): """ .. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples an...
[ "def", "iter_fields", "(", "fields", ")", ":", "if", "isinstance", "(", "fields", ",", "dict", ")", ":", "return", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "fields", ")", ")", "return", "(", "(", "...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/requests/packages/urllib3/filepost.py#L41-L56
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/wsgiref/handlers.py
python
BaseHandler.send_preamble
(self)
Transmit version/status/date/server, via self._write()
Transmit version/status/date/server, via self._write()
[ "Transmit", "version", "/", "status", "/", "date", "/", "server", "via", "self", ".", "_write", "()" ]
def send_preamble(self): """Transmit version/status/date/server, via self._write()""" if self.origin_server: if self.client_is_modern(): self._write('HTTP/%s %s\r\n' % (self.http_version,self.status)) if 'Date' not in self.headers: self._wr...
[ "def", "send_preamble", "(", "self", ")", ":", "if", "self", ".", "origin_server", ":", "if", "self", ".", "client_is_modern", "(", ")", ":", "self", ".", "_write", "(", "'HTTP/%s %s\\r\\n'", "%", "(", "self", ".", "http_version", ",", "self", ".", "stat...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/wsgiref/handlers.py#L185-L197
ProgVal/Limnoria
181e34baf90a8cabc281e8349da6e36e1e558608
plugins/User/plugin.py
python
User.identify
(self, irc, msg, args, user, password)
<name> <password> Identifies the user as <name>. This command (and all other commands that include a password) must be sent to the bot privately, not in a channel.
<name> <password>
[ "<name", ">", "<password", ">" ]
def identify(self, irc, msg, args, user, password): """<name> <password> Identifies the user as <name>. This command (and all other commands that include a password) must be sent to the bot privately, not in a channel. """ if user.checkPassword(password): try...
[ "def", "identify", "(", "self", ",", "irc", ",", "msg", ",", "args", ",", "user", ",", "password", ")", ":", "if", "user", ".", "checkPassword", "(", "password", ")", ":", "try", ":", "user", ".", "addAuth", "(", "msg", ".", "prefix", ")", "ircdb",...
https://github.com/ProgVal/Limnoria/blob/181e34baf90a8cabc281e8349da6e36e1e558608/plugins/User/plugin.py#L458-L476
python/mypy
17850b3bd77ae9efb5d21f656c4e4e05ac48d894
mypy/dmypy/client.py
python
do_kill
(args: argparse.Namespace)
Kill daemon process with SIGKILL.
Kill daemon process with SIGKILL.
[ "Kill", "daemon", "process", "with", "SIGKILL", "." ]
def do_kill(args: argparse.Namespace) -> None: """Kill daemon process with SIGKILL.""" pid, _ = get_status(args.status_file) try: kill(pid) except OSError as err: fail(str(err)) else: print("Daemon killed")
[ "def", "do_kill", "(", "args", ":", "argparse", ".", "Namespace", ")", "->", "None", ":", "pid", ",", "_", "=", "get_status", "(", "args", ".", "status_file", ")", "try", ":", "kill", "(", "pid", ")", "except", "OSError", "as", "err", ":", "fail", ...
https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/dmypy/client.py#L319-L327
0vercl0k/stuffz
2ff82f4739d7e215c6140d4987efa8310db39d55
ollydbg2-udd-files/udd.py
python
breakpoint_type_to_access
(ty)
return ''.join(a if (ty & mask) == mask else '-' for mask, a in flags)
0x00200000|0x00400000|0x00800000 -> rwx
0x00200000|0x00400000|0x00800000 -> rwx
[ "0x00200000|0x00400000|0x00800000", "-", ">", "rwx" ]
def breakpoint_type_to_access(ty): '''0x00200000|0x00400000|0x00800000 -> rwx''' flags = [ (0x00200000, 'r'), (0x00400000, 'w'), (0x00800000, 'x') ] return ''.join(a if (ty & mask) == mask else '-' for mask, a in flags)
[ "def", "breakpoint_type_to_access", "(", "ty", ")", ":", "flags", "=", "[", "(", "0x00200000", ",", "'r'", ")", ",", "(", "0x00400000", ",", "'w'", ")", ",", "(", "0x00800000", ",", "'x'", ")", "]", "return", "''", ".", "join", "(", "a", "if", "(",...
https://github.com/0vercl0k/stuffz/blob/2ff82f4739d7e215c6140d4987efa8310db39d55/ollydbg2-udd-files/udd.py#L237-L244
0xdea/tactical-exploitation
231146ac5b4caa44ed73fade0ec29767d28b20b5
seitan.py
python
get_targets
(args)
return [t.rstrip() for t in args.f]
Get targets from command line or file
Get targets from command line or file
[ "Get", "targets", "from", "command", "line", "or", "file" ]
def get_targets(args): """ Get targets from command line or file """ if args.t: return [args.t] return [t.rstrip() for t in args.f]
[ "def", "get_targets", "(", "args", ")", ":", "if", "args", ".", "t", ":", "return", "[", "args", ".", "t", "]", "return", "[", "t", ".", "rstrip", "(", ")", "for", "t", "in", "args", ".", "f", "]" ]
https://github.com/0xdea/tactical-exploitation/blob/231146ac5b4caa44ed73fade0ec29767d28b20b5/seitan.py#L257-L263
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/sem/logic.py
python
LogicParser.handle
(self, tok, context)
This method is intended to be overridden for logics that use different operators or expressions
This method is intended to be overridden for logics that use different operators or expressions
[ "This", "method", "is", "intended", "to", "be", "overridden", "for", "logics", "that", "use", "different", "operators", "or", "expressions" ]
def handle(self, tok, context): """This method is intended to be overridden for logics that use different operators or expressions""" if self.isvariable(tok): return self.handle_variable(tok, context) elif tok in Tokens.NOT_LIST: return self.handle_negation(tok, ...
[ "def", "handle", "(", "self", ",", "tok", ",", "context", ")", ":", "if", "self", ".", "isvariable", "(", "tok", ")", ":", "return", "self", ".", "handle_variable", "(", "tok", ",", "context", ")", "elif", "tok", "in", "Tokens", ".", "NOT_LIST", ":",...
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/sem/logic.py#L296-L312
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/werkzeug/contrib/cache.py
python
BaseCache.get_dict
(self, *keys)
return dict(zip(keys, self.get_many(*keys)))
Like :meth:`get_many` but return a dict:: d = cache.get_dict("foo", "bar") foo = d["foo"] bar = d["bar"] :param keys: The function accepts multiple keys as positional arguments.
Like :meth:`get_many` but return a dict::
[ "Like", ":", "meth", ":", "get_many", "but", "return", "a", "dict", "::" ]
def get_dict(self, *keys): """Like :meth:`get_many` but return a dict:: d = cache.get_dict("foo", "bar") foo = d["foo"] bar = d["bar"] :param keys: The function accepts multiple keys as positional arguments. """ return dict(zip(k...
[ "def", "get_dict", "(", "self", ",", "*", "keys", ")", ":", "return", "dict", "(", "zip", "(", "keys", ",", "self", ".", "get_many", "(", "*", "keys", ")", ")", ")" ]
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/werkzeug/contrib/cache.py#L132-L142
celery/kombu
853b13f1d018ebfe7ad2d064a3111cac9fcf5383
kombu/transport/qpid.py
python
Channel.queue_purge
(self, queue, **kwargs)
return self._purge(queue)
Remove all undelivered messages from queue. Purge all undelivered messages from a queue specified by name. If the queue does not exist an exception is raised. The queue message depth is first checked, and then the broker is asked to purge that number of messages. The integer number of m...
Remove all undelivered messages from queue.
[ "Remove", "all", "undelivered", "messages", "from", "queue", "." ]
def queue_purge(self, queue, **kwargs): """Remove all undelivered messages from queue. Purge all undelivered messages from a queue specified by name. If the queue does not exist an exception is raised. The queue message depth is first checked, and then the broker is asked to purge that ...
[ "def", "queue_purge", "(", "self", ",", "queue", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_purge", "(", "queue", ")" ]
https://github.com/celery/kombu/blob/853b13f1d018ebfe7ad2d064a3111cac9fcf5383/kombu/transport/qpid.py#L795-L826
tdamdouni/Pythonista
3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad
stash/shellista-Transistor1.py
python
Shell.do_ls
(self, line)
list directory contents
list directory contents
[ "list", "directory", "contents" ]
def do_ls(self, line): """list directory contents""" files = self.bash(line) if files is None: return elif (not files): files = ['.'] files_for_path = dict() for filef in files: full_file = os.path.normpath(os.path.abspath(filef)) file_name = os.path.basename(full_file) dir_name = os.path.no...
[ "def", "do_ls", "(", "self", ",", "line", ")", ":", "files", "=", "self", ".", "bash", "(", "line", ")", "if", "files", "is", "None", ":", "return", "elif", "(", "not", "files", ")", ":", "files", "=", "[", "'.'", "]", "files_for_path", "=", "dic...
https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/stash/shellista-Transistor1.py#L833-L881
Nandaka/PixivUtil2
3495f52c8889a45af29a0356045f230248abc177
PixivHelper.py
python
convert_ugoira
(ugoira_file, exportname, ffmpeg, codec, param, extension, image=None)
modified based on https://github.com/tsudoko/ugoira-tools/blob/master/ugoira2webm/ugoira2webm.py
modified based on https://github.com/tsudoko/ugoira-tools/blob/master/ugoira2webm/ugoira2webm.py
[ "modified", "based", "on", "https", ":", "//", "github", ".", "com", "/", "tsudoko", "/", "ugoira", "-", "tools", "/", "blob", "/", "master", "/", "ugoira2webm", "/", "ugoira2webm", ".", "py" ]
def convert_ugoira(ugoira_file, exportname, ffmpeg, codec, param, extension, image=None): ''' modified based on https://github.com/tsudoko/ugoira-tools/blob/master/ugoira2webm/ugoira2webm.py ''' # if not os.path.exists(os.path.abspath(ffmpeg)): # raise PixivException(f"Cannot find ffmpeg executables => ...
[ "def", "convert_ugoira", "(", "ugoira_file", ",", "exportname", ",", "ffmpeg", ",", "codec", ",", "param", ",", "extension", ",", "image", "=", "None", ")", ":", "# if not os.path.exists(os.path.abspath(ffmpeg)):", "# raise PixivException(f\"Cannot find ffmpeg executabl...
https://github.com/Nandaka/PixivUtil2/blob/3495f52c8889a45af29a0356045f230248abc177/PixivHelper.py#L988-L1084
huawei-noah/Pretrained-Language-Model
d4694a134bdfacbaef8ff1d99735106bd3b3372b
PMLM/tokenization.py
python
BasicTokenizer._tokenize_chinese_chars
(self, text)
return "".join(output)
Adds whitespace around any CJK character.
Adds whitespace around any CJK character.
[ "Adds", "whitespace", "around", "any", "CJK", "character", "." ]
def _tokenize_chinese_chars(self, text): """Adds whitespace around any CJK character.""" output = [] for char in text: cp = ord(char) if self._is_chinese_char(cp): output.append(" ") output.append(char) output.append(" ") else: output.append(char) return...
[ "def", "_tokenize_chinese_chars", "(", "self", ",", "text", ")", ":", "output", "=", "[", "]", "for", "char", "in", "text", ":", "cp", "=", "ord", "(", "char", ")", "if", "self", ".", "_is_chinese_char", "(", "cp", ")", ":", "output", ".", "append", ...
https://github.com/huawei-noah/Pretrained-Language-Model/blob/d4694a134bdfacbaef8ff1d99735106bd3b3372b/PMLM/tokenization.py#L252-L263
googleads/googleads-python-lib
b3b42a6deedbe6eaa1c9b30183a9eae3f9e9a7ee
examples/adwords/v201809/campaign_management/add_draft.py
python
main
(client, base_campaign_id)
[]
def main(client, base_campaign_id): draft_service = client.GetService('DraftService', version='v201809') draft = { 'baseCampaignId': base_campaign_id, 'draftName': 'Test Draft #%s' % uuid.uuid4() } draft_operation = {'operator': 'ADD', 'operand': draft} draft = draft_service.mutate([draft_operat...
[ "def", "main", "(", "client", ",", "base_campaign_id", ")", ":", "draft_service", "=", "client", ".", "GetService", "(", "'DraftService'", ",", "version", "=", "'v201809'", ")", "draft", "=", "{", "'baseCampaignId'", ":", "base_campaign_id", ",", "'draftName'", ...
https://github.com/googleads/googleads-python-lib/blob/b3b42a6deedbe6eaa1c9b30183a9eae3f9e9a7ee/examples/adwords/v201809/campaign_management/add_draft.py#L37-L74
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
twistedcaldav/database.py
python
AbstractADBAPIDatabase.__repr__
(self)
return "<%s %r>" % (self.__class__.__name__, self.pool)
[]
def __repr__(self): return "<%s %r>" % (self.__class__.__name__, self.pool)
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"<%s %r>\"", "%", "(", "self", ".", "__class__", ".", "__name__", ",", "self", ".", "pool", ")" ]
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/database.py#L98-L99
Theano/Theano
8fd9203edfeecebced9344b0c70193be292a9ade
theano/_version.py
python
run_command
(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None)
return stdout, p.returncode
Call the given command(s).
Call the given command(s).
[ "Call", "the", "given", "command", "(", "s", ")", "." ]
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None): """Call the given command(s).""" assert isinstance(commands, list) p = None for c in commands: try: dispcmd = str([c] + args) # remember shell=False, so use git.cmd on w...
[ "def", "run_command", "(", "commands", ",", "args", ",", "cwd", "=", "None", ",", "verbose", "=", "False", ",", "hide_stderr", "=", "False", ",", "env", "=", "None", ")", ":", "assert", "isinstance", "(", "commands", ",", "list", ")", "p", "=", "None...
https://github.com/Theano/Theano/blob/8fd9203edfeecebced9344b0c70193be292a9ade/theano/_version.py#L70-L104
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/cffLib/specializer.py
python
_GeneralizerDecombinerCommandsMap.vhcurveto
(args)
[]
def vhcurveto(args): if len(args) < 4 or len(args) % 8 not in {0,1,4,5}: raise ValueError(args) last_args = None if len(args) % 2 == 1: lastStraight = len(args) % 8 == 5 args, last_args = args[:-5], args[-5:] it = _everyN(args, 4) try: while True: args = next(it) yield ('rrcurveto', [0, args[...
[ "def", "vhcurveto", "(", "args", ")", ":", "if", "len", "(", "args", ")", "<", "4", "or", "len", "(", "args", ")", "%", "8", "not", "in", "{", "0", ",", "1", ",", "4", ",", "5", "}", ":", "raise", "ValueError", "(", "args", ")", "last_args", ...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/cffLib/specializer.py#L238-L258
donnemartin/gitsome
d7c57abc7cb66e9c910a844f15d4536866da3310
xonsh/tools.py
python
deprecated
(deprecated_in=None, removed_in=None)
return decorated
Parametrized decorator that deprecates a function in a graceful manner. Updates the decorated function's docstring to mention the version that deprecation occurred in and the version it will be removed in if both of these values are passed. When removed_in is not a release equal to or less than the cu...
Parametrized decorator that deprecates a function in a graceful manner.
[ "Parametrized", "decorator", "that", "deprecates", "a", "function", "in", "a", "graceful", "manner", "." ]
def deprecated(deprecated_in=None, removed_in=None): """Parametrized decorator that deprecates a function in a graceful manner. Updates the decorated function's docstring to mention the version that deprecation occurred in and the version it will be removed in if both of these values are passed. W...
[ "def", "deprecated", "(", "deprecated_in", "=", "None", ",", "removed_in", "=", "None", ")", ":", "message_suffix", "=", "_deprecated_message_suffix", "(", "deprecated_in", ",", "removed_in", ")", "if", "not", "message_suffix", ":", "message_suffix", "=", "\"\"", ...
https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/xonsh/tools.py#L2381-L2424
cea-sec/miasm
09376c524aedc7920a7eda304d6095e12f6958f4
miasm/analysis/dse.py
python
DSEEngine.add_handler
(self, addr, callback)
Add a @callback for address @addr before any state update. The state IS NOT updated after returning from the callback @addr: int @callback: func(dse instance)
Add a
[ "Add", "a" ]
def add_handler(self, addr, callback): """Add a @callback for address @addr before any state update. The state IS NOT updated after returning from the callback @addr: int @callback: func(dse instance)""" self.handler[addr] = callback
[ "def", "add_handler", "(", "self", ",", "addr", ",", "callback", ")", ":", "self", ".", "handler", "[", "addr", "]", "=", "callback" ]
https://github.com/cea-sec/miasm/blob/09376c524aedc7920a7eda304d6095e12f6958f4/miasm/analysis/dse.py#L243-L248
PyCQA/pylint
3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb
pylint/pyreverse/inspector.py
python
IdGeneratorMixIn.generate_id
(self)
return self.id_count
generate a new identifier
generate a new identifier
[ "generate", "a", "new", "identifier" ]
def generate_id(self): """generate a new identifier""" self.id_count += 1 return self.id_count
[ "def", "generate_id", "(", "self", ")", ":", "self", ".", "id_count", "+=", "1", "return", "self", ".", "id_count" ]
https://github.com/PyCQA/pylint/blob/3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb/pylint/pyreverse/inspector.py#L77-L80
JonnyHaystack/i3-resurrect
80e3fd6d048fe473c8cb8b2dfb75b1ace3846408
i3_resurrect/main.py
python
restore_workspace
(workspace, numeric, directory, profile, target)
Restore i3 workspace layout and programs.
Restore i3 workspace layout and programs.
[ "Restore", "i3", "workspace", "layout", "and", "programs", "." ]
def restore_workspace(workspace, numeric, directory, profile, target): """ Restore i3 workspace layout and programs. """ i3 = i3ipc.Connection() if workspace is None: workspace = i3.get_tree().find_focused().workspace().name directory = util.resolve_directory(directory, profile) i...
[ "def", "restore_workspace", "(", "workspace", ",", "numeric", ",", "directory", ",", "profile", ",", "target", ")", ":", "i3", "=", "i3ipc", ".", "Connection", "(", ")", "if", "workspace", "is", "None", ":", "workspace", "=", "i3", ".", "get_tree", "(", ...
https://github.com/JonnyHaystack/i3-resurrect/blob/80e3fd6d048fe473c8cb8b2dfb75b1ace3846408/i3_resurrect/main.py#L91-L123
Lookyloo/lookyloo
45ec8efe64d4b549e2598bee0300bb8ffb33ea91
lookyloo/default/helpers.py
python
get_config
(config_type: str, entry: str, quiet: bool=False)
return sample_config[entry]
Get an entry from the given config_type file. Automatic fallback to the sample file
Get an entry from the given config_type file. Automatic fallback to the sample file
[ "Get", "an", "entry", "from", "the", "given", "config_type", "file", ".", "Automatic", "fallback", "to", "the", "sample", "file" ]
def get_config(config_type: str, entry: str, quiet: bool=False) -> Any: """Get an entry from the given config_type file. Automatic fallback to the sample file""" global configs if not configs: load_configs() if config_type in configs: if entry in configs[config_type]: return ...
[ "def", "get_config", "(", "config_type", ":", "str", ",", "entry", ":", "str", ",", "quiet", ":", "bool", "=", "False", ")", "->", "Any", ":", "global", "configs", "if", "not", "configs", ":", "load_configs", "(", ")", "if", "config_type", "in", "confi...
https://github.com/Lookyloo/lookyloo/blob/45ec8efe64d4b549e2598bee0300bb8ffb33ea91/lookyloo/default/helpers.py#L61-L79
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/physics/quantum/trace.py
python
Tr.__new__
(cls, *args)
Construct a Trace object. Parameters ========== args = SymPy expression indices = tuple/list if indices, optional
Construct a Trace object.
[ "Construct", "a", "Trace", "object", "." ]
def __new__(cls, *args): """ Construct a Trace object. Parameters ========== args = SymPy expression indices = tuple/list if indices, optional """ # expect no indices,int or a tuple/list/Tuple if (len(args) == 2): if not isinstance(args[1], ...
[ "def", "__new__", "(", "cls", ",", "*", "args", ")", ":", "# expect no indices,int or a tuple/list/Tuple", "if", "(", "len", "(", "args", ")", "==", "2", ")", ":", "if", "not", "isinstance", "(", "args", "[", "1", "]", ",", "(", "list", ",", "Tuple", ...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/physics/quantum/trace.py#L110-L161
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
opy/pytree.py
python
WildcardPattern.match
(self, node, results=None)
return self.match_seq([node], results)
Does this pattern exactly match a node?
Does this pattern exactly match a node?
[ "Does", "this", "pattern", "exactly", "match", "a", "node?" ]
def match(self, node, results=None): """Does this pattern exactly match a node?""" return self.match_seq([node], results)
[ "def", "match", "(", "self", ",", "node", ",", "results", "=", "None", ")", ":", "return", "self", ".", "match_seq", "(", "[", "node", "]", ",", "results", ")" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/opy/pytree.py#L628-L630
heynemann/pyccuracy
0bbe3bcff4d13a6501bf77d5af9457f6a1491ab6
pyccuracy/drivers/core/selenium_webdriver.py
python
SeleniumWebdriver.radio_uncheck
(self, radio_selector)
return self.checkbox_uncheck(radio_selector)
[]
def radio_uncheck(self, radio_selector): return self.checkbox_uncheck(radio_selector)
[ "def", "radio_uncheck", "(", "self", ",", "radio_selector", ")", ":", "return", "self", ".", "checkbox_uncheck", "(", "radio_selector", ")" ]
https://github.com/heynemann/pyccuracy/blob/0bbe3bcff4d13a6501bf77d5af9457f6a1491ab6/pyccuracy/drivers/core/selenium_webdriver.py#L134-L135
MillionIntegrals/vel
f3ce7da64362ad207f40f2c0d58d9300a25df3e8
vel/api/data/image_ops.py
python
lighting
(im, b, c)
return np.clip((im-mu)*c+mu+b,0.,1.).astype(np.float32)
adjusts image's balance and contrast
adjusts image's balance and contrast
[ "adjusts", "image", "s", "balance", "and", "contrast" ]
def lighting(im, b, c): ''' adjusts image's balance and contrast''' if b==0 and c==1: return im mu = np.average(im) return np.clip((im-mu)*c+mu+b,0.,1.).astype(np.float32)
[ "def", "lighting", "(", "im", ",", "b", ",", "c", ")", ":", "if", "b", "==", "0", "and", "c", "==", "1", ":", "return", "im", "mu", "=", "np", ".", "average", "(", "im", ")", "return", "np", ".", "clip", "(", "(", "im", "-", "mu", ")", "*...
https://github.com/MillionIntegrals/vel/blob/f3ce7da64362ad207f40f2c0d58d9300a25df3e8/vel/api/data/image_ops.py#L80-L84
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/db/backends/sqlite3/creation.py
python
DatabaseCreation._create_test_db
(self, verbosity, autoclobber, keepdb=False)
return test_database_name
[]
def _create_test_db(self, verbosity, autoclobber, keepdb=False): test_database_name = self._get_test_db_name() if keepdb: return test_database_name if not self.is_in_memory_db(test_database_name): # Erase the old test database if verbosity >= 1: ...
[ "def", "_create_test_db", "(", "self", ",", "verbosity", ",", "autoclobber", ",", "keepdb", "=", "False", ")", ":", "test_database_name", "=", "self", ".", "_get_test_db_name", "(", ")", "if", "keepdb", ":", "return", "test_database_name", "if", "not", "self",...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/backends/sqlite3/creation.py#L33-L59
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/importlib/_bootstrap.py
python
_install
(sys_module, _imp_module)
Install importlib as the implementation of import.
Install importlib as the implementation of import.
[ "Install", "importlib", "as", "the", "implementation", "of", "import", "." ]
def _install(sys_module, _imp_module): """Install importlib as the implementation of import.""" _setup(sys_module, _imp_module) supported_loaders = _get_supported_file_loaders() sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)]) sys.meta_path.append(BuiltinImporter) sys.meta_path....
[ "def", "_install", "(", "sys_module", ",", "_imp_module", ")", ":", "_setup", "(", "sys_module", ",", "_imp_module", ")", "supported_loaders", "=", "_get_supported_file_loaders", "(", ")", "sys", ".", "path_hooks", ".", "extend", "(", "[", "FileFinder", ".", "...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/importlib/_bootstrap.py#L2452-L2461