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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
WsgiToAsgiInstance.run_wsgi_app | (self, body) |
Called in a subthread to run the WSGI app. We encapsulate like
this so that the start_response callable is called in the same thread.
|
Called in a subthread to run the WSGI app. We encapsulate like
this so that the start_response callable is called in the same thread.
| def run_wsgi_app(self, body):
"""
Called in a subthread to run the WSGI app. We encapsulate like
this so that the start_response callable is called in the same thread.
"""
# Translate the scope and incoming request body into a WSGI environ
environ = self.build_environ(sel... | [
"def",
"run_wsgi_app",
"(",
"self",
",",
"body",
")",
":",
"# Translate the scope and incoming request body into a WSGI environ",
"environ",
"=",
"self",
".",
"build_environ",
"(",
"self",
".",
"scope",
",",
"body",
")",
"# Run the WSGI app",
"for",
"output",
"in",
... | [
124,
4
] | [
144,
54
] | python | en | ['en', 'error', 'th'] | False |
is_fp_closed | (obj) |
Checks whether a given file-like object is closed.
:param obj:
The file-like object to check.
|
Checks whether a given file-like object is closed. | def is_fp_closed(obj):
"""
Checks whether a given file-like object is closed.
:param obj:
The file-like object to check.
"""
try:
# Check `isclosed()` first, in case Python3 doesn't set `closed`.
# GH Issue #928
return obj.isclosed()
except AttributeError:
... | [
"def",
"is_fp_closed",
"(",
"obj",
")",
":",
"try",
":",
"# Check `isclosed()` first, in case Python3 doesn't set `closed`.",
"# GH Issue #928",
"return",
"obj",
".",
"isclosed",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"try",
":",
"# Check via the official file... | [
6,
0
] | [
34,
65
] | python | en | ['en', 'error', 'th'] | False |
assert_header_parsing | (headers) |
Asserts whether all headers have been successfully parsed.
Extracts encountered errors from the result of parsing headers.
Only works on Python 3.
:param headers: Headers to verify.
:type headers: `httplib.HTTPMessage`.
:raises urllib3.exceptions.HeaderParsingError:
If parsing errors... |
Asserts whether all headers have been successfully parsed.
Extracts encountered errors from the result of parsing headers. | def assert_header_parsing(headers):
"""
Asserts whether all headers have been successfully parsed.
Extracts encountered errors from the result of parsing headers.
Only works on Python 3.
:param headers: Headers to verify.
:type headers: `httplib.HTTPMessage`.
:raises urllib3.exceptions.He... | [
"def",
"assert_header_parsing",
"(",
"headers",
")",
":",
"# This will fail silently if we pass in the wrong kind of parameter.",
"# To make debugging easier add an explicit check.",
"if",
"not",
"isinstance",
"(",
"headers",
",",
"httplib",
".",
"HTTPMessage",
")",
":",
"raise... | [
37,
0
] | [
70,
78
] | python | en | ['en', 'error', 'th'] | False |
is_response_to_head | (response) |
Checks whether the request of a response has been a HEAD-request.
Handles the quirks of AppEngine.
:param conn:
:type conn: :class:`httplib.HTTPResponse`
|
Checks whether the request of a response has been a HEAD-request.
Handles the quirks of AppEngine. | def is_response_to_head(response):
"""
Checks whether the request of a response has been a HEAD-request.
Handles the quirks of AppEngine.
:param conn:
:type conn: :class:`httplib.HTTPResponse`
"""
# FIXME: Can we do this somehow without accessing private httplib _method?
method = respon... | [
"def",
"is_response_to_head",
"(",
"response",
")",
":",
"# FIXME: Can we do this somehow without accessing private httplib _method?",
"method",
"=",
"response",
".",
"_method",
"if",
"isinstance",
"(",
"method",
",",
"int",
")",
":",
"# Platform-specific: Appengine",
"retu... | [
73,
0
] | [
85,
35
] | python | en | ['en', 'error', 'th'] | False |
Command.compile_messages | (self, locations) |
Locations is a list of tuples: [(directory, file), ...]
|
Locations is a list of tuples: [(directory, file), ...]
| def compile_messages(self, locations):
"""
Locations is a list of tuples: [(directory, file), ...]
"""
for i, (dirpath, f) in enumerate(locations):
if self.verbosity > 0:
self.stdout.write('processing file %s in %s\n' % (f, dirpath))
po_path = os.p... | [
"def",
"compile_messages",
"(",
"self",
",",
"locations",
")",
":",
"for",
"i",
",",
"(",
"dirpath",
",",
"f",
")",
"in",
"enumerate",
"(",
"locations",
")",
":",
"if",
"self",
".",
"verbosity",
">",
"0",
":",
"self",
".",
"stdout",
".",
"write",
"... | [
90,
4
] | [
118,
39
] | python | en | ['en', 'error', 'th'] | False |
DualFormulation.__init__ | (
self,
sess,
dual_var,
neural_net_param_object,
test_input,
true_class,
adv_class,
input_minval,
input_maxval,
epsilon,
lzs_params=None,
project_dual=True,
) | Initializes dual formulation class.
Args:
sess: Tensorflow session
dual_var: dictionary of dual variables containing a) lambda_pos
b) lambda_neg, c) lambda_quad, d) lambda_lu
neural_net_param_object: NeuralNetParam object created for the network
under consi... | Initializes dual formulation class. | def __init__(
self,
sess,
dual_var,
neural_net_param_object,
test_input,
true_class,
adv_class,
input_minval,
input_maxval,
epsilon,
lzs_params=None,
project_dual=True,
):
"""Initializes dual formulation class.
... | [
"def",
"__init__",
"(",
"self",
",",
"sess",
",",
"dual_var",
",",
"neural_net_param_object",
",",
"test_input",
",",
"true_class",
",",
"adv_class",
",",
"input_minval",
",",
"input_maxval",
",",
"epsilon",
",",
"lzs_params",
"=",
"None",
",",
"project_dual",
... | [
34,
4
] | [
181,
62
] | python | en | ['fr', 'pt', 'en'] | False |
DualFormulation.create_projected_dual | (self) | Function to create variables for the projected dual object.
Function that projects the input dual variables onto the feasible set.
Returns:
projected_dual: Feasible dual solution corresponding to current dual
| Function to create variables for the projected dual object.
Function that projects the input dual variables onto the feasible set.
Returns:
projected_dual: Feasible dual solution corresponding to current dual
| def create_projected_dual(self):
"""Function to create variables for the projected dual object.
Function that projects the input dual variables onto the feasible set.
Returns:
projected_dual: Feasible dual solution corresponding to current dual
"""
# TODO: consider whet... | [
"def",
"create_projected_dual",
"(",
"self",
")",
":",
"# TODO: consider whether we can use shallow copy of the lists without",
"# using tf.identity",
"projected_nu",
"=",
"tf",
".",
"placeholder",
"(",
"tf",
".",
"float32",
",",
"shape",
"=",
"[",
"]",
")",
"min_eig_h"... | [
183,
4
] | [
235,
36
] | python | en | ['en', 'en', 'en'] | True |
DualFormulation.construct_lanczos_params | (self) | Computes matrices T and V using the Lanczos algorithm.
Args:
k: number of iterations and dimensionality of the tridiagonal matrix
Returns:
eig_vec: eigen vector corresponding to min eigenvalue
| Computes matrices T and V using the Lanczos algorithm. | def construct_lanczos_params(self):
"""Computes matrices T and V using the Lanczos algorithm.
Args:
k: number of iterations and dimensionality of the tridiagonal matrix
Returns:
eig_vec: eigen vector corresponding to min eigenvalue
"""
# Using autograph to au... | [
"def",
"construct_lanczos_params",
"(",
"self",
")",
":",
"# Using autograph to automatically handle",
"# the control flow of minimum_eigen_vector",
"self",
".",
"min_eigen_vec",
"=",
"autograph",
".",
"to_graph",
"(",
"utils",
".",
"tf_lanczos_smallest_eigval",
")",
"def",
... | [
237,
4
] | [
288,
63
] | python | en | ['en', 'en', 'en'] | True |
DualFormulation.set_differentiable_objective | (self) | Function that constructs minimization objective from dual variables. | Function that constructs minimization objective from dual variables. | def set_differentiable_objective(self):
"""Function that constructs minimization objective from dual variables."""
# Checking if graphs are already created
if self.vector_g is not None:
return
# Computing the scalar term
bias_sum = 0
for i in range(0, self.nn... | [
"def",
"set_differentiable_objective",
"(",
"self",
")",
":",
"# Checking if graphs are already created",
"if",
"self",
".",
"vector_g",
"is",
"not",
"None",
":",
"return",
"# Computing the scalar term",
"bias_sum",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"0",
"... | [
290,
4
] | [
351,
68
] | python | en | ['en', 'en', 'en'] | True |
DualFormulation.get_h_product | (self, vector, dtype=None) | Function that provides matrix product interface with PSD matrix.
Args:
vector: the vector to be multiplied with matrix H
Returns:
result_product: Matrix product of H and vector
| Function that provides matrix product interface with PSD matrix. | def get_h_product(self, vector, dtype=None):
"""Function that provides matrix product interface with PSD matrix.
Args:
vector: the vector to be multiplied with matrix H
Returns:
result_product: Matrix product of H and vector
"""
# Computing the product of ma... | [
"def",
"get_h_product",
"(",
"self",
",",
"vector",
",",
"dtype",
"=",
"None",
")",
":",
"# Computing the product of matrix_h with beta (input vector)",
"# At first layer, h is simply diagonal",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"self",
".",
"nn_dtype",
... | [
353,
4
] | [
413,
37
] | python | en | ['en', 'en', 'en'] | True |
DualFormulation.get_psd_product | (self, vector, dtype=None) | Function that provides matrix product interface with PSD matrix.
Args:
vector: the vector to be multiplied with matrix M
Returns:
result_product: Matrix product of M and vector
| Function that provides matrix product interface with PSD matrix. | def get_psd_product(self, vector, dtype=None):
"""Function that provides matrix product interface with PSD matrix.
Args:
vector: the vector to be multiplied with matrix M
Returns:
result_product: Matrix product of M and vector
"""
# For convenience, think of... | [
"def",
"get_psd_product",
"(",
"self",
",",
"vector",
",",
"dtype",
"=",
"None",
")",
":",
"# For convenience, think of x as [\\alpha, \\beta]",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"self",
".",
"nn_dtype",
"vector",
"=",
"tf",
".",
"cast",
"(",
"... | [
415,
4
] | [
442,
37
] | python | en | ['en', 'en', 'en'] | True |
DualFormulation.get_full_psd_matrix | (self) | Function that returns the tf graph corresponding to the entire matrix M.
Returns:
matrix_h: unrolled version of tf matrix corresponding to H
matrix_m: unrolled tf matrix corresponding to M
| Function that returns the tf graph corresponding to the entire matrix M. | def get_full_psd_matrix(self):
"""Function that returns the tf graph corresponding to the entire matrix M.
Returns:
matrix_h: unrolled version of tf matrix corresponding to H
matrix_m: unrolled tf matrix corresponding to M
"""
if self.matrix_m is not None:
... | [
"def",
"get_full_psd_matrix",
"(",
"self",
")",
":",
"if",
"self",
".",
"matrix_m",
"is",
"not",
"None",
":",
"return",
"self",
".",
"matrix_h",
",",
"self",
".",
"matrix_m",
"# Computing the matrix term",
"h_columns",
"=",
"[",
"]",
"for",
"i",
"in",
"ran... | [
444,
4
] | [
496,
43
] | python | en | ['en', 'en', 'en'] | True |
DualFormulation.make_m_psd | (self, original_nu, feed_dictionary) | Run binary search to find a value for nu that makes M PSD
Args:
original_nu: starting value of nu to do binary search on
feed_dictionary: dictionary of updated lambda variables to feed into M
Returns:
new_nu: new value of nu
| Run binary search to find a value for nu that makes M PSD
Args:
original_nu: starting value of nu to do binary search on
feed_dictionary: dictionary of updated lambda variables to feed into M
Returns:
new_nu: new value of nu
| def make_m_psd(self, original_nu, feed_dictionary):
"""Run binary search to find a value for nu that makes M PSD
Args:
original_nu: starting value of nu to do binary search on
feed_dictionary: dictionary of updated lambda variables to feed into M
Returns:
new_nu: ne... | [
"def",
"make_m_psd",
"(",
"self",
",",
"original_nu",
",",
"feed_dictionary",
")",
":",
"feed_dict",
"=",
"feed_dictionary",
".",
"copy",
"(",
")",
"_",
",",
"min_eig_val_m",
"=",
"self",
".",
"get_lanczos_eig",
"(",
"compute_m",
"=",
"True",
",",
"feed_dict... | [
498,
4
] | [
535,
23
] | python | en | ['en', 'en', 'en'] | True |
DualFormulation.get_lanczos_eig | (self, compute_m=True, feed_dict=None) | Computes the min eigen value and corresponding vector of matrix M or H
using the Lanczos algorithm.
Args:
compute_m: boolean to determine whether we should compute eig val/vec
for M or for H. True for M; False for H.
feed_dict: dictionary mapping from TF placeholders to v... | Computes the min eigen value and corresponding vector of matrix M or H
using the Lanczos algorithm.
Args:
compute_m: boolean to determine whether we should compute eig val/vec
for M or for H. True for M; False for H.
feed_dict: dictionary mapping from TF placeholders to v... | def get_lanczos_eig(self, compute_m=True, feed_dict=None):
"""Computes the min eigen value and corresponding vector of matrix M or H
using the Lanczos algorithm.
Args:
compute_m: boolean to determine whether we should compute eig val/vec
for M or for H. True for M; False fo... | [
"def",
"get_lanczos_eig",
"(",
"self",
",",
"compute_m",
"=",
"True",
",",
"feed_dict",
"=",
"None",
")",
":",
"if",
"compute_m",
":",
"min_eig",
",",
"min_vec",
"=",
"self",
".",
"sess",
".",
"run",
"(",
"[",
"self",
".",
"m_min_eig",
",",
"self",
"... | [
537,
4
] | [
558,
31
] | python | en | ['en', 'en', 'en'] | True |
DualFormulation.compute_certificate | (self, current_step, feed_dictionary) | Function to compute the certificate based either current value
or dual variables loaded from dual folder | Function to compute the certificate based either current value
or dual variables loaded from dual folder | def compute_certificate(self, current_step, feed_dictionary):
"""Function to compute the certificate based either current value
or dual variables loaded from dual folder"""
feed_dict = feed_dictionary.copy()
nu = feed_dict[self.nu]
second_term = self.make_m_psd(nu, feed_dict)
... | [
"def",
"compute_certificate",
"(",
"self",
",",
"current_step",
",",
"feed_dictionary",
")",
":",
"feed_dict",
"=",
"feed_dictionary",
".",
"copy",
"(",
")",
"nu",
"=",
"feed_dict",
"[",
"self",
".",
"nu",
"]",
"second_term",
"=",
"self",
".",
"make_m_psd",
... | [
560,
4
] | [
607,
20
] | python | en | ['en', 'en', 'en'] | True |
is_url | (name) |
Return true if the name looks like a URL.
|
Return true if the name looks like a URL.
| def is_url(name):
# type: (Union[str, Text]) -> bool
"""
Return true if the name looks like a URL.
"""
scheme = get_url_scheme(name)
if scheme is None:
return False
return scheme in ['http', 'https', 'file', 'ftp'] + vcs.all_schemes | [
"def",
"is_url",
"(",
"name",
")",
":",
"# type: (Union[str, Text]) -> bool",
"scheme",
"=",
"get_url_scheme",
"(",
"name",
")",
"if",
"scheme",
"is",
"None",
":",
"return",
"False",
"return",
"scheme",
"in",
"[",
"'http'",
",",
"'https'",
",",
"'file'",
","... | [
45,
0
] | [
53,
71
] | python | en | ['en', 'error', 'th'] | False |
make_vcs_requirement_url | (repo_url, rev, project_name, subdir=None) |
Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name.
|
Return the URL for a VCS requirement. | def make_vcs_requirement_url(repo_url, rev, project_name, subdir=None):
# type: (str, str, str, Optional[str]) -> str
"""
Return the URL for a VCS requirement.
Args:
repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+").
project_name: the (unescaped) project name.
"""
... | [
"def",
"make_vcs_requirement_url",
"(",
"repo_url",
",",
"rev",
",",
"project_name",
",",
"subdir",
"=",
"None",
")",
":",
"# type: (str, str, str, Optional[str]) -> str",
"egg_project_name",
"=",
"pkg_resources",
".",
"to_filename",
"(",
"project_name",
")",
"req",
"... | [
56,
0
] | [
70,
14
] | python | en | ['en', 'error', 'th'] | False |
find_path_to_setup_from_repo_root | (location, repo_root) |
Find the path to `setup.py` by searching up the filesystem from `location`.
Return the path to `setup.py` relative to `repo_root`.
Return None if `setup.py` is in `repo_root` or cannot be found.
|
Find the path to `setup.py` by searching up the filesystem from `location`.
Return the path to `setup.py` relative to `repo_root`.
Return None if `setup.py` is in `repo_root` or cannot be found.
| def find_path_to_setup_from_repo_root(location, repo_root):
# type: (str, str) -> Optional[str]
"""
Find the path to `setup.py` by searching up the filesystem from `location`.
Return the path to `setup.py` relative to `repo_root`.
Return None if `setup.py` is in `repo_root` or cannot be found.
"... | [
"def",
"find_path_to_setup_from_repo_root",
"(",
"location",
",",
"repo_root",
")",
":",
"# type: (str, str) -> Optional[str]",
"# find setup.py",
"orig_location",
"=",
"location",
"while",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join"... | [
73,
0
] | [
98,
47
] | python | en | ['en', 'error', 'th'] | False |
RevOptions.__init__ | (
self,
vc_class, # type: Type[VersionControl]
rev=None, # type: Optional[str]
extra_args=None, # type: Optional[CommandArgs]
) |
Args:
vc_class: a VersionControl subclass.
rev: the name of the revision to install.
extra_args: a list of extra options.
|
Args:
vc_class: a VersionControl subclass.
rev: the name of the revision to install.
extra_args: a list of extra options.
| def __init__(
self,
vc_class, # type: Type[VersionControl]
rev=None, # type: Optional[str]
extra_args=None, # type: Optional[CommandArgs]
):
# type: (...) -> None
"""
Args:
vc_class: a VersionControl subclass.
rev: the name of the revisi... | [
"def",
"__init__",
"(",
"self",
",",
"vc_class",
",",
"# type: Type[VersionControl]",
"rev",
"=",
"None",
",",
"# type: Optional[str]",
"extra_args",
"=",
"None",
",",
"# type: Optional[CommandArgs]",
")",
":",
"# type: (...) -> None",
"if",
"extra_args",
"is",
"None"... | [
114,
4
] | [
133,
31
] | python | en | ['en', 'error', 'th'] | False |
RevOptions.to_args | (self) |
Return the VCS-specific command arguments.
|
Return the VCS-specific command arguments.
| def to_args(self):
# type: () -> CommandArgs
"""
Return the VCS-specific command arguments.
"""
args = [] # type: CommandArgs
rev = self.arg_rev
if rev is not None:
args += self.vc_class.get_base_rev_args(rev)
args += self.extra_args
... | [
"def",
"to_args",
"(",
"self",
")",
":",
"# type: () -> CommandArgs",
"args",
"=",
"[",
"]",
"# type: CommandArgs",
"rev",
"=",
"self",
".",
"arg_rev",
"if",
"rev",
"is",
"not",
"None",
":",
"args",
"+=",
"self",
".",
"vc_class",
".",
"get_base_rev_args",
... | [
147,
4
] | [
158,
19
] | python | en | ['en', 'error', 'th'] | False |
RevOptions.make_new | (self, rev) |
Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object.
|
Make a copy of the current instance, but with a new rev. | def make_new(self, rev):
# type: (str) -> RevOptions
"""
Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object.
"""
return self.vc_class.make_rev_options(rev, extra_args=self.extra_args) | [
"def",
"make_new",
"(",
"self",
",",
"rev",
")",
":",
"# type: (str) -> RevOptions",
"return",
"self",
".",
"vc_class",
".",
"make_rev_options",
"(",
"rev",
",",
"extra_args",
"=",
"self",
".",
"extra_args",
")"
] | [
167,
4
] | [
175,
78
] | python | en | ['en', 'error', 'th'] | False |
VcsSupport.get_backend_for_dir | (self, location) |
Return a VersionControl object if a repository of that type is found
at the given directory.
|
Return a VersionControl object if a repository of that type is found
at the given directory.
| def get_backend_for_dir(self, location):
# type: (str) -> Optional[VersionControl]
"""
Return a VersionControl object if a repository of that type is found
at the given directory.
"""
vcs_backends = {}
for vcs_backend in self._registry.values():
repo_p... | [
"def",
"get_backend_for_dir",
"(",
"self",
",",
"location",
")",
":",
"# type: (str) -> Optional[VersionControl]",
"vcs_backends",
"=",
"{",
"}",
"for",
"vcs_backend",
"in",
"self",
".",
"_registry",
".",
"values",
"(",
")",
":",
"repo_path",
"=",
"vcs_backend",
... | [
228,
4
] | [
251,
49
] | python | en | ['en', 'error', 'th'] | False |
VcsSupport.get_backend_for_scheme | (self, scheme) |
Return a VersionControl object or None.
|
Return a VersionControl object or None.
| def get_backend_for_scheme(self, scheme):
# type: (str) -> Optional[VersionControl]
"""
Return a VersionControl object or None.
"""
for vcs_backend in self._registry.values():
if scheme in vcs_backend.schemes:
return vcs_backend
return None | [
"def",
"get_backend_for_scheme",
"(",
"self",
",",
"scheme",
")",
":",
"# type: (str) -> Optional[VersionControl]",
"for",
"vcs_backend",
"in",
"self",
".",
"_registry",
".",
"values",
"(",
")",
":",
"if",
"scheme",
"in",
"vcs_backend",
".",
"schemes",
":",
"ret... | [
253,
4
] | [
261,
19
] | python | en | ['en', 'error', 'th'] | False |
VcsSupport.get_backend | (self, name) |
Return a VersionControl object or None.
|
Return a VersionControl object or None.
| def get_backend(self, name):
# type: (str) -> Optional[VersionControl]
"""
Return a VersionControl object or None.
"""
name = name.lower()
return self._registry.get(name) | [
"def",
"get_backend",
"(",
"self",
",",
"name",
")",
":",
"# type: (str) -> Optional[VersionControl]",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"return",
"self",
".",
"_registry",
".",
"get",
"(",
"name",
")"
] | [
263,
4
] | [
269,
39
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.should_add_vcs_url_prefix | (cls, remote_url) |
Return whether the vcs prefix (e.g. "git+") should be added to a
repository's remote url when used in a requirement.
|
Return whether the vcs prefix (e.g. "git+") should be added to a
repository's remote url when used in a requirement.
| def should_add_vcs_url_prefix(cls, remote_url):
# type: (str) -> bool
"""
Return whether the vcs prefix (e.g. "git+") should be added to a
repository's remote url when used in a requirement.
"""
return not remote_url.lower().startswith('{}:'.format(cls.name)) | [
"def",
"should_add_vcs_url_prefix",
"(",
"cls",
",",
"remote_url",
")",
":",
"# type: (str) -> bool",
"return",
"not",
"remote_url",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"'{}:'",
".",
"format",
"(",
"cls",
".",
"name",
")",
")"
] | [
286,
4
] | [
292,
72
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_subdirectory | (cls, location) |
Return the path to setup.py, relative to the repo root.
Return None if setup.py is in the repo root.
|
Return the path to setup.py, relative to the repo root.
Return None if setup.py is in the repo root.
| def get_subdirectory(cls, location):
# type: (str) -> Optional[str]
"""
Return the path to setup.py, relative to the repo root.
Return None if setup.py is in the repo root.
"""
return None | [
"def",
"get_subdirectory",
"(",
"cls",
",",
"location",
")",
":",
"# type: (str) -> Optional[str]",
"return",
"None"
] | [
295,
4
] | [
301,
19
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_requirement_revision | (cls, repo_dir) |
Return the revision string that should be used in a requirement.
|
Return the revision string that should be used in a requirement.
| def get_requirement_revision(cls, repo_dir):
# type: (str) -> str
"""
Return the revision string that should be used in a requirement.
"""
return cls.get_revision(repo_dir) | [
"def",
"get_requirement_revision",
"(",
"cls",
",",
"repo_dir",
")",
":",
"# type: (str) -> str",
"return",
"cls",
".",
"get_revision",
"(",
"repo_dir",
")"
] | [
304,
4
] | [
309,
41
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_src_requirement | (cls, repo_dir, project_name) |
Return the requirement string to use to redownload the files
currently at the given repository directory.
Args:
project_name: the (unescaped) project name.
The return value has a form similar to the following:
{repository_url}@{revision}#egg={project_name}
... |
Return the requirement string to use to redownload the files
currently at the given repository directory. | def get_src_requirement(cls, repo_dir, project_name):
# type: (str, str) -> Optional[str]
"""
Return the requirement string to use to redownload the files
currently at the given repository directory.
Args:
project_name: the (unescaped) project name.
The return... | [
"def",
"get_src_requirement",
"(",
"cls",
",",
"repo_dir",
",",
"project_name",
")",
":",
"# type: (str, str) -> Optional[str]",
"repo_url",
"=",
"cls",
".",
"get_remote_url",
"(",
"repo_dir",
")",
"if",
"repo_url",
"is",
"None",
":",
"return",
"None",
"if",
"cl... | [
312,
4
] | [
337,
18
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_base_rev_args | (rev) |
Return the base revision arguments for a vcs command.
Args:
rev: the name of a revision to install. Cannot be None.
|
Return the base revision arguments for a vcs command. | def get_base_rev_args(rev):
# type: (str) -> List[str]
"""
Return the base revision arguments for a vcs command.
Args:
rev: the name of a revision to install. Cannot be None.
"""
raise NotImplementedError | [
"def",
"get_base_rev_args",
"(",
"rev",
")",
":",
"# type: (str) -> List[str]",
"raise",
"NotImplementedError"
] | [
340,
4
] | [
348,
33
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.is_immutable_rev_checkout | (self, url, dest) |
Return true if the commit hash checked out at dest matches
the revision in url.
Always return False, if the VCS does not support immutable commit
hashes.
This method does not check if there are local uncommitted changes
in dest after checkout, as pip currently has no u... |
Return true if the commit hash checked out at dest matches
the revision in url. | def is_immutable_rev_checkout(self, url, dest):
# type: (str, str) -> bool
"""
Return true if the commit hash checked out at dest matches
the revision in url.
Always return False, if the VCS does not support immutable commit
hashes.
This method does not check if... | [
"def",
"is_immutable_rev_checkout",
"(",
"self",
",",
"url",
",",
"dest",
")",
":",
"# type: (str, str) -> bool",
"return",
"False"
] | [
350,
4
] | [
362,
20
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.make_rev_options | (cls, rev=None, extra_args=None) |
Return a RevOptions object.
Args:
rev: the name of a revision to install.
extra_args: a list of extra options.
|
Return a RevOptions object. | def make_rev_options(cls, rev=None, extra_args=None):
# type: (Optional[str], Optional[CommandArgs]) -> RevOptions
"""
Return a RevOptions object.
Args:
rev: the name of a revision to install.
extra_args: a list of extra options.
"""
return RevOptions... | [
"def",
"make_rev_options",
"(",
"cls",
",",
"rev",
"=",
"None",
",",
"extra_args",
"=",
"None",
")",
":",
"# type: (Optional[str], Optional[CommandArgs]) -> RevOptions",
"return",
"RevOptions",
"(",
"cls",
",",
"rev",
",",
"extra_args",
"=",
"extra_args",
")"
] | [
365,
4
] | [
374,
58
] | python | en | ['en', 'error', 'th'] | False |
VersionControl._is_local_repository | (cls, repo) |
posix absolute paths start with os.path.sep,
win32 ones start with drive (like c:\\folder)
|
posix absolute paths start with os.path.sep,
win32 ones start with drive (like c:\\folder)
| def _is_local_repository(cls, repo):
# type: (str) -> bool
"""
posix absolute paths start with os.path.sep,
win32 ones start with drive (like c:\\folder)
"""
drive, tail = os.path.splitdrive(repo)
return repo.startswith(os.path.sep) or bool(drive) | [
"def",
"_is_local_repository",
"(",
"cls",
",",
"repo",
")",
":",
"# type: (str) -> bool",
"drive",
",",
"tail",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"repo",
")",
"return",
"repo",
".",
"startswith",
"(",
"os",
".",
"path",
".",
"sep",
")",
... | [
377,
4
] | [
384,
58
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.export | (self, location, url) |
Export the repository at the url to the destination location
i.e. only download the files, without vcs informations
:param url: the repository URL starting with a vcs prefix.
|
Export the repository at the url to the destination location
i.e. only download the files, without vcs informations | def export(self, location, url):
# type: (str, HiddenText) -> None
"""
Export the repository at the url to the destination location
i.e. only download the files, without vcs informations
:param url: the repository URL starting with a vcs prefix.
"""
raise NotImpl... | [
"def",
"export",
"(",
"self",
",",
"location",
",",
"url",
")",
":",
"# type: (str, HiddenText) -> None",
"raise",
"NotImplementedError"
] | [
386,
4
] | [
394,
33
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_netloc_and_auth | (cls, netloc, scheme) |
Parse the repository URL's netloc, and return the new netloc to use
along with auth information.
Args:
netloc: the original repository URL netloc.
scheme: the repository URL's scheme without the vcs prefix.
This is mainly for the Subversion class to override, so th... |
Parse the repository URL's netloc, and return the new netloc to use
along with auth information. | def get_netloc_and_auth(cls, netloc, scheme):
# type: (str, str) -> Tuple[str, Tuple[Optional[str], Optional[str]]]
"""
Parse the repository URL's netloc, and return the new netloc to use
along with auth information.
Args:
netloc: the original repository URL netloc.
... | [
"def",
"get_netloc_and_auth",
"(",
"cls",
",",
"netloc",
",",
"scheme",
")",
":",
"# type: (str, str) -> Tuple[str, Tuple[Optional[str], Optional[str]]]",
"return",
"netloc",
",",
"(",
"None",
",",
"None",
")"
] | [
397,
4
] | [
414,
35
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_url_rev_and_auth | (cls, url) |
Parse the repository URL to use, and return the URL, revision,
and auth info to use.
Returns: (url, rev, (username, password)).
|
Parse the repository URL to use, and return the URL, revision,
and auth info to use. | def get_url_rev_and_auth(cls, url):
# type: (str) -> Tuple[str, Optional[str], AuthInfo]
"""
Parse the repository URL to use, and return the URL, revision,
and auth info to use.
Returns: (url, rev, (username, password)).
"""
scheme, netloc, path, query, frag = ur... | [
"def",
"get_url_rev_and_auth",
"(",
"cls",
",",
"url",
")",
":",
"# type: (str) -> Tuple[str, Optional[str], AuthInfo]",
"scheme",
",",
"netloc",
",",
"path",
",",
"query",
",",
"frag",
"=",
"urllib_parse",
".",
"urlsplit",
"(",
"url",
")",
"if",
"'+'",
"not",
... | [
417,
4
] | [
445,
34
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.make_rev_args | (username, password) |
Return the RevOptions "extra arguments" to use in obtain().
|
Return the RevOptions "extra arguments" to use in obtain().
| def make_rev_args(username, password):
# type: (Optional[str], Optional[HiddenText]) -> CommandArgs
"""
Return the RevOptions "extra arguments" to use in obtain().
"""
return [] | [
"def",
"make_rev_args",
"(",
"username",
",",
"password",
")",
":",
"# type: (Optional[str], Optional[HiddenText]) -> CommandArgs",
"return",
"[",
"]"
] | [
448,
4
] | [
453,
17
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_url_rev_options | (self, url) |
Return the URL and RevOptions object to use in obtain() and in
some cases export(), as a tuple (url, rev_options).
|
Return the URL and RevOptions object to use in obtain() and in
some cases export(), as a tuple (url, rev_options).
| def get_url_rev_options(self, url):
# type: (HiddenText) -> Tuple[HiddenText, RevOptions]
"""
Return the URL and RevOptions object to use in obtain() and in
some cases export(), as a tuple (url, rev_options).
"""
secret_url, rev, user_pass = self.get_url_rev_and_auth(url.... | [
"def",
"get_url_rev_options",
"(",
"self",
",",
"url",
")",
":",
"# type: (HiddenText) -> Tuple[HiddenText, RevOptions]",
"secret_url",
",",
"rev",
",",
"user_pass",
"=",
"self",
".",
"get_url_rev_and_auth",
"(",
"url",
".",
"secret",
")",
"username",
",",
"secret_p... | [
455,
4
] | [
469,
48
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.normalize_url | (url) |
Normalize a URL for comparison by unquoting it and removing any
trailing slash.
|
Normalize a URL for comparison by unquoting it and removing any
trailing slash.
| def normalize_url(url):
# type: (str) -> str
"""
Normalize a URL for comparison by unquoting it and removing any
trailing slash.
"""
return urllib_parse.unquote(url).rstrip('/') | [
"def",
"normalize_url",
"(",
"url",
")",
":",
"# type: (str) -> str",
"return",
"urllib_parse",
".",
"unquote",
"(",
"url",
")",
".",
"rstrip",
"(",
"'/'",
")"
] | [
472,
4
] | [
478,
52
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.compare_urls | (cls, url1, url2) |
Compare two repo URLs for identity, ignoring incidental differences.
|
Compare two repo URLs for identity, ignoring incidental differences.
| def compare_urls(cls, url1, url2):
# type: (str, str) -> bool
"""
Compare two repo URLs for identity, ignoring incidental differences.
"""
return (cls.normalize_url(url1) == cls.normalize_url(url2)) | [
"def",
"compare_urls",
"(",
"cls",
",",
"url1",
",",
"url2",
")",
":",
"# type: (str, str) -> bool",
"return",
"(",
"cls",
".",
"normalize_url",
"(",
"url1",
")",
"==",
"cls",
".",
"normalize_url",
"(",
"url2",
")",
")"
] | [
481,
4
] | [
486,
67
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.fetch_new | (self, dest, url, rev_options) |
Fetch a revision from a repository, in the case that this is the
first fetch from the repository.
Args:
dest: the directory to fetch the repository to.
rev_options: a RevOptions object.
|
Fetch a revision from a repository, in the case that this is the
first fetch from the repository. | def fetch_new(self, dest, url, rev_options):
# type: (str, HiddenText, RevOptions) -> None
"""
Fetch a revision from a repository, in the case that this is the
first fetch from the repository.
Args:
dest: the directory to fetch the repository to.
rev_options:... | [
"def",
"fetch_new",
"(",
"self",
",",
"dest",
",",
"url",
",",
"rev_options",
")",
":",
"# type: (str, HiddenText, RevOptions) -> None",
"raise",
"NotImplementedError"
] | [
488,
4
] | [
498,
33
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.switch | (self, dest, url, rev_options) |
Switch the repo at ``dest`` to point to ``URL``.
Args:
rev_options: a RevOptions object.
|
Switch the repo at ``dest`` to point to ``URL``. | def switch(self, dest, url, rev_options):
# type: (str, HiddenText, RevOptions) -> None
"""
Switch the repo at ``dest`` to point to ``URL``.
Args:
rev_options: a RevOptions object.
"""
raise NotImplementedError | [
"def",
"switch",
"(",
"self",
",",
"dest",
",",
"url",
",",
"rev_options",
")",
":",
"# type: (str, HiddenText, RevOptions) -> None",
"raise",
"NotImplementedError"
] | [
500,
4
] | [
508,
33
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.update | (self, dest, url, rev_options) |
Update an already-existing repo to the given ``rev_options``.
Args:
rev_options: a RevOptions object.
|
Update an already-existing repo to the given ``rev_options``. | def update(self, dest, url, rev_options):
# type: (str, HiddenText, RevOptions) -> None
"""
Update an already-existing repo to the given ``rev_options``.
Args:
rev_options: a RevOptions object.
"""
raise NotImplementedError | [
"def",
"update",
"(",
"self",
",",
"dest",
",",
"url",
",",
"rev_options",
")",
":",
"# type: (str, HiddenText, RevOptions) -> None",
"raise",
"NotImplementedError"
] | [
510,
4
] | [
518,
33
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.is_commit_id_equal | (cls, dest, name) |
Return whether the id of the current commit equals the given name.
Args:
dest: the repository directory.
name: a string name.
|
Return whether the id of the current commit equals the given name. | def is_commit_id_equal(cls, dest, name):
# type: (str, Optional[str]) -> bool
"""
Return whether the id of the current commit equals the given name.
Args:
dest: the repository directory.
name: a string name.
"""
raise NotImplementedError | [
"def",
"is_commit_id_equal",
"(",
"cls",
",",
"dest",
",",
"name",
")",
":",
"# type: (str, Optional[str]) -> bool",
"raise",
"NotImplementedError"
] | [
521,
4
] | [
530,
33
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.obtain | (self, dest, url) |
Install or update in editable mode the package represented by this
VersionControl object.
:param dest: the repository directory in which to install or update.
:param url: the repository URL starting with a vcs prefix.
|
Install or update in editable mode the package represented by this
VersionControl object. | def obtain(self, dest, url):
# type: (str, HiddenText) -> None
"""
Install or update in editable mode the package represented by this
VersionControl object.
:param dest: the repository directory in which to install or update.
:param url: the repository URL starting with ... | [
"def",
"obtain",
"(",
"self",
",",
"dest",
",",
"url",
")",
":",
"# type: (str, HiddenText) -> None",
"url",
",",
"rev_options",
"=",
"self",
".",
"get_url_rev_options",
"(",
"url",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":... | [
532,
4
] | [
624,
47
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.unpack | (self, location, url) |
Clean up current location and download the url repository
(and vcs infos) into location
:param url: the repository URL starting with a vcs prefix.
|
Clean up current location and download the url repository
(and vcs infos) into location | def unpack(self, location, url):
# type: (str, HiddenText) -> None
"""
Clean up current location and download the url repository
(and vcs infos) into location
:param url: the repository URL starting with a vcs prefix.
"""
if os.path.exists(location):
... | [
"def",
"unpack",
"(",
"self",
",",
"location",
",",
"url",
")",
":",
"# type: (str, HiddenText) -> None",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"location",
")",
":",
"rmtree",
"(",
"location",
")",
"self",
".",
"obtain",
"(",
"location",
",",
"url... | [
626,
4
] | [
636,
38
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_remote_url | (cls, location) |
Return the url used at location
Raises RemoteNotFoundError if the repository does not have a remote
url configured.
|
Return the url used at location | def get_remote_url(cls, location):
# type: (str) -> str
"""
Return the url used at location
Raises RemoteNotFoundError if the repository does not have a remote
url configured.
"""
raise NotImplementedError | [
"def",
"get_remote_url",
"(",
"cls",
",",
"location",
")",
":",
"# type: (str) -> str",
"raise",
"NotImplementedError"
] | [
639,
4
] | [
647,
33
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_revision | (cls, location) |
Return the current commit id of the files at the given location.
|
Return the current commit id of the files at the given location.
| def get_revision(cls, location):
# type: (str) -> str
"""
Return the current commit id of the files at the given location.
"""
raise NotImplementedError | [
"def",
"get_revision",
"(",
"cls",
",",
"location",
")",
":",
"# type: (str) -> str",
"raise",
"NotImplementedError"
] | [
650,
4
] | [
655,
33
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.run_command | (
cls,
cmd, # type: Union[List[str], CommandArgs]
show_stdout=True, # type: bool
cwd=None, # type: Optional[str]
on_returncode='raise', # type: str
extra_ok_returncodes=None, # type: Optional[Iterable[int]]
command_desc=None, # type: Optional[str]
ex... |
Run a VCS subcommand
This is simply a wrapper around call_subprocess that adds the VCS
command name, and checks that the VCS is available
|
Run a VCS subcommand
This is simply a wrapper around call_subprocess that adds the VCS
command name, and checks that the VCS is available
| def run_command(
cls,
cmd, # type: Union[List[str], CommandArgs]
show_stdout=True, # type: bool
cwd=None, # type: Optional[str]
on_returncode='raise', # type: str
extra_ok_returncodes=None, # type: Optional[Iterable[int]]
command_desc=None, # type: Optional[... | [
"def",
"run_command",
"(",
"cls",
",",
"cmd",
",",
"# type: Union[List[str], CommandArgs]",
"show_stdout",
"=",
"True",
",",
"# type: bool",
"cwd",
"=",
"None",
",",
"# type: Optional[str]",
"on_returncode",
"=",
"'raise'",
",",
"# type: str",
"extra_ok_returncodes",
... | [
658,
4
] | [
695,
21
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.is_repository_directory | (cls, path) |
Return whether a directory path is a repository directory.
|
Return whether a directory path is a repository directory.
| def is_repository_directory(cls, path):
# type: (str) -> bool
"""
Return whether a directory path is a repository directory.
"""
logger.debug('Checking in %s for %s (%s)...',
path, cls.dirname, cls.name)
return os.path.exists(os.path.join(path, cls.di... | [
"def",
"is_repository_directory",
"(",
"cls",
",",
"path",
")",
":",
"# type: (str) -> bool",
"logger",
".",
"debug",
"(",
"'Checking in %s for %s (%s)...'",
",",
"path",
",",
"cls",
".",
"dirname",
",",
"cls",
".",
"name",
")",
"return",
"os",
".",
"path",
... | [
698,
4
] | [
705,
62
] | python | en | ['en', 'error', 'th'] | False |
VersionControl.get_repository_root | (cls, location) |
Return the "root" (top-level) directory controlled by the vcs,
or `None` if the directory is not in any.
It is meant to be overridden to implement smarter detection
mechanisms for specific vcs.
This can do more than is_repository_directory() alone. For
example, the Git... |
Return the "root" (top-level) directory controlled by the vcs,
or `None` if the directory is not in any. | def get_repository_root(cls, location):
# type: (str) -> Optional[str]
"""
Return the "root" (top-level) directory controlled by the vcs,
or `None` if the directory is not in any.
It is meant to be overridden to implement smarter detection
mechanisms for specific vcs.
... | [
"def",
"get_repository_root",
"(",
"cls",
",",
"location",
")",
":",
"# type: (str) -> Optional[str]",
"if",
"cls",
".",
"is_repository_directory",
"(",
"location",
")",
":",
"return",
"location",
"return",
"None"
] | [
708,
4
] | [
722,
19
] | python | en | ['en', 'error', 'th'] | False |
check_err | (code, cpl=False) |
Check the given CPL/OGRERR and raise an exception where appropriate.
|
Check the given CPL/OGRERR and raise an exception where appropriate.
| def check_err(code, cpl=False):
"""
Check the given CPL/OGRERR and raise an exception where appropriate.
"""
err_dict = CPLERR_DICT if cpl else OGRERR_DICT
if code == ERR_NONE:
return
elif code in err_dict:
e, msg = err_dict[code]
raise e(msg)
else:
raise GDA... | [
"def",
"check_err",
"(",
"code",
",",
"cpl",
"=",
"False",
")",
":",
"err_dict",
"=",
"CPLERR_DICT",
"if",
"cpl",
"else",
"OGRERR_DICT",
"if",
"code",
"==",
"ERR_NONE",
":",
"return",
"elif",
"code",
"in",
"err_dict",
":",
"e",
",",
"msg",
"=",
"err_di... | [
48,
0
] | [
60,
62
] | python | en | ['en', 'error', 'th'] | False |
SessionStore.flush | (self) |
Removes the current session data from the database and regenerates the
key.
|
Removes the current session data from the database and regenerates the
key.
| def flush(self):
"""
Removes the current session data from the database and regenerates the
key.
"""
self.clear()
self.delete(self.session_key)
self._session_key = '' | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"clear",
"(",
")",
"self",
".",
"delete",
"(",
"self",
".",
"session_key",
")",
"self",
".",
"_session_key",
"=",
"''"
] | [
74,
4
] | [
81,
30
] | python | en | ['en', 'error', 'th'] | False |
HTTPConnection.host | (self) |
Getter method to remove any trailing dots that indicate the hostname is an FQDN.
In general, SSL certificates don't include the trailing dot indicating a
fully-qualified domain name, and thus, they don't validate properly when
checked against a domain name that includes the dot. In add... |
Getter method to remove any trailing dots that indicate the hostname is an FQDN. | def host(self):
"""
Getter method to remove any trailing dots that indicate the hostname is an FQDN.
In general, SSL certificates don't include the trailing dot indicating a
fully-qualified domain name, and thus, they don't validate properly when
checked against a domain name th... | [
"def",
"host",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dns_host",
".",
"rstrip",
"(",
"\".\"",
")"
] | [
114,
4
] | [
130,
41
] | python | en | ['en', 'error', 'th'] | False |
HTTPConnection.host | (self, value) |
Setter for the `host` property.
We assume that only urllib3 uses the _dns_host attribute; httplib itself
only uses `host`, and it seems reasonable that other libraries follow suit.
|
Setter for the `host` property. | def host(self, value):
"""
Setter for the `host` property.
We assume that only urllib3 uses the _dns_host attribute; httplib itself
only uses `host`, and it seems reasonable that other libraries follow suit.
"""
self._dns_host = value | [
"def",
"host",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_dns_host",
"=",
"value"
] | [
133,
4
] | [
140,
30
] | python | en | ['en', 'error', 'th'] | False |
HTTPConnection._new_conn | (self) | Establish a socket connection and set nodelay settings on it.
:return: New socket connection.
| Establish a socket connection and set nodelay settings on it. | def _new_conn(self):
""" Establish a socket connection and set nodelay settings on it.
:return: New socket connection.
"""
extra_kw = {}
if self.source_address:
extra_kw["source_address"] = self.source_address
if self.socket_options:
extra_kw["so... | [
"def",
"_new_conn",
"(",
"self",
")",
":",
"extra_kw",
"=",
"{",
"}",
"if",
"self",
".",
"source_address",
":",
"extra_kw",
"[",
"\"source_address\"",
"]",
"=",
"self",
".",
"source_address",
"if",
"self",
".",
"socket_options",
":",
"extra_kw",
"[",
"\"so... | [
142,
4
] | [
171,
19
] | python | en | ['en', 'st', 'en'] | True |
HTTPConnection.request_chunked | (self, method, url, body=None, headers=None) |
Alternative to the common request method, which sends the
body with chunked encoding and not as one block
|
Alternative to the common request method, which sends the
body with chunked encoding and not as one block
| def request_chunked(self, method, url, body=None, headers=None):
"""
Alternative to the common request method, which sends the
body with chunked encoding and not as one block
"""
headers = HTTPHeaderDict(headers if headers is not None else {})
skip_accept_encoding = "acce... | [
"def",
"request_chunked",
"(",
"self",
",",
"method",
",",
"url",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"headers",
"=",
"HTTPHeaderDict",
"(",
"headers",
"if",
"headers",
"is",
"not",
"None",
"else",
"{",
"}",
")",
"skip_acce... | [
186,
4
] | [
219,
31
] | python | en | ['en', 'error', 'th'] | False |
VerifiedHTTPSConnection.set_cert | (
self,
key_file=None,
cert_file=None,
cert_reqs=None,
key_password=None,
ca_certs=None,
assert_hostname=None,
assert_fingerprint=None,
ca_cert_dir=None,
) |
This method should only be called once, before the connection is used.
|
This method should only be called once, before the connection is used.
| def set_cert(
self,
key_file=None,
cert_file=None,
cert_reqs=None,
key_password=None,
ca_certs=None,
assert_hostname=None,
assert_fingerprint=None,
ca_cert_dir=None,
):
"""
This method should only be called once, before the conn... | [
"def",
"set_cert",
"(",
"self",
",",
"key_file",
"=",
"None",
",",
"cert_file",
"=",
"None",
",",
"cert_reqs",
"=",
"None",
",",
"key_password",
"=",
"None",
",",
"ca_certs",
"=",
"None",
",",
"assert_hostname",
"=",
"None",
",",
"assert_fingerprint",
"=",... | [
266,
4
] | [
295,
74
] | python | en | ['en', 'error', 'th'] | False |
srs_double | (f) |
Creates a function prototype for the OSR routines that take
the OSRSpatialReference object and
|
Creates a function prototype for the OSR routines that take
the OSRSpatialReference object and
| def srs_double(f):
"""
Creates a function prototype for the OSR routines that take
the OSRSpatialReference object and
"""
return double_output(f, [c_void_p, POINTER(c_int)], errcheck=True) | [
"def",
"srs_double",
"(",
"f",
")",
":",
"return",
"double_output",
"(",
"f",
",",
"[",
"c_void_p",
",",
"POINTER",
"(",
"c_int",
")",
"]",
",",
"errcheck",
"=",
"True",
")"
] | [
7,
0
] | [
12,
70
] | python | en | ['en', 'error', 'th'] | False |
units_func | (f) |
Creates a ctypes function prototype for OSR units functions, e.g.,
OSRGetAngularUnits, OSRGetLinearUnits.
|
Creates a ctypes function prototype for OSR units functions, e.g.,
OSRGetAngularUnits, OSRGetLinearUnits.
| def units_func(f):
"""
Creates a ctypes function prototype for OSR units functions, e.g.,
OSRGetAngularUnits, OSRGetLinearUnits.
"""
return double_output(f, [c_void_p, POINTER(c_char_p)], strarg=True) | [
"def",
"units_func",
"(",
"f",
")",
":",
"return",
"double_output",
"(",
"f",
",",
"[",
"c_void_p",
",",
"POINTER",
"(",
"c_char_p",
")",
"]",
",",
"strarg",
"=",
"True",
")"
] | [
15,
0
] | [
20,
71
] | python | en | ['en', 'error', 'th'] | False |
EggLoadingTest.test_egg1 | (self) | Models module can be loaded from an app in an egg | Models module can be loaded from an app in an egg | def test_egg1(self):
"""Models module can be loaded from an app in an egg"""
egg_name = '%s/modelapp.egg' % self.egg_dir
with extend_sys_path(egg_name):
with self.settings(INSTALLED_APPS=['app_with_models']):
models_module = apps.get_app_config('app_with_models').mode... | [
"def",
"test_egg1",
"(",
"self",
")",
":",
"egg_name",
"=",
"'%s/modelapp.egg'",
"%",
"self",
".",
"egg_dir",
"with",
"extend_sys_path",
"(",
"egg_name",
")",
":",
"with",
"self",
".",
"settings",
"(",
"INSTALLED_APPS",
"=",
"[",
"'app_with_models'",
"]",
")... | [
19,
4
] | [
26,
46
] | python | en | ['en', 'en', 'en'] | True |
EggLoadingTest.test_egg2 | (self) | Loading an app from an egg that has no models returns no models (and no error) | Loading an app from an egg that has no models returns no models (and no error) | def test_egg2(self):
"""Loading an app from an egg that has no models returns no models (and no error)"""
egg_name = '%s/nomodelapp.egg' % self.egg_dir
with extend_sys_path(egg_name):
with self.settings(INSTALLED_APPS=['app_no_models']):
models_module = apps.get_app_c... | [
"def",
"test_egg2",
"(",
"self",
")",
":",
"egg_name",
"=",
"'%s/nomodelapp.egg'",
"%",
"self",
".",
"egg_dir",
"with",
"extend_sys_path",
"(",
"egg_name",
")",
":",
"with",
"self",
".",
"settings",
"(",
"INSTALLED_APPS",
"=",
"[",
"'app_no_models'",
"]",
")... | [
28,
4
] | [
35,
44
] | python | en | ['en', 'en', 'en'] | True |
EggLoadingTest.test_egg3 | (self) | Models module can be loaded from an app located under an egg's top-level package | Models module can be loaded from an app located under an egg's top-level package | def test_egg3(self):
"""Models module can be loaded from an app located under an egg's top-level package"""
egg_name = '%s/omelet.egg' % self.egg_dir
with extend_sys_path(egg_name):
with self.settings(INSTALLED_APPS=['omelet.app_with_models']):
models_module = apps.ge... | [
"def",
"test_egg3",
"(",
"self",
")",
":",
"egg_name",
"=",
"'%s/omelet.egg'",
"%",
"self",
".",
"egg_dir",
"with",
"extend_sys_path",
"(",
"egg_name",
")",
":",
"with",
"self",
".",
"settings",
"(",
"INSTALLED_APPS",
"=",
"[",
"'omelet.app_with_models'",
"]",... | [
37,
4
] | [
44,
46
] | python | en | ['en', 'en', 'en'] | True |
EggLoadingTest.test_egg4 | (self) | Loading an app with no models from under the top-level egg package generates no error | Loading an app with no models from under the top-level egg package generates no error | def test_egg4(self):
"""Loading an app with no models from under the top-level egg package generates no error"""
egg_name = '%s/omelet.egg' % self.egg_dir
with extend_sys_path(egg_name):
with self.settings(INSTALLED_APPS=['omelet.app_no_models']):
models_module = apps... | [
"def",
"test_egg4",
"(",
"self",
")",
":",
"egg_name",
"=",
"'%s/omelet.egg'",
"%",
"self",
".",
"egg_dir",
"with",
"extend_sys_path",
"(",
"egg_name",
")",
":",
"with",
"self",
".",
"settings",
"(",
"INSTALLED_APPS",
"=",
"[",
"'omelet.app_no_models'",
"]",
... | [
46,
4
] | [
53,
44
] | python | en | ['en', 'en', 'en'] | True |
EggLoadingTest.test_egg5 | (self) | Loading an app from an egg that has an import error in its models module raises that error | Loading an app from an egg that has an import error in its models module raises that error | def test_egg5(self):
"""Loading an app from an egg that has an import error in its models module raises that error"""
egg_name = '%s/brokenapp.egg' % self.egg_dir
with extend_sys_path(egg_name):
with six.assertRaisesRegex(self, ImportError, 'modelz'):
with self.settin... | [
"def",
"test_egg5",
"(",
"self",
")",
":",
"egg_name",
"=",
"'%s/brokenapp.egg'",
"%",
"self",
".",
"egg_dir",
"with",
"extend_sys_path",
"(",
"egg_name",
")",
":",
"with",
"six",
".",
"assertRaisesRegex",
"(",
"self",
",",
"ImportError",
",",
"'modelz'",
")... | [
55,
4
] | [
61,
24
] | python | en | ['en', 'en', 'en'] | True |
Deserializer | (stream_or_string, **options) |
Deserialize a stream or string of JSON data.
|
Deserialize a stream or string of JSON data.
| def Deserializer(stream_or_string, **options):
"""
Deserialize a stream or string of JSON data.
"""
if not isinstance(stream_or_string, (bytes, six.string_types)):
stream_or_string = stream_or_string.read()
if isinstance(stream_or_string, bytes):
stream_or_string = stream_or_string.d... | [
"def",
"Deserializer",
"(",
"stream_or_string",
",",
"*",
"*",
"options",
")",
":",
"if",
"not",
"isinstance",
"(",
"stream_or_string",
",",
"(",
"bytes",
",",
"six",
".",
"string_types",
")",
")",
":",
"stream_or_string",
"=",
"stream_or_string",
".",
"read... | [
64,
0
] | [
80,
85
] | python | en | ['en', 'error', 'th'] | False |
arg_byref | (args, offset=-1) | Returns the pointer argument's by-reference value. | Returns the pointer argument's by-reference value. | def arg_byref(args, offset=-1):
"Returns the pointer argument's by-reference value."
return args[offset]._obj.value | [
"def",
"arg_byref",
"(",
"args",
",",
"offset",
"=",
"-",
"1",
")",
":",
"return",
"args",
"[",
"offset",
"]",
".",
"_obj",
".",
"value"
] | [
13,
0
] | [
15,
34
] | python | en | ['en', 'en', 'en'] | True |
ptr_byref | (args, offset=-1) | Returns the pointer argument passed in by-reference. | Returns the pointer argument passed in by-reference. | def ptr_byref(args, offset=-1):
"Returns the pointer argument passed in by-reference."
return args[offset]._obj | [
"def",
"ptr_byref",
"(",
"args",
",",
"offset",
"=",
"-",
"1",
")",
":",
"return",
"args",
"[",
"offset",
"]",
".",
"_obj"
] | [
18,
0
] | [
20,
28
] | python | en | ['en', 'en', 'en'] | True |
check_const_string | (result, func, cargs, offset=None) |
Similar functionality to `check_string`, but does not free the pointer.
|
Similar functionality to `check_string`, but does not free the pointer.
| def check_const_string(result, func, cargs, offset=None):
"""
Similar functionality to `check_string`, but does not free the pointer.
"""
if offset:
check_err(result)
ptr = ptr_byref(cargs, offset)
return ptr.value
else:
return result | [
"def",
"check_const_string",
"(",
"result",
",",
"func",
",",
"cargs",
",",
"offset",
"=",
"None",
")",
":",
"if",
"offset",
":",
"check_err",
"(",
"result",
")",
"ptr",
"=",
"ptr_byref",
"(",
"cargs",
",",
"offset",
")",
"return",
"ptr",
".",
"value",... | [
24,
0
] | [
33,
21
] | python | en | ['en', 'error', 'th'] | False |
check_string | (result, func, cargs, offset=-1, str_result=False) |
Checks the string output returned from the given function, and frees
the string pointer allocated by OGR. The `str_result` keyword
may be used when the result is the string pointer, otherwise
the OGR error code is assumed. The `offset` keyword may be used
to extract the string pointer passed in b... |
Checks the string output returned from the given function, and frees
the string pointer allocated by OGR. The `str_result` keyword
may be used when the result is the string pointer, otherwise
the OGR error code is assumed. The `offset` keyword may be used
to extract the string pointer passed in b... | def check_string(result, func, cargs, offset=-1, str_result=False):
"""
Checks the string output returned from the given function, and frees
the string pointer allocated by OGR. The `str_result` keyword
may be used when the result is the string pointer, otherwise
the OGR error code is assumed. The... | [
"def",
"check_string",
"(",
"result",
",",
"func",
",",
"cargs",
",",
"offset",
"=",
"-",
"1",
",",
"str_result",
"=",
"False",
")",
":",
"if",
"str_result",
":",
"# For routines that return a string.",
"ptr",
"=",
"result",
"if",
"not",
"ptr",
":",
"s",
... | [
36,
0
] | [
62,
12
] | python | en | ['en', 'error', 'th'] | False |
check_envelope | (result, func, cargs, offset=-1) | Checks a function that returns an OGR Envelope by reference. | Checks a function that returns an OGR Envelope by reference. | def check_envelope(result, func, cargs, offset=-1):
"Checks a function that returns an OGR Envelope by reference."
env = ptr_byref(cargs, offset)
return env | [
"def",
"check_envelope",
"(",
"result",
",",
"func",
",",
"cargs",
",",
"offset",
"=",
"-",
"1",
")",
":",
"env",
"=",
"ptr_byref",
"(",
"cargs",
",",
"offset",
")",
"return",
"env"
] | [
68,
0
] | [
71,
14
] | python | en | ['en', 'en', 'en'] | True |
check_geom | (result, func, cargs) | Checks a function that returns a geometry. | Checks a function that returns a geometry. | def check_geom(result, func, cargs):
"Checks a function that returns a geometry."
# OGR_G_Clone may return an integer, even though the
# restype is set to c_void_p
if isinstance(result, six.integer_types):
result = c_void_p(result)
if not result:
raise OGRException('Invalid geometry ... | [
"def",
"check_geom",
"(",
"result",
",",
"func",
",",
"cargs",
")",
":",
"# OGR_G_Clone may return an integer, even though the",
"# restype is set to c_void_p",
"if",
"isinstance",
"(",
"result",
",",
"six",
".",
"integer_types",
")",
":",
"result",
"=",
"c_void_p",
... | [
75,
0
] | [
83,
17
] | python | en | ['en', 'en', 'en'] | True |
check_geom_offset | (result, func, cargs, offset=-1) | Chcks the geometry at the given offset in the C parameter list. | Chcks the geometry at the given offset in the C parameter list. | def check_geom_offset(result, func, cargs, offset=-1):
"Chcks the geometry at the given offset in the C parameter list."
check_err(result)
geom = ptr_byref(cargs, offset=offset)
return check_geom(geom, func, cargs) | [
"def",
"check_geom_offset",
"(",
"result",
",",
"func",
",",
"cargs",
",",
"offset",
"=",
"-",
"1",
")",
":",
"check_err",
"(",
"result",
")",
"geom",
"=",
"ptr_byref",
"(",
"cargs",
",",
"offset",
"=",
"offset",
")",
"return",
"check_geom",
"(",
"geom... | [
86,
0
] | [
90,
40
] | python | en | ['en', 'en', 'en'] | True |
check_arg_errcode | (result, func, cargs) |
The error code is returned in the last argument, by reference.
Check its value with `check_err` before returning the result.
|
The error code is returned in the last argument, by reference.
Check its value with `check_err` before returning the result.
| def check_arg_errcode(result, func, cargs):
"""
The error code is returned in the last argument, by reference.
Check its value with `check_err` before returning the result.
"""
check_err(arg_byref(cargs))
return result | [
"def",
"check_arg_errcode",
"(",
"result",
",",
"func",
",",
"cargs",
")",
":",
"check_err",
"(",
"arg_byref",
"(",
"cargs",
")",
")",
"return",
"result"
] | [
103,
0
] | [
109,
17
] | python | en | ['en', 'error', 'th'] | False |
check_errcode | (result, func, cargs) |
Check the error code returned (c_int).
|
Check the error code returned (c_int).
| def check_errcode(result, func, cargs):
"""
Check the error code returned (c_int).
"""
check_err(result) | [
"def",
"check_errcode",
"(",
"result",
",",
"func",
",",
"cargs",
")",
":",
"check_err",
"(",
"result",
")"
] | [
112,
0
] | [
116,
21
] | python | en | ['en', 'error', 'th'] | False |
check_pointer | (result, func, cargs) | Makes sure the result pointer is valid. | Makes sure the result pointer is valid. | def check_pointer(result, func, cargs):
"Makes sure the result pointer is valid."
if isinstance(result, six.integer_types):
result = c_void_p(result)
if result:
return result
else:
raise OGRException('Invalid pointer returned from "%s"' % func.__name__) | [
"def",
"check_pointer",
"(",
"result",
",",
"func",
",",
"cargs",
")",
":",
"if",
"isinstance",
"(",
"result",
",",
"six",
".",
"integer_types",
")",
":",
"result",
"=",
"c_void_p",
"(",
"result",
")",
"if",
"result",
":",
"return",
"result",
"else",
"... | [
119,
0
] | [
126,
80
] | python | en | ['en', 'en', 'en'] | True |
check_str_arg | (result, func, cargs) |
This is for the OSRGet[Angular|Linear]Units functions, which
require that the returned string pointer not be freed. This
returns both the double and string values.
|
This is for the OSRGet[Angular|Linear]Units functions, which
require that the returned string pointer not be freed. This
returns both the double and string values.
| def check_str_arg(result, func, cargs):
"""
This is for the OSRGet[Angular|Linear]Units functions, which
require that the returned string pointer not be freed. This
returns both the double and string values.
"""
dbl = result
ptr = cargs[-1]._obj
return dbl, ptr.value.decode() | [
"def",
"check_str_arg",
"(",
"result",
",",
"func",
",",
"cargs",
")",
":",
"dbl",
"=",
"result",
"ptr",
"=",
"cargs",
"[",
"-",
"1",
"]",
".",
"_obj",
"return",
"dbl",
",",
"ptr",
".",
"value",
".",
"decode",
"(",
")"
] | [
129,
0
] | [
137,
34
] | python | en | ['en', 'error', 'th'] | False |
msvc9_find_vcvarsall | (version) |
Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone
compiler build for Python
(VCForPython / Microsoft Visual C++ Compiler for Python 2.7).
Fall back to original behavior when the standalone compiler is not
available.
Redirect the path of "vcvarsall.bat".
Parameters
... |
Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone
compiler build for Python
(VCForPython / Microsoft Visual C++ Compiler for Python 2.7). | def msvc9_find_vcvarsall(version):
"""
Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone
compiler build for Python
(VCForPython / Microsoft Visual C++ Compiler for Python 2.7).
Fall back to original behavior when the standalone compiler is not
available.
Redirect the p... | [
"def",
"msvc9_find_vcvarsall",
"(",
"version",
")",
":",
"vc_base",
"=",
"r'Software\\%sMicrosoft\\DevDiv\\VCForPython\\%0.1f'",
"key",
"=",
"vc_base",
"%",
"(",
"''",
",",
"version",
")",
"try",
":",
"# Per-user installs register the compiler path here",
"productdir",
"=... | [
65,
0
] | [
104,
55
] | python | en | ['en', 'error', 'th'] | False |
msvc9_query_vcvarsall | (ver, arch='x86', *args, **kwargs) |
Patched "distutils.msvc9compiler.query_vcvarsall" for support extra
Microsoft Visual C++ 9.0 and 10.0 compilers.
Set environment without use of "vcvarsall.bat".
Parameters
----------
ver: float
Required Microsoft Visual C++ version.
arch: str
Target architecture.
Retu... |
Patched "distutils.msvc9compiler.query_vcvarsall" for support extra
Microsoft Visual C++ 9.0 and 10.0 compilers. | def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs):
"""
Patched "distutils.msvc9compiler.query_vcvarsall" for support extra
Microsoft Visual C++ 9.0 and 10.0 compilers.
Set environment without use of "vcvarsall.bat".
Parameters
----------
ver: float
Required Microsoft Visu... | [
"def",
"msvc9_query_vcvarsall",
"(",
"ver",
",",
"arch",
"=",
"'x86'",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Try to get environment from vcvarsall.bat (Classical way)",
"try",
":",
"orig",
"=",
"get_unpatched",
"(",
"msvc9_query_vcvarsall",
")",
... | [
107,
0
] | [
142,
13
] | python | en | ['en', 'error', 'th'] | False |
_msvc14_find_vc2015 | () | Python 3.8 "distutils/_msvccompiler.py" backport | Python 3.8 "distutils/_msvccompiler.py" backport | def _msvc14_find_vc2015():
"""Python 3.8 "distutils/_msvccompiler.py" backport"""
try:
key = winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
r"Software\Microsoft\VisualStudio\SxS\VC7",
0,
winreg.KEY_READ | winreg.KEY_WOW64_32KEY
)
except OSError:
... | [
"def",
"_msvc14_find_vc2015",
"(",
")",
":",
"try",
":",
"key",
"=",
"winreg",
".",
"OpenKey",
"(",
"winreg",
".",
"HKEY_LOCAL_MACHINE",
",",
"r\"Software\\Microsoft\\VisualStudio\\SxS\\VC7\"",
",",
"0",
",",
"winreg",
".",
"KEY_READ",
"|",
"winreg",
".",
"KEY_W... | [
145,
0
] | [
172,
33
] | python | ceb | ['fi', 'ceb', 'en'] | False |
_msvc14_find_vc2017 | () | Python 3.8 "distutils/_msvccompiler.py" backport
Returns "15, path" based on the result of invoking vswhere.exe
If no install is found, returns "None, None"
The version is returned to avoid unnecessarily changing the function
result. It may be ignored when the path is not None.
If vswhere.exe is ... | Python 3.8 "distutils/_msvccompiler.py" backport | def _msvc14_find_vc2017():
"""Python 3.8 "distutils/_msvccompiler.py" backport
Returns "15, path" based on the result of invoking vswhere.exe
If no install is found, returns "None, None"
The version is returned to avoid unnecessarily changing the function
result. It may be ignored when the path is... | [
"def",
"_msvc14_find_vc2017",
"(",
")",
":",
"root",
"=",
"environ",
".",
"get",
"(",
"\"ProgramFiles(x86)\"",
")",
"or",
"environ",
".",
"get",
"(",
"\"ProgramFiles\"",
")",
"if",
"not",
"root",
":",
"return",
"None",
",",
"None",
"try",
":",
"path",
"=... | [
175,
0
] | [
207,
21
] | python | ceb | ['fi', 'ceb', 'en'] | False |
_msvc14_find_vcvarsall | (plat_spec) | Python 3.8 "distutils/_msvccompiler.py" backport | Python 3.8 "distutils/_msvccompiler.py" backport | def _msvc14_find_vcvarsall(plat_spec):
"""Python 3.8 "distutils/_msvccompiler.py" backport"""
_, best_dir = _msvc14_find_vc2017()
vcruntime = None
if plat_spec in PLAT_SPEC_TO_RUNTIME:
vcruntime_plat = PLAT_SPEC_TO_RUNTIME[plat_spec]
else:
vcruntime_plat = 'x64' if 'amd64' in plat_s... | [
"def",
"_msvc14_find_vcvarsall",
"(",
"plat_spec",
")",
":",
"_",
",",
"best_dir",
"=",
"_msvc14_find_vc2017",
"(",
")",
"vcruntime",
"=",
"None",
"if",
"plat_spec",
"in",
"PLAT_SPEC_TO_RUNTIME",
":",
"vcruntime_plat",
"=",
"PLAT_SPEC_TO_RUNTIME",
"[",
"plat_spec",
... | [
218,
0
] | [
254,
31
] | python | ceb | ['fi', 'ceb', 'en'] | False |
_msvc14_get_vc_env | (plat_spec) | Python 3.8 "distutils/_msvccompiler.py" backport | Python 3.8 "distutils/_msvccompiler.py" backport | def _msvc14_get_vc_env(plat_spec):
"""Python 3.8 "distutils/_msvccompiler.py" backport"""
if "DISTUTILS_USE_SDK" in environ:
return {
key.lower(): value
for key, value in environ.items()
}
vcvarsall, vcruntime = _msvc14_find_vcvarsall(plat_spec)
if not vcvarsall:... | [
"def",
"_msvc14_get_vc_env",
"(",
"plat_spec",
")",
":",
"if",
"\"DISTUTILS_USE_SDK\"",
"in",
"environ",
":",
"return",
"{",
"key",
".",
"lower",
"(",
")",
":",
"value",
"for",
"key",
",",
"value",
"in",
"environ",
".",
"items",
"(",
")",
"}",
"vcvarsall... | [
257,
0
] | [
290,
14
] | python | ceb | ['fi', 'ceb', 'en'] | False |
msvc14_get_vc_env | (plat_spec) |
Patched "distutils._msvccompiler._get_vc_env" for support extra
Microsoft Visual C++ 14.X compilers.
Set environment without use of "vcvarsall.bat".
Parameters
----------
plat_spec: str
Target architecture.
Return
------
dict
environment
|
Patched "distutils._msvccompiler._get_vc_env" for support extra
Microsoft Visual C++ 14.X compilers. | def msvc14_get_vc_env(plat_spec):
"""
Patched "distutils._msvccompiler._get_vc_env" for support extra
Microsoft Visual C++ 14.X compilers.
Set environment without use of "vcvarsall.bat".
Parameters
----------
plat_spec: str
Target architecture.
Return
------
dict
... | [
"def",
"msvc14_get_vc_env",
"(",
"plat_spec",
")",
":",
"# Always use backport from CPython 3.8",
"try",
":",
"return",
"_msvc14_get_vc_env",
"(",
"plat_spec",
")",
"except",
"distutils",
".",
"errors",
".",
"DistutilsPlatformError",
"as",
"exc",
":",
"_augment_exceptio... | [
293,
0
] | [
316,
13
] | python | en | ['en', 'error', 'th'] | False |
msvc14_gen_lib_options | (*args, **kwargs) |
Patched "distutils._msvccompiler.gen_lib_options" for fix
compatibility between "numpy.distutils" and "distutils._msvccompiler"
(for Numpy < 1.11.2)
|
Patched "distutils._msvccompiler.gen_lib_options" for fix
compatibility between "numpy.distutils" and "distutils._msvccompiler"
(for Numpy < 1.11.2)
| def msvc14_gen_lib_options(*args, **kwargs):
"""
Patched "distutils._msvccompiler.gen_lib_options" for fix
compatibility between "numpy.distutils" and "distutils._msvccompiler"
(for Numpy < 1.11.2)
"""
if "numpy.distutils" in sys.modules:
import numpy as np
if LegacyVersion(np.__... | [
"def",
"msvc14_gen_lib_options",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"numpy.distutils\"",
"in",
"sys",
".",
"modules",
":",
"import",
"numpy",
"as",
"np",
"if",
"LegacyVersion",
"(",
"np",
".",
"__version__",
")",
"<",
"LegacyVersi... | [
319,
0
] | [
329,
65
] | python | en | ['en', 'error', 'th'] | False |
_augment_exception | (exc, version, arch='') |
Add details to the exception message to help guide the user
as to what action will resolve it.
|
Add details to the exception message to help guide the user
as to what action will resolve it.
| def _augment_exception(exc, version, arch=''):
"""
Add details to the exception message to help guide the user
as to what action will resolve it.
"""
# Error if MSVC++ directory not found or environment not set
message = exc.args[0]
if "vcvarsall" in message.lower() or "visual c" in message... | [
"def",
"_augment_exception",
"(",
"exc",
",",
"version",
",",
"arch",
"=",
"''",
")",
":",
"# Error if MSVC++ directory not found or environment not set",
"message",
"=",
"exc",
".",
"args",
"[",
"0",
"]",
"if",
"\"vcvarsall\"",
"in",
"message",
".",
"lower",
"(... | [
332,
0
] | [
365,
26
] | python | en | ['en', 'error', 'th'] | False |
PlatformInfo.target_cpu | (self) |
Return Target CPU architecture.
Return
------
str
Target CPU
|
Return Target CPU architecture. | def target_cpu(self):
"""
Return Target CPU architecture.
Return
------
str
Target CPU
"""
return self.arch[self.arch.find('_') + 1:] | [
"def",
"target_cpu",
"(",
"self",
")",
":",
"return",
"self",
".",
"arch",
"[",
"self",
".",
"arch",
".",
"find",
"(",
"'_'",
")",
"+",
"1",
":",
"]"
] | [
383,
4
] | [
392,
50
] | python | en | ['en', 'error', 'th'] | False |
PlatformInfo.target_is_x86 | (self) |
Return True if target CPU is x86 32 bits..
Return
------
bool
CPU is x86 32 bits
|
Return True if target CPU is x86 32 bits.. | def target_is_x86(self):
"""
Return True if target CPU is x86 32 bits..
Return
------
bool
CPU is x86 32 bits
"""
return self.target_cpu == 'x86' | [
"def",
"target_is_x86",
"(",
"self",
")",
":",
"return",
"self",
".",
"target_cpu",
"==",
"'x86'"
] | [
394,
4
] | [
403,
39
] | python | en | ['en', 'error', 'th'] | False |
PlatformInfo.current_is_x86 | (self) |
Return True if current CPU is x86 32 bits..
Return
------
bool
CPU is x86 32 bits
|
Return True if current CPU is x86 32 bits.. | def current_is_x86(self):
"""
Return True if current CPU is x86 32 bits..
Return
------
bool
CPU is x86 32 bits
"""
return self.current_cpu == 'x86' | [
"def",
"current_is_x86",
"(",
"self",
")",
":",
"return",
"self",
".",
"current_cpu",
"==",
"'x86'"
] | [
405,
4
] | [
414,
40
] | python | en | ['en', 'error', 'th'] | False |
PlatformInfo.current_dir | (self, hidex86=False, x64=False) |
Current platform specific subfolder.
Parameters
----------
hidex86: bool
return '' and not '\x86' if architecture is x86.
x64: bool
return '\x64' and not '\amd64' if architecture is amd64.
Return
------
str
subfolder:... |
Current platform specific subfolder. | def current_dir(self, hidex86=False, x64=False):
"""
Current platform specific subfolder.
Parameters
----------
hidex86: bool
return '' and not '\x86' if architecture is x86.
x64: bool
return '\x64' and not '\amd64' if architecture is amd64.
... | [
"def",
"current_dir",
"(",
"self",
",",
"hidex86",
"=",
"False",
",",
"x64",
"=",
"False",
")",
":",
"return",
"(",
"''",
"if",
"(",
"self",
".",
"current_cpu",
"==",
"'x86'",
"and",
"hidex86",
")",
"else",
"r'\\x64'",
"if",
"(",
"self",
".",
"curren... | [
416,
4
] | [
436,
9
] | python | en | ['en', 'error', 'th'] | False |
PlatformInfo.target_dir | (self, hidex86=False, x64=False) | r"""
Target platform specific subfolder.
Parameters
----------
hidex86: bool
return '' and not '\x86' if architecture is x86.
x64: bool
return '\x64' and not '\amd64' if architecture is amd64.
Return
------
str
subfold... | r"""
Target platform specific subfolder. | def target_dir(self, hidex86=False, x64=False):
r"""
Target platform specific subfolder.
Parameters
----------
hidex86: bool
return '' and not '\x86' if architecture is x86.
x64: bool
return '\x64' and not '\amd64' if architecture is amd64.
... | [
"def",
"target_dir",
"(",
"self",
",",
"hidex86",
"=",
"False",
",",
"x64",
"=",
"False",
")",
":",
"return",
"(",
"''",
"if",
"(",
"self",
".",
"target_cpu",
"==",
"'x86'",
"and",
"hidex86",
")",
"else",
"r'\\x64'",
"if",
"(",
"self",
".",
"target_c... | [
438,
4
] | [
458,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
PlatformInfo.cross_dir | (self, forcex86=False) | r"""
Cross platform specific subfolder.
Parameters
----------
forcex86: bool
Use 'x86' as current architecture even if current architecture is
not x86.
Return
------
str
subfolder: '' if target architecture is current architec... | r"""
Cross platform specific subfolder. | def cross_dir(self, forcex86=False):
r"""
Cross platform specific subfolder.
Parameters
----------
forcex86: bool
Use 'x86' as current architecture even if current architecture is
not x86.
Return
------
str
subfolder: ... | [
"def",
"cross_dir",
"(",
"self",
",",
"forcex86",
"=",
"False",
")",
":",
"current",
"=",
"'x86'",
"if",
"forcex86",
"else",
"self",
".",
"current_cpu",
"return",
"(",
"''",
"if",
"self",
".",
"target_cpu",
"==",
"current",
"else",
"self",
".",
"target_d... | [
460,
4
] | [
480,
9
] | python | cy | ['en', 'cy', 'hi'] | False |
RegistryInfo.visualstudio | (self) |
Microsoft Visual Studio root registry key.
Return
------
str
Registry key
|
Microsoft Visual Studio root registry key. | def visualstudio(self):
"""
Microsoft Visual Studio root registry key.
Return
------
str
Registry key
"""
return 'VisualStudio' | [
"def",
"visualstudio",
"(",
"self",
")",
":",
"return",
"'VisualStudio'"
] | [
501,
4
] | [
510,
29
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.sxs | (self) |
Microsoft Visual Studio SxS registry key.
Return
------
str
Registry key
|
Microsoft Visual Studio SxS registry key. | def sxs(self):
"""
Microsoft Visual Studio SxS registry key.
Return
------
str
Registry key
"""
return join(self.visualstudio, 'SxS') | [
"def",
"sxs",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"visualstudio",
",",
"'SxS'",
")"
] | [
513,
4
] | [
522,
45
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.vc | (self) |
Microsoft Visual C++ VC7 registry key.
Return
------
str
Registry key
|
Microsoft Visual C++ VC7 registry key. | def vc(self):
"""
Microsoft Visual C++ VC7 registry key.
Return
------
str
Registry key
"""
return join(self.sxs, 'VC7') | [
"def",
"vc",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"sxs",
",",
"'VC7'",
")"
] | [
525,
4
] | [
534,
36
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.vs | (self) |
Microsoft Visual Studio VS7 registry key.
Return
------
str
Registry key
|
Microsoft Visual Studio VS7 registry key. | def vs(self):
"""
Microsoft Visual Studio VS7 registry key.
Return
------
str
Registry key
"""
return join(self.sxs, 'VS7') | [
"def",
"vs",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"sxs",
",",
"'VS7'",
")"
] | [
537,
4
] | [
546,
36
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.vc_for_python | (self) |
Microsoft Visual C++ for Python registry key.
Return
------
str
Registry key
|
Microsoft Visual C++ for Python registry key. | def vc_for_python(self):
"""
Microsoft Visual C++ for Python registry key.
Return
------
str
Registry key
"""
return r'DevDiv\VCForPython' | [
"def",
"vc_for_python",
"(",
"self",
")",
":",
"return",
"r'DevDiv\\VCForPython'"
] | [
549,
4
] | [
558,
36
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.microsoft_sdk | (self) |
Microsoft SDK registry key.
Return
------
str
Registry key
|
Microsoft SDK registry key. | def microsoft_sdk(self):
"""
Microsoft SDK registry key.
Return
------
str
Registry key
"""
return 'Microsoft SDKs' | [
"def",
"microsoft_sdk",
"(",
"self",
")",
":",
"return",
"'Microsoft SDKs'"
] | [
561,
4
] | [
570,
31
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.windows_sdk | (self) |
Microsoft Windows/Platform SDK registry key.
Return
------
str
Registry key
|
Microsoft Windows/Platform SDK registry key. | def windows_sdk(self):
"""
Microsoft Windows/Platform SDK registry key.
Return
------
str
Registry key
"""
return join(self.microsoft_sdk, 'Windows') | [
"def",
"windows_sdk",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"microsoft_sdk",
",",
"'Windows'",
")"
] | [
573,
4
] | [
582,
50
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.netfx_sdk | (self) |
Microsoft .NET Framework SDK registry key.
Return
------
str
Registry key
|
Microsoft .NET Framework SDK registry key. | def netfx_sdk(self):
"""
Microsoft .NET Framework SDK registry key.
Return
------
str
Registry key
"""
return join(self.microsoft_sdk, 'NETFXSDK') | [
"def",
"netfx_sdk",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"microsoft_sdk",
",",
"'NETFXSDK'",
")"
] | [
585,
4
] | [
594,
51
] | python | en | ['en', 'error', 'th'] | False |
RegistryInfo.windows_kits_roots | (self) |
Microsoft Windows Kits Roots registry key.
Return
------
str
Registry key
|
Microsoft Windows Kits Roots registry key. | def windows_kits_roots(self):
"""
Microsoft Windows Kits Roots registry key.
Return
------
str
Registry key
"""
return r'Windows Kits\Installed Roots' | [
"def",
"windows_kits_roots",
"(",
"self",
")",
":",
"return",
"r'Windows Kits\\Installed Roots'"
] | [
597,
4
] | [
606,
46
] | 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.