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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ensure_dir | (path) | os.path.makedirs without EEXIST. | os.path.makedirs without EEXIST. | def ensure_dir(path):
# type: (AnyStr) -> None
"""os.path.makedirs without EEXIST."""
try:
os.makedirs(path)
except OSError as e:
# Windows can raise spurious ENOTEMPTY errors. See #6426.
if e.errno != errno.EEXIST and e.errno != errno.ENOTEMPTY:
raise | [
"def",
"ensure_dir",
"(",
"path",
")",
":",
"# type: (AnyStr) -> None",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
"as",
"e",
":",
"# Windows can raise spurious ENOTEMPTY errors. See #6426.",
"if",
"e",
".",
"errno",
"!=",
"errno",
... | [
106,
0
] | [
114,
17
] | python | en | ['en', 'en', 'en'] | True |
rmtree_errorhandler | (func, path, exc_info) | On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems. | On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems. | def rmtree_errorhandler(func, path, exc_info):
"""On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems."""
try:
has_attr_readonly = not (os.stat(pat... | [
"def",
"rmtree_errorhandler",
"(",
"func",
",",
"path",
",",
"exc_info",
")",
":",
"try",
":",
"has_attr_readonly",
"=",
"not",
"(",
"os",
".",
"stat",
"(",
"path",
")",
".",
"st_mode",
"&",
"stat",
".",
"S_IWRITE",
")",
"except",
"(",
"IOError",
",",
... | [
138,
0
] | [
155,
13
] | python | en | ['en', 'en', 'en'] | True |
path_to_display | (path) |
Convert a bytes (or text) path to text (unicode in Python 2) for display
and logging purposes.
This function should never error out. Also, this function is mainly needed
for Python 2 since in Python 3 str paths are already text.
|
Convert a bytes (or text) path to text (unicode in Python 2) for display
and logging purposes. | def path_to_display(path):
# type: (Optional[Union[str, Text]]) -> Optional[Text]
"""
Convert a bytes (or text) path to text (unicode in Python 2) for display
and logging purposes.
This function should never error out. Also, this function is mainly needed
for Python 2 since in Python 3 str path... | [
"def",
"path_to_display",
"(",
"path",
")",
":",
"# type: (Optional[Union[str, Text]]) -> Optional[Text]",
"if",
"path",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"path",
",",
"text_type",
")",
":",
"return",
"path",
"# Otherwise, path is a bytes o... | [
158,
0
] | [
189,
23
] | python | en | ['en', 'error', 'th'] | False |
display_path | (path) | Gives the display value for a given path, making it relative to cwd
if possible. | Gives the display value for a given path, making it relative to cwd
if possible. | def display_path(path):
# type: (Union[str, Text]) -> str
"""Gives the display value for a given path, making it relative to cwd
if possible."""
path = os.path.normcase(os.path.abspath(path))
if sys.version_info[0] == 2:
path = path.decode(sys.getfilesystemencoding(), 'replace')
path... | [
"def",
"display_path",
"(",
"path",
")",
":",
"# type: (Union[str, Text]) -> str",
"path",
"=",
"os",
".",
"path",
".",
"normcase",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
")",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
"==",
"2... | [
192,
0
] | [
202,
15
] | python | en | ['en', 'en', 'en'] | True |
backup_dir | (dir, ext='.bak') | Figure out the name of a directory to back up the given dir to
(adding .bak, .bak2, etc) | Figure out the name of a directory to back up the given dir to
(adding .bak, .bak2, etc) | def backup_dir(dir, ext='.bak'):
# type: (str, str) -> str
"""Figure out the name of a directory to back up the given dir to
(adding .bak, .bak2, etc)"""
n = 1
extension = ext
while os.path.exists(dir + extension):
n += 1
extension = ext + str(n)
return dir + extension | [
"def",
"backup_dir",
"(",
"dir",
",",
"ext",
"=",
"'.bak'",
")",
":",
"# type: (str, str) -> str",
"n",
"=",
"1",
"extension",
"=",
"ext",
"while",
"os",
".",
"path",
".",
"exists",
"(",
"dir",
"+",
"extension",
")",
":",
"n",
"+=",
"1",
"extension",
... | [
205,
0
] | [
214,
26
] | python | en | ['en', 'en', 'en'] | True |
_check_no_input | (message) | Raise an error if no input is allowed. | Raise an error if no input is allowed. | def _check_no_input(message):
# type: (str) -> None
"""Raise an error if no input is allowed."""
if os.environ.get('PIP_NO_INPUT'):
raise Exception(
'No input was expected ($PIP_NO_INPUT set); question: {}'.format(
message)
) | [
"def",
"_check_no_input",
"(",
"message",
")",
":",
"# type: (str) -> None",
"if",
"os",
".",
"environ",
".",
"get",
"(",
"'PIP_NO_INPUT'",
")",
":",
"raise",
"Exception",
"(",
"'No input was expected ($PIP_NO_INPUT set); question: {}'",
".",
"format",
"(",
"message",... | [
225,
0
] | [
232,
9
] | python | en | ['en', 'lb', 'en'] | True |
ask | (message, options) | Ask the message interactively, with the given possible responses | Ask the message interactively, with the given possible responses | def ask(message, options):
# type: (str, Iterable[str]) -> str
"""Ask the message interactively, with the given possible responses"""
while 1:
_check_no_input(message)
response = input(message)
response = response.strip().lower()
if response not in options:
print(... | [
"def",
"ask",
"(",
"message",
",",
"options",
")",
":",
"# type: (str, Iterable[str]) -> str",
"while",
"1",
":",
"_check_no_input",
"(",
"message",
")",
"response",
"=",
"input",
"(",
"message",
")",
"response",
"=",
"response",
".",
"strip",
"(",
")",
".",... | [
235,
0
] | [
248,
27
] | python | en | ['en', 'en', 'en'] | True |
ask_input | (message) | Ask for input interactively. | Ask for input interactively. | def ask_input(message):
# type: (str) -> str
"""Ask for input interactively."""
_check_no_input(message)
return input(message) | [
"def",
"ask_input",
"(",
"message",
")",
":",
"# type: (str) -> str",
"_check_no_input",
"(",
"message",
")",
"return",
"input",
"(",
"message",
")"
] | [
251,
0
] | [
255,
25
] | python | en | ['en', 'en', 'en'] | True |
ask_password | (message) | Ask for a password interactively. | Ask for a password interactively. | def ask_password(message):
# type: (str) -> str
"""Ask for a password interactively."""
_check_no_input(message)
return getpass.getpass(message) | [
"def",
"ask_password",
"(",
"message",
")",
":",
"# type: (str) -> str",
"_check_no_input",
"(",
"message",
")",
"return",
"getpass",
".",
"getpass",
"(",
"message",
")"
] | [
258,
0
] | [
262,
35
] | python | en | ['en', 'en', 'en'] | True |
tabulate | (rows) | Return a list of formatted rows and a list of column sizes.
For example::
>>> tabulate([['foobar', 2000], [0xdeadbeef]])
(['foobar 2000', '3735928559'], [10, 4])
| Return a list of formatted rows and a list of column sizes. | def tabulate(rows):
# type: (Iterable[Iterable[Any]]) -> Tuple[List[str], List[int]]
"""Return a list of formatted rows and a list of column sizes.
For example::
>>> tabulate([['foobar', 2000], [0xdeadbeef]])
(['foobar 2000', '3735928559'], [10, 4])
"""
rows = [tuple(map(str, row)) for... | [
"def",
"tabulate",
"(",
"rows",
")",
":",
"# type: (Iterable[Iterable[Any]]) -> Tuple[List[str], List[int]]",
"rows",
"=",
"[",
"tuple",
"(",
"map",
"(",
"str",
",",
"row",
")",
")",
"for",
"row",
"in",
"rows",
"]",
"sizes",
"=",
"[",
"max",
"(",
"map",
"(... | [
277,
0
] | [
289,
23
] | python | en | ['en', 'en', 'en'] | True |
is_installable_dir | (path) | Is path is a directory containing setup.py or pyproject.toml?
| Is path is a directory containing setup.py or pyproject.toml?
| def is_installable_dir(path):
# type: (str) -> bool
"""Is path is a directory containing setup.py or pyproject.toml?
"""
if not os.path.isdir(path):
return False
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
return True
pyproject_toml = os.path.join(p... | [
"def",
"is_installable_dir",
"(",
"path",
")",
":",
"# type: (str) -> bool",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"return",
"False",
"setup_py",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'setup.py'",
")",
"... | [
292,
0
] | [
304,
16
] | python | en | ['en', 'en', 'en'] | True |
read_chunks | (file, size=io.DEFAULT_BUFFER_SIZE) | Yield pieces of data from a file-like object until EOF. | Yield pieces of data from a file-like object until EOF. | def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
"""Yield pieces of data from a file-like object until EOF."""
while True:
chunk = file.read(size)
if not chunk:
break
yield chunk | [
"def",
"read_chunks",
"(",
"file",
",",
"size",
"=",
"io",
".",
"DEFAULT_BUFFER_SIZE",
")",
":",
"while",
"True",
":",
"chunk",
"=",
"file",
".",
"read",
"(",
"size",
")",
"if",
"not",
"chunk",
":",
"break",
"yield",
"chunk"
] | [
307,
0
] | [
313,
19
] | python | en | ['en', 'en', 'en'] | True |
normalize_path | (path, resolve_symlinks=True) |
Convert a path to its canonical, case-normalized, absolute version.
|
Convert a path to its canonical, case-normalized, absolute version. | def normalize_path(path, resolve_symlinks=True):
# type: (str, bool) -> str
"""
Convert a path to its canonical, case-normalized, absolute version.
"""
path = expanduser(path)
if resolve_symlinks:
path = os.path.realpath(path)
else:
path = os.path.abspath(path)
return os... | [
"def",
"normalize_path",
"(",
"path",
",",
"resolve_symlinks",
"=",
"True",
")",
":",
"# type: (str, bool) -> str",
"path",
"=",
"expanduser",
"(",
"path",
")",
"if",
"resolve_symlinks",
":",
"path",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path",
")",... | [
316,
0
] | [
327,
33
] | python | en | ['en', 'error', 'th'] | False |
splitext | (path) | Like os.path.splitext, but take off .tar too | Like os.path.splitext, but take off .tar too | def splitext(path):
# type: (str) -> Tuple[str, str]
"""Like os.path.splitext, but take off .tar too"""
base, ext = posixpath.splitext(path)
if base.lower().endswith('.tar'):
ext = base[-4:] + ext
base = base[:-4]
return base, ext | [
"def",
"splitext",
"(",
"path",
")",
":",
"# type: (str) -> Tuple[str, str]",
"base",
",",
"ext",
"=",
"posixpath",
".",
"splitext",
"(",
"path",
")",
"if",
"base",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.tar'",
")",
":",
"ext",
"=",
"base",
"... | [
330,
0
] | [
337,
20
] | python | en | ['en', 'en', 'en'] | True |
renames | (old, new) | Like os.renames(), but handles renaming across devices. | Like os.renames(), but handles renaming across devices. | def renames(old, new):
# type: (str, str) -> None
"""Like os.renames(), but handles renaming across devices."""
# Implementation borrowed from os.renames().
head, tail = os.path.split(new)
if head and tail and not os.path.exists(head):
os.makedirs(head)
shutil.move(old, new)
head, ... | [
"def",
"renames",
"(",
"old",
",",
"new",
")",
":",
"# type: (str, str) -> None",
"# Implementation borrowed from os.renames().",
"head",
",",
"tail",
"=",
"os",
".",
"path",
".",
"split",
"(",
"new",
")",
"if",
"head",
"and",
"tail",
"and",
"not",
"os",
"."... | [
340,
0
] | [
355,
16
] | python | en | ['en', 'en', 'en'] | True |
is_local | (path) |
Return True if path is within sys.prefix, if we're running in a virtualenv.
If we're not in a virtualenv, all paths are considered "local."
Caution: this function assumes the head of path has been normalized
with normalize_path.
|
Return True if path is within sys.prefix, if we're running in a virtualenv. | def is_local(path):
# type: (str) -> bool
"""
Return True if path is within sys.prefix, if we're running in a virtualenv.
If we're not in a virtualenv, all paths are considered "local."
Caution: this function assumes the head of path has been normalized
with normalize_path.
"""
if not ... | [
"def",
"is_local",
"(",
"path",
")",
":",
"# type: (str) -> bool",
"if",
"not",
"running_under_virtualenv",
"(",
")",
":",
"return",
"True",
"return",
"path",
".",
"startswith",
"(",
"normalize_path",
"(",
"sys",
".",
"prefix",
")",
")"
] | [
358,
0
] | [
370,
54
] | python | en | ['en', 'error', 'th'] | False |
dist_is_local | (dist) |
Return True if given Distribution object is installed locally
(i.e. within current virtualenv).
Always True if we're not in a virtualenv.
|
Return True if given Distribution object is installed locally
(i.e. within current virtualenv). | def dist_is_local(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution object is installed locally
(i.e. within current virtualenv).
Always True if we're not in a virtualenv.
"""
return is_local(dist_location(dist)) | [
"def",
"dist_is_local",
"(",
"dist",
")",
":",
"# type: (Distribution) -> bool",
"return",
"is_local",
"(",
"dist_location",
"(",
"dist",
")",
")"
] | [
373,
0
] | [
382,
40
] | python | en | ['en', 'error', 'th'] | False |
dist_in_usersite | (dist) |
Return True if given Distribution is installed in user site.
|
Return True if given Distribution is installed in user site.
| def dist_in_usersite(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is installed in user site.
"""
return dist_location(dist).startswith(normalize_path(user_site)) | [
"def",
"dist_in_usersite",
"(",
"dist",
")",
":",
"# type: (Distribution) -> bool",
"return",
"dist_location",
"(",
"dist",
")",
".",
"startswith",
"(",
"normalize_path",
"(",
"user_site",
")",
")"
] | [
385,
0
] | [
390,
68
] | python | en | ['en', 'error', 'th'] | False |
dist_in_site_packages | (dist) |
Return True if given Distribution is installed in
sysconfig.get_python_lib().
|
Return True if given Distribution is installed in
sysconfig.get_python_lib().
| def dist_in_site_packages(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is installed in
sysconfig.get_python_lib().
"""
return dist_location(dist).startswith(normalize_path(site_packages)) | [
"def",
"dist_in_site_packages",
"(",
"dist",
")",
":",
"# type: (Distribution) -> bool",
"return",
"dist_location",
"(",
"dist",
")",
".",
"startswith",
"(",
"normalize_path",
"(",
"site_packages",
")",
")"
] | [
393,
0
] | [
399,
72
] | python | en | ['en', 'error', 'th'] | False |
dist_is_editable | (dist) |
Return True if given Distribution is an editable install.
|
Return True if given Distribution is an editable install.
| def dist_is_editable(dist):
# type: (Distribution) -> bool
"""
Return True if given Distribution is an editable install.
"""
for path_item in sys.path:
egg_link = os.path.join(path_item, dist.project_name + '.egg-link')
if os.path.isfile(egg_link):
return True
return ... | [
"def",
"dist_is_editable",
"(",
"dist",
")",
":",
"# type: (Distribution) -> bool",
"for",
"path_item",
"in",
"sys",
".",
"path",
":",
"egg_link",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path_item",
",",
"dist",
".",
"project_name",
"+",
"'.egg-link'",
")... | [
402,
0
] | [
411,
16
] | python | en | ['en', 'error', 'th'] | False |
get_installed_distributions | (
local_only=True, # type: bool
skip=stdlib_pkgs, # type: Container[str]
include_editables=True, # type: bool
editables_only=False, # type: bool
user_only=False, # type: bool
paths=None # type: Optional[List[str]]
) |
Return a list of installed Distribution objects.
If ``local_only`` is True (default), only return installations
local to the current virtualenv, if in a virtualenv.
``skip`` argument is an iterable of lower-case project names to
ignore; defaults to stdlib_pkgs
If ``include_editables`` is Fal... |
Return a list of installed Distribution objects. | def get_installed_distributions(
local_only=True, # type: bool
skip=stdlib_pkgs, # type: Container[str]
include_editables=True, # type: bool
editables_only=False, # type: bool
user_only=False, # type: bool
paths=None # type: Optional[List[str]]
):
# type: (...) ... | [
"def",
"get_installed_distributions",
"(",
"local_only",
"=",
"True",
",",
"# type: bool",
"skip",
"=",
"stdlib_pkgs",
",",
"# type: Container[str]",
"include_editables",
"=",
"True",
",",
"# type: bool",
"editables_only",
"=",
"False",
",",
"# type: bool",
"user_only",... | [
414,
0
] | [
479,
13
] | python | en | ['en', 'error', 'th'] | False |
egg_link_path | (dist) |
Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site_packages
3) in a yes-global virtualenv
try to find in site_packa... |
Return the path for the .egg-link file if it exists, otherwise, None. | def egg_link_path(dist):
# type: (Distribution) -> Optional[str]
"""
Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site... | [
"def",
"egg_link_path",
"(",
"dist",
")",
":",
"# type: (Distribution) -> Optional[str]",
"sites",
"=",
"[",
"]",
"if",
"running_under_virtualenv",
"(",
")",
":",
"sites",
".",
"append",
"(",
"site_packages",
")",
"if",
"not",
"virtualenv_no_global",
"(",
")",
"... | [
482,
0
] | [
515,
15
] | python | en | ['en', 'error', 'th'] | False |
dist_location | (dist) |
Get the site-packages location of this distribution. Generally
this is dist.location, except in the case of develop-installed
packages, where dist.location is the source code location, and we
want to know where the egg-link file is.
The returned location is normalized (in particular, with symlinks... |
Get the site-packages location of this distribution. Generally
this is dist.location, except in the case of develop-installed
packages, where dist.location is the source code location, and we
want to know where the egg-link file is. | def dist_location(dist):
# type: (Distribution) -> str
"""
Get the site-packages location of this distribution. Generally
this is dist.location, except in the case of develop-installed
packages, where dist.location is the source code location, and we
want to know where the egg-link file is.
... | [
"def",
"dist_location",
"(",
"dist",
")",
":",
"# type: (Distribution) -> str",
"egg_link",
"=",
"egg_link_path",
"(",
"dist",
")",
"if",
"egg_link",
":",
"return",
"normalize_path",
"(",
"egg_link",
")",
"return",
"normalize_path",
"(",
"dist",
".",
"location",
... | [
518,
0
] | [
531,
40
] | python | en | ['en', 'error', 'th'] | False |
captured_output | (stream_name) | Return a context manager used by captured_stdout/stdin/stderr
that temporarily replaces the sys stream *stream_name* with a StringIO.
Taken from Lib/support/__init__.py in the CPython repo.
| Return a context manager used by captured_stdout/stdin/stderr
that temporarily replaces the sys stream *stream_name* with a StringIO. | def captured_output(stream_name):
"""Return a context manager used by captured_stdout/stdin/stderr
that temporarily replaces the sys stream *stream_name* with a StringIO.
Taken from Lib/support/__init__.py in the CPython repo.
"""
orig_stdout = getattr(sys, stream_name)
setattr(sys, stream_name... | [
"def",
"captured_output",
"(",
"stream_name",
")",
":",
"orig_stdout",
"=",
"getattr",
"(",
"sys",
",",
"stream_name",
")",
"setattr",
"(",
"sys",
",",
"stream_name",
",",
"StreamWrapper",
".",
"from_stream",
"(",
"orig_stdout",
")",
")",
"try",
":",
"yield"... | [
572,
0
] | [
583,
46
] | python | en | ['en', 'en', 'en'] | True |
captured_stdout | () | Capture the output of sys.stdout:
with captured_stdout() as stdout:
print('hello')
self.assertEqual(stdout.getvalue(), 'hello\n')
Taken from Lib/support/__init__.py in the CPython repo.
| Capture the output of sys.stdout: | def captured_stdout():
"""Capture the output of sys.stdout:
with captured_stdout() as stdout:
print('hello')
self.assertEqual(stdout.getvalue(), 'hello\n')
Taken from Lib/support/__init__.py in the CPython repo.
"""
return captured_output('stdout') | [
"def",
"captured_stdout",
"(",
")",
":",
"return",
"captured_output",
"(",
"'stdout'",
")"
] | [
586,
0
] | [
595,
36
] | python | en | ['en', 'en', 'en'] | True |
captured_stderr | () |
See captured_stdout().
|
See captured_stdout().
| def captured_stderr():
"""
See captured_stdout().
"""
return captured_output('stderr') | [
"def",
"captured_stderr",
"(",
")",
":",
"return",
"captured_output",
"(",
"'stderr'",
")"
] | [
598,
0
] | [
602,
36
] | python | en | ['en', 'error', 'th'] | False |
get_installed_version | (dist_name, working_set=None) | Get the installed version of dist_name avoiding pkg_resources cache | Get the installed version of dist_name avoiding pkg_resources cache | def get_installed_version(dist_name, working_set=None):
"""Get the installed version of dist_name avoiding pkg_resources cache"""
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_name)
if working_set is None:
# We want to avoid having t... | [
"def",
"get_installed_version",
"(",
"dist_name",
",",
"working_set",
"=",
"None",
")",
":",
"# Create a requirement that we'll look for inside of setuptools.",
"req",
"=",
"pkg_resources",
".",
"Requirement",
".",
"parse",
"(",
"dist_name",
")",
"if",
"working_set",
"i... | [
625,
0
] | [
640,
41
] | python | en | ['en', 'en', 'en'] | True |
consume | (iterator) | Consume an iterable at C speed. | Consume an iterable at C speed. | def consume(iterator):
"""Consume an iterable at C speed."""
deque(iterator, maxlen=0) | [
"def",
"consume",
"(",
"iterator",
")",
":",
"deque",
"(",
"iterator",
",",
"maxlen",
"=",
"0",
")"
] | [
643,
0
] | [
645,
29
] | python | en | ['en', 'en', 'en'] | True |
build_netloc | (host, port) |
Build a netloc from a host-port pair
|
Build a netloc from a host-port pair
| def build_netloc(host, port):
# type: (str, Optional[int]) -> str
"""
Build a netloc from a host-port pair
"""
if port is None:
return host
if ':' in host:
# Only wrap host with square brackets when it is IPv6
host = '[{}]'.format(host)
return '{}:{}'.format(host, por... | [
"def",
"build_netloc",
"(",
"host",
",",
"port",
")",
":",
"# type: (str, Optional[int]) -> str",
"if",
"port",
"is",
"None",
":",
"return",
"host",
"if",
"':'",
"in",
"host",
":",
"# Only wrap host with square brackets when it is IPv6",
"host",
"=",
"'[{}]'",
".",
... | [
656,
0
] | [
666,
37
] | python | en | ['en', 'error', 'th'] | False |
build_url_from_netloc | (netloc, scheme='https') |
Build a full URL from a netloc.
|
Build a full URL from a netloc.
| def build_url_from_netloc(netloc, scheme='https'):
# type: (str, str) -> str
"""
Build a full URL from a netloc.
"""
if netloc.count(':') >= 2 and '@' not in netloc and '[' not in netloc:
# It must be a bare IPv6 address, so wrap it with brackets.
netloc = '[{}]'.format(netloc)
r... | [
"def",
"build_url_from_netloc",
"(",
"netloc",
",",
"scheme",
"=",
"'https'",
")",
":",
"# type: (str, str) -> str",
"if",
"netloc",
".",
"count",
"(",
"':'",
")",
">=",
"2",
"and",
"'@'",
"not",
"in",
"netloc",
"and",
"'['",
"not",
"in",
"netloc",
":",
... | [
669,
0
] | [
677,
43
] | python | en | ['en', 'error', 'th'] | False |
parse_netloc | (netloc) |
Return the host-port pair from a netloc.
|
Return the host-port pair from a netloc.
| def parse_netloc(netloc):
# type: (str) -> Tuple[str, Optional[int]]
"""
Return the host-port pair from a netloc.
"""
url = build_url_from_netloc(netloc)
parsed = urllib_parse.urlparse(url)
return parsed.hostname, parsed.port | [
"def",
"parse_netloc",
"(",
"netloc",
")",
":",
"# type: (str) -> Tuple[str, Optional[int]]",
"url",
"=",
"build_url_from_netloc",
"(",
"netloc",
")",
"parsed",
"=",
"urllib_parse",
".",
"urlparse",
"(",
"url",
")",
"return",
"parsed",
".",
"hostname",
",",
"parse... | [
680,
0
] | [
687,
39
] | python | en | ['en', 'error', 'th'] | False |
split_auth_from_netloc | (netloc) |
Parse out and remove the auth information from a netloc.
Returns: (netloc, (username, password)).
|
Parse out and remove the auth information from a netloc. | def split_auth_from_netloc(netloc):
"""
Parse out and remove the auth information from a netloc.
Returns: (netloc, (username, password)).
"""
if '@' not in netloc:
return netloc, (None, None)
# Split from the right because that's how urllib.parse.urlsplit()
# behaves if more than o... | [
"def",
"split_auth_from_netloc",
"(",
"netloc",
")",
":",
"if",
"'@'",
"not",
"in",
"netloc",
":",
"return",
"netloc",
",",
"(",
"None",
",",
"None",
")",
"# Split from the right because that's how urllib.parse.urlsplit()",
"# behaves if more than one @ is present (which ca... | [
690,
0
] | [
715,
28
] | python | en | ['en', 'error', 'th'] | False |
redact_netloc | (netloc) |
Replace the sensitive data in a netloc with "****", if it exists.
For example:
- "user:pass@example.com" returns "user:****@example.com"
- "accesstoken@example.com" returns "****@example.com"
|
Replace the sensitive data in a netloc with "****", if it exists. | def redact_netloc(netloc):
# type: (str) -> str
"""
Replace the sensitive data in a netloc with "****", if it exists.
For example:
- "user:pass@example.com" returns "user:****@example.com"
- "accesstoken@example.com" returns "****@example.com"
"""
netloc, (user, password) = spli... | [
"def",
"redact_netloc",
"(",
"netloc",
")",
":",
"# type: (str) -> str",
"netloc",
",",
"(",
"user",
",",
"password",
")",
"=",
"split_auth_from_netloc",
"(",
"netloc",
")",
"if",
"user",
"is",
"None",
":",
"return",
"netloc",
"if",
"password",
"is",
"None",... | [
718,
0
] | [
738,
60
] | python | en | ['en', 'error', 'th'] | False |
_transform_url | (url, transform_netloc) | Transform and replace netloc in a url.
transform_netloc is a function taking the netloc and returning a
tuple. The first element of this tuple is the new netloc. The
entire tuple is returned.
Returns a tuple containing the transformed url as item 0 and the
original tuple returned by transform_netl... | Transform and replace netloc in a url. | def _transform_url(url, transform_netloc):
"""Transform and replace netloc in a url.
transform_netloc is a function taking the netloc and returning a
tuple. The first element of this tuple is the new netloc. The
entire tuple is returned.
Returns a tuple containing the transformed url as item 0 and... | [
"def",
"_transform_url",
"(",
"url",
",",
"transform_netloc",
")",
":",
"purl",
"=",
"urllib_parse",
".",
"urlsplit",
"(",
"url",
")",
"netloc_tuple",
"=",
"transform_netloc",
"(",
"purl",
".",
"netloc",
")",
"# stripped url",
"url_pieces",
"=",
"(",
"purl",
... | [
741,
0
] | [
758,
29
] | python | en | ['en', 'en', 'en'] | True |
split_auth_netloc_from_url | (url) |
Parse a url into separate netloc, auth, and url with no auth.
Returns: (url_without_auth, netloc, (username, password))
|
Parse a url into separate netloc, auth, and url with no auth. | def split_auth_netloc_from_url(url):
# type: (str) -> Tuple[str, str, Tuple[str, str]]
"""
Parse a url into separate netloc, auth, and url with no auth.
Returns: (url_without_auth, netloc, (username, password))
"""
url_without_auth, (netloc, auth) = _transform_url(url, _get_netloc)
return u... | [
"def",
"split_auth_netloc_from_url",
"(",
"url",
")",
":",
"# type: (str) -> Tuple[str, str, Tuple[str, str]]",
"url_without_auth",
",",
"(",
"netloc",
",",
"auth",
")",
"=",
"_transform_url",
"(",
"url",
",",
"_get_netloc",
")",
"return",
"url_without_auth",
",",
"ne... | [
769,
0
] | [
777,
41
] | python | en | ['en', 'error', 'th'] | False |
remove_auth_from_url | (url) | Return a copy of url with 'username:password@' removed. | Return a copy of url with 'username:password | def remove_auth_from_url(url):
# type: (str) -> str
"""Return a copy of url with 'username:password@' removed."""
# username/pass params are passed to subversion through flags
# and are not recognized in the url.
return _transform_url(url, _get_netloc)[0] | [
"def",
"remove_auth_from_url",
"(",
"url",
")",
":",
"# type: (str) -> str",
"# username/pass params are passed to subversion through flags",
"# and are not recognized in the url.",
"return",
"_transform_url",
"(",
"url",
",",
"_get_netloc",
")",
"[",
"0",
"]"
] | [
780,
0
] | [
785,
46
] | python | en | ['en', 'en', 'en'] | True |
redact_auth_from_url | (url) | Replace the password in a given url with ****. | Replace the password in a given url with ****. | def redact_auth_from_url(url):
# type: (str) -> str
"""Replace the password in a given url with ****."""
return _transform_url(url, _redact_netloc)[0] | [
"def",
"redact_auth_from_url",
"(",
"url",
")",
":",
"# type: (str) -> str",
"return",
"_transform_url",
"(",
"url",
",",
"_redact_netloc",
")",
"[",
"0",
"]"
] | [
788,
0
] | [
791,
49
] | python | en | ['en', 'en', 'en'] | True |
protect_pip_from_modification_on_windows | (modifying_pip) | Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ...
| Protection of pip.exe from modification on Windows | def protect_pip_from_modification_on_windows(modifying_pip):
# type: (bool) -> None
"""Protection of pip.exe from modification on Windows
On Windows, any operation modifying pip should be run as:
python -m pip ...
"""
pip_names = [
"pip.exe",
"pip{}.exe".format(sys.version_i... | [
"def",
"protect_pip_from_modification_on_windows",
"(",
"modifying_pip",
")",
":",
"# type: (bool) -> None",
"pip_names",
"=",
"[",
"\"pip.exe\"",
",",
"\"pip{}.exe\"",
".",
"format",
"(",
"sys",
".",
"version_info",
"[",
"0",
"]",
")",
",",
"\"pip{}.{}.exe\"",
".",... | [
840,
0
] | [
867,
9
] | python | en | ['en', 'en', 'en'] | True |
is_console_interactive | () | Is this console interactive?
| Is this console interactive?
| def is_console_interactive():
# type: () -> bool
"""Is this console interactive?
"""
return sys.stdin is not None and sys.stdin.isatty() | [
"def",
"is_console_interactive",
"(",
")",
":",
"# type: () -> bool",
"return",
"sys",
".",
"stdin",
"is",
"not",
"None",
"and",
"sys",
".",
"stdin",
".",
"isatty",
"(",
")"
] | [
870,
0
] | [
874,
55
] | python | en | ['en', 'en', 'en'] | True |
hash_file | (path, blocksize=1 << 20) | Return (hash, length) for path using hashlib.sha256()
| Return (hash, length) for path using hashlib.sha256()
| def hash_file(path, blocksize=1 << 20):
# type: (str, int) -> Tuple[Any, int]
"""Return (hash, length) for path using hashlib.sha256()
"""
h = hashlib.sha256()
length = 0
with open(path, 'rb') as f:
for block in read_chunks(f, size=blocksize):
length += len(block)
... | [
"def",
"hash_file",
"(",
"path",
",",
"blocksize",
"=",
"1",
"<<",
"20",
")",
":",
"# type: (str, int) -> Tuple[Any, int]",
"h",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"length",
"=",
"0",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",... | [
877,
0
] | [
888,
20
] | python | en | ['en', 'hi-Latn', 'en'] | True |
is_wheel_installed | () |
Return whether the wheel package is installed.
|
Return whether the wheel package is installed.
| def is_wheel_installed():
"""
Return whether the wheel package is installed.
"""
try:
import wheel # noqa: F401
except ImportError:
return False
return True | [
"def",
"is_wheel_installed",
"(",
")",
":",
"try",
":",
"import",
"wheel",
"# noqa: F401",
"except",
"ImportError",
":",
"return",
"False",
"return",
"True"
] | [
891,
0
] | [
900,
15
] | python | en | ['en', 'error', 'th'] | False |
pairwise | (iterable) |
Return paired elements.
For example:
s -> (s0, s1), (s2, s3), (s4, s5), ...
|
Return paired elements. | def pairwise(iterable):
# type: (Iterable[Any]) -> Iterator[Tuple[Any, Any]]
"""
Return paired elements.
For example:
s -> (s0, s1), (s2, s3), (s4, s5), ...
"""
iterable = iter(iterable)
return zip_longest(iterable, iterable) | [
"def",
"pairwise",
"(",
"iterable",
")",
":",
"# type: (Iterable[Any]) -> Iterator[Tuple[Any, Any]]",
"iterable",
"=",
"iter",
"(",
"iterable",
")",
"return",
"zip_longest",
"(",
"iterable",
",",
"iterable",
")"
] | [
903,
0
] | [
912,
42
] | python | en | ['en', 'error', 'th'] | False |
GetInternalWSGIApplicationTest.test_success | (self) |
If ``WSGI_APPLICATION`` is a dotted path, the referenced object is
returned.
|
If ``WSGI_APPLICATION`` is a dotted path, the referenced object is
returned. | def test_success(self):
"""
If ``WSGI_APPLICATION`` is a dotted path, the referenced object is
returned.
"""
app = get_internal_wsgi_application()
from .wsgi import application
self.assertTrue(app is application) | [
"def",
"test_success",
"(",
"self",
")",
":",
"app",
"=",
"get_internal_wsgi_application",
"(",
")",
"from",
".",
"wsgi",
"import",
"application",
"self",
".",
"assertTrue",
"(",
"app",
"is",
"application",
")"
] | [
56,
4
] | [
66,
43
] | python | en | ['en', 'error', 'th'] | False |
GetInternalWSGIApplicationTest.test_default | (self) |
If ``WSGI_APPLICATION`` is ``None``, the return value of
``get_wsgi_application`` is returned.
|
If ``WSGI_APPLICATION`` is ``None``, the return value of
``get_wsgi_application`` is returned. | def test_default(self):
"""
If ``WSGI_APPLICATION`` is ``None``, the return value of
``get_wsgi_application`` is returned.
"""
# Mock out get_wsgi_application so we know its return value is used
fake_app = object()
def mock_get_wsgi_app():
return fak... | [
"def",
"test_default",
"(",
"self",
")",
":",
"# Mock out get_wsgi_application so we know its return value is used",
"fake_app",
"=",
"object",
"(",
")",
"def",
"mock_get_wsgi_app",
"(",
")",
":",
"return",
"fake_app",
"from",
"django",
".",
"core",
".",
"servers",
... | [
69,
4
] | [
89,
62
] | python | en | ['en', 'error', 'th'] | False |
create_tf_addition_model | () |
A simple addition model
|
A simple addition model
| def create_tf_addition_model():
"""
A simple addition model
"""
g = tf.Graph()
with g.as_default():
with tf.name_scope("some_namespace"):
x = tf.placeholder(tf.float32, name="in_x")
y = tf.placeholder(tf.float32, name="in_y")
# Assigned to a variable for ... | [
"def",
"create_tf_addition_model",
"(",
")",
":",
"g",
"=",
"tf",
".",
"Graph",
"(",
")",
"with",
"g",
".",
"as_default",
"(",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"some_namespace\"",
")",
":",
"x",
"=",
"tf",
".",
"placeholder",
"(",
"t... | [
26,
0
] | [
39,
27
] | python | en | ['en', 'error', 'th'] | False |
create_tf_accumulator_model | () |
Accumulate input x into a variable. Return the accumulated value.
|
Accumulate input x into a variable. Return the accumulated value.
| def create_tf_accumulator_model():
"""
Accumulate input x into a variable. Return the accumulated value.
"""
g = tf.Graph()
with g.as_default():
with tf.name_scope("some_namespace"):
acc = tf.get_variable(
"accumulator",
initializer=tf.zeros_initia... | [
"def",
"create_tf_accumulator_model",
"(",
")",
":",
"g",
"=",
"tf",
".",
"Graph",
"(",
")",
"with",
"g",
".",
"as_default",
"(",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"\"some_namespace\"",
")",
":",
"acc",
"=",
"tf",
".",
"get_variable",
"("... | [
42,
0
] | [
62,
41
] | python | en | ['en', 'error', 'th'] | False |
GenericParser._get_image | (self) |
Finding a first image after the h1 header.
Presumably it will be the main image.
|
Finding a first image after the h1 header.
Presumably it will be the main image.
| def _get_image(self) -> Optional[str]:
"""
Finding a first image after the h1 header.
Presumably it will be the main image.
"""
soup = self._soup
first_h1 = soup.find("h1")
if first_h1:
first_image = first_h1.find_next_sibling("img", src=True)
... | [
"def",
"_get_image",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"soup",
"=",
"self",
".",
"_soup",
"first_h1",
"=",
"soup",
".",
"find",
"(",
"\"h1\"",
")",
"if",
"first_h1",
":",
"first_image",
"=",
"first_h1",
".",
"find_next_sibling",
... | [
36,
4
] | [
47,
19
] | python | en | ['en', 'error', 'th'] | False |
NotificationTemplate.render | (self, context, language_code=DEFAULT_LANG) |
Render this notification template with given context and language
Returns a dict containing all content fields of the template. Example:
{'short_message': 'foo', 'subject': 'bar', 'body': 'baz', 'html_body': '<b>foobar</b>'}
|
Render this notification template with given context and language | def render(self, context, language_code=DEFAULT_LANG):
"""
Render this notification template with given context and language
Returns a dict containing all content fields of the template. Example:
{'short_message': 'foo', 'subject': 'bar', 'body': 'baz', 'html_body': '<b>foobar</b>'}
... | [
"def",
"render",
"(",
"self",
",",
"context",
",",
"language_code",
"=",
"DEFAULT_LANG",
")",
":",
"env",
"=",
"SandboxedEnvironment",
"(",
"trim_blocks",
"=",
"True",
",",
"lstrip_blocks",
"=",
"True",
",",
"undefined",
"=",
"StrictUndefined",
")",
"env",
"... | [
93,
4
] | [
122,
61
] | python | en | ['en', 'error', 'th'] | False |
is_iterable | (x) | A implementation independent way of checking for iterables | A implementation independent way of checking for iterables | def is_iterable(x):
"A implementation independent way of checking for iterables"
try:
iter(x)
except TypeError:
return False
else:
return True | [
"def",
"is_iterable",
"(",
"x",
")",
":",
"try",
":",
"iter",
"(",
"x",
")",
"except",
"TypeError",
":",
"return",
"False",
"else",
":",
"return",
"True"
] | [
7,
0
] | [
14,
19
] | python | en | ['en', 'en', 'en'] | True |
skipIfCustomUser | (test_func) |
Skip a test if a custom user model is in use.
|
Skip a test if a custom user model is in use.
| def skipIfCustomUser(test_func):
"""
Skip a test if a custom user model is in use.
"""
return skipIf(settings.AUTH_USER_MODEL != 'auth.User', 'Custom user model in use')(test_func) | [
"def",
"skipIfCustomUser",
"(",
"test_func",
")",
":",
"return",
"skipIf",
"(",
"settings",
".",
"AUTH_USER_MODEL",
"!=",
"'auth.User'",
",",
"'Custom user model in use'",
")",
"(",
"test_func",
")"
] | [
5,
0
] | [
9,
97
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase._post_init | (self) | Perform post-initialization setup. | Perform post-initialization setup. | def _post_init(self):
"Perform post-initialization setup."
# Setting the coordinate sequence for the geometry (will be None on
# geometries that do not have coordinate sequences)
self._cs = GEOSCoordSeq(capi.get_cs(self.ptr), self.hasz) if self.has_cs else None | [
"def",
"_post_init",
"(",
"self",
")",
":",
"# Setting the coordinate sequence for the geometry (will be None on",
"# geometries that do not have coordinate sequences)",
"self",
".",
"_cs",
"=",
"GEOSCoordSeq",
"(",
"capi",
".",
"get_cs",
"(",
"self",
".",
"ptr",
")",
","... | [
59,
4
] | [
63,
90
] | python | en | ['en', 'bg', 'en'] | True |
GEOSGeometryBase.__copy__ | (self) |
Return a clone because the copy of a GEOSGeometry may contain an
invalid pointer location if the original is garbage collected.
|
Return a clone because the copy of a GEOSGeometry may contain an
invalid pointer location if the original is garbage collected.
| def __copy__(self):
"""
Return a clone because the copy of a GEOSGeometry may contain an
invalid pointer location if the original is garbage collected.
"""
return self.clone() | [
"def",
"__copy__",
"(",
"self",
")",
":",
"return",
"self",
".",
"clone",
"(",
")"
] | [
65,
4
] | [
70,
27
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.__deepcopy__ | (self, memodict) |
The `deepcopy` routine is used by the `Node` class of django.utils.tree;
thus, the protocol routine needs to be implemented to return correct
copies (clones) of these GEOS objects, which use C pointers.
|
The `deepcopy` routine is used by the `Node` class of django.utils.tree;
thus, the protocol routine needs to be implemented to return correct
copies (clones) of these GEOS objects, which use C pointers.
| def __deepcopy__(self, memodict):
"""
The `deepcopy` routine is used by the `Node` class of django.utils.tree;
thus, the protocol routine needs to be implemented to return correct
copies (clones) of these GEOS objects, which use C pointers.
"""
return self.clone() | [
"def",
"__deepcopy__",
"(",
"self",
",",
"memodict",
")",
":",
"return",
"self",
".",
"clone",
"(",
")"
] | [
72,
4
] | [
78,
27
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.__str__ | (self) | EWKT is used for the string representation. | EWKT is used for the string representation. | def __str__(self):
"EWKT is used for the string representation."
return self.ewkt | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"ewkt"
] | [
80,
4
] | [
82,
24
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.__repr__ | (self) | Short-hand representation because WKT may be very large. | Short-hand representation because WKT may be very large. | def __repr__(self):
"Short-hand representation because WKT may be very large."
return '<%s object at %s>' % (self.geom_type, hex(addressof(self.ptr))) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<%s object at %s>'",
"%",
"(",
"self",
".",
"geom_type",
",",
"hex",
"(",
"addressof",
"(",
"self",
".",
"ptr",
")",
")",
")"
] | [
84,
4
] | [
86,
79
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.__eq__ | (self, other) |
Equivalence testing, a Geometry may be compared with another Geometry
or an EWKT representation.
|
Equivalence testing, a Geometry may be compared with another Geometry
or an EWKT representation.
| def __eq__(self, other):
"""
Equivalence testing, a Geometry may be compared with another Geometry
or an EWKT representation.
"""
if isinstance(other, str):
try:
other = GEOSGeometry.from_ewkt(other)
except (ValueError, GEOSException):
... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"str",
")",
":",
"try",
":",
"other",
"=",
"GEOSGeometry",
".",
"from_ewkt",
"(",
"other",
")",
"except",
"(",
"ValueError",
",",
"GEOSException",
")",
":",
... | [
140,
4
] | [
150,
103
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.__or__ | (self, other) | Return the union of this Geometry and the other. | Return the union of this Geometry and the other. | def __or__(self, other):
"Return the union of this Geometry and the other."
return self.union(other) | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"union",
"(",
"other",
")"
] | [
159,
4
] | [
161,
32
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.__and__ | (self, other) | Return the intersection of this Geometry and the other. | Return the intersection of this Geometry and the other. | def __and__(self, other):
"Return the intersection of this Geometry and the other."
return self.intersection(other) | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"intersection",
"(",
"other",
")"
] | [
164,
4
] | [
166,
39
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.__sub__ | (self, other) | Return the difference this Geometry and the other. | Return the difference this Geometry and the other. | def __sub__(self, other):
"Return the difference this Geometry and the other."
return self.difference(other) | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"difference",
"(",
"other",
")"
] | [
169,
4
] | [
171,
37
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.__xor__ | (self, other) | Return the symmetric difference of this Geometry and the other. | Return the symmetric difference of this Geometry and the other. | def __xor__(self, other):
"Return the symmetric difference of this Geometry and the other."
return self.sym_difference(other) | [
"def",
"__xor__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"sym_difference",
"(",
"other",
")"
] | [
174,
4
] | [
176,
41
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.coord_seq | (self) | Return a clone of the coordinate sequence for this Geometry. | Return a clone of the coordinate sequence for this Geometry. | def coord_seq(self):
"Return a clone of the coordinate sequence for this Geometry."
if self.has_cs:
return self._cs.clone() | [
"def",
"coord_seq",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_cs",
":",
"return",
"self",
".",
"_cs",
".",
"clone",
"(",
")"
] | [
180,
4
] | [
183,
35
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.geom_type | (self) | Return a string representing the Geometry type, e.g. 'Polygon | Return a string representing the Geometry type, e.g. 'Polygon | def geom_type(self):
"Return a string representing the Geometry type, e.g. 'Polygon'"
return capi.geos_type(self.ptr).decode() | [
"def",
"geom_type",
"(",
"self",
")",
":",
"return",
"capi",
".",
"geos_type",
"(",
"self",
".",
"ptr",
")",
".",
"decode",
"(",
")"
] | [
187,
4
] | [
189,
48
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.geom_typeid | (self) | Return an integer representing the Geometry type. | Return an integer representing the Geometry type. | def geom_typeid(self):
"Return an integer representing the Geometry type."
return capi.geos_typeid(self.ptr) | [
"def",
"geom_typeid",
"(",
"self",
")",
":",
"return",
"capi",
".",
"geos_typeid",
"(",
"self",
".",
"ptr",
")"
] | [
192,
4
] | [
194,
41
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.num_geom | (self) | Return the number of geometries in the Geometry. | Return the number of geometries in the Geometry. | def num_geom(self):
"Return the number of geometries in the Geometry."
return capi.get_num_geoms(self.ptr) | [
"def",
"num_geom",
"(",
"self",
")",
":",
"return",
"capi",
".",
"get_num_geoms",
"(",
"self",
".",
"ptr",
")"
] | [
197,
4
] | [
199,
43
] | python | en | ['en', 'af', 'en'] | True |
GEOSGeometryBase.num_coords | (self) | Return the number of coordinates in the Geometry. | Return the number of coordinates in the Geometry. | def num_coords(self):
"Return the number of coordinates in the Geometry."
return capi.get_num_coords(self.ptr) | [
"def",
"num_coords",
"(",
"self",
")",
":",
"return",
"capi",
".",
"get_num_coords",
"(",
"self",
".",
"ptr",
")"
] | [
202,
4
] | [
204,
44
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.num_points | (self) | Return the number points, or coordinates, in the Geometry. | Return the number points, or coordinates, in the Geometry. | def num_points(self):
"Return the number points, or coordinates, in the Geometry."
return self.num_coords | [
"def",
"num_points",
"(",
"self",
")",
":",
"return",
"self",
".",
"num_coords"
] | [
207,
4
] | [
209,
30
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.dims | (self) | Return the dimension of this Geometry (0=point, 1=line, 2=surface). | Return the dimension of this Geometry (0=point, 1=line, 2=surface). | def dims(self):
"Return the dimension of this Geometry (0=point, 1=line, 2=surface)."
return capi.get_dims(self.ptr) | [
"def",
"dims",
"(",
"self",
")",
":",
"return",
"capi",
".",
"get_dims",
"(",
"self",
".",
"ptr",
")"
] | [
212,
4
] | [
214,
38
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.normalize | (self) | Convert this Geometry to normal form (or canonical form). | Convert this Geometry to normal form (or canonical form). | def normalize(self):
"Convert this Geometry to normal form (or canonical form)."
capi.geos_normalize(self.ptr) | [
"def",
"normalize",
"(",
"self",
")",
":",
"capi",
".",
"geos_normalize",
"(",
"self",
".",
"ptr",
")"
] | [
216,
4
] | [
218,
37
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.empty | (self) |
Return a boolean indicating whether the set of points in this Geometry
are empty.
|
Return a boolean indicating whether the set of points in this Geometry
are empty.
| def empty(self):
"""
Return a boolean indicating whether the set of points in this Geometry
are empty.
"""
return capi.geos_isempty(self.ptr) | [
"def",
"empty",
"(",
"self",
")",
":",
"return",
"capi",
".",
"geos_isempty",
"(",
"self",
".",
"ptr",
")"
] | [
222,
4
] | [
227,
42
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.hasz | (self) | Return whether the geometry has a 3D dimension. | Return whether the geometry has a 3D dimension. | def hasz(self):
"Return whether the geometry has a 3D dimension."
return capi.geos_hasz(self.ptr) | [
"def",
"hasz",
"(",
"self",
")",
":",
"return",
"capi",
".",
"geos_hasz",
"(",
"self",
".",
"ptr",
")"
] | [
230,
4
] | [
232,
39
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.ring | (self) | Return whether or not the geometry is a ring. | Return whether or not the geometry is a ring. | def ring(self):
"Return whether or not the geometry is a ring."
return capi.geos_isring(self.ptr) | [
"def",
"ring",
"(",
"self",
")",
":",
"return",
"capi",
".",
"geos_isring",
"(",
"self",
".",
"ptr",
")"
] | [
235,
4
] | [
237,
41
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.simple | (self) | Return false if the Geometry isn't simple. | Return false if the Geometry isn't simple. | def simple(self):
"Return false if the Geometry isn't simple."
return capi.geos_issimple(self.ptr) | [
"def",
"simple",
"(",
"self",
")",
":",
"return",
"capi",
".",
"geos_issimple",
"(",
"self",
".",
"ptr",
")"
] | [
240,
4
] | [
242,
43
] | python | en | ['en', 'sq', 'en'] | True |
GEOSGeometryBase.valid | (self) | Test the validity of this Geometry. | Test the validity of this Geometry. | def valid(self):
"Test the validity of this Geometry."
return capi.geos_isvalid(self.ptr) | [
"def",
"valid",
"(",
"self",
")",
":",
"return",
"capi",
".",
"geos_isvalid",
"(",
"self",
".",
"ptr",
")"
] | [
245,
4
] | [
247,
42
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.valid_reason | (self) |
Return a string containing the reason for any invalidity.
|
Return a string containing the reason for any invalidity.
| def valid_reason(self):
"""
Return a string containing the reason for any invalidity.
"""
return capi.geos_isvalidreason(self.ptr).decode() | [
"def",
"valid_reason",
"(",
"self",
")",
":",
"return",
"capi",
".",
"geos_isvalidreason",
"(",
"self",
".",
"ptr",
")",
".",
"decode",
"(",
")"
] | [
250,
4
] | [
254,
57
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.contains | (self, other) | Return true if other.within(this) returns true. | Return true if other.within(this) returns true. | def contains(self, other):
"Return true if other.within(this) returns true."
return capi.geos_contains(self.ptr, other.ptr) | [
"def",
"contains",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_contains",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
257,
4
] | [
259,
54
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.covers | (self, other) |
Return True if the DE-9IM Intersection Matrix for the two geometries is
T*****FF*, *T****FF*, ***T**FF*, or ****T*FF*. If either geometry is
empty, return False.
|
Return True if the DE-9IM Intersection Matrix for the two geometries is
T*****FF*, *T****FF*, ***T**FF*, or ****T*FF*. If either geometry is
empty, return False.
| def covers(self, other):
"""
Return True if the DE-9IM Intersection Matrix for the two geometries is
T*****FF*, *T****FF*, ***T**FF*, or ****T*FF*. If either geometry is
empty, return False.
"""
return capi.geos_covers(self.ptr, other.ptr) | [
"def",
"covers",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_covers",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
261,
4
] | [
267,
52
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.crosses | (self, other) |
Return true if the DE-9IM intersection matrix for the two Geometries
is T*T****** (for a point and a curve,a point and an area or a line and
an area) 0******** (for two curves).
|
Return true if the DE-9IM intersection matrix for the two Geometries
is T*T****** (for a point and a curve,a point and an area or a line and
an area) 0******** (for two curves).
| def crosses(self, other):
"""
Return true if the DE-9IM intersection matrix for the two Geometries
is T*T****** (for a point and a curve,a point and an area or a line and
an area) 0******** (for two curves).
"""
return capi.geos_crosses(self.ptr, other.ptr) | [
"def",
"crosses",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_crosses",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
269,
4
] | [
275,
53
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.disjoint | (self, other) |
Return true if the DE-9IM intersection matrix for the two Geometries
is FF*FF****.
|
Return true if the DE-9IM intersection matrix for the two Geometries
is FF*FF****.
| def disjoint(self, other):
"""
Return true if the DE-9IM intersection matrix for the two Geometries
is FF*FF****.
"""
return capi.geos_disjoint(self.ptr, other.ptr) | [
"def",
"disjoint",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_disjoint",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
277,
4
] | [
282,
54
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.equals | (self, other) |
Return true if the DE-9IM intersection matrix for the two Geometries
is T*F**FFF*.
|
Return true if the DE-9IM intersection matrix for the two Geometries
is T*F**FFF*.
| def equals(self, other):
"""
Return true if the DE-9IM intersection matrix for the two Geometries
is T*F**FFF*.
"""
return capi.geos_equals(self.ptr, other.ptr) | [
"def",
"equals",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_equals",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
284,
4
] | [
289,
52
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.equals_exact | (self, other, tolerance=0) |
Return true if the two Geometries are exactly equal, up to a
specified tolerance.
|
Return true if the two Geometries are exactly equal, up to a
specified tolerance.
| def equals_exact(self, other, tolerance=0):
"""
Return true if the two Geometries are exactly equal, up to a
specified tolerance.
"""
return capi.geos_equalsexact(self.ptr, other.ptr, float(tolerance)) | [
"def",
"equals_exact",
"(",
"self",
",",
"other",
",",
"tolerance",
"=",
"0",
")",
":",
"return",
"capi",
".",
"geos_equalsexact",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
",",
"float",
"(",
"tolerance",
")",
")"
] | [
291,
4
] | [
296,
75
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.intersects | (self, other) | Return true if disjoint return false. | Return true if disjoint return false. | def intersects(self, other):
"Return true if disjoint return false."
return capi.geos_intersects(self.ptr, other.ptr) | [
"def",
"intersects",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_intersects",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
298,
4
] | [
300,
56
] | python | en | ['nb', 'no', 'en'] | False |
GEOSGeometryBase.overlaps | (self, other) |
Return true if the DE-9IM intersection matrix for the two Geometries
is T*T***T** (for two points or two surfaces) 1*T***T** (for two curves).
|
Return true if the DE-9IM intersection matrix for the two Geometries
is T*T***T** (for two points or two surfaces) 1*T***T** (for two curves).
| def overlaps(self, other):
"""
Return true if the DE-9IM intersection matrix for the two Geometries
is T*T***T** (for two points or two surfaces) 1*T***T** (for two curves).
"""
return capi.geos_overlaps(self.ptr, other.ptr) | [
"def",
"overlaps",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_overlaps",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
302,
4
] | [
307,
54
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.relate_pattern | (self, other, pattern) |
Return true if the elements in the DE-9IM intersection matrix for the
two Geometries match the elements in pattern.
|
Return true if the elements in the DE-9IM intersection matrix for the
two Geometries match the elements in pattern.
| def relate_pattern(self, other, pattern):
"""
Return true if the elements in the DE-9IM intersection matrix for the
two Geometries match the elements in pattern.
"""
if not isinstance(pattern, str) or len(pattern) > 9:
raise GEOSException('invalid intersection matrix ... | [
"def",
"relate_pattern",
"(",
"self",
",",
"other",
",",
"pattern",
")",
":",
"if",
"not",
"isinstance",
"(",
"pattern",
",",
"str",
")",
"or",
"len",
"(",
"pattern",
")",
">",
"9",
":",
"raise",
"GEOSException",
"(",
"'invalid intersection matrix pattern'",... | [
309,
4
] | [
316,
81
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.touches | (self, other) |
Return true if the DE-9IM intersection matrix for the two Geometries
is FT*******, F**T***** or F***T****.
|
Return true if the DE-9IM intersection matrix for the two Geometries
is FT*******, F**T***** or F***T****.
| def touches(self, other):
"""
Return true if the DE-9IM intersection matrix for the two Geometries
is FT*******, F**T***** or F***T****.
"""
return capi.geos_touches(self.ptr, other.ptr) | [
"def",
"touches",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_touches",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
318,
4
] | [
323,
53
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.within | (self, other) |
Return true if the DE-9IM intersection matrix for the two Geometries
is T*F**F***.
|
Return true if the DE-9IM intersection matrix for the two Geometries
is T*F**F***.
| def within(self, other):
"""
Return true if the DE-9IM intersection matrix for the two Geometries
is T*F**F***.
"""
return capi.geos_within(self.ptr, other.ptr) | [
"def",
"within",
"(",
"self",
",",
"other",
")",
":",
"return",
"capi",
".",
"geos_within",
"(",
"self",
".",
"ptr",
",",
"other",
".",
"ptr",
")"
] | [
325,
4
] | [
330,
52
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.srid | (self) | Get the SRID for the geometry. Return None if no SRID is set. | Get the SRID for the geometry. Return None if no SRID is set. | def srid(self):
"Get the SRID for the geometry. Return None if no SRID is set."
s = capi.geos_get_srid(self.ptr)
if s == 0:
return None
else:
return s | [
"def",
"srid",
"(",
"self",
")",
":",
"s",
"=",
"capi",
".",
"geos_get_srid",
"(",
"self",
".",
"ptr",
")",
"if",
"s",
"==",
"0",
":",
"return",
"None",
"else",
":",
"return",
"s"
] | [
334,
4
] | [
340,
20
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.srid | (self, srid) | Set the SRID for the geometry. | Set the SRID for the geometry. | def srid(self, srid):
"Set the SRID for the geometry."
capi.geos_set_srid(self.ptr, 0 if srid is None else srid) | [
"def",
"srid",
"(",
"self",
",",
"srid",
")",
":",
"capi",
".",
"geos_set_srid",
"(",
"self",
".",
"ptr",
",",
"0",
"if",
"srid",
"is",
"None",
"else",
"srid",
")"
] | [
343,
4
] | [
345,
65
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.ewkt | (self) |
Return the EWKT (SRID + WKT) of the Geometry.
|
Return the EWKT (SRID + WKT) of the Geometry.
| def ewkt(self):
"""
Return the EWKT (SRID + WKT) of the Geometry.
"""
srid = self.srid
return 'SRID=%s;%s' % (srid, self.wkt) if srid else self.wkt | [
"def",
"ewkt",
"(",
"self",
")",
":",
"srid",
"=",
"self",
".",
"srid",
"return",
"'SRID=%s;%s'",
"%",
"(",
"srid",
",",
"self",
".",
"wkt",
")",
"if",
"srid",
"else",
"self",
".",
"wkt"
] | [
349,
4
] | [
354,
68
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.wkt | (self) | Return the WKT (Well-Known Text) representation of this Geometry. | Return the WKT (Well-Known Text) representation of this Geometry. | def wkt(self):
"Return the WKT (Well-Known Text) representation of this Geometry."
return wkt_w(dim=3 if self.hasz else 2, trim=True).write(self).decode() | [
"def",
"wkt",
"(",
"self",
")",
":",
"return",
"wkt_w",
"(",
"dim",
"=",
"3",
"if",
"self",
".",
"hasz",
"else",
"2",
",",
"trim",
"=",
"True",
")",
".",
"write",
"(",
"self",
")",
".",
"decode",
"(",
")"
] | [
357,
4
] | [
359,
79
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.hex | (self) |
Return the WKB of this Geometry in hexadecimal form. Please note
that the SRID is not included in this representation because it is not
a part of the OGC specification (use the `hexewkb` property instead).
|
Return the WKB of this Geometry in hexadecimal form. Please note
that the SRID is not included in this representation because it is not
a part of the OGC specification (use the `hexewkb` property instead).
| def hex(self):
"""
Return the WKB of this Geometry in hexadecimal form. Please note
that the SRID is not included in this representation because it is not
a part of the OGC specification (use the `hexewkb` property instead).
"""
# A possible faster, all-python, implementa... | [
"def",
"hex",
"(",
"self",
")",
":",
"# A possible faster, all-python, implementation:",
"# str(self.wkb).encode('hex')",
"return",
"wkb_w",
"(",
"dim",
"=",
"3",
"if",
"self",
".",
"hasz",
"else",
"2",
")",
".",
"write_hex",
"(",
"self",
")"
] | [
362,
4
] | [
370,
63
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.hexewkb | (self) |
Return the EWKB of this Geometry in hexadecimal form. This is an
extension of the WKB specification that includes SRID value that are
a part of this geometry.
|
Return the EWKB of this Geometry in hexadecimal form. This is an
extension of the WKB specification that includes SRID value that are
a part of this geometry.
| def hexewkb(self):
"""
Return the EWKB of this Geometry in hexadecimal form. This is an
extension of the WKB specification that includes SRID value that are
a part of this geometry.
"""
return ewkb_w(dim=3 if self.hasz else 2).write_hex(self) | [
"def",
"hexewkb",
"(",
"self",
")",
":",
"return",
"ewkb_w",
"(",
"dim",
"=",
"3",
"if",
"self",
".",
"hasz",
"else",
"2",
")",
".",
"write_hex",
"(",
"self",
")"
] | [
373,
4
] | [
379,
64
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.json | (self) |
Return GeoJSON representation of this Geometry.
|
Return GeoJSON representation of this Geometry.
| def json(self):
"""
Return GeoJSON representation of this Geometry.
"""
return self.ogr.json | [
"def",
"json",
"(",
"self",
")",
":",
"return",
"self",
".",
"ogr",
".",
"json"
] | [
382,
4
] | [
386,
28
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.wkb | (self) |
Return the WKB (Well-Known Binary) representation of this Geometry
as a Python buffer. SRID and Z values are not included, use the
`ewkb` property instead.
|
Return the WKB (Well-Known Binary) representation of this Geometry
as a Python buffer. SRID and Z values are not included, use the
`ewkb` property instead.
| def wkb(self):
"""
Return the WKB (Well-Known Binary) representation of this Geometry
as a Python buffer. SRID and Z values are not included, use the
`ewkb` property instead.
"""
return wkb_w(3 if self.hasz else 2).write(self) | [
"def",
"wkb",
"(",
"self",
")",
":",
"return",
"wkb_w",
"(",
"3",
"if",
"self",
".",
"hasz",
"else",
"2",
")",
".",
"write",
"(",
"self",
")"
] | [
390,
4
] | [
396,
55
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.ewkb | (self) |
Return the EWKB representation of this Geometry as a Python buffer.
This is an extension of the WKB specification that includes any SRID
value that are a part of this geometry.
|
Return the EWKB representation of this Geometry as a Python buffer.
This is an extension of the WKB specification that includes any SRID
value that are a part of this geometry.
| def ewkb(self):
"""
Return the EWKB representation of this Geometry as a Python buffer.
This is an extension of the WKB specification that includes any SRID
value that are a part of this geometry.
"""
return ewkb_w(3 if self.hasz else 2).write(self) | [
"def",
"ewkb",
"(",
"self",
")",
":",
"return",
"ewkb_w",
"(",
"3",
"if",
"self",
".",
"hasz",
"else",
"2",
")",
".",
"write",
"(",
"self",
")"
] | [
399,
4
] | [
405,
56
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.kml | (self) | Return the KML representation of this Geometry. | Return the KML representation of this Geometry. | def kml(self):
"Return the KML representation of this Geometry."
gtype = self.geom_type
return '<%s>%s</%s>' % (gtype, self.coord_seq.kml, gtype) | [
"def",
"kml",
"(",
"self",
")",
":",
"gtype",
"=",
"self",
".",
"geom_type",
"return",
"'<%s>%s</%s>'",
"%",
"(",
"gtype",
",",
"self",
".",
"coord_seq",
".",
"kml",
",",
"gtype",
")"
] | [
408,
4
] | [
411,
65
] | python | en | ['en', 'id', 'en'] | True |
GEOSGeometryBase.prepared | (self) |
Return a PreparedGeometry corresponding to this geometry -- it is
optimized for the contains, intersects, and covers operations.
|
Return a PreparedGeometry corresponding to this geometry -- it is
optimized for the contains, intersects, and covers operations.
| def prepared(self):
"""
Return a PreparedGeometry corresponding to this geometry -- it is
optimized for the contains, intersects, and covers operations.
"""
return PreparedGeometry(self) | [
"def",
"prepared",
"(",
"self",
")",
":",
"return",
"PreparedGeometry",
"(",
"self",
")"
] | [
414,
4
] | [
419,
37
] | python | en | ['en', 'error', 'th'] | False |
GEOSGeometryBase.ogr | (self) | Return the OGR Geometry for this Geometry. | Return the OGR Geometry for this Geometry. | def ogr(self):
"Return the OGR Geometry for this Geometry."
return gdal.OGRGeometry(self._ogr_ptr(), self.srs) | [
"def",
"ogr",
"(",
"self",
")",
":",
"return",
"gdal",
".",
"OGRGeometry",
"(",
"self",
".",
"_ogr_ptr",
"(",
")",
",",
"self",
".",
"srs",
")"
] | [
426,
4
] | [
428,
58
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.srs | (self) | Return the OSR SpatialReference for SRID of this Geometry. | Return the OSR SpatialReference for SRID of this Geometry. | def srs(self):
"Return the OSR SpatialReference for SRID of this Geometry."
if self.srid:
try:
return gdal.SpatialReference(self.srid)
except gdal.SRSException:
pass
return None | [
"def",
"srs",
"(",
"self",
")",
":",
"if",
"self",
".",
"srid",
":",
"try",
":",
"return",
"gdal",
".",
"SpatialReference",
"(",
"self",
".",
"srid",
")",
"except",
"gdal",
".",
"SRSException",
":",
"pass",
"return",
"None"
] | [
431,
4
] | [
438,
19
] | python | en | ['en', 'en', 'en'] | True |
GEOSGeometryBase.crs | (self) | Alias for `srs` property. | Alias for `srs` property. | def crs(self):
"Alias for `srs` property."
return self.srs | [
"def",
"crs",
"(",
"self",
")",
":",
"return",
"self",
".",
"srs"
] | [
441,
4
] | [
443,
23
] | python | en | ['es', 'en', 'en'] | True |
GEOSGeometryBase.transform | (self, ct, clone=False) |
Requires GDAL. Transform the geometry according to the given
transformation object, which may be an integer SRID, and WKT or
PROJ.4 string. By default, transform the geometry in-place and return
nothing. However if the `clone` keyword is set, don't modify the
geometry and return... |
Requires GDAL. Transform the geometry according to the given
transformation object, which may be an integer SRID, and WKT or
PROJ.4 string. By default, transform the geometry in-place and return
nothing. However if the `clone` keyword is set, don't modify the
geometry and return... | def transform(self, ct, clone=False):
"""
Requires GDAL. Transform the geometry according to the given
transformation object, which may be an integer SRID, and WKT or
PROJ.4 string. By default, transform the geometry in-place and return
nothing. However if the `clone` keyword is ... | [
"def",
"transform",
"(",
"self",
",",
"ct",
",",
"clone",
"=",
"False",
")",
":",
"srid",
"=",
"self",
".",
"srid",
"if",
"ct",
"==",
"srid",
":",
"# short-circuit where source & dest SRIDs match",
"if",
"clone",
":",
"return",
"self",
".",
"clone",
"(",
... | [
445,
4
] | [
485,
63
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.