partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | PublicSuffix._extensions | Extract the extension from the given line.
:param line: The line from the official public suffix repository.
:type line: str | PyFunceble/publicsuffix.py | def _extensions(self, line):
"""
Extract the extension from the given line.
:param line: The line from the official public suffix repository.
:type line: str
"""
# We strip the parsed line.
line = line.strip()
if not line.startswith("//") and "." in lin... | def _extensions(self, line):
"""
Extract the extension from the given line.
:param line: The line from the official public suffix repository.
:type line: str
"""
# We strip the parsed line.
line = line.strip()
if not line.startswith("//") and "." in lin... | [
"Extract",
"the",
"extension",
"from",
"the",
"given",
"line",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/publicsuffix.py#L104-L146 | [
"def",
"_extensions",
"(",
"self",
",",
"line",
")",
":",
"# We strip the parsed line.",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"not",
"line",
".",
"startswith",
"(",
"\"//\"",
")",
"and",
"\".\"",
"in",
"line",
":",
"# * The parsed line is not a... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | PublicSuffix.update | Update of the content of the :code:`public-suffix.json`. | PyFunceble/publicsuffix.py | def update(self):
"""
Update of the content of the :code:`public-suffix.json`.
"""
if not PyFunceble.CONFIGURATION["quiet"]:
# The quiet mode is not activated.
# We print a message for the user on screen.
print(
"Update of %s" % PyFun... | def update(self):
"""
Update of the content of the :code:`public-suffix.json`.
"""
if not PyFunceble.CONFIGURATION["quiet"]:
# The quiet mode is not activated.
# We print a message for the user on screen.
print(
"Update of %s" % PyFun... | [
"Update",
"of",
"the",
"content",
"of",
"the",
":",
"code",
":",
"public",
"-",
"suffix",
".",
"json",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/publicsuffix.py#L148-L172 | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"not",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"quiet\"",
"]",
":",
"# The quiet mode is not activated.",
"# We print a message for the user on screen.",
"print",
"(",
"\"Update of %s\"",
"%",
"PyFunceble",
".",
"OUTPUTS"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | PublicSuffix.load | Load the public suffix database into the system. | PyFunceble/publicsuffix.py | def load(self):
"""
Load the public suffix database into the system.
"""
if not PyFunceble.INTERN["psl_db"]:
# The public database was not already loaded.
# * We read, convert to dict and return the file content.
# and
# * We fill/create ... | def load(self):
"""
Load the public suffix database into the system.
"""
if not PyFunceble.INTERN["psl_db"]:
# The public database was not already loaded.
# * We read, convert to dict and return the file content.
# and
# * We fill/create ... | [
"Load",
"the",
"public",
"suffix",
"database",
"into",
"the",
"system",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/publicsuffix.py#L174-L187 | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"not",
"PyFunceble",
".",
"INTERN",
"[",
"\"psl_db\"",
"]",
":",
"# The public database was not already loaded.",
"# * We read, convert to dict and return the file content.",
"# and",
"# * We fill/create the database.",
"PyFunceble",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Sort.standard | Implement the standard and alphabetical sorting.
:param element: The element we are currently reading.
:type element: str
:return: The formatted element.
:rtype: str | PyFunceble/sort.py | def standard(cls, element):
"""
Implement the standard and alphabetical sorting.
:param element: The element we are currently reading.
:type element: str
:return: The formatted element.
:rtype: str
"""
# We remove all special characters and return the f... | def standard(cls, element):
"""
Implement the standard and alphabetical sorting.
:param element: The element we are currently reading.
:type element: str
:return: The formatted element.
:rtype: str
"""
# We remove all special characters and return the f... | [
"Implement",
"the",
"standard",
"and",
"alphabetical",
"sorting",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/sort.py#L79-L95 | [
"def",
"standard",
"(",
"cls",
",",
"element",
")",
":",
"# We remove all special characters and return the formatted string.",
"return",
"(",
"Regex",
"(",
"element",
",",
"cls",
".",
"regex_replace",
",",
"replace_with",
"=",
"\"@funilrys\"",
")",
".",
"replace",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Sort.hierarchical | The idea behind this method is to sort a list of domain hierarchicaly.
:param element: The element we are currently reading.
:type element: str
:return: The formatted element.
:rtype: str
.. note::
For a domain like :code:`aaa.bbb.ccc.tdl`.
A normal so... | PyFunceble/sort.py | def hierarchical(cls, element):
"""
The idea behind this method is to sort a list of domain hierarchicaly.
:param element: The element we are currently reading.
:type element: str
:return: The formatted element.
:rtype: str
.. note::
For a domain li... | def hierarchical(cls, element):
"""
The idea behind this method is to sort a list of domain hierarchicaly.
:param element: The element we are currently reading.
:type element: str
:return: The formatted element.
:rtype: str
.. note::
For a domain li... | [
"The",
"idea",
"behind",
"this",
"method",
"is",
"to",
"sort",
"a",
"list",
"of",
"domain",
"hierarchicaly",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/sort.py#L98-L247 | [
"def",
"hierarchical",
"(",
"cls",
",",
"element",
")",
":",
"# We initiate a variable which will save the element to sort without",
"# the extension.",
"to_sort",
"=",
"\"\"",
"# We initiate a variable which will save the full extension.",
"full_extension",
"=",
"\"\"",
"# We conv... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | IANA.load | Initiate the IANA database if it is not the case. | PyFunceble/iana.py | def load(self):
"""
Initiate the IANA database if it is not the case.
"""
if "iana_db" not in PyFunceble.INTERN or not PyFunceble.INTERN["iana_db"]:
# The global database is empty, None or does not exist.
# We update it with the database content.
PyF... | def load(self):
"""
Initiate the IANA database if it is not the case.
"""
if "iana_db" not in PyFunceble.INTERN or not PyFunceble.INTERN["iana_db"]:
# The global database is empty, None or does not exist.
# We update it with the database content.
PyF... | [
"Initiate",
"the",
"IANA",
"database",
"if",
"it",
"is",
"not",
"the",
"case",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/iana.py#L389-L398 | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"\"iana_db\"",
"not",
"in",
"PyFunceble",
".",
"INTERN",
"or",
"not",
"PyFunceble",
".",
"INTERN",
"[",
"\"iana_db\"",
"]",
":",
"# The global database is empty, None or does not exist.",
"# We update it with the database cont... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | IANA._referer | Return the referer for the given extension.
:param extension: A valid domain extension.
:type extension: str
:return: The whois server to use to get the WHOIS record.
:rtype: str | PyFunceble/iana.py | def _referer(self, extension):
"""
Return the referer for the given extension.
:param extension: A valid domain extension.
:type extension: str
:return: The whois server to use to get the WHOIS record.
:rtype: str
"""
# We get the a copy of the page.
... | def _referer(self, extension):
"""
Return the referer for the given extension.
:param extension: A valid domain extension.
:type extension: str
:return: The whois server to use to get the WHOIS record.
:rtype: str
"""
# We get the a copy of the page.
... | [
"Return",
"the",
"referer",
"for",
"the",
"given",
"extension",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/iana.py#L400-L445 | [
"def",
"_referer",
"(",
"self",
",",
"extension",
")",
":",
"# We get the a copy of the page.",
"iana_record",
"=",
"self",
".",
"lookup",
".",
"whois",
"(",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"iana_whois_server\"",
"]",
",",
"\"hello.%s\"",
"%",
"extensio... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | IANA._extensions | Extract the extention from the given block.
Plus get its referer. | PyFunceble/iana.py | def _extensions(self):
"""
Extract the extention from the given block.
Plus get its referer.
"""
upstream_lines = (
Download(self.iana_url, return_data=True)
.text()
.split('<span class="domain tld">')
)
# We extract the diffe... | def _extensions(self):
"""
Extract the extention from the given block.
Plus get its referer.
"""
upstream_lines = (
Download(self.iana_url, return_data=True)
.text()
.split('<span class="domain tld">')
)
# We extract the diffe... | [
"Extract",
"the",
"extention",
"from",
"the",
"given",
"block",
".",
"Plus",
"get",
"its",
"referer",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/iana.py#L447-L478 | [
"def",
"_extensions",
"(",
"self",
")",
":",
"upstream_lines",
"=",
"(",
"Download",
"(",
"self",
".",
"iana_url",
",",
"return_data",
"=",
"True",
")",
".",
"text",
"(",
")",
".",
"split",
"(",
"'<span class=\"domain tld\">'",
")",
")",
"# We extract the di... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | IANA.update | Update the content of the `iana-domains-db` file. | PyFunceble/iana.py | def update(self):
"""
Update the content of the `iana-domains-db` file.
"""
if not PyFunceble.CONFIGURATION["quiet"]:
# * The quiet mode is not activated.
# We print on screen what we are doing.
print("Update of iana-domains-db", end=" ")
# ... | def update(self):
"""
Update the content of the `iana-domains-db` file.
"""
if not PyFunceble.CONFIGURATION["quiet"]:
# * The quiet mode is not activated.
# We print on screen what we are doing.
print("Update of iana-domains-db", end=" ")
# ... | [
"Update",
"the",
"content",
"of",
"the",
"iana",
"-",
"domains",
"-",
"db",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/iana.py#L480-L505 | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"not",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"quiet\"",
"]",
":",
"# * The quiet mode is not activated.",
"# We print on screen what we are doing.",
"print",
"(",
"\"Update of iana-domains-db\"",
",",
"end",
"=",
"\" \"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Mining.mine | Search for domain or URL related to the original URL or domain.
:return: The mined domains or URL.
:rtype: dict | PyFunceble/mining.py | def mine(self): # pragma: no cover
"""
Search for domain or URL related to the original URL or domain.
:return: The mined domains or URL.
:rtype: dict
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
try:
# ... | def mine(self): # pragma: no cover
"""
Search for domain or URL related to the original URL or domain.
:return: The mined domains or URL.
:rtype: dict
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
try:
# ... | [
"Search",
"for",
"domain",
"or",
"URL",
"related",
"to",
"the",
"original",
"URL",
"or",
"domain",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L122-L204 | [
"def",
"mine",
"(",
"self",
")",
":",
"# pragma: no cover",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"mining\"",
"]",
":",
"# The mining is activated.",
"try",
":",
"# We get the history.",
"history",
"=",
"PyFunceble",
".",
"requests",
".",
"get",
"(",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Mining._retrieve | Retrieve the mining informations. | PyFunceble/mining.py | def _retrieve(self):
"""
Retrieve the mining informations.
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
if "mined" not in PyFunceble.INTERN:
PyFunceble.INTERN["mined"] = {}
if PyFunceble.path.isfile(self.file... | def _retrieve(self):
"""
Retrieve the mining informations.
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
if "mined" not in PyFunceble.INTERN:
PyFunceble.INTERN["mined"] = {}
if PyFunceble.path.isfile(self.file... | [
"Retrieve",
"the",
"mining",
"informations",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L206-L241 | [
"def",
"_retrieve",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"mining\"",
"]",
":",
"# The mining is activated.",
"if",
"\"mined\"",
"not",
"in",
"PyFunceble",
".",
"INTERN",
":",
"PyFunceble",
".",
"INTERN",
"[",
"\"mined\"",
"]"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Mining._backup | Backup the mined informations. | PyFunceble/mining.py | def _backup(self):
"""
Backup the mined informations.
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
# We backup our mined informations.
Dict(PyFunceble.INTERN["mined"]).to_json(self.file) | def _backup(self):
"""
Backup the mined informations.
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
# We backup our mined informations.
Dict(PyFunceble.INTERN["mined"]).to_json(self.file) | [
"Backup",
"the",
"mined",
"informations",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L243-L252 | [
"def",
"_backup",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"mining\"",
"]",
":",
"# The mining is activated.",
"# We backup our mined informations.",
"Dict",
"(",
"PyFunceble",
".",
"INTERN",
"[",
"\"mined\"",
"]",
")",
".",
"to_json... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Mining._add | Add the currently mined information to the
mined "database".
:param to_add: The element to add.
:type to_add: dict | PyFunceble/mining.py | def _add(self, to_add):
"""
Add the currently mined information to the
mined "database".
:param to_add: The element to add.
:type to_add: dict
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
if PyFunceble.INTERN["fi... | def _add(self, to_add):
"""
Add the currently mined information to the
mined "database".
:param to_add: The element to add.
:type to_add: dict
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
if PyFunceble.INTERN["fi... | [
"Add",
"the",
"currently",
"mined",
"information",
"to",
"the",
"mined",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L254-L303 | [
"def",
"_add",
"(",
"self",
",",
"to_add",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"mining\"",
"]",
":",
"# The mining is activated.",
"if",
"PyFunceble",
".",
"INTERN",
"[",
"\"file_to_test\"",
"]",
"not",
"in",
"PyFunceble",
".",
"INTERN",... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Mining.remove | Remove the currently tested element from the mining
data. | PyFunceble/mining.py | def remove(self):
"""
Remove the currently tested element from the mining
data.
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
if PyFunceble.INTERN["file_to_test"] in PyFunceble.INTERN["mined"]:
# The currently test... | def remove(self):
"""
Remove the currently tested element from the mining
data.
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
if PyFunceble.INTERN["file_to_test"] in PyFunceble.INTERN["mined"]:
# The currently test... | [
"Remove",
"the",
"currently",
"tested",
"element",
"from",
"the",
"mining",
"data",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L305-L337 | [
"def",
"remove",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"mining\"",
"]",
":",
"# The mining is activated.",
"if",
"PyFunceble",
".",
"INTERN",
"[",
"\"file_to_test\"",
"]",
"in",
"PyFunceble",
".",
"INTERN",
"[",
"\"mined\"",
"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Mining.list_of_mined | Provide the list of mined so they can be added to the list
queue.
:return: The list of mined domains or URL.
:rtype: list | PyFunceble/mining.py | def list_of_mined(cls):
"""
Provide the list of mined so they can be added to the list
queue.
:return: The list of mined domains or URL.
:rtype: list
"""
# We initiate a variable which will return the result.
result = []
if PyFunceble.CONFIGURAT... | def list_of_mined(cls):
"""
Provide the list of mined so they can be added to the list
queue.
:return: The list of mined domains or URL.
:rtype: list
"""
# We initiate a variable which will return the result.
result = []
if PyFunceble.CONFIGURAT... | [
"Provide",
"the",
"list",
"of",
"mined",
"so",
"they",
"can",
"be",
"added",
"to",
"the",
"list",
"queue",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L340-L374 | [
"def",
"list_of_mined",
"(",
"cls",
")",
":",
"# We initiate a variable which will return the result.",
"result",
"=",
"[",
"]",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"mining\"",
"]",
":",
"# The mining is activated.",
"if",
"PyFunceble",
".",
"INTERN",
"["... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Mining.process | Process the logic and structuration of the mining database. | PyFunceble/mining.py | def process(self): # pragma: no cover
"""
Process the logic and structuration of the mining database.
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
# We load the mining logic.
mined = self.mine()
if mined:
... | def process(self): # pragma: no cover
"""
Process the logic and structuration of the mining database.
"""
if PyFunceble.CONFIGURATION["mining"]:
# The mining is activated.
# We load the mining logic.
mined = self.mine()
if mined:
... | [
"Process",
"the",
"logic",
"and",
"structuration",
"of",
"the",
"mining",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/mining.py#L376-L394 | [
"def",
"process",
"(",
"self",
")",
":",
"# pragma: no cover",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"mining\"",
"]",
":",
"# The mining is activated.",
"# We load the mining logic.",
"mined",
"=",
"self",
".",
"mine",
"(",
")",
"if",
"mined",
":",
"#... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Logs._get_content | Get and return the content of the given log file.
:param file: The file we have to get the content from.
:type file: str
:return The content of the given file.
:rtype: dict | PyFunceble/logs.py | def _get_content(cls, file):
"""
Get and return the content of the given log file.
:param file: The file we have to get the content from.
:type file: str
:return The content of the given file.
:rtype: dict
"""
if PyFunceble.path.isfile(file):
... | def _get_content(cls, file):
"""
Get and return the content of the given log file.
:param file: The file we have to get the content from.
:type file: str
:return The content of the given file.
:rtype: dict
"""
if PyFunceble.path.isfile(file):
... | [
"Get",
"and",
"return",
"the",
"content",
"of",
"the",
"given",
"log",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/logs.py#L84-L98 | [
"def",
"_get_content",
"(",
"cls",
",",
"file",
")",
":",
"if",
"PyFunceble",
".",
"path",
".",
"isfile",
"(",
"file",
")",
":",
"return",
"Dict",
"(",
")",
".",
"from_json",
"(",
"File",
"(",
"file",
")",
".",
"read",
"(",
")",
")",
"return",
"{... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Logs._write_content | Write the content into the given file.
:param content: The dict to write.
:type content: dict
:param file: The file to write.
:type file: str | PyFunceble/logs.py | def _write_content(cls, content, file):
"""
Write the content into the given file.
:param content: The dict to write.
:type content: dict
:param file: The file to write.
:type file: str
"""
if not PyFunceble.CONFIGURATION["no_files"]:
if not... | def _write_content(cls, content, file):
"""
Write the content into the given file.
:param content: The dict to write.
:type content: dict
:param file: The file to write.
:type file: str
"""
if not PyFunceble.CONFIGURATION["no_files"]:
if not... | [
"Write",
"the",
"content",
"into",
"the",
"given",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/logs.py#L101-L116 | [
"def",
"_write_content",
"(",
"cls",
",",
"content",
",",
"file",
")",
":",
"if",
"not",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"no_files\"",
"]",
":",
"if",
"not",
"isinstance",
"(",
"content",
",",
"dict",
")",
":",
"content",
"=",
"{",
"}",
"Dic... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Logs.whois | Logs the WHOIS record if needed.
:param record: The record to log.
:type record: str | PyFunceble/logs.py | def whois(self, record):
"""
Logs the WHOIS record if needed.
:param record: The record to log.
:type record: str
"""
if PyFunceble.CONFIGURATION["debug"] and PyFunceble.CONFIGURATION["logs"]:
# The debug and the logs subsystem are activated.
if... | def whois(self, record):
"""
Logs the WHOIS record if needed.
:param record: The record to log.
:type record: str
"""
if PyFunceble.CONFIGURATION["debug"] and PyFunceble.CONFIGURATION["logs"]:
# The debug and the logs subsystem are activated.
if... | [
"Logs",
"the",
"WHOIS",
"record",
"if",
"needed",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/logs.py#L118-L153 | [
"def",
"whois",
"(",
"self",
",",
"record",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"debug\"",
"]",
"and",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"logs\"",
"]",
":",
"# The debug and the logs subsystem are activated.",
"if",
"PyFunceble",
".... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Logs.expiration_date | Logs the extracted expiration date.
:param extracted: The extracted expiration date (from WHOIS record).
:type extracted: str | PyFunceble/logs.py | def expiration_date(self, extracted):
"""
Logs the extracted expiration date.
:param extracted: The extracted expiration date (from WHOIS record).
:type extracted: str
"""
if PyFunceble.CONFIGURATION["logs"]:
# The logs subsystem is activated.
i... | def expiration_date(self, extracted):
"""
Logs the extracted expiration date.
:param extracted: The extracted expiration date (from WHOIS record).
:type extracted: str
"""
if PyFunceble.CONFIGURATION["logs"]:
# The logs subsystem is activated.
i... | [
"Logs",
"the",
"extracted",
"expiration",
"date",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/logs.py#L155-L199 | [
"def",
"expiration_date",
"(",
"self",
",",
"extracted",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"logs\"",
"]",
":",
"# The logs subsystem is activated.",
"if",
"PyFunceble",
".",
"INTERN",
"[",
"\"referer\"",
"]",
":",
"referer",
"=",
"PyFunc... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Logs.referer_not_found | Logs the case that the referer was not found.
:param extension: The extension of the domain we are testing.
:type extension: str | PyFunceble/logs.py | def referer_not_found(self, extension):
"""
Logs the case that the referer was not found.
:param extension: The extension of the domain we are testing.
:type extension: str
"""
if PyFunceble.CONFIGURATION["logs"]:
# The logs subsystem is activated.
... | def referer_not_found(self, extension):
"""
Logs the case that the referer was not found.
:param extension: The extension of the domain we are testing.
:type extension: str
"""
if PyFunceble.CONFIGURATION["logs"]:
# The logs subsystem is activated.
... | [
"Logs",
"the",
"case",
"that",
"the",
"referer",
"was",
"not",
"found",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/logs.py#L201-L238 | [
"def",
"referer_not_found",
"(",
"self",
",",
"extension",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"logs\"",
"]",
":",
"# The logs subsystem is activated.",
"to_write",
"=",
"{",
"self",
".",
"current_time",
":",
"{",
"\"domain\"",
":",
"PyFun... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Prints._before_header | Print informations about PyFunceble and the date of generation of a file
into a given path, if doesn't exist. | PyFunceble/prints.py | def _before_header(self):
"""
Print informations about PyFunceble and the date of generation of a file
into a given path, if doesn't exist.
"""
if (
not PyFunceble.CONFIGURATION["no_files"]
and self.output
and not PyFunceble.path.isfile(self.o... | def _before_header(self):
"""
Print informations about PyFunceble and the date of generation of a file
into a given path, if doesn't exist.
"""
if (
not PyFunceble.CONFIGURATION["no_files"]
and self.output
and not PyFunceble.path.isfile(self.o... | [
"Print",
"informations",
"about",
"PyFunceble",
"and",
"the",
"date",
"of",
"generation",
"of",
"a",
"file",
"into",
"a",
"given",
"path",
"if",
"doesn",
"t",
"exist",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L180-L233 | [
"def",
"_before_header",
"(",
"self",
")",
":",
"if",
"(",
"not",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"no_files\"",
"]",
"and",
"self",
".",
"output",
"and",
"not",
"PyFunceble",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"output",
")",
")",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Prints._header_constructor | Construct header of the table according to template.
:param data_to_print:
The list of data to print into the header of the table.
:type data_to_print: list
:param header_separator:
The separator to use between the table header and our data.
:type header_separat... | PyFunceble/prints.py | def _header_constructor(
cls, data_to_print, header_separator="-", column_separator=" "
):
"""
Construct header of the table according to template.
:param data_to_print:
The list of data to print into the header of the table.
:type data_to_print: list
:p... | def _header_constructor(
cls, data_to_print, header_separator="-", column_separator=" "
):
"""
Construct header of the table according to template.
:param data_to_print:
The list of data to print into the header of the table.
:type data_to_print: list
:p... | [
"Construct",
"header",
"of",
"the",
"table",
"according",
"to",
"template",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L236-L325 | [
"def",
"_header_constructor",
"(",
"cls",
",",
"data_to_print",
",",
"header_separator",
"=",
"\"-\"",
",",
"column_separator",
"=",
"\" \"",
")",
":",
"# We initiate a variable which will save the header data.",
"header_data",
"=",
"[",
"]",
"# We initiate a variable which... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Prints.header | Management and creation of templates of header.
Please consider as "header" the title of each columns.
:param do_not_print:
Tell us if we have to print the header or not.
:type do_not_print: bool | PyFunceble/prints.py | def header(
self, do_not_print=False
): # pragma: no cover pylint: disable=too-many-branches
"""
Management and creation of templates of header.
Please consider as "header" the title of each columns.
:param do_not_print:
Tell us if we have to print the header or... | def header(
self, do_not_print=False
): # pragma: no cover pylint: disable=too-many-branches
"""
Management and creation of templates of header.
Please consider as "header" the title of each columns.
:param do_not_print:
Tell us if we have to print the header or... | [
"Management",
"and",
"creation",
"of",
"templates",
"of",
"header",
".",
"Please",
"consider",
"as",
"header",
"the",
"title",
"of",
"each",
"columns",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L327-L441 | [
"def",
"header",
"(",
"self",
",",
"do_not_print",
"=",
"False",
")",
":",
"# pragma: no cover pylint: disable=too-many-branches",
"if",
"(",
"not",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"header_printed\"",
"]",
"or",
"self",
".",
"template",
"==",
"\"Percentag... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Prints._data_constructor | Construct the table of data according to given size.
:param size: The maximal length of each string in the table.
:type size: list
:return:
A dict with all information about the data and how to which what
maximal size to print it.
:rtype: OrderedDict
:r... | PyFunceble/prints.py | def _data_constructor(self, size):
"""
Construct the table of data according to given size.
:param size: The maximal length of each string in the table.
:type size: list
:return:
A dict with all information about the data and how to which what
maximal si... | def _data_constructor(self, size):
"""
Construct the table of data according to given size.
:param size: The maximal length of each string in the table.
:type size: list
:return:
A dict with all information about the data and how to which what
maximal si... | [
"Construct",
"the",
"table",
"of",
"data",
"according",
"to",
"given",
"size",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L443-L481 | [
"def",
"_data_constructor",
"(",
"self",
",",
"size",
")",
":",
"# We initiate a variable which will save what we are going to",
"# return.",
"result",
"=",
"PyFunceble",
".",
"OrderedDict",
"(",
")",
"if",
"len",
"(",
"self",
".",
"data_to_print",
")",
"==",
"len",... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Prints._size_from_header | Get the size of each columns from the header.
:param header:
The header template we have to get the size from.
:type header: dict
:return: The maximal size of the each data to print.
:rtype: list | PyFunceble/prints.py | def _size_from_header(cls, header):
"""
Get the size of each columns from the header.
:param header:
The header template we have to get the size from.
:type header: dict
:return: The maximal size of the each data to print.
:rtype: list
"""
#... | def _size_from_header(cls, header):
"""
Get the size of each columns from the header.
:param header:
The header template we have to get the size from.
:type header: dict
:return: The maximal size of the each data to print.
:rtype: list
"""
#... | [
"Get",
"the",
"size",
"of",
"each",
"columns",
"from",
"the",
"header",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L484-L506 | [
"def",
"_size_from_header",
"(",
"cls",
",",
"header",
")",
":",
"# We initiate the result we are going to return.",
"result",
"=",
"[",
"]",
"for",
"data",
"in",
"header",
":",
"# We lopp through the header.",
"# And we append the size to our result.",
"result",
".",
"ap... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Prints._colorify | Retun colored string.
:param data: The string to colorify.
:type data: str
:return: A colored string.
:rtype: str | PyFunceble/prints.py | def _colorify(self, data):
"""
Retun colored string.
:param data: The string to colorify.
:type data: str
:return: A colored string.
:rtype: str
"""
if self.template in ["Generic", "Less"]:
# The template is in the list of template that need... | def _colorify(self, data):
"""
Retun colored string.
:param data: The string to colorify.
:type data: str
:return: A colored string.
:rtype: str
"""
if self.template in ["Generic", "Less"]:
# The template is in the list of template that need... | [
"Retun",
"colored",
"string",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L508-L542 | [
"def",
"_colorify",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"template",
"in",
"[",
"\"Generic\"",
",",
"\"Less\"",
"]",
":",
"# The template is in the list of template that need the coloration.",
"if",
"(",
"self",
".",
"data_to_print",
"[",
"1",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Prints._json_print | Management of the json template. | PyFunceble/prints.py | def _json_print(self): # pragma: no cover
"""
Management of the json template.
"""
if self.output:
# The given output is not empty.
if PyFunceble.path.isfile(self.output):
# The given output already exist.
# We get the content o... | def _json_print(self): # pragma: no cover
"""
Management of the json template.
"""
if self.output:
# The given output is not empty.
if PyFunceble.path.isfile(self.output):
# The given output already exist.
# We get the content o... | [
"Management",
"of",
"the",
"json",
"template",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L544-L593 | [
"def",
"_json_print",
"(",
"self",
")",
":",
"# pragma: no cover",
"if",
"self",
".",
"output",
":",
"# The given output is not empty.",
"if",
"PyFunceble",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"output",
")",
":",
"# The given output already exist.",
"# W... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Prints.data | Management and input of data to the table.
:raises:
:code:`Exception`
When self.data_to_print is not a list. | PyFunceble/prints.py | def data(self): # pragma: no cover pylint: disable=inconsistent-return-statements
"""
Management and input of data to the table.
:raises:
:code:`Exception`
When self.data_to_print is not a list.
"""
if isinstance(self.data_to_print, list):
... | def data(self): # pragma: no cover pylint: disable=inconsistent-return-statements
"""
Management and input of data to the table.
:raises:
:code:`Exception`
When self.data_to_print is not a list.
"""
if isinstance(self.data_to_print, list):
... | [
"Management",
"and",
"input",
"of",
"data",
"to",
"the",
"table",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/prints.py#L595-L692 | [
"def",
"data",
"(",
"self",
")",
":",
"# pragma: no cover pylint: disable=inconsistent-return-statements",
"if",
"isinstance",
"(",
"self",
".",
"data_to_print",
",",
"list",
")",
":",
"# The data to print is a list.",
"# We initiate the data we are going to print.",
"to_prin... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | ExecutionTime._save | Save the current time to the file.
:param last:
Tell us if we are at the very end of the file testing.
:type last: bool | PyFunceble/execution_time.py | def _save(self, last=False): # pragma: no cover
"""
Save the current time to the file.
:param last:
Tell us if we are at the very end of the file testing.
:type last: bool
"""
if (
self._authorization()
and PyFunceble.CONFIGURATION["... | def _save(self, last=False): # pragma: no cover
"""
Save the current time to the file.
:param last:
Tell us if we are at the very end of the file testing.
:type last: bool
"""
if (
self._authorization()
and PyFunceble.CONFIGURATION["... | [
"Save",
"the",
"current",
"time",
"to",
"the",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/execution_time.py#L133-L244 | [
"def",
"_save",
"(",
"self",
",",
"last",
"=",
"False",
")",
":",
"# pragma: no cover",
"if",
"(",
"self",
".",
"_authorization",
"(",
")",
"and",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"logs\"",
"]",
"and",
"\"file_to_test\"",
"in",
"PyFunceble",
".",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | ExecutionTime._calculate | calculate the difference between starting and ending time.
:param start: A starting time.
:type start: int|str
:param stop: A ending time.
:type stop: int|str
:return:
A dict with following as index.
* :code:`days`
* :code:`hours`
... | PyFunceble/execution_time.py | def _calculate(cls, start=None, end=None):
"""
calculate the difference between starting and ending time.
:param start: A starting time.
:type start: int|str
:param stop: A ending time.
:type stop: int|str
:return:
A dict with following as index.
... | def _calculate(cls, start=None, end=None):
"""
calculate the difference between starting and ending time.
:param start: A starting time.
:type start: int|str
:param stop: A ending time.
:type stop: int|str
:return:
A dict with following as index.
... | [
"calculate",
"the",
"difference",
"between",
"starting",
"and",
"ending",
"time",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/execution_time.py#L265-L318 | [
"def",
"_calculate",
"(",
"cls",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"if",
"start",
"and",
"end",
":",
"# The start and end time is explicitly given.",
"# We get the difference between the ending and the starting time.",
"time_difference",
"=",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | ExecutionTime.format_execution_time | Format the calculated time into a human readable format.
:param start: A starting time.
:type start: int|str
:param stop: A ending time.
:type stop: int|str
:return: A human readable date.
:rtype: str | PyFunceble/execution_time.py | def format_execution_time(self, start=None, end=None):
"""
Format the calculated time into a human readable format.
:param start: A starting time.
:type start: int|str
:param stop: A ending time.
:type stop: int|str
:return: A human readable date.
:rtyp... | def format_execution_time(self, start=None, end=None):
"""
Format the calculated time into a human readable format.
:param start: A starting time.
:type start: int|str
:param stop: A ending time.
:type stop: int|str
:return: A human readable date.
:rtyp... | [
"Format",
"the",
"calculated",
"time",
"into",
"a",
"human",
"readable",
"format",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/execution_time.py#L320-L335 | [
"def",
"format_execution_time",
"(",
"self",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"# We return the formatted execution time.",
"return",
"\":\"",
".",
"join",
"(",
"list",
"(",
"self",
".",
"_calculate",
"(",
"start",
",",
"end",
")"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Clean.file_to_delete | Return the list of file to delete. | PyFunceble/clean.py | def file_to_delete(cls):
"""
Return the list of file to delete.
"""
# We initiate the directory we have to look for.
directory = PyFunceble.OUTPUT_DIRECTORY + PyFunceble.OUTPUTS["parent_directory"]
if not directory.endswith(PyFunceble.directory_separator): # pragma: no... | def file_to_delete(cls):
"""
Return the list of file to delete.
"""
# We initiate the directory we have to look for.
directory = PyFunceble.OUTPUT_DIRECTORY + PyFunceble.OUTPUTS["parent_directory"]
if not directory.endswith(PyFunceble.directory_separator): # pragma: no... | [
"Return",
"the",
"list",
"of",
"file",
"to",
"delete",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/clean.py#L128-L170 | [
"def",
"file_to_delete",
"(",
"cls",
")",
":",
"# We initiate the directory we have to look for.",
"directory",
"=",
"PyFunceble",
".",
"OUTPUT_DIRECTORY",
"+",
"PyFunceble",
".",
"OUTPUTS",
"[",
"\"parent_directory\"",
"]",
"if",
"not",
"directory",
".",
"endswith",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Clean.databases_to_delete | Set the databases files to delete. | PyFunceble/clean.py | def databases_to_delete(cls): # pragma: no cover
"""
Set the databases files to delete.
"""
# We initiate the directory we have to look for.
directory = PyFunceble.CURRENT_DIRECTORY
# We initate the result variable.
result = []
# We append the dir_stru... | def databases_to_delete(cls): # pragma: no cover
"""
Set the databases files to delete.
"""
# We initiate the directory we have to look for.
directory = PyFunceble.CURRENT_DIRECTORY
# We initate the result variable.
result = []
# We append the dir_stru... | [
"Set",
"the",
"databases",
"files",
"to",
"delete",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/clean.py#L173-L217 | [
"def",
"databases_to_delete",
"(",
"cls",
")",
":",
"# pragma: no cover",
"# We initiate the directory we have to look for.",
"directory",
"=",
"PyFunceble",
".",
"CURRENT_DIRECTORY",
"# We initate the result variable.",
"result",
"=",
"[",
"]",
"# We append the dir_structure fil... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Clean.almost_everything | Delete almost all discovered files.
:param clean_all:
Tell the subsystem if we have to clean everything instesd
of almost everything.
:type clean_all: bool | PyFunceble/clean.py | def almost_everything(self, clean_all=False):
"""
Delete almost all discovered files.
:param clean_all:
Tell the subsystem if we have to clean everything instesd
of almost everything.
:type clean_all: bool
"""
# We get the list of file to delete.... | def almost_everything(self, clean_all=False):
"""
Delete almost all discovered files.
:param clean_all:
Tell the subsystem if we have to clean everything instesd
of almost everything.
:type clean_all: bool
"""
# We get the list of file to delete.... | [
"Delete",
"almost",
"all",
"discovered",
"files",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/clean.py#L219-L242 | [
"def",
"almost_everything",
"(",
"self",
",",
"clean_all",
"=",
"False",
")",
":",
"# We get the list of file to delete.",
"to_delete",
"=",
"self",
".",
"file_to_delete",
"(",
")",
"if",
"clean_all",
":",
"# pragma: no cover",
"to_delete",
".",
"extend",
"(",
"se... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Hash._hash_file | Get the hash of the given file
:param algo: The algorithm to use.
:type algo: str
:return: The hexdigest of the data.
:rtype: str | PyFunceble/helpers.py | def _hash_file(self, algo):
"""Get the hash of the given file
:param algo: The algorithm to use.
:type algo: str
:return: The hexdigest of the data.
:rtype: str
"""
# We het the algorithm function.
hash_data = getattr(hashlib, algo)()
with open... | def _hash_file(self, algo):
"""Get the hash of the given file
:param algo: The algorithm to use.
:type algo: str
:return: The hexdigest of the data.
:rtype: str
"""
# We het the algorithm function.
hash_data = getattr(hashlib, algo)()
with open... | [
"Get",
"the",
"hash",
"of",
"the",
"given",
"file"
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L126-L149 | [
"def",
"_hash_file",
"(",
"self",
",",
"algo",
")",
":",
"# We het the algorithm function.",
"hash_data",
"=",
"getattr",
"(",
"hashlib",
",",
"algo",
")",
"(",
")",
"with",
"open",
"(",
"self",
".",
"path",
",",
"\"rb\"",
")",
"as",
"file",
":",
"# We o... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Hash._hash_data | Get hash of the given data.
:param algo: The algorithm to use.
:type algo: str | PyFunceble/helpers.py | def _hash_data(self, algo):
"""
Get hash of the given data.
:param algo: The algorithm to use.
:type algo: str
"""
# We het the algorithm function.
hash_data = getattr(hashlib, algo)()
# We set the data into our hashlib.
hash_data.update(self.da... | def _hash_data(self, algo):
"""
Get hash of the given data.
:param algo: The algorithm to use.
:type algo: str
"""
# We het the algorithm function.
hash_data = getattr(hashlib, algo)()
# We set the data into our hashlib.
hash_data.update(self.da... | [
"Get",
"hash",
"of",
"the",
"given",
"data",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L151-L166 | [
"def",
"_hash_data",
"(",
"self",
",",
"algo",
")",
":",
"# We het the algorithm function.",
"hash_data",
"=",
"getattr",
"(",
"hashlib",
",",
"algo",
")",
"(",
")",
"# We set the data into our hashlib.",
"hash_data",
".",
"update",
"(",
"self",
".",
"data",
")"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Hash.get | Return the hash of the given file | PyFunceble/helpers.py | def get(self):
"""
Return the hash of the given file
"""
# We initiate a variable which will save the result we are going
# to return.
result = {}
if self.algorithm in self.valid_algorithms:
# * The parsed path exist.
# and
# ... | def get(self):
"""
Return the hash of the given file
"""
# We initiate a variable which will save the result we are going
# to return.
result = {}
if self.algorithm in self.valid_algorithms:
# * The parsed path exist.
# and
# ... | [
"Return",
"the",
"hash",
"of",
"the",
"given",
"file"
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L168-L247 | [
"def",
"get",
"(",
"self",
")",
":",
"# We initiate a variable which will save the result we are going",
"# to return.",
"result",
"=",
"{",
"}",
"if",
"self",
".",
"algorithm",
"in",
"self",
".",
"valid_algorithms",
":",
"# * The parsed path exist.",
"# and",
"# * The ... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Command.execute | Execute the given command.
:return: The output of the command.
:rtype: str | PyFunceble/helpers.py | def execute(self):
"""
Execute the given command.
:return: The output of the command.
:rtype: str
"""
# We initiate a process and parse the command to it.
process = Popen(self.command, stdout=PIPE, stderr=PIPE, shell=True)
# We communicate the command a... | def execute(self):
"""
Execute the given command.
:return: The output of the command.
:rtype: str
"""
# We initiate a process and parse the command to it.
process = Popen(self.command, stdout=PIPE, stderr=PIPE, shell=True)
# We communicate the command a... | [
"Execute",
"the",
"given",
"command",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L290-L313 | [
"def",
"execute",
"(",
"self",
")",
":",
"# We initiate a process and parse the command to it.",
"process",
"=",
"Popen",
"(",
"self",
".",
"command",
",",
"stdout",
"=",
"PIPE",
",",
"stderr",
"=",
"PIPE",
",",
"shell",
"=",
"True",
")",
"# We communicate the c... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Command.run | Run the given command and yield each line(s) one by one.
.. note::
The difference between this method and :code:`self.execute()`
is that :code:`self.execute()` wait for the process to end
in order to return its output. | PyFunceble/helpers.py | def run(self):
"""
Run the given command and yield each line(s) one by one.
.. note::
The difference between this method and :code:`self.execute()`
is that :code:`self.execute()` wait for the process to end
in order to return its output.
"""
... | def run(self):
"""
Run the given command and yield each line(s) one by one.
.. note::
The difference between this method and :code:`self.execute()`
is that :code:`self.execute()` wait for the process to end
in order to return its output.
"""
... | [
"Run",
"the",
"given",
"command",
"and",
"yield",
"each",
"line",
"(",
"s",
")",
"one",
"by",
"one",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L315-L346 | [
"def",
"run",
"(",
"self",
")",
":",
"with",
"Popen",
"(",
"self",
".",
"command",
",",
"stdout",
"=",
"PIPE",
",",
"shell",
"=",
"True",
")",
"as",
"process",
":",
"# We initiate a process and parse the command to it.",
"while",
"True",
":",
"# We loop infini... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Dict.remove_key | Remove a given key from a given dictionary.
:param key_to_remove: The key(s) to delete.
:type key_to_remove: list|str
:return: The dict without the given key(s).
:rtype: dict|None | PyFunceble/helpers.py | def remove_key(self, key_to_remove):
"""
Remove a given key from a given dictionary.
:param key_to_remove: The key(s) to delete.
:type key_to_remove: list|str
:return: The dict without the given key(s).
:rtype: dict|None
"""
if isinstance(self.main_dict... | def remove_key(self, key_to_remove):
"""
Remove a given key from a given dictionary.
:param key_to_remove: The key(s) to delete.
:type key_to_remove: list|str
:return: The dict without the given key(s).
:rtype: dict|None
"""
if isinstance(self.main_dict... | [
"Remove",
"a",
"given",
"key",
"from",
"a",
"given",
"dictionary",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L370-L407 | [
"def",
"remove_key",
"(",
"self",
",",
"key_to_remove",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"main_dictionnary",
",",
"dict",
")",
":",
"# The main dictionnary is a dictionnary",
"if",
"isinstance",
"(",
"key_to_remove",
",",
"list",
")",
":",
"# The ... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Dict.rename_key | Rename the given keys from the given dictionary.
:param key_to_rename:
The key(s) to rename.
Expected format: :code:`{old:new}`
:type key_to_rename: dict
:param strict:
Tell us if we have to rename the exact index or
the index which looks like th... | PyFunceble/helpers.py | def rename_key(self, key_to_rename, strict=True):
"""
Rename the given keys from the given dictionary.
:param key_to_rename:
The key(s) to rename.
Expected format: :code:`{old:new}`
:type key_to_rename: dict
:param strict:
Tell us if we have ... | def rename_key(self, key_to_rename, strict=True):
"""
Rename the given keys from the given dictionary.
:param key_to_rename:
The key(s) to rename.
Expected format: :code:`{old:new}`
:type key_to_rename: dict
:param strict:
Tell us if we have ... | [
"Rename",
"the",
"given",
"keys",
"from",
"the",
"given",
"dictionary",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L409-L471 | [
"def",
"rename_key",
"(",
"self",
",",
"key_to_rename",
",",
"strict",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"main_dictionnary",
",",
"dict",
")",
"and",
"isinstance",
"(",
"key_to_rename",
",",
"dict",
")",
":",
"# * The given main di... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Dict.merge | Merge the content of to_merge into the given main dictionnary.
:param to_merge: The dictionnary to merge.
:type to_merge: dict
:param strict:
Tell us if we have to strictly merge lists.
:code:`True`: We follow index
:code`False`: We follow element (content)... | PyFunceble/helpers.py | def merge(self, to_merge, strict=True):
"""
Merge the content of to_merge into the given main dictionnary.
:param to_merge: The dictionnary to merge.
:type to_merge: dict
:param strict:
Tell us if we have to strictly merge lists.
:code:`True`: We follow... | def merge(self, to_merge, strict=True):
"""
Merge the content of to_merge into the given main dictionnary.
:param to_merge: The dictionnary to merge.
:type to_merge: dict
:param strict:
Tell us if we have to strictly merge lists.
:code:`True`: We follow... | [
"Merge",
"the",
"content",
"of",
"to_merge",
"into",
"the",
"given",
"main",
"dictionnary",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L473-L542 | [
"def",
"merge",
"(",
"self",
",",
"to_merge",
",",
"strict",
"=",
"True",
")",
":",
"# We initiate a variable which will save our result.",
"result",
"=",
"{",
"}",
"for",
"element",
"in",
"to_merge",
":",
"# We loop throught the given dict to merge.",
"if",
"element"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Dict.to_json | Save a dictionnary into a JSON file.
:param destination:
A path to a file where we're going to
write the converted dict into a JSON format.
:type destination: str | PyFunceble/helpers.py | def to_json(self, destination):
"""
Save a dictionnary into a JSON file.
:param destination:
A path to a file where we're going to
write the converted dict into a JSON format.
:type destination: str
"""
try:
with open(destination, "w"... | def to_json(self, destination):
"""
Save a dictionnary into a JSON file.
:param destination:
A path to a file where we're going to
write the converted dict into a JSON format.
:type destination: str
"""
try:
with open(destination, "w"... | [
"Save",
"a",
"dictionnary",
"into",
"a",
"JSON",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L544-L579 | [
"def",
"to_json",
"(",
"self",
",",
"destination",
")",
":",
"try",
":",
"with",
"open",
"(",
"destination",
",",
"\"w\"",
")",
"as",
"file",
":",
"# We open the file we are going to write.",
"# Note: We always overwrite the destination.",
"# We save the current dictionna... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Dict.to_yaml | Save a dictionnary into a YAML file.
:param destination:
A path to a file where we're going to write the
converted dict into a JSON format.
:type destination: str | PyFunceble/helpers.py | def to_yaml(self, destination, flow_style=False):
"""
Save a dictionnary into a YAML file.
:param destination:
A path to a file where we're going to write the
converted dict into a JSON format.
:type destination: str
"""
with open(destination, "w... | def to_yaml(self, destination, flow_style=False):
"""
Save a dictionnary into a YAML file.
:param destination:
A path to a file where we're going to write the
converted dict into a JSON format.
:type destination: str
"""
with open(destination, "w... | [
"Save",
"a",
"dictionnary",
"into",
"a",
"YAML",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L581-L603 | [
"def",
"to_yaml",
"(",
"self",
",",
"destination",
",",
"flow_style",
"=",
"False",
")",
":",
"with",
"open",
"(",
"destination",
",",
"\"w\"",
")",
"as",
"file",
":",
"# We open the file we are going to write.",
"# Note: We always overwrite the destination.",
"# We s... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Directory.fix_path | Fix the path of the given path.
:param splited_path: A list to convert to the right path.
:type splited_path: list
:return: The fixed path.
:rtype: str | PyFunceble/helpers.py | def fix_path(self, splited_path=None):
"""
Fix the path of the given path.
:param splited_path: A list to convert to the right path.
:type splited_path: list
:return: The fixed path.
:rtype: str
"""
if not splited_path:
# A splited path is p... | def fix_path(self, splited_path=None):
"""
Fix the path of the given path.
:param splited_path: A list to convert to the right path.
:type splited_path: list
:return: The fixed path.
:rtype: str
"""
if not splited_path:
# A splited path is p... | [
"Fix",
"the",
"path",
"of",
"the",
"given",
"path",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L654-L690 | [
"def",
"fix_path",
"(",
"self",
",",
"splited_path",
"=",
"None",
")",
":",
"if",
"not",
"splited_path",
":",
"# A splited path is parsed.",
"# We initate a variable which will save the splited path.",
"split_path",
"=",
"[",
"]",
"if",
"self",
".",
"directory",
":",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | File.write | Write or append data into the given file path.
:param data_to_write: The data to write.
:type data_to_write: str
:param overwrite:
Tell us if we have to overwrite the
content of the file we are working with.
:type overwrite: bool | PyFunceble/helpers.py | def write(self, data_to_write, overwrite=False):
"""
Write or append data into the given file path.
:param data_to_write: The data to write.
:type data_to_write: str
:param overwrite:
Tell us if we have to overwrite the
content of the file we are working... | def write(self, data_to_write, overwrite=False):
"""
Write or append data into the given file path.
:param data_to_write: The data to write.
:type data_to_write: str
:param overwrite:
Tell us if we have to overwrite the
content of the file we are working... | [
"Write",
"or",
"append",
"data",
"into",
"the",
"given",
"file",
"path",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L705-L747 | [
"def",
"write",
"(",
"self",
",",
"data_to_write",
",",
"overwrite",
"=",
"False",
")",
":",
"if",
"overwrite",
"or",
"not",
"path",
".",
"isfile",
"(",
"self",
".",
"file",
")",
":",
"# * We have to overwrite the file data.",
"# or",
"# * The file path does not... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | File.read | Read a given file path and return its content.
:return: The content of the given file path.
:rtype: str | PyFunceble/helpers.py | def read(self):
"""
Read a given file path and return its content.
:return: The content of the given file path.
:rtype: str
"""
try:
with open(self.file, "r", encoding="utf-8") as file:
# We open and read a file.
# We get the... | def read(self):
"""
Read a given file path and return its content.
:return: The content of the given file path.
:rtype: str
"""
try:
with open(self.file, "r", encoding="utf-8") as file:
# We open and read a file.
# We get the... | [
"Read",
"a",
"given",
"file",
"path",
"and",
"return",
"its",
"content",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L749-L771 | [
"def",
"read",
"(",
"self",
")",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"file",
",",
"\"r\"",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"file",
":",
"# We open and read a file.",
"# We get the file content.",
"funilrys",
"=",
"file",
".",
"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | List.format | Return a well formatted list. Basicaly, it's sort a list and remove duplicate.
:return: A sorted, without duplicate, list.
:rtype: list | PyFunceble/helpers.py | 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):
"""
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... | [
"Return",
"a",
"well",
"formatted",
"list",
".",
"Basicaly",
"it",
"s",
"sort",
"a",
"list",
"and",
"remove",
"duplicate",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L816-L828 | [
"def",
"format",
"(",
"self",
")",
":",
"try",
":",
"return",
"sorted",
"(",
"list",
"(",
"set",
"(",
"self",
".",
"main_list",
")",
")",
",",
"key",
"=",
"str",
".",
"lower",
")",
"except",
"TypeError",
":",
"# pragma: no cover",
"return",
"self",
"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | List.custom_format | 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... | PyFunceble/helpers.py | 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):
"""
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.
... | [
"Return",
"a",
"well",
"formatted",
"list",
".",
"With",
"the",
"key_method",
"as",
"a",
"function",
"/",
"method",
"to",
"format",
"the",
"elements",
"before",
"sorting",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L830-L850 | [
"def",
"custom_format",
"(",
"self",
",",
"key_method",
",",
"reverse",
"=",
"False",
")",
":",
"try",
":",
"return",
"sorted",
"(",
"list",
"(",
"set",
"(",
"self",
".",
"main_list",
")",
")",
",",
"key",
"=",
"key_method",
",",
"reverse",
"=",
"rev... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | List.merge | 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 | PyFunceble/helpers.py | 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):
"""
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... | [
"Merge",
"to_merge",
"into",
"the",
"given",
"main",
"list",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L852-L925 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Regex.not_matching_list | Return a list of string which don't match the
given regex. | PyFunceble/helpers.py | 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):
"""
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))] | [
"Return",
"a",
"list",
"of",
"string",
"which",
"don",
"t",
"match",
"the",
"given",
"regex",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L985-L993 | [
"def",
"not_matching_list",
"(",
"self",
")",
":",
"pre_result",
"=",
"comp",
"(",
"self",
".",
"regex",
")",
"return",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"data",
"if",
"not",
"pre_result",
".",
"search",
"(",
"str",
"(",
"x",
")",
")",
"]"
] | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Regex.match | Used to get exploitable result of re.search
:return: The data of the match status.
:rtype: mixed | PyFunceble/helpers.py | 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):
"""
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(... | [
"Used",
"to",
"get",
"exploitable",
"result",
"of",
"re",
".",
"search"
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L1005-L1047 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Regex.replace | Used to replace a matched string with another.
:return: The data after replacement.
:rtype: str | PyFunceble/helpers.py | 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):
"""
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, #... | [
"Used",
"to",
"replace",
"a",
"matched",
"string",
"with",
"another",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L1049-L1065 | [
"def",
"replace",
"(",
"self",
")",
":",
"if",
"self",
".",
"replace_with",
":",
"# pylint: disable=no-member",
"return",
"substrings",
"(",
"self",
".",
"regex",
",",
"self",
".",
"replace_with",
",",
"# pylint: disable=no-member",
"self",
".",
"data",
",",
"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Download.text | 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`. | PyFunceble/helpers.py | 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):
"""
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 ... | [
"Download",
"the",
"given",
"link",
"and",
"return",
"or",
"save",
"its",
":",
"code",
":",
"requests",
".",
"text",
"at",
"the",
"given",
"destination",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/helpers.py#L1108-L1145 | [
"def",
"text",
"(",
"self",
")",
":",
"try",
":",
"# We request the link.",
"req",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"link",
",",
"verify",
"=",
"self",
".",
"verification",
")",
"if",
"req",
".",
"status_code",
"==",
"200",
":",
"# The re... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Percentage.count | Count the number of domain for each status. | PyFunceble/percentage.py | 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):
"""
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... | [
"Count",
"the",
"number",
"of",
"domain",
"for",
"each",
"status",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/percentage.py#L96-L124 | [
"def",
"count",
"(",
"self",
")",
":",
"if",
"self",
".",
"status",
":",
"# The status is parsed.",
"# We increase the number of tested.",
"PyFunceble",
".",
"INTERN",
"[",
"\"counter\"",
"]",
"[",
"\"number\"",
"]",
"[",
"\"tested\"",
"]",
"+=",
"1",
"if",
"(... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Percentage._calculate | Calculate the percentage of each status. | PyFunceble/percentage.py | 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):
"""
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"],
... | [
"Calculate",
"the",
"percentage",
"of",
"each",
"status",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/percentage.py#L127-L150 | [
"def",
"_calculate",
"(",
"cls",
")",
":",
"# We map the current state/counters of the different status.",
"percentages",
"=",
"{",
"\"up\"",
":",
"PyFunceble",
".",
"INTERN",
"[",
"\"counter\"",
"]",
"[",
"\"number\"",
"]",
"[",
"\"up\"",
"]",
",",
"\"down\"",
":... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Percentage.log | Print on screen and on file the percentages for each status. | PyFunceble/percentage.py | 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):
"""
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... | [
"Print",
"on",
"screen",
"and",
"on",
"file",
"the",
"percentages",
"for",
"each",
"status",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/percentage.py#L152-L233 | [
"def",
"log",
"(",
"self",
")",
":",
"if",
"(",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"show_percentage\"",
"]",
"and",
"PyFunceble",
".",
"INTERN",
"[",
"\"counter\"",
"]",
"[",
"\"number\"",
"]",
"[",
"\"tested\"",
"]",
">",
"0",
")",
":",
"# * We ... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Check.is_url_valid | 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... | PyFunceble/check.py | 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):
"""
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... | [
"Check",
"if",
"the",
"given",
"URL",
"is",
"valid",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L83-L194 | [
"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",
"="... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Check.is_domain_valid | 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 | PyFunceble/check.py | 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
"""
Check if the given domain is a valid.
:param domain: The domain to validate.
:type domain: str
:param subdomain_check:
Ac... | [
"Check",
"if",
"the",
"given",
"domain",
"is",
"a",
"valid",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L196-L350 | [
"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\"^(?=.... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Check.is_subdomain | 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 | PyFunceble/check.py | 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):
"""
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.
... | [
"Check",
"if",
"the",
"given",
"subdomain",
"is",
"a",
"subdomain",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L352-L380 | [
"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.",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Check.is_ip_valid | 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. | PyFunceble/check.py | 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):
"""
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... | [
"Check",
"if",
"the",
"given",
"IP",
"is",
"a",
"valid",
"IPv4",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L382-L418 | [
"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-... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Check.is_ip_range | 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. | PyFunceble/check.py | 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):
"""
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... | [
"Check",
"if",
"the",
"given",
"IP",
"is",
"a",
"valid",
"IPv4",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/check.py#L420-L458 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Syntax.get | Execute the logic behind the Syntax handling.
:return: The syntax status.
:rtype: str | PyFunceble/syntax.py | 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):
"""
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(... | [
"Execute",
"the",
"logic",
"behind",
"the",
"Syntax",
"handling",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/syntax.py#L74-L104 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive._reformat_historical_formating_error | Format the old format so it can be merged into the newer format. | PyFunceble/database.py | 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
"""
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... | [
"Format",
"the",
"old",
"format",
"so",
"it",
"can",
"be",
"merged",
"into",
"the",
"newer",
"format",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L112-L184 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive._merge | Merge the real database with the older one which
has already been set into :code:`PyFunceble.INTERN["inactive_db"]` | PyFunceble/database.py | 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):
"""
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... | [
"Merge",
"the",
"real",
"database",
"with",
"the",
"older",
"one",
"which",
"has",
"already",
"been",
"set",
"into",
":",
"code",
":",
"PyFunceble",
".",
"INTERN",
"[",
"inactive_db",
"]"
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L186-L251 | [
"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",
"(",... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive._retrieve | Return the current content of the inactive-db.json file. | PyFunceble/database.py | 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):
"""
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_... | [
"Return",
"the",
"current",
"content",
"of",
"the",
"inactive",
"-",
"db",
".",
"json",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L253-L268 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive._backup | Save the current database into the inactive-db.json file. | PyFunceble/database.py | 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):
"""
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... | [
"Save",
"the",
"current",
"database",
"into",
"the",
"inactive",
"-",
"db",
".",
"json",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L270-L279 | [
"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",
"["... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive._timestamp | 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 | PyFunceble/database.py | 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):
"""
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... | [
"Get",
"the",
"timestamp",
"where",
"we",
"are",
"going",
"to",
"save",
"our",
"current",
"list",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L408-L466 | [
"def",
"_timestamp",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"if",
"(",
"\"inactive_db\"",
"in",
"PyFunceble",
".",
"INTERN",
"and",
"PyFunceble",
".",
"INTERN... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive.add | Save the current :code.`PyFunceble.CONFIGURATION['to_test']`
into the current timestamp. | PyFunceble/database.py | 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):
"""
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... | [
"Save",
"the",
"current",
":",
"code",
".",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"to_test",
"]",
"into",
"the",
"current",
"timestamp",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L468-L550 | [
"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",
"(",
")... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive.remove | Remove all occurence of :code:`PyFunceble.CONFIGURATION['to_test']`
from the database. | PyFunceble/database.py | 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):
"""
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... | [
"Remove",
"all",
"occurence",
"of",
":",
"code",
":",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"to_test",
"]",
"from",
"the",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L552-L583 | [
"def",
"remove",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"if",
"PyFunceble",
".",
"INTERN",
"[",
"\"file_to_test\"",
"]",
"in",
"PyFunceble",
".",
"INTERN",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive.content | Get the content of the database.
:return: The content of the database.
:rtype: list | PyFunceble/database.py | 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):
"""
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"... | [
"Get",
"the",
"content",
"of",
"the",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L586-L624 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Inactive.is_present | Check if the currently tested element is into the database. | PyFunceble/database.py | 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):
"""
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... | [
"Check",
"if",
"the",
"currently",
"tested",
"element",
"is",
"into",
"the",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L627-L649 | [
"def",
"is_present",
"(",
"cls",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"inactive_database\"",
"]",
":",
"# The database subsystem is activated.",
"if",
"PyFunceble",
".",
"INTERN",
"[",
"\"to_test\"",
"]",
"in",
"PyFunceble",
".",
"INTERN",
"[... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Whois._retrieve | Retrieve the data from the database. | PyFunceble/database.py | 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):
"""
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... | [
"Retrieve",
"the",
"data",
"from",
"the",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L726-L745 | [
"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",
"("... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Whois._backup | Backup the database into its file. | PyFunceble/database.py | 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):
"""
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) | [
"Backup",
"the",
"database",
"into",
"its",
"file",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L747-L756 | [
"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",
"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Whois.is_in_database | Check if the element is into the database. | PyFunceble/database.py | 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):
"""
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"... | [
"Check",
"if",
"the",
"element",
"is",
"into",
"the",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L758-L787 | [
"def",
"is_in_database",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_authorization",
"(",
")",
"and",
"PyFunceble",
".",
"INTERN",
"[",
"\"file_to_test\"",
"]",
"in",
"PyFunceble",
".",
"INTERN",
"[",
"\"whois_db\"",
"]",
"and",
"PyFunceble",
".",
"IN... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Whois.is_time_older | Check if the current time is older than the one in the database. | PyFunceble/database.py | 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):
"""
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"]][
... | [
"Check",
"if",
"the",
"current",
"time",
"is",
"older",
"than",
"the",
"one",
"in",
"the",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L789-L814 | [
"def",
"is_time_older",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_authorization",
"(",
")",
"and",
"self",
".",
"is_in_database",
"(",
")",
"and",
"int",
"(",
"PyFunceble",
".",
"INTERN",
"[",
"\"whois_db\"",
"]",
"[",
"PyFunceble",
".",
"INTERN",... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Whois.get_expiration_date | Get the expiration date from the database.
:return: The expiration date from the database.
:rtype: str|None | PyFunceble/database.py | 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):
"""
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.... | [
"Get",
"the",
"expiration",
"date",
"from",
"the",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L816-L844 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Whois.add | Add the currently tested element into the database. | PyFunceble/database.py | 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):
"""
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"
... | [
"Add",
"the",
"currently",
"tested",
"element",
"into",
"the",
"database",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/database.py#L846-L938 | [
"def",
"add",
"(",
"self",
")",
":",
"if",
"self",
".",
"_authorization",
"(",
")",
":",
"# We are authorized to work.",
"if",
"self",
".",
"epoch",
"<",
"int",
"(",
"PyFunceble",
".",
"time",
"(",
")",
")",
":",
"state",
"=",
"\"past\"",
"else",
":",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | AutoSave.travis_permissions | Set permissions in order to avoid issues before commiting. | PyFunceble/auto_save.py | 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):
"""
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... | [
"Set",
"permissions",
"in",
"order",
"to",
"avoid",
"issues",
"before",
"commiting",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/auto_save.py#L93-L116 | [
"def",
"travis_permissions",
"(",
"cls",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"travis\"",
"]",
":",
"try",
":",
"build_dir",
"=",
"PyFunceble",
".",
"environ",
"[",
"\"TRAVIS_BUILD_DIR\"",
"]",
"commands",
"=",
"[",
"\"sudo chown -R travis:... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | AutoSave._travis | Logic behind autosave under Travis CI. | PyFunceble/auto_save.py | 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):
"""
Logic behind autosave under Travis CI.
"""
if PyFunceble.CONFIGURATION["travis"]:
try:
_ = PyFunceble.environ["TRAVIS_BUILD_DIR"]
time_autorisation = False
try:
time_autorisation = in... | [
"Logic",
"behind",
"autosave",
"under",
"Travis",
"CI",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/auto_save.py#L118-L180 | [
"def",
"_travis",
"(",
"self",
")",
":",
"if",
"PyFunceble",
".",
"CONFIGURATION",
"[",
"\"travis\"",
"]",
":",
"try",
":",
"_",
"=",
"PyFunceble",
".",
"environ",
"[",
"\"TRAVIS_BUILD_DIR\"",
"]",
"time_autorisation",
"=",
"False",
"try",
":",
"time_autoris... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Lookup.nslookup | Implementation of UNIX nslookup. | PyFunceble/lookup.py | 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):
"""
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... | [
"Implementation",
"of",
"UNIX",
"nslookup",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/lookup.py#L75-L145 | [
"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",
... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Lookup.whois | 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
... | PyFunceble/lookup.py | 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
"""
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... | [
"Implementation",
"of",
"UNIX",
"whois",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/lookup.py#L148-L258 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | URL.get | Execute the logic behind the URL handling.
:return: The status of the URL.
:rtype: str | PyFunceble/url.py | 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
"""
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... | [
"Execute",
"the",
"logic",
"behind",
"the",
"URL",
"handling",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/url.py#L75-L125 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | _get_version | This function will extract the version from PyFunceble/__init__.py | setup.py | 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():
"""
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... | [
"This",
"function",
"will",
"extract",
"the",
"version",
"from",
"PyFunceble",
"/",
"__init__",
".",
"py"
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/setup.py#L107-L117 | [
"def",
"_get_version",
"(",
")",
":",
"to_match",
"=",
"comp",
"(",
"r'VERSION\\s=\\s\"(.*)\"\\n'",
")",
"extracted",
"=",
"to_match",
".",
"findall",
"(",
"open",
"(",
"\"PyFunceble/__init__.py\"",
",",
"encoding",
"=",
"\"utf-8\"",
")",
".",
"read",
"(",
")"... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | Referer.get | Return the referer aka the WHOIS server of the current domain extension. | PyFunceble/referer.py | 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):
"""
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... | [
"Return",
"the",
"referer",
"aka",
"the",
"WHOIS",
"server",
"of",
"the",
"current",
"domain",
"extension",
"."
] | funilrys/PyFunceble | python | https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/referer.py#L212-L269 | [
"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... | cdf69cbde120199171f7158e1c33635753e6e2f5 |
test | BaseApp._register_servicer | register serviser
:param servicer: servicer | sea/app.py | 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):
"""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... | [
"register",
"serviser"
] | shanbay/sea | python | https://github.com/shanbay/sea/blob/a4484a571e3d68cc333411264077a59ea20cc5f1/sea/app.py#L78-L88 | [
"def",
"_register_servicer",
"(",
"self",
",",
"servicer",
")",
":",
"name",
"=",
"servicer",
".",
"__name__",
"if",
"name",
"in",
"self",
".",
"_servicers",
":",
"raise",
"exceptions",
".",
"ConfigException",
"(",
"'servicer duplicated: {}'",
".",
"format",
"... | a4484a571e3d68cc333411264077a59ea20cc5f1 |
test | BaseApp._register_extension | register extension
:param name: extension name
:param ext: extension object | sea/app.py | 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):
"""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... | [
"register",
"extension"
] | shanbay/sea | python | https://github.com/shanbay/sea/blob/a4484a571e3d68cc333411264077a59ea20cc5f1/sea/app.py#L96-L106 | [
"def",
"_register_extension",
"(",
"self",
",",
"name",
",",
"ext",
")",
":",
"ext",
".",
"init_app",
"(",
"self",
")",
"if",
"name",
"in",
"self",
".",
"_extensions",
":",
"raise",
"exceptions",
".",
"ConfigException",
"(",
"'extension duplicated: {}'",
"."... | a4484a571e3d68cc333411264077a59ea20cc5f1 |
test | Proxy._get_current_object | 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. | sea/local.py | 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):
"""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')
... | [
"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... | shanbay/sea | python | https://github.com/shanbay/sea/blob/a4484a571e3d68cc333411264077a59ea20cc5f1/sea/local.py#L58-L71 | [
"def",
"_get_current_object",
"(",
"self",
")",
":",
"loc",
"=",
"object",
".",
"__getattribute__",
"(",
"self",
",",
"'_Proxy__local'",
")",
"if",
"not",
"hasattr",
"(",
"loc",
",",
"'__release_local__'",
")",
":",
"return",
"loc",
"(",
"*",
"self",
".",
... | a4484a571e3d68cc333411264077a59ea20cc5f1 |
test | standard_paths | Yield paths to standard modules. | autoflake.py | 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():
"""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
... | [
"Yield",
"paths",
"to",
"standard",
"modules",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L69-L82 | [
"def",
"standard_paths",
"(",
")",
":",
"for",
"is_plat_spec",
"in",
"[",
"True",
",",
"False",
"]",
":",
"path",
"=",
"distutils",
".",
"sysconfig",
".",
"get_python_lib",
"(",
"standard_lib",
"=",
"True",
",",
"plat_specific",
"=",
"is_plat_spec",
")",
"... | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | standard_package_names | Yield standard module names. | autoflake.py | 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():
"""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] | [
"Yield",
"standard",
"module",
"names",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L85-L94 | [
"def",
"standard_package_names",
"(",
")",
":",
"for",
"name",
"in",
"standard_paths",
"(",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"'_'",
")",
"or",
"'-'",
"in",
"name",
":",
"continue",
"if",
"'.'",
"in",
"name",
"and",
"name",
".",
"rsplit",... | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | unused_import_line_numbers | Yield line numbers of unused imports. | autoflake.py | 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):
"""Yield line numbers of unused imports."""
for message in messages:
if isinstance(message, pyflakes.messages.UnusedImport):
yield message.lineno | [
"Yield",
"line",
"numbers",
"of",
"unused",
"imports",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L108-L112 | [
"def",
"unused_import_line_numbers",
"(",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"UnusedImport",
")",
":",
"yield",
"message",
".",
"lineno"
] | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | unused_import_module_name | Yield line number and module name of unused imports. | autoflake.py | 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):
"""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... | [
"Yield",
"line",
"number",
"and",
"module",
"name",
"of",
"unused",
"imports",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L115-L123 | [
"def",
"unused_import_module_name",
"(",
"messages",
")",
":",
"pattern",
"=",
"r'\\'(.+?)\\''",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"UnusedImport",
")",
":",
"module_name",
"=",
"... | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | star_import_used_line_numbers | Yield line number of star import usage. | autoflake.py | 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):
"""Yield line number of star import usage."""
for message in messages:
if isinstance(message, pyflakes.messages.ImportStarUsed):
yield message.lineno | [
"Yield",
"line",
"number",
"of",
"star",
"import",
"usage",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L126-L130 | [
"def",
"star_import_used_line_numbers",
"(",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"ImportStarUsed",
")",
":",
"yield",
"message",
".",
"lineno"
] | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | star_import_usage_undefined_name | Yield line number, undefined name, and its possible origin module. | autoflake.py | 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):
"""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... | [
"Yield",
"line",
"number",
"undefined",
"name",
"and",
"its",
"possible",
"origin",
"module",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L133-L139 | [
"def",
"star_import_usage_undefined_name",
"(",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"ImportStarUsage",
")",
":",
"undefined_name",
"=",
"message",
".",
"message... | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | unused_variable_line_numbers | Yield line numbers of unused variables. | autoflake.py | 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):
"""Yield line numbers of unused variables."""
for message in messages:
if isinstance(message, pyflakes.messages.UnusedVariable):
yield message.lineno | [
"Yield",
"line",
"numbers",
"of",
"unused",
"variables",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L142-L146 | [
"def",
"unused_variable_line_numbers",
"(",
"messages",
")",
":",
"for",
"message",
"in",
"messages",
":",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"UnusedVariable",
")",
":",
"yield",
"message",
".",
"lineno"
] | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | duplicate_key_line_numbers | Yield line numbers of duplicate keys. | autoflake.py | 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):
"""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 ... | [
"Yield",
"line",
"numbers",
"of",
"duplicate",
"keys",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L149-L174 | [
"def",
"duplicate_key_line_numbers",
"(",
"messages",
",",
"source",
")",
":",
"messages",
"=",
"[",
"message",
"for",
"message",
"in",
"messages",
"if",
"isinstance",
"(",
"message",
",",
"pyflakes",
".",
"messages",
".",
"MultiValueRepeatedKeyLiteral",
")",
"]... | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | create_key_to_messages_dict | Return dict mapping the key to list of messages. | autoflake.py | 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):
"""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 | [
"Return",
"dict",
"mapping",
"the",
"key",
"to",
"list",
"of",
"messages",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L177-L182 | [
"def",
"create_key_to_messages_dict",
"(",
"messages",
")",
":",
"dictionary",
"=",
"collections",
".",
"defaultdict",
"(",
"lambda",
":",
"[",
"]",
")",
"for",
"message",
"in",
"messages",
":",
"dictionary",
"[",
"message",
".",
"message_args",
"[",
"0",
"]... | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | check | Return messages from pyflakes. | autoflake.py | 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):
"""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:
... | [
"Return",
"messages",
"from",
"pyflakes",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L185-L201 | [
"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... | 68fea68646922b920d55975f9f2adaeafd84df4f |
test | extract_package_name | Return package name in import statement. | autoflake.py | 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):
"""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.
... | [
"Return",
"package",
"name",
"in",
"import",
"statement",
"."
] | myint/autoflake | python | https://github.com/myint/autoflake/blob/68fea68646922b920d55975f9f2adaeafd84df4f/autoflake.py#L228-L244 | [
"def",
"extract_package_name",
"(",
"line",
")",
":",
"assert",
"'\\\\'",
"not",
"in",
"line",
"assert",
"'('",
"not",
"in",
"line",
"assert",
"')'",
"not",
"in",
"line",
"assert",
"';'",
"not",
"in",
"line",
"if",
"line",
".",
"lstrip",
"(",
")",
".",... | 68fea68646922b920d55975f9f2adaeafd84df4f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.