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
IcnsFile.__init__
(self, fobj)
fobj is a file-like object as an icns resource
fobj is a file-like object as an icns resource
def __init__(self, fobj): """ fobj is a file-like object as an icns resource """ # signature : (start, length) self.dct = dct = {} self.fobj = fobj sig, filesize = nextheader(fobj) if sig != b"icns": raise SyntaxError("not an icns file") ...
[ "def", "__init__", "(", "self", ",", "fobj", ")", ":", "# signature : (start, length)", "self", ".", "dct", "=", "dct", "=", "{", "}", "self", ".", "fobj", "=", "fobj", "sig", ",", "filesize", "=", "nextheader", "(", "fobj", ")", "if", "sig", "!=", "...
[ 160, 4 ]
[ 179, 26 ]
python
en
['en', 'error', 'th']
False
IcnsFile.dataforsize
(self, size)
Get an icon resource as {channel: array}. Note that the arrays are bottom-up like windows bitmaps and will likely need to be flipped or transposed in some way.
Get an icon resource as {channel: array}. Note that the arrays are bottom-up like windows bitmaps and will likely need to be flipped or transposed in some way.
def dataforsize(self, size): """ Get an icon resource as {channel: array}. Note that the arrays are bottom-up like windows bitmaps and will likely need to be flipped or transposed in some way. """ dct = {} for code, reader in self.SIZES[size]: desc = ...
[ "def", "dataforsize", "(", "self", ",", "size", ")", ":", "dct", "=", "{", "}", "for", "code", ",", "reader", "in", "self", ".", "SIZES", "[", "size", "]", ":", "desc", "=", "self", ".", "dct", ".", "get", "(", "code", ")", "if", "desc", "is", ...
[ 196, 4 ]
[ 207, 18 ]
python
en
['en', 'error', 'th']
False
paginator_number
(cl, i)
Generates an individual page index link in a paginated list.
Generates an individual page index link in a paginated list.
def paginator_number(cl, i): """ Generates an individual page index link in a paginated list. """ if i == DOT: return '... ' elif i == cl.page_num: return format_html('<span class="this-page">{0}</span> ', i + 1) else: return format_html('<a href="{0}"{1}>{2}</a> ', ...
[ "def", "paginator_number", "(", "cl", ",", "i", ")", ":", "if", "i", "==", "DOT", ":", "return", "'... '", "elif", "i", "==", "cl", ".", "page_num", ":", "return", "format_html", "(", "'<span class=\"this-page\">{0}</span> '", ",", "i", "+", "1", ")", "e...
[ 29, 0 ]
[ 41, 33 ]
python
en
['en', 'error', 'th']
False
pagination
(cl)
Generates the series of links to the pages in a paginated list.
Generates the series of links to the pages in a paginated list.
def pagination(cl): """ Generates the series of links to the pages in a paginated list. """ paginator, page_num = cl.paginator, cl.page_num pagination_required = (not cl.show_all or not cl.can_show_all) and cl.multi_page if not pagination_required: page_range = [] else: ON_E...
[ "def", "pagination", "(", "cl", ")", ":", "paginator", ",", "page_num", "=", "cl", ".", "paginator", ",", "cl", ".", "page_num", "pagination_required", "=", "(", "not", "cl", ".", "show_all", "or", "not", "cl", ".", "can_show_all", ")", "and", "cl", "....
[ 45, 0 ]
[ 88, 5 ]
python
en
['en', 'error', 'th']
False
result_headers
(cl)
Generates the list column headers.
Generates the list column headers.
def result_headers(cl): """ Generates the list column headers. """ ordering_field_columns = cl.get_ordering_field_columns() for i, field_name in enumerate(cl.list_display): text, attr = label_for_field( field_name, cl.model, model_admin=cl.model_admin, ret...
[ "def", "result_headers", "(", "cl", ")", ":", "ordering_field_columns", "=", "cl", ".", "get_ordering_field_columns", "(", ")", "for", "i", ",", "field_name", "in", "enumerate", "(", "cl", ".", "list_display", ")", ":", "text", ",", "attr", "=", "label_for_f...
[ 91, 0 ]
[ 171, 9 ]
python
en
['en', 'error', 'th']
False
items_for_result
(cl, result, form)
Generates the actual list of data.
Generates the actual list of data.
def items_for_result(cl, result, form): """ Generates the actual list of data. """ def link_in_col(is_first, field_name, cl): if cl.list_display_links is None: return False if is_first and not cl.list_display_links: return True return field_name in cl.lis...
[ "def", "items_for_result", "(", "cl", ",", "result", ",", "form", ")", ":", "def", "link_in_col", "(", "is_first", ",", "field_name", ",", "cl", ")", ":", "if", "cl", ".", "list_display_links", "is", "None", ":", "return", "False", "if", "is_first", "and...
[ 180, 0 ]
[ 275, 83 ]
python
en
['en', 'error', 'th']
False
result_list
(cl)
Displays the headers and data list together
Displays the headers and data list together
def result_list(cl): """ Displays the headers and data list together """ headers = list(result_headers(cl)) num_sorted_fields = 0 for h in headers: if h['sortable'] and h['sorted']: num_sorted_fields += 1 return {'cl': cl, 'result_hidden_fields': list(result_h...
[ "def", "result_list", "(", "cl", ")", ":", "headers", "=", "list", "(", "result_headers", "(", "cl", ")", ")", "num_sorted_fields", "=", "0", "for", "h", "in", "headers", ":", "if", "h", "[", "'sortable'", "]", "and", "h", "[", "'sorted'", "]", ":", ...
[ 305, 0 ]
[ 318, 41 ]
python
en
['en', 'error', 'th']
False
date_hierarchy
(cl)
Displays the date hierarchy for date drill-down functionality.
Displays the date hierarchy for date drill-down functionality.
def date_hierarchy(cl): """ Displays the date hierarchy for date drill-down functionality. """ if cl.date_hierarchy: field_name = cl.date_hierarchy field = cl.opts.get_field_by_name(field_name)[0] dates_or_datetimes = 'datetimes' if isinstance(field, models.DateTimeField) else 'd...
[ "def", "date_hierarchy", "(", "cl", ")", ":", "if", "cl", ".", "date_hierarchy", ":", "field_name", "=", "cl", ".", "date_hierarchy", "field", "=", "cl", ".", "opts", ".", "get_field_by_name", "(", "field_name", ")", "[", "0", "]", "dates_or_datetimes", "=...
[ 322, 0 ]
[ 396, 13 ]
python
en
['en', 'error', 'th']
False
search_form
(cl)
Displays a search form for searching the list.
Displays a search form for searching the list.
def search_form(cl): """ Displays a search form for searching the list. """ return { 'cl': cl, 'show_result_count': cl.result_count != cl.full_result_count, 'search_var': SEARCH_VAR }
[ "def", "search_form", "(", "cl", ")", ":", "return", "{", "'cl'", ":", "cl", ",", "'show_result_count'", ":", "cl", ".", "result_count", "!=", "cl", ".", "full_result_count", ",", "'search_var'", ":", "SEARCH_VAR", "}" ]
[ 400, 0 ]
[ 408, 5 ]
python
en
['en', 'error', 'th']
False
admin_actions
(context)
Track the number of times the action field has been rendered on the page, so we know which value to use.
Track the number of times the action field has been rendered on the page, so we know which value to use.
def admin_actions(context): """ Track the number of times the action field has been rendered on the page, so we know which value to use. """ context['action_index'] = context.get('action_index', -1) + 1 return context
[ "def", "admin_actions", "(", "context", ")", ":", "context", "[", "'action_index'", "]", "=", "context", ".", "get", "(", "'action_index'", ",", "-", "1", ")", "+", "1", "return", "context" ]
[ 422, 0 ]
[ 428, 18 ]
python
en
['en', 'error', 'th']
False
logger
()
Returns the logger instance used in this module.
Returns the logger instance used in this module.
def logger(): """Returns the logger instance used in this module.""" global _logger _logger = _logger or logging.getLogger(__name__) return _logger
[ "def", "logger", "(", ")", ":", "global", "_logger", "_logger", "=", "_logger", "or", "logging", ".", "getLogger", "(", "__name__", ")", "return", "_logger" ]
[ 82, 0 ]
[ 86, 18 ]
python
en
['en', 'en', 'en']
True
BaseFileLock.lock_file
(self)
The path to the lock file.
The path to the lock file.
def lock_file(self): """ The path to the lock file. """ return self._lock_file
[ "def", "lock_file", "(", "self", ")", ":", "return", "self", ".", "_lock_file" ]
[ 163, 4 ]
[ 167, 30 ]
python
en
['en', 'error', 'th']
False
BaseFileLock.timeout
(self)
You can set a default timeout for the filelock. It will be used as fallback value in the acquire method, if no timeout value (*None*) is given. If you want to disable the timeout, set it to a negative value. A timeout of 0 means, that there is exactly one attempt to acquire th...
You can set a default timeout for the filelock. It will be used as fallback value in the acquire method, if no timeout value (*None*) is given.
def timeout(self): """ You can set a default timeout for the filelock. It will be used as fallback value in the acquire method, if no timeout value (*None*) is given. If you want to disable the timeout, set it to a negative value. A timeout of 0 means, that there is exa...
[ "def", "timeout", "(", "self", ")", ":", "return", "self", ".", "_timeout" ]
[ 170, 4 ]
[ 183, 28 ]
python
en
['en', 'error', 'th']
False
BaseFileLock._acquire
(self)
Platform dependent. If the file lock could be acquired, self._lock_file_fd holds the file descriptor of the lock file.
Platform dependent. If the file lock could be acquired, self._lock_file_fd holds the file descriptor of the lock file.
def _acquire(self): """ Platform dependent. If the file lock could be acquired, self._lock_file_fd holds the file descriptor of the lock file. """ raise NotImplementedError()
[ "def", "_acquire", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 195, 4 ]
[ 201, 35 ]
python
en
['en', 'error', 'th']
False
BaseFileLock._release
(self)
Releases the lock and sets self._lock_file_fd to None.
Releases the lock and sets self._lock_file_fd to None.
def _release(self): """ Releases the lock and sets self._lock_file_fd to None. """ raise NotImplementedError()
[ "def", "_release", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 203, 4 ]
[ 207, 35 ]
python
en
['en', 'error', 'th']
False
BaseFileLock.is_locked
(self)
True, if the object holds the file lock. .. versionchanged:: 2.0.0 This was previously a method and is now a property.
True, if the object holds the file lock.
def is_locked(self): """ True, if the object holds the file lock. .. versionchanged:: 2.0.0 This was previously a method and is now a property. """ return self._lock_file_fd is not None
[ "def", "is_locked", "(", "self", ")", ":", "return", "self", ".", "_lock_file_fd", "is", "not", "None" ]
[ 213, 4 ]
[ 221, 45 ]
python
en
['en', 'error', 'th']
False
BaseFileLock.acquire
(self, timeout=None, poll_intervall=0.05)
Acquires the file lock or fails with a :exc:`Timeout` error. .. code-block:: python # You can use this method in the context manager (recommended) with lock.acquire(): pass # Or use an equivalent try-finally construct: lock.acquire() ...
Acquires the file lock or fails with a :exc:`Timeout` error.
def acquire(self, timeout=None, poll_intervall=0.05): """ Acquires the file lock or fails with a :exc:`Timeout` error. .. code-block:: python # You can use this method in the context manager (recommended) with lock.acquire(): pass # Or use a...
[ "def", "acquire", "(", "self", ",", "timeout", "=", "None", ",", "poll_intervall", "=", "0.05", ")", ":", "# Use the default timeout, if no timeout is provided.", "if", "timeout", "is", "None", ":", "timeout", "=", "self", ".", "timeout", "# Increment the number rig...
[ 223, 4 ]
[ 303, 46 ]
python
en
['en', 'error', 'th']
False
BaseFileLock.release
(self, force=False)
Releases the file lock. Please note, that the lock is only completly released, if the lock counter is 0. Also note, that the lock file itself is not automatically deleted. :arg bool force: If true, the lock counter is ignored and the lock is released in ...
Releases the file lock.
def release(self, force=False): """ Releases the file lock. Please note, that the lock is only completly released, if the lock counter is 0. Also note, that the lock file itself is not automatically deleted. :arg bool force: If true, the lock counter is ign...
[ "def", "release", "(", "self", ",", "force", "=", "False", ")", ":", "with", "self", ".", "_thread_lock", ":", "if", "self", ".", "is_locked", ":", "self", ".", "_lock_counter", "-=", "1", "if", "self", ".", "_lock_counter", "==", "0", "or", "force", ...
[ 305, 4 ]
[ 334, 19 ]
python
en
['en', 'error', 'th']
False
InspectDBTestCase.make_field_type_asserter
(self)
Call inspectdb and return a function to validate a field type in its output
Call inspectdb and return a function to validate a field type in its output
def make_field_type_asserter(self): """Call inspectdb and return a function to validate a field type in its output""" out = StringIO() call_command('inspectdb', table_name_filter=lambda tn: tn.startswith('inspectdb_columntypes'), stdout=out) outp...
[ "def", "make_field_type_asserter", "(", "self", ")", ":", "out", "=", "StringIO", "(", ")", "call_command", "(", "'inspectdb'", ",", "table_name_filter", "=", "lambda", "tn", ":", "tn", ".", "startswith", "(", "'inspectdb_columntypes'", ")", ",", "stdout", "="...
[ 29, 4 ]
[ 41, 30 ]
python
en
['en', 'en', 'en']
True
InspectDBTestCase.test_field_types
(self)
Test introspection of various Django field types
Test introspection of various Django field types
def test_field_types(self): """Test introspection of various Django field types""" assertFieldType = self.make_field_type_asserter() # Inspecting Oracle DB doesn't produce correct results (#19884): # - it gets max_length wrong: it returns a number of bytes. # - it reports fields...
[ "def", "test_field_types", "(", "self", ")", ":", "assertFieldType", "=", "self", ".", "make_field_type_asserter", "(", ")", "# Inspecting Oracle DB doesn't produce correct results (#19884):", "# - it gets max_length wrong: it returns a number of bytes.", "# - it reports fields as blan...
[ 43, 4 ]
[ 77, 76 ]
python
en
['en', 'fi', 'en']
True
InspectDBTestCase.test_number_field_types
(self)
Test introspection of various Django field types
Test introspection of various Django field types
def test_number_field_types(self): """Test introspection of various Django field types""" assertFieldType = self.make_field_type_asserter() if not connection.features.can_introspect_autofield: assertFieldType('id', "models.IntegerField(primary_key=True) # AutoField?") if c...
[ "def", "test_number_field_types", "(", "self", ")", ":", "assertFieldType", "=", "self", ".", "make_field_type_asserter", "(", ")", "if", "not", "connection", ".", "features", ".", "can_introspect_autofield", ":", "assertFieldType", "(", "'id'", ",", "\"models.Integ...
[ 79, 4 ]
[ 134, 71 ]
python
en
['en', 'fi', 'en']
True
InspectDBTestCase.test_digits_column_name_introspection
(self)
Introspection of column names consist/start with digits (#16536/#17676)
Introspection of column names consist/start with digits (#16536/#17676)
def test_digits_column_name_introspection(self): """Introspection of column names consist/start with digits (#16536/#17676)""" out = StringIO() # Lets limit the introspection to tables created for models of this # application call_command('inspectdb', table_n...
[ "def", "test_digits_column_name_introspection", "(", "self", ")", ":", "out", "=", "StringIO", "(", ")", "# Lets limit the introspection to tables created for models of this", "# application", "call_command", "(", "'inspectdb'", ",", "table_name_filter", "=", "lambda", "tn", ...
[ 157, 4 ]
[ 175, 66 ]
python
en
['en', 'en', 'en']
True
InspectDBTestCase.test_special_column_name_introspection
(self)
Introspection of column names containing special characters, unsuitable for Python identifiers
Introspection of column names containing special characters, unsuitable for Python identifiers
def test_special_column_name_introspection(self): """ Introspection of column names containing special characters, unsuitable for Python identifiers """ out = StringIO() call_command('inspectdb', table_name_filter=lambda tn: tn.startswith('inspectdb_'...
[ "def", "test_special_column_name_introspection", "(", "self", ")", ":", "out", "=", "StringIO", "(", ")", "call_command", "(", "'inspectdb'", ",", "table_name_filter", "=", "lambda", "tn", ":", "tn", ".", "startswith", "(", "'inspectdb_'", ")", ",", "stdout", ...
[ 177, 4 ]
[ 197, 89 ]
python
en
['en', 'error', 'th']
False
InspectDBTestCase.test_table_name_introspection
(self)
Introspection of table names containing special characters, unsuitable for Python identifiers
Introspection of table names containing special characters, unsuitable for Python identifiers
def test_table_name_introspection(self): """ Introspection of table names containing special characters, unsuitable for Python identifiers """ out = StringIO() call_command('inspectdb', table_name_filter=lambda tn: tn.startswith('inspectdb_'), ...
[ "def", "test_table_name_introspection", "(", "self", ")", ":", "out", "=", "StringIO", "(", ")", "call_command", "(", "'inspectdb'", ",", "table_name_filter", "=", "lambda", "tn", ":", "tn", ".", "startswith", "(", "'inspectdb_'", ")", ",", "stdout", "=", "o...
[ 199, 4 ]
[ 209, 79 ]
python
en
['en', 'error', 'th']
False
InspectDBTestCase.test_managed_models
(self)
Test that by default the command generates models with `Meta.managed = False` (#14305)
Test that by default the command generates models with `Meta.managed = False` (#14305)
def test_managed_models(self): """Test that by default the command generates models with `Meta.managed = False` (#14305)""" out = StringIO() call_command('inspectdb', table_name_filter=lambda tn: tn.startswith('inspectdb_columntypes'), stdout=out) ...
[ "def", "test_managed_models", "(", "self", ")", ":", "out", "=", "StringIO", "(", ")", "call_command", "(", "'inspectdb'", ",", "table_name_filter", "=", "lambda", "tn", ":", "tn", ".", "startswith", "(", "'inspectdb_columntypes'", ")", ",", "stdout", "=", "...
[ 211, 4 ]
[ 219, 107 ]
python
en
['en', 'en', 'en']
True
InspectDBTestCase.test_custom_fields
(self)
Introspection of columns with a custom field (#21090)
Introspection of columns with a custom field (#21090)
def test_custom_fields(self): """ Introspection of columns with a custom field (#21090) """ out = StringIO() orig_data_types_reverse = connection.introspection.data_types_reverse try: connection.introspection.data_types_reverse = { 'text': 'myf...
[ "def", "test_custom_fields", "(", "self", ")", ":", "out", "=", "StringIO", "(", ")", "orig_data_types_reverse", "=", "connection", ".", "introspection", ".", "data_types_reverse", "try", ":", "connection", ".", "introspection", ".", "data_types_reverse", "=", "{"...
[ 231, 4 ]
[ 249, 81 ]
python
en
['en', 'error', 'th']
False
is_url
(url)
Check if provided string is a url. Args: url (str): url to check Returns: bool: True if arg url is a valid url
Check if provided string is a url.
def is_url(url): """Check if provided string is a url. Args: url (str): url to check Returns: bool: True if arg url is a valid url """ scheme = requtil.urlparse(str(url)).scheme return scheme in ( "http", "https", )
[ "def", "is_url", "(", "url", ")", ":", "scheme", "=", "requtil", ".", "urlparse", "(", "str", "(", "url", ")", ")", ".", "scheme", "return", "scheme", "in", "(", "\"http\"", ",", "\"https\"", ",", ")" ]
[ 49, 0 ]
[ 63, 5 ]
python
en
['en', 'en', 'en']
True
ensure_valid_url
(url)
Ensure a url is valid. Args: url (str): URL to validate Raises: InvalidURL: URL is not a valid url ConnectionError: Failed to connect to url HTTPError: Reponse was not 200 <OK> Returns: str: valid url
Ensure a url is valid.
def ensure_valid_url(url): """Ensure a url is valid. Args: url (str): URL to validate Raises: InvalidURL: URL is not a valid url ConnectionError: Failed to connect to url HTTPError: Reponse was not 200 <OK> Returns: str: valid url """ if not is_url(url...
[ "def", "ensure_valid_url", "(", "url", ")", ":", "if", "not", "is_url", "(", "url", ")", ":", "raise", "reqexc", ".", "InvalidURL", "(", "f\"{url} is not a valid url!\"", ")", "resp", "=", "requests", ".", "head", "(", "url", ",", "allow_redirects", "=", "...
[ 67, 0 ]
[ 86, 14 ]
python
en
['en', 'af', 'en']
True
ensure_existing_dir
(path)
Ensure path exists and is a directory. If path does exist, it will be returned as a pathlib.PurePath object Args: path (str): path to validate and return Raises: NotADirectoryError: path does not exist NotADirectoryError: path is not a directory Returns: object: p...
Ensure path exists and is a directory.
def ensure_existing_dir(path): """Ensure path exists and is a directory. If path does exist, it will be returned as a pathlib.PurePath object Args: path (str): path to validate and return Raises: NotADirectoryError: path does not exist NotADirectoryError: path is not a dir...
[ "def", "ensure_existing_dir", "(", "path", ")", ":", "_path", "=", "Path", "(", "path", ")", "path", "=", "_path", ".", "absolute", "(", ")", "try", ":", "if", "not", "path", ".", "exists", "(", ")", ":", "raise", "NotADirectoryError", "(", "f\"{_path}...
[ 89, 0 ]
[ 115, 16 ]
python
en
['en', 'en', 'en']
True
is_existing_dir
(path)
Check if path is an existing directory. Args: path (str): path to check Returns: bool: True if path exists and is a directory
Check if path is an existing directory.
def is_existing_dir(path): """Check if path is an existing directory. Args: path (str): path to check Returns: bool: True if path exists and is a directory """ try: ensure_existing_dir(path) except NotADirectoryError: return False else: return True
[ "def", "is_existing_dir", "(", "path", ")", ":", "try", ":", "ensure_existing_dir", "(", "path", ")", "except", "NotADirectoryError", ":", "return", "False", "else", ":", "return", "True" ]
[ 118, 0 ]
[ 133, 19 ]
python
en
['en', 'en', 'en']
True
is_downloadable
(url)
Checks if the url can be downloaded from. Args: url (str): url to check Returns: bool: True if contains a downloadable resource
Checks if the url can be downloaded from.
def is_downloadable(url): """Checks if the url can be downloaded from. Args: url (str): url to check Returns: bool: True if contains a downloadable resource """ try: ensure_valid_url(url) except Exception: return False headers = requests.head(url).headers ...
[ "def", "is_downloadable", "(", "url", ")", ":", "try", ":", "ensure_valid_url", "(", "url", ")", "except", "Exception", ":", "return", "False", "headers", "=", "requests", ".", "head", "(", "url", ")", ".", "headers", "content_type", "=", "headers", ".", ...
[ 136, 0 ]
[ 162, 15 ]
python
en
['en', 'en', 'en']
True
get_url_filename
(url)
Parse filename from url. Args: url (str): url to parse Returns: str: filename of url
Parse filename from url.
def get_url_filename(url): """Parse filename from url. Args: url (str): url to parse Returns: str: filename of url """ path = requtil.urlparse(url).path file_name = Path(path).name return file_name
[ "def", "get_url_filename", "(", "url", ")", ":", "path", "=", "requtil", ".", "urlparse", "(", "url", ")", ".", "path", "file_name", "=", "Path", "(", "path", ")", ".", "name", "return", "file_name" ]
[ 165, 0 ]
[ 177, 20 ]
python
en
['en', 'en', 'en']
True
stream_download
(url, **kwargs)
Stream download with tqdm progress bar. Args: url (str): url to file Returns: bytearray: bytearray of content
Stream download with tqdm progress bar.
def stream_download(url, **kwargs): """Stream download with tqdm progress bar. Args: url (str): url to file Returns: bytearray: bytearray of content """ stream = requests.get(url, stream=True) content = bytearray() total_size = int(stream.headers.get("content-length", len(...
[ "def", "stream_download", "(", "url", ",", "*", "*", "kwargs", ")", ":", "stream", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "content", "=", "bytearray", "(", ")", "total_size", "=", "int", "(", "stream", ".", "headers...
[ 180, 0 ]
[ 206, 18 ]
python
en
['en', 'mt', 'en']
True
search_xml
(url, node)
Search xml from url by node. Args: url (str): url to xml node (str): node to search for Returns: [str]: matching nodes
Search xml from url by node.
def search_xml(url, node): """Search xml from url by node. Args: url (str): url to xml node (str): node to search for Returns: [str]: matching nodes """ resp = requests.get(url) xml = resp.content.decode("UTF-8") root = ET.fromstring(xml) root_ns = root.tag[1 :...
[ "def", "search_xml", "(", "url", ",", "node", ")", ":", "resp", "=", "requests", ".", "get", "(", "url", ")", "xml", "=", "resp", ".", "content", ".", "decode", "(", "\"UTF-8\"", ")", "root", "=", "ET", ".", "fromstring", "(", "xml", ")", "root_ns"...
[ 210, 0 ]
[ 228, 18 ]
python
en
['en', 'en', 'en']
True
iter_requirements
(path)
Iterate requirements from a requirements.txt file. Args: path (str): path to file
Iterate requirements from a requirements.txt file.
def iter_requirements(path): """Iterate requirements from a requirements.txt file. Args: path (str): path to file """ req_path = Path(path).absolute() with req_path.open("r") as rfile: for req in requirements.parse(rfile): yield req
[ "def", "iter_requirements", "(", "path", ")", ":", "req_path", "=", "Path", "(", "path", ")", ".", "absolute", "(", ")", "with", "req_path", ".", "open", "(", "\"r\"", ")", "as", "rfile", ":", "for", "req", "in", "requirements", ".", "parse", "(", "r...
[ 231, 0 ]
[ 241, 21 ]
python
en
['en', 'en', 'en']
True
get_package_meta
(name, url)
Retrieve package metadata from PyPi. Args: name (str): Name of package with specs. url (str): Url to package. Returns: dict: Dictionary of Metadata
Retrieve package metadata from PyPi.
def get_package_meta(name, url): """Retrieve package metadata from PyPi. Args: name (str): Name of package with specs. url (str): Url to package. Returns: dict: Dictionary of Metadata """ def _iter_compare(in_val, comp_to, operator): for t in comp_to: ...
[ "def", "get_package_meta", "(", "name", ",", "url", ")", ":", "def", "_iter_compare", "(", "in_val", ",", "comp_to", ",", "operator", ")", ":", "for", "t", "in", "comp_to", ":", "state", "=", "eval", "(", "f\"in_val {operator} t\"", ")", "if", "state", "...
[ 244, 0 ]
[ 276, 19 ]
python
en
['en', 'pt', 'en']
True
extract_tarbytes
(file_bytes, path)
Extract tarfile as bytes. Args: file_bytes (bytearray): Bytes of file to extract path (str): Path to extract it to Returns: path: destination path
Extract tarfile as bytes.
def extract_tarbytes(file_bytes, path): """Extract tarfile as bytes. Args: file_bytes (bytearray): Bytes of file to extract path (str): Path to extract it to Returns: path: destination path """ tar_bytes_obj = io.BytesIO(file_bytes) with tarfile.open(fileobj=tar_bytes_...
[ "def", "extract_tarbytes", "(", "file_bytes", ",", "path", ")", ":", "tar_bytes_obj", "=", "io", ".", "BytesIO", "(", "file_bytes", ")", "with", "tarfile", ".", "open", "(", "fileobj", "=", "tar_bytes_obj", ",", "mode", "=", "\"r:gz\"", ")", "as", "tar", ...
[ 279, 0 ]
[ 293, 15 ]
python
en
['en', 'en', 'en']
True
create_dir_link
(source, target)
Creates a platform appropriate directory link. On POSIX systems it will create a symlink. On Windows it will fallback on a directory junction if needed Args: source (os.Pathlike): Path to create link at. target (os.Pathlike): Path to link to. Raises: OSError: Symlink Creation ...
Creates a platform appropriate directory link.
def create_dir_link(source, target): """Creates a platform appropriate directory link. On POSIX systems it will create a symlink. On Windows it will fallback on a directory junction if needed Args: source (os.Pathlike): Path to create link at. target (os.Pathlike): Path to link to. ...
[ "def", "create_dir_link", "(", "source", ",", "target", ")", ":", "platform", "=", "sys", ".", "platform", "source", "=", "Path", "(", "source", ")", "target", "=", "Path", "(", "target", ")", "try", ":", "source", ".", "symlink_to", "(", "target", ","...
[ 296, 0 ]
[ 334, 19 ]
python
en
['en', 'en', 'en']
True
is_dir_link
(path)
Test if path is either a symlink or directory junction. Args: path (os.Pathlike): Path to test. Returns: bool: True if path is a type of link.
Test if path is either a symlink or directory junction.
def is_dir_link(path): """Test if path is either a symlink or directory junction. Args: path (os.Pathlike): Path to test. Returns: bool: True if path is a type of link. """ platform = sys.platform path = Path(path) if path.is_symlink(): return True if platform ...
[ "def", "is_dir_link", "(", "path", ")", ":", "platform", "=", "sys", ".", "platform", "path", "=", "Path", "(", "path", ")", "if", "path", ".", "is_symlink", "(", ")", ":", "return", "True", "if", "platform", "==", "\"win32\"", ":", "# Test for Directory...
[ 337, 0 ]
[ 356, 16 ]
python
en
['en', 'en', 'en']
True
is_update_available
()
Check if micropy-cli update is available. Returns: bool: True if update available, else False.
Check if micropy-cli update is available.
def is_update_available(): """Check if micropy-cli update is available. Returns: bool: True if update available, else False. """ url = f"https://pypi.org/pypi/micropy-cli/json" data = get_cached_data(url) versions = [k for k in data["releases"].keys() if "rc" not in k] if versions:...
[ "def", "is_update_available", "(", ")", ":", "url", "=", "f\"https://pypi.org/pypi/micropy-cli/json\"", "data", "=", "get_cached_data", "(", "url", ")", "versions", "=", "[", "k", "for", "k", "in", "data", "[", "\"releases\"", "]", ".", "keys", "(", ")", "if...
[ 359, 0 ]
[ 374, 16 ]
python
en
['en', 'en', 'en']
True
get_cached_data
(url)
Wrap requests with a short cache.
Wrap requests with a short cache.
def get_cached_data(url): """Wrap requests with a short cache.""" source_data = requests.get(url).json() return source_data
[ "def", "get_cached_data", "(", "url", ")", ":", "source_data", "=", "requests", ".", "get", "(", "url", ")", ".", "json", "(", ")", "return", "source_data" ]
[ 378, 0 ]
[ 381, 22 ]
python
en
['en', 'en', 'en']
True
get_class_that_defined_method
(meth)
Determines Class that defined a given method. See - https://stackoverflow.com/a/25959545 Args: meth (Callable): Method to determine class from Returns: Callable: Class that defined method
Determines Class that defined a given method.
def get_class_that_defined_method(meth): """Determines Class that defined a given method. See - https://stackoverflow.com/a/25959545 Args: meth (Callable): Method to determine class from Returns: Callable: Class that defined method """ if inspect.ismethod(meth): for c...
[ "def", "get_class_that_defined_method", "(", "meth", ")", ":", "if", "inspect", ".", "ismethod", "(", "meth", ")", ":", "for", "cls", "in", "inspect", ".", "getmro", "(", "meth", ".", "__self__", ".", "__class__", ")", ":", "if", "cls", ".", "__dict__", ...
[ 384, 0 ]
[ 407, 46 ]
python
en
['en', 'en', 'en']
True
decide_user_install
( use_user_site, # type: Optional[bool] prefix_path=None, # type: Optional[str] target_dir=None, # type: Optional[str] root_path=None, # type: Optional[str] isolated_mode=False, # type: bool )
Determine whether to do a user install based on the input options. If use_user_site is False, no additional checks are done. If use_user_site is True, it is checked for compatibility with other options. If use_user_site is None, the default behaviour depends on the environment, which is provided by...
Determine whether to do a user install based on the input options.
def decide_user_install( use_user_site, # type: Optional[bool] prefix_path=None, # type: Optional[str] target_dir=None, # type: Optional[str] root_path=None, # type: Optional[str] isolated_mode=False, # type: bool ): # type: (...) -> bool """Determine whether to do a user install based ...
[ "def", "decide_user_install", "(", "use_user_site", ",", "# type: Optional[bool]", "prefix_path", "=", "None", ",", "# type: Optional[str]", "target_dir", "=", "None", ",", "# type: Optional[str]", "root_path", "=", "None", ",", "# type: Optional[str]", "isolated_mode", "...
[ 547, 0 ]
[ 604, 15 ]
python
en
['en', 'en', 'en']
True
warn_deprecated_install_options
(requirements, options)
If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning.
If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning.
def warn_deprecated_install_options(requirements, options): # type: (List[InstallRequirement], Optional[List[str]]) -> None """If any location-changing --install-option arguments were passed for requirements or on the command-line, then show a deprecation warning. """ def format_options(option_names...
[ "def", "warn_deprecated_install_options", "(", "requirements", ",", "options", ")", ":", "# type: (List[InstallRequirement], Optional[List[str]]) -> None", "def", "format_options", "(", "option_names", ")", ":", "# type: (Iterable[str]) -> List[str]", "return", "[", "\"--{}\"", ...
[ 607, 0 ]
[ 654, 5 ]
python
en
['en', 'en', 'en']
True
create_env_error_message
(error, show_traceback, using_user_site)
Format an error message for an EnvironmentError It may occur anytime during the execution of the install command.
Format an error message for an EnvironmentError
def create_env_error_message(error, show_traceback, using_user_site): """Format an error message for an EnvironmentError It may occur anytime during the execution of the install command. """ parts = [] # Mention the error if we are not going to show a traceback parts.append("Could not install ...
[ "def", "create_env_error_message", "(", "error", ",", "show_traceback", ",", "using_user_site", ")", ":", "parts", "=", "[", "]", "# Mention the error if we are not going to show a traceback", "parts", ".", "append", "(", "\"Could not install packages due to an EnvironmentError...
[ 657, 0 ]
[ 690, 40 ]
python
br
['br', 'gl', 'en']
False
maybe_send_to_registration
( request: HttpRequest, email: str, full_name: str = "", mobile_flow_otp: Optional[str] = None, desktop_flow_otp: Optional[str] = None, is_signup: bool = False, password_required: bool = True, multiuse_object_key: str = "", full_name_validated: bool = False, )
Given a successful authentication for an email address (i.e. we've confirmed the user controls the email address) that does not currently have a Zulip account in the target realm, send them to the registration flow or the "continue to registration" flow, depending on is_signup, whether the email address...
Given a successful authentication for an email address (i.e. we've confirmed the user controls the email address) that does not currently have a Zulip account in the target realm, send them to the registration flow or the "continue to registration" flow, depending on is_signup, whether the email address...
def maybe_send_to_registration( request: HttpRequest, email: str, full_name: str = "", mobile_flow_otp: Optional[str] = None, desktop_flow_otp: Optional[str] = None, is_signup: bool = False, password_required: bool = True, multiuse_object_key: str = "", full_name_validated: bool = Fa...
[ "def", "maybe_send_to_registration", "(", "request", ":", "HttpRequest", ",", "email", ":", "str", ",", "full_name", ":", "str", "=", "\"\"", ",", "mobile_flow_otp", ":", "Optional", "[", "str", "]", "=", "None", ",", "desktop_flow_otp", ":", "Optional", "["...
[ 115, 0 ]
[ 232, 72 ]
python
en
['en', 'en', 'en']
True
login_or_register_remote_user
(request: HttpRequest, result: ExternalAuthResult)
Given a successful authentication showing the user controls given email address (email) and potentially a UserProfile object (if the user already has a Zulip account), redirect the browser to the appropriate place: * The logged-in app if the user already has a Zulip account and is trying to log i...
Given a successful authentication showing the user controls given email address (email) and potentially a UserProfile object (if the user already has a Zulip account), redirect the browser to the appropriate place:
def login_or_register_remote_user(request: HttpRequest, result: ExternalAuthResult) -> HttpResponse: """Given a successful authentication showing the user controls given email address (email) and potentially a UserProfile object (if the user already has a Zulip account), redirect the browser to the appr...
[ "def", "login_or_register_remote_user", "(", "request", ":", "HttpRequest", ",", "result", ":", "ExternalAuthResult", ")", "->", "HttpResponse", ":", "user_profile", "=", "result", ".", "user_profile", "if", "user_profile", "is", "None", "or", "user_profile", ".", ...
[ 249, 0 ]
[ 289, 44 ]
python
en
['en', 'en', 'en']
True
finish_desktop_flow
(request: HttpRequest, user_profile: UserProfile, otp: str)
The desktop otp flow returns to the app (through the clipboard) a token that allows obtaining (through log_into_subdomain) a logged in session for the user account we authenticated in this flow. The token can only be used once and within ExternalAuthResult.LOGIN_KEY_EXPIRATION_SECONDS of being crea...
The desktop otp flow returns to the app (through the clipboard) a token that allows obtaining (through log_into_subdomain) a logged in session for the user account we authenticated in this flow. The token can only be used once and within ExternalAuthResult.LOGIN_KEY_EXPIRATION_SECONDS of being crea...
def finish_desktop_flow(request: HttpRequest, user_profile: UserProfile, otp: str) -> HttpResponse: """ The desktop otp flow returns to the app (through the clipboard) a token that allows obtaining (through log_into_subdomain) a logged in session for the user account we authenticated in this flow. T...
[ "def", "finish_desktop_flow", "(", "request", ":", "HttpRequest", ",", "user_profile", ":", "UserProfile", ",", "otp", ":", "str", ")", "->", "HttpResponse", ":", "result", "=", "ExternalAuthResult", "(", "user_profile", "=", "user_profile", ")", "token", "=", ...
[ 292, 0 ]
[ 311, 75 ]
python
en
['en', 'error', 'th']
False
start_remote_user_sso
(request: HttpRequest)
The purpose of this endpoint is to provide an initial step in the flow on which we can handle the special behavior for the desktop app. /accounts/login/sso may have Apache intercepting requests to it to do authentication, so we need this additional endpoint.
The purpose of this endpoint is to provide an initial step in the flow on which we can handle the special behavior for the desktop app. /accounts/login/sso may have Apache intercepting requests to it to do authentication, so we need this additional endpoint.
def start_remote_user_sso(request: HttpRequest) -> HttpResponse: """ The purpose of this endpoint is to provide an initial step in the flow on which we can handle the special behavior for the desktop app. /accounts/login/sso may have Apache intercepting requests to it to do authentication, so we nee...
[ "def", "start_remote_user_sso", "(", "request", ":", "HttpRequest", ")", "->", "HttpResponse", ":", "query", "=", "request", ".", "META", "[", "\"QUERY_STRING\"", "]", "return", "redirect", "(", "add_query_to_redirect_url", "(", "reverse", "(", "remote_user_sso", ...
[ 518, 0 ]
[ 526, 79 ]
python
en
['en', 'error', 'th']
False
log_into_subdomain
(request: HttpRequest, token: str)
Given a valid authentication token (generated by redirect_and_log_into_subdomain called on auth.zulip.example.com), call login_or_register_remote_user, passing all the authentication result data that has been stored in Redis, associated with this token.
Given a valid authentication token (generated by redirect_and_log_into_subdomain called on auth.zulip.example.com), call login_or_register_remote_user, passing all the authentication result data that has been stored in Redis, associated with this token.
def log_into_subdomain(request: HttpRequest, token: str) -> HttpResponse: """Given a valid authentication token (generated by redirect_and_log_into_subdomain called on auth.zulip.example.com), call login_or_register_remote_user, passing all the authentication result data that has been stored in Redis, a...
[ "def", "log_into_subdomain", "(", "request", ":", "HttpRequest", ",", "token", ":", "str", ")", "->", "HttpResponse", ":", "# The tokens are intended to have the same format as API keys.", "if", "not", "has_api_key_format", "(", "token", ")", ":", "logging", ".", "war...
[ 590, 0 ]
[ 611, 57 ]
python
en
['en', 'en', 'en']
True
start_two_factor_auth
( request: HttpRequest, extra_context: ExtraContext = None, **kwargs: Any )
This is how Django implements as_view(), so extra_context will be passed to the __init__ method of TwoFactorLoginView. def as_view(cls, **initkwargs): def view(request, *args, **kwargs): self = cls(**initkwargs) ... return view
This is how Django implements as_view(), so extra_context will be passed to the __init__ method of TwoFactorLoginView.
def start_two_factor_auth( request: HttpRequest, extra_context: ExtraContext = None, **kwargs: Any ) -> HttpResponse: two_fa_form_field = "two_factor_login_view-current_step" if two_fa_form_field not in request.POST: # Here we inject the 2FA step in the request context if it's missing to # f...
[ "def", "start_two_factor_auth", "(", "request", ":", "HttpRequest", ",", "extra_context", ":", "ExtraContext", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "HttpResponse", ":", "two_fa_form_field", "=", "\"two_factor_login_view-current_step\"", "if",...
[ 798, 0 ]
[ 826, 41 ]
python
en
['en', 'error', 'th']
False
api_dev_fetch_api_key
(request: HttpRequest, username: str = REQ())
This function allows logging in without a password on the Zulip mobile apps when connecting to a Zulip development environment. It requires DevAuthBackend to be included in settings.AUTHENTICATION_BACKENDS.
This function allows logging in without a password on the Zulip mobile apps when connecting to a Zulip development environment. It requires DevAuthBackend to be included in settings.AUTHENTICATION_BACKENDS.
def api_dev_fetch_api_key(request: HttpRequest, username: str = REQ()) -> HttpResponse: """This function allows logging in without a password on the Zulip mobile apps when connecting to a Zulip development environment. It requires DevAuthBackend to be included in settings.AUTHENTICATION_BACKENDS. """ ...
[ "def", "api_dev_fetch_api_key", "(", "request", ":", "HttpRequest", ",", "username", ":", "str", "=", "REQ", "(", ")", ")", "->", "HttpResponse", ":", "check_dev_auth_backend", "(", ")", "# Django invokes authenticate methods by matching arguments, and this", "# authentic...
[ 864, 0 ]
[ 897, 83 ]
python
en
['en', 'en', 'en']
True
get_auth_backends_data
(request: HttpRequest)
Returns which authentication methods are enabled on the server
Returns which authentication methods are enabled on the server
def get_auth_backends_data(request: HttpRequest) -> Dict[str, Any]: """Returns which authentication methods are enabled on the server""" subdomain = get_subdomain(request) try: realm = Realm.objects.get(string_id=subdomain) except Realm.DoesNotExist: # If not the root subdomain, this is ...
[ "def", "get_auth_backends_data", "(", "request", ":", "HttpRequest", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "subdomain", "=", "get_subdomain", "(", "request", ")", "try", ":", "realm", "=", "Realm", ".", "objects", ".", "get", "(", "string_...
[ 978, 0 ]
[ 1001, 17 ]
python
en
['en', 'en', 'en']
True
saml_sp_metadata
(request: HttpRequest, **kwargs: Any)
This is the view function for generating our SP metadata for SAML authentication. It's meant for helping check the correctness of the configuration when setting up SAML, or for obtaining the XML metadata if the IdP requires it. Taken from https://python-social-auth.readthedocs.io/en/latest/backends...
This is the view function for generating our SP metadata for SAML authentication. It's meant for helping check the correctness of the configuration when setting up SAML, or for obtaining the XML metadata if the IdP requires it. Taken from https://python-social-auth.readthedocs.io/en/latest/backends...
def saml_sp_metadata(request: HttpRequest, **kwargs: Any) -> HttpResponse: # nocoverage """ This is the view function for generating our SP metadata for SAML authentication. It's meant for helping check the correctness of the configuration when setting up SAML, or for obtaining the XML metadata if ...
[ "def", "saml_sp_metadata", "(", "request", ":", "HttpRequest", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "HttpResponse", ":", "# nocoverage", "if", "not", "saml_auth_enabled", "(", ")", ":", "return", "config_error", "(", "request", ",", "\"saml\"", ")...
[ 1074, 0 ]
[ 1091, 61 ]
python
en
['en', 'error', 'th']
False
TwoFactorLoginView.done
(self, form_list: List[Form], **kwargs: Any)
Login the user and redirect to the desired page. We need to override this function so that we can redirect to realm.uri instead of '/'.
Login the user and redirect to the desired page.
def done(self, form_list: List[Form], **kwargs: Any) -> HttpResponse: """ Login the user and redirect to the desired page. We need to override this function so that we can redirect to realm.uri instead of '/'. """ realm_uri = self.get_user().realm.uri # This mock...
[ "def", "done", "(", "self", ",", "form_list", ":", "List", "[", "Form", "]", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "HttpResponse", ":", "realm_uri", "=", "self", ".", "get_user", "(", ")", ".", "realm", ".", "uri", "# This mock.patch business...
[ 712, 4 ]
[ 729, 52 ]
python
en
['en', 'error', 'th']
False
TestCallableModelWrapperInitArguments.test_output_layer
(self)
Test that the CallableModelWrapper can be constructed without causing Exceptions
Test that the CallableModelWrapper can be constructed without causing Exceptions
def test_output_layer(self): """ Test that the CallableModelWrapper can be constructed without causing Exceptions """ def model(**kwargs): """Mock model""" del kwargs return True # The following two calls should not raise Exceptions C...
[ "def", "test_output_layer", "(", "self", ")", ":", "def", "model", "(", "*", "*", "kwargs", ")", ":", "\"\"\"Mock model\"\"\"", "del", "kwargs", "return", "True", "# The following two calls should not raise Exceptions", "CallableModelWrapper", "(", "model", ",", "\"pr...
[ 56, 4 ]
[ 68, 45 ]
python
en
['en', 'error', 'th']
False
SpatialReference.__init__
(self, srs_input='')
Creates a GDAL OSR Spatial Reference object from the given input. The input may be string of OGC Well Known Text (WKT), an integer EPSG code, a PROJ.4 string, and/or a projection "well known" shorthand string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').
Creates a GDAL OSR Spatial Reference object from the given input. The input may be string of OGC Well Known Text (WKT), an integer EPSG code, a PROJ.4 string, and/or a projection "well known" shorthand string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').
def __init__(self, srs_input=''): """ Creates a GDAL OSR Spatial Reference object from the given input. The input may be string of OGC Well Known Text (WKT), an integer EPSG code, a PROJ.4 string, and/or a projection "well known" shorthand string (one of 'WGS84', 'WGS72', 'NAD27'...
[ "def", "__init__", "(", "self", ",", "srs_input", "=", "''", ")", ":", "srs_type", "=", "'user'", "if", "isinstance", "(", "srs_input", ",", "six", ".", "string_types", ")", ":", "# Encoding to ASCII if unicode passed in.", "if", "isinstance", "(", "srs_input", ...
[ 48, 4 ]
[ 95, 39 ]
python
en
['en', 'error', 'th']
False
SpatialReference.__del__
(self)
Destroys this spatial reference.
Destroys this spatial reference.
def __del__(self): "Destroys this spatial reference." if self._ptr and capi: capi.release_srs(self._ptr)
[ "def", "__del__", "(", "self", ")", ":", "if", "self", ".", "_ptr", "and", "capi", ":", "capi", ".", "release_srs", "(", "self", ".", "_ptr", ")" ]
[ 97, 4 ]
[ 100, 39 ]
python
en
['en', 'en', 'en']
True
SpatialReference.__getitem__
(self, target)
Returns the value of the given string attribute node, None if the node doesn't exist. Can also take a tuple as a parameter, (target, child), where child is the index of the attribute in the WKT. For example: >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]' ...
Returns the value of the given string attribute node, None if the node doesn't exist. Can also take a tuple as a parameter, (target, child), where child is the index of the attribute in the WKT. For example:
def __getitem__(self, target): """ Returns the value of the given string attribute node, None if the node doesn't exist. Can also take a tuple as a parameter, (target, child), where child is the index of the attribute in the WKT. For example: >>> wkt = 'GEOGCS["WGS 84", DATUM[...
[ "def", "__getitem__", "(", "self", ",", "target", ")", ":", "if", "isinstance", "(", "target", ",", "tuple", ")", ":", "return", "self", ".", "attr_value", "(", "*", "target", ")", "else", ":", "return", "self", ".", "attr_value", "(", "target", ")" ]
[ 102, 4 ]
[ 128, 42 ]
python
en
['en', 'error', 'th']
False
SpatialReference.__str__
(self)
The string representation uses 'pretty' WKT.
The string representation uses 'pretty' WKT.
def __str__(self): "The string representation uses 'pretty' WKT." return self.pretty_wkt
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "pretty_wkt" ]
[ 130, 4 ]
[ 132, 30 ]
python
en
['en', 'en', 'en']
True
SpatialReference.attr_value
(self, target, index=0)
The attribute value for the given target node (e.g. 'PROJCS'). The index keyword specifies an index of the child node to return.
The attribute value for the given target node (e.g. 'PROJCS'). The index keyword specifies an index of the child node to return.
def attr_value(self, target, index=0): """ The attribute value for the given target node (e.g. 'PROJCS'). The index keyword specifies an index of the child node to return. """ if not isinstance(target, six.string_types) or not isinstance(index, int): raise TypeError ...
[ "def", "attr_value", "(", "self", ",", "target", ",", "index", "=", "0", ")", ":", "if", "not", "isinstance", "(", "target", ",", "six", ".", "string_types", ")", "or", "not", "isinstance", "(", "index", ",", "int", ")", ":", "raise", "TypeError", "r...
[ 135, 4 ]
[ 142, 72 ]
python
en
['en', 'error', 'th']
False
SpatialReference.auth_name
(self, target)
Returns the authority name for the given string target node.
Returns the authority name for the given string target node.
def auth_name(self, target): "Returns the authority name for the given string target node." return capi.get_auth_name(self.ptr, force_bytes(target))
[ "def", "auth_name", "(", "self", ",", "target", ")", ":", "return", "capi", ".", "get_auth_name", "(", "self", ".", "ptr", ",", "force_bytes", "(", "target", ")", ")" ]
[ 144, 4 ]
[ 146, 64 ]
python
en
['en', 'en', 'en']
True
SpatialReference.auth_code
(self, target)
Returns the authority code for the given string target node.
Returns the authority code for the given string target node.
def auth_code(self, target): "Returns the authority code for the given string target node." return capi.get_auth_code(self.ptr, force_bytes(target))
[ "def", "auth_code", "(", "self", ",", "target", ")", ":", "return", "capi", ".", "get_auth_code", "(", "self", ".", "ptr", ",", "force_bytes", "(", "target", ")", ")" ]
[ 148, 4 ]
[ 150, 64 ]
python
en
['en', 'en', 'en']
True
SpatialReference.clone
(self)
Returns a clone of this SpatialReference object.
Returns a clone of this SpatialReference object.
def clone(self): "Returns a clone of this SpatialReference object." return SpatialReference(capi.clone_srs(self.ptr))
[ "def", "clone", "(", "self", ")", ":", "return", "SpatialReference", "(", "capi", ".", "clone_srs", "(", "self", ".", "ptr", ")", ")" ]
[ 152, 4 ]
[ 154, 57 ]
python
en
['en', 'en', 'en']
True
SpatialReference.from_esri
(self)
Morphs this SpatialReference from ESRI's format to EPSG.
Morphs this SpatialReference from ESRI's format to EPSG.
def from_esri(self): "Morphs this SpatialReference from ESRI's format to EPSG." capi.morph_from_esri(self.ptr)
[ "def", "from_esri", "(", "self", ")", ":", "capi", ".", "morph_from_esri", "(", "self", ".", "ptr", ")" ]
[ 156, 4 ]
[ 158, 38 ]
python
en
['en', 'en', 'en']
True
SpatialReference.identify_epsg
(self)
This method inspects the WKT of this SpatialReference, and will add EPSG authority nodes where an EPSG identifier is applicable.
This method inspects the WKT of this SpatialReference, and will add EPSG authority nodes where an EPSG identifier is applicable.
def identify_epsg(self): """ This method inspects the WKT of this SpatialReference, and will add EPSG authority nodes where an EPSG identifier is applicable. """ capi.identify_epsg(self.ptr)
[ "def", "identify_epsg", "(", "self", ")", ":", "capi", ".", "identify_epsg", "(", "self", ".", "ptr", ")" ]
[ 160, 4 ]
[ 165, 36 ]
python
en
['en', 'error', 'th']
False
SpatialReference.to_esri
(self)
Morphs this SpatialReference to ESRI's format.
Morphs this SpatialReference to ESRI's format.
def to_esri(self): "Morphs this SpatialReference to ESRI's format." capi.morph_to_esri(self.ptr)
[ "def", "to_esri", "(", "self", ")", ":", "capi", ".", "morph_to_esri", "(", "self", ".", "ptr", ")" ]
[ 167, 4 ]
[ 169, 36 ]
python
en
['en', 'en', 'en']
True
SpatialReference.validate
(self)
Checks to see if the given spatial reference is valid.
Checks to see if the given spatial reference is valid.
def validate(self): "Checks to see if the given spatial reference is valid." capi.srs_validate(self.ptr)
[ "def", "validate", "(", "self", ")", ":", "capi", ".", "srs_validate", "(", "self", ".", "ptr", ")" ]
[ 171, 4 ]
[ 173, 35 ]
python
en
['en', 'en', 'en']
True
SpatialReference.name
(self)
Returns the name of this Spatial Reference.
Returns the name of this Spatial Reference.
def name(self): "Returns the name of this Spatial Reference." if self.projected: return self.attr_value('PROJCS') elif self.geographic: return self.attr_value('GEOGCS') elif self.local: return self.attr_value('LOCAL_CS') else: retur...
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "projected", ":", "return", "self", ".", "attr_value", "(", "'PROJCS'", ")", "elif", "self", ".", "geographic", ":", "return", "self", ".", "attr_value", "(", "'GEOGCS'", ")", "elif", "self", "."...
[ 177, 4 ]
[ 186, 23 ]
python
en
['en', 'en', 'en']
True
SpatialReference.srid
(self)
Returns the SRID of top-level authority, or None if undefined.
Returns the SRID of top-level authority, or None if undefined.
def srid(self): "Returns the SRID of top-level authority, or None if undefined." try: return int(self.attr_value('AUTHORITY', 1)) except (TypeError, ValueError): return None
[ "def", "srid", "(", "self", ")", ":", "try", ":", "return", "int", "(", "self", ".", "attr_value", "(", "'AUTHORITY'", ",", "1", ")", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "return", "None" ]
[ 189, 4 ]
[ 194, 23 ]
python
en
['en', 'en', 'en']
True
SpatialReference.linear_name
(self)
Returns the name of the linear units.
Returns the name of the linear units.
def linear_name(self): "Returns the name of the linear units." units, name = capi.linear_units(self.ptr, byref(c_char_p())) return name
[ "def", "linear_name", "(", "self", ")", ":", "units", ",", "name", "=", "capi", ".", "linear_units", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ")", "return", "name" ]
[ 198, 4 ]
[ 201, 19 ]
python
en
['en', 'en', 'en']
True
SpatialReference.linear_units
(self)
Returns the value of the linear units.
Returns the value of the linear units.
def linear_units(self): "Returns the value of the linear units." units, name = capi.linear_units(self.ptr, byref(c_char_p())) return units
[ "def", "linear_units", "(", "self", ")", ":", "units", ",", "name", "=", "capi", ".", "linear_units", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ")", "return", "units" ]
[ 204, 4 ]
[ 207, 20 ]
python
en
['en', 'en', 'en']
True
SpatialReference.angular_name
(self)
Returns the name of the angular units.
Returns the name of the angular units.
def angular_name(self): "Returns the name of the angular units." units, name = capi.angular_units(self.ptr, byref(c_char_p())) return name
[ "def", "angular_name", "(", "self", ")", ":", "units", ",", "name", "=", "capi", ".", "angular_units", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ")", "return", "name" ]
[ 210, 4 ]
[ 213, 19 ]
python
en
['en', 'mi', 'en']
True
SpatialReference.angular_units
(self)
Returns the value of the angular units.
Returns the value of the angular units.
def angular_units(self): "Returns the value of the angular units." units, name = capi.angular_units(self.ptr, byref(c_char_p())) return units
[ "def", "angular_units", "(", "self", ")", ":", "units", ",", "name", "=", "capi", ".", "angular_units", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ")", "return", "units" ]
[ 216, 4 ]
[ 219, 20 ]
python
en
['en', 'en', 'en']
True
SpatialReference.units
(self)
Returns a 2-tuple of the units value and the units name, and will automatically determines whether to return the linear or angular units.
Returns a 2-tuple of the units value and the units name, and will automatically determines whether to return the linear or angular units.
def units(self): """ Returns a 2-tuple of the units value and the units name, and will automatically determines whether to return the linear or angular units. """ units, name = None, None if self.projected or self.local: units, name = capi.linear_units...
[ "def", "units", "(", "self", ")", ":", "units", ",", "name", "=", "None", ",", "None", "if", "self", ".", "projected", "or", "self", ".", "local", ":", "units", ",", "name", "=", "capi", ".", "linear_units", "(", "self", ".", "ptr", ",", "byref", ...
[ 222, 4 ]
[ 235, 28 ]
python
en
['en', 'error', 'th']
False
SpatialReference.ellipsoid
(self)
Returns a tuple of the ellipsoid parameters: (semimajor axis, semiminor axis, and inverse flattening)
Returns a tuple of the ellipsoid parameters: (semimajor axis, semiminor axis, and inverse flattening)
def ellipsoid(self): """ Returns a tuple of the ellipsoid parameters: (semimajor axis, semiminor axis, and inverse flattening) """ return (self.semi_major, self.semi_minor, self.inverse_flattening)
[ "def", "ellipsoid", "(", "self", ")", ":", "return", "(", "self", ".", "semi_major", ",", "self", ".", "semi_minor", ",", "self", ".", "inverse_flattening", ")" ]
[ 239, 4 ]
[ 244, 74 ]
python
en
['en', 'error', 'th']
False
SpatialReference.semi_major
(self)
Returns the Semi Major Axis for this Spatial Reference.
Returns the Semi Major Axis for this Spatial Reference.
def semi_major(self): "Returns the Semi Major Axis for this Spatial Reference." return capi.semi_major(self.ptr, byref(c_int()))
[ "def", "semi_major", "(", "self", ")", ":", "return", "capi", ".", "semi_major", "(", "self", ".", "ptr", ",", "byref", "(", "c_int", "(", ")", ")", ")" ]
[ 247, 4 ]
[ 249, 56 ]
python
en
['en', 'en', 'en']
True
SpatialReference.semi_minor
(self)
Returns the Semi Minor Axis for this Spatial Reference.
Returns the Semi Minor Axis for this Spatial Reference.
def semi_minor(self): "Returns the Semi Minor Axis for this Spatial Reference." return capi.semi_minor(self.ptr, byref(c_int()))
[ "def", "semi_minor", "(", "self", ")", ":", "return", "capi", ".", "semi_minor", "(", "self", ".", "ptr", ",", "byref", "(", "c_int", "(", ")", ")", ")" ]
[ 252, 4 ]
[ 254, 56 ]
python
en
['en', 'en', 'en']
True
SpatialReference.inverse_flattening
(self)
Returns the Inverse Flattening for this Spatial Reference.
Returns the Inverse Flattening for this Spatial Reference.
def inverse_flattening(self): "Returns the Inverse Flattening for this Spatial Reference." return capi.invflattening(self.ptr, byref(c_int()))
[ "def", "inverse_flattening", "(", "self", ")", ":", "return", "capi", ".", "invflattening", "(", "self", ".", "ptr", ",", "byref", "(", "c_int", "(", ")", ")", ")" ]
[ 257, 4 ]
[ 259, 59 ]
python
en
['en', 'en', 'en']
True
SpatialReference.geographic
(self)
Returns True if this SpatialReference is geographic (root node is GEOGCS).
Returns True if this SpatialReference is geographic (root node is GEOGCS).
def geographic(self): """ Returns True if this SpatialReference is geographic (root node is GEOGCS). """ return bool(capi.isgeographic(self.ptr))
[ "def", "geographic", "(", "self", ")", ":", "return", "bool", "(", "capi", ".", "isgeographic", "(", "self", ".", "ptr", ")", ")" ]
[ 263, 4 ]
[ 268, 48 ]
python
en
['en', 'error', 'th']
False
SpatialReference.local
(self)
Returns True if this SpatialReference is local (root node is LOCAL_CS).
Returns True if this SpatialReference is local (root node is LOCAL_CS).
def local(self): "Returns True if this SpatialReference is local (root node is LOCAL_CS)." return bool(capi.islocal(self.ptr))
[ "def", "local", "(", "self", ")", ":", "return", "bool", "(", "capi", ".", "islocal", "(", "self", ".", "ptr", ")", ")" ]
[ 271, 4 ]
[ 273, 43 ]
python
en
['en', 'en', 'en']
True
SpatialReference.projected
(self)
Returns True if this SpatialReference is a projected coordinate system (root node is PROJCS).
Returns True if this SpatialReference is a projected coordinate system (root node is PROJCS).
def projected(self): """ Returns True if this SpatialReference is a projected coordinate system (root node is PROJCS). """ return bool(capi.isprojected(self.ptr))
[ "def", "projected", "(", "self", ")", ":", "return", "bool", "(", "capi", ".", "isprojected", "(", "self", ".", "ptr", ")", ")" ]
[ 276, 4 ]
[ 281, 47 ]
python
en
['en', 'error', 'th']
False
SpatialReference.import_epsg
(self, epsg)
Imports the Spatial Reference from the EPSG code (an integer).
Imports the Spatial Reference from the EPSG code (an integer).
def import_epsg(self, epsg): "Imports the Spatial Reference from the EPSG code (an integer)." capi.from_epsg(self.ptr, epsg)
[ "def", "import_epsg", "(", "self", ",", "epsg", ")", ":", "capi", ".", "from_epsg", "(", "self", ".", "ptr", ",", "epsg", ")" ]
[ 284, 4 ]
[ 286, 38 ]
python
en
['en', 'en', 'en']
True
SpatialReference.import_proj
(self, proj)
Imports the Spatial Reference from a PROJ.4 string.
Imports the Spatial Reference from a PROJ.4 string.
def import_proj(self, proj): "Imports the Spatial Reference from a PROJ.4 string." capi.from_proj(self.ptr, proj)
[ "def", "import_proj", "(", "self", ",", "proj", ")", ":", "capi", ".", "from_proj", "(", "self", ".", "ptr", ",", "proj", ")" ]
[ 288, 4 ]
[ 290, 38 ]
python
en
['en', 'en', 'en']
True
SpatialReference.import_user_input
(self, user_input)
Imports the Spatial Reference from the given user input string.
Imports the Spatial Reference from the given user input string.
def import_user_input(self, user_input): "Imports the Spatial Reference from the given user input string." capi.from_user_input(self.ptr, force_bytes(user_input))
[ "def", "import_user_input", "(", "self", ",", "user_input", ")", ":", "capi", ".", "from_user_input", "(", "self", ".", "ptr", ",", "force_bytes", "(", "user_input", ")", ")" ]
[ 292, 4 ]
[ 294, 63 ]
python
en
['en', 'en', 'en']
True
SpatialReference.import_wkt
(self, wkt)
Imports the Spatial Reference from OGC WKT (string)
Imports the Spatial Reference from OGC WKT (string)
def import_wkt(self, wkt): "Imports the Spatial Reference from OGC WKT (string)" capi.from_wkt(self.ptr, byref(c_char_p(wkt)))
[ "def", "import_wkt", "(", "self", ",", "wkt", ")", ":", "capi", ".", "from_wkt", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", "wkt", ")", ")", ")" ]
[ 296, 4 ]
[ 298, 53 ]
python
en
['en', 'en', 'en']
True
SpatialReference.import_xml
(self, xml)
Imports the Spatial Reference from an XML string.
Imports the Spatial Reference from an XML string.
def import_xml(self, xml): "Imports the Spatial Reference from an XML string." capi.from_xml(self.ptr, xml)
[ "def", "import_xml", "(", "self", ",", "xml", ")", ":", "capi", ".", "from_xml", "(", "self", ".", "ptr", ",", "xml", ")" ]
[ 300, 4 ]
[ 302, 36 ]
python
en
['en', 'en', 'en']
True
SpatialReference.wkt
(self)
Returns the WKT representation of this Spatial Reference.
Returns the WKT representation of this Spatial Reference.
def wkt(self): "Returns the WKT representation of this Spatial Reference." return capi.to_wkt(self.ptr, byref(c_char_p()))
[ "def", "wkt", "(", "self", ")", ":", "return", "capi", ".", "to_wkt", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ")" ]
[ 306, 4 ]
[ 308, 55 ]
python
en
['en', 'en', 'en']
True
SpatialReference.pretty_wkt
(self, simplify=0)
Returns the 'pretty' representation of the WKT.
Returns the 'pretty' representation of the WKT.
def pretty_wkt(self, simplify=0): "Returns the 'pretty' representation of the WKT." return capi.to_pretty_wkt(self.ptr, byref(c_char_p()), simplify)
[ "def", "pretty_wkt", "(", "self", ",", "simplify", "=", "0", ")", ":", "return", "capi", ".", "to_pretty_wkt", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ",", "simplify", ")" ]
[ 311, 4 ]
[ 313, 72 ]
python
en
['en', 'en', 'en']
True
SpatialReference.proj
(self)
Returns the PROJ.4 representation for this Spatial Reference.
Returns the PROJ.4 representation for this Spatial Reference.
def proj(self): "Returns the PROJ.4 representation for this Spatial Reference." return capi.to_proj(self.ptr, byref(c_char_p()))
[ "def", "proj", "(", "self", ")", ":", "return", "capi", ".", "to_proj", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ")" ]
[ 316, 4 ]
[ 318, 56 ]
python
en
['en', 'en', 'en']
True
SpatialReference.proj4
(self)
Alias for proj().
Alias for proj().
def proj4(self): "Alias for proj()." return self.proj
[ "def", "proj4", "(", "self", ")", ":", "return", "self", ".", "proj" ]
[ 321, 4 ]
[ 323, 24 ]
python
eo
['es', 'eo', 'ur']
False
SpatialReference.xml
(self, dialect='')
Returns the XML representation of this Spatial Reference.
Returns the XML representation of this Spatial Reference.
def xml(self, dialect=''): "Returns the XML representation of this Spatial Reference." return capi.to_xml(self.ptr, byref(c_char_p()), dialect)
[ "def", "xml", "(", "self", ",", "dialect", "=", "''", ")", ":", "return", "capi", ".", "to_xml", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ",", "dialect", ")" ]
[ 326, 4 ]
[ 328, 64 ]
python
en
['en', 'en', 'en']
True
CoordTransform.__init__
(self, source, target)
Initializes on a source and target SpatialReference objects.
Initializes on a source and target SpatialReference objects.
def __init__(self, source, target): "Initializes on a source and target SpatialReference objects." if not isinstance(source, SpatialReference) or not isinstance(target, SpatialReference): raise TypeError('source and target must be of type SpatialReference') self.ptr = capi.new_ct(sou...
[ "def", "__init__", "(", "self", ",", "source", ",", "target", ")", ":", "if", "not", "isinstance", "(", "source", ",", "SpatialReference", ")", "or", "not", "isinstance", "(", "target", ",", "SpatialReference", ")", ":", "raise", "TypeError", "(", "'source...
[ 334, 4 ]
[ 340, 37 ]
python
en
['en', 'en', 'en']
True
CoordTransform.__del__
(self)
Deletes this Coordinate Transformation object.
Deletes this Coordinate Transformation object.
def __del__(self): "Deletes this Coordinate Transformation object." if self._ptr and capi: capi.destroy_ct(self._ptr)
[ "def", "__del__", "(", "self", ")", ":", "if", "self", ".", "_ptr", "and", "capi", ":", "capi", ".", "destroy_ct", "(", "self", ".", "_ptr", ")" ]
[ 342, 4 ]
[ 345, 38 ]
python
en
['en', 'en', 'en']
True
StaticFilesHandlerMixin._should_handle
(self, path)
Check if the path should be handled. Ignore the path if: * the host is provided as part of the base_url * the request's path isn't under the media path (or equal)
Check if the path should be handled. Ignore the path if: * the host is provided as part of the base_url * the request's path isn't under the media path (or equal)
def _should_handle(self, path): """ Check if the path should be handled. Ignore the path if: * the host is provided as part of the base_url * the request's path isn't under the media path (or equal) """ return path.startswith(self.base_url[2]) and not self.base_url[1]
[ "def", "_should_handle", "(", "self", ",", "path", ")", ":", "return", "path", ".", "startswith", "(", "self", ".", "base_url", "[", "2", "]", ")", "and", "not", "self", ".", "base_url", "[", "1", "]" ]
[ 29, 4 ]
[ 35, 73 ]
python
en
['en', 'error', 'th']
False
StaticFilesHandlerMixin.file_path
(self, url)
Return the relative path to the media file on disk for the given URL.
Return the relative path to the media file on disk for the given URL.
def file_path(self, url): """ Return the relative path to the media file on disk for the given URL. """ relative_url = url[len(self.base_url[2]):] return url2pathname(relative_url)
[ "def", "file_path", "(", "self", ",", "url", ")", ":", "relative_url", "=", "url", "[", "len", "(", "self", ".", "base_url", "[", "2", "]", ")", ":", "]", "return", "url2pathname", "(", "relative_url", ")" ]
[ 37, 4 ]
[ 42, 41 ]
python
en
['en', 'error', 'th']
False
StaticFilesHandlerMixin.serve
(self, request)
Serve the request path.
Serve the request path.
def serve(self, request): """Serve the request path.""" return serve(request, self.file_path(request.path), insecure=True)
[ "def", "serve", "(", "self", ",", "request", ")", ":", "return", "serve", "(", "request", ",", "self", ".", "file_path", "(", "request", ".", "path", ")", ",", "insecure", "=", "True", ")" ]
[ 44, 4 ]
[ 46, 74 ]
python
en
['en', 'en', 'en']
True
WsgiToAsgi.__call__
(self, scope, receive, send)
ASGI application instantiation point. We return a new WsgiToAsgiInstance here with the WSGI app and the scope, ready to respond when it is __call__ed.
ASGI application instantiation point. We return a new WsgiToAsgiInstance here with the WSGI app and the scope, ready to respond when it is __call__ed.
async def __call__(self, scope, receive, send): """ ASGI application instantiation point. We return a new WsgiToAsgiInstance here with the WSGI app and the scope, ready to respond when it is __call__ed. """ await WsgiToAsgiInstance(self.wsgi_application)(scope, receive, s...
[ "async", "def", "__call__", "(", "self", ",", "scope", ",", "receive", ",", "send", ")", ":", "await", "WsgiToAsgiInstance", "(", "self", ".", "wsgi_application", ")", "(", "scope", ",", "receive", ",", "send", ")" ]
[ 14, 4 ]
[ 20, 77 ]
python
en
['en', 'error', 'th']
False
WsgiToAsgiInstance.build_environ
(self, scope, body)
Builds a scope and request body into a WSGI environ object.
Builds a scope and request body into a WSGI environ object.
def build_environ(self, scope, body): """ Builds a scope and request body into a WSGI environ object. """ environ = { "REQUEST_METHOD": scope["method"], "SCRIPT_NAME": scope.get("root_path", ""), "PATH_INFO": scope["path"], "QUERY_STRING": ...
[ "def", "build_environ", "(", "self", ",", "scope", ",", "body", ")", ":", "environ", "=", "{", "\"REQUEST_METHOD\"", ":", "scope", "[", "\"method\"", "]", ",", "\"SCRIPT_NAME\"", ":", "scope", ".", "get", "(", "\"root_path\"", ",", "\"\"", ")", ",", "\"P...
[ 51, 4 ]
[ 94, 22 ]
python
en
['en', 'error', 'th']
False
WsgiToAsgiInstance.start_response
(self, status, response_headers, exc_info=None)
WSGI start_response callable.
WSGI start_response callable.
def start_response(self, status, response_headers, exc_info=None): """ WSGI start_response callable. """ # Don't allow re-calling once response has begun if self.response_started: raise exc_info[1].with_traceback(exc_info[2]) # Don't allow re-calling without e...
[ "def", "start_response", "(", "self", ",", "status", ",", "response_headers", ",", "exc_info", "=", "None", ")", ":", "# Don't allow re-calling once response has begun", "if", "self", ".", "response_started", ":", "raise", "exc_info", "[", "1", "]", ".", "with_tra...
[ 96, 4 ]
[ 121, 9 ]
python
en
['en', 'error', 'th']
False