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
rossant/galry
6201fa32fb5c9ef3cea700cc22caf52fb69ebe31
galry/processors/navigation_processor.py
python
NavigationEventProcessor.set_position
(self, x, y)
Set the current position. Arguments: * x, y: coordinates in the data coordinate system.
Set the current position. Arguments: * x, y: coordinates in the data coordinate system.
[ "Set", "the", "current", "position", ".", "Arguments", ":", "*", "x", "y", ":", "coordinates", "in", "the", "data", "coordinate", "system", "." ]
def set_position(self, x, y): """Set the current position. Arguments: * x, y: coordinates in the data coordinate system. """ self.tx = -x self.ty = -y
[ "def", "set_position", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "tx", "=", "-", "x", "self", ".", "ty", "=", "-", "y" ]
https://github.com/rossant/galry/blob/6201fa32fb5c9ef3cea700cc22caf52fb69ebe31/galry/processors/navigation_processor.py#L335-L343
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/hqmedia/models.py
python
CommCareMultimedia.get_mime_type
(cls, data, filename=None)
return mime_type
[]
def get_mime_type(cls, data, filename=None): mime = magic.Magic(mime=True) mime_type = mime.from_buffer(data) if mime_type.startswith('application') and filename is not None: guessed_type = mimetypes.guess_type(filename) mime_type = guessed_type[0] if guessed_type[0] else...
[ "def", "get_mime_type", "(", "cls", ",", "data", ",", "filename", "=", "None", ")", ":", "mime", "=", "magic", ".", "Magic", "(", "mime", "=", "True", ")", "mime_type", "=", "mime", ".", "from_buffer", "(", "data", ")", "if", "mime_type", ".", "start...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/hqmedia/models.py#L241-L247
tensorflow/tensorboard
61d11d99ef034c30ba20b6a7840c8eededb9031c
tensorboard/plugins/debugger_v2/debug_data_provider.py
python
alerts_run_tag_filter
(run, begin, end, alert_type=None)
return provider.RunTagFilter(runs=[run], tags=[tag])
Create a RunTagFilter for Alerts. Args: run: tfdbg2 run name. begin: Beginning index of alerts. end: Ending index of alerts. alert_type: Optional alert type, used to restrict retrieval of alerts data to a single type of alerts. Returns: `RunTagFilter` for the run and rang...
Create a RunTagFilter for Alerts.
[ "Create", "a", "RunTagFilter", "for", "Alerts", "." ]
def alerts_run_tag_filter(run, begin, end, alert_type=None): """Create a RunTagFilter for Alerts. Args: run: tfdbg2 run name. begin: Beginning index of alerts. end: Ending index of alerts. alert_type: Optional alert type, used to restrict retrieval of alerts data to a single typ...
[ "def", "alerts_run_tag_filter", "(", "run", ",", "begin", ",", "end", ",", "alert_type", "=", "None", ")", ":", "tag", "=", "\"%s_%d_%d\"", "%", "(", "ALERTS_BLOB_TAG_PREFIX", ",", "begin", ",", "end", ")", "if", "alert_type", "is", "not", "None", ":", "...
https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/plugins/debugger_v2/debug_data_provider.py#L50-L66
ddbourgin/numpy-ml
b0359af5285fbf9699d64fd5ec059493228af03e
numpy_ml/utils/kernels.py
python
RBFKernel._kernel
(self, X, Y=None)
return np.exp(-0.5 * pairwise_l2_distances(X / sigma, Y / sigma) ** 2)
Computes the radial basis function (RBF) kernel between all pairs of rows in `X` and `Y`. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of shape `(N, C)` Collection of `N` input vectors, each with dimension `C`. Y : :py:class:`ndarray <numpy.ndarray>`...
Computes the radial basis function (RBF) kernel between all pairs of rows in `X` and `Y`.
[ "Computes", "the", "radial", "basis", "function", "(", "RBF", ")", "kernel", "between", "all", "pairs", "of", "rows", "in", "X", "and", "Y", "." ]
def _kernel(self, X, Y=None): """ Computes the radial basis function (RBF) kernel between all pairs of rows in `X` and `Y`. Parameters ---------- X : :py:class:`ndarray <numpy.ndarray>` of shape `(N, C)` Collection of `N` input vectors, each with dimension `C...
[ "def", "_kernel", "(", "self", ",", "X", ",", "Y", "=", "None", ")", ":", "P", "=", "self", ".", "parameters", "X", ",", "Y", "=", "kernel_checks", "(", "X", ",", "Y", ")", "sigma", "=", "np", ".", "sqrt", "(", "X", ".", "shape", "[", "1", ...
https://github.com/ddbourgin/numpy-ml/blob/b0359af5285fbf9699d64fd5ec059493228af03e/numpy_ml/utils/kernels.py#L217-L238
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/billiard/managers.py
python
Server.fallback_str
(self, conn, ident, obj)
return str(obj)
[]
def fallback_str(self, conn, ident, obj): return str(obj)
[ "def", "fallback_str", "(", "self", ",", "conn", ",", "ident", ",", "obj", ")", ":", "return", "str", "(", "obj", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/billiard/managers.py#L308-L309
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/vod/v20180717/models.py
python
AiReviewPoliticalAsrTaskOutput.__init__
(self)
r""" :param Confidence: Asr 文字涉及令人不适宜的信息、违规评分,分值为0到100。 :type Confidence: float :param Suggestion: Asr 文字涉及令人不适宜的信息、违规结果建议,取值范围: <li>pass。</li> <li>review。</li> <li>block。</li> :type Suggestion: str :param SegmentSet: Asr 文字有涉及令人不适宜的信息、违规嫌疑的视频片段列表。 <font color=red>注意</font> :该列表最...
r""" :param Confidence: Asr 文字涉及令人不适宜的信息、违规评分,分值为0到100。 :type Confidence: float :param Suggestion: Asr 文字涉及令人不适宜的信息、违规结果建议,取值范围: <li>pass。</li> <li>review。</li> <li>block。</li> :type Suggestion: str :param SegmentSet: Asr 文字有涉及令人不适宜的信息、违规嫌疑的视频片段列表。 <font color=red>注意</font> :该列表最...
[ "r", ":", "param", "Confidence", ":", "Asr", "文字涉及令人不适宜的信息、违规评分,分值为0到100。", ":", "type", "Confidence", ":", "float", ":", "param", "Suggestion", ":", "Asr", "文字涉及令人不适宜的信息、违规结果建议,取值范围:", "<li", ">", "pass。<", "/", "li", ">", "<li", ">", "review。<", "/", "li", ...
def __init__(self): r""" :param Confidence: Asr 文字涉及令人不适宜的信息、违规评分,分值为0到100。 :type Confidence: float :param Suggestion: Asr 文字涉及令人不适宜的信息、违规结果建议,取值范围: <li>pass。</li> <li>review。</li> <li>block。</li> :type Suggestion: str :param SegmentSet: Asr 文字有涉及令人不适宜的信息、违规嫌疑的视频片段列表。 <fo...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Confidence", "=", "None", "self", ".", "Suggestion", "=", "None", "self", ".", "SegmentSet", "=", "None", "self", ".", "SegmentSetFileUrl", "=", "None", "self", ".", "SegmentSetFileUrlExpireTime", "=", ...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vod/v20180717/models.py#L2673-L2694
GNS3/gns3-server
aff06572d4173df945ad29ea8feb274f7885d9e4
gns3server/compute/dynamips/nodes/router.py
python
Router.system_id
(self)
return self._system_id
Returns the system ID. :returns: the system ID (also called board processor ID)
Returns the system ID.
[ "Returns", "the", "system", "ID", "." ]
def system_id(self): """ Returns the system ID. :returns: the system ID (also called board processor ID) """ return self._system_id
[ "def", "system_id", "(", "self", ")", ":", "return", "self", ".", "_system_id" ]
https://github.com/GNS3/gns3-server/blob/aff06572d4173df945ad29ea8feb274f7885d9e4/gns3server/compute/dynamips/nodes/router.py#L1034-L1041
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/rebulk/loose.py
python
ensure_list
(param)
return param
Retrieves a list from given parameter. :param param: :type param: :return: :rtype:
Retrieves a list from given parameter.
[ "Retrieves", "a", "list", "from", "given", "parameter", "." ]
def ensure_list(param): """ Retrieves a list from given parameter. :param param: :type param: :return: :rtype: """ if not param: param = [] elif not is_iterable(param): param = [param] return param
[ "def", "ensure_list", "(", "param", ")", ":", "if", "not", "param", ":", "param", "=", "[", "]", "elif", "not", "is_iterable", "(", "param", ")", ":", "param", "=", "[", "param", "]", "return", "param" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/rebulk/loose.py#L153-L166
zenodo/zenodo
3c45e52a742ad5a0a7788a67b02fbbc15ab4d8d5
zenodo/modules/utils/tasks.py
python
update_search_pattern_sets
()
Update all records affected by search-patterned OAISets. In order to avoid racing condition when editing the records, all OAISet task groups are chained.
Update all records affected by search-patterned OAISets.
[ "Update", "all", "records", "affected", "by", "search", "-", "patterned", "OAISets", "." ]
def update_search_pattern_sets(): """Update all records affected by search-patterned OAISets. In order to avoid racing condition when editing the records, all OAISet task groups are chained. """ oaisets = OAISet.query.filter(OAISet.search_pattern.isnot(None)) chain(make_oai_task_group(oais) for...
[ "def", "update_search_pattern_sets", "(", ")", ":", "oaisets", "=", "OAISet", ".", "query", ".", "filter", "(", "OAISet", ".", "search_pattern", ".", "isnot", "(", "None", ")", ")", "chain", "(", "make_oai_task_group", "(", "oais", ")", "for", "oais", "in"...
https://github.com/zenodo/zenodo/blob/3c45e52a742ad5a0a7788a67b02fbbc15ab4d8d5/zenodo/modules/utils/tasks.py#L265-L272
IlyaGusev/rupo
83a5fac0dddd480a401181e5465f0e3c94ad2dcc
rupo/util/preprocess.py
python
get_first_vowel_position
(string)
return -1
[]
def get_first_vowel_position(string): for i, ch in enumerate(string): if ch in VOWELS: return i return -1
[ "def", "get_first_vowel_position", "(", "string", ")", ":", "for", "i", ",", "ch", "in", "enumerate", "(", "string", ")", ":", "if", "ch", "in", "VOWELS", ":", "return", "i", "return", "-", "1" ]
https://github.com/IlyaGusev/rupo/blob/83a5fac0dddd480a401181e5465f0e3c94ad2dcc/rupo/util/preprocess.py#L60-L64
intel/fMBT
a221c55cd7b6367aa458781b134ae155aa47a71f
utils/fmbtx11.py
python
Screen.refreshView
(self, window=None, forcedView=None, viewSource=None)
return self._lastView
Update toolkit data
Update toolkit data
[ "Update", "toolkit", "data" ]
def refreshView(self, window=None, forcedView=None, viewSource=None): """Update toolkit data""" self._lastView = None if window == None: window = self._refreshViewDefaults.get("window", None) if viewSource == None: viewSource = self._refreshViewDefaults.get("viewS...
[ "def", "refreshView", "(", "self", ",", "window", "=", "None", ",", "forcedView", "=", "None", ",", "viewSource", "=", "None", ")", ":", "self", ".", "_lastView", "=", "None", "if", "window", "==", "None", ":", "window", "=", "self", ".", "_refreshView...
https://github.com/intel/fMBT/blob/a221c55cd7b6367aa458781b134ae155aa47a71f/utils/fmbtx11.py#L309-L329
ValvePython/steam
7aef9d2df57c2195f35bd85013e1b5ccb04624a5
steam/game_servers.py
python
a2s_info
(server_addr, timeout=2, force_goldsrc=False, challenge=0)
return info
Get information from a server .. note:: All ``GoldSrc`` games have been updated to reply in ``Source`` format. ``GoldSrc`` format is essentially DEPRECATED. By default the function will prefer to return ``Source`` format, and will automatically fallback to ``GoldSrc`` if available. ...
Get information from a server
[ "Get", "information", "from", "a", "server" ]
def a2s_info(server_addr, timeout=2, force_goldsrc=False, challenge=0): """Get information from a server .. note:: All ``GoldSrc`` games have been updated to reply in ``Source`` format. ``GoldSrc`` format is essentially DEPRECATED. By default the function will prefer to return ``Source`...
[ "def", "a2s_info", "(", "server_addr", ",", "timeout", "=", "2", ",", "force_goldsrc", "=", "False", ",", "challenge", "=", "0", ")", ":", "ss", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_DGRAM", ")", "ss", ...
https://github.com/ValvePython/steam/blob/7aef9d2df57c2195f35bd85013e1b5ccb04624a5/steam/game_servers.py#L311-L465
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/lib2to3/patcomp.py
python
PatternCompiler.compile_pattern
(self, input, debug=False, with_tree=False)
Compiles a pattern string to a nested pytree.*Pattern object.
Compiles a pattern string to a nested pytree.*Pattern object.
[ "Compiles", "a", "pattern", "string", "to", "a", "nested", "pytree", ".", "*", "Pattern", "object", "." ]
def compile_pattern(self, input, debug=False, with_tree=False): """Compiles a pattern string to a nested pytree.*Pattern object.""" tokens = tokenize_wrapper(input) try: root = self.driver.parse_tokens(tokens, debug=debug) except parse.ParseError as e: raise Patte...
[ "def", "compile_pattern", "(", "self", ",", "input", ",", "debug", "=", "False", ",", "with_tree", "=", "False", ")", ":", "tokens", "=", "tokenize_wrapper", "(", "input", ")", "try", ":", "root", "=", "self", ".", "driver", ".", "parse_tokens", "(", "...
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/lib2to3/patcomp.py#L55-L65
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/werkzeug/utils.py
python
append_slash_redirect
(environ, code=301)
return redirect(new_path, code)
Redirects to the same URL but with a slash appended. The behavior of this function is undefined if the path ends with a slash already. :param environ: the WSGI environment for the request that triggers the redirect. :param code: the status code for the redirect.
Redirects to the same URL but with a slash appended. The behavior of this function is undefined if the path ends with a slash already.
[ "Redirects", "to", "the", "same", "URL", "but", "with", "a", "slash", "appended", ".", "The", "behavior", "of", "this", "function", "is", "undefined", "if", "the", "path", "ends", "with", "a", "slash", "already", "." ]
def append_slash_redirect(environ, code=301): """Redirects to the same URL but with a slash appended. The behavior of this function is undefined if the path ends with a slash already. :param environ: the WSGI environment for the request that triggers the redirect. :param code: the ...
[ "def", "append_slash_redirect", "(", "environ", ",", "code", "=", "301", ")", ":", "new_path", "=", "environ", "[", "'PATH_INFO'", "]", ".", "strip", "(", "'/'", ")", "+", "'/'", "query_string", "=", "environ", ".", "get", "(", "'QUERY_STRING'", ")", "if...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/utils.py#L384-L396
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/selenium/webdriver/opera/options.py
python
Options.android_device_socket
(self, value)
Allows you to set the devtools socket name :Args: - value: devtools socket name
Allows you to set the devtools socket name
[ "Allows", "you", "to", "set", "the", "devtools", "socket", "name" ]
def android_device_socket(self, value): """ Allows you to set the devtools socket name :Args: - value: devtools socket name """ self._android_device_socket = value
[ "def", "android_device_socket", "(", "self", ",", "value", ")", ":", "self", ".", "_android_device_socket", "=", "value" ]
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/selenium/webdriver/opera/options.py#L55-L62
determined-ai/determined
f637264493acc14f12e66550cb51c520b5d27f6c
examples/hp_search_benchmarks/darts_penntreebank_pytorch/model_def.py
python
DARTSRNNTrial.evaluate_full_dataset
(self, data_loader: torch.utils.data.DataLoader)
return {"loss": total_loss, "perplexity": perplexity}
Evaluates the full dataset against the given arch
Evaluates the full dataset against the given arch
[ "Evaluates", "the", "full", "dataset", "against", "the", "given", "arch" ]
def evaluate_full_dataset(self, data_loader: torch.utils.data.DataLoader): """ Evaluates the full dataset against the given arch """ # If optimizer is ASGD, we'll have to save current params # to a tmp var and copy over averaged params to use for eval. if self._optimizer....
[ "def", "evaluate_full_dataset", "(", "self", ",", "data_loader", ":", "torch", ".", "utils", ".", "data", ".", "DataLoader", ")", ":", "# If optimizer is ASGD, we'll have to save current params", "# to a tmp var and copy over averaged params to use for eval.", "if", "self", "...
https://github.com/determined-ai/determined/blob/f637264493acc14f12e66550cb51c520b5d27f6c/examples/hp_search_benchmarks/darts_penntreebank_pytorch/model_def.py#L233-L288
wang502/slack-sql
f6531e8bad65c09be779469c3bebdc89a28eccbf
PyGreSQL-5.0/build/lib.macosx-10.11-intel-2.7/pg.py
python
Adapter._adapt_date
(cls, v)
return v
Adapt a date parameter.
Adapt a date parameter.
[ "Adapt", "a", "date", "parameter", "." ]
def _adapt_date(cls, v): """Adapt a date parameter.""" if not v: return None if isinstance(v, basestring) and v.lower() in cls._date_literals: return Literal(v) return v
[ "def", "_adapt_date", "(", "cls", ",", "v", ")", ":", "if", "not", "v", ":", "return", "None", "if", "isinstance", "(", "v", ",", "basestring", ")", "and", "v", ".", "lower", "(", ")", "in", "cls", ".", "_date_literals", ":", "return", "Literal", "...
https://github.com/wang502/slack-sql/blob/f6531e8bad65c09be779469c3bebdc89a28eccbf/PyGreSQL-5.0/build/lib.macosx-10.11-intel-2.7/pg.py#L340-L346
HenriWahl/Nagstamon
16549c6860b51a93141d84881c6ad28c35d8581e
Nagstamon/Helpers.py
python
webbrowser_open
(url)
decide if default or custom browser is used for various tasks used by almost all
decide if default or custom browser is used for various tasks used by almost all
[ "decide", "if", "default", "or", "custom", "browser", "is", "used", "for", "various", "tasks", "used", "by", "almost", "all" ]
def webbrowser_open(url): """ decide if default or custom browser is used for various tasks used by almost all """ if conf.use_default_browser: webbrowser.open(url) else: webbrowser.get('{0} %s &'.format(conf.custom_browser)).open(url)
[ "def", "webbrowser_open", "(", "url", ")", ":", "if", "conf", ".", "use_default_browser", ":", "webbrowser", ".", "open", "(", "url", ")", "else", ":", "webbrowser", ".", "get", "(", "'{0} %s &'", ".", "format", "(", "conf", ".", "custom_browser", ")", "...
https://github.com/HenriWahl/Nagstamon/blob/16549c6860b51a93141d84881c6ad28c35d8581e/Nagstamon/Helpers.py#L432-L440
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/layout/_coloraxis.py
python
Coloraxis.__init__
( self, arg=None, autocolorscale=None, cauto=None, cmax=None, cmid=None, cmin=None, colorbar=None, colorscale=None, reversescale=None, showscale=None, **kwargs )
Construct a new Coloraxis object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.Coloraxis` autocolorscale Determines whether the colorscale is a defa...
Construct a new Coloraxis object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.Coloraxis` autocolorscale Determines whether the colorscale is a defa...
[ "Construct", "a", "new", "Coloraxis", "object", "Parameters", "----------", "arg", "dict", "of", "properties", "compatible", "with", "this", "constructor", "or", "an", "instance", "of", ":", "class", ":", "plotly", ".", "graph_objs", ".", "layout", ".", "Color...
def __init__( self, arg=None, autocolorscale=None, cauto=None, cmax=None, cmid=None, cmin=None, colorbar=None, colorscale=None, reversescale=None, showscale=None, **kwargs ): """ Construct a new Coloraxis...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "autocolorscale", "=", "None", ",", "cauto", "=", "None", ",", "cmax", "=", "None", ",", "cmid", "=", "None", ",", "cmin", "=", "None", ",", "colorbar", "=", "None", ",", "colorscale", "...
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/_coloraxis.py#L549-L697
quodlibet/quodlibet
e3099c89f7aa6524380795d325cc14630031886c
quodlibet/ext/events/trayicon/base.py
python
BaseIndicator.popup_menu
(self)
Show the context menu as if the icon was pressed. Mainly for testing
Show the context menu as if the icon was pressed.
[ "Show", "the", "context", "menu", "as", "if", "the", "icon", "was", "pressed", "." ]
def popup_menu(self): """Show the context menu as if the icon was pressed. Mainly for testing """ pass
[ "def", "popup_menu", "(", "self", ")", ":", "pass" ]
https://github.com/quodlibet/quodlibet/blob/e3099c89f7aa6524380795d325cc14630031886c/quodlibet/ext/events/trayicon/base.py#L37-L43
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/django/utils/html.py
python
linebreaks
(value, autoescape=False)
return '\n\n'.join(paras)
Converts newlines into <p> and <br />s.
Converts newlines into <p> and <br />s.
[ "Converts", "newlines", "into", "<p", ">", "and", "<br", "/", ">", "s", "." ]
def linebreaks(value, autoescape=False): """Converts newlines into <p> and <br />s.""" value = normalize_newlines(value) paras = re.split('\n{2,}', value) if autoescape: paras = ['<p>%s</p>' % escape(p).replace('\n', '<br />') for p in paras] else: paras = ['<p>%s</p>' % p.replace('\...
[ "def", "linebreaks", "(", "value", ",", "autoescape", "=", "False", ")", ":", "value", "=", "normalize_newlines", "(", "value", ")", "paras", "=", "re", ".", "split", "(", "'\\n{2,}'", ",", "value", ")", "if", "autoescape", ":", "paras", "=", "[", "'<p...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/utils/html.py#L104-L112
lxml/lxml
4eff06df2f25e07e7b46954bd2bd02920b470cf9
src/lxml/html/clean.py
python
Cleaner.kill_conditional_comments
(self, doc)
IE conditional comments basically embed HTML that the parser doesn't normally see. We can't allow anything like that, so we'll kill any comments that could be conditional.
IE conditional comments basically embed HTML that the parser doesn't normally see. We can't allow anything like that, so we'll kill any comments that could be conditional.
[ "IE", "conditional", "comments", "basically", "embed", "HTML", "that", "the", "parser", "doesn", "t", "normally", "see", ".", "We", "can", "t", "allow", "anything", "like", "that", "so", "we", "ll", "kill", "any", "comments", "that", "could", "be", "condit...
def kill_conditional_comments(self, doc): """ IE conditional comments basically embed HTML that the parser doesn't normally see. We can't allow anything like that, so we'll kill any comments that could be conditional. """ has_conditional_comment = _conditional_comment_re...
[ "def", "kill_conditional_comments", "(", "self", ",", "doc", ")", ":", "has_conditional_comment", "=", "_conditional_comment_re", ".", "search", "self", ".", "_kill_elements", "(", "doc", ",", "lambda", "el", ":", "has_conditional_comment", "(", "el", ".", "text",...
https://github.com/lxml/lxml/blob/4eff06df2f25e07e7b46954bd2bd02920b470cf9/src/lxml/html/clean.py#L501-L510
meduza-corp/interstellar
40a801ccd7856491726f5a126621d9318cabe2e1
gsutil/third_party/crcmod/python2/crcmod/crcmod.py
python
Crc.hexdigest
(self)
return ''.join(lst)
Return the current CRC value as a string of hex digits. The length of this string is twice the digest_size attribute.
Return the current CRC value as a string of hex digits. The length of this string is twice the digest_size attribute.
[ "Return", "the", "current", "CRC", "value", "as", "a", "string", "of", "hex", "digits", ".", "The", "length", "of", "this", "string", "is", "twice", "the", "digest_size", "attribute", "." ]
def hexdigest(self): '''Return the current CRC value as a string of hex digits. The length of this string is twice the digest_size attribute. ''' n = self.digest_size crc = self.crcValue lst = [] while n > 0: lst.append('%02X' % (crc & 0xFF)) ...
[ "def", "hexdigest", "(", "self", ")", ":", "n", "=", "self", ".", "digest_size", "crc", "=", "self", ".", "crcValue", "lst", "=", "[", "]", "while", "n", ">", "0", ":", "lst", ".", "append", "(", "'%02X'", "%", "(", "crc", "&", "0xFF", ")", ")"...
https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/crcmod/python2/crcmod/crcmod.py#L167-L179
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
calendarserver/tap/caldav.py
python
CalDAVServiceMaker._spawnMemcached
(self, monitor=None)
Optionally start memcached through the specified ProcessMonitor, or if monitor is None, use Popen.
Optionally start memcached through the specified ProcessMonitor, or if monitor is None, use Popen.
[ "Optionally", "start", "memcached", "through", "the", "specified", "ProcessMonitor", "or", "if", "monitor", "is", "None", "use", "Popen", "." ]
def _spawnMemcached(self, monitor=None): """ Optionally start memcached through the specified ProcessMonitor, or if monitor is None, use Popen. """ for name, pool in config.Memcached.Pools.items(): if pool.ServerEnabled: memcachedArgv = [ ...
[ "def", "_spawnMemcached", "(", "self", ",", "monitor", "=", "None", ")", ":", "for", "name", ",", "pool", "in", "config", ".", "Memcached", ".", "Pools", ".", "items", "(", ")", ":", "if", "pool", ".", "ServerEnabled", ":", "memcachedArgv", "=", "[", ...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tap/caldav.py#L1246-L1281
pyqt/examples
843bb982917cecb2350b5f6d7f42c9b7fb142ec1
src/pyqt-official/sql/tablemodel.py
python
createView
(title, model)
return view
[]
def createView(title, model): view = QTableView() view.setModel(model) view.setWindowTitle(title) return view
[ "def", "createView", "(", "title", ",", "model", ")", ":", "view", "=", "QTableView", "(", ")", "view", ".", "setModel", "(", "model", ")", "view", ".", "setWindowTitle", "(", "title", ")", "return", "view" ]
https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/sql/tablemodel.py#L63-L67
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/artist.py
python
Artist.get_snap
(self)
Returns the snap setting which may be: * True: snap vertices to the nearest pixel center * False: leave vertices as-is * None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center Only supported by the Agg and MacOSX backends...
Returns the snap setting which may be:
[ "Returns", "the", "snap", "setting", "which", "may", "be", ":" ]
def get_snap(self): """ Returns the snap setting which may be: * True: snap vertices to the nearest pixel center * False: leave vertices as-is * None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center Only ...
[ "def", "get_snap", "(", "self", ")", ":", "if", "rcParams", "[", "'path.snap'", "]", ":", "return", "self", ".", "_snap", "else", ":", "return", "False" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/artist.py#L522-L538
mrjoes/tornadio
cae72634113139b6003d869ba3f95054c1b9513f
tornadio/router.py
python
SocketRouterBase.connection
(self)
return self._connection
Return associated connection class.
Return associated connection class.
[ "Return", "associated", "connection", "class", "." ]
def connection(self): """Return associated connection class.""" return self._connection
[ "def", "connection", "(", "self", ")", ":", "return", "self", ".", "_connection" ]
https://github.com/mrjoes/tornadio/blob/cae72634113139b6003d869ba3f95054c1b9513f/tornadio/router.py#L86-L88
SickChill/SickChill
01020f3636d01535f60b83464d8127ea0efabfc7
sickchill/adba/aniDBresponses.py
python
NoSuchVoteResponse.__init__
(self, cmd, restag, rescode, resstr, datalines)
attributes: data:
attributes:
[ "attributes", ":" ]
def __init__(self, cmd, restag, rescode, resstr, datalines): """ attributes: data: """ super().__init__(cmd, restag, rescode, resstr, datalines) self.codestr = "NO_SUCH_VOTE" self.codehead = () self.codetail = () self.coderep = ()
[ "def", "__init__", "(", "self", ",", "cmd", ",", "restag", ",", "rescode", ",", "resstr", ",", "datalines", ")", ":", "super", "(", ")", ".", "__init__", "(", "cmd", ",", "restag", ",", "rescode", ",", "resstr", ",", "datalines", ")", "self", ".", ...
https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/adba/aniDBresponses.py#L1444-L1455
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
tensorflow_dl_models/research/capsules/models/layers/layers.py
python
conv_slim_capsule
(input_tensor, input_dim, output_dim, layer_name, input_atoms=8, output_atoms=8, stride=2, kernel_size=5, padding='SAME', ...
Builds a slim convolutional capsule layer. This layer performs 2D convolution given 5D input tensor of shape `[batch, input_dim, input_atoms, input_height, input_width]`. Then refines the votes with routing and applies Squash non linearity for each capsule. Each capsule in this layer is a convolutional unit a...
Builds a slim convolutional capsule layer.
[ "Builds", "a", "slim", "convolutional", "capsule", "layer", "." ]
def conv_slim_capsule(input_tensor, input_dim, output_dim, layer_name, input_atoms=8, output_atoms=8, stride=2, kernel_size=5, padding='SAME', ...
[ "def", "conv_slim_capsule", "(", "input_tensor", ",", "input_dim", ",", "output_dim", ",", "layer_name", ",", "input_atoms", "=", "8", ",", "output_atoms", "=", "8", ",", "stride", "=", "2", ",", "kernel_size", "=", "5", ",", "padding", "=", "'SAME'", ",",...
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/capsules/models/layers/layers.py#L268-L338
wummel/linkchecker
c2ce810c3fb00b895a841a7be6b2e78c64e7b042
linkcheck/threader.py
python
StoppableThread.__init__
(self)
Store stop event.
Store stop event.
[ "Store", "stop", "event", "." ]
def __init__ (self): """Store stop event.""" super(StoppableThread, self).__init__() self._stop = threading.Event()
[ "def", "__init__", "(", "self", ")", ":", "super", "(", "StoppableThread", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "_stop", "=", "threading", ".", "Event", "(", ")" ]
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/threader.py#L27-L30
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/pysaml2-4.9.0/src/saml2/ecp_client.py
python
Client.operation
(self, url, idp_entity_id, op, **opargs)
return response
This is the method that should be used by someone that wants to authenticate using SAML ECP :param url: The page that access is sought for :param idp_entity_id: The entity ID of the IdP that should be used for authentication :param op: Which HTTP operation (GET/POST/PUT/DELE...
This is the method that should be used by someone that wants to authenticate using SAML ECP
[ "This", "is", "the", "method", "that", "should", "be", "used", "by", "someone", "that", "wants", "to", "authenticate", "using", "SAML", "ECP" ]
def operation(self, url, idp_entity_id, op, **opargs): """ This is the method that should be used by someone that wants to authenticate using SAML ECP :param url: The page that access is sought for :param idp_entity_id: The entity ID of the IdP that should be used fo...
[ "def", "operation", "(", "self", ",", "url", ",", "idp_entity_id", ",", "op", ",", "*", "*", "opargs", ")", ":", "sp_url", "=", "self", ".", "_sp", "# ********************************************", "# Phase 1 - First conversation with the SP", "# ***********************...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pysaml2-4.9.0/src/saml2/ecp_client.py#L250-L299
theeluwin/pytorch-sgns
2d007c700545ae2a3e44b1f4bf37fa1b034a7d27
preprocess.py
python
parse_args
()
return parser.parse_args()
[]
def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--data_dir', type=str, default='./data/', help="data directory path") parser.add_argument('--vocab', type=str, default='./data/corpus.txt', help="corpus path for building vocab") parser.add_argument('--corpus', type=str, default='...
[ "def", "parse_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--data_dir'", ",", "type", "=", "str", ",", "default", "=", "'./data/'", ",", "help", "=", "\"data directory path\"", ")", ...
https://github.com/theeluwin/pytorch-sgns/blob/2d007c700545ae2a3e44b1f4bf37fa1b034a7d27/preprocess.py#L9-L17
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/tornado/template.py
python
_NamedBlock.generate
(self, writer: "_CodeWriter")
[]
def generate(self, writer: "_CodeWriter") -> None: block = writer.named_blocks[self.name] with writer.include(block.template, self.line): block.body.generate(writer)
[ "def", "generate", "(", "self", ",", "writer", ":", "\"_CodeWriter\"", ")", "->", "None", ":", "block", "=", "writer", ".", "named_blocks", "[", "self", ".", "name", "]", "with", "writer", ".", "include", "(", "block", ".", "template", ",", "self", "."...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/tornado/template.py#L557-L560
joke2k/faker
0ebe46fc9b9793fe315cf0fce430258ce74df6f8
faker/providers/misc/__init__.py
python
Provider.null_boolean
(self)
return { 0: None, 1: True, -1: False, }[self.generator.random.randint(-1, 1)]
Generate ``None``, ``True``, or ``False``, each with equal probability. :sample size=15:
Generate ``None``, ``True``, or ``False``, each with equal probability.
[ "Generate", "None", "True", "or", "False", "each", "with", "equal", "probability", "." ]
def null_boolean(self) -> Optional[bool]: """Generate ``None``, ``True``, or ``False``, each with equal probability. :sample size=15: """ return { 0: None, 1: True, -1: False, }[self.generator.random.randint(-1, 1)]
[ "def", "null_boolean", "(", "self", ")", "->", "Optional", "[", "bool", "]", ":", "return", "{", "0", ":", "None", ",", "1", ":", "True", ",", "-", "1", ":", "False", ",", "}", "[", "self", ".", "generator", ".", "random", ".", "randint", "(", ...
https://github.com/joke2k/faker/blob/0ebe46fc9b9793fe315cf0fce430258ce74df6f8/faker/providers/misc/__init__.py#L32-L41
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/interfaces/giac.py
python
Giac.console
(self)
Spawn a new Giac command-line session. EXAMPLES:: sage: giac_console() # not tested - giac ... Homepage http://www-fourier.ujf-grenoble.fr/~parisse/giac.html Released under the GPL license 3.0 or above See http://www.gnu.org for lic...
Spawn a new Giac command-line session.
[ "Spawn", "a", "new", "Giac", "command", "-", "line", "session", "." ]
def console(self): """ Spawn a new Giac command-line session. EXAMPLES:: sage: giac_console() # not tested - giac ... Homepage http://www-fourier.ujf-grenoble.fr/~parisse/giac.html Released under the GPL license 3.0 or above ...
[ "def", "console", "(", "self", ")", ":", "giac_console", "(", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/giac.py#L467-L484
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
vsphere/datadog_checks/vsphere/legacy/vsphere_legacy.py
python
VSphereLegacyCheck._cache_morlist_raw
(self, instance)
Fill the Mor objects queue that will be asynchronously processed later. Resolve the vCenter `rootFolder` and initiate hosts and virtual machines discovery.
Fill the Mor objects queue that will be asynchronously processed later. Resolve the vCenter `rootFolder` and initiate hosts and virtual machines discovery.
[ "Fill", "the", "Mor", "objects", "queue", "that", "will", "be", "asynchronously", "processed", "later", ".", "Resolve", "the", "vCenter", "rootFolder", "and", "initiate", "hosts", "and", "virtual", "machines", "discovery", "." ]
def _cache_morlist_raw(self, instance): """ Fill the Mor objects queue that will be asynchronously processed later. Resolve the vCenter `rootFolder` and initiate hosts and virtual machines discovery. """ i_key = self._instance_key(instance) self.log.debug("Caching...
[ "def", "_cache_morlist_raw", "(", "self", ",", "instance", ")", ":", "i_key", "=", "self", ".", "_instance_key", "(", "instance", ")", "self", ".", "log", ".", "debug", "(", "\"Caching the morlist for vcenter instance %s\"", ",", "i_key", ")", "# If the queue is n...
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/vsphere/datadog_checks/vsphere/legacy/vsphere_legacy.py#L625-L662
hydroshare/hydroshare
7ba563b55412f283047fb3ef6da367d41dec58c6
hs_core/models.py
python
ResourceFile.__str__
(self)
Return resource filename or federated resource filename for string representation.
Return resource filename or federated resource filename for string representation.
[ "Return", "resource", "filename", "or", "federated", "resource", "filename", "for", "string", "representation", "." ]
def __str__(self): """Return resource filename or federated resource filename for string representation.""" if self.resource.resource_federation_path: return self.fed_resource_file.name else: return self.resource_file.name
[ "def", "__str__", "(", "self", ")", ":", "if", "self", ".", "resource", ".", "resource_federation_path", ":", "return", "self", ".", "fed_resource_file", ".", "name", "else", ":", "return", "self", ".", "resource_file", ".", "name" ]
https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_core/models.py#L2810-L2815
pypa/pip
7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4
src/pip/_vendor/tenacity/before_sleep.py
python
before_sleep_nothing
(retry_state: "RetryCallState")
Before call strategy that does nothing.
Before call strategy that does nothing.
[ "Before", "call", "strategy", "that", "does", "nothing", "." ]
def before_sleep_nothing(retry_state: "RetryCallState") -> None: """Before call strategy that does nothing."""
[ "def", "before_sleep_nothing", "(", "retry_state", ":", "\"RetryCallState\"", ")", "->", "None", ":" ]
https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/tenacity/before_sleep.py#L27-L28
cournape/Bento
37de23d784407a7c98a4a15770ffc570d5f32d70
bento/compat/_functools.py
python
partial
(func, *a, **kw)
return f
[]
def partial(func, *a, **kw): def f(*_a, **_kw): new_a = list(a) + list(_a) new_kw = kw new_kw.update(_kw) return func(*new_a, **new_kw) f = update_wrapper(f, func) return f
[ "def", "partial", "(", "func", ",", "*", "a", ",", "*", "*", "kw", ")", ":", "def", "f", "(", "*", "_a", ",", "*", "*", "_kw", ")", ":", "new_a", "=", "list", "(", "a", ")", "+", "list", "(", "_a", ")", "new_kw", "=", "kw", "new_kw", ".",...
https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/compat/_functools.py#L39-L46
MouseLand/suite2p
12dc119ac0c7c4355e9cd3e07bebc447755623e4
suite2p/registration/metrics.py
python
get_pc_metrics
(ops, use_red=False)
return ops
Computes registration metrics using top PCs of registered movie movie saved as binary file ops['reg_file'] metrics saved to ops['regPC'] and ops['X'] 'regDX' is nPC x 3 where X[:,0] is rigid, X[:,1] is average nonrigid, X[:,2] is max nonrigid shifts 'regPC' is average of top and bottom frames for each ...
Computes registration metrics using top PCs of registered movie
[ "Computes", "registration", "metrics", "using", "top", "PCs", "of", "registered", "movie" ]
def get_pc_metrics(ops, use_red=False): """ Computes registration metrics using top PCs of registered movie movie saved as binary file ops['reg_file'] metrics saved to ops['regPC'] and ops['X'] 'regDX' is nPC x 3 where X[:,0] is rigid, X[:,1] is average nonrigid, X[:,2] is max nonrigid shifts '...
[ "def", "get_pc_metrics", "(", "ops", ",", "use_red", "=", "False", ")", ":", "random_state", "=", "ops", "[", "'reg_metrics_rs'", "]", "if", "'reg_metrics_rs'", "in", "ops", "else", "None", "nPC", "=", "ops", "[", "'reg_metric_n_pc'", "]", "if", "'reg_metric...
https://github.com/MouseLand/suite2p/blob/12dc119ac0c7c4355e9cd3e07bebc447755623e4/suite2p/registration/metrics.py#L197-L252
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/zwave_js/sensor.py
python
ZWaveListSensor.extra_state_attributes
(self)
return {ATTR_VALUE: self.info.primary_value.value}
Return the device specific state attributes.
Return the device specific state attributes.
[ "Return", "the", "device", "specific", "state", "attributes", "." ]
def extra_state_attributes(self) -> dict[str, str] | None: """Return the device specific state attributes.""" # add the value's int value as property for multi-value (list) items return {ATTR_VALUE: self.info.primary_value.value}
[ "def", "extra_state_attributes", "(", "self", ")", "->", "dict", "[", "str", ",", "str", "]", "|", "None", ":", "# add the value's int value as property for multi-value (list) items", "return", "{", "ATTR_VALUE", ":", "self", ".", "info", ".", "primary_value", ".", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/zwave_js/sensor.py#L403-L406
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/ocr/v20181119/models.py
python
VehicleLicenseOCRRequest.__init__
(self)
r""" :param ImageBase64: 图片的 Base64 值。要求图片经Base64编码后不超过 7M,分辨率建议500*800以上,支持PNG、JPG、JPEG、BMP格式。建议卡片部分占据图片2/3以上。 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。 :type ImageBase64: str :param ImageUrl: 图片的 Url 地址。要求图片经Base64编码后不超过 7M,分辨率建议500*800以上,支持PNG、JPG、JPEG、BMP格式。建议卡片部分占据图片2/3以上。图片下载时间不超...
r""" :param ImageBase64: 图片的 Base64 值。要求图片经Base64编码后不超过 7M,分辨率建议500*800以上,支持PNG、JPG、JPEG、BMP格式。建议卡片部分占据图片2/3以上。 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。 :type ImageBase64: str :param ImageUrl: 图片的 Url 地址。要求图片经Base64编码后不超过 7M,分辨率建议500*800以上,支持PNG、JPG、JPEG、BMP格式。建议卡片部分占据图片2/3以上。图片下载时间不超...
[ "r", ":", "param", "ImageBase64", ":", "图片的", "Base64", "值。要求图片经Base64编码后不超过", "7M,分辨率建议500", "*", "800以上,支持PNG、JPG、JPEG、BMP格式。建议卡片部分占据图片2", "/", "3以上。", "图片的", "ImageUrl、ImageBase64", "必须提供一个,如果都提供,只使用", "ImageUrl。", ":", "type", "ImageBase64", ":", "str", ":", "param"...
def __init__(self): r""" :param ImageBase64: 图片的 Base64 值。要求图片经Base64编码后不超过 7M,分辨率建议500*800以上,支持PNG、JPG、JPEG、BMP格式。建议卡片部分占据图片2/3以上。 图片的 ImageUrl、ImageBase64 必须提供一个,如果都提供,只使用 ImageUrl。 :type ImageBase64: str :param ImageUrl: 图片的 Url 地址。要求图片经Base64编码后不超过 7M,分辨率建议500*800以上,支持PNG、JPG、JPEG、BM...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "ImageBase64", "=", "None", "self", ".", "ImageUrl", "=", "None", "self", ".", "CardSide", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ocr/v20181119/models.py#L7645-L7660
zatosource/zato
2a9d273f06f9d776fbfeb53e73855af6e40fa208
code/patches/requests/sessions.py
python
SessionRedirectMixin.rebuild_auth
(self, prepared_request, response)
When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss.
When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss.
[ "When", "being", "redirected", "we", "may", "want", "to", "strip", "authentication", "from", "the", "request", "to", "avoid", "leaking", "credentials", ".", "This", "method", "intelligently", "removes", "and", "reapplies", "authentication", "where", "possible", "t...
def rebuild_auth(self, prepared_request, response): """When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss. """ headers = pr...
[ "def", "rebuild_auth", "(", "self", ",", "prepared_request", ",", "response", ")", ":", "headers", "=", "prepared_request", ".", "headers", "url", "=", "prepared_request", ".", "url", "if", "'Authorization'", "in", "headers", "and", "self", ".", "should_strip_au...
https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/patches/requests/sessions.py#L254-L270
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/misc/help/inspector.py
python
HTMLFormatter.write_supported_item
(self, modname, itemname, typename, explained, sources, alias)
[]
def write_supported_item(self, modname, itemname, typename, explained, sources, alias): self.print('<li>') self.print('{}.<b>{}</b>'.format( modname, itemname, )) self.print(': <b>{}</b>'.format(typename)) self.print('<div><pre...
[ "def", "write_supported_item", "(", "self", ",", "modname", ",", "itemname", ",", "typename", ",", "explained", ",", "sources", ",", "alias", ")", ":", "self", ".", "print", "(", "'<li>'", ")", "self", ".", "print", "(", "'{}.<b>{}</b>'", ".", "format", ...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/misc/help/inspector.py#L231-L262
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/xml/sax/xmlreader.py
python
AttributesImpl.copy
(self)
return self.__class__(self._attrs)
[]
def copy(self): return self.__class__(self._attrs)
[ "def", "copy", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "self", ".", "_attrs", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/xml/sax/xmlreader.py#L330-L331
sharppy/SHARPpy
19175269ab11fe06c917b5d10376862a4716e1db
sharppy/viz/draggable.py
python
Draggable.setBackground
(self, background)
Change the background pixmap. background: A QPixmap containing the new background
Change the background pixmap. background: A QPixmap containing the new background
[ "Change", "the", "background", "pixmap", ".", "background", ":", "A", "QPixmap", "containing", "the", "new", "background" ]
def setBackground(self, background): """ Change the background pixmap. background: A QPixmap containing the new background """ self._background = background
[ "def", "setBackground", "(", "self", ",", "background", ")", ":", "self", ".", "_background", "=", "background" ]
https://github.com/sharppy/SHARPpy/blob/19175269ab11fe06c917b5d10376862a4716e1db/sharppy/viz/draggable.py#L176-L181
Yelp/clusterman
54beef89c01a2681aafd1fbb93b6ad5f6252d6cf
clusterman/monitoring_lib.py
python
TimerProtocol.start
(self, *args: Any, **kwargs: Any)
[]
def start(self, *args: Any, **kwargs: Any) -> None: ...
[ "def", "start", "(", "self", ",", "*", "args", ":", "Any", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "..." ]
https://github.com/Yelp/clusterman/blob/54beef89c01a2681aafd1fbb93b6ad5f6252d6cf/clusterman/monitoring_lib.py#L44-L45
tenpy/tenpy
bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff
tenpy/networks/mpo.py
python
MPOEnvironment.test_sanity
(self)
Sanity check, raises ValueErrors, if something is wrong.
Sanity check, raises ValueErrors, if something is wrong.
[ "Sanity", "check", "raises", "ValueErrors", "if", "something", "is", "wrong", "." ]
def test_sanity(self): """Sanity check, raises ValueErrors, if something is wrong.""" assert (self.bra.finite == self.ket.finite == self.H.finite == self._finite) # check that the physical legs are contractable for b_s, H_s, k_s in zip(self.bra.sites, self.H.sites, self.ket.sites): ...
[ "def", "test_sanity", "(", "self", ")", ":", "assert", "(", "self", ".", "bra", ".", "finite", "==", "self", ".", "ket", ".", "finite", "==", "self", ".", "H", ".", "finite", "==", "self", ".", "_finite", ")", "# check that the physical legs are contractab...
https://github.com/tenpy/tenpy/blob/bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff/tenpy/networks/mpo.py#L1876-L1884
jctissier/whatsapp-assistant-bot
e6429cd7ddcaf229257e597f08a53426df1f8ad7
whatsapp_assistant_bot.py
python
BotConfig.get_command_history
(self)
return "You have asked the following commands: " + ", ".join(self.command_history)
[]
def get_command_history(self): return "You have asked the following commands: " + ", ".join(self.command_history)
[ "def", "get_command_history", "(", "self", ")", ":", "return", "\"You have asked the following commands: \"", "+", "\", \"", ".", "join", "(", "self", ".", "command_history", ")" ]
https://github.com/jctissier/whatsapp-assistant-bot/blob/e6429cd7ddcaf229257e597f08a53426df1f8ad7/whatsapp_assistant_bot.py#L41-L42
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/docutils/parsers/rst/states.py
python
Body.split_attribution
(self, indented, line_offset)
Check for a block quote attribution and split it off: * First line after a blank line must begin with a dash ("--", "---", em-dash; matches `self.attribution_pattern`). * Every line after that must have consistent indentation. * Attributions must be preceded by block quote content. ...
Check for a block quote attribution and split it off:
[ "Check", "for", "a", "block", "quote", "attribution", "and", "split", "it", "off", ":" ]
def split_attribution(self, indented, line_offset): """ Check for a block quote attribution and split it off: * First line after a blank line must begin with a dash ("--", "---", em-dash; matches `self.attribution_pattern`). * Every line after that must have consistent indenta...
[ "def", "split_attribution", "(", "self", ",", "indented", ",", "line_offset", ")", ":", "blank", "=", "None", "nonblank_seen", "=", "False", "for", "i", "in", "range", "(", "len", "(", "indented", ")", ")", ":", "line", "=", "indented", "[", "i", "]", ...
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/docutils/parsers/rst/states.py#L1182-L1215
openai/random-network-distillation
f75c0f1efa473d5109d487062fd8ed49ddce6634
tf_util.py
python
huber_loss
(x, delta=1.0)
return tf.where( tf.abs(x) < delta, tf.square(x) * 0.5, delta * (tf.abs(x) - 0.5 * delta) )
Reference: https://en.wikipedia.org/wiki/Huber_loss
Reference: https://en.wikipedia.org/wiki/Huber_loss
[ "Reference", ":", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Huber_loss" ]
def huber_loss(x, delta=1.0): """Reference: https://en.wikipedia.org/wiki/Huber_loss""" return tf.where( tf.abs(x) < delta, tf.square(x) * 0.5, delta * (tf.abs(x) - 0.5 * delta) )
[ "def", "huber_loss", "(", "x", ",", "delta", "=", "1.0", ")", ":", "return", "tf", ".", "where", "(", "tf", ".", "abs", "(", "x", ")", "<", "delta", ",", "tf", ".", "square", "(", "x", ")", "*", "0.5", ",", "delta", "*", "(", "tf", ".", "ab...
https://github.com/openai/random-network-distillation/blob/f75c0f1efa473d5109d487062fd8ed49ddce6634/tf_util.py#L39-L45
jesseweisberg/moveo_ros
b9282bdadbf2505a26d3b94b91e60a98d86efa34
object_detector_app/object_detection/core/box_list_ops.py
python
matched_iou
(boxlist1, boxlist2, scope=None)
Compute intersection-over-union between corresponding boxes in boxlists. Args: boxlist1: BoxList holding N boxes boxlist2: BoxList holding N boxes scope: name scope. Returns: a tensor with shape [N] representing pairwise iou scores.
Compute intersection-over-union between corresponding boxes in boxlists.
[ "Compute", "intersection", "-", "over", "-", "union", "between", "corresponding", "boxes", "in", "boxlists", "." ]
def matched_iou(boxlist1, boxlist2, scope=None): """Compute intersection-over-union between corresponding boxes in boxlists. Args: boxlist1: BoxList holding N boxes boxlist2: BoxList holding N boxes scope: name scope. Returns: a tensor with shape [N] representing pairwise iou scores. """ wit...
[ "def", "matched_iou", "(", "boxlist1", ",", "boxlist2", ",", "scope", "=", "None", ")", ":", "with", "tf", ".", "name_scope", "(", "scope", ",", "'MatchedIOU'", ")", ":", "intersections", "=", "matched_intersection", "(", "boxlist1", ",", "boxlist2", ")", ...
https://github.com/jesseweisberg/moveo_ros/blob/b9282bdadbf2505a26d3b94b91e60a98d86efa34/object_detector_app/object_detection/core/box_list_ops.py#L275-L293
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/shelly/__init__.py
python
RpcDeviceWrapper._handle_ha_stop
(self, _event: Event)
Handle Home Assistant stopping.
Handle Home Assistant stopping.
[ "Handle", "Home", "Assistant", "stopping", "." ]
async def _handle_ha_stop(self, _event: Event) -> None: """Handle Home Assistant stopping.""" _LOGGER.debug("Stopping RpcDeviceWrapper for %s", self.name) await self.shutdown()
[ "async", "def", "_handle_ha_stop", "(", "self", ",", "_event", ":", "Event", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Stopping RpcDeviceWrapper for %s\"", ",", "self", ".", "name", ")", "await", "self", ".", "shutdown", "(", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/shelly/__init__.py#L767-L770
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbWuLiu.cainiao_member_courier_cpresign
( self, account_id )
return self._top_request( "cainiao.member.courier.cpresign", { "account_id": account_id } )
cp清理离职用户信息 CP清理内部离职的用户信息 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28075 :param account_id: 菜鸟用户id
cp清理离职用户信息 CP清理内部离职的用户信息 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28075
[ "cp清理离职用户信息", "CP清理内部离职的用户信息", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "28075" ]
def cainiao_member_courier_cpresign( self, account_id ): """ cp清理离职用户信息 CP清理内部离职的用户信息 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28075 :param account_id: 菜鸟用户id """ return self._top_request( "cainiao.member.couri...
[ "def", "cainiao_member_courier_cpresign", "(", "self", ",", "account_id", ")", ":", "return", "self", ".", "_top_request", "(", "\"cainiao.member.courier.cpresign\"", ",", "{", "\"account_id\"", ":", "account_id", "}", ")" ]
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L15919-L15935
traverseda/pycraft
24d6b97cd0c1c4649b86d91d4bb419834a03bdad
pycraft/objects/storage.py
python
Storage.retrieve_item_by_position
(self, position, quantity=1)
return False
Retrieve an item from the storage by position Parameters ---------- position quantity Returns -------
Retrieve an item from the storage by position Parameters ---------- position quantity
[ "Retrieve", "an", "item", "from", "the", "storage", "by", "position", "Parameters", "----------", "position", "quantity" ]
def retrieve_item_by_position(self, position, quantity=1): """ Retrieve an item from the storage by position Parameters ---------- position quantity Returns ------- """ if position in self.items: items = self.items[position].c...
[ "def", "retrieve_item_by_position", "(", "self", ",", "position", ",", "quantity", "=", "1", ")", ":", "if", "position", "in", "self", ".", "items", ":", "items", "=", "self", ".", "items", "[", "position", "]", ".", "copy", "(", ")", ".", "items", "...
https://github.com/traverseda/pycraft/blob/24d6b97cd0c1c4649b86d91d4bb419834a03bdad/pycraft/objects/storage.py#L57-L82
slinderman/pyhawkes
0df433a40c5e6d8c1dcdb98ffc88fe3a403ac223
pyhawkes/internals/parallel_adjacency_resampling.py
python
_log_likelihood_single_process
(k2, T, dt, lambda0, Wk2, g, Sk, Fk, Ns)
return ll
Compute the *marginal* log likelihood by summing over parent assignments. In practice, this just means compute the total area under the rate function (an easy sum) and the instantaneous rate at the time of spikes.
Compute the *marginal* log likelihood by summing over parent assignments. In practice, this just means compute the total area under the rate function (an easy sum) and the instantaneous rate at the time of spikes.
[ "Compute", "the", "*", "marginal", "*", "log", "likelihood", "by", "summing", "over", "parent", "assignments", ".", "In", "practice", "this", "just", "means", "compute", "the", "total", "area", "under", "the", "rate", "function", "(", "an", "easy", "sum", ...
def _log_likelihood_single_process(k2, T, dt, lambda0, Wk2, g, Sk, Fk, Ns): """ Compute the *marginal* log likelihood by summing over parent assignments. In practice, this just means compute the total area under the rate function (an ...
[ "def", "_log_likelihood_single_process", "(", "k2", ",", "T", ",", "dt", ",", "lambda0", ",", "Wk2", ",", "g", ",", "Sk", ",", "Fk", ",", "Ns", ")", ":", "ll", "=", "0", "# Compute the integrated rate", "# Each event induces a weighted impulse response", "ll", ...
https://github.com/slinderman/pyhawkes/blob/0df433a40c5e6d8c1dcdb98ffc88fe3a403ac223/pyhawkes/internals/parallel_adjacency_resampling.py#L15-L36
NVlabs/planercnn
2698414a44eaa164f5174f7fe3c87dfc4d5dea3b
utils.py
python
compose_image_meta
(image_id, image_shape, window, active_class_ids)
return meta
Takes attributes of an image and puts them in one 1D array. Use parse_image_meta() to parse the values back. image_id: An int ID of the image. Useful for debugging. image_shape: [height, width, channels] window: (y1, x1, y2, x2) in pixels. The area of the image where the real image is (excl...
Takes attributes of an image and puts them in one 1D array. Use parse_image_meta() to parse the values back.
[ "Takes", "attributes", "of", "an", "image", "and", "puts", "them", "in", "one", "1D", "array", ".", "Use", "parse_image_meta", "()", "to", "parse", "the", "values", "back", "." ]
def compose_image_meta(image_id, image_shape, window, active_class_ids): """Takes attributes of an image and puts them in one 1D array. Use parse_image_meta() to parse the values back. image_id: An int ID of the image. Useful for debugging. image_shape: [height, width, channels] window: (y1, x1, y2...
[ "def", "compose_image_meta", "(", "image_id", ",", "image_shape", ",", "window", ",", "active_class_ids", ")", ":", "meta", "=", "np", ".", "array", "(", "[", "image_id", "]", "+", "# size=1", "list", "(", "image_shape", ")", "+", "# size=3", "list", "(", ...
https://github.com/NVlabs/planercnn/blob/2698414a44eaa164f5174f7fe3c87dfc4d5dea3b/utils.py#L300-L318
phimpme/phimpme-generator
ba6d11190b9016238f27672e1ad55e6a875b74a0
Phimpme/site-packages/requests/cookies.py
python
RequestsCookieJar.__setstate__
(self, state)
Unlike a normal CookieJar, this class is pickleable.
Unlike a normal CookieJar, this class is pickleable.
[ "Unlike", "a", "normal", "CookieJar", "this", "class", "is", "pickleable", "." ]
def __setstate__(self, state): """Unlike a normal CookieJar, this class is pickleable.""" self.__dict__.update(state) if '_cookies_lock' not in self.__dict__: self._cookies_lock = threading.RLock()
[ "def", "__setstate__", "(", "self", ",", "state", ")", ":", "self", ".", "__dict__", ".", "update", "(", "state", ")", "if", "'_cookies_lock'", "not", "in", "self", ".", "__dict__", ":", "self", ".", "_cookies_lock", "=", "threading", ".", "RLock", "(", ...
https://github.com/phimpme/phimpme-generator/blob/ba6d11190b9016238f27672e1ad55e6a875b74a0/Phimpme/site-packages/requests/cookies.py#L331-L335
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_validating_webhook.py
python
V1ValidatingWebhook.__init__
(self, admission_review_versions=None, client_config=None, failure_policy=None, match_policy=None, name=None, namespace_selector=None, object_selector=None, rules=None, side_effects=None, timeout_seconds=None, local_vars_configuration=None)
V1ValidatingWebhook - a model defined in OpenAPI
V1ValidatingWebhook - a model defined in OpenAPI
[ "V1ValidatingWebhook", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, admission_review_versions=None, client_config=None, failure_policy=None, match_policy=None, name=None, namespace_selector=None, object_selector=None, rules=None, side_effects=None, timeout_seconds=None, local_vars_configuration=None): # noqa: E501 """V1ValidatingWebhook - a model defined in ...
[ "def", "__init__", "(", "self", ",", "admission_review_versions", "=", "None", ",", "client_config", "=", "None", ",", "failure_policy", "=", "None", ",", "match_policy", "=", "None", ",", "name", "=", "None", ",", "namespace_selector", "=", "None", ",", "ob...
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_validating_webhook.py#L61-L94
berkerpeksag/astor
ce56db29bdc3d7d86f66df3e501c7f90febdb0cb
astor/op_util.py
python
get_op_precedence
(obj, precedence_data=precedence_data, type=type)
return precedence_data[type(obj)]
Given an AST node object, returns the precedence.
Given an AST node object, returns the precedence.
[ "Given", "an", "AST", "node", "object", "returns", "the", "precedence", "." ]
def get_op_precedence(obj, precedence_data=precedence_data, type=type): """Given an AST node object, returns the precedence. """ return precedence_data[type(obj)]
[ "def", "get_op_precedence", "(", "obj", ",", "precedence_data", "=", "precedence_data", ",", "type", "=", "type", ")", ":", "return", "precedence_data", "[", "type", "(", "obj", ")", "]" ]
https://github.com/berkerpeksag/astor/blob/ce56db29bdc3d7d86f66df3e501c7f90febdb0cb/astor/op_util.py#L102-L105
dabeaz/ply
559a7a1feabb0853be79d4f4dd9e9e9e5ea0d08c
example/yply/yparse.py
python
p_rule
(p)
rule : ID ':' rulelist ';'
rule : ID ':' rulelist ';'
[ "rule", ":", "ID", ":", "rulelist", ";" ]
def p_rule(p): '''rule : ID ':' rulelist ';' ''' p[0] = (p[1], [p[3]])
[ "def", "p_rule", "(", "p", ")", ":", "p", "[", "0", "]", "=", "(", "p", "[", "1", "]", ",", "[", "p", "[", "3", "]", "]", ")" ]
https://github.com/dabeaz/ply/blob/559a7a1feabb0853be79d4f4dd9e9e9e5ea0d08c/example/yply/yparse.py#L171-L173
cnk700i/havcs
75a2ca8e3d6ae49cf880dfea6dec60fe29b9dc03
custom_components/havcs/dueros.py
python
VoiceControlDueros.handleRequest
(self, data, auth = False, request_from = "http")
return response
Handle request
Handle request
[ "Handle", "request" ]
async def handleRequest(self, data, auth = False, request_from = "http"): """Handle request""" _LOGGER.info("[%s] Handle Request:\n%s", LOGGER_NAME, data) header = self._prase_command(data, 'header') action = self._prase_command(data, 'action') namespace = self._prase_command(da...
[ "async", "def", "handleRequest", "(", "self", ",", "data", ",", "auth", "=", "False", ",", "request_from", "=", "\"http\"", ")", ":", "_LOGGER", ".", "info", "(", "\"[%s] Handle Request:\\n%s\"", ",", "LOGGER_NAME", ",", "data", ")", "header", "=", "self", ...
https://github.com/cnk700i/havcs/blob/75a2ca8e3d6ae49cf880dfea6dec60fe29b9dc03/custom_components/havcs/dueros.py#L187-L228
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/dependency.py
python
DependencyProcessor.prop_has_changes
(self, uowcommit, states, isdelete)
[]
def prop_has_changes(self, uowcommit, states, isdelete): if not isdelete or self.passive_deletes: passive = attributes.PASSIVE_NO_INITIALIZE elif self.direction is MANYTOONE: passive = attributes.PASSIVE_NO_FETCH_RELATED else: passive = attributes.PASSIVE_OFF ...
[ "def", "prop_has_changes", "(", "self", ",", "uowcommit", ",", "states", ",", "isdelete", ")", ":", "if", "not", "isdelete", "or", "self", ".", "passive_deletes", ":", "passive", "=", "attributes", ".", "PASSIVE_NO_INITIALIZE", "elif", "self", ".", "direction"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/dependency.py#L219-L240
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/op2/tables/oes_stressStrain/complex/oes_plates_vm.py
python
ComplexPlateVMArray.build
(self)
sizes the vectorized attributes of the ComplexPlateArray SORT1: - etype SORT ndata numwide size -> nelements ntimes nnodes ntotal_layers - CQUAD8 1 1044 87 4 1044/(4*87)=3 xxx 5 3*5=15 C:\MSC.Software\simcenter_nastran_201...
sizes the vectorized attributes of the ComplexPlateArray
[ "sizes", "the", "vectorized", "attributes", "of", "the", "ComplexPlateArray" ]
def build(self) -> None: """sizes the vectorized attributes of the ComplexPlateArray SORT1: - etype SORT ndata numwide size -> nelements ntimes nnodes ntotal_layers - CQUAD8 1 1044 87 4 1044/(4*87)=3 xxx 5 3*5=15 C...
[ "def", "build", "(", "self", ")", "->", "None", ":", "if", "not", "hasattr", "(", "self", ",", "'subtitle'", ")", ":", "self", ".", "subtitle", "=", "self", ".", "data_code", "[", "'subtitle'", "]", "nnodes", "=", "self", ".", "nnodes_per_element", "#p...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/tables/oes_stressStrain/complex/oes_plates_vm.py#L68-L130
henrysky/astroNN
a8358137f09bf964ec34faa2a19d2efc1d7c3557
astroNN/nn/losses.py
python
mean_absolute_error
(y_true, y_pred, sample_weight=None)
return weighted_loss(losses, sample_weight)
Calculate mean absolute error, ignoring the magic number :param y_true: Ground Truth :type y_true: Union(tf.Tensor, tf.Variable) :param y_pred: Prediction :type y_pred: Union(tf.Tensor, tf.Variable) :param sample_weight: Sample weights :type sample_weight: Union(tf.Tensor, tf.Variable, list) ...
Calculate mean absolute error, ignoring the magic number
[ "Calculate", "mean", "absolute", "error", "ignoring", "the", "magic", "number" ]
def mean_absolute_error(y_true, y_pred, sample_weight=None): """ Calculate mean absolute error, ignoring the magic number :param y_true: Ground Truth :type y_true: Union(tf.Tensor, tf.Variable) :param y_pred: Prediction :type y_pred: Union(tf.Tensor, tf.Variable) :param sample_weight: Sampl...
[ "def", "mean_absolute_error", "(", "y_true", ",", "y_pred", ",", "sample_weight", "=", "None", ")", ":", "losses", "=", "tf", ".", "reduce_mean", "(", "tf", ".", "where", "(", "magic_num_check", "(", "y_true", ")", ",", "tf", ".", "zeros_like", "(", "y_t...
https://github.com/henrysky/astroNN/blob/a8358137f09bf964ec34faa2a19d2efc1d7c3557/astroNN/nn/losses.py#L194-L210
shubhtuls/factored3d
1bb77c7ae7dbaba7056e94cb99fdd6c9cc73c7cd
demo/demo_utils.py
python
DemoTester.predict_depth
(self)
return depth_pred
[]
def predict_depth(self): depth_pred = self.depth_model.forward(self.input_imgs_orig) return depth_pred
[ "def", "predict_depth", "(", "self", ")", ":", "depth_pred", "=", "self", ".", "depth_model", ".", "forward", "(", "self", ".", "input_imgs_orig", ")", "return", "depth_pred" ]
https://github.com/shubhtuls/factored3d/blob/1bb77c7ae7dbaba7056e94cb99fdd6c9cc73c7cd/demo/demo_utils.py#L226-L228
BishopFox/zigdiggity
b969b3f7e8d7fc010aef0578acf04167320f1d6f
zigdiggity/misc/actions.py
python
wait_for_frame_counter
(radio, panid, addr)
return None
[]
def wait_for_frame_counter(radio, panid, addr): print_info("Waiting to observe a frame counter for pan_id:0x%04x, src_addr:0x%04x" % (panid, addr)) timer = Timer(OBSERVATION_TIME) while(not timer.has_expired()): frame = radio.receive() if frame is not None and Dot15d4Data in frame and fram...
[ "def", "wait_for_frame_counter", "(", "radio", ",", "panid", ",", "addr", ")", ":", "print_info", "(", "\"Waiting to observe a frame counter for pan_id:0x%04x, src_addr:0x%04x\"", "%", "(", "panid", ",", "addr", ")", ")", "timer", "=", "Timer", "(", "OBSERVATION_TIME"...
https://github.com/BishopFox/zigdiggity/blob/b969b3f7e8d7fc010aef0578acf04167320f1d6f/zigdiggity/misc/actions.py#L63-L76
foremast/foremast
e8eb9bd24e975772532d90efa8a9ba1850e968cc
src/foremast/slacknotify/__main__.py
python
main
()
Send Slack notification to a configured channel.
Send Slack notification to a configured channel.
[ "Send", "Slack", "notification", "to", "a", "configured", "channel", "." ]
def main(): """Send Slack notification to a configured channel.""" logging.basicConfig(format=LOGGING_FORMAT) log = logging.getLogger(__name__) parser = argparse.ArgumentParser() add_debug(parser) add_app(parser) add_env(parser) add_properties(parser) args = parser.parse_args() ...
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "LOGGING_FORMAT", ")", "log", "=", "logging", ".", "getLogger", "(", "__name__", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "add_debug", "(", "parser", ...
https://github.com/foremast/foremast/blob/e8eb9bd24e975772532d90efa8a9ba1850e968cc/src/foremast/slacknotify/__main__.py#L28-L49
blackye/lalascan
e35726e6648525eb47493e39ee63a2a906dbb4b2
thirdparty_libs/requests/structures.py
python
CaseInsensitiveDict.lower_items
(self)
return ( (lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items() )
Like iteritems(), but with all lowercase keys.
Like iteritems(), but with all lowercase keys.
[ "Like", "iteritems", "()", "but", "with", "all", "lowercase", "keys", "." ]
def lower_items(self): """Like iteritems(), but with all lowercase keys.""" return ( (lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items() )
[ "def", "lower_items", "(", "self", ")", ":", "return", "(", "(", "lowerkey", ",", "keyval", "[", "1", "]", ")", "for", "(", "lowerkey", ",", "keyval", ")", "in", "self", ".", "_store", ".", "items", "(", ")", ")" ]
https://github.com/blackye/lalascan/blob/e35726e6648525eb47493e39ee63a2a906dbb4b2/thirdparty_libs/requests/structures.py#L88-L94
ViRb3/apk-utilities
818f0f455e4cb549896375bed0eada5c0d211651
bin/enjarify/util.py
python
s16
(val)
return val
[]
def s16(val): val %= 1 << 16 if val >= 1 << 15: val -= 1 << 16 return val
[ "def", "s16", "(", "val", ")", ":", "val", "%=", "1", "<<", "16", "if", "val", ">=", "1", "<<", "15", ":", "val", "-=", "1", "<<", "16", "return", "val" ]
https://github.com/ViRb3/apk-utilities/blob/818f0f455e4cb549896375bed0eada5c0d211651/bin/enjarify/util.py#L27-L31
kamalgill/flask-appengine-template
11760f83faccbb0d0afe416fc58e67ecfb4643c2
src/lib/wtforms/csrf/core.py
python
CSRFTokenField.pre_validate
(self, form)
Handle validation of this token field.
Handle validation of this token field.
[ "Handle", "validation", "of", "this", "token", "field", "." ]
def pre_validate(self, form): """ Handle validation of this token field. """ self.csrf_impl.validate_csrf_token(form, self)
[ "def", "pre_validate", "(", "self", ",", "form", ")", ":", "self", ".", "csrf_impl", ".", "validate_csrf_token", "(", "form", ",", "self", ")" ]
https://github.com/kamalgill/flask-appengine-template/blob/11760f83faccbb0d0afe416fc58e67ecfb4643c2/src/lib/wtforms/csrf/core.py#L35-L39
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/distlib/locators.py
python
DependencyFinder.try_to_replace
(self, provider, other, problems)
return result
Attempt to replace one provider with another. This is typically used when resolving dependencies from multiple sources, e.g. A requires (B >= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must meet all the requirements which ``other`` fulfills. :par...
Attempt to replace one provider with another. This is typically used when resolving dependencies from multiple sources, e.g. A requires (B >= 1.0) while C requires (B >= 1.1).
[ "Attempt", "to", "replace", "one", "provider", "with", "another", ".", "This", "is", "typically", "used", "when", "resolving", "dependencies", "from", "multiple", "sources", "e", ".", "g", ".", "A", "requires", "(", "B", ">", "=", "1", ".", "0", ")", "...
def try_to_replace(self, provider, other, problems): """ Attempt to replace one provider with another. This is typically used when resolving dependencies from multiple sources, e.g. A requires (B >= 1.0) while C requires (B >= 1.1). For successful replacement, ``provider`` must ...
[ "def", "try_to_replace", "(", "self", ",", "provider", ",", "other", ",", "problems", ")", ":", "rlist", "=", "self", ".", "reqts", "[", "other", "]", "unmatched", "=", "set", "(", ")", "for", "s", "in", "rlist", ":", "matcher", "=", "self", ".", "...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/distlib/locators.py#L1135-L1173
WikidPad/WikidPad
558109638807bc76b4672922686e416ab2d5f79c
WikidPad/lib/aui/auibook.py
python
AuiNotebook.AddTabAreaButton
(self, id, location, normal_bitmap=wx.NullBitmap, disabled_bitmap=wx.NullBitmap, name="")
Adds a button in the tab area. :param integer `id`: the button identifier. This can be one of the following: ============================== ================================= Button Identifier Description ============================== ================================...
Adds a button in the tab area.
[ "Adds", "a", "button", "in", "the", "tab", "area", "." ]
def AddTabAreaButton(self, id, location, normal_bitmap=wx.NullBitmap, disabled_bitmap=wx.NullBitmap, name=""): """ Adds a button in the tab area. :param integer `id`: the button identifier. This can be one of the following: ============================== =============================...
[ "def", "AddTabAreaButton", "(", "self", ",", "id", ",", "location", ",", "normal_bitmap", "=", "wx", ".", "NullBitmap", ",", "disabled_bitmap", "=", "wx", ".", "NullBitmap", ",", "name", "=", "\"\"", ")", ":", "active_tabctrl", "=", "self", ".", "GetActive...
https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/aui/auibook.py#L6105-L6127
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/timeit.py
python
repeat
(stmt="pass", setup="pass", timer=default_timer, repeat=default_repeat, number=default_number)
return Timer(stmt, setup, timer).repeat(repeat, number)
Convenience function to create Timer object and call repeat method.
Convenience function to create Timer object and call repeat method.
[ "Convenience", "function", "to", "create", "Timer", "object", "and", "call", "repeat", "method", "." ]
def repeat(stmt="pass", setup="pass", timer=default_timer, repeat=default_repeat, number=default_number): """Convenience function to create Timer object and call repeat method.""" return Timer(stmt, setup, timer).repeat(repeat, number)
[ "def", "repeat", "(", "stmt", "=", "\"pass\"", ",", "setup", "=", "\"pass\"", ",", "timer", "=", "default_timer", ",", "repeat", "=", "default_repeat", ",", "number", "=", "default_number", ")", ":", "return", "Timer", "(", "stmt", ",", "setup", ",", "ti...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/timeit.py#L230-L233
rlworkgroup/garage
b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507
src/garage/tf/plotter/plotter.py
python
Plotter.get_plotters
()
return Plotter.__plotters
Return all garage.tf.Plotter's. Returns: list[garage.tf.Plotter]: All the garage.tf.Plotter's
Return all garage.tf.Plotter's.
[ "Return", "all", "garage", ".", "tf", ".", "Plotter", "s", "." ]
def get_plotters(): """Return all garage.tf.Plotter's. Returns: list[garage.tf.Plotter]: All the garage.tf.Plotter's """ return Plotter.__plotters
[ "def", "get_plotters", "(", ")", ":", "return", "Plotter", ".", "__plotters" ]
https://github.com/rlworkgroup/garage/blob/b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507/src/garage/tf/plotter/plotter.py#L130-L137
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/data_interfaces/forms.py
python
CaseRuleCriteriaForm.set_case_type_choices
(self, initial)
[]
def set_case_type_choices(self, initial): case_types = [''] + list(get_case_types_for_domain(self.domain)) if initial and initial not in case_types: # Include the deleted case type in the list of choices so that # we always allow proper display and edit of rules case_...
[ "def", "set_case_type_choices", "(", "self", ",", "initial", ")", ":", "case_types", "=", "[", "''", "]", "+", "list", "(", "get_case_types_for_domain", "(", "self", ".", "domain", ")", ")", "if", "initial", "and", "initial", "not", "in", "case_types", ":"...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/data_interfaces/forms.py#L425-L434
petl-developers/petl
012cc7faf79d2fa8147a2cfe3a8b39b110f77051
petl/transform/regex.py
python
sub
(table, field, pattern, repl, count=0, flags=0)
return convert(table, field, conv)
Convenience function to convert values under the given field using a regular expression substitution. See also :func:`re.sub`.
Convenience function to convert values under the given field using a regular expression substitution. See also :func:`re.sub`.
[ "Convenience", "function", "to", "convert", "values", "under", "the", "given", "field", "using", "a", "regular", "expression", "substitution", ".", "See", "also", ":", "func", ":", "re", ".", "sub", "." ]
def sub(table, field, pattern, repl, count=0, flags=0): """ Convenience function to convert values under the given field using a regular expression substitution. See also :func:`re.sub`. """ prog = re.compile(pattern, flags) conv = lambda v: prog.sub(repl, v, count=count) return convert(ta...
[ "def", "sub", "(", "table", ",", "field", ",", "pattern", ",", "repl", ",", "count", "=", "0", ",", "flags", "=", "0", ")", ":", "prog", "=", "re", ".", "compile", "(", "pattern", ",", "flags", ")", "conv", "=", "lambda", "v", ":", "prog", ".",...
https://github.com/petl-developers/petl/blob/012cc7faf79d2fa8147a2cfe3a8b39b110f77051/petl/transform/regex.py#L230-L239
mozman/ezdxf
59d0fc2ea63f5cf82293428f5931da7e9f9718e9
src/ezdxf/render/mleader.py
python
MultiLeaderBuilder.set_mleader_style
(self, style: MLeaderStyle)
Reset base properties by :class:`~ezdxf.entities.MLeaderStyle` properties. This also resets the content!
Reset base properties by :class:`~ezdxf.entities.MLeaderStyle` properties. This also resets the content!
[ "Reset", "base", "properties", "by", ":", "class", ":", "~ezdxf", ".", "entities", ".", "MLeaderStyle", "properties", ".", "This", "also", "resets", "the", "content!" ]
def set_mleader_style(self, style: MLeaderStyle): """Reset base properties by :class:`~ezdxf.entities.MLeaderStyle` properties. This also resets the content! """ self._mleader_style = style multileader_dxf = self._multileader.dxf style_dxf = style.dxf keys = list...
[ "def", "set_mleader_style", "(", "self", ",", "style", ":", "MLeaderStyle", ")", ":", "self", ".", "_mleader_style", "=", "style", "multileader_dxf", "=", "self", ".", "_multileader", ".", "dxf", "style_dxf", "=", "style", ".", "dxf", "keys", "=", "list", ...
https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/render/mleader.py#L875-L894
slimkrazy/python-google-places
1ddb7aa35983e845ede912f8cc415b115ef4d8be
googleplaces/__init__.py
python
Place.reference
(self)
return self._reference
DEPRECATED AS OF JUNE 24, 2014. May stop being returned on June 24, 2015. Reference: https://developers.google.com/places/documentation/search Returns contains a unique token for the place. The token can be used to retrieve additional information about this place when invoking the getP...
DEPRECATED AS OF JUNE 24, 2014. May stop being returned on June 24, 2015. Reference: https://developers.google.com/places/documentation/search
[ "DEPRECATED", "AS", "OF", "JUNE", "24", "2014", ".", "May", "stop", "being", "returned", "on", "June", "24", "2015", ".", "Reference", ":", "https", ":", "//", "developers", ".", "google", ".", "com", "/", "places", "/", "documentation", "/", "search" ]
def reference(self): """DEPRECATED AS OF JUNE 24, 2014. May stop being returned on June 24, 2015. Reference: https://developers.google.com/places/documentation/search Returns contains a unique token for the place. The token can be used to retrieve additional information about this ...
[ "def", "reference", "(", "self", ")", ":", "warnings", ".", "warn", "(", "'The \"reference\" feature is deprecated and may'", "'stop working any time after June 24, 2015.'", ",", "FutureWarning", ")", "return", "self", ".", "_reference" ]
https://github.com/slimkrazy/python-google-places/blob/1ddb7aa35983e845ede912f8cc415b115ef4d8be/googleplaces/__init__.py#L847-L862
barseghyanartur/django-dash
dc00513b65e017c40f278a0a7df2a18ec8da9bc3
src/dash/base.py
python
BaseDashboardPlugin.delete_plugin_data
(self)
Delete plugin data. Used in ``dash.views.delete_dashboard_entry``. Fired automatically, when ``dash.models.DashboardEntry`` object is about to be deleted. Make use of it if your plugin creates database records or files that are not monitored externally but by dash only.
Delete plugin data.
[ "Delete", "plugin", "data", "." ]
def delete_plugin_data(self): """Delete plugin data. Used in ``dash.views.delete_dashboard_entry``. Fired automatically, when ``dash.models.DashboardEntry`` object is about to be deleted. Make use of it if your plugin creates database records or files that are not monitored exte...
[ "def", "delete_plugin_data", "(", "self", ")", ":" ]
https://github.com/barseghyanartur/django-dash/blob/dc00513b65e017c40f278a0a7df2a18ec8da9bc3/src/dash/base.py#L1199-L1206
Ekultek/Dagon
f065d7bbd7598f9a8c43bd12ba6b528cfef7377e
thirdparty/blake/blake.py
python
BLAKE._eightByte2int
(self, bytestr)
return struct.unpack('!Q', bytestr)[0]
convert a 8-byte string to an int (long long)
convert a 8-byte string to an int (long long)
[ "convert", "a", "8", "-", "byte", "string", "to", "an", "int", "(", "long", "long", ")" ]
def _eightByte2int(self, bytestr): """ convert a 8-byte string to an int (long long) """ return struct.unpack('!Q', bytestr)[0]
[ "def", "_eightByte2int", "(", "self", ",", "bytestr", ")", ":", "return", "struct", ".", "unpack", "(", "'!Q'", ",", "bytestr", ")", "[", "0", "]" ]
https://github.com/Ekultek/Dagon/blob/f065d7bbd7598f9a8c43bd12ba6b528cfef7377e/thirdparty/blake/blake.py#L508-L510
nosmokingbandit/watcher
dadacd21a5790ee609058a98a17fcc8954d24439
lib/sqlalchemy/connectors/mxodbc.py
python
MxODBCConnector._load_mx_exceptions
(cls)
Import mxODBC exception classes into the module namespace, as if they had been imported normally. This is done here to avoid requiring all SQLAlchemy users to install mxODBC.
Import mxODBC exception classes into the module namespace, as if they had been imported normally. This is done here to avoid requiring all SQLAlchemy users to install mxODBC.
[ "Import", "mxODBC", "exception", "classes", "into", "the", "module", "namespace", "as", "if", "they", "had", "been", "imported", "normally", ".", "This", "is", "done", "here", "to", "avoid", "requiring", "all", "SQLAlchemy", "users", "to", "install", "mxODBC",...
def _load_mx_exceptions(cls): """ Import mxODBC exception classes into the module namespace, as if they had been imported normally. This is done here to avoid requiring all SQLAlchemy users to install mxODBC. """ global InterfaceError, ProgrammingError from mx.ODBC import...
[ "def", "_load_mx_exceptions", "(", "cls", ")", ":", "global", "InterfaceError", ",", "ProgrammingError", "from", "mx", ".", "ODBC", "import", "InterfaceError", "from", "mx", ".", "ODBC", "import", "ProgrammingError" ]
https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/connectors/mxodbc.py#L56-L63
mne-tools/mne-python
f90b303ce66a8415e64edd4605b09ac0179c1ebf
mne/io/edf/edf.py
python
_read_segment_file
(data, idx, fi, start, stop, raw_extras, filenames, cals, mult)
return tal_data
Read a chunk of raw data.
Read a chunk of raw data.
[ "Read", "a", "chunk", "of", "raw", "data", "." ]
def _read_segment_file(data, idx, fi, start, stop, raw_extras, filenames, cals, mult): """Read a chunk of raw data.""" from scipy.interpolate import interp1d n_samps = raw_extras['n_samps'] buf_len = int(raw_extras['max_samp']) dtype = raw_extras['dtype_np'] dtype_byte = ...
[ "def", "_read_segment_file", "(", "data", ",", "idx", ",", "fi", ",", "start", ",", "stop", ",", "raw_extras", ",", "filenames", ",", "cals", ",", "mult", ")", ":", "from", "scipy", ".", "interpolate", "import", "interp1d", "n_samps", "=", "raw_extras", ...
https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/io/edf/edf.py#L252-L341
mitre-attack/attack-website
446748b71f412f7125d596a5eae0869559c89f05
modules/redirections/redirections.py
python
generate_redirections
()
Responsible for verifying redirects directory and starting off markdown generation process
Responsible for verifying redirects directory and starting off markdown generation process
[ "Responsible", "for", "verifying", "redirects", "directory", "and", "starting", "off", "markdown", "generation", "process" ]
def generate_redirections(): """Responsible for verifying redirects directory and starting off markdown generation process """ # Create content pages directory if does not already exist util.buildhelpers.create_content_pages_dir() # Verify if directory exists if not os.path.isdir(site_c...
[ "def", "generate_redirections", "(", ")", ":", "# Create content pages directory if does not already exist", "util", ".", "buildhelpers", ".", "create_content_pages_dir", "(", ")", "# Verify if directory exists", "if", "not", "os", ".", "path", ".", "isdir", "(", "site_co...
https://github.com/mitre-attack/attack-website/blob/446748b71f412f7125d596a5eae0869559c89f05/modules/redirections/redirections.py#L7-L24
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/_osx_support.py
python
_remove_unsupported_archs
(_config_vars)
return _config_vars
Remove any unsupported archs from config vars
Remove any unsupported archs from config vars
[ "Remove", "any", "unsupported", "archs", "from", "config", "vars" ]
def _remove_unsupported_archs(_config_vars): """Remove any unsupported archs from config vars""" # Different Xcode releases support different sets for '-arch' # flags. In particular, Xcode 4.x no longer supports the # PPC architectures. # # This code automatically removes '-arch ppc' and '-arch ...
[ "def", "_remove_unsupported_archs", "(", "_config_vars", ")", ":", "# Different Xcode releases support different sets for '-arch'", "# flags. In particular, Xcode 4.x no longer supports the", "# PPC architectures.", "#", "# This code automatically removes '-arch ppc' and '-arch ppc64'", "# whe...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/_osx_support.py#L220-L257
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/Mask RCNN/CharlesShang_FastMaskRCNN/libs/setup.py
python
customize_compiler_for_nvcc
(self)
inject deep into distutils to customize how the dispatch to gcc/nvcc works. If you subclass UnixCCompiler, it's not trivial to get your subclass injected in, and still have the right customizations (i.e. distutils.sysconfig.customize_compiler) run on it. So instead of going the OO route, I have thi...
inject deep into distutils to customize how the dispatch to gcc/nvcc works.
[ "inject", "deep", "into", "distutils", "to", "customize", "how", "the", "dispatch", "to", "gcc", "/", "nvcc", "works", "." ]
def customize_compiler_for_nvcc(self): """inject deep into distutils to customize how the dispatch to gcc/nvcc works. If you subclass UnixCCompiler, it's not trivial to get your subclass injected in, and still have the right customizations (i.e. distutils.sysconfig.customize_compiler) run on it. So...
[ "def", "customize_compiler_for_nvcc", "(", "self", ")", ":", "# tell the compiler it can processes .cu", "self", ".", "src_extensions", ".", "append", "(", "'.cu'", ")", "# save references to the default compiler_so and _comple methods", "default_compiler_so", "=", "self", ".",...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/Mask RCNN/CharlesShang_FastMaskRCNN/libs/setup.py#L63-L99
glue-viz/glue
840b4c1364b0fa63bf67c914540c93dd71df41e1
glue/app/qt/keyboard_shortcuts.py
python
delete_current_window
(session)
return session.application._viewer_in_focus.close(warn=True)
Deletes the currently active window
Deletes the currently active window
[ "Deletes", "the", "currently", "active", "window" ]
def delete_current_window(session): """ Deletes the currently active window """ if check_duplicate_shortcut("backspace"): return return session.application._viewer_in_focus.close(warn=True)
[ "def", "delete_current_window", "(", "session", ")", ":", "if", "check_duplicate_shortcut", "(", "\"backspace\"", ")", ":", "return", "return", "session", ".", "application", ".", "_viewer_in_focus", ".", "close", "(", "warn", "=", "True", ")" ]
https://github.com/glue-viz/glue/blob/840b4c1364b0fa63bf67c914540c93dd71df41e1/glue/app/qt/keyboard_shortcuts.py#L44-L51
lisa-lab/pylearn2
af81e5c362f0df4df85c3e54e23b2adeec026055
pylearn2/sandbox/cuda_convnet/stochastic_pool.py
python
WeightedMaxPool.c_libraries
(self)
return ['cuda_convnet']
.. todo:: WRITEME
.. todo::
[ "..", "todo", "::" ]
def c_libraries(self): """ .. todo:: WRITEME """ return ['cuda_convnet']
[ "def", "c_libraries", "(", "self", ")", ":", "return", "[", "'cuda_convnet'", "]" ]
https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/sandbox/cuda_convnet/stochastic_pool.py#L435-L441
Eugeny/reconfigure
ff1115dede4b80222a2618d0e7657cafa36a2573
reconfigure/configs/csf.py
python
CSFConfig.__init__
(self, **kwargs)
[]
def __init__(self, **kwargs): k = { 'parser': ShellParser(), 'builder': BoundBuilder(CSFData), } k.update(kwargs) Reconfig.__init__(self, **k)
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "k", "=", "{", "'parser'", ":", "ShellParser", "(", ")", ",", "'builder'", ":", "BoundBuilder", "(", "CSFData", ")", ",", "}", "k", ".", "update", "(", "kwargs", ")", "Reconfig", "....
https://github.com/Eugeny/reconfigure/blob/ff1115dede4b80222a2618d0e7657cafa36a2573/reconfigure/configs/csf.py#L11-L17
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/email/headerregistry.py
python
BaseHeader.init
(self, name, *, parse_tree, defects)
[]
def init(self, name, *, parse_tree, defects): self._name = name self._parse_tree = parse_tree self._defects = defects
[ "def", "init", "(", "self", ",", "name", ",", "*", ",", "parse_tree", ",", "defects", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_parse_tree", "=", "parse_tree", "self", ".", "_defects", "=", "defects" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/email/headerregistry.py#L200-L203
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/mailbox.py
python
_ProxyFile.close
(self)
Close the file.
Close the file.
[ "Close", "the", "file", "." ]
def close(self): """Close the file.""" if hasattr(self, '_file'): if hasattr(self._file, 'close'): self._file.close() del self._file
[ "def", "close", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_file'", ")", ":", "if", "hasattr", "(", "self", ".", "_file", ",", "'close'", ")", ":", "self", ".", "_file", ".", "close", "(", ")", "del", "self", ".", "_file" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/mailbox.py#L1969-L1974
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/modular/abvar/abvar_ambient_jacobian.py
python
ModAbVar_ambient_jacobian_class._modular_symbols
(self)
Return the modular symbols space associated to this ambient Jacobian. OUTPUT: modular symbols space EXAMPLES:: sage: M = J0(33)._modular_symbols(); M Modular Symbols subspace of dimension 6 of Modular Symbols space of dimension 9 for Gamma_0(33) of weight 2 with sign 0...
Return the modular symbols space associated to this ambient Jacobian.
[ "Return", "the", "modular", "symbols", "space", "associated", "to", "this", "ambient", "Jacobian", "." ]
def _modular_symbols(self): """ Return the modular symbols space associated to this ambient Jacobian. OUTPUT: modular symbols space EXAMPLES:: sage: M = J0(33)._modular_symbols(); M Modular Symbols subspace of dimension 6 of Modular Symbols space of dim...
[ "def", "_modular_symbols", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__modsym", "except", "AttributeError", ":", "self", ".", "__modsym", "=", "ModularSymbols", "(", "self", ".", "__group", ",", "weight", "=", "2", ")", ".", "cuspidal_subm...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/abvar/abvar_ambient_jacobian.py#L95-L113
shunsukesaito/PIFu
02a6d8643d3267d06cb4a510b30a59e7e07255de
lib/model/ResBlkPIFuNet.py
python
ResBlkPIFuNet.forward
(self, images, im_feat, points, calibs, transforms=None, labels=None)
return res, error
[]
def forward(self, images, im_feat, points, calibs, transforms=None, labels=None): self.filter(images) self.attach(im_feat) self.query(points, calibs, transforms, labels) res = self.get_preds() error = self.get_error() return res, error
[ "def", "forward", "(", "self", ",", "images", ",", "im_feat", ",", "points", ",", "calibs", ",", "transforms", "=", "None", ",", "labels", "=", "None", ")", ":", "self", ".", "filter", "(", "images", ")", "self", ".", "attach", "(", "im_feat", ")", ...
https://github.com/shunsukesaito/PIFu/blob/02a6d8643d3267d06cb4a510b30a59e7e07255de/lib/model/ResBlkPIFuNet.py#L78-L88
google/jax
bebe9845a873b3203f8050395255f173ba3bbb71
jax/_src/numpy/lax_numpy.py
python
_IndexUpdateRef.multiply
(self, values, indices_are_sorted=False, unique_indices=False, mode=None)
return scatter._scatter_update(self.array, self.index, values, lax.scatter_mul, indices_are_sorted=indices_are_sorted, unique_indices=unique_indices, mode=mode)
Pure equivalent of ``x[idx] *= y``. Returns the value of ``x`` that would result from the NumPy-style :mod:indexed assignment <numpy.doc.indexing>` ``x[idx] *= y``. See :mod:`jax.ops` for details.
Pure equivalent of ``x[idx] *= y``.
[ "Pure", "equivalent", "of", "x", "[", "idx", "]", "*", "=", "y", "." ]
def multiply(self, values, indices_are_sorted=False, unique_indices=False, mode=None): """Pure equivalent of ``x[idx] *= y``. Returns the value of ``x`` that would result from the NumPy-style :mod:indexed assignment <numpy.doc.indexing>` ``x[idx] *= y``. See :mod:`jax.ops` for details. ...
[ "def", "multiply", "(", "self", ",", "values", ",", "indices_are_sorted", "=", "False", ",", "unique_indices", "=", "False", ",", "mode", "=", "None", ")", ":", "return", "scatter", ".", "_scatter_update", "(", "self", ".", "array", ",", "self", ".", "in...
https://github.com/google/jax/blob/bebe9845a873b3203f8050395255f173ba3bbb71/jax/_src/numpy/lax_numpy.py#L6967-L6980
django-haystack/django-haystack
b6dd72e6b5c97b782f5436b7bb4e8227ba6e3b06
haystack/management/commands/clear_index.py
python
Command.add_arguments
(self, parser)
[]
def add_arguments(self, parser): parser.add_argument( "--noinput", action="store_false", dest="interactive", default=True, help="If provided, no prompts will be issued to the user and the data will be wiped out.", ) parser.add_argument(...
[ "def", "add_arguments", "(", "self", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "\"--noinput\"", ",", "action", "=", "\"store_false\"", ",", "dest", "=", "\"interactive\"", ",", "default", "=", "True", ",", "help", "=", "\"If provided, no pro...
https://github.com/django-haystack/django-haystack/blob/b6dd72e6b5c97b782f5436b7bb4e8227ba6e3b06/haystack/management/commands/clear_index.py#L9-L31
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/logging/handlers.py
python
MemoryHandler.flush
(self)
For a MemoryHandler, flushing means just sending the buffered records to the target, if there is one. Override if you want different behaviour.
For a MemoryHandler, flushing means just sending the buffered records to the target, if there is one. Override if you want different behaviour.
[ "For", "a", "MemoryHandler", "flushing", "means", "just", "sending", "the", "buffered", "records", "to", "the", "target", "if", "there", "is", "one", ".", "Override", "if", "you", "want", "different", "behaviour", "." ]
def flush(self): """ For a MemoryHandler, flushing means just sending the buffered records to the target, if there is one. Override if you want different behaviour. """ if self.target: for record in self.buffer: self.target.handle(record) ...
[ "def", "flush", "(", "self", ")", ":", "if", "self", ".", "target", ":", "for", "record", "in", "self", ".", "buffer", ":", "self", ".", "target", ".", "handle", "(", "record", ")", "self", ".", "buffer", "=", "[", "]" ]
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/logging/handlers.py#L1141-L1150
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/ext/db/__init__.py
python
DateProperty.validate
(self, value)
return value
Validate date. Returns: A valid value. Raises: BadValueError if property is not instance of 'date', or if it is an instance of 'datetime' (which is a subclass of 'date', but for all practical purposes a different type).
Validate date.
[ "Validate", "date", "." ]
def validate(self, value): """Validate date. Returns: A valid value. Raises: BadValueError if property is not instance of 'date', or if it is an instance of 'datetime' (which is a subclass of 'date', but for all practical purposes a different type). """ value = super(DatePr...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "value", "=", "super", "(", "DateProperty", ",", "self", ")", ".", "validate", "(", "value", ")", "if", "isinstance", "(", "value", ",", "datetime", ".", "datetime", ")", ":", "raise", "BadValueEr...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/ext/db/__init__.py#L3102-L3117
phonopy/phonopy
816586d0ba8177482ecf40e52f20cbdee2260d51
phonopy/harmonic/dynamical_matrix.py
python
DynamicalMatrixNAC.get_nac_method
(self)
return self.nac_method
Return NAC method name.
Return NAC method name.
[ "Return", "NAC", "method", "name", "." ]
def get_nac_method(self): """Return NAC method name.""" warnings.warn( "DynamicalMatrixNAC.get_nac_method() is deprecated." "Use DynamicalMatrixNAC.nac_method attribute.", DeprecationWarning, ) return self.nac_method
[ "def", "get_nac_method", "(", "self", ")", ":", "warnings", ".", "warn", "(", "\"DynamicalMatrixNAC.get_nac_method() is deprecated.\"", "\"Use DynamicalMatrixNAC.nac_method attribute.\"", ",", "DeprecationWarning", ",", ")", "return", "self", ".", "nac_method" ]
https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/harmonic/dynamical_matrix.py#L461-L468
roclark/sportsipy
c19f545d3376d62ded6304b137dc69238ac620a9
sportsipy/ncaab/boxscore.py
python
Boxscore.home_block_percentage
(self)
return self._home_block_percentage
Returns a ``float`` of the percentage of 2-point field goals that were blocked by the home team. Percentage ranges from 0-100.
Returns a ``float`` of the percentage of 2-point field goals that were blocked by the home team. Percentage ranges from 0-100.
[ "Returns", "a", "float", "of", "the", "percentage", "of", "2", "-", "point", "field", "goals", "that", "were", "blocked", "by", "the", "home", "team", ".", "Percentage", "ranges", "from", "0", "-", "100", "." ]
def home_block_percentage(self): """ Returns a ``float`` of the percentage of 2-point field goals that were blocked by the home team. Percentage ranges from 0-100. """ return self._home_block_percentage
[ "def", "home_block_percentage", "(", "self", ")", ":", "return", "self", ".", "_home_block_percentage" ]
https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/ncaab/boxscore.py#L1547-L1552
man-group/mdf
4b2c78084467791ad883c0b4c53832ad70fc96ef
mdf/viewer/panels/valueviewer.py
python
DataFramePanel.HideZeros
(self, event)
[]
def HideZeros(self, event): self.__hide_zeros = True self.__FilterDataFrame()
[ "def", "HideZeros", "(", "self", ",", "event", ")", ":", "self", ".", "__hide_zeros", "=", "True", "self", ".", "__FilterDataFrame", "(", ")" ]
https://github.com/man-group/mdf/blob/4b2c78084467791ad883c0b4c53832ad70fc96ef/mdf/viewer/panels/valueviewer.py#L210-L212