Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
handle_gather
()
Handle key press from a user.
Handle key press from a user.
def handle_gather(): """Handle key press from a user.""" digit_pressed = request.values.get('Digits', None) if digit_pressed == "1": resp = VoiceResponse() # Dial (310) 555-1212 - connect that number to the incoming caller. resp.dial("+13105551212") # If the dial fails: ...
[ "def", "handle_gather", "(", ")", ":", "digit_pressed", "=", "request", ".", "values", ".", "get", "(", "'Digits'", ",", "None", ")", "if", "digit_pressed", "==", "\"1\"", ":", "resp", "=", "VoiceResponse", "(", ")", "# Dial (310) 555-1212 - connect that number ...
[ 8, 0 ]
[ 29, 28 ]
python
en
['en', 'en', 'en']
True
connect
(dsn=None, connection_factory=None, cursor_factory=None, **kwargs)
Create a new database connection. The connection parameters can be specified as a string: conn = psycopg2.connect("dbname=test user=postgres password=secret") or using a set of keyword arguments: conn = psycopg2.connect(database="test", user="postgres", password="secret") Or as a m...
Create a new database connection.
def connect(dsn=None, connection_factory=None, cursor_factory=None, **kwargs): """ Create a new database connection. The connection parameters can be specified as a string: conn = psycopg2.connect("dbname=test user=postgres password=secret") or using a set of keyword arguments: conn ...
[ "def", "connect", "(", "dsn", "=", "None", ",", "connection_factory", "=", "None", ",", "cursor_factory", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwasync", "=", "{", "}", "if", "'async'", "in", "kwargs", ":", "kwasync", "[", "'async'", "]", ...
[ 79, 0 ]
[ 125, 15 ]
python
en
['en', 'error', 'th']
False
Highchart.__init__
(self, **kwargs)
This is the base class for all the charts. The following keywords are accepted: :keyword: **display_container** - default: ``True`` **offline - default: ``False`` If True, download all .js and .css file and put them into ...
This is the base class for all the charts. The following keywords are accepted: :keyword: **display_container** - default: ``True`` **offline - default: ``False`` If True, download all .js and .css file and put them into ...
def __init__(self, **kwargs): """ This is the base class for all the charts. The following keywords are accepted: :keyword: **display_container** - default: ``True`` **offline - default: ``False`` If True, download all .js and .css file and p...
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# set the model", "self", ".", "model", "=", "self", ".", "__class__", ".", "__name__", "#: The chart model,", "self", ".", "div_name", "=", "kwargs", ".", "get", "(", "\"renderTo\"", ",",...
[ 49, 4 ]
[ 166, 41 ]
python
en
['en', 'error', 'th']
False
Highchart.add_JSsource
(self, new_src)
add additional js script source(s)
add additional js script source(s)
def add_JSsource(self, new_src): """add additional js script source(s)""" if isinstance(new_src, list): for h in new_src: self.JSsource.append(h) elif isinstance(new_src, basestring): self.JSsource.append(new_src) else: raise OptionType...
[ "def", "add_JSsource", "(", "self", ",", "new_src", ")", ":", "if", "isinstance", "(", "new_src", ",", "list", ")", ":", "for", "h", "in", "new_src", ":", "self", ".", "JSsource", ".", "append", "(", "h", ")", "elif", "isinstance", "(", "new_src", ",...
[ 175, 4 ]
[ 183, 95 ]
python
en
['en', 'co', 'en']
True
Highchart.add_CSSsource
(self, new_src)
add additional css source(s)
add additional css source(s)
def add_CSSsource(self, new_src): """add additional css source(s)""" if isinstance(new_src, list): for h in new_src: self.CSSsource.append(h) elif isinstance(new_src, basestring): self.CSSsource.append(new_src) else: raise OptionTypeErr...
[ "def", "add_CSSsource", "(", "self", ",", "new_src", ")", ":", "if", "isinstance", "(", "new_src", ",", "list", ")", ":", "for", "h", "in", "new_src", ":", "self", ".", "CSSsource", ".", "append", "(", "h", ")", "elif", "isinstance", "(", "new_src", ...
[ 186, 4 ]
[ 194, 95 ]
python
en
['en', 'en', 'en']
True
Highchart.add_data_set
(self, data, series_type="line", name=None, **kwargs)
set data for series option in highcharts
set data for series option in highcharts
def add_data_set(self, data, series_type="line", name=None, **kwargs): """set data for series option in highcharts""" self.data_set_count += 1 if not name: name = "Series %d" % self.data_set_count kwargs.update({'name':name}) if series_type == 'treemap': ...
[ "def", "add_data_set", "(", "self", ",", "data", ",", "series_type", "=", "\"line\"", ",", "name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "data_set_count", "+=", "1", "if", "not", "name", ":", "name", "=", "\"Series %d\"", "%", ...
[ 200, 4 ]
[ 214, 42 ]
python
en
['en', 'en', 'en']
True
Highchart.add_drilldown_data_set
(self, data, series_type, id, **kwargs)
set data for drilldown option in highcharts
set data for drilldown option in highcharts
def add_drilldown_data_set(self, data, series_type, id, **kwargs): """set data for drilldown option in highcharts""" self.drilldown_data_set_count += 1 if self.drilldown_flag == False: self.drilldown_flag = True kwargs.update({'id':id}) series_data = Series(data, se...
[ "def", "add_drilldown_data_set", "(", "self", ",", "data", ",", "series_type", ",", "id", ",", "*", "*", "kwargs", ")", ":", "self", ".", "drilldown_data_set_count", "+=", "1", "if", "self", ".", "drilldown_flag", "==", "False", ":", "self", ".", "drilldow...
[ 217, 4 ]
[ 228, 52 ]
python
en
['en', 'en', 'en']
True
Highchart.add_data_from_jsonp
(self, data_src, data_name='json_data', series_type="line", name=None, **kwargs)
set map data directly from a https source the data_src is the https link for data and it must be in jsonp format
set map data directly from a https source the data_src is the https link for data and it must be in jsonp format
def add_data_from_jsonp(self, data_src, data_name='json_data', series_type="line", name=None, **kwargs): """set map data directly from a https source the data_src is the https link for data and it must be in jsonp format """ if not self.jsonp_data_flag: self.jsonp_dat...
[ "def", "add_data_from_jsonp", "(", "self", ",", "data_src", ",", "data_name", "=", "'json_data'", ",", "series_type", "=", "\"line\"", ",", "name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "jsonp_data_flag", ":", "self", ...
[ 231, 4 ]
[ 246, 61 ]
python
en
['en', 'en', 'en']
True
Highchart.add_JSscript
(self, js_script, js_loc)
add (highcharts) javascript in the beginning or at the end of script use only if necessary
add (highcharts) javascript in the beginning or at the end of script use only if necessary
def add_JSscript(self, js_script, js_loc): """add (highcharts) javascript in the beginning or at the end of script use only if necessary """ if js_loc == 'head': self.jscript_head_flag = True if self.jscript_head: self.jscript_head = self.jscript_h...
[ "def", "add_JSscript", "(", "self", ",", "js_script", ",", "js_loc", ")", ":", "if", "js_loc", "==", "'head'", ":", "self", ".", "jscript_head_flag", "=", "True", "if", "self", ".", "jscript_head", ":", "self", ".", "jscript_head", "=", "self", ".", "jsc...
[ 249, 4 ]
[ 267, 41 ]
python
en
['en', 'en', 'en']
True
Highchart.set_options
(self, option_type, option_dict, force_options=False)
set plot options
set plot options
def set_options(self, option_type, option_dict, force_options=False): """set plot options """ if force_options: self.options[option_type].update(option_dict) elif (option_type == 'yAxis' or option_type == 'xAxis') and isinstance(option_dict, list): # For multi-Axis ...
[ "def", "set_options", "(", "self", ",", "option_type", ",", "option_dict", ",", "force_options", "=", "False", ")", ":", "if", "force_options", ":", "self", ".", "options", "[", "option_type", "]", ".", "update", "(", "option_dict", ")", "elif", "(", "opti...
[ 270, 4 ]
[ 294, 76 ]
python
en
['en', 'bg', 'en']
True
Highchart.set_dict_options
(self, options)
for dictionary-like inputs (as object in Javascript) options must be in python dictionary format
for dictionary-like inputs (as object in Javascript) options must be in python dictionary format
def set_dict_options(self, options): """for dictionary-like inputs (as object in Javascript) options must be in python dictionary format """ if isinstance(options, dict): for key, option_data in options.items(): self.set_options(key, option_data) else:...
[ "def", "set_dict_options", "(", "self", ",", "options", ")", ":", "if", "isinstance", "(", "options", ",", "dict", ")", ":", "for", "key", ",", "option_data", "in", "options", ".", "items", "(", ")", ":", "self", ".", "set_options", "(", "key", ",", ...
[ 297, 4 ]
[ 305, 104 ]
python
en
['en', 'en', 'en']
True
Highchart.buildcontent
(self)
build HTML content only, no header or body tags
build HTML content only, no header or body tags
def buildcontent(self): """build HTML content only, no header or body tags""" self.buildcontainer() self.option = json.dumps(self.options, cls = HighchartsEncoder) self.setoption = json.dumps(self.setOptions, cls = HighchartsEncoder) self.data = json.dumps(self.data_temp, cls = ...
[ "def", "buildcontent", "(", "self", ")", ":", "self", ".", "buildcontainer", "(", ")", "self", ".", "option", "=", "json", ".", "dumps", "(", "self", ".", "options", ",", "cls", "=", "HighchartsEncoder", ")", "self", ".", "setoption", "=", "json", ".",...
[ 308, 4 ]
[ 323, 95 ]
python
en
['en', 'en', 'en']
True
Highchart.buildhtml
(self)
build the HTML page create the htmlheader with css / js create html page
build the HTML page create the htmlheader with css / js create html page
def buildhtml(self): """build the HTML page create the htmlheader with css / js create html page """ self.buildcontent() self.buildhtmlheader() self.content = self._htmlcontent.decode('utf-8') # need to ensure unicode self._htmlcontent = self.template_page...
[ "def", "buildhtml", "(", "self", ")", ":", "self", ".", "buildcontent", "(", ")", "self", ".", "buildhtmlheader", "(", ")", "self", ".", "content", "=", "self", ".", "_htmlcontent", ".", "decode", "(", "'utf-8'", ")", "# need to ensure unicode", "self", "....
[ 326, 4 ]
[ 335, 32 ]
python
en
['en', 'en', 'en']
True
Highchart.buildhtmlheader
(self)
generate HTML header content
generate HTML header content
def buildhtmlheader(self): """generate HTML header content""" if self.drilldown_flag: self.add_JSsource('http://code.highcharts.com/modules/drilldown.js') if self.offline: opener = urllib.request.build_opener() opener.addheaders = [('User-Agent', '...
[ "def", "buildhtmlheader", "(", "self", ")", ":", "if", "self", ".", "drilldown_flag", ":", "self", ".", "add_JSsource", "(", "'http://code.highcharts.com/modules/drilldown.js'", ")", "if", "self", ".", "offline", ":", "opener", "=", "urllib", ".", "request", "."...
[ 338, 4 ]
[ 370, 33 ]
python
en
['en', 'en', 'en']
True
Highchart.buildcontainer
(self)
generate HTML div
generate HTML div
def buildcontainer(self): """generate HTML div""" if self.container: return # Create HTML div with style if self.options['chart'].width: if str(self.options['chart'].width)[-1] != '%': self.div_style += 'width:%spx;' % self.options['chart'].width ...
[ "def", "buildcontainer", "(", "self", ")", ":", "if", "self", ".", "container", ":", "return", "# Create HTML div with style", "if", "self", ".", "options", "[", "'chart'", "]", ".", "width", ":", "if", "str", "(", "self", ".", "options", "[", "'chart'", ...
[ 373, 4 ]
[ 391, 96 ]
python
en
['en', 'en', 'en']
True
Highchart.__str__
(self)
return htmlcontent
return htmlcontent
def __str__(self): """return htmlcontent""" #self.buildhtml() return self.htmlcontent
[ "def", "__str__", "(", "self", ")", ":", "#self.buildhtml()", "return", "self", ".", "htmlcontent" ]
[ 415, 4 ]
[ 418, 31 ]
python
en
['en', 'no', 'en']
False
Highchart.save_file
(self, filename = 'Chart')
save htmlcontent as .html file
save htmlcontent as .html file
def save_file(self, filename = 'Chart'): """ save htmlcontent as .html file """ filename = filename + '.html' with open(filename, 'w') as f: #self.buildhtml() f.write(self.htmlcontent) f.closed
[ "def", "save_file", "(", "self", ",", "filename", "=", "'Chart'", ")", ":", "filename", "=", "filename", "+", "'.html'", "with", "open", "(", "filename", ",", "'w'", ")", "as", "f", ":", "#self.buildhtml()", "f", ".", "write", "(", "self", ".", "htmlco...
[ 420, 4 ]
[ 428, 16 ]
python
en
['en', 'en', 'en']
True
load_pyproject_toml
( use_pep517, # type: Optional[bool] pyproject_toml, # type: str setup_py, # type: str req_name # type: str )
Load the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP 517 processing? None means the user hasn't explicitly specified. pyproject_toml - Location of the project's pyproject.toml file setup_py - Location of the project's setup.py file r...
Load the pyproject.toml file.
def load_pyproject_toml( use_pep517, # type: Optional[bool] pyproject_toml, # type: str setup_py, # type: str req_name # type: str ): # type: (...) -> Optional[BuildSystemDetails] """Load the pyproject.toml file. Parameters: use_pep517 - Has the user requested PEP 517 processing...
[ "def", "load_pyproject_toml", "(", "use_pep517", ",", "# type: Optional[bool]", "pyproject_toml", ",", "# type: str", "setup_py", ",", "# type: str", "req_name", "# type: str", ")", ":", "# type: (...) -> Optional[BuildSystemDetails]", "has_pyproject", "=", "os", ".", "path...
[ 28, 0 ]
[ 182, 69 ]
python
en
['en', 'en', 'en']
True
receiver
(signal, **kwargs)
A decorator for connecting receivers to signals. Used by passing in the signal (or list of signals) and keyword arguments to connect:: @receiver(post_save, sender=MyModel) def signal_receiver(sender, **kwargs): ... @receiver([post_save, post_delete], sender=MyModel) ...
A decorator for connecting receivers to signals. Used by passing in the signal (or list of signals) and keyword arguments to connect::
def receiver(signal, **kwargs): """ A decorator for connecting receivers to signals. Used by passing in the signal (or list of signals) and keyword arguments to connect:: @receiver(post_save, sender=MyModel) def signal_receiver(sender, **kwargs): ... @receiver([post_sav...
[ "def", "receiver", "(", "signal", ",", "*", "*", "kwargs", ")", ":", "def", "_decorator", "(", "func", ")", ":", "if", "isinstance", "(", "signal", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "s", "in", "signal", ":", "s", ".", "connect...
[ 282, 0 ]
[ 302, 21 ]
python
en
['en', 'error', 'th']
False
Signal.__init__
(self, providing_args=None, use_caching=False)
Create a new signal.
Create a new signal.
def __init__(self, providing_args=None, use_caching=False): """ Create a new signal. """ self.receivers = [] if providing_args is not None: warnings.warn( 'The providing_args argument is deprecated. As it is purely ' 'documentational, i...
[ "def", "__init__", "(", "self", ",", "providing_args", "=", "None", ",", "use_caching", "=", "False", ")", ":", "self", ".", "receivers", "=", "[", "]", "if", "providing_args", "is", "not", "None", ":", "warnings", ".", "warn", "(", "'The providing_args ar...
[ 32, 4 ]
[ 53, 36 ]
python
en
['en', 'error', 'th']
False
Signal.connect
(self, receiver, sender=None, weak=True, dispatch_uid=None)
Connect receiver to sender for signal. Arguments: receiver A function or an instance method which is to receive signals. Receivers must be hashable objects. If weak is True, then receiver must be weak referenceable. Receive...
Connect receiver to sender for signal.
def connect(self, receiver, sender=None, weak=True, dispatch_uid=None): """ Connect receiver to sender for signal. Arguments: receiver A function or an instance method which is to receive signals. Receivers must be hashable objects. ...
[ "def", "connect", "(", "self", ",", "receiver", ",", "sender", "=", "None", ",", "weak", "=", "True", ",", "dispatch_uid", "=", "None", ")", ":", "from", "django", ".", "conf", "import", "settings", "# If DEBUG is on, check that we got a good receiver", "if", ...
[ 55, 4 ]
[ 117, 47 ]
python
en
['en', 'error', 'th']
False
Signal.disconnect
(self, receiver=None, sender=None, dispatch_uid=None)
Disconnect receiver from sender for signal. If weak references are used, disconnect need not be called. The receiver will be removed from dispatch automatically. Arguments: receiver The registered receiver to disconnect. May be none if disp...
Disconnect receiver from sender for signal.
def disconnect(self, receiver=None, sender=None, dispatch_uid=None): """ Disconnect receiver from sender for signal. If weak references are used, disconnect need not be called. The receiver will be removed from dispatch automatically. Arguments: receiver ...
[ "def", "disconnect", "(", "self", ",", "receiver", "=", "None", ",", "sender", "=", "None", ",", "dispatch_uid", "=", "None", ")", ":", "if", "dispatch_uid", ":", "lookup_key", "=", "(", "dispatch_uid", ",", "_make_id", "(", "sender", ")", ")", "else", ...
[ 119, 4 ]
[ 153, 27 ]
python
en
['en', 'error', 'th']
False
Signal.send
(self, sender, **named)
Send signal from sender to all connected receivers. If any receiver raises an error, the error propagates back through send, terminating the dispatch loop. So it's possible that all receivers won't be called if an error is raised. Arguments: sender ...
Send signal from sender to all connected receivers.
def send(self, sender, **named): """ Send signal from sender to all connected receivers. If any receiver raises an error, the error propagates back through send, terminating the dispatch loop. So it's possible that all receivers won't be called if an error is raised. Ar...
[ "def", "send", "(", "self", ",", "sender", ",", "*", "*", "named", ")", ":", "if", "not", "self", ".", "receivers", "or", "self", ".", "sender_receivers_cache", ".", "get", "(", "sender", ")", "is", "NO_RECEIVERS", ":", "return", "[", "]", "return", ...
[ 158, 4 ]
[ 182, 9 ]
python
en
['en', 'error', 'th']
False
Signal.send_robust
(self, sender, **named)
Send signal from sender to all connected receivers catching errors. Arguments: sender The sender of the signal. Can be any Python object (normally one registered with a connect if you actually want something to occur). named ...
Send signal from sender to all connected receivers catching errors.
def send_robust(self, sender, **named): """ Send signal from sender to all connected receivers catching errors. Arguments: sender The sender of the signal. Can be any Python object (normally one registered with a connect if you actually want somethin...
[ "def", "send_robust", "(", "self", ",", "sender", ",", "*", "*", "named", ")", ":", "if", "not", "self", ".", "receivers", "or", "self", ".", "sender_receivers_cache", ".", "get", "(", "sender", ")", "is", "NO_RECEIVERS", ":", "return", "[", "]", "# Ca...
[ 184, 4 ]
[ 222, 24 ]
python
en
['en', 'error', 'th']
False
Signal._live_receivers
(self, sender)
Filter sequence of receivers to get resolved, live receivers. This checks for weak references and resolves them, then returning only live receivers.
Filter sequence of receivers to get resolved, live receivers.
def _live_receivers(self, sender): """ Filter sequence of receivers to get resolved, live receivers. This checks for weak references and resolves them, then returning only live receivers. """ receivers = None if self.use_caching and not self._dead_receivers: ...
[ "def", "_live_receivers", "(", "self", ",", "sender", ")", ":", "receivers", "=", "None", "if", "self", ".", "use_caching", "and", "not", "self", ".", "_dead_receivers", ":", "receivers", "=", "self", ".", "sender_receivers_cache", ".", "get", "(", "sender",...
[ 233, 4 ]
[ 270, 33 ]
python
en
['en', 'error', 'th']
False
module_to_dict
(module, omittable=lambda k: k.startswith('_') or not k.isupper())
Convert a module namespace to a Python dictionary.
Convert a module namespace to a Python dictionary.
def module_to_dict(module, omittable=lambda k: k.startswith('_') or not k.isupper()): """Convert a module namespace to a Python dictionary.""" return {k: repr(getattr(module, k)) for k in dir(module) if not omittable(k)}
[ "def", "module_to_dict", "(", "module", ",", "omittable", "=", "lambda", "k", ":", "k", ".", "startswith", "(", "'_'", ")", "or", "not", "k", ".", "isupper", "(", ")", ")", ":", "return", "{", "k", ":", "repr", "(", "getattr", "(", "module", ",", ...
[ 3, 0 ]
[ 5, 81 ]
python
en
['en', 'en', 'en']
True
feed
(request, url, feed_dict=None)
Provided for backwards compatibility.
Provided for backwards compatibility.
def feed(request, url, feed_dict=None): """Provided for backwards compatibility.""" if not feed_dict: raise Http404(_("No feeds are registered.")) slug = url.partition('/')[0] try: f = feed_dict[slug] except KeyError: raise Http404(_('Slug %r isn’t registered.') % slug) ...
[ "def", "feed", "(", "request", ",", "url", ",", "feed_dict", "=", "None", ")", ":", "if", "not", "feed_dict", ":", "raise", "Http404", "(", "_", "(", "\"No feeds are registered.\"", ")", ")", "slug", "=", "url", ".", "partition", "(", "'/'", ")", "[", ...
[ 4, 0 ]
[ 19, 28 ]
python
en
['en', 'en', 'en']
True
_covert_legacy_entry
(entry: Tuple[str, ...], info: Tuple[str, ...])
Convert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages directory. :param entry: Path parts of the installed-files.txt entry. :param i...
Convert a legacy installed-files.txt path into modern RECORD path.
def _covert_legacy_entry(entry: Tuple[str, ...], info: Tuple[str, ...]) -> str: """Convert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages ...
[ "def", "_covert_legacy_entry", "(", "entry", ":", "Tuple", "[", "str", ",", "...", "]", ",", "info", ":", "Tuple", "[", "str", ",", "...", "]", ")", "->", "str", ":", "while", "entry", "and", "entry", "[", "0", "]", "==", "\"..\"", ":", "if", "no...
[ 68, 0 ]
[ 92, 43 ]
python
en
['en', 'en', 'en']
True
search_packages_info
(query: List[str])
Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory.
Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory.
def search_packages_info(query: List[str]) -> Iterator[_PackageInfo]: """ Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory. """ ...
[ "def", "search_packages_info", "(", "query", ":", "List", "[", "str", "]", ")", "->", "Iterator", "[", "_PackageInfo", "]", ":", "env", "=", "get_default_environment", "(", ")", "installed", "=", "{", "dist", ".", "canonical_name", ":", "dist", "for", "dis...
[ 95, 0 ]
[ 189, 9 ]
python
en
['en', 'error', 'th']
False
print_results
( distributions: Iterator[_PackageInfo], list_files: bool, verbose: bool, )
Print the information from installed distributions found.
Print the information from installed distributions found.
def print_results( distributions: Iterator[_PackageInfo], list_files: bool, verbose: bool, ) -> bool: """ Print the information from installed distributions found. """ results_printed = False for i, dist in enumerate(distributions): results_printed = True if i > 0: ...
[ "def", "print_results", "(", "distributions", ":", "Iterator", "[", "_PackageInfo", "]", ",", "list_files", ":", "bool", ",", "verbose", ":", "bool", ",", ")", "->", "bool", ":", "results_printed", "=", "False", "for", "i", ",", "dist", "in", "enumerate", ...
[ 192, 0 ]
[ 233, 26 ]
python
en
['en', 'error', 'th']
False
call_metadata_api
(method, uri, params, **options)
Private function that assists with performing an API call to the metadata_fields part of the Admin API :param method: The HTTP method. Valid methods: get, post, put, delete :param uri: REST endpoint of the API (without 'metadata_fields') :param params: Query/body parameters passed to the method :par...
Private function that assists with performing an API call to the metadata_fields part of the Admin API :param method: The HTTP method. Valid methods: get, post, put, delete :param uri: REST endpoint of the API (without 'metadata_fields') :param params: Query/body parameters passed to the method :par...
def call_metadata_api(method, uri, params, **options): """Private function that assists with performing an API call to the metadata_fields part of the Admin API :param method: The HTTP method. Valid methods: get, post, put, delete :param uri: REST endpoint of the API (without 'metadata_fields') :par...
[ "def", "call_metadata_api", "(", "method", ",", "uri", ",", "params", ",", "*", "*", "options", ")", ":", "uri", "=", "[", "\"metadata_fields\"", "]", "+", "(", "uri", "or", "[", "]", ")", "return", "call_json_api", "(", "method", ",", "uri", ",", "p...
[ 11, 0 ]
[ 21, 56 ]
python
en
['en', 'en', 'en']
True
KeyValueCacheAdapter.__init__
(self, storage)
Create a new adapter for the provided storage interface
Create a new adapter for the provided storage interface
def __init__(self, storage): """Create a new adapter for the provided storage interface""" if not isinstance(storage, KeyValueStorage): raise ValueError("An instance of valid KeyValueStorage must be provided") self._key_value_storage = storage
[ "def", "__init__", "(", "self", ",", "storage", ")", ":", "if", "not", "isinstance", "(", "storage", ",", "KeyValueStorage", ")", ":", "raise", "ValueError", "(", "\"An instance of valid KeyValueStorage must be provided\"", ")", "self", ".", "_key_value_storage", "=...
[ 12, 4 ]
[ 17, 41 ]
python
en
['en', 'en', 'en']
True
KeyValueCacheAdapter.generate_cache_key
(public_id, type, resource_type, transformation, format)
Generates key-value storage key from parameters :param public_id: The public ID of the resource :param type: The storage type :param resource_type: The type of the resource :param transformation: The transformation string :param format: The ...
Generates key-value storage key from parameters
def generate_cache_key(public_id, type, resource_type, transformation, format): """ Generates key-value storage key from parameters :param public_id: The public ID of the resource :param type: The storage type :param resource_type: The type of the resource ...
[ "def", "generate_cache_key", "(", "public_id", ",", "type", ",", "resource_type", ",", "transformation", ",", "format", ")", ":", "valid_params", "=", "[", "p", "for", "p", "in", "[", "public_id", ",", "type", ",", "resource_type", ",", "transformation", ","...
[ 45, 4 ]
[ 60, 71 ]
python
en
['en', 'error', 'th']
False
_attr_key
(attr)
Return an appropriate key for an attribute for sorting Attributes have a namespace that can be either ``None`` or a string. We can't compare the two because they're different types, so we convert ``None`` to an empty string first.
Return an appropriate key for an attribute for sorting
def _attr_key(attr): """Return an appropriate key for an attribute for sorting Attributes have a namespace that can be either ``None`` or a string. We can't compare the two because they're different types, so we convert ``None`` to an empty string first. """ return (attr[0][0] or ''), attr[0][...
[ "def", "_attr_key", "(", "attr", ")", ":", "return", "(", "attr", "[", "0", "]", "[", "0", "]", "or", "''", ")", ",", "attr", "[", "0", "]", "[", "1", "]" ]
[ 7, 0 ]
[ 15, 41 ]
python
en
['en', 'en', 'en']
True
RemoteUserMiddleware.clean_username
(self, username, request)
Allow the backend to clean the username, if the backend defines a clean_username method.
Allow the backend to clean the username, if the backend defines a clean_username method.
def clean_username(self, username, request): """ Allow the backend to clean the username, if the backend defines a clean_username method. """ backend_str = request.session[auth.BACKEND_SESSION_KEY] backend = auth.load_backend(backend_str) try: username...
[ "def", "clean_username", "(", "self", ",", "username", ",", "request", ")", ":", "backend_str", "=", "request", ".", "session", "[", "auth", ".", "BACKEND_SESSION_KEY", "]", "backend", "=", "auth", ".", "load_backend", "(", "backend_str", ")", "try", ":", ...
[ 83, 4 ]
[ 94, 23 ]
python
en
['en', 'error', 'th']
False
RemoteUserMiddleware._remove_invalid_user
(self, request)
Remove the current authenticated user in the request which is invalid but only if the user is authenticated via the RemoteUserBackend.
Remove the current authenticated user in the request which is invalid but only if the user is authenticated via the RemoteUserBackend.
def _remove_invalid_user(self, request): """ Remove the current authenticated user in the request which is invalid but only if the user is authenticated via the RemoteUserBackend. """ try: stored_backend = load_backend(request.session.get(auth.BACKEND_SESSION_KEY, '')...
[ "def", "_remove_invalid_user", "(", "self", ",", "request", ")", ":", "try", ":", "stored_backend", "=", "load_backend", "(", "request", ".", "session", ".", "get", "(", "auth", ".", "BACKEND_SESSION_KEY", ",", "''", ")", ")", "except", "ImportError", ":", ...
[ 96, 4 ]
[ 108, 36 ]
python
en
['en', 'error', 'th']
False
Command.write_migration_files
(self, changes)
Take a changes dict and write them out as migration files.
Take a changes dict and write them out as migration files.
def write_migration_files(self, changes): """ Take a changes dict and write them out as migration files. """ directory_created = {} for app_label, app_migrations in changes.items(): if self.verbosity >= 1: self.stdout.write(self.style.MIGRATE_HEADING("...
[ "def", "write_migration_files", "(", "self", ",", "changes", ")", ":", "directory_created", "=", "{", "}", "for", "app_label", ",", "app_migrations", "in", "changes", ".", "items", "(", ")", ":", "if", "self", ".", "verbosity", ">=", "1", ":", "self", "....
[ 193, 4 ]
[ 236, 57 ]
python
en
['en', 'error', 'th']
False
Command.handle_merge
(self, loader, conflicts)
Handles merging together conflicted migrations interactively, if it's safe; otherwise, advises on how to fix it.
Handles merging together conflicted migrations interactively, if it's safe; otherwise, advises on how to fix it.
def handle_merge(self, loader, conflicts): """ Handles merging together conflicted migrations interactively, if it's safe; otherwise, advises on how to fix it. """ if self.interactive: questioner = InteractiveMigrationQuestioner() else: questioner ...
[ "def", "handle_merge", "(", "self", ",", "loader", ",", "conflicts", ")", ":", "if", "self", ".", "interactive", ":", "questioner", "=", "InteractiveMigrationQuestioner", "(", ")", "else", ":", "questioner", "=", "MigrationQuestioner", "(", "defaults", "=", "{...
[ 238, 4 ]
[ 324, 57 ]
python
en
['en', 'error', 'th']
False
matches_patterns
(path, patterns)
Return True or False depending on whether the ``path`` should be ignored (if it matches any pattern in ``ignore_patterns``).
Return True or False depending on whether the ``path`` should be ignored (if it matches any pattern in ``ignore_patterns``).
def matches_patterns(path, patterns): """ Return True or False depending on whether the ``path`` should be ignored (if it matches any pattern in ``ignore_patterns``). """ return any(fnmatch.fnmatchcase(path, pattern) for pattern in patterns)
[ "def", "matches_patterns", "(", "path", ",", "patterns", ")", ":", "return", "any", "(", "fnmatch", ".", "fnmatchcase", "(", "path", ",", "pattern", ")", "for", "pattern", "in", "patterns", ")" ]
[ 7, 0 ]
[ 12, 74 ]
python
en
['en', 'error', 'th']
False
get_files
(storage, ignore_patterns=None, location='')
Recursively walk the storage directories yielding the paths of all files that should be copied.
Recursively walk the storage directories yielding the paths of all files that should be copied.
def get_files(storage, ignore_patterns=None, location=''): """ Recursively walk the storage directories yielding the paths of all files that should be copied. """ if ignore_patterns is None: ignore_patterns = [] directories, files = storage.listdir(location) for fn in files: ...
[ "def", "get_files", "(", "storage", ",", "ignore_patterns", "=", "None", ",", "location", "=", "''", ")", ":", "if", "ignore_patterns", "is", "None", ":", "ignore_patterns", "=", "[", "]", "directories", ",", "files", "=", "storage", ".", "listdir", "(", ...
[ 15, 0 ]
[ 38, 59 ]
python
en
['en', 'error', 'th']
False
check_settings
(base_url=None)
Check if the staticfiles settings have sane values.
Check if the staticfiles settings have sane values.
def check_settings(base_url=None): """ Check if the staticfiles settings have sane values. """ if base_url is None: base_url = settings.STATIC_URL if not base_url: raise ImproperlyConfigured( "You're using the staticfiles app " "without having set the required...
[ "def", "check_settings", "(", "base_url", "=", "None", ")", ":", "if", "base_url", "is", "None", ":", "base_url", "=", "settings", ".", "STATIC_URL", "if", "not", "base_url", ":", "raise", "ImproperlyConfigured", "(", "\"You're using the staticfiles app \"", "\"wi...
[ 41, 0 ]
[ 62, 73 ]
python
en
['en', 'error', 'th']
False
freeze_base
(model)
Our models are build in such way that a backbone model is a layer in the final model. This function finds the model and freezes it, Do not forget to compile your model after freezing! :param model: model which base will be frozen :return Whether the base was found and frozen.
Our models are build in such way that a backbone model is a layer in the final model. This function finds the model and freezes it,
def freeze_base(model): """ Our models are build in such way that a backbone model is a layer in the final model. This function finds the model and freezes it, Do not forget to compile your model after freezing! :param model: model which base will be frozen :return Whether the base was found a...
[ "def", "freeze_base", "(", "model", ")", ":", "return", "unfreeze_base", "(", "model", ",", "0", ")" ]
[ 3, 0 ]
[ 13, 34 ]
python
en
['en', 'error', 'th']
False
unfreeze_base
(model, fraction=1.0)
Make the full model trainable. If there is a model inside the the layers, all is unfroze. Do not forget to compile your model after freezing! :param model: model which base will be (partially) frozen :param fraction: how many layers from top should be unfroze :return Whether the base was found an...
Make the full model trainable. If there is a model inside the the layers, all is unfroze.
def unfreeze_base(model, fraction=1.0): """ Make the full model trainable. If there is a model inside the the layers, all is unfroze. Do not forget to compile your model after freezing! :param model: model which base will be (partially) frozen :param fraction: how many layers from top should be un...
[ "def", "unfreeze_base", "(", "model", ",", "fraction", "=", "1.0", ")", ":", "base", "=", "None", "for", "id", ",", "layer", "in", "enumerate", "(", "model", ".", "layers", ")", ":", "if", "isinstance", "(", "layer", ",", "tf", ".", "keras", ".", "...
[ 16, 0 ]
[ 39, 15 ]
python
en
['en', 'error', 'th']
False
parse_cookie
(cookie)
Return a dictionary parsed from a `Cookie:` header string.
Return a dictionary parsed from a `Cookie:` header string.
def parse_cookie(cookie): """ Return a dictionary parsed from a `Cookie:` header string. """ cookiedict = {} for chunk in cookie.split(';'): if '=' in chunk: key, val = chunk.split('=', 1) else: # Assume an empty name per # https://bugzilla.mozilla...
[ "def", "parse_cookie", "(", "cookie", ")", ":", "cookiedict", "=", "{", "}", "for", "chunk", "in", "cookie", ".", "split", "(", "';'", ")", ":", "if", "'='", "in", "chunk", ":", "key", ",", "val", "=", "chunk", ".", "split", "(", "'='", ",", "1",...
[ 9, 0 ]
[ 25, 21 ]
python
en
['en', 'error', 'th']
False
parse_arguments
()
Parse job arguments.
Parse job arguments.
def parse_arguments(): """Parse job arguments.""" parser = argparse.ArgumentParser() # required input arguments parser.add_argument( '--train-files', help='GCS or local paths to training data', nargs='+', required=True ) parser.add_argument( '--job-dir', help='GCS locati...
[ "def", "parse_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "# required input arguments", "parser", ".", "add_argument", "(", "'--train-files'", ",", "help", "=", "'GCS or local paths to training data'", ",", "nargs", "=", "'...
[ 50, 0 ]
[ 192, 15 ]
python
en
['en', 'fr', 'en']
True
lazy
(func, *resultclasses)
Turn any callable into a lazy evaluated callable. result classes or types is required -- at least one is needed so that the automatic forcing of the lazy evaluation code is triggered. Results are not memoized; the function is evaluated on every access.
Turn any callable into a lazy evaluated callable. result classes or types is required -- at least one is needed so that the automatic forcing of the lazy evaluation code is triggered. Results are not memoized; the function is evaluated on every access.
def lazy(func, *resultclasses): """ Turn any callable into a lazy evaluated callable. result classes or types is required -- at least one is needed so that the automatic forcing of the lazy evaluation code is triggered. Results are not memoized; the function is evaluated on every access. """ ...
[ "def", "lazy", "(", "func", ",", "*", "resultclasses", ")", ":", "@", "total_ordering", "class", "__proxy__", "(", "Promise", ")", ":", "\"\"\"\n Encapsulate a function call and act as a proxy for methods that are\n called on the result of that function. The function ...
[ 75, 0 ]
[ 196, 22 ]
python
en
['en', 'error', 'th']
False
lazystr
(text)
Shortcut for the common case of a lazy callable that returns str.
Shortcut for the common case of a lazy callable that returns str.
def lazystr(text): """ Shortcut for the common case of a lazy callable that returns str. """ return lazy(str, str)(text)
[ "def", "lazystr", "(", "text", ")", ":", "return", "lazy", "(", "str", ",", "str", ")", "(", "text", ")" ]
[ 203, 0 ]
[ 207, 31 ]
python
en
['en', 'error', 'th']
False
keep_lazy
(*resultclasses)
A decorator that allows a function to be called with one or more lazy arguments. If none of the args are lazy, the function is evaluated immediately, otherwise a __proxy__ is returned that will evaluate the function when needed.
A decorator that allows a function to be called with one or more lazy arguments. If none of the args are lazy, the function is evaluated immediately, otherwise a __proxy__ is returned that will evaluate the function when needed.
def keep_lazy(*resultclasses): """ A decorator that allows a function to be called with one or more lazy arguments. If none of the args are lazy, the function is evaluated immediately, otherwise a __proxy__ is returned that will evaluate the function when needed. """ if not resultclasses: ...
[ "def", "keep_lazy", "(", "*", "resultclasses", ")", ":", "if", "not", "resultclasses", ":", "raise", "TypeError", "(", "\"You must pass at least one argument to keep_lazy().\"", ")", "def", "decorator", "(", "func", ")", ":", "lazy_func", "=", "lazy", "(", "func",...
[ 210, 0 ]
[ 229, 20 ]
python
en
['en', 'error', 'th']
False
keep_lazy_text
(func)
A decorator for functions that accept lazy arguments and return text.
A decorator for functions that accept lazy arguments and return text.
def keep_lazy_text(func): """ A decorator for functions that accept lazy arguments and return text. """ return keep_lazy(str)(func)
[ "def", "keep_lazy_text", "(", "func", ")", ":", "return", "keep_lazy", "(", "str", ")", "(", "func", ")" ]
[ 232, 0 ]
[ 236, 31 ]
python
en
['en', 'error', 'th']
False
unpickle_lazyobject
(wrapped)
Used to unpickle lazy objects. Just return its argument, which will be the wrapped object.
Used to unpickle lazy objects. Just return its argument, which will be the wrapped object.
def unpickle_lazyobject(wrapped): """ Used to unpickle lazy objects. Just return its argument, which will be the wrapped object. """ return wrapped
[ "def", "unpickle_lazyobject", "(", "wrapped", ")", ":", "return", "wrapped" ]
[ 353, 0 ]
[ 358, 18 ]
python
en
['en', 'error', 'th']
False
partition
(predicate, values)
Split the values into two sets, based on the return value of the function (True/False). e.g.: >>> partition(lambda x: x > 3, range(5)) [0, 1, 2, 3], [4]
Split the values into two sets, based on the return value of the function (True/False). e.g.:
def partition(predicate, values): """ Split the values into two sets, based on the return value of the function (True/False). e.g.: >>> partition(lambda x: x > 3, range(5)) [0, 1, 2, 3], [4] """ results = ([], []) for item in values: results[predicate(item)].append(item)...
[ "def", "partition", "(", "predicate", ",", "values", ")", ":", "results", "=", "(", "[", "]", ",", "[", "]", ")", "for", "item", "in", "values", ":", "results", "[", "predicate", "(", "item", ")", "]", ".", "append", "(", "item", ")", "return", "...
[ 411, 0 ]
[ 422, 18 ]
python
en
['en', 'error', 'th']
False
cached_property.__get__
(self, instance, cls=None)
Call the function and put the return value in instance.__dict__ so that subsequent attribute access on the instance returns the cached value instead of calling cached_property.__get__().
Call the function and put the return value in instance.__dict__ so that subsequent attribute access on the instance returns the cached value instead of calling cached_property.__get__().
def __get__(self, instance, cls=None): """ Call the function and put the return value in instance.__dict__ so that subsequent attribute access on the instance returns the cached value instead of calling cached_property.__get__(). """ if instance is None: retur...
[ "def", "__get__", "(", "self", ",", "instance", ",", "cls", "=", "None", ")", ":", "if", "instance", "is", "None", ":", "return", "self", "res", "=", "instance", ".", "__dict__", "[", "self", ".", "name", "]", "=", "self", ".", "func", "(", "instan...
[ 39, 4 ]
[ 48, 18 ]
python
en
['en', 'error', 'th']
False
LazyObject._setup
(self)
Must be implemented by subclasses to initialize the wrapped object.
Must be implemented by subclasses to initialize the wrapped object.
def _setup(self): """ Must be implemented by subclasses to initialize the wrapped object. """ raise NotImplementedError('subclasses of LazyObject must provide a _setup() method')
[ "def", "_setup", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'subclasses of LazyObject must provide a _setup() method'", ")" ]
[ 285, 4 ]
[ 289, 92 ]
python
en
['en', 'error', 'th']
False
SimpleLazyObject.__init__
(self, func)
Pass in a callable that returns the object to be wrapped. If copies are made of the resulting SimpleLazyObject, which can happen in various circumstances within Django, then you must ensure that the callable can be safely run more than once and will return the same value. ...
Pass in a callable that returns the object to be wrapped.
def __init__(self, func): """ Pass in a callable that returns the object to be wrapped. If copies are made of the resulting SimpleLazyObject, which can happen in various circumstances within Django, then you must ensure that the callable can be safely run more than once and will...
[ "def", "__init__", "(", "self", ",", "func", ")", ":", "self", ".", "__dict__", "[", "'_setupfunc'", "]", "=", "func", "super", "(", ")", ".", "__init__", "(", ")" ]
[ 368, 4 ]
[ 378, 26 ]
python
en
['en', 'error', 'th']
False
_multi_decorate
(decorators, method)
Decorate `method` with one or more function decorators. `decorators` can be a single decorator or an iterable of decorators.
Decorate `method` with one or more function decorators. `decorators` can be a single decorator or an iterable of decorators.
def _multi_decorate(decorators, method): """ Decorate `method` with one or more function decorators. `decorators` can be a single decorator or an iterable of decorators. """ if hasattr(decorators, '__iter__'): # Apply a list/tuple of decorators if 'decorators' is one. Decorator # fun...
[ "def", "_multi_decorate", "(", "decorators", ",", "method", ")", ":", "if", "hasattr", "(", "decorators", ",", "'__iter__'", ")", ":", "# Apply a list/tuple of decorators if 'decorators' is one. Decorator", "# functions are applied so that the call order is the same as the", "# o...
[ 21, 0 ]
[ 49, 19 ]
python
en
['en', 'error', 'th']
False
method_decorator
(decorator, name='')
Convert a function decorator into a method decorator
Convert a function decorator into a method decorator
def method_decorator(decorator, name=''): """ Convert a function decorator into a method decorator """ # 'obj' can be a class or a function. If 'obj' is a function at the time it # is passed to _dec, it will eventually be a method of the class it is # defined on. If 'obj' is a class, the 'name'...
[ "def", "method_decorator", "(", "decorator", ",", "name", "=", "''", ")", ":", "# 'obj' can be a class or a function. If 'obj' is a function at the time it", "# is passed to _dec, it will eventually be a method of the class it is", "# defined on. If 'obj' is a class, the 'name' is required ...
[ 52, 0 ]
[ 85, 15 ]
python
en
['en', 'error', 'th']
False
decorator_from_middleware_with_args
(middleware_class)
Like decorator_from_middleware, but return a function that accepts the arguments to be passed to the middleware_class. Use like:: cache_page = decorator_from_middleware_with_args(CacheMiddleware) # ... @cache_page(3600) def my_view(request): # ...
Like decorator_from_middleware, but return a function that accepts the arguments to be passed to the middleware_class. Use like::
def decorator_from_middleware_with_args(middleware_class): """ Like decorator_from_middleware, but return a function that accepts the arguments to be passed to the middleware_class. Use like:: cache_page = decorator_from_middleware_with_args(CacheMiddleware) # ... @cache_pag...
[ "def", "decorator_from_middleware_with_args", "(", "middleware_class", ")", ":", "return", "make_middleware_decorator", "(", "middleware_class", ")" ]
[ 88, 0 ]
[ 101, 54 ]
python
en
['en', 'error', 'th']
False
decorator_from_middleware
(middleware_class)
Given a middleware class (not an instance), return a view decorator. This lets you use middleware functionality on a per-view basis. The middleware is created with no params passed.
Given a middleware class (not an instance), return a view decorator. This lets you use middleware functionality on a per-view basis. The middleware is created with no params passed.
def decorator_from_middleware(middleware_class): """ Given a middleware class (not an instance), return a view decorator. This lets you use middleware functionality on a per-view basis. The middleware is created with no params passed. """ return make_middleware_decorator(middleware_class)()
[ "def", "decorator_from_middleware", "(", "middleware_class", ")", ":", "return", "make_middleware_decorator", "(", "middleware_class", ")", "(", ")" ]
[ 104, 0 ]
[ 110, 56 ]
python
en
['en', 'error', 'th']
False
sync_and_async_middleware
(func)
Mark a middleware factory as returning a hybrid middleware supporting both types of request.
Mark a middleware factory as returning a hybrid middleware supporting both types of request.
def sync_and_async_middleware(func): """ Mark a middleware factory as returning a hybrid middleware supporting both types of request. """ func.sync_capable = True func.async_capable = True return func
[ "def", "sync_and_async_middleware", "(", "func", ")", ":", "func", ".", "sync_capable", "=", "True", "func", ".", "async_capable", "=", "True", "return", "func" ]
[ 154, 0 ]
[ 161, 15 ]
python
en
['en', 'error', 'th']
False
sync_only_middleware
(func)
Mark a middleware factory as returning a sync middleware. This is the default.
Mark a middleware factory as returning a sync middleware. This is the default.
def sync_only_middleware(func): """ Mark a middleware factory as returning a sync middleware. This is the default. """ func.sync_capable = True func.async_capable = False return func
[ "def", "sync_only_middleware", "(", "func", ")", ":", "func", ".", "sync_capable", "=", "True", "func", ".", "async_capable", "=", "False", "return", "func" ]
[ 164, 0 ]
[ 171, 15 ]
python
en
['en', 'error', 'th']
False
async_only_middleware
(func)
Mark a middleware factory as returning an async middleware.
Mark a middleware factory as returning an async middleware.
def async_only_middleware(func): """Mark a middleware factory as returning an async middleware.""" func.sync_capable = False func.async_capable = True return func
[ "def", "async_only_middleware", "(", "func", ")", ":", "func", ".", "sync_capable", "=", "False", "func", ".", "async_capable", "=", "True", "return", "func" ]
[ 174, 0 ]
[ 178, 15 ]
python
en
['en', 'en', 'en']
True
require_http_methods
(request_method_list)
Decorator to make a view only accept particular request methods. Usage:: @require_http_methods(["GET", "POST"]) def my_view(request): # I can assume now that only GET or POST requests make it this far # ... Note that request methods should be in uppercase.
Decorator to make a view only accept particular request methods. Usage::
def require_http_methods(request_method_list): """ Decorator to make a view only accept particular request methods. Usage:: @require_http_methods(["GET", "POST"]) def my_view(request): # I can assume now that only GET or POST requests make it this far # ... Note th...
[ "def", "require_http_methods", "(", "request_method_list", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "inner", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "request", ".", ...
[ 17, 0 ]
[ 41, 20 ]
python
en
['en', 'error', 'th']
False
condition
(etag_func=None, last_modified_func=None)
Decorator to support conditional retrieval (or change) for a view function. The parameters are callables to compute the ETag and last modified time for the requested resource, respectively. The callables are passed the same parameters as the view itself. The ETag function should return a string (o...
Decorator to support conditional retrieval (or change) for a view function.
def condition(etag_func=None, last_modified_func=None): """ Decorator to support conditional retrieval (or change) for a view function. The parameters are callables to compute the ETag and last modified time for the requested resource, respectively. The callables are passed the same parameters ...
[ "def", "condition", "(", "etag_func", "=", "None", ",", "last_modified_func", "=", "None", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "inner", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs",...
[ 54, 0 ]
[ 111, 20 ]
python
en
['en', 'error', 'th']
False
with_metaclass
(meta, *bases)
Create a base class with a metaclass. This requires a bit of explanation: the basic idea is to make a dummy metaclass for one level of class instantiation that replaces itself with the actual metaclass. Taken from six - https://pythonhosted.org/six/
Create a base class with a metaclass.
def with_metaclass(meta, *bases): """ Create a base class with a metaclass. This requires a bit of explanation: the basic idea is to make a dummy metaclass for one level of class instantiation that replaces itself with the actual metaclass. Taken from six - https://pythonhosted.org/six/ ""...
[ "def", "with_metaclass", "(", "meta", ",", "*", "bases", ")", ":", "class", "metaclass", "(", "meta", ")", ":", "def", "__new__", "(", "cls", ",", "name", ",", "this_bases", ",", "d", ")", ":", "return", "meta", "(", "name", ",", "bases", ",", "d",...
[ 22, 0 ]
[ 35, 61 ]
python
en
['en', 'error', 'th']
False
CloudinaryField.value_to_string
(self, obj)
We need to support both legacy `_get_val_from_obj` and new `value_from_object` models.Field methods. It would be better to wrap it with try -> except AttributeError -> fallback to legacy. Unfortunately, we can catch AttributeError exception from `value_from_object` function itself. Pars...
We need to support both legacy `_get_val_from_obj` and new `value_from_object` models.Field methods. It would be better to wrap it with try -> except AttributeError -> fallback to legacy. Unfortunately, we can catch AttributeError exception from `value_from_object` function itself. Pars...
def value_to_string(self, obj): """ We need to support both legacy `_get_val_from_obj` and new `value_from_object` models.Field methods. It would be better to wrap it with try -> except AttributeError -> fallback to legacy. Unfortunately, we can catch AttributeError exception from `value...
[ "def", "value_to_string", "(", "self", ",", "obj", ")", ":", "if", "hasattr", "(", "self", ",", "'value_from_object'", ")", ":", "value", "=", "self", ".", "value_from_object", "(", "obj", ")", "else", ":", "# fallback for legacy django versions", "value", "="...
[ 57, 4 ]
[ 74, 41 ]
python
en
['en', 'error', 'th']
False
PyAccess.__setitem__
(self, xy, color)
Modifies the pixel at x,y. The color is given as a single numerical value for single band images, and a tuple for multi-band images :param xy: The pixel coordinate, given as (x, y). See :ref:`coordinate-system`. :param color: The pixel value.
Modifies the pixel at x,y. The color is given as a single numerical value for single band images, and a tuple for multi-band images
def __setitem__(self, xy, color): """ Modifies the pixel at x,y. The color is given as a single numerical value for single band images, and a tuple for multi-band images :param xy: The pixel coordinate, given as (x, y). See :ref:`coordinate-system`. :param col...
[ "def", "__setitem__", "(", "self", ",", "xy", ",", "color", ")", ":", "if", "self", ".", "readonly", ":", "raise", "ValueError", "(", "\"Attempt to putpixel a read only image\"", ")", "(", "x", ",", "y", ")", "=", "xy", "if", "x", "<", "0", ":", "x", ...
[ 71, 4 ]
[ 98, 42 ]
python
en
['en', 'error', 'th']
False
PyAccess.__getitem__
(self, xy)
Returns the pixel at x,y. The pixel is returned as a single value for single band images or a tuple for multiple band images :param xy: The pixel coordinate, given as (x, y). See :ref:`coordinate-system`. :returns: a pixel value for single band images, a tuple of ...
Returns the pixel at x,y. The pixel is returned as a single value for single band images or a tuple for multiple band images
def __getitem__(self, xy): """ Returns the pixel at x,y. The pixel is returned as a single value for single band images or a tuple for multiple band images :param xy: The pixel coordinate, given as (x, y). See :ref:`coordinate-system`. :returns: a pixel value f...
[ "def", "__getitem__", "(", "self", ",", "xy", ")", ":", "(", "x", ",", "y", ")", "=", "xy", "if", "x", "<", "0", ":", "x", "=", "self", ".", "xsize", "+", "x", "if", "y", "<", "0", ":", "y", "=", "self", ".", "ysize", "+", "y", "(", "x"...
[ 100, 4 ]
[ 117, 35 ]
python
en
['en', 'error', 'th']
False
setdefaultproxy
( proxytype=None, addr=None, port=None, rdns=True, username=None, password=None )
setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets a default proxy which all further socksocket objects will use, unless explicitly changed.
setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets a default proxy which all further socksocket objects will use, unless explicitly changed.
def setdefaultproxy( proxytype=None, addr=None, port=None, rdns=True, username=None, password=None ): """setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets a default proxy which all further socksocket objects will use, unless explicitly changed. """ global _defaultprox...
[ "def", "setdefaultproxy", "(", "proxytype", "=", "None", ",", "addr", "=", "None", ",", "port", "=", "None", ",", "rdns", "=", "True", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "global", "_defaultproxy", "_defaultproxy", "=", ...
[ 118, 0 ]
[ 126, 69 ]
python
en
['es', 'hu', 'en']
False
wrapmodule
(module)
wrapmodule(module) Attempts to replace a module's socket library with a SOCKS socket. Must set a default proxy using setdefaultproxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls into this category.
wrapmodule(module)
def wrapmodule(module): """wrapmodule(module) Attempts to replace a module's socket library with a SOCKS socket. Must set a default proxy using setdefaultproxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls in...
[ "def", "wrapmodule", "(", "module", ")", ":", "if", "_defaultproxy", "!=", "None", ":", "module", ".", "socket", ".", "socket", "=", "socksocket", "else", ":", "raise", "GeneralProxyError", "(", "(", "4", ",", "\"no proxy specified\"", ")", ")" ]
[ 129, 0 ]
[ 141, 58 ]
python
en
['en', 'yo', 'en']
False
socksocket.__recvall
(self, count)
__recvall(count) -> data Receive EXACTLY the number of bytes requested from the socket. Blocks until the required number of bytes have been received.
__recvall(count) -> data Receive EXACTLY the number of bytes requested from the socket. Blocks until the required number of bytes have been received.
def __recvall(self, count): """__recvall(count) -> data Receive EXACTLY the number of bytes requested from the socket. Blocks until the required number of bytes have been received. """ data = self.recv(count) while len(data) < count: d = self.recv(count - len(...
[ "def", "__recvall", "(", "self", ",", "count", ")", ":", "data", "=", "self", ".", "recv", "(", "count", ")", "while", "len", "(", "data", ")", "<", "count", ":", "d", "=", "self", ".", "recv", "(", "count", "-", "len", "(", "data", ")", ")", ...
[ 163, 4 ]
[ 174, 19 ]
python
en
['en', 'en', 'hi']
True
socksocket.sendall
(self, content, *args)
override socket.socket.sendall method to rewrite the header for non-tunneling proxies if needed
override socket.socket.sendall method to rewrite the header for non-tunneling proxies if needed
def sendall(self, content, *args): """ override socket.socket.sendall method to rewrite the header for non-tunneling proxies if needed """ if not self.__httptunnel: content = self.__rewriteproxy(content) return super(socksocket, self).sendall(content, *args)
[ "def", "sendall", "(", "self", ",", "content", ",", "*", "args", ")", ":", "if", "not", "self", ".", "__httptunnel", ":", "content", "=", "self", ".", "__rewriteproxy", "(", "content", ")", "return", "super", "(", "socksocket", ",", "self", ")", ".", ...
[ 176, 4 ]
[ 182, 62 ]
python
en
['en', 'no', 'en']
True
socksocket.__rewriteproxy
(self, header)
rewrite HTTP request headers to support non-tunneling proxies (i.e. those which do not support the CONNECT method). This only works for HTTP (not HTTPS) since HTTPS requires tunneling.
rewrite HTTP request headers to support non-tunneling proxies (i.e. those which do not support the CONNECT method). This only works for HTTP (not HTTPS) since HTTPS requires tunneling.
def __rewriteproxy(self, header): """ rewrite HTTP request headers to support non-tunneling proxies (i.e. those which do not support the CONNECT method). This only works for HTTP (not HTTPS) since HTTPS requires tunneling. """ host, endpt = None, None hdrs = header.split(...
[ "def", "__rewriteproxy", "(", "self", ",", "header", ")", ":", "host", ",", "endpt", "=", "None", ",", "None", "hdrs", "=", "header", ".", "split", "(", "\"\\r\\n\"", ")", "for", "hdr", "in", "hdrs", ":", "if", "hdr", ".", "lower", "(", ")", ".", ...
[ 184, 4 ]
[ 205, 32 ]
python
en
['en', 'en', 'en']
True
socksocket.setproxy
( self, proxytype=None, addr=None, port=None, rdns=True, username=None, password=None, headers=None, )
setproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets the proxy to be used. proxytype - The type of the proxy to be used. Three types are supported: PROXY_TYPE_SOCKS4 (including socks4a), PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP addr - The...
setproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
def setproxy( self, proxytype=None, addr=None, port=None, rdns=True, username=None, password=None, headers=None, ): """setproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets the proxy to be used. proxytype - ...
[ "def", "setproxy", "(", "self", ",", "proxytype", "=", "None", ",", "addr", "=", "None", ",", "port", "=", "None", ",", "rdns", "=", "True", ",", "username", "=", "None", ",", "password", "=", "None", ",", "headers", "=", "None", ",", ")", ":", "...
[ 211, 4 ]
[ 240, 81 ]
python
en
['es', 'hu', 'en']
False
socksocket.__negotiatesocks5
(self, destaddr, destport)
__negotiatesocks5(self,destaddr,destport) Negotiates a connection through a SOCKS5 server.
__negotiatesocks5(self,destaddr,destport) Negotiates a connection through a SOCKS5 server.
def __negotiatesocks5(self, destaddr, destport): """__negotiatesocks5(self,destaddr,destport) Negotiates a connection through a SOCKS5 server. """ # First we'll send the authentication packages we support. if (self.__proxy[4] != None) and (self.__proxy[5] != None): # ...
[ "def", "__negotiatesocks5", "(", "self", ",", "destaddr", ",", "destport", ")", ":", "# First we'll send the authentication packages we support.", "if", "(", "self", ".", "__proxy", "[", "4", "]", "!=", "None", ")", "and", "(", "self", ".", "__proxy", "[", "5"...
[ 242, 4 ]
[ 343, 55 ]
python
pl
['pl', 'sv', 'sw']
False
socksocket.getproxysockname
(self)
getsockname() -> address info Returns the bound IP address and port number at the proxy.
getsockname() -> address info Returns the bound IP address and port number at the proxy.
def getproxysockname(self): """getsockname() -> address info Returns the bound IP address and port number at the proxy. """ return self.__proxysockname
[ "def", "getproxysockname", "(", "self", ")", ":", "return", "self", ".", "__proxysockname" ]
[ 345, 4 ]
[ 349, 35 ]
python
en
['en', 'no', 'en']
True
socksocket.getproxypeername
(self)
getproxypeername() -> address info Returns the IP and port number of the proxy.
getproxypeername() -> address info Returns the IP and port number of the proxy.
def getproxypeername(self): """getproxypeername() -> address info Returns the IP and port number of the proxy. """ return _orgsocket.getpeername(self)
[ "def", "getproxypeername", "(", "self", ")", ":", "return", "_orgsocket", ".", "getpeername", "(", "self", ")" ]
[ 351, 4 ]
[ 355, 43 ]
python
en
['en', 'nl', 'en']
True
socksocket.getpeername
(self)
getpeername() -> address info Returns the IP address and port number of the destination machine (note: getproxypeername returns the proxy)
getpeername() -> address info Returns the IP address and port number of the destination machine (note: getproxypeername returns the proxy)
def getpeername(self): """getpeername() -> address info Returns the IP address and port number of the destination machine (note: getproxypeername returns the proxy) """ return self.__proxypeername
[ "def", "getpeername", "(", "self", ")", ":", "return", "self", ".", "__proxypeername" ]
[ 357, 4 ]
[ 362, 35 ]
python
en
['en', 'ko', 'en']
True
socksocket.__negotiatesocks4
(self, destaddr, destport)
__negotiatesocks4(self,destaddr,destport) Negotiates a connection through a SOCKS4 server.
__negotiatesocks4(self,destaddr,destport) Negotiates a connection through a SOCKS4 server.
def __negotiatesocks4(self, destaddr, destport): """__negotiatesocks4(self,destaddr,destport) Negotiates a connection through a SOCKS4 server. """ # Check if the destination address provided is an IP address rmtrslv = False try: ipaddr = socket.inet_aton(desta...
[ "def", "__negotiatesocks4", "(", "self", ",", "destaddr", ",", "destport", ")", ":", "# Check if the destination address provided is an IP address", "rmtrslv", "=", "False", "try", ":", "ipaddr", "=", "socket", ".", "inet_aton", "(", "destaddr", ")", "except", "sock...
[ 364, 4 ]
[ 413, 55 ]
python
hi
['pl', 'sv', 'hi']
False
socksocket.__negotiatehttp
(self, destaddr, destport)
__negotiatehttp(self,destaddr,destport) Negotiates a connection through an HTTP server.
__negotiatehttp(self,destaddr,destport) Negotiates a connection through an HTTP server.
def __negotiatehttp(self, destaddr, destport): """__negotiatehttp(self,destaddr,destport) Negotiates a connection through an HTTP server. """ # If we need to resolve locally, we do this now if not self.__proxy[3]: addr = socket.gethostbyname(destaddr) else: ...
[ "def", "__negotiatehttp", "(", "self", ",", "destaddr", ",", "destport", ")", ":", "# If we need to resolve locally, we do this now", "if", "not", "self", ".", "__proxy", "[", "3", "]", ":", "addr", "=", "socket", ".", "gethostbyname", "(", "destaddr", ")", "e...
[ 415, 4 ]
[ 458, 47 ]
python
et
['et', 'lb', 'hi']
False
socksocket.connect
(self, destpair)
connect(self, despair) Connects to the specified destination through a proxy. destpar - A tuple of the IP/DNS address and the port number. (identical to socket's connect). To select the proxy server use setproxy().
connect(self, despair) Connects to the specified destination through a proxy. destpar - A tuple of the IP/DNS address and the port number. (identical to socket's connect). To select the proxy server use setproxy().
def connect(self, destpair): """connect(self, despair) Connects to the specified destination through a proxy. destpar - A tuple of the IP/DNS address and the port number. (identical to socket's connect). To select the proxy server use setproxy(). """ # Do a minima...
[ "def", "connect", "(", "self", ",", "destpair", ")", ":", "# Do a minimal input check first", "if", "(", "(", "not", "type", "(", "destpair", ")", "in", "(", "list", ",", "tuple", ")", ")", "or", "(", "len", "(", "destpair", ")", "<", "2", ")", "or",...
[ 460, 4 ]
[ 509, 59 ]
python
es
['es', 'gd', 'fr']
False
srs_double
(f)
Create a function prototype for the OSR routines that take the OSRSpatialReference object and return a double value.
Create a function prototype for the OSR routines that take the OSRSpatialReference object and return a double value.
def srs_double(f): """ Create a function prototype for the OSR routines that take the OSRSpatialReference object and return a double value. """ return double_output(f, [c_void_p, POINTER(c_int)], errcheck=True)
[ "def", "srs_double", "(", "f", ")", ":", "return", "double_output", "(", "f", ",", "[", "c_void_p", ",", "POINTER", "(", "c_int", ")", "]", ",", "errcheck", "=", "True", ")" ]
[ 10, 0 ]
[ 15, 70 ]
python
en
['en', 'error', 'th']
False
units_func
(f)
Create a ctypes function prototype for OSR units functions, e.g., OSRGetAngularUnits, OSRGetLinearUnits.
Create a ctypes function prototype for OSR units functions, e.g., OSRGetAngularUnits, OSRGetLinearUnits.
def units_func(f): """ Create a ctypes function prototype for OSR units functions, e.g., OSRGetAngularUnits, OSRGetLinearUnits. """ return double_output(f, [c_void_p, POINTER(c_char_p)], strarg=True)
[ "def", "units_func", "(", "f", ")", ":", "return", "double_output", "(", "f", ",", "[", "c_void_p", ",", "POINTER", "(", "c_char_p", ")", "]", ",", "strarg", "=", "True", ")" ]
[ 18, 0 ]
[ 23, 71 ]
python
en
['en', 'error', 'th']
False
run
(argv=None)
Build and run the pipeline.
Build and run the pipeline.
def run(argv=None): """Build and run the pipeline.""" parser = argparse.ArgumentParser() parser.add_argument( '--project', help=('Google Cloud Project ID'), required=True) parser.add_argument( '--input_topic', help=('Google Cloud PubSub topic ...
[ "def", "run", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--project'", ",", "help", "=", "(", "'Google Cloud Project ID'", ")", ",", "required", "=", "True", ")", "...
[ 34, 0 ]
[ 80, 20 ]
python
en
['en', 'en', 'en']
True
as_base_candidate
(candidate: Candidate)
The runtime version of BaseCandidate.
The runtime version of BaseCandidate.
def as_base_candidate(candidate: Candidate) -> Optional[BaseCandidate]: """The runtime version of BaseCandidate.""" base_candidate_classes = ( AlreadyInstalledCandidate, EditableCandidate, LinkCandidate, ) if isinstance(candidate, base_candidate_classes): return candidate...
[ "def", "as_base_candidate", "(", "candidate", ":", "Candidate", ")", "->", "Optional", "[", "BaseCandidate", "]", ":", "base_candidate_classes", "=", "(", "AlreadyInstalledCandidate", ",", "EditableCandidate", ",", "LinkCandidate", ",", ")", "if", "isinstance", "(",...
[ 38, 0 ]
[ 47, 15 ]
python
en
['en', 'en', 'en']
True
_InstallRequirementBackedCandidate.project_name
(self)
The normalised name of the project the candidate refers to
The normalised name of the project the candidate refers to
def project_name(self) -> NormalizedName: """The normalised name of the project the candidate refers to""" if self._name is None: self._name = canonicalize_name(self.dist.project_name) return self._name
[ "def", "project_name", "(", "self", ")", "->", "NormalizedName", ":", "if", "self", ".", "_name", "is", "None", ":", "self", ".", "_name", "=", "canonicalize_name", "(", "self", ".", "dist", ".", "project_name", ")", "return", "self", ".", "_name" ]
[ 179, 4 ]
[ 183, 25 ]
python
en
['en', 'en', 'en']
True
_InstallRequirementBackedCandidate._check_metadata_consistency
(self, dist: Distribution)
Check for consistency of project name and version of dist.
Check for consistency of project name and version of dist.
def _check_metadata_consistency(self, dist: Distribution) -> None: """Check for consistency of project name and version of dist.""" canonical_name = canonicalize_name(dist.project_name) if self._name is not None and self._name != canonical_name: raise MetadataInconsistent( ...
[ "def", "_check_metadata_consistency", "(", "self", ",", "dist", ":", "Distribution", ")", "->", "None", ":", "canonical_name", "=", "canonicalize_name", "(", "dist", ".", "project_name", ")", "if", "self", ".", "_name", "is", "not", "None", "and", "self", "....
[ 205, 4 ]
[ 222, 13 ]
python
en
['en', 'en', 'en']
True
ExtrasCandidate.name
(self)
The normalised name of the project the candidate refers to
The normalised name of the project the candidate refers to
def name(self) -> str: """The normalised name of the project the candidate refers to""" return format_name(self.base.project_name, self.extras)
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "format_name", "(", "self", ".", "base", ".", "project_name", ",", "self", ".", "extras", ")" ]
[ 457, 4 ]
[ 459, 63 ]
python
en
['en', 'en', 'en']
True
DashboardsServiceGrpcAsyncIOTransport.create_channel
( cls, host: str = "monitoring.googleapis.com", credentials: credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, )
Create and return a gRPC AsyncIO channel object. Args: address (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the ...
Create and return a gRPC AsyncIO channel object. Args: address (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the ...
def create_channel( cls, host: str = "monitoring.googleapis.com", credentials: credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, ) -> aio.Channel: ...
[ "def", "create_channel", "(", "cls", ",", "host", ":", "str", "=", "\"monitoring.googleapis.com\"", ",", "credentials", ":", "credentials", ".", "Credentials", "=", "None", ",", "credentials_file", ":", "Optional", "[", "str", "]", "=", "None", ",", "scopes", ...
[ 52, 4 ]
[ 90, 9 ]
python
en
['en', 'en', 'en']
True
DashboardsServiceGrpcAsyncIOTransport.__init__
( self, *, host: str = "monitoring.googleapis.com", credentials: credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, api_mtls_endpoint: str = None, client_cert...
Instantiate the transport. Args: host (Optional[str]): The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service;...
Instantiate the transport.
def __init__( self, *, host: str = "monitoring.googleapis.com", credentials: credentials.Credentials = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: aio.Channel = None, api_mtls_endpoint: str = None, ...
[ "def", "__init__", "(", "self", ",", "*", ",", "host", ":", "str", "=", "\"monitoring.googleapis.com\"", ",", "credentials", ":", "credentials", ".", "Credentials", "=", "None", ",", "credentials_file", ":", "Optional", "[", "str", "]", "=", "None", ",", "...
[ 92, 4 ]
[ 182, 24 ]
python
en
['en', 'en', 'en']
True
DashboardsServiceGrpcAsyncIOTransport.grpc_channel
(self)
Create the channel designed to connect to this service. This property caches on the instance; repeated calls return the same channel.
Create the channel designed to connect to this service.
def grpc_channel(self) -> aio.Channel: """Create the channel designed to connect to this service. This property caches on the instance; repeated calls return the same channel. """ # Sanity check: Only create a new channel if we do not already # have one. if not h...
[ "def", "grpc_channel", "(", "self", ")", "->", "aio", ".", "Channel", ":", "# Sanity check: Only create a new channel if we do not already", "# have one.", "if", "not", "hasattr", "(", "self", ",", "\"_grpc_channel\"", ")", ":", "self", ".", "_grpc_channel", "=", "s...
[ 185, 4 ]
[ 199, 33 ]
python
en
['en', 'en', 'en']
True
DashboardsServiceGrpcAsyncIOTransport.create_dashboard
( self, )
r"""Return a callable for the create dashboard method over gRPC. Creates a new custom dashboard. This method requires the ``monitoring.dashboards.create`` permission on the specified project. For more information, see `Google Cloud IAM <https://cloud.google.com/iam>`__. Return...
r"""Return a callable for the create dashboard method over gRPC.
def create_dashboard( self, ) -> Callable[ [dashboards_service.CreateDashboardRequest], Awaitable[dashboard.Dashboard] ]: r"""Return a callable for the create dashboard method over gRPC. Creates a new custom dashboard. This method requires the ``monitoring.dashboards.cr...
[ "def", "create_dashboard", "(", "self", ",", ")", "->", "Callable", "[", "[", "dashboards_service", ".", "CreateDashboardRequest", "]", ",", "Awaitable", "[", "dashboard", ".", "Dashboard", "]", "]", ":", "# Generate a \"stub function\" on-the-fly which will actually ma...
[ 202, 4 ]
[ 231, 46 ]
python
en
['en', 'en', 'en']
True
DashboardsServiceGrpcAsyncIOTransport.list_dashboards
( self, )
r"""Return a callable for the list dashboards method over gRPC. Lists the existing dashboards. This method requires the ``monitoring.dashboards.list`` permission on the specified project. For more information, see `Google Cloud IAM <https://cloud.google.com/iam>`__. Returns: ...
r"""Return a callable for the list dashboards method over gRPC.
def list_dashboards( self, ) -> Callable[ [dashboards_service.ListDashboardsRequest], Awaitable[dashboards_service.ListDashboardsResponse], ]: r"""Return a callable for the list dashboards method over gRPC. Lists the existing dashboards. This method requires the...
[ "def", "list_dashboards", "(", "self", ",", ")", "->", "Callable", "[", "[", "dashboards_service", ".", "ListDashboardsRequest", "]", ",", "Awaitable", "[", "dashboards_service", ".", "ListDashboardsResponse", "]", ",", "]", ":", "# Generate a \"stub function\" on-the...
[ 234, 4 ]
[ 264, 45 ]
python
en
['en', 'en', 'en']
True
DashboardsServiceGrpcAsyncIOTransport.get_dashboard
( self, )
r"""Return a callable for the get dashboard method over gRPC. Fetches a specific dashboard. This method requires the ``monitoring.dashboards.get`` permission on the specified dashboard. For more information, see `Google Cloud IAM <https://cloud.google.com/iam>`__. Returns: ...
r"""Return a callable for the get dashboard method over gRPC.
def get_dashboard( self, ) -> Callable[ [dashboards_service.GetDashboardRequest], Awaitable[dashboard.Dashboard] ]: r"""Return a callable for the get dashboard method over gRPC. Fetches a specific dashboard. This method requires the ``monitoring.dashboards.get`` ...
[ "def", "get_dashboard", "(", "self", ",", ")", "->", "Callable", "[", "[", "dashboards_service", ".", "GetDashboardRequest", "]", ",", "Awaitable", "[", "dashboard", ".", "Dashboard", "]", "]", ":", "# Generate a \"stub function\" on-the-fly which will actually make", ...
[ 267, 4 ]
[ 296, 43 ]
python
en
['en', 'en', 'en']
True
DashboardsServiceGrpcAsyncIOTransport.delete_dashboard
( self, )
r"""Return a callable for the delete dashboard method over gRPC. Deletes an existing custom dashboard. This method requires the ``monitoring.dashboards.delete`` permission on the specified dashboard. For more information, see `Google Cloud IAM <https://cloud.google.com/iam>`__. ...
r"""Return a callable for the delete dashboard method over gRPC.
def delete_dashboard( self, ) -> Callable[[dashboards_service.DeleteDashboardRequest], Awaitable[empty.Empty]]: r"""Return a callable for the delete dashboard method over gRPC. Deletes an existing custom dashboard. This method requires the ``monitoring.dashboards.delete`` p...
[ "def", "delete_dashboard", "(", "self", ",", ")", "->", "Callable", "[", "[", "dashboards_service", ".", "DeleteDashboardRequest", "]", ",", "Awaitable", "[", "empty", ".", "Empty", "]", "]", ":", "# Generate a \"stub function\" on-the-fly which will actually make", "...
[ 299, 4 ]
[ 326, 46 ]
python
en
['en', 'en', 'en']
True
DashboardsServiceGrpcAsyncIOTransport.update_dashboard
( self, )
r"""Return a callable for the update dashboard method over gRPC. Replaces an existing custom dashboard with a new definition. This method requires the ``monitoring.dashboards.update`` permission on the specified dashboard. For more information, see `Google Cloud IAM <https://cloud.goog...
r"""Return a callable for the update dashboard method over gRPC.
def update_dashboard( self, ) -> Callable[ [dashboards_service.UpdateDashboardRequest], Awaitable[dashboard.Dashboard] ]: r"""Return a callable for the update dashboard method over gRPC. Replaces an existing custom dashboard with a new definition. This method requires t...
[ "def", "update_dashboard", "(", "self", ",", ")", "->", "Callable", "[", "[", "dashboards_service", ".", "UpdateDashboardRequest", "]", ",", "Awaitable", "[", "dashboard", ".", "Dashboard", "]", "]", ":", "# Generate a \"stub function\" on-the-fly which will actually ma...
[ 329, 4 ]
[ 358, 46 ]
python
en
['en', 'en', 'en']
True
command_urls
(bot, user, channel, args)
Prints the titles of URLs linked in the channel. Usage: urls [on|off]
Prints the titles of URLs linked in the channel. Usage: urls [on|off]
def command_urls(bot, user, channel, args): "Prints the titles of URLs linked in the channel. Usage: urls [on|off]" if permissions(user) < 10: # 10 == admin, 20 == superadmin return bot.say(channel, "{}, your permission level is not high enough.".format( g...
[ "def", "command_urls", "(", "bot", ",", "user", ",", "channel", ",", "args", ")", ":", "if", "permissions", "(", "user", ")", "<", "10", ":", "# 10 == admin, 20 == superadmin", "return", "bot", ".", "say", "(", "channel", ",", "\"{}, your permission level is n...
[ 6, 0 ]
[ 29, 34 ]
python
en
['en', 'en', 'en']
True
write_pkg_file
(self, file)
Write the PKG-INFO format data to a file object.
Write the PKG-INFO format data to a file object.
def write_pkg_file(self, file): """Write the PKG-INFO format data to a file object. """ version = get_metadata_version(self) file.write('Metadata-Version: %s\n' % version) file.write('Name: %s\n' % self.get_name()) file.write('Version: %s\n' % self.get_version()) file.write('Summary: %s\n' ...
[ "def", "write_pkg_file", "(", "self", ",", "file", ")", ":", "version", "=", "get_metadata_version", "(", "self", ")", "file", ".", "write", "(", "'Metadata-Version: %s\\n'", "%", "version", ")", "file", ".", "write", "(", "'Name: %s\\n'", "%", "self", ".", ...
[ 54, 0 ]
[ 122, 54 ]
python
en
['en', 'en', 'en']
True
write_pkg_info
(self, base_dir)
Write the PKG-INFO file into the release tree.
Write the PKG-INFO file into the release tree.
def write_pkg_info(self, base_dir): """Write the PKG-INFO file into the release tree. """ with open(os.path.join(base_dir, 'PKG-INFO'), 'w', encoding='UTF-8') as pkg_info: self.write_pkg_file(pkg_info)
[ "def", "write_pkg_info", "(", "self", ",", "base_dir", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "base_dir", ",", "'PKG-INFO'", ")", ",", "'w'", ",", "encoding", "=", "'UTF-8'", ")", "as", "pkg_info", ":", "self", ".", "writ...
[ 126, 0 ]
[ 131, 37 ]
python
en
['en', 'en', 'en']
True
assert_string_list
(dist, attr, value)
Verify that value is a string list or None
Verify that value is a string list or None
def assert_string_list(dist, attr, value): """Verify that value is a string list or None""" try: assert ''.join(value) != value except (TypeError, ValueError, AttributeError, AssertionError): raise DistutilsSetupError( "%r must be a list of strings (got %r)" % (attr, value) ...
[ "def", "assert_string_list", "(", "dist", ",", "attr", ",", "value", ")", ":", "try", ":", "assert", "''", ".", "join", "(", "value", ")", "!=", "value", "except", "(", "TypeError", ",", "ValueError", ",", "AttributeError", ",", "AssertionError", ")", ":...
[ 148, 0 ]
[ 155, 9 ]
python
en
['en', 'en', 'en']
True
check_nsp
(dist, attr, value)
Verify that namespace packages are valid
Verify that namespace packages are valid
def check_nsp(dist, attr, value): """Verify that namespace packages are valid""" ns_packages = value assert_string_list(dist, attr, ns_packages) for nsp in ns_packages: if not dist.has_contents_for(nsp): raise DistutilsSetupError( "Distribution contains no modules or ...
[ "def", "check_nsp", "(", "dist", ",", "attr", ",", "value", ")", ":", "ns_packages", "=", "value", "assert_string_list", "(", "dist", ",", "attr", ",", "ns_packages", ")", "for", "nsp", "in", "ns_packages", ":", "if", "not", "dist", ".", "has_contents_for"...
[ 158, 0 ]
[ 173, 13 ]
python
en
['en', 'en', 'en']
True