repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
funilrys/PyFunceble | PyFunceble/helpers.py | List.format | def format(self):
"""
Return a well formatted list. Basicaly, it's sort a list and remove duplicate.
:return: A sorted, without duplicate, list.
:rtype: list
"""
try:
return sorted(list(set(self.main_list)), key=str.lower)
except TypeError: # pragm... | python | def format(self):
"""
Return a well formatted list. Basicaly, it's sort a list and remove duplicate.
:return: A sorted, without duplicate, list.
:rtype: list
"""
try:
return sorted(list(set(self.main_list)), key=str.lower)
except TypeError: # pragm... | [
"def",
"format",
"(",
"self",
")",
":",
"try",
":",
"return",
"sorted",
"(",
"list",
"(",
"set",
"(",
"self",
".",
"main_list",
")",
")",
",",
"key",
"=",
"str",
".",
"lower",
")",
"except",
"TypeError",
":",
"# pragma: no cover",
"return",
"self",
"... | Return a well formatted list. Basicaly, it's sort a list and remove duplicate.
:return: A sorted, without duplicate, list.
:rtype: list | [
"Return",
"a",
"well",
"formatted",
"list",
".",
"Basicaly",
"it",
"s",
"sort",
"a",
"list",
"and",
"remove",
"duplicate",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L816-L828 | test | Return a well formatted list of all the available user s entries. |
funilrys/PyFunceble | PyFunceble/helpers.py | List.custom_format | def custom_format(self, key_method, reverse=False):
"""
Return a well formatted list. With the key_method as a function/method to format
the elements before sorting.
:param key_method:
A function or method to use to format the
readed element before sorting.
... | python | def custom_format(self, key_method, reverse=False):
"""
Return a well formatted list. With the key_method as a function/method to format
the elements before sorting.
:param key_method:
A function or method to use to format the
readed element before sorting.
... | [
"def",
"custom_format",
"(",
"self",
",",
"key_method",
",",
"reverse",
"=",
"False",
")",
":",
"try",
":",
"return",
"sorted",
"(",
"list",
"(",
"set",
"(",
"self",
".",
"main_list",
")",
")",
",",
"key",
"=",
"key_method",
",",
"reverse",
"=",
"rev... | Return a well formatted list. With the key_method as a function/method to format
the elements before sorting.
:param key_method:
A function or method to use to format the
readed element before sorting.
:type key_method: function|method
:param reverse: Tell us if... | [
"Return",
"a",
"well",
"formatted",
"list",
".",
"With",
"the",
"key_method",
"as",
"a",
"function",
"/",
"method",
"to",
"format",
"the",
"elements",
"before",
"sorting",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L830-L850 | test | Returns a well formatted list. |
funilrys/PyFunceble | PyFunceble/helpers.py | List.merge | def merge(self, to_merge, strict=True):
"""
Merge to_merge into the given main list.
:param to_merge: The list to merge.
:type to_merge: list
:param strict:
Tell us if we have to respect index (True)
or not (False).
:type strict: bool
:r... | python | def merge(self, to_merge, strict=True):
"""
Merge to_merge into the given main list.
:param to_merge: The list to merge.
:type to_merge: list
:param strict:
Tell us if we have to respect index (True)
or not (False).
:type strict: bool
:r... | [
"def",
"merge",
"(",
"self",
",",
"to_merge",
",",
"strict",
"=",
"True",
")",
":",
"# We initiate a variable which will save the",
"# result",
"result",
"=",
"[",
"]",
"if",
"strict",
":",
"# We are in strict mode.",
"for",
"index",
",",
"element",
"in",
"enume... | Merge to_merge into the given main list.
:param to_merge: The list to merge.
:type to_merge: list
:param strict:
Tell us if we have to respect index (True)
or not (False).
:type strict: bool
:return: The merged list.
:rtype: list | [
"Merge",
"to_merge",
"into",
"the",
"given",
"main",
"list",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L852-L925 | test | This method merges the given list into the main list. |
funilrys/PyFunceble | PyFunceble/helpers.py | Regex.not_matching_list | def not_matching_list(self):
"""
Return a list of string which don't match the
given regex.
"""
pre_result = comp(self.regex)
return [x for x in self.data if not pre_result.search(str(x))] | python | def not_matching_list(self):
"""
Return a list of string which don't match the
given regex.
"""
pre_result = comp(self.regex)
return [x for x in self.data if not pre_result.search(str(x))] | [
"def",
"not_matching_list",
"(",
"self",
")",
":",
"pre_result",
"=",
"comp",
"(",
"self",
".",
"regex",
")",
"return",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"data",
"if",
"not",
"pre_result",
".",
"search",
"(",
"str",
"(",
"x",
")",
")",
"]"
] | Return a list of string which don't match the
given regex. | [
"Return",
"a",
"list",
"of",
"string",
"which",
"don",
"t",
"match",
"the",
"given",
"regex",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L985-L993 | test | Return a list of string which don t match the
given regex. |
funilrys/PyFunceble | PyFunceble/helpers.py | Regex.match | def match(self):
"""
Used to get exploitable result of re.search
:return: The data of the match status.
:rtype: mixed
"""
# We initate this variable which gonna contain the returned data
result = []
# We compile the regex string
to_match = comp(... | python | def match(self):
"""
Used to get exploitable result of re.search
:return: The data of the match status.
:rtype: mixed
"""
# We initate this variable which gonna contain the returned data
result = []
# We compile the regex string
to_match = comp(... | [
"def",
"match",
"(",
"self",
")",
":",
"# We initate this variable which gonna contain the returned data",
"result",
"=",
"[",
"]",
"# We compile the regex string",
"to_match",
"=",
"comp",
"(",
"self",
".",
"regex",
")",
"# In case we have to use the implementation of ${BASH... | Used to get exploitable result of re.search
:return: The data of the match status.
:rtype: mixed | [
"Used",
"to",
"get",
"exploitable",
"result",
"of",
"re",
".",
"search"
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L1005-L1047 | test | Returns the data of the match status. |
funilrys/PyFunceble | PyFunceble/helpers.py | Regex.replace | def replace(self):
"""
Used to replace a matched string with another.
:return: The data after replacement.
:rtype: str
"""
if self.replace_with: # pylint: disable=no-member
return substrings(
self.regex,
self.replace_with, #... | python | def replace(self):
"""
Used to replace a matched string with another.
:return: The data after replacement.
:rtype: str
"""
if self.replace_with: # pylint: disable=no-member
return substrings(
self.regex,
self.replace_with, #... | [
"def",
"replace",
"(",
"self",
")",
":",
"if",
"self",
".",
"replace_with",
":",
"# pylint: disable=no-member",
"return",
"substrings",
"(",
"self",
".",
"regex",
",",
"self",
".",
"replace_with",
",",
"# pylint: disable=no-member",
"self",
".",
"data",
",",
"... | Used to replace a matched string with another.
:return: The data after replacement.
:rtype: str | [
"Used",
"to",
"replace",
"a",
"matched",
"string",
"with",
"another",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L1049-L1065 | test | Used to replace a matched string with another. |
funilrys/PyFunceble | PyFunceble/helpers.py | Download.text | def text(self):
"""
Download the given link and return or save its :code:`requests.text`
at the given destination.
:rtype: mixed
:raises:
:code:`Exception`
If the status code is not :code:`200`.
"""
try:
# We request the ... | python | def text(self):
"""
Download the given link and return or save its :code:`requests.text`
at the given destination.
:rtype: mixed
:raises:
:code:`Exception`
If the status code is not :code:`200`.
"""
try:
# We request the ... | [
"def",
"text",
"(",
"self",
")",
":",
"try",
":",
"# We request the link.",
"req",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"link",
",",
"verify",
"=",
"self",
".",
"verification",
")",
"if",
"req",
".",
"status_code",
"==",
"200",
":",
"# The re... | Download the given link and return or save its :code:`requests.text`
at the given destination.
:rtype: mixed
:raises:
:code:`Exception`
If the status code is not :code:`200`. | [
"Download",
"the",
"given",
"link",
"and",
"return",
"or",
"save",
"its",
":",
"code",
":",
"requests",
".",
"text",
"at",
"the",
"given",
"destination",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L1108-L1145 | test | Download the given link and return or save its content at the given destination. |
funilrys/PyFunceble | PyFunceble/percentage.py | Percentage.count | def count(self):
"""
Count the number of domain for each status.
"""
if self.status:
# The status is parsed.
# We increase the number of tested.
PyFunceble.INTERN["counter"]["number"]["tested"] += 1
if (
self.status.lower... | python | def count(self):
"""
Count the number of domain for each status.
"""
if self.status:
# The status is parsed.
# We increase the number of tested.
PyFunceble.INTERN["counter"]["number"]["tested"] += 1
if (
self.status.lower... | [
"def",
"count",
"(",
"self",
")",
":",
"if",
"self",
".",
"status",
":",
"# The status is parsed.",
"# We increase the number of tested.",
"PyFunceble",
".",
"INTERN",
"[",
"\"counter\"",
"]",
"[",
"\"number\"",
"]",
"[",
"\"tested\"",
"]",
"+=",
"1",
"if",
"(... | Count the number of domain for each status. | [
"Count",
"the",
"number",
"of",
"domain",
"for",
"each",
"status",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/percentage.py#L96-L124 | test | Count the number of domain for each status. |
funilrys/PyFunceble | PyFunceble/percentage.py | Percentage._calculate | def _calculate(cls):
"""
Calculate the percentage of each status.
"""
# We map the current state/counters of the different status.
percentages = {
"up": PyFunceble.INTERN["counter"]["number"]["up"],
"down": PyFunceble.INTERN["counter"]["number"]["down"],
... | python | def _calculate(cls):
"""
Calculate the percentage of each status.
"""
# We map the current state/counters of the different status.
percentages = {
"up": PyFunceble.INTERN["counter"]["number"]["up"],
"down": PyFunceble.INTERN["counter"]["number"]["down"],
... | [
"def",
"_calculate",
"(",
"cls",
")",
":",
"# We map the current state/counters of the different status.",
"percentages",
"=",
"{",
"\"up\"",
":",
"PyFunceble",
".",
"INTERN",
"[",
"\"counter\"",
"]",
"[",
"\"number\"",
"]",
"[",
"\"up\"",
"]",
",",
"\"down\"",
":... | Calculate the percentage of each status. | [
"Calculate",
"the",
"percentage",
"of",
"each",
"status",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/percentage.py#L127-L150 | test | Calculate the percentage of each status. |
funilrys/PyFunceble | PyFunceble/percentage.py | Percentage.log | def log(self):
"""
Print on screen and on file the percentages for each status.
"""
if (
PyFunceble.CONFIGURATION["show_percentage"]
and PyFunceble.INTERN["counter"]["number"]["tested"] > 0
):
# * We are allowed to show the percentage on scree... | python | def log(self):
"""
Print on screen and on file the percentages for each status.
"""
if (
PyFunceble.CONFIGURATION["show_percentage"]
and PyFunceble.INTERN["counter"]["number"]["tested"] > 0
):
# * We are allowed to show the percentage on scree... | [
"def",
"log",
"(",
"self",
")",
":",
"if",
"(",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"show_percentage\"",
"]",
"and",
"PyFunceble",
".",
"INTERN",
"[",
"\"counter\"",
"]",
"[",
"\"number\"",
"]",
"[",
"\"tested\"",
"]",
">",
"0",
")",
":",
"# * We ... | Print on screen and on file the percentages for each status. | [
"Print",
"on",
"screen",
"and",
"on",
"file",
"the",
"percentages",
"for",
"each",
"status",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/percentage.py#L152-L233 | test | Print on screen and on file the percentage of each status. |
funilrys/PyFunceble | PyFunceble/check.py | Check.is_url_valid | def is_url_valid(self, url=None, return_base=False, return_formatted=False):
"""
Check if the given URL is valid.
:param url: The url to validate.
:type url: str
:param return_base:
Allow us the return of the url base (if URL formatted correctly).
:type retu... | python | def is_url_valid(self, url=None, return_base=False, return_formatted=False):
"""
Check if the given URL is valid.
:param url: The url to validate.
:type url: str
:param return_base:
Allow us the return of the url base (if URL formatted correctly).
:type retu... | [
"def",
"is_url_valid",
"(",
"self",
",",
"url",
"=",
"None",
",",
"return_base",
"=",
"False",
",",
"return_formatted",
"=",
"False",
")",
":",
"# We initiate a variable which will save the initial base in case",
"# we have to convert the base to IDNA.",
"initial_base",
"="... | Check if the given URL is valid.
:param url: The url to validate.
:type url: str
:param return_base:
Allow us the return of the url base (if URL formatted correctly).
:type return_formatted: bool
:param return_formatted:
Allow us to get the URL converte... | [
"Check",
"if",
"the",
"given",
"URL",
"is",
"valid",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L83-L194 | test | Check if the given URL is valid. |
funilrys/PyFunceble | PyFunceble/check.py | Check.is_domain_valid | def is_domain_valid(
self, domain=None, subdomain_check=False
): # pylint:disable=too-many-return-statements, too-many-branches
"""
Check if the given domain is a valid.
:param domain: The domain to validate.
:type domain: str
:param subdomain_check:
Ac... | python | def is_domain_valid(
self, domain=None, subdomain_check=False
): # pylint:disable=too-many-return-statements, too-many-branches
"""
Check if the given domain is a valid.
:param domain: The domain to validate.
:type domain: str
:param subdomain_check:
Ac... | [
"def",
"is_domain_valid",
"(",
"self",
",",
"domain",
"=",
"None",
",",
"subdomain_check",
"=",
"False",
")",
":",
"# pylint:disable=too-many-return-statements, too-many-branches",
"# We initate our regex which will match for valid domains.",
"regex_valid_domains",
"=",
"r\"^(?=.... | Check if the given domain is a valid.
:param domain: The domain to validate.
:type domain: str
:param subdomain_check:
Activate the subdomain checking.
:type subdomain_check: bool
:return: The validity of the sub-domain.
:rtype: bool | [
"Check",
"if",
"the",
"given",
"domain",
"is",
"a",
"valid",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L196-L350 | test | Checks if the given domain is a valid sub - domain. |
funilrys/PyFunceble | PyFunceble/check.py | Check.is_subdomain | def is_subdomain(self, domain=None):
"""
Check if the given subdomain is a subdomain.
:param domain: The domain to validate.
:type domain: str
:return: The validity of the subdomain.
:rtype: bool
"""
if domain:
# A domain is given.
... | python | def is_subdomain(self, domain=None):
"""
Check if the given subdomain is a subdomain.
:param domain: The domain to validate.
:type domain: str
:return: The validity of the subdomain.
:rtype: bool
"""
if domain:
# A domain is given.
... | [
"def",
"is_subdomain",
"(",
"self",
",",
"domain",
"=",
"None",
")",
":",
"if",
"domain",
":",
"# A domain is given.",
"# We set the element to test as the parsed domain.",
"to_test",
"=",
"domain",
"elif",
"self",
".",
"element",
":",
"# A domain is globally given.",
... | Check if the given subdomain is a subdomain.
:param domain: The domain to validate.
:type domain: str
:return: The validity of the subdomain.
:rtype: bool | [
"Check",
"if",
"the",
"given",
"subdomain",
"is",
"a",
"subdomain",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L352-L380 | test | Check if the given domain is a subdomain. |
funilrys/PyFunceble | PyFunceble/check.py | Check.is_ip_valid | def is_ip_valid(self, ip_to_check=None):
"""
Check if the given IP is a valid IPv4.
:param ip_to_check: The IP to test.
:type ip_to_check: str
:return: The validity of the IP.
:rtype: bool
.. note::
We only test IPv4 because for now we only them for... | python | def is_ip_valid(self, ip_to_check=None):
"""
Check if the given IP is a valid IPv4.
:param ip_to_check: The IP to test.
:type ip_to_check: str
:return: The validity of the IP.
:rtype: bool
.. note::
We only test IPv4 because for now we only them for... | [
"def",
"is_ip_valid",
"(",
"self",
",",
"ip_to_check",
"=",
"None",
")",
":",
"# We initate our regex which will match for valid IPv4.",
"regex_ipv4",
"=",
"r\"^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-... | Check if the given IP is a valid IPv4.
:param ip_to_check: The IP to test.
:type ip_to_check: str
:return: The validity of the IP.
:rtype: bool
.. note::
We only test IPv4 because for now we only them for now. | [
"Check",
"if",
"the",
"given",
"IP",
"is",
"a",
"valid",
"IPv4",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L382-L418 | test | Check if the given IP is a valid IPv4. |
funilrys/PyFunceble | PyFunceble/check.py | Check.is_ip_range | def is_ip_range(self, ip_to_check=None):
"""
Check if the given IP is a valid IPv4.
:param ip_to_check: The IP to test.
:type ip_to_check: str
:return: The validity of the IP.
:rtype: bool
.. note::
We only test IPv4 because for now we only them for... | python | def is_ip_range(self, ip_to_check=None):
"""
Check if the given IP is a valid IPv4.
:param ip_to_check: The IP to test.
:type ip_to_check: str
:return: The validity of the IP.
:rtype: bool
.. note::
We only test IPv4 because for now we only them for... | [
"def",
"is_ip_range",
"(",
"self",
",",
"ip_to_check",
"=",
"None",
")",
":",
"if",
"ip_to_check",
":",
"# An element is localy given.",
"# We consider it as the element to test.",
"to_test",
"=",
"ip_to_check",
"elif",
"self",
".",
"element",
":",
"# An element is give... | Check if the given IP is a valid IPv4.
:param ip_to_check: The IP to test.
:type ip_to_check: str
:return: The validity of the IP.
:rtype: bool
.. note::
We only test IPv4 because for now we only them for now. | [
"Check",
"if",
"the",
"given",
"IP",
"is",
"a",
"valid",
"IPv4",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L420-L458 | test | Check if the given IP is a valid IPv4 range. |
funilrys/PyFunceble | PyFunceble/syntax.py | Syntax.get | def get(cls):
"""
Execute the logic behind the Syntax handling.
:return: The syntax status.
:rtype: str
"""
if PyFunceble.INTERN["to_test_type"] == "domain":
# We are testing for domain or ip.
if Check().is_domain_valid() or Check().is_ip_valid(... | python | def get(cls):
"""
Execute the logic behind the Syntax handling.
:return: The syntax status.
:rtype: str
"""
if PyFunceble.INTERN["to_test_type"] == "domain":
# We are testing for domain or ip.
if Check().is_domain_valid() or Check().is_ip_valid(... | [
"def",
"get",
"(",
"cls",
")",
":",
"if",
"PyFunceble",
".",
"INTERN",
"[",
"\"to_test_type\"",
"]",
"==",
"\"domain\"",
":",
"# We are testing for domain or ip.",
"if",
"Check",
"(",
")",
".",
"is_domain_valid",
"(",
")",
"or",
"Check",
"(",
")",
".",
"is... | Execute the logic behind the Syntax handling.
:return: The syntax status.
:rtype: str | [
"Execute",
"the",
"logic",
"behind",
"the",
"Syntax",
"handling",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/syntax.py#L74-L104 | test | Execute the logic behind the Syntax handling. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive._reformat_historical_formating_error | def _reformat_historical_formating_error(self): # pragma: no cover
"""
Format the old format so it can be merged into the newer format.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We construct the possible path... | python | def _reformat_historical_formating_error(self): # pragma: no cover
"""
Format the old format so it can be merged into the newer format.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We construct the possible path... | [
"def",
"_reformat_historical_formating_error",
"(",
"self",
")",
":",
"# pragma: no cover",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"# We construct the possible path to an older version of the databas... | Format the old format so it can be merged into the newer format. | [
"Format",
"the",
"old",
"format",
"so",
"it",
"can",
"be",
"merged",
"into",
"the",
"newer",
"format",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L112-L184 | test | Reformat the historical formating error into the new format. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive._merge | def _merge(self):
"""
Merge the real database with the older one which
has already been set into :code:`PyFunceble.INTERN["inactive_db"]`
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We get the content of... | python | def _merge(self):
"""
Merge the real database with the older one which
has already been set into :code:`PyFunceble.INTERN["inactive_db"]`
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We get the content of... | [
"def",
"_merge",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"# We get the content of the database.",
"database_content",
"=",
"Dict",
"(",
")",
".",
"from_json",
"(",... | Merge the real database with the older one which
has already been set into :code:`PyFunceble.INTERN["inactive_db"]` | [
"Merge",
"the",
"real",
"database",
"with",
"the",
"older",
"one",
"which",
"has",
"already",
"been",
"set",
"into",
":",
"code",
":",
"PyFunceble",
".",
"INTERN",
"[",
"inactive_db",
"]"
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L186-L251 | test | Merge the real database with the older one which has already been set into the inactive database. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive._retrieve | def _retrieve(self):
"""
Return the current content of the inactive-db.json file.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We get, format and initiate the historical database file.
self._reformat_... | python | def _retrieve(self):
"""
Return the current content of the inactive-db.json file.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We get, format and initiate the historical database file.
self._reformat_... | [
"def",
"_retrieve",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"# We get, format and initiate the historical database file.",
"self",
".",
"_reformat_historical_formating_error... | Return the current content of the inactive-db.json file. | [
"Return",
"the",
"current",
"content",
"of",
"the",
"inactive",
"-",
"db",
".",
"json",
"file",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L253-L268 | test | Retrieve the current content of the inactive - db. json file. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive._backup | def _backup(self):
"""
Save the current database into the inactive-db.json file.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We save the current database state into the database file.
Dict(PyFunceble... | python | def _backup(self):
"""
Save the current database into the inactive-db.json file.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We save the current database state into the database file.
Dict(PyFunceble... | [
"def",
"_backup",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"# We save the current database state into the database file.",
"Dict",
"(",
"PyFunceble",
".",
"INTERN",
"["... | Save the current database into the inactive-db.json file. | [
"Save",
"the",
"current",
"database",
"into",
"the",
"inactive",
"-",
"db",
".",
"json",
"file",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L270-L279 | test | Backup the current database into the inactive - db. json file. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive._timestamp | def _timestamp(self):
"""
Get the timestamp where we are going to save our current list.
:return: The timestamp to append with the currently tested element.
:rtype: int|str
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is act... | python | def _timestamp(self):
"""
Get the timestamp where we are going to save our current list.
:return: The timestamp to append with the currently tested element.
:rtype: int|str
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is act... | [
"def",
"_timestamp",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"if",
"(",
"\"inactive_db\"",
"in",
"PyFunceble",
".",
"INTERN",
"and",
"PyFunceble",
".",
"INTERN... | Get the timestamp where we are going to save our current list.
:return: The timestamp to append with the currently tested element.
:rtype: int|str | [
"Get",
"the",
"timestamp",
"where",
"we",
"are",
"going",
"to",
"save",
"our",
"current",
"list",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L408-L466 | test | Return the timestamp where we are going to save our current list. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive.add | def add(self):
"""
Save the current :code.`PyFunceble.CONFIGURATION['to_test']`
into the current timestamp.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We get the timestamp to use as index.
t... | python | def add(self):
"""
Save the current :code.`PyFunceble.CONFIGURATION['to_test']`
into the current timestamp.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
# We get the timestamp to use as index.
t... | [
"def",
"add",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"# We get the timestamp to use as index.",
"timestamp",
"=",
"str",
"(",
"self",
".",
"_timestamp",
"(",
")... | Save the current :code.`PyFunceble.CONFIGURATION['to_test']`
into the current timestamp. | [
"Save",
"the",
"current",
":",
"code",
".",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"to_test",
"]",
"into",
"the",
"current",
"timestamp",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L468-L550 | test | Add the current time to the database. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive.remove | def remove(self):
"""
Remove all occurence of :code:`PyFunceble.CONFIGURATION['to_test']`
from the database.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
if PyFunceble.INTERN["file_to_test"] in PyFunceble.I... | python | def remove(self):
"""
Remove all occurence of :code:`PyFunceble.CONFIGURATION['to_test']`
from the database.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
if PyFunceble.INTERN["file_to_test"] in PyFunceble.I... | [
"def",
"remove",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"if",
"PyFunceble",
".",
"INTERN",
"[",
"\"file_to_test\"",
"]",
"in",
"PyFunceble",
".",
"INTERN",
... | Remove all occurence of :code:`PyFunceble.CONFIGURATION['to_test']`
from the database. | [
"Remove",
"all",
"occurence",
"of",
":",
"code",
":",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"to_test",
"]",
"from",
"the",
"database",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L552-L583 | test | Removes all occurence of to_test from the database. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive.content | def content(cls):
"""
Get the content of the database.
:return: The content of the database.
:rtype: list
"""
# We initiate a variable which will save what we are going to return.
result = []
if (
PyFunceble.CONFIGURATION["inactive_database"... | python | def content(cls):
"""
Get the content of the database.
:return: The content of the database.
:rtype: list
"""
# We initiate a variable which will save what we are going to return.
result = []
if (
PyFunceble.CONFIGURATION["inactive_database"... | [
"def",
"content",
"(",
"cls",
")",
":",
"# We initiate a variable which will save what we are going to return.",
"result",
"=",
"[",
"]",
"if",
"(",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
"and",
"PyFunceble",
".",
"INTERN",
"[",
"\"inac... | Get the content of the database.
:return: The content of the database.
:rtype: list | [
"Get",
"the",
"content",
"of",
"the",
"database",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L586-L624 | test | Get the content of the database. |
funilrys/PyFunceble | PyFunceble/database.py | Inactive.is_present | def is_present(cls):
"""
Check if the currently tested element is into the database.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
if PyFunceble.INTERN["to_test"] in PyFunceble.INTERN[
"flatten_inact... | python | def is_present(cls):
"""
Check if the currently tested element is into the database.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
if PyFunceble.INTERN["to_test"] in PyFunceble.INTERN[
"flatten_inact... | [
"def",
"is_present",
"(",
"cls",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"if",
"PyFunceble",
".",
"INTERN",
"[",
"\"to_test\"",
"]",
"in",
"PyFunceble",
".",
"INTERN",
"[... | Check if the currently tested element is into the database. | [
"Check",
"if",
"the",
"currently",
"tested",
"element",
"is",
"into",
"the",
"database",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L627-L649 | test | Check if the currently tested element is into the database. |
funilrys/PyFunceble | PyFunceble/database.py | Whois._retrieve | def _retrieve(self):
"""
Retrieve the data from the database.
"""
if self._authorization() and "whois_db" not in PyFunceble.INTERN:
# The usage of the whois database is activated.
if PyFunceble.path.isfile(self.whois_db_path):
# The database file... | python | def _retrieve(self):
"""
Retrieve the data from the database.
"""
if self._authorization() and "whois_db" not in PyFunceble.INTERN:
# The usage of the whois database is activated.
if PyFunceble.path.isfile(self.whois_db_path):
# The database file... | [
"def",
"_retrieve",
"(",
"self",
")",
":",
"if",
"self",
".",
"_authorization",
"(",
")",
"and",
"\"whois_db\"",
"not",
"in",
"PyFunceble",
".",
"INTERN",
":",
"# The usage of the whois database is activated.",
"if",
"PyFunceble",
".",
"path",
".",
"isfile",
"("... | Retrieve the data from the database. | [
"Retrieve",
"the",
"data",
"from",
"the",
"database",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L726-L745 | test | Retrieve the data from the database. |
funilrys/PyFunceble | PyFunceble/database.py | Whois._backup | def _backup(self):
"""
Backup the database into its file.
"""
if self._authorization():
# We are authorized to work.
# We backup the current state of the datbase.
Dict(PyFunceble.INTERN["whois_db"]).to_json(self.whois_db_path) | python | def _backup(self):
"""
Backup the database into its file.
"""
if self._authorization():
# We are authorized to work.
# We backup the current state of the datbase.
Dict(PyFunceble.INTERN["whois_db"]).to_json(self.whois_db_path) | [
"def",
"_backup",
"(",
"self",
")",
":",
"if",
"self",
".",
"_authorization",
"(",
")",
":",
"# We are authorized to work.",
"# We backup the current state of the datbase.",
"Dict",
"(",
"PyFunceble",
".",
"INTERN",
"[",
"\"whois_db\"",
"]",
")",
".",
"to_json",
"... | Backup the database into its file. | [
"Backup",
"the",
"database",
"into",
"its",
"file",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L747-L756 | test | Backup the database into its file. |
funilrys/PyFunceble | PyFunceble/database.py | Whois.is_in_database | def is_in_database(self):
"""
Check if the element is into the database.
"""
if (
self._authorization()
and PyFunceble.INTERN["file_to_test"] in PyFunceble.INTERN["whois_db"]
and PyFunceble.INTERN["to_test"]
in PyFunceble.INTERN["whois_db"... | python | def is_in_database(self):
"""
Check if the element is into the database.
"""
if (
self._authorization()
and PyFunceble.INTERN["file_to_test"] in PyFunceble.INTERN["whois_db"]
and PyFunceble.INTERN["to_test"]
in PyFunceble.INTERN["whois_db"... | [
"def",
"is_in_database",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_authorization",
"(",
")",
"and",
"PyFunceble",
".",
"INTERN",
"[",
"\"file_to_test\"",
"]",
"in",
"PyFunceble",
".",
"INTERN",
"[",
"\"whois_db\"",
"]",
"and",
"PyFunceble",
".",
"IN... | Check if the element is into the database. | [
"Check",
"if",
"the",
"element",
"is",
"into",
"the",
"database",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L758-L787 | test | Check if the element is in the database. |
funilrys/PyFunceble | PyFunceble/database.py | Whois.is_time_older | def is_time_older(self):
"""
Check if the current time is older than the one in the database.
"""
if (
self._authorization()
and self.is_in_database()
and int(
PyFunceble.INTERN["whois_db"][PyFunceble.INTERN["file_to_test"]][
... | python | def is_time_older(self):
"""
Check if the current time is older than the one in the database.
"""
if (
self._authorization()
and self.is_in_database()
and int(
PyFunceble.INTERN["whois_db"][PyFunceble.INTERN["file_to_test"]][
... | [
"def",
"is_time_older",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_authorization",
"(",
")",
"and",
"self",
".",
"is_in_database",
"(",
")",
"and",
"int",
"(",
"PyFunceble",
".",
"INTERN",
"[",
"\"whois_db\"",
"]",
"[",
"PyFunceble",
".",
"INTERN",... | Check if the current time is older than the one in the database. | [
"Check",
"if",
"the",
"current",
"time",
"is",
"older",
"than",
"the",
"one",
"in",
"the",
"database",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L789-L814 | test | Check if the current time is older than the one in the database. |
funilrys/PyFunceble | PyFunceble/database.py | Whois.get_expiration_date | def get_expiration_date(self):
"""
Get the expiration date from the database.
:return: The expiration date from the database.
:rtype: str|None
"""
if self._authorization() and self.is_in_database() and not self.is_time_older():
# * We are authorized to work.... | python | def get_expiration_date(self):
"""
Get the expiration date from the database.
:return: The expiration date from the database.
:rtype: str|None
"""
if self._authorization() and self.is_in_database() and not self.is_time_older():
# * We are authorized to work.... | [
"def",
"get_expiration_date",
"(",
"self",
")",
":",
"if",
"self",
".",
"_authorization",
"(",
")",
"and",
"self",
".",
"is_in_database",
"(",
")",
"and",
"not",
"self",
".",
"is_time_older",
"(",
")",
":",
"# * We are authorized to work.",
"# and",
"# * The e... | Get the expiration date from the database.
:return: The expiration date from the database.
:rtype: str|None | [
"Get",
"the",
"expiration",
"date",
"from",
"the",
"database",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L816-L844 | test | Get the expiration date from the database. |
funilrys/PyFunceble | PyFunceble/database.py | Whois.add | def add(self):
"""
Add the currently tested element into the database.
"""
if self._authorization():
# We are authorized to work.
if self.epoch < int(PyFunceble.time()):
state = "past"
else:
state = "future"
... | python | def add(self):
"""
Add the currently tested element into the database.
"""
if self._authorization():
# We are authorized to work.
if self.epoch < int(PyFunceble.time()):
state = "past"
else:
state = "future"
... | [
"def",
"add",
"(",
"self",
")",
":",
"if",
"self",
".",
"_authorization",
"(",
")",
":",
"# We are authorized to work.",
"if",
"self",
".",
"epoch",
"<",
"int",
"(",
"PyFunceble",
".",
"time",
"(",
")",
")",
":",
"state",
"=",
"\"past\"",
"else",
":",
... | Add the currently tested element into the database. | [
"Add",
"the",
"currently",
"tested",
"element",
"into",
"the",
"database",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L846-L938 | test | Add the currently tested element into the database. |
funilrys/PyFunceble | PyFunceble/auto_save.py | AutoSave.travis_permissions | def travis_permissions(cls):
"""
Set permissions in order to avoid issues before commiting.
"""
if PyFunceble.CONFIGURATION["travis"]:
try:
build_dir = PyFunceble.environ["TRAVIS_BUILD_DIR"]
commands = [
"sudo chown -R trav... | python | def travis_permissions(cls):
"""
Set permissions in order to avoid issues before commiting.
"""
if PyFunceble.CONFIGURATION["travis"]:
try:
build_dir = PyFunceble.environ["TRAVIS_BUILD_DIR"]
commands = [
"sudo chown -R trav... | [
"def",
"travis_permissions",
"(",
"cls",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"travis\"",
"]",
":",
"try",
":",
"build_dir",
"=",
"PyFunceble",
".",
"environ",
"[",
"\"TRAVIS_BUILD_DIR\"",
"]",
"commands",
"=",
"[",
"\"sudo chown -R travis:... | Set permissions in order to avoid issues before commiting. | [
"Set",
"permissions",
"in",
"order",
"to",
"avoid",
"issues",
"before",
"commiting",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/auto_save.py#L93-L116 | test | Set permissions for the travis project. |
funilrys/PyFunceble | PyFunceble/auto_save.py | AutoSave._travis | def _travis(self):
"""
Logic behind autosave under Travis CI.
"""
if PyFunceble.CONFIGURATION["travis"]:
try:
_ = PyFunceble.environ["TRAVIS_BUILD_DIR"]
time_autorisation = False
try:
time_autorisation = in... | python | def _travis(self):
"""
Logic behind autosave under Travis CI.
"""
if PyFunceble.CONFIGURATION["travis"]:
try:
_ = PyFunceble.environ["TRAVIS_BUILD_DIR"]
time_autorisation = False
try:
time_autorisation = in... | [
"def",
"_travis",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"travis\"",
"]",
":",
"try",
":",
"_",
"=",
"PyFunceble",
".",
"environ",
"[",
"\"TRAVIS_BUILD_DIR\"",
"]",
"time_autorisation",
"=",
"False",
"try",
":",
"time_autoris... | Logic behind autosave under Travis CI. | [
"Logic",
"behind",
"autosave",
"under",
"Travis",
"CI",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/auto_save.py#L118-L180 | test | This function is called by the travis daemon when the application is running in Travis CI. |
funilrys/PyFunceble | PyFunceble/lookup.py | Lookup.nslookup | def nslookup(cls):
"""
Implementation of UNIX nslookup.
"""
try:
# We try to get the addresse information of the given domain or IP.
if "current_test_data" in PyFunceble.INTERN: # pragma: no cover
# The end-user want more information whith his t... | python | def nslookup(cls):
"""
Implementation of UNIX nslookup.
"""
try:
# We try to get the addresse information of the given domain or IP.
if "current_test_data" in PyFunceble.INTERN: # pragma: no cover
# The end-user want more information whith his t... | [
"def",
"nslookup",
"(",
"cls",
")",
":",
"try",
":",
"# We try to get the addresse information of the given domain or IP.",
"if",
"\"current_test_data\"",
"in",
"PyFunceble",
".",
"INTERN",
":",
"# pragma: no cover",
"# The end-user want more information whith his test.",
"if",
... | Implementation of UNIX nslookup. | [
"Implementation",
"of",
"UNIX",
"nslookup",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/lookup.py#L75-L145 | test | This method is used to get the addresse information of the given domain or IP. |
funilrys/PyFunceble | PyFunceble/lookup.py | Lookup.whois | def whois(cls, whois_server, domain=None, timeout=None): # pragma: no cover
"""
Implementation of UNIX whois.
:param whois_server: The WHOIS server to use to get the record.
:type whois_server: str
:param domain: The domain to get the whois record from.
:type domain: s... | python | def whois(cls, whois_server, domain=None, timeout=None): # pragma: no cover
"""
Implementation of UNIX whois.
:param whois_server: The WHOIS server to use to get the record.
:type whois_server: str
:param domain: The domain to get the whois record from.
:type domain: s... | [
"def",
"whois",
"(",
"cls",
",",
"whois_server",
",",
"domain",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"# pragma: no cover",
"if",
"domain",
"is",
"None",
":",
"# The domain is not given (localy).",
"# We consider the domain as the domain or IP we are curre... | Implementation of UNIX whois.
:param whois_server: The WHOIS server to use to get the record.
:type whois_server: str
:param domain: The domain to get the whois record from.
:type domain: str
:param timeout: The timeout to apply to the request.
:type timeout: int
... | [
"Implementation",
"of",
"UNIX",
"whois",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/lookup.py#L148-L258 | test | This method returns the whois record from the given whois server. |
funilrys/PyFunceble | PyFunceble/url.py | URL.get | def get(cls): # pragma: no cover
"""
Execute the logic behind the URL handling.
:return: The status of the URL.
:rtype: str
"""
if Check().is_url_valid() or PyFunceble.CONFIGURATION["local"]:
# * The url is valid.
# or
# * We are tes... | python | def get(cls): # pragma: no cover
"""
Execute the logic behind the URL handling.
:return: The status of the URL.
:rtype: str
"""
if Check().is_url_valid() or PyFunceble.CONFIGURATION["local"]:
# * The url is valid.
# or
# * We are tes... | [
"def",
"get",
"(",
"cls",
")",
":",
"# pragma: no cover",
"if",
"Check",
"(",
")",
".",
"is_url_valid",
"(",
")",
"or",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"local\"",
"]",
":",
"# * The url is valid.",
"# or",
"# * We are testing in/for a local or private net... | Execute the logic behind the URL handling.
:return: The status of the URL.
:rtype: str | [
"Execute",
"the",
"logic",
"behind",
"the",
"URL",
"handling",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/url.py#L75-L125 | test | Execute the logic behind the URL handling. |
funilrys/PyFunceble | setup.py | _get_version | def _get_version():
"""
This function will extract the version from PyFunceble/__init__.py
"""
to_match = comp(r'VERSION\s=\s"(.*)"\n')
extracted = to_match.findall(
open("PyFunceble/__init__.py", encoding="utf-8").read()
)[0]
return ".".join([x for x in extracted.split(".") if x.i... | python | def _get_version():
"""
This function will extract the version from PyFunceble/__init__.py
"""
to_match = comp(r'VERSION\s=\s"(.*)"\n')
extracted = to_match.findall(
open("PyFunceble/__init__.py", encoding="utf-8").read()
)[0]
return ".".join([x for x in extracted.split(".") if x.i... | [
"def",
"_get_version",
"(",
")",
":",
"to_match",
"=",
"comp",
"(",
"r'VERSION\\s=\\s\"(.*)\"\\n'",
")",
"extracted",
"=",
"to_match",
".",
"findall",
"(",
"open",
"(",
"\"PyFunceble/__init__.py\"",
",",
"encoding",
"=",
"\"utf-8\"",
")",
".",
"read",
"(",
")"... | This function will extract the version from PyFunceble/__init__.py | [
"This",
"function",
"will",
"extract",
"the",
"version",
"from",
"PyFunceble",
"/",
"__init__",
".",
"py"
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/setup.py#L107-L117 | test | This function will extract the version from the version field of the last version of the module |
funilrys/PyFunceble | PyFunceble/referer.py | Referer.get | def get(self):
"""
Return the referer aka the WHOIS server of the current domain extension.
"""
if not PyFunceble.CONFIGURATION["local"]:
# We are not running a test in a local network.
if self.domain_extension not in self.ignored_extension:
# Th... | python | def get(self):
"""
Return the referer aka the WHOIS server of the current domain extension.
"""
if not PyFunceble.CONFIGURATION["local"]:
# We are not running a test in a local network.
if self.domain_extension not in self.ignored_extension:
# Th... | [
"def",
"get",
"(",
"self",
")",
":",
"if",
"not",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"local\"",
"]",
":",
"# We are not running a test in a local network.",
"if",
"self",
".",
"domain_extension",
"not",
"in",
"self",
".",
"ignored_extension",
":",
"# The e... | Return the referer aka the WHOIS server of the current domain extension. | [
"Return",
"the",
"referer",
"aka",
"the",
"WHOIS",
"server",
"of",
"the",
"current",
"domain",
"extension",
"."
] | cdf69cbde120199171f7158e1c33635753e6e2f5 | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/referer.py#L212-L269 | test | Return the referer aka the WHOIS server of the current domain extension. |
shanbay/sea | sea/app.py | BaseApp._register_servicer | def _register_servicer(self, servicer):
"""register serviser
:param servicer: servicer
"""
name = servicer.__name__
if name in self._servicers:
raise exceptions.ConfigException(
'servicer duplicated: {}'.format(name))
add_func = self._get_serv... | python | def _register_servicer(self, servicer):
"""register serviser
:param servicer: servicer
"""
name = servicer.__name__
if name in self._servicers:
raise exceptions.ConfigException(
'servicer duplicated: {}'.format(name))
add_func = self._get_serv... | [
"def",
"_register_servicer",
"(",
"self",
",",
"servicer",
")",
":",
"name",
"=",
"servicer",
".",
"__name__",
"if",
"name",
"in",
"self",
".",
"_servicers",
":",
"raise",
"exceptions",
".",
"ConfigException",
"(",
"'servicer duplicated: {}'",
".",
"format",
"... | register serviser
:param servicer: servicer | [
"register",
"serviser"
] | a4484a571e3d68cc333411264077a59ea20cc5f1 | https://github.com/shanbay/sea/blob/a4484a571e3d68cc333411264077a59ea20cc5f1/sea/app.py#L78-L88 | test | register serviser
servicer |
shanbay/sea | sea/app.py | BaseApp._register_extension | def _register_extension(self, name, ext):
"""register extension
:param name: extension name
:param ext: extension object
"""
ext.init_app(self)
if name in self._extensions:
raise exceptions.ConfigException(
'extension duplicated: {}'.format(na... | python | def _register_extension(self, name, ext):
"""register extension
:param name: extension name
:param ext: extension object
"""
ext.init_app(self)
if name in self._extensions:
raise exceptions.ConfigException(
'extension duplicated: {}'.format(na... | [
"def",
"_register_extension",
"(",
"self",
",",
"name",
",",
"ext",
")",
":",
"ext",
".",
"init_app",
"(",
"self",
")",
"if",
"name",
"in",
"self",
".",
"_extensions",
":",
"raise",
"exceptions",
".",
"ConfigException",
"(",
"'extension duplicated: {}'",
"."... | register extension
:param name: extension name
:param ext: extension object | [
"register",
"extension"
] | a4484a571e3d68cc333411264077a59ea20cc5f1 | https://github.com/shanbay/sea/blob/a4484a571e3d68cc333411264077a59ea20cc5f1/sea/app.py#L96-L106 | test | register an extension with the cache |
shanbay/sea | sea/local.py | Proxy._get_current_object | def _get_current_object(self):
"""Get current object.
This is useful if you want the real
object behind the proxy at a time for performance reasons or because
you want to pass the object into a different context.
"""
loc = object.__getattribute__(self, '_Proxy__local')
... | python | def _get_current_object(self):
"""Get current object.
This is useful if you want the real
object behind the proxy at a time for performance reasons or because
you want to pass the object into a different context.
"""
loc = object.__getattribute__(self, '_Proxy__local')
... | [
"def",
"_get_current_object",
"(",
"self",
")",
":",
"loc",
"=",
"object",
".",
"__getattribute__",
"(",
"self",
",",
"'_Proxy__local'",
")",
"if",
"not",
"hasattr",
"(",
"loc",
",",
"'__release_local__'",
")",
":",
"return",
"loc",
"(",
"*",
"self",
".",
... | Get current object.
This is useful if you want the real
object behind the proxy at a time for performance reasons or because
you want to pass the object into a different context. | [
"Get",
"current",
"object",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"the",
"real",
"object",
"behind",
"the",
"proxy",
"at",
"a",
"time",
"for",
"performance",
"reasons",
"or",
"because",
"you",
"want",
"to",
"pass",
"the",
"object",
"into",
"a... | a4484a571e3d68cc333411264077a59ea20cc5f1 | https://github.com/shanbay/sea/blob/a4484a571e3d68cc333411264077a59ea20cc5f1/sea/local.py#L58-L71 | test | Get current object. |
myint/autoflake | autoflake.py | standard_paths | def standard_paths():
"""Yield paths to standard modules."""
for is_plat_spec in [True, False]:
path = distutils.sysconfig.get_python_lib(standard_lib=True,
plat_specific=is_plat_spec)
for name in os.listdir(path):
yield name
... | python | def standard_paths():
"""Yield paths to standard modules."""
for is_plat_spec in [True, False]:
path = distutils.sysconfig.get_python_lib(standard_lib=True,
plat_specific=is_plat_spec)
for name in os.listdir(path):
yield name
... | [
"def",
"standard_paths",
"(",
")",
":",
"for",
"is_plat_spec",
"in",
"[",
"True",
",",
"False",
"]",
":",
"path",
"=",
"distutils",
".",
"sysconfig",
".",
"get_python_lib",
"(",
"standard_lib",
"=",
"True",
",",
"plat_specific",
"=",
"is_plat_spec",
")",
"... | Yield paths to standard modules. | [
"Yield",
"paths",
"to",
"standard",
"modules",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L69-L82 | test | Yields paths to standard modules. |
myint/autoflake | autoflake.py | standard_package_names | def standard_package_names():
"""Yield standard module names."""
for name in standard_paths():
if name.startswith('_') or '-' in name:
continue
if '.' in name and name.rsplit('.')[-1] not in ['so', 'py', 'pyc']:
continue
yield name.split('.')[0] | python | def standard_package_names():
"""Yield standard module names."""
for name in standard_paths():
if name.startswith('_') or '-' in name:
continue
if '.' in name and name.rsplit('.')[-1] not in ['so', 'py', 'pyc']:
continue
yield name.split('.')[0] | [
"def",
"standard_package_names",
"(",
")",
":",
"for",
"name",
"in",
"standard_paths",
"(",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"'_'",
")",
"or",
"'-'",
"in",
"name",
":",
"continue",
"if",
"'.'",
"in",
"name",
"and",
"name",
".",
"rsplit",... | Yield standard module names. | [
"Yield",
"standard",
"module",
"names",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L85-L94 | test | Yields all standard module names. |
myint/autoflake | autoflake.py | unused_import_line_numbers | def unused_import_line_numbers(messages):
"""Yield line numbers of unused imports."""
for message in messages:
if isinstance(message, pyflakes.messages.UnusedImport):
yield message.lineno | python | def unused_import_line_numbers(messages):
"""Yield line numbers of unused imports."""
for message in messages:
if isinstance(message, pyflakes.messages.UnusedImport):
yield message.lineno | [
"def",
"unused_import_line_numbers",
"(",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"UnusedImport",
")",
":",
"yield",
"message",
".",
"lineno"
] | Yield line numbers of unused imports. | [
"Yield",
"line",
"numbers",
"of",
"unused",
"imports",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L108-L112 | test | Yield line numbers of unused imports. |
myint/autoflake | autoflake.py | unused_import_module_name | def unused_import_module_name(messages):
"""Yield line number and module name of unused imports."""
pattern = r'\'(.+?)\''
for message in messages:
if isinstance(message, pyflakes.messages.UnusedImport):
module_name = re.search(pattern, str(message))
module_name = module_name... | python | def unused_import_module_name(messages):
"""Yield line number and module name of unused imports."""
pattern = r'\'(.+?)\''
for message in messages:
if isinstance(message, pyflakes.messages.UnusedImport):
module_name = re.search(pattern, str(message))
module_name = module_name... | [
"def",
"unused_import_module_name",
"(",
"messages",
")",
":",
"pattern",
"=",
"r'\\'(.+?)\\''",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"UnusedImport",
")",
":",
"module_name",
"=",
"... | Yield line number and module name of unused imports. | [
"Yield",
"line",
"number",
"and",
"module",
"name",
"of",
"unused",
"imports",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L115-L123 | test | Yield line number and module name of unused imports. |
myint/autoflake | autoflake.py | star_import_used_line_numbers | def star_import_used_line_numbers(messages):
"""Yield line number of star import usage."""
for message in messages:
if isinstance(message, pyflakes.messages.ImportStarUsed):
yield message.lineno | python | def star_import_used_line_numbers(messages):
"""Yield line number of star import usage."""
for message in messages:
if isinstance(message, pyflakes.messages.ImportStarUsed):
yield message.lineno | [
"def",
"star_import_used_line_numbers",
"(",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"ImportStarUsed",
")",
":",
"yield",
"message",
".",
"lineno"
] | Yield line number of star import usage. | [
"Yield",
"line",
"number",
"of",
"star",
"import",
"usage",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L126-L130 | test | Yields line numbers of star import used messages. |
myint/autoflake | autoflake.py | star_import_usage_undefined_name | def star_import_usage_undefined_name(messages):
"""Yield line number, undefined name, and its possible origin module."""
for message in messages:
if isinstance(message, pyflakes.messages.ImportStarUsage):
undefined_name = message.message_args[0]
module_name = message.message_args... | python | def star_import_usage_undefined_name(messages):
"""Yield line number, undefined name, and its possible origin module."""
for message in messages:
if isinstance(message, pyflakes.messages.ImportStarUsage):
undefined_name = message.message_args[0]
module_name = message.message_args... | [
"def",
"star_import_usage_undefined_name",
"(",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"ImportStarUsage",
")",
":",
"undefined_name",
"=",
"message",
".",
"message... | Yield line number, undefined name, and its possible origin module. | [
"Yield",
"line",
"number",
"undefined",
"name",
"and",
"its",
"possible",
"origin",
"module",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L133-L139 | test | Yields line number undefined name and its possible origin module. |
myint/autoflake | autoflake.py | unused_variable_line_numbers | def unused_variable_line_numbers(messages):
"""Yield line numbers of unused variables."""
for message in messages:
if isinstance(message, pyflakes.messages.UnusedVariable):
yield message.lineno | python | def unused_variable_line_numbers(messages):
"""Yield line numbers of unused variables."""
for message in messages:
if isinstance(message, pyflakes.messages.UnusedVariable):
yield message.lineno | [
"def",
"unused_variable_line_numbers",
"(",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"UnusedVariable",
")",
":",
"yield",
"message",
".",
"lineno"
] | Yield line numbers of unused variables. | [
"Yield",
"line",
"numbers",
"of",
"unused",
"variables",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L142-L146 | test | Yield line numbers of unused variables. |
myint/autoflake | autoflake.py | duplicate_key_line_numbers | def duplicate_key_line_numbers(messages, source):
"""Yield line numbers of duplicate keys."""
messages = [
message for message in messages
if isinstance(message, pyflakes.messages.MultiValueRepeatedKeyLiteral)]
if messages:
# Filter out complex cases. We don't want to bother trying ... | python | def duplicate_key_line_numbers(messages, source):
"""Yield line numbers of duplicate keys."""
messages = [
message for message in messages
if isinstance(message, pyflakes.messages.MultiValueRepeatedKeyLiteral)]
if messages:
# Filter out complex cases. We don't want to bother trying ... | [
"def",
"duplicate_key_line_numbers",
"(",
"messages",
",",
"source",
")",
":",
"messages",
"=",
"[",
"message",
"for",
"message",
"in",
"messages",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"MultiValueRepeatedKeyLiteral",
")",
"]... | Yield line numbers of duplicate keys. | [
"Yield",
"line",
"numbers",
"of",
"duplicate",
"keys",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L149-L174 | test | Yield line numbers of duplicate keys. |
myint/autoflake | autoflake.py | create_key_to_messages_dict | def create_key_to_messages_dict(messages):
"""Return dict mapping the key to list of messages."""
dictionary = collections.defaultdict(lambda: [])
for message in messages:
dictionary[message.message_args[0]].append(message)
return dictionary | python | def create_key_to_messages_dict(messages):
"""Return dict mapping the key to list of messages."""
dictionary = collections.defaultdict(lambda: [])
for message in messages:
dictionary[message.message_args[0]].append(message)
return dictionary | [
"def",
"create_key_to_messages_dict",
"(",
"messages",
")",
":",
"dictionary",
"=",
"collections",
".",
"defaultdict",
"(",
"lambda",
":",
"[",
"]",
")",
"for",
"message",
"in",
"messages",
":",
"dictionary",
"[",
"message",
".",
"message_args",
"[",
"0",
"]... | Return dict mapping the key to list of messages. | [
"Return",
"dict",
"mapping",
"the",
"key",
"to",
"list",
"of",
"messages",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L177-L182 | test | Return dict mapping the key to list of messages. |
myint/autoflake | autoflake.py | check | def check(source):
"""Return messages from pyflakes."""
if sys.version_info[0] == 2 and isinstance(source, unicode):
# Convert back to original byte string encoding, otherwise pyflakes
# call to compile() will complain. See PEP 263. This only affects
# Python 2.
try:
... | python | def check(source):
"""Return messages from pyflakes."""
if sys.version_info[0] == 2 and isinstance(source, unicode):
# Convert back to original byte string encoding, otherwise pyflakes
# call to compile() will complain. See PEP 263. This only affects
# Python 2.
try:
... | [
"def",
"check",
"(",
"source",
")",
":",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
"==",
"2",
"and",
"isinstance",
"(",
"source",
",",
"unicode",
")",
":",
"# Convert back to original byte string encoding, otherwise pyflakes",
"# call to compile() will complain... | Return messages from pyflakes. | [
"Return",
"messages",
"from",
"pyflakes",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L185-L201 | test | Return messages from pyflakes. |
myint/autoflake | autoflake.py | extract_package_name | def extract_package_name(line):
"""Return package name in import statement."""
assert '\\' not in line
assert '(' not in line
assert ')' not in line
assert ';' not in line
if line.lstrip().startswith(('import', 'from')):
word = line.split()[1]
else:
# Ignore doctests.
... | python | def extract_package_name(line):
"""Return package name in import statement."""
assert '\\' not in line
assert '(' not in line
assert ')' not in line
assert ';' not in line
if line.lstrip().startswith(('import', 'from')):
word = line.split()[1]
else:
# Ignore doctests.
... | [
"def",
"extract_package_name",
"(",
"line",
")",
":",
"assert",
"'\\\\'",
"not",
"in",
"line",
"assert",
"'('",
"not",
"in",
"line",
"assert",
"')'",
"not",
"in",
"line",
"assert",
"';'",
"not",
"in",
"line",
"if",
"line",
".",
"lstrip",
"(",
")",
".",... | Return package name in import statement. | [
"Return",
"package",
"name",
"in",
"import",
"statement",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L228-L244 | test | Return package name in import statement. |
myint/autoflake | autoflake.py | multiline_import | def multiline_import(line, previous_line=''):
"""Return True if import is spans multiples lines."""
for symbol in '()':
if symbol in line:
return True
# Ignore doctests.
if line.lstrip().startswith('>'):
return True
return multiline_statement(line, previous_line) | python | def multiline_import(line, previous_line=''):
"""Return True if import is spans multiples lines."""
for symbol in '()':
if symbol in line:
return True
# Ignore doctests.
if line.lstrip().startswith('>'):
return True
return multiline_statement(line, previous_line) | [
"def",
"multiline_import",
"(",
"line",
",",
"previous_line",
"=",
"''",
")",
":",
"for",
"symbol",
"in",
"'()'",
":",
"if",
"symbol",
"in",
"line",
":",
"return",
"True",
"# Ignore doctests.",
"if",
"line",
".",
"lstrip",
"(",
")",
".",
"startswith",
"(... | Return True if import is spans multiples lines. | [
"Return",
"True",
"if",
"import",
"is",
"spans",
"multiples",
"lines",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L247-L257 | test | Return True if import is spans multiples lines. |
myint/autoflake | autoflake.py | multiline_statement | def multiline_statement(line, previous_line=''):
"""Return True if this is part of a multiline statement."""
for symbol in '\\:;':
if symbol in line:
return True
sio = io.StringIO(line)
try:
list(tokenize.generate_tokens(sio.readline))
return previous_line.rstrip().e... | python | def multiline_statement(line, previous_line=''):
"""Return True if this is part of a multiline statement."""
for symbol in '\\:;':
if symbol in line:
return True
sio = io.StringIO(line)
try:
list(tokenize.generate_tokens(sio.readline))
return previous_line.rstrip().e... | [
"def",
"multiline_statement",
"(",
"line",
",",
"previous_line",
"=",
"''",
")",
":",
"for",
"symbol",
"in",
"'\\\\:;'",
":",
"if",
"symbol",
"in",
"line",
":",
"return",
"True",
"sio",
"=",
"io",
".",
"StringIO",
"(",
"line",
")",
"try",
":",
"list",
... | Return True if this is part of a multiline statement. | [
"Return",
"True",
"if",
"this",
"is",
"part",
"of",
"a",
"multiline",
"statement",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L260-L271 | test | Return True if this is part of a multiline statement. |
myint/autoflake | autoflake.py | filter_from_import | def filter_from_import(line, unused_module):
"""Parse and filter ``from something import a, b, c``.
Return line without unused import modules, or `pass` if all of the
module in import is unused.
"""
(indentation, imports) = re.split(pattern=r'\bimport\b',
strin... | python | def filter_from_import(line, unused_module):
"""Parse and filter ``from something import a, b, c``.
Return line without unused import modules, or `pass` if all of the
module in import is unused.
"""
(indentation, imports) = re.split(pattern=r'\bimport\b',
strin... | [
"def",
"filter_from_import",
"(",
"line",
",",
"unused_module",
")",
":",
"(",
"indentation",
",",
"imports",
")",
"=",
"re",
".",
"split",
"(",
"pattern",
"=",
"r'\\bimport\\b'",
",",
"string",
"=",
"line",
",",
"maxsplit",
"=",
"1",
")",
"base_module",
... | Parse and filter ``from something import a, b, c``.
Return line without unused import modules, or `pass` if all of the
module in import is unused. | [
"Parse",
"and",
"filter",
"from",
"something",
"import",
"a",
"b",
"c",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L274-L304 | test | Parse and filter from something import a b c as d. |
myint/autoflake | autoflake.py | break_up_import | def break_up_import(line):
"""Return line with imports on separate lines."""
assert '\\' not in line
assert '(' not in line
assert ')' not in line
assert ';' not in line
assert '#' not in line
assert not line.lstrip().startswith('from')
newline = get_line_ending(line)
if not newline... | python | def break_up_import(line):
"""Return line with imports on separate lines."""
assert '\\' not in line
assert '(' not in line
assert ')' not in line
assert ';' not in line
assert '#' not in line
assert not line.lstrip().startswith('from')
newline = get_line_ending(line)
if not newline... | [
"def",
"break_up_import",
"(",
"line",
")",
":",
"assert",
"'\\\\'",
"not",
"in",
"line",
"assert",
"'('",
"not",
"in",
"line",
"assert",
"')'",
"not",
"in",
"line",
"assert",
"';'",
"not",
"in",
"line",
"assert",
"'#'",
"not",
"in",
"line",
"assert",
... | Return line with imports on separate lines. | [
"Return",
"line",
"with",
"imports",
"on",
"separate",
"lines",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L307-L327 | test | Return line with imports on separate lines. |
myint/autoflake | autoflake.py | filter_code | def filter_code(source, additional_imports=None,
expand_star_imports=False,
remove_all_unused_imports=False,
remove_duplicate_keys=False,
remove_unused_variables=False,
ignore_init_module_imports=False,
):
"""Yield code ... | python | def filter_code(source, additional_imports=None,
expand_star_imports=False,
remove_all_unused_imports=False,
remove_duplicate_keys=False,
remove_unused_variables=False,
ignore_init_module_imports=False,
):
"""Yield code ... | [
"def",
"filter_code",
"(",
"source",
",",
"additional_imports",
"=",
"None",
",",
"expand_star_imports",
"=",
"False",
",",
"remove_all_unused_imports",
"=",
"False",
",",
"remove_duplicate_keys",
"=",
"False",
",",
"remove_unused_variables",
"=",
"False",
",",
"ign... | Yield code with unused imports removed. | [
"Yield",
"code",
"with",
"unused",
"imports",
"removed",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L330-L411 | test | Yields code with unused imports removed. |
myint/autoflake | autoflake.py | get_messages_by_line | def get_messages_by_line(messages):
"""Return dictionary that maps line number to message."""
line_messages = {}
for message in messages:
line_messages[message.lineno] = message
return line_messages | python | def get_messages_by_line(messages):
"""Return dictionary that maps line number to message."""
line_messages = {}
for message in messages:
line_messages[message.lineno] = message
return line_messages | [
"def",
"get_messages_by_line",
"(",
"messages",
")",
":",
"line_messages",
"=",
"{",
"}",
"for",
"message",
"in",
"messages",
":",
"line_messages",
"[",
"message",
".",
"lineno",
"]",
"=",
"message",
"return",
"line_messages"
] | Return dictionary that maps line number to message. | [
"Return",
"dictionary",
"that",
"maps",
"line",
"number",
"to",
"message",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L414-L419 | test | Return dictionary that maps line number to message. |
myint/autoflake | autoflake.py | filter_star_import | def filter_star_import(line, marked_star_import_undefined_name):
"""Return line with the star import expanded."""
undefined_name = sorted(set(marked_star_import_undefined_name))
return re.sub(r'\*', ', '.join(undefined_name), line) | python | def filter_star_import(line, marked_star_import_undefined_name):
"""Return line with the star import expanded."""
undefined_name = sorted(set(marked_star_import_undefined_name))
return re.sub(r'\*', ', '.join(undefined_name), line) | [
"def",
"filter_star_import",
"(",
"line",
",",
"marked_star_import_undefined_name",
")",
":",
"undefined_name",
"=",
"sorted",
"(",
"set",
"(",
"marked_star_import_undefined_name",
")",
")",
"return",
"re",
".",
"sub",
"(",
"r'\\*'",
",",
"', '",
".",
"join",
"(... | Return line with the star import expanded. | [
"Return",
"line",
"with",
"the",
"star",
"import",
"expanded",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L422-L425 | test | Return line with the star import expanded. |
myint/autoflake | autoflake.py | filter_unused_import | def filter_unused_import(line, unused_module, remove_all_unused_imports,
imports, previous_line=''):
"""Return line if used, otherwise return None."""
if multiline_import(line, previous_line):
return line
is_from_import = line.lstrip().startswith('from')
if ',' in line... | python | def filter_unused_import(line, unused_module, remove_all_unused_imports,
imports, previous_line=''):
"""Return line if used, otherwise return None."""
if multiline_import(line, previous_line):
return line
is_from_import = line.lstrip().startswith('from')
if ',' in line... | [
"def",
"filter_unused_import",
"(",
"line",
",",
"unused_module",
",",
"remove_all_unused_imports",
",",
"imports",
",",
"previous_line",
"=",
"''",
")",
":",
"if",
"multiline_import",
"(",
"line",
",",
"previous_line",
")",
":",
"return",
"line",
"is_from_import"... | Return line if used, otherwise return None. | [
"Return",
"line",
"if",
"used",
"otherwise",
"return",
"None",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L428-L453 | test | Return line if used otherwise return None. |
myint/autoflake | autoflake.py | filter_unused_variable | def filter_unused_variable(line, previous_line=''):
"""Return line if used, otherwise return None."""
if re.match(EXCEPT_REGEX, line):
return re.sub(r' as \w+:$', ':', line, count=1)
elif multiline_statement(line, previous_line):
return line
elif line.count('=') == 1:
split_line ... | python | def filter_unused_variable(line, previous_line=''):
"""Return line if used, otherwise return None."""
if re.match(EXCEPT_REGEX, line):
return re.sub(r' as \w+:$', ':', line, count=1)
elif multiline_statement(line, previous_line):
return line
elif line.count('=') == 1:
split_line ... | [
"def",
"filter_unused_variable",
"(",
"line",
",",
"previous_line",
"=",
"''",
")",
":",
"if",
"re",
".",
"match",
"(",
"EXCEPT_REGEX",
",",
"line",
")",
":",
"return",
"re",
".",
"sub",
"(",
"r' as \\w+:$'",
",",
"':'",
",",
"line",
",",
"count",
"=",... | Return line if used, otherwise return None. | [
"Return",
"line",
"if",
"used",
"otherwise",
"return",
"None",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L456-L476 | test | Return line if used otherwise return None. |
myint/autoflake | autoflake.py | filter_duplicate_key | def filter_duplicate_key(line, message, line_number, marked_line_numbers,
source, previous_line=''):
"""Return '' if first occurrence of the key otherwise return `line`."""
if marked_line_numbers and line_number == sorted(marked_line_numbers)[0]:
return ''
return line | python | def filter_duplicate_key(line, message, line_number, marked_line_numbers,
source, previous_line=''):
"""Return '' if first occurrence of the key otherwise return `line`."""
if marked_line_numbers and line_number == sorted(marked_line_numbers)[0]:
return ''
return line | [
"def",
"filter_duplicate_key",
"(",
"line",
",",
"message",
",",
"line_number",
",",
"marked_line_numbers",
",",
"source",
",",
"previous_line",
"=",
"''",
")",
":",
"if",
"marked_line_numbers",
"and",
"line_number",
"==",
"sorted",
"(",
"marked_line_numbers",
")"... | Return '' if first occurrence of the key otherwise return `line`. | [
"Return",
"if",
"first",
"occurrence",
"of",
"the",
"key",
"otherwise",
"return",
"line",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L479-L485 | test | Return line if line_number is the first occurrence of the key otherwise return line. |
myint/autoflake | autoflake.py | dict_entry_has_key | def dict_entry_has_key(line, key):
"""Return True if `line` is a dict entry that uses `key`.
Return False for multiline cases where the line should not be removed by
itself.
"""
if '#' in line:
return False
result = re.match(r'\s*(.*)\s*:\s*(.*),\s*$', line)
if not result:
... | python | def dict_entry_has_key(line, key):
"""Return True if `line` is a dict entry that uses `key`.
Return False for multiline cases where the line should not be removed by
itself.
"""
if '#' in line:
return False
result = re.match(r'\s*(.*)\s*:\s*(.*),\s*$', line)
if not result:
... | [
"def",
"dict_entry_has_key",
"(",
"line",
",",
"key",
")",
":",
"if",
"'#'",
"in",
"line",
":",
"return",
"False",
"result",
"=",
"re",
".",
"match",
"(",
"r'\\s*(.*)\\s*:\\s*(.*),\\s*$'",
",",
"line",
")",
"if",
"not",
"result",
":",
"return",
"False",
... | Return True if `line` is a dict entry that uses `key`.
Return False for multiline cases where the line should not be removed by
itself. | [
"Return",
"True",
"if",
"line",
"is",
"a",
"dict",
"entry",
"that",
"uses",
"key",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L488-L510 | test | Return True if line is a dict entry that uses key. |
myint/autoflake | autoflake.py | is_literal_or_name | def is_literal_or_name(value):
"""Return True if value is a literal or a name."""
try:
ast.literal_eval(value)
return True
except (SyntaxError, ValueError):
pass
if value.strip() in ['dict()', 'list()', 'set()']:
return True
# Support removal of variables on the rig... | python | def is_literal_or_name(value):
"""Return True if value is a literal or a name."""
try:
ast.literal_eval(value)
return True
except (SyntaxError, ValueError):
pass
if value.strip() in ['dict()', 'list()', 'set()']:
return True
# Support removal of variables on the rig... | [
"def",
"is_literal_or_name",
"(",
"value",
")",
":",
"try",
":",
"ast",
".",
"literal_eval",
"(",
"value",
")",
"return",
"True",
"except",
"(",
"SyntaxError",
",",
"ValueError",
")",
":",
"pass",
"if",
"value",
".",
"strip",
"(",
")",
"in",
"[",
"'dic... | Return True if value is a literal or a name. | [
"Return",
"True",
"if",
"value",
"is",
"a",
"literal",
"or",
"a",
"name",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L513-L526 | test | Return True if value is a literal or a name. |
myint/autoflake | autoflake.py | useless_pass_line_numbers | def useless_pass_line_numbers(source):
"""Yield line numbers of unneeded "pass" statements."""
sio = io.StringIO(source)
previous_token_type = None
last_pass_row = None
last_pass_indentation = None
previous_line = ''
for token in tokenize.generate_tokens(sio.readline):
token_type = t... | python | def useless_pass_line_numbers(source):
"""Yield line numbers of unneeded "pass" statements."""
sio = io.StringIO(source)
previous_token_type = None
last_pass_row = None
last_pass_indentation = None
previous_line = ''
for token in tokenize.generate_tokens(sio.readline):
token_type = t... | [
"def",
"useless_pass_line_numbers",
"(",
"source",
")",
":",
"sio",
"=",
"io",
".",
"StringIO",
"(",
"source",
")",
"previous_token_type",
"=",
"None",
"last_pass_row",
"=",
"None",
"last_pass_indentation",
"=",
"None",
"previous_line",
"=",
"''",
"for",
"token"... | Yield line numbers of unneeded "pass" statements. | [
"Yield",
"line",
"numbers",
"of",
"unneeded",
"pass",
"statements",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L529-L561 | test | Yield line numbers of unneeded pass statements. |
myint/autoflake | autoflake.py | filter_useless_pass | def filter_useless_pass(source):
"""Yield code with useless "pass" lines removed."""
try:
marked_lines = frozenset(useless_pass_line_numbers(source))
except (SyntaxError, tokenize.TokenError):
marked_lines = frozenset()
sio = io.StringIO(source)
for line_number, line in enumerate(si... | python | def filter_useless_pass(source):
"""Yield code with useless "pass" lines removed."""
try:
marked_lines = frozenset(useless_pass_line_numbers(source))
except (SyntaxError, tokenize.TokenError):
marked_lines = frozenset()
sio = io.StringIO(source)
for line_number, line in enumerate(si... | [
"def",
"filter_useless_pass",
"(",
"source",
")",
":",
"try",
":",
"marked_lines",
"=",
"frozenset",
"(",
"useless_pass_line_numbers",
"(",
"source",
")",
")",
"except",
"(",
"SyntaxError",
",",
"tokenize",
".",
"TokenError",
")",
":",
"marked_lines",
"=",
"fr... | Yield code with useless "pass" lines removed. | [
"Yield",
"code",
"with",
"useless",
"pass",
"lines",
"removed",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L564-L574 | test | Yield code with useless pass lines removed. |
myint/autoflake | autoflake.py | get_indentation | def get_indentation(line):
"""Return leading whitespace."""
if line.strip():
non_whitespace_index = len(line) - len(line.lstrip())
return line[:non_whitespace_index]
else:
return '' | python | def get_indentation(line):
"""Return leading whitespace."""
if line.strip():
non_whitespace_index = len(line) - len(line.lstrip())
return line[:non_whitespace_index]
else:
return '' | [
"def",
"get_indentation",
"(",
"line",
")",
":",
"if",
"line",
".",
"strip",
"(",
")",
":",
"non_whitespace_index",
"=",
"len",
"(",
"line",
")",
"-",
"len",
"(",
"line",
".",
"lstrip",
"(",
")",
")",
"return",
"line",
"[",
":",
"non_whitespace_index",... | Return leading whitespace. | [
"Return",
"leading",
"whitespace",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L577-L583 | test | Return leading whitespace. |
myint/autoflake | autoflake.py | get_line_ending | def get_line_ending(line):
"""Return line ending."""
non_whitespace_index = len(line.rstrip()) - len(line)
if not non_whitespace_index:
return ''
else:
return line[non_whitespace_index:] | python | def get_line_ending(line):
"""Return line ending."""
non_whitespace_index = len(line.rstrip()) - len(line)
if not non_whitespace_index:
return ''
else:
return line[non_whitespace_index:] | [
"def",
"get_line_ending",
"(",
"line",
")",
":",
"non_whitespace_index",
"=",
"len",
"(",
"line",
".",
"rstrip",
"(",
")",
")",
"-",
"len",
"(",
"line",
")",
"if",
"not",
"non_whitespace_index",
":",
"return",
"''",
"else",
":",
"return",
"line",
"[",
... | Return line ending. | [
"Return",
"line",
"ending",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L586-L592 | test | Return line ending. |
myint/autoflake | autoflake.py | fix_code | def fix_code(source, additional_imports=None, expand_star_imports=False,
remove_all_unused_imports=False, remove_duplicate_keys=False,
remove_unused_variables=False, ignore_init_module_imports=False):
"""Return code with all filtering run on it."""
if not source:
return source
... | python | def fix_code(source, additional_imports=None, expand_star_imports=False,
remove_all_unused_imports=False, remove_duplicate_keys=False,
remove_unused_variables=False, ignore_init_module_imports=False):
"""Return code with all filtering run on it."""
if not source:
return source
... | [
"def",
"fix_code",
"(",
"source",
",",
"additional_imports",
"=",
"None",
",",
"expand_star_imports",
"=",
"False",
",",
"remove_all_unused_imports",
"=",
"False",
",",
"remove_duplicate_keys",
"=",
"False",
",",
"remove_unused_variables",
"=",
"False",
",",
"ignore... | Return code with all filtering run on it. | [
"Return",
"code",
"with",
"all",
"filtering",
"run",
"on",
"it",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L595-L624 | test | Return code with all filtering run on it. |
myint/autoflake | autoflake.py | fix_file | def fix_file(filename, args, standard_out):
"""Run fix_code() on a file."""
encoding = detect_encoding(filename)
with open_with_encoding(filename, encoding=encoding) as input_file:
source = input_file.read()
original_source = source
isInitFile = os.path.basename(filename) == '__init__.py'
... | python | def fix_file(filename, args, standard_out):
"""Run fix_code() on a file."""
encoding = detect_encoding(filename)
with open_with_encoding(filename, encoding=encoding) as input_file:
source = input_file.read()
original_source = source
isInitFile = os.path.basename(filename) == '__init__.py'
... | [
"def",
"fix_file",
"(",
"filename",
",",
"args",
",",
"standard_out",
")",
":",
"encoding",
"=",
"detect_encoding",
"(",
"filename",
")",
"with",
"open_with_encoding",
"(",
"filename",
",",
"encoding",
"=",
"encoding",
")",
"as",
"input_file",
":",
"source",
... | Run fix_code() on a file. | [
"Run",
"fix_code",
"()",
"on",
"a",
"file",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L627-L668 | test | Run fix_code() on a file. |
myint/autoflake | autoflake.py | detect_encoding | def detect_encoding(filename, limit_byte_check=-1):
"""Return file encoding."""
try:
with open(filename, 'rb') as input_file:
encoding = _detect_encoding(input_file.readline)
# Check for correctness of encoding.
with open_with_encoding(filename, encoding) as input_fi... | python | def detect_encoding(filename, limit_byte_check=-1):
"""Return file encoding."""
try:
with open(filename, 'rb') as input_file:
encoding = _detect_encoding(input_file.readline)
# Check for correctness of encoding.
with open_with_encoding(filename, encoding) as input_fi... | [
"def",
"detect_encoding",
"(",
"filename",
",",
"limit_byte_check",
"=",
"-",
"1",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"input_file",
":",
"encoding",
"=",
"_detect_encoding",
"(",
"input_file",
".",
"readline",
")... | Return file encoding. | [
"Return",
"file",
"encoding",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L681-L693 | test | Detect encoding of a file. |
myint/autoflake | autoflake.py | _detect_encoding | def _detect_encoding(readline):
"""Return file encoding."""
try:
from lib2to3.pgen2 import tokenize as lib2to3_tokenize
encoding = lib2to3_tokenize.detect_encoding(readline)[0]
return encoding
except (LookupError, SyntaxError, UnicodeDecodeError):
return 'latin-1' | python | def _detect_encoding(readline):
"""Return file encoding."""
try:
from lib2to3.pgen2 import tokenize as lib2to3_tokenize
encoding = lib2to3_tokenize.detect_encoding(readline)[0]
return encoding
except (LookupError, SyntaxError, UnicodeDecodeError):
return 'latin-1' | [
"def",
"_detect_encoding",
"(",
"readline",
")",
":",
"try",
":",
"from",
"lib2to3",
".",
"pgen2",
"import",
"tokenize",
"as",
"lib2to3_tokenize",
"encoding",
"=",
"lib2to3_tokenize",
".",
"detect_encoding",
"(",
"readline",
")",
"[",
"0",
"]",
"return",
"enco... | Return file encoding. | [
"Return",
"file",
"encoding",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L696-L703 | test | Detect encoding of the file. |
myint/autoflake | autoflake.py | _split_comma_separated | def _split_comma_separated(string):
"""Return a set of strings."""
return set(text.strip() for text in string.split(',') if text.strip()) | python | def _split_comma_separated(string):
"""Return a set of strings."""
return set(text.strip() for text in string.split(',') if text.strip()) | [
"def",
"_split_comma_separated",
"(",
"string",
")",
":",
"return",
"set",
"(",
"text",
".",
"strip",
"(",
")",
"for",
"text",
"in",
"string",
".",
"split",
"(",
"','",
")",
"if",
"text",
".",
"strip",
"(",
")",
")"
] | Return a set of strings. | [
"Return",
"a",
"set",
"of",
"strings",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L726-L728 | test | Return a set of strings. |
myint/autoflake | autoflake.py | is_python_file | def is_python_file(filename):
"""Return True if filename is Python file."""
if filename.endswith('.py'):
return True
try:
with open_with_encoding(
filename,
None,
limit_byte_check=MAX_PYTHON_FILE_DETECTION_BYTES) as f:
text = f.rea... | python | def is_python_file(filename):
"""Return True if filename is Python file."""
if filename.endswith('.py'):
return True
try:
with open_with_encoding(
filename,
None,
limit_byte_check=MAX_PYTHON_FILE_DETECTION_BYTES) as f:
text = f.rea... | [
"def",
"is_python_file",
"(",
"filename",
")",
":",
"if",
"filename",
".",
"endswith",
"(",
"'.py'",
")",
":",
"return",
"True",
"try",
":",
"with",
"open_with_encoding",
"(",
"filename",
",",
"None",
",",
"limit_byte_check",
"=",
"MAX_PYTHON_FILE_DETECTION_BYTE... | Return True if filename is Python file. | [
"Return",
"True",
"if",
"filename",
"is",
"Python",
"file",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L731-L751 | test | Return True if filename is Python file. |
myint/autoflake | autoflake.py | is_exclude_file | def is_exclude_file(filename, exclude):
"""Return True if file matches exclude pattern."""
base_name = os.path.basename(filename)
if base_name.startswith('.'):
return True
for pattern in exclude:
if fnmatch.fnmatch(base_name, pattern):
return True
if fnmatch.fnmatch... | python | def is_exclude_file(filename, exclude):
"""Return True if file matches exclude pattern."""
base_name = os.path.basename(filename)
if base_name.startswith('.'):
return True
for pattern in exclude:
if fnmatch.fnmatch(base_name, pattern):
return True
if fnmatch.fnmatch... | [
"def",
"is_exclude_file",
"(",
"filename",
",",
"exclude",
")",
":",
"base_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"if",
"base_name",
".",
"startswith",
"(",
"'.'",
")",
":",
"return",
"True",
"for",
"pattern",
"in",
"exclud... | Return True if file matches exclude pattern. | [
"Return",
"True",
"if",
"file",
"matches",
"exclude",
"pattern",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L754-L766 | test | Return True if file matches exclude pattern. |
myint/autoflake | autoflake.py | match_file | def match_file(filename, exclude):
"""Return True if file is okay for modifying/recursing."""
if is_exclude_file(filename, exclude):
return False
if not os.path.isdir(filename) and not is_python_file(filename):
return False
return True | python | def match_file(filename, exclude):
"""Return True if file is okay for modifying/recursing."""
if is_exclude_file(filename, exclude):
return False
if not os.path.isdir(filename) and not is_python_file(filename):
return False
return True | [
"def",
"match_file",
"(",
"filename",
",",
"exclude",
")",
":",
"if",
"is_exclude_file",
"(",
"filename",
",",
"exclude",
")",
":",
"return",
"False",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"filename",
")",
"and",
"not",
"is_python_file",
"("... | Return True if file is okay for modifying/recursing. | [
"Return",
"True",
"if",
"file",
"is",
"okay",
"for",
"modifying",
"/",
"recursing",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L769-L777 | test | Return True if file is okay for modifying or recursing. |
myint/autoflake | autoflake.py | find_files | def find_files(filenames, recursive, exclude):
"""Yield filenames."""
while filenames:
name = filenames.pop(0)
if recursive and os.path.isdir(name):
for root, directories, children in os.walk(name):
filenames += [os.path.join(root, f) for f in children
... | python | def find_files(filenames, recursive, exclude):
"""Yield filenames."""
while filenames:
name = filenames.pop(0)
if recursive and os.path.isdir(name):
for root, directories, children in os.walk(name):
filenames += [os.path.join(root, f) for f in children
... | [
"def",
"find_files",
"(",
"filenames",
",",
"recursive",
",",
"exclude",
")",
":",
"while",
"filenames",
":",
"name",
"=",
"filenames",
".",
"pop",
"(",
"0",
")",
"if",
"recursive",
"and",
"os",
".",
"path",
".",
"isdir",
"(",
"name",
")",
":",
"for"... | Yield filenames. | [
"Yield",
"filenames",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L780-L794 | test | Yields the names of all files in the archive. |
myint/autoflake | autoflake.py | _main | def _main(argv, standard_out, standard_error):
"""Return exit status.
0 means no error.
"""
import argparse
parser = argparse.ArgumentParser(description=__doc__, prog='autoflake')
parser.add_argument('-c', '--check', action='store_true',
help='return error code if change... | python | def _main(argv, standard_out, standard_error):
"""Return exit status.
0 means no error.
"""
import argparse
parser = argparse.ArgumentParser(description=__doc__, prog='autoflake')
parser.add_argument('-c', '--check', action='store_true',
help='return error code if change... | [
"def",
"_main",
"(",
"argv",
",",
"standard_out",
",",
"standard_error",
")",
":",
"import",
"argparse",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
",",
"prog",
"=",
"'autoflake'",
")",
"parser",
".",
"add_argument",
... | Return exit status.
0 means no error. | [
"Return",
"exit",
"status",
"."
] | 68fea68646922b920d55975f9f2adaeafd84df4f | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L797-L858 | test | Main function for the automlake command line interface. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/obtain_lease.py | ObtainLeaseResponsePayload.read | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the ObtainLease response payload and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting ... | python | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the ObtainLease response payload and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting ... | [
"def",
"read",
"(",
"self",
",",
"input_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"ObtainLeaseResponsePayload",
",",
"self",
")",
".",
"read",
"(",
"input_stream",
",",
"kmip_version",
"=",
"kmip... | Read the data encoding the ObtainLease response payload and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read method; usually a BytearrayStream
object.
kmip_version (... | [
"Read",
"the",
"data",
"encoding",
"the",
"ObtainLease",
"response",
"payload",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/obtain_lease.py#L254-L299 | test | Reads the data encoding the ObtainLease response payload and decode it into its constituent parts. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/obtain_lease.py | ObtainLeaseResponsePayload.write | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the ObtainLease response payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a Bytearr... | python | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the ObtainLease response payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a Bytearr... | [
"def",
"write",
"(",
"self",
",",
"output_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"local_stream",
"=",
"utils",
".",
"BytearrayStream",
"(",
")",
"if",
"self",
".",
"_unique_identifier",
":",
"self",
".",
... | Write the data encoding the ObtainLease response payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream
object.
kmip_version (KMIPVersion): An enumeration defin... | [
"Write",
"the",
"data",
"encoding",
"the",
"ObtainLease",
"response",
"payload",
"to",
"a",
"stream",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/obtain_lease.py#L301-L339 | test | Writes the data encoding the ObtainLease response payload to the output stream. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/cancel.py | CancelRequestPayload.write | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the Cancel request payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStre... | python | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the Cancel request payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStre... | [
"def",
"write",
"(",
"self",
",",
"output_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"local_stream",
"=",
"utils",
".",
"BytearrayStream",
"(",
")",
"if",
"self",
".",
"_asynchronous_correlation_value",
":",
"sel... | Write the data encoding the Cancel request payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream
object.
kmip_version (KMIPVersion): An enumeration defining th... | [
"Write",
"the",
"data",
"encoding",
"the",
"Cancel",
"request",
"payload",
"to",
"a",
"stream",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/cancel.py#L103-L131 | test | Writes the data encoding the object to the output stream. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/cancel.py | CancelResponsePayload.read | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the Cancel response payload and decode it into
its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a rea... | python | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the Cancel response payload and decode it into
its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a rea... | [
"def",
"read",
"(",
"self",
",",
"input_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"CancelResponsePayload",
",",
"self",
")",
".",
"read",
"(",
"input_stream",
",",
"kmip_version",
"=",
"kmip_vers... | Read the data encoding the Cancel response payload and decode it into
its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read method; usually a BytearrayStream
object.
kmip_version (KMIPV... | [
"Read",
"the",
"data",
"encoding",
"the",
"Cancel",
"response",
"payload",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/cancel.py#L237-L281 | test | Reads the data encoding the Cancel response payload and decode it into the object. |
OpenKMIP/PyKMIP | kmip/core/attributes.py | Name.create | def create(cls, name_value, name_type):
'''
Returns a Name object, populated with the given value and type
'''
if isinstance(name_value, Name.NameValue):
value = name_value
elif isinstance(name_value, str):
value = cls.NameValue(name_value)
els... | python | def create(cls, name_value, name_type):
'''
Returns a Name object, populated with the given value and type
'''
if isinstance(name_value, Name.NameValue):
value = name_value
elif isinstance(name_value, str):
value = cls.NameValue(name_value)
els... | [
"def",
"create",
"(",
"cls",
",",
"name_value",
",",
"name_type",
")",
":",
"if",
"isinstance",
"(",
"name_value",
",",
"Name",
".",
"NameValue",
")",
":",
"value",
"=",
"name_value",
"elif",
"isinstance",
"(",
"name_value",
",",
"str",
")",
":",
"value"... | Returns a Name object, populated with the given value and type | [
"Returns",
"a",
"Name",
"object",
"populated",
"with",
"the",
"given",
"value",
"and",
"type"
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L157-L186 | test | Returns a Name object populated with the given value and type |
OpenKMIP/PyKMIP | kmip/core/attributes.py | Digest.read | def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the Digest object and decode it into its
constituent parts.
Args:
istream (Stream): A data stream containing encoded object data,
supporting a read method; usually a ... | python | def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the Digest object and decode it into its
constituent parts.
Args:
istream (Stream): A data stream containing encoded object data,
supporting a read method; usually a ... | [
"def",
"read",
"(",
"self",
",",
"istream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"Digest",
",",
"self",
")",
".",
"read",
"(",
"istream",
",",
"kmip_version",
"=",
"kmip_version",
")",
"tstream",... | Read the data encoding the Digest object and decode it into its
constituent parts.
Args:
istream (Stream): A data stream containing encoded object data,
supporting a read method; usually a BytearrayStream object.
kmip_version (KMIPVersion): An enumeration definin... | [
"Read",
"the",
"data",
"encoding",
"the",
"Digest",
"object",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L899-L919 | test | Reads the data encoding the Digest object and decode it into its own parts. |
OpenKMIP/PyKMIP | kmip/core/attributes.py | Digest.write | def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the Digest object to a stream.
Args:
ostream (Stream): A data stream in which to encode object data,
supporting a write method; usually a BytearrayStream object.
... | python | def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the Digest object to a stream.
Args:
ostream (Stream): A data stream in which to encode object data,
supporting a write method; usually a BytearrayStream object.
... | [
"def",
"write",
"(",
"self",
",",
"ostream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"tstream",
"=",
"BytearrayStream",
"(",
")",
"self",
".",
"hashing_algorithm",
".",
"write",
"(",
"tstream",
",",
"kmip_version",
... | Write the data encoding the Digest object to a stream.
Args:
ostream (Stream): A data stream in which to encode object data,
supporting a write method; usually a BytearrayStream object.
kmip_version (KMIPVersion): An enumeration defining the KMIP
version ... | [
"Write",
"the",
"data",
"encoding",
"the",
"Digest",
"object",
"to",
"a",
"stream",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L921-L940 | test | Writes the data encoding the object to the data stream. |
OpenKMIP/PyKMIP | kmip/core/attributes.py | Digest.create | def create(cls,
hashing_algorithm=HashingAlgorithmEnum.SHA_256,
digest_value=b'',
key_format_type=KeyFormatTypeEnum.RAW):
"""
Construct a Digest object from provided digest values.
Args:
hashing_algorithm (HashingAlgorithm): An enumeratio... | python | def create(cls,
hashing_algorithm=HashingAlgorithmEnum.SHA_256,
digest_value=b'',
key_format_type=KeyFormatTypeEnum.RAW):
"""
Construct a Digest object from provided digest values.
Args:
hashing_algorithm (HashingAlgorithm): An enumeratio... | [
"def",
"create",
"(",
"cls",
",",
"hashing_algorithm",
"=",
"HashingAlgorithmEnum",
".",
"SHA_256",
",",
"digest_value",
"=",
"b''",
",",
"key_format_type",
"=",
"KeyFormatTypeEnum",
".",
"RAW",
")",
":",
"algorithm",
"=",
"HashingAlgorithm",
"(",
"hashing_algorit... | Construct a Digest object from provided digest values.
Args:
hashing_algorithm (HashingAlgorithm): An enumeration representing
the hash algorithm used to compute the digest. Optional,
defaults to HashingAlgorithm.SHA_256.
digest_value (byte string): The b... | [
"Construct",
"a",
"Digest",
"object",
"from",
"provided",
"digest",
"values",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L1003-L1039 | test | Constructs a new Digest object from provided digest values. |
OpenKMIP/PyKMIP | kmip/core/attributes.py | ApplicationSpecificInformation.read | def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the ApplicationSpecificInformation object and
decode it into its constituent parts.
Args:
istream (Stream): A data stream containing encoded object data,
supporting a... | python | def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the ApplicationSpecificInformation object and
decode it into its constituent parts.
Args:
istream (Stream): A data stream containing encoded object data,
supporting a... | [
"def",
"read",
"(",
"self",
",",
"istream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"ApplicationSpecificInformation",
",",
"self",
")",
".",
"read",
"(",
"istream",
",",
"kmip_version",
"=",
"kmip_versi... | Read the data encoding the ApplicationSpecificInformation object and
decode it into its constituent parts.
Args:
istream (Stream): A data stream containing encoded object data,
supporting a read method; usually a BytearrayStream object.
kmip_version (KMIPVersion)... | [
"Read",
"the",
"data",
"encoding",
"the",
"ApplicationSpecificInformation",
"object",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L1154-L1176 | test | Reads the data encoding the ApplicationSpecificInformation object and decode it into constituent parts. |
OpenKMIP/PyKMIP | kmip/core/attributes.py | ApplicationSpecificInformation.write | def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the ApplicationSpecificInformation object to a
stream.
Args:
ostream (Stream): A data stream in which to encode object data,
supporting a write method; usually a By... | python | def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the ApplicationSpecificInformation object to a
stream.
Args:
ostream (Stream): A data stream in which to encode object data,
supporting a write method; usually a By... | [
"def",
"write",
"(",
"self",
",",
"ostream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"tstream",
"=",
"BytearrayStream",
"(",
")",
"self",
".",
"application_namespace",
".",
"write",
"(",
"tstream",
",",
"kmip_version... | Write the data encoding the ApplicationSpecificInformation object to a
stream.
Args:
ostream (Stream): A data stream in which to encode object data,
supporting a write method; usually a BytearrayStream object.
kmip_version (KMIPVersion): An enumeration defining t... | [
"Write",
"the",
"data",
"encoding",
"the",
"ApplicationSpecificInformation",
"object",
"to",
"a",
"stream",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L1178-L1200 | test | Writes the data encoding the ApplicationSpecificInformation object to an output stream. |
OpenKMIP/PyKMIP | kmip/core/attributes.py | ApplicationSpecificInformation.create | def create(cls, application_namespace, application_data):
"""
Construct an ApplicationSpecificInformation object from provided data
and namespace values.
Args:
application_namespace (str): The name of the application namespace.
application_data (str): Application... | python | def create(cls, application_namespace, application_data):
"""
Construct an ApplicationSpecificInformation object from provided data
and namespace values.
Args:
application_namespace (str): The name of the application namespace.
application_data (str): Application... | [
"def",
"create",
"(",
"cls",
",",
"application_namespace",
",",
"application_data",
")",
":",
"namespace",
"=",
"ApplicationNamespace",
"(",
"application_namespace",
")",
"data",
"=",
"ApplicationData",
"(",
"application_data",
")",
"return",
"ApplicationSpecificInforma... | Construct an ApplicationSpecificInformation object from provided data
and namespace values.
Args:
application_namespace (str): The name of the application namespace.
application_data (str): Application data related to the namespace.
Returns:
ApplicationSpeci... | [
"Construct",
"an",
"ApplicationSpecificInformation",
"object",
"from",
"provided",
"data",
"and",
"namespace",
"values",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L1257-L1280 | test | Create an ApplicationSpecificInformation object from provided data and application namespace values. |
OpenKMIP/PyKMIP | kmip/core/attributes.py | DerivationParameters.read | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the DerivationParameters struct and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a... | python | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the DerivationParameters struct and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a... | [
"def",
"read",
"(",
"self",
",",
"input_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"DerivationParameters",
",",
"self",
")",
".",
"read",
"(",
"input_stream",
",",
"kmip_version",
"=",
"kmip_versi... | Read the data encoding the DerivationParameters struct and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read method; usually a BytearrayStream
object.
kmip_version (K... | [
"Read",
"the",
"data",
"encoding",
"the",
"DerivationParameters",
"struct",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L1443-L1493 | test | Reads the data encoding the DerivationParameters struct and decodes it into parts. |
OpenKMIP/PyKMIP | kmip/core/attributes.py | DerivationParameters.write | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the DerivationParameters struct to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a Bytearra... | python | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the DerivationParameters struct to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a Bytearra... | [
"def",
"write",
"(",
"self",
",",
"output_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"local_stream",
"=",
"BytearrayStream",
"(",
")",
"if",
"self",
".",
"_cryptographic_parameters",
":",
"self",
".",
"_cryptogra... | Write the data encoding the DerivationParameters struct to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream
object.
kmip_version (KMIPVersion): An enumeration defini... | [
"Write",
"the",
"data",
"encoding",
"the",
"DerivationParameters",
"struct",
"to",
"a",
"stream",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/attributes.py#L1495-L1540 | test | Writes the DerivationParameters struct to a byte array stream. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/get.py | GetRequestPayload.read | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the Get request payload and decode it into its
constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read me... | python | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the Get request payload and decode it into its
constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read me... | [
"def",
"read",
"(",
"self",
",",
"input_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"GetRequestPayload",
",",
"self",
")",
".",
"read",
"(",
"input_stream",
",",
"kmip_version",
"=",
"kmip_version"... | Read the data encoding the Get request payload and decode it into its
constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read method; usually a BytearrayStream
object.
kmip_version (KMIPVersi... | [
"Read",
"the",
"data",
"encoding",
"the",
"Get",
"request",
"payload",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/get.py#L159-L218 | test | Reads the data encoding the Get Request Payload and decodes it into its components. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/get.py | GetRequestPayload.write | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the Get request payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream
... | python | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the Get request payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream
... | [
"def",
"write",
"(",
"self",
",",
"output_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"local_stream",
"=",
"utils",
".",
"BytearrayStream",
"(",
")",
"if",
"self",
".",
"_unique_identifier",
"is",
"not",
"None",... | Write the data encoding the Get request payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream
object.
kmip_version (KMIPVersion): An enumeration defining the K... | [
"Write",
"the",
"data",
"encoding",
"the",
"Get",
"request",
"payload",
"to",
"a",
"stream",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/get.py#L220-L260 | test | Writes the data encoding the object to the output stream. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/get.py | GetResponsePayload.read | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the Get response payload and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read m... | python | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the Get response payload and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read m... | [
"def",
"read",
"(",
"self",
",",
"input_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"GetResponsePayload",
",",
"self",
")",
".",
"read",
"(",
"input_stream",
",",
"kmip_version",
"=",
"kmip_version... | Read the data encoding the Get response payload and decode it
into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read method; usually a BytearrayStream
object.
kmip_version (KMIPVers... | [
"Read",
"the",
"data",
"encoding",
"the",
"Get",
"response",
"payload",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/get.py#L414-L470 | test | Reads the data encoding the Get response payload and decode it into parts. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/get.py | GetResponsePayload.write | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the Get response payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream... | python | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the Get response payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream... | [
"def",
"write",
"(",
"self",
",",
"output_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"local_stream",
"=",
"utils",
".",
"BytearrayStream",
"(",
")",
"if",
"self",
".",
"object_type",
":",
"self",
".",
"_objec... | Write the data encoding the Get response payload to a stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream
object.
kmip_version (KMIPVersion): An enumeration defining the ... | [
"Write",
"the",
"data",
"encoding",
"the",
"Get",
"response",
"payload",
"to",
"a",
"stream",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/get.py#L472-L515 | test | Writes the data encoding the Get response payload to the output stream. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/signature_verify.py | SignatureVerifyRequestPayload.read | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the SignatureVerify request payload and decode
it into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporti... | python | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the SignatureVerify request payload and decode
it into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporti... | [
"def",
"read",
"(",
"self",
",",
"input_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"SignatureVerifyRequestPayload",
",",
"self",
")",
".",
"read",
"(",
"input_stream",
",",
"kmip_version",
"=",
"k... | Read the data encoding the SignatureVerify request payload and decode
it into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read method; usually a BytearrayStream
object.
kmip_versio... | [
"Read",
"the",
"data",
"encoding",
"the",
"SignatureVerify",
"request",
"payload",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/signature_verify.py#L251-L321 | test | Reads the contents of the SignatureVerifyRequestPayload into the object. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/signature_verify.py | SignatureVerifyRequestPayload.write | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the SignatureVerify request payload to a
stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usuall... | python | def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Write the data encoding the SignatureVerify request payload to a
stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usuall... | [
"def",
"write",
"(",
"self",
",",
"output_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"local_stream",
"=",
"utils",
".",
"BytearrayStream",
"(",
")",
"if",
"self",
".",
"_unique_identifier",
":",
"self",
".",
... | Write the data encoding the SignatureVerify request payload to a
stream.
Args:
output_stream (stream): A data stream in which to encode object
data, supporting a write method; usually a BytearrayStream
object.
kmip_version (KMIPVersion): An enumer... | [
"Write",
"the",
"data",
"encoding",
"the",
"SignatureVerify",
"request",
"payload",
"to",
"a",
"stream",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/signature_verify.py#L323-L381 | test | Writes the contents of this object to the output stream. |
OpenKMIP/PyKMIP | kmip/core/messages/payloads/signature_verify.py | SignatureVerifyResponsePayload.read | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the SignatureVerify response payload and decode
it into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, support... | python | def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the SignatureVerify response payload and decode
it into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, support... | [
"def",
"read",
"(",
"self",
",",
"input_stream",
",",
"kmip_version",
"=",
"enums",
".",
"KMIPVersion",
".",
"KMIP_1_0",
")",
":",
"super",
"(",
"SignatureVerifyResponsePayload",
",",
"self",
")",
".",
"read",
"(",
"input_stream",
",",
"kmip_version",
"=",
"... | Read the data encoding the SignatureVerify response payload and decode
it into its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a read method; usually a BytearrayStream
object.
kmip_versi... | [
"Read",
"the",
"data",
"encoding",
"the",
"SignatureVerify",
"response",
"payload",
"and",
"decode",
"it",
"into",
"its",
"constituent",
"parts",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/messages/payloads/signature_verify.py#L568-L630 | test | Reads the contents of the SignatureVerify response payload and decodes it into its constituent parts. |
OpenKMIP/PyKMIP | kmip/services/server/engine.py | KmipEngine.process_request | def process_request(self, request, credential=None):
"""
Process a KMIP request message.
This routine is the main driver of the KmipEngine. It breaks apart and
processes the request header, handles any message errors that may
result, and then passes the set of request batch item... | python | def process_request(self, request, credential=None):
"""
Process a KMIP request message.
This routine is the main driver of the KmipEngine. It breaks apart and
processes the request header, handles any message errors that may
result, and then passes the set of request batch item... | [
"def",
"process_request",
"(",
"self",
",",
"request",
",",
"credential",
"=",
"None",
")",
":",
"self",
".",
"_client_identity",
"=",
"[",
"None",
",",
"None",
"]",
"header",
"=",
"request",
".",
"request_header",
"# Process the protocol version",
"self",
"."... | Process a KMIP request message.
This routine is the main driver of the KmipEngine. It breaks apart and
processes the request header, handles any message errors that may
result, and then passes the set of request batch items on for
processing. This routine is thread-safe, allowing multip... | [
"Process",
"a",
"KMIP",
"request",
"message",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/engine.py#L189-L310 | test | This routine processes a request message and processes the response. |
OpenKMIP/PyKMIP | kmip/services/server/engine.py | KmipEngine.build_error_response | def build_error_response(self, version, reason, message):
"""
Build a simple ResponseMessage with a single error result.
Args:
version (ProtocolVersion): The protocol version the response
should be addressed with.
reason (ResultReason): An enumeration cla... | python | def build_error_response(self, version, reason, message):
"""
Build a simple ResponseMessage with a single error result.
Args:
version (ProtocolVersion): The protocol version the response
should be addressed with.
reason (ResultReason): An enumeration cla... | [
"def",
"build_error_response",
"(",
"self",
",",
"version",
",",
"reason",
",",
"message",
")",
":",
"batch_item",
"=",
"messages",
".",
"ResponseBatchItem",
"(",
"result_status",
"=",
"contents",
".",
"ResultStatus",
"(",
"enums",
".",
"ResultStatus",
".",
"O... | Build a simple ResponseMessage with a single error result.
Args:
version (ProtocolVersion): The protocol version the response
should be addressed with.
reason (ResultReason): An enumeration classifying the type of
error occurred.
message (str)... | [
"Build",
"a",
"simple",
"ResponseMessage",
"with",
"a",
"single",
"error",
"result",
"."
] | b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e | https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/services/server/engine.py#L324-L347 | test | Builds a simple ResponseMessage containing a single error result. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.