repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.applicable_file_flags | def applicable_file_flags(self):
"""
Return the applicable file flags attribute of the BFD file being
processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.APPLICABLE_FI... | python | def applicable_file_flags(self):
"""
Return the applicable file flags attribute of the BFD file being
processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.APPLICABLE_FI... | [
"def",
"applicable_file_flags",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"APPLIC... | Return the applicable file flags attribute of the BFD file being
processed. | [
"Return",
"the",
"applicable",
"file",
"flags",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L524-L534 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.my_archieve | def my_archieve(self):
"""Return the my archieve attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.MY_ARCHIEVE) | python | def my_archieve(self):
"""Return the my archieve attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.MY_ARCHIEVE) | [
"def",
"my_archieve",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"MY_ARCHIEVE",
... | Return the my archieve attribute of the BFD file being processed. | [
"Return",
"the",
"my",
"archieve",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L537-L542 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.has_map | def has_map(self):
"""Return the has map attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.HAS_MAP) | python | def has_map(self):
"""Return the has map attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.HAS_MAP) | [
"def",
"has_map",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"HAS_MAP",
")"
] | Return the has map attribute of the BFD file being processed. | [
"Return",
"the",
"has",
"map",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L545-L550 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.is_thin_archieve | def is_thin_archieve(self):
"""
Return the is thin archieve attribute of the BFD file being processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.IS_THIN_ARCHIEVE) | python | def is_thin_archieve(self):
"""
Return the is thin archieve attribute of the BFD file being processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.IS_THIN_ARCHIEVE) | [
"def",
"is_thin_archieve",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"IS_THIN_ARC... | Return the is thin archieve attribute of the BFD file being processed. | [
"Return",
"the",
"is",
"thin",
"archieve",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L553-L561 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.has_gap_in_elf_shndx | def has_gap_in_elf_shndx(self):
"""Return the has gap in elf shndx attribute of the BFD file being
processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.HAS_GAP_IN_ELF_SHNDX) | python | def has_gap_in_elf_shndx(self):
"""Return the has gap in elf shndx attribute of the BFD file being
processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.HAS_GAP_IN_ELF_SHNDX) | [
"def",
"has_gap_in_elf_shndx",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"HAS_GAP... | Return the has gap in elf shndx attribute of the BFD file being
processed. | [
"Return",
"the",
"has",
"gap",
"in",
"elf",
"shndx",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L564-L572 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.valid_reloction_types | def valid_reloction_types(self):
"""Return the valid_reloc_types attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.VALID_RELOC_TYPES) | python | def valid_reloction_types(self):
"""Return the valid_reloc_types attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.VALID_RELOC_TYPES) | [
"def",
"valid_reloction_types",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"VALID_... | Return the valid_reloc_types attribute of the BFD file being processed. | [
"Return",
"the",
"valid_reloc_types",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L575-L581 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.user_data | def user_data(self):
"""Return the usrdata attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.USRDATA) | python | def user_data(self):
"""Return the usrdata attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.USRDATA) | [
"def",
"user_data",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"USRDATA",
")"
] | Return the usrdata attribute of the BFD file being processed. | [
"Return",
"the",
"usrdata",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L584-L589 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.start_address | def start_address(self):
"""Return the start address attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.START_ADDRESS) | python | def start_address(self):
"""Return the start address attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.START_ADDRESS) | [
"def",
"start_address",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"START_ADDRESS"... | Return the start address attribute of the BFD file being processed. | [
"Return",
"the",
"start",
"address",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L592-L597 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.symbols_count | def symbols_count(self):
"""Return the symcount attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.SYMCOUNT) | python | def symbols_count(self):
"""Return the symcount attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.SYMCOUNT) | [
"def",
"symbols_count",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"SYMCOUNT",
"... | Return the symcount attribute of the BFD file being processed. | [
"Return",
"the",
"symcount",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L630-L635 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.out_symbols | def out_symbols(self):
"""Return the out symbols attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.OUTSYMBOLS) | python | def out_symbols(self):
"""Return the out symbols attribute of the BFD file being processed."""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.OUTSYMBOLS) | [
"def",
"out_symbols",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"OUTSYMBOLS",
"... | Return the out symbols attribute of the BFD file being processed. | [
"Return",
"the",
"out",
"symbols",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L638-L643 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.sections_count | def sections_count(self):
"""Return the sections_count attribute of the BFD file being processed."""
# This should match the 'sections' attribute length so instead should
# use :
#
# len(bfd.sections)
#
if not self._ptr:
raise BfdException("BFD not i... | python | def sections_count(self):
"""Return the sections_count attribute of the BFD file being processed."""
# This should match the 'sections' attribute length so instead should
# use :
#
# len(bfd.sections)
#
if not self._ptr:
raise BfdException("BFD not i... | [
"def",
"sections_count",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"COUNT_SECTION... | Return the sections_count attribute of the BFD file being processed. | [
"Return",
"the",
"sections_count",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L646-L656 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.dynamic_symbols_count | def dynamic_symbols_count(self):
"""Return the dynamic symbols count attribute of the BFD file being
processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.DYNAMIC_SYMCOU... | python | def dynamic_symbols_count(self):
"""Return the dynamic symbols count attribute of the BFD file being
processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.DYNAMIC_SYMCOU... | [
"def",
"dynamic_symbols_count",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"DYNAMI... | Return the dynamic symbols count attribute of the BFD file being
processed. | [
"Return",
"the",
"dynamic",
"symbols",
"count",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L659-L668 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.symbol_leading_char | def symbol_leading_char(self):
"""Return the symbol leading char attribute of the BFD file being
processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.SYMBOL_LEADING_CHA... | python | def symbol_leading_char(self):
"""Return the symbol leading char attribute of the BFD file being
processed.
"""
if not self._ptr:
raise BfdException("BFD not initialized")
return _bfd.get_bfd_attribute(
self._ptr, BfdAttributes.SYMBOL_LEADING_CHA... | [
"def",
"symbol_leading_char",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"return",
"_bfd",
".",
"get_bfd_attribute",
"(",
"self",
".",
"_ptr",
",",
"BfdAttributes",
".",
"SYMBOL_L... | Return the symbol leading char attribute of the BFD file being
processed. | [
"Return",
"the",
"symbol",
"leading",
"char",
"attribute",
"of",
"the",
"BFD",
"file",
"being",
"processed",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L671-L680 | train |
Groundworkstech/pybfd | pybfd/bfd.py | Bfd.arch_size | def arch_size(self):
"""Return the architecure size in bits."""
if not self._ptr:
raise BfdException("BFD not initialized")
try:
return _bfd.get_arch_size(self._ptr)
except Exception, err:
raise BfdException("Unable to determine architeure size.") | python | def arch_size(self):
"""Return the architecure size in bits."""
if not self._ptr:
raise BfdException("BFD not initialized")
try:
return _bfd.get_arch_size(self._ptr)
except Exception, err:
raise BfdException("Unable to determine architeure size.") | [
"def",
"arch_size",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_ptr",
":",
"raise",
"BfdException",
"(",
"\"BFD not initialized\"",
")",
"try",
":",
"return",
"_bfd",
".",
"get_arch_size",
"(",
"self",
".",
"_ptr",
")",
"except",
"Exception",
",",
... | Return the architecure size in bits. | [
"Return",
"the",
"architecure",
"size",
"in",
"bits",
"."
] | 9e722435929b4ad52212043a6f1e9e9ce60b5d72 | https://github.com/Groundworkstech/pybfd/blob/9e722435929b4ad52212043a6f1e9e9ce60b5d72/pybfd/bfd.py#L697-L705 | train |
getsenic/nuimo-linux-python | nuimo/nuimo.py | Controller.display_matrix | def display_matrix(self, matrix, interval=2.0, brightness=1.0, fading=False, ignore_duplicates=False):
"""
Displays an LED matrix on Nuimo's LED matrix display.
:param matrix: the matrix to display
:param interval: interval in seconds until the matrix disappears again
:param bri... | python | def display_matrix(self, matrix, interval=2.0, brightness=1.0, fading=False, ignore_duplicates=False):
"""
Displays an LED matrix on Nuimo's LED matrix display.
:param matrix: the matrix to display
:param interval: interval in seconds until the matrix disappears again
:param bri... | [
"def",
"display_matrix",
"(",
"self",
",",
"matrix",
",",
"interval",
"=",
"2.0",
",",
"brightness",
"=",
"1.0",
",",
"fading",
"=",
"False",
",",
"ignore_duplicates",
"=",
"False",
")",
":",
"self",
".",
"_matrix_writer",
".",
"write",
"(",
"matrix",
"=... | Displays an LED matrix on Nuimo's LED matrix display.
:param matrix: the matrix to display
:param interval: interval in seconds until the matrix disappears again
:param brightness: led brightness between 0..1
:param fading: if True, the previous matrix fades into the new matrix
... | [
"Displays",
"an",
"LED",
"matrix",
"on",
"Nuimo",
"s",
"LED",
"matrix",
"display",
"."
] | 1918e6e51ad6569eb134904e891122479fafa2d6 | https://github.com/getsenic/nuimo-linux-python/blob/1918e6e51ad6569eb134904e891122479fafa2d6/nuimo/nuimo.py#L208-L224 | train |
secynic/ipwhois | ipwhois/net.py | Net.get_asn_origin_whois | def get_asn_origin_whois(self, asn_registry='radb', asn=None,
retry_count=3, server=None, port=43):
"""
The function for retrieving CIDR info for an ASN via whois.
Args:
asn_registry (:obj:`str`): The source to run the query against
(asn.... | python | def get_asn_origin_whois(self, asn_registry='radb', asn=None,
retry_count=3, server=None, port=43):
"""
The function for retrieving CIDR info for an ASN via whois.
Args:
asn_registry (:obj:`str`): The source to run the query against
(asn.... | [
"def",
"get_asn_origin_whois",
"(",
"self",
",",
"asn_registry",
"=",
"'radb'",
",",
"asn",
"=",
"None",
",",
"retry_count",
"=",
"3",
",",
"server",
"=",
"None",
",",
"port",
"=",
"43",
")",
":",
"try",
":",
"if",
"server",
"is",
"None",
":",
"serve... | The function for retrieving CIDR info for an ASN via whois.
Args:
asn_registry (:obj:`str`): The source to run the query against
(asn.ASN_ORIGIN_WHOIS).
asn (:obj:`str`): The AS number (required).
retry_count (:obj:`int`): The number of times to retry in case... | [
"The",
"function",
"for",
"retrieving",
"CIDR",
"info",
"for",
"an",
"ASN",
"via",
"whois",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/net.py#L431-L541 | train |
secynic/ipwhois | ipwhois/net.py | Net.get_http_json | def get_http_json(self, url=None, retry_count=3, rate_limit_timeout=120,
headers=None):
"""
The function for retrieving a json result via HTTP.
Args:
url (:obj:`str`): The URL to retrieve (required).
retry_count (:obj:`int`): The number of times to ... | python | def get_http_json(self, url=None, retry_count=3, rate_limit_timeout=120,
headers=None):
"""
The function for retrieving a json result via HTTP.
Args:
url (:obj:`str`): The URL to retrieve (required).
retry_count (:obj:`int`): The number of times to ... | [
"def",
"get_http_json",
"(",
"self",
",",
"url",
"=",
"None",
",",
"retry_count",
"=",
"3",
",",
"rate_limit_timeout",
"=",
"120",
",",
"headers",
"=",
"None",
")",
":",
"if",
"headers",
"is",
"None",
":",
"headers",
"=",
"{",
"'Accept'",
":",
"'applic... | The function for retrieving a json result via HTTP.
Args:
url (:obj:`str`): The URL to retrieve (required).
retry_count (:obj:`int`): The number of times to retry in case
socket errors, timeouts, connection resets, etc. are
encountered. Defaults to 3.
... | [
"The",
"function",
"for",
"retrieving",
"a",
"json",
"result",
"via",
"HTTP",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/net.py#L672-L793 | train |
secynic/ipwhois | ipwhois/net.py | Net.get_host | def get_host(self, retry_count=3):
"""
The function for retrieving host information for an IP address.
Args:
retry_count (:obj:`int`): The number of times to retry in case
socket errors, timeouts, connection resets, etc. are
encountered. Defaults to 3... | python | def get_host(self, retry_count=3):
"""
The function for retrieving host information for an IP address.
Args:
retry_count (:obj:`int`): The number of times to retry in case
socket errors, timeouts, connection resets, etc. are
encountered. Defaults to 3... | [
"def",
"get_host",
"(",
"self",
",",
"retry_count",
"=",
"3",
")",
":",
"try",
":",
"default_timeout_set",
"=",
"False",
"if",
"not",
"socket",
".",
"getdefaulttimeout",
"(",
")",
":",
"socket",
".",
"setdefaulttimeout",
"(",
"self",
".",
"timeout",
")",
... | The function for retrieving host information for an IP address.
Args:
retry_count (:obj:`int`): The number of times to retry in case
socket errors, timeouts, connection resets, etc. are
encountered. Defaults to 3.
Returns:
namedtuple:
... | [
"The",
"function",
"for",
"retrieving",
"host",
"information",
"for",
"an",
"IP",
"address",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/net.py#L795-L855 | train |
secynic/ipwhois | ipwhois/net.py | Net.get_http_raw | def get_http_raw(self, url=None, retry_count=3, headers=None,
request_type='GET', form_data=None):
"""
The function for retrieving a raw HTML result via HTTP.
Args:
url (:obj:`str`): The URL to retrieve (required).
retry_count (:obj:`int`): The numbe... | python | def get_http_raw(self, url=None, retry_count=3, headers=None,
request_type='GET', form_data=None):
"""
The function for retrieving a raw HTML result via HTTP.
Args:
url (:obj:`str`): The URL to retrieve (required).
retry_count (:obj:`int`): The numbe... | [
"def",
"get_http_raw",
"(",
"self",
",",
"url",
"=",
"None",
",",
"retry_count",
"=",
"3",
",",
"headers",
"=",
"None",
",",
"request_type",
"=",
"'GET'",
",",
"form_data",
"=",
"None",
")",
":",
"if",
"headers",
"is",
"None",
":",
"headers",
"=",
"{... | The function for retrieving a raw HTML result via HTTP.
Args:
url (:obj:`str`): The URL to retrieve (required).
retry_count (:obj:`int`): The number of times to retry in case
socket errors, timeouts, connection resets, etc. are
encountered. Defaults to 3.... | [
"The",
"function",
"for",
"retrieving",
"a",
"raw",
"HTML",
"result",
"via",
"HTTP",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/net.py#L857-L936 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | generate_output | def generate_output(line='0', short=None, name=None, value=None,
is_parent=False, colorize=True):
"""
The function for formatting CLI output results.
Args:
line (:obj:`str`): The line number (0-4). Determines indentation.
Defaults to '0'.
short (:obj:`str`): ... | python | def generate_output(line='0', short=None, name=None, value=None,
is_parent=False, colorize=True):
"""
The function for formatting CLI output results.
Args:
line (:obj:`str`): The line number (0-4). Determines indentation.
Defaults to '0'.
short (:obj:`str`): ... | [
"def",
"generate_output",
"(",
"line",
"=",
"'0'",
",",
"short",
"=",
"None",
",",
"name",
"=",
"None",
",",
"value",
"=",
"None",
",",
"is_parent",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"output",
"=",
"'{0}{1}{2}{3}{4}{5}{6}{7}\\n'",
"."... | The function for formatting CLI output results.
Args:
line (:obj:`str`): The line number (0-4). Determines indentation.
Defaults to '0'.
short (:obj:`str`): The optional abbreviated name for a field.
See hr.py for values.
name (:obj:`str`): The optional name for a fi... | [
"The",
"function",
"for",
"formatting",
"CLI",
"output",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L313-L350 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_header | def generate_output_header(self, query_type='RDAP'):
"""
The function for generating the CLI output header.
Args:
query_type (:obj:`str`): The IPWhois query type. Defaults to
'RDAP'.
Returns:
str: The generated output.
"""
output... | python | def generate_output_header(self, query_type='RDAP'):
"""
The function for generating the CLI output header.
Args:
query_type (:obj:`str`): The IPWhois query type. Defaults to
'RDAP'.
Returns:
str: The generated output.
"""
output... | [
"def",
"generate_output_header",
"(",
"self",
",",
"query_type",
"=",
"'RDAP'",
")",
":",
"output",
"=",
"'\\n{0}{1}{2} query for {3}:{4}\\n\\n'",
".",
"format",
"(",
"ANSI",
"[",
"'ul'",
"]",
",",
"ANSI",
"[",
"'b'",
"]",
",",
"query_type",
",",
"self",
"."... | The function for generating the CLI output header.
Args:
query_type (:obj:`str`): The IPWhois query type. Defaults to
'RDAP'.
Returns:
str: The generated output. | [
"The",
"function",
"for",
"generating",
"the",
"CLI",
"output",
"header",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L406-L426 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_newline | def generate_output_newline(self, line='0', colorize=True):
"""
The function for generating a CLI output new line.
Args:
line (:obj:`str`): The line number (0-4). Determines indentation.
Defaults to '0'.
colorize (:obj:`bool`): Colorize the console output... | python | def generate_output_newline(self, line='0', colorize=True):
"""
The function for generating a CLI output new line.
Args:
line (:obj:`str`): The line number (0-4). Determines indentation.
Defaults to '0'.
colorize (:obj:`bool`): Colorize the console output... | [
"def",
"generate_output_newline",
"(",
"self",
",",
"line",
"=",
"'0'",
",",
"colorize",
"=",
"True",
")",
":",
"return",
"generate_output",
"(",
"line",
"=",
"line",
",",
"is_parent",
"=",
"True",
",",
"colorize",
"=",
"colorize",
")"
] | The function for generating a CLI output new line.
Args:
line (:obj:`str`): The line number (0-4). Determines indentation.
Defaults to '0'.
colorize (:obj:`bool`): Colorize the console output with ANSI
colors. Defaults to True.
Returns:
... | [
"The",
"function",
"for",
"generating",
"a",
"CLI",
"output",
"new",
"line",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L428-L446 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_asn | def generate_output_asn(self, json_data=None, hr=True, show_name=False,
colorize=True):
"""
The function for generating CLI output ASN results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Enable huma... | python | def generate_output_asn(self, json_data=None, hr=True, show_name=False,
colorize=True):
"""
The function for generating CLI output ASN results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Enable huma... | [
"def",
"generate_output_asn",
"(",
"self",
",",
"json_data",
"=",
"None",
",",
"hr",
"=",
"True",
",",
"show_name",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"if",
"json_data",
"is",
"None",
":",
"json_data",
"=",
"{",
"}",
"keys",
"=",
"... | The function for generating CLI output ASN results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Enable human readable key translations. Defaults
to True.
show_name (:obj:`bool`): Show human readable name (default is... | [
"The",
"function",
"for",
"generating",
"CLI",
"output",
"ASN",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L448-L487 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_entities | def generate_output_entities(self, json_data=None, hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output RDAP entity results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`b... | python | def generate_output_entities(self, json_data=None, hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output RDAP entity results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`b... | [
"def",
"generate_output_entities",
"(",
"self",
",",
"json_data",
"=",
"None",
",",
"hr",
"=",
"True",
",",
"show_name",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"output",
"=",
"''",
"short",
"=",
"HR_RDAP",
"[",
"'entities'",
"]",
"[",
"'... | The function for generating CLI output RDAP entity results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Enable human readable key translations. Defaults
to True.
show_name (:obj:`bool`): Show human readable name (de... | [
"The",
"function",
"for",
"generating",
"CLI",
"output",
"RDAP",
"entity",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L489-L532 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_events | def generate_output_events(self, source, key, val, line='2', hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output RDAP events results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(req... | python | def generate_output_events(self, source, key, val, line='2', hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output RDAP events results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(req... | [
"def",
"generate_output_events",
"(",
"self",
",",
"source",
",",
"key",
",",
"val",
",",
"line",
"=",
"'2'",
",",
"hr",
"=",
"True",
",",
"show_name",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"output",
"=",
"generate_output",
"(",
"line",... | The function for generating CLI output RDAP events results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(required).
key (:obj:`str`): The event key 'events' or 'events_actor'
(required).
val (:obj:`dict`): The event dictio... | [
"The",
"function",
"for",
"generating",
"CLI",
"output",
"RDAP",
"events",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L534-L628 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_list | def generate_output_list(self, source, key, val, line='2', hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output RDAP list results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(required)... | python | def generate_output_list(self, source, key, val, line='2', hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output RDAP list results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(required)... | [
"def",
"generate_output_list",
"(",
"self",
",",
"source",
",",
"key",
",",
"val",
",",
"line",
"=",
"'2'",
",",
"hr",
"=",
"True",
",",
"show_name",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"output",
"=",
"generate_output",
"(",
"line",
... | The function for generating CLI output RDAP list results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(required).
key (:obj:`str`): The event key 'events' or 'events_actor'
(required).
val (:obj:`dict`): The event dictiona... | [
"The",
"function",
"for",
"generating",
"CLI",
"output",
"RDAP",
"list",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L630-L673 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_notices | def generate_output_notices(self, source, key, val, line='1', hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output RDAP notices results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(... | python | def generate_output_notices(self, source, key, val, line='1', hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output RDAP notices results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(... | [
"def",
"generate_output_notices",
"(",
"self",
",",
"source",
",",
"key",
",",
"val",
",",
"line",
"=",
"'1'",
",",
"hr",
"=",
"True",
",",
"show_name",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"output",
"=",
"generate_output",
"(",
"line"... | The function for generating CLI output RDAP notices results.
Args:
source (:obj:`str`): The parent key 'network' or 'objects'
(required).
key (:obj:`str`): The event key 'events' or 'events_actor'
(required).
val (:obj:`dict`): The event dicti... | [
"The",
"function",
"for",
"generating",
"CLI",
"output",
"RDAP",
"notices",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L675-L760 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_network | def generate_output_network(self, json_data=None, hr=True, show_name=False,
colorize=True):
"""
The function for generating CLI output RDAP network results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bo... | python | def generate_output_network(self, json_data=None, hr=True, show_name=False,
colorize=True):
"""
The function for generating CLI output RDAP network results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bo... | [
"def",
"generate_output_network",
"(",
"self",
",",
"json_data",
"=",
"None",
",",
"hr",
"=",
"True",
",",
"show_name",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"if",
"json_data",
"is",
"None",
":",
"json_data",
"=",
"{",
"}",
"output",
"=... | The function for generating CLI output RDAP network results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Enable human readable key translations. Defaults
to True.
show_name (:obj:`bool`): Show human readable name (d... | [
"The",
"function",
"for",
"generating",
"CLI",
"output",
"RDAP",
"network",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L762-L840 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_whois_nets | def generate_output_whois_nets(self, json_data=None, hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output Legacy Whois networks results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
... | python | def generate_output_whois_nets(self, json_data=None, hr=True,
show_name=False, colorize=True):
"""
The function for generating CLI output Legacy Whois networks results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
... | [
"def",
"generate_output_whois_nets",
"(",
"self",
",",
"json_data",
"=",
"None",
",",
"hr",
"=",
"True",
",",
"show_name",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"if",
"json_data",
"is",
"None",
":",
"json_data",
"=",
"{",
"}",
"output",
... | The function for generating CLI output Legacy Whois networks results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Enable human readable key translations. Defaults
to True.
show_name (:obj:`bool`): Show human readabl... | [
"The",
"function",
"for",
"generating",
"CLI",
"output",
"Legacy",
"Whois",
"networks",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L1085-L1164 | train |
secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | IPWhoisCLI.generate_output_nir | def generate_output_nir(self, json_data=None, hr=True, show_name=False,
colorize=True):
"""
The function for generating CLI output NIR network results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Ena... | python | def generate_output_nir(self, json_data=None, hr=True, show_name=False,
colorize=True):
"""
The function for generating CLI output NIR network results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Ena... | [
"def",
"generate_output_nir",
"(",
"self",
",",
"json_data",
"=",
"None",
",",
"hr",
"=",
"True",
",",
"show_name",
"=",
"False",
",",
"colorize",
"=",
"True",
")",
":",
"if",
"json_data",
"is",
"None",
":",
"json_data",
"=",
"{",
"}",
"output",
"=",
... | The function for generating CLI output NIR network results.
Args:
json_data (:obj:`dict`): The data to process. Defaults to None.
hr (:obj:`bool`): Enable human readable key translations. Defaults
to True.
show_name (:obj:`bool`): Show human readable name (de... | [
"The",
"function",
"for",
"generating",
"CLI",
"output",
"NIR",
"network",
"results",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L1234-L1368 | train |
secynic/ipwhois | ipwhois/asn.py | IPASN.parse_fields_whois | def parse_fields_whois(self, response):
"""
The function for parsing ASN fields from a whois response.
Args:
response (:obj:`str`): The response from the ASN whois server.
Returns:
dict: The ASN lookup results
::
{
... | python | def parse_fields_whois(self, response):
"""
The function for parsing ASN fields from a whois response.
Args:
response (:obj:`str`): The response from the ASN whois server.
Returns:
dict: The ASN lookup results
::
{
... | [
"def",
"parse_fields_whois",
"(",
"self",
",",
"response",
")",
":",
"try",
":",
"temp",
"=",
"response",
".",
"split",
"(",
"'|'",
")",
"ret",
"=",
"{",
"'asn_registry'",
":",
"temp",
"[",
"4",
"]",
".",
"strip",
"(",
"' \\n'",
")",
"}",
"if",
"re... | The function for parsing ASN fields from a whois response.
Args:
response (:obj:`str`): The response from the ASN whois server.
Returns:
dict: The ASN lookup results
::
{
'asn' (str) - The Autonomous System Number
... | [
"The",
"function",
"for",
"parsing",
"ASN",
"fields",
"from",
"a",
"whois",
"response",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/asn.py#L239-L294 | train |
secynic/ipwhois | ipwhois/asn.py | IPASN.parse_fields_http | def parse_fields_http(self, response, extra_org_map=None):
"""
The function for parsing ASN fields from a http response.
Args:
response (:obj:`str`): The response from the ASN http server.
extra_org_map (:obj:`dict`): Dictionary mapping org handles to
RIR... | python | def parse_fields_http(self, response, extra_org_map=None):
"""
The function for parsing ASN fields from a http response.
Args:
response (:obj:`str`): The response from the ASN http server.
extra_org_map (:obj:`dict`): Dictionary mapping org handles to
RIR... | [
"def",
"parse_fields_http",
"(",
"self",
",",
"response",
",",
"extra_org_map",
"=",
"None",
")",
":",
"org_map",
"=",
"self",
".",
"org_map",
".",
"copy",
"(",
")",
"try",
":",
"org_map",
".",
"update",
"(",
"extra_org_map",
")",
"except",
"(",
"TypeErr... | The function for parsing ASN fields from a http response.
Args:
response (:obj:`str`): The response from the ASN http server.
extra_org_map (:obj:`dict`): Dictionary mapping org handles to
RIRs. This is for limited cases where ARIN REST (ASN fallback
HTTP... | [
"The",
"function",
"for",
"parsing",
"ASN",
"fields",
"from",
"a",
"http",
"response",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/asn.py#L306-L404 | train |
secynic/ipwhois | ipwhois/asn.py | ASNOrigin.get_nets_radb | def get_nets_radb(self, response, is_http=False):
"""
The function for parsing network blocks from ASN origin data.
Args:
response (:obj:`str`): The response from the RADB whois/http
server.
is_http (:obj:`bool`): If the query is RADB HTTP instead of whoi... | python | def get_nets_radb(self, response, is_http=False):
"""
The function for parsing network blocks from ASN origin data.
Args:
response (:obj:`str`): The response from the RADB whois/http
server.
is_http (:obj:`bool`): If the query is RADB HTTP instead of whoi... | [
"def",
"get_nets_radb",
"(",
"self",
",",
"response",
",",
"is_http",
"=",
"False",
")",
":",
"nets",
"=",
"[",
"]",
"if",
"is_http",
":",
"regex",
"=",
"r'route(?:6)?:[^\\S\\n]+(?P<val>.+?)<br>'",
"else",
":",
"regex",
"=",
"r'^route(?:6)?:[^\\S\\n]+(?P<val>.+|.+... | The function for parsing network blocks from ASN origin data.
Args:
response (:obj:`str`): The response from the RADB whois/http
server.
is_http (:obj:`bool`): If the query is RADB HTTP instead of whois,
set to True. Defaults to False.
Returns:
... | [
"The",
"function",
"for",
"parsing",
"network",
"blocks",
"from",
"ASN",
"origin",
"data",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/asn.py#L719-L770 | train |
secynic/ipwhois | ipwhois/nir.py | NIRWhois.get_nets_jpnic | def get_nets_jpnic(self, response):
"""
The function for parsing network blocks from jpnic whois data.
Args:
response (:obj:`str`): The response from the jpnic server.
Returns:
list of dict: Mapping of networks with start and end positions.
::
... | python | def get_nets_jpnic(self, response):
"""
The function for parsing network blocks from jpnic whois data.
Args:
response (:obj:`str`): The response from the jpnic server.
Returns:
list of dict: Mapping of networks with start and end positions.
::
... | [
"def",
"get_nets_jpnic",
"(",
"self",
",",
"response",
")",
":",
"nets",
"=",
"[",
"]",
"for",
"match",
"in",
"re",
".",
"finditer",
"(",
"r'^.*?(\\[Network Number\\])[^\\S\\n]+.+?>(?P<val>.+?)</A>$'",
",",
"response",
",",
"re",
".",
"MULTILINE",
")",
":",
"t... | The function for parsing network blocks from jpnic whois data.
Args:
response (:obj:`str`): The response from the jpnic server.
Returns:
list of dict: Mapping of networks with start and end positions.
::
[{
'cidr' (str) - The ne... | [
"The",
"function",
"for",
"parsing",
"network",
"blocks",
"from",
"jpnic",
"whois",
"data",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/nir.py#L299-L360 | train |
secynic/ipwhois | ipwhois/nir.py | NIRWhois.get_contact | def get_contact(self, response=None, nir=None, handle=None,
retry_count=3, dt_format=None):
"""
The function for retrieving and parsing NIR whois data based on
NIR_WHOIS contact_fields.
Args:
response (:obj:`str`): Optional response object, this bypasses ... | python | def get_contact(self, response=None, nir=None, handle=None,
retry_count=3, dt_format=None):
"""
The function for retrieving and parsing NIR whois data based on
NIR_WHOIS contact_fields.
Args:
response (:obj:`str`): Optional response object, this bypasses ... | [
"def",
"get_contact",
"(",
"self",
",",
"response",
"=",
"None",
",",
"nir",
"=",
"None",
",",
"handle",
"=",
"None",
",",
"retry_count",
"=",
"3",
",",
"dt_format",
"=",
"None",
")",
":",
"if",
"response",
"or",
"nir",
"==",
"'krnic'",
":",
"contact... | The function for retrieving and parsing NIR whois data based on
NIR_WHOIS contact_fields.
Args:
response (:obj:`str`): Optional response object, this bypasses the
lookup.
nir (:obj:`str`): The NIR to query ('jpnic' or 'krnic'). Required
if respons... | [
"The",
"function",
"for",
"retrieving",
"and",
"parsing",
"NIR",
"whois",
"data",
"based",
"on",
"NIR_WHOIS",
"contact_fields",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/nir.py#L447-L492 | train |
secynic/ipwhois | ipwhois/rdap.py | _RDAPContact._parse_address | def _parse_address(self, val):
"""
The function for parsing the vcard address.
Args:
val (:obj:`list`): The value to parse.
"""
ret = {
'type': None,
'value': None
}
try:
ret['type'] = val[1]['type']
exc... | python | def _parse_address(self, val):
"""
The function for parsing the vcard address.
Args:
val (:obj:`list`): The value to parse.
"""
ret = {
'type': None,
'value': None
}
try:
ret['type'] = val[1]['type']
exc... | [
"def",
"_parse_address",
"(",
"self",
",",
"val",
")",
":",
"ret",
"=",
"{",
"'type'",
":",
"None",
",",
"'value'",
":",
"None",
"}",
"try",
":",
"ret",
"[",
"'type'",
"]",
"=",
"val",
"[",
"1",
"]",
"[",
"'type'",
"]",
"except",
"(",
"KeyError",... | The function for parsing the vcard address.
Args:
val (:obj:`list`): The value to parse. | [
"The",
"function",
"for",
"parsing",
"the",
"vcard",
"address",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/rdap.py#L112-L148 | train |
secynic/ipwhois | ipwhois/rdap.py | _RDAPContact._parse_phone | def _parse_phone(self, val):
"""
The function for parsing the vcard phone numbers.
Args:
val (:obj:`list`): The value to parse.
"""
ret = {
'type': None,
'value': None
}
try:
ret['type'] = val[1]['type']
... | python | def _parse_phone(self, val):
"""
The function for parsing the vcard phone numbers.
Args:
val (:obj:`list`): The value to parse.
"""
ret = {
'type': None,
'value': None
}
try:
ret['type'] = val[1]['type']
... | [
"def",
"_parse_phone",
"(",
"self",
",",
"val",
")",
":",
"ret",
"=",
"{",
"'type'",
":",
"None",
",",
"'value'",
":",
"None",
"}",
"try",
":",
"ret",
"[",
"'type'",
"]",
"=",
"val",
"[",
"1",
"]",
"[",
"'type'",
"]",
"except",
"(",
"IndexError",... | The function for parsing the vcard phone numbers.
Args:
val (:obj:`list`): The value to parse. | [
"The",
"function",
"for",
"parsing",
"the",
"vcard",
"phone",
"numbers",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/rdap.py#L150-L180 | train |
secynic/ipwhois | ipwhois/rdap.py | _RDAPContact._parse_email | def _parse_email(self, val):
"""
The function for parsing the vcard email addresses.
Args:
val (:obj:`list`): The value to parse.
"""
ret = {
'type': None,
'value': None
}
try:
ret['type'] = val[1]['type']
... | python | def _parse_email(self, val):
"""
The function for parsing the vcard email addresses.
Args:
val (:obj:`list`): The value to parse.
"""
ret = {
'type': None,
'value': None
}
try:
ret['type'] = val[1]['type']
... | [
"def",
"_parse_email",
"(",
"self",
",",
"val",
")",
":",
"ret",
"=",
"{",
"'type'",
":",
"None",
",",
"'value'",
":",
"None",
"}",
"try",
":",
"ret",
"[",
"'type'",
"]",
"=",
"val",
"[",
"1",
"]",
"[",
"'type'",
"]",
"except",
"(",
"KeyError",
... | The function for parsing the vcard email addresses.
Args:
val (:obj:`list`): The value to parse. | [
"The",
"function",
"for",
"parsing",
"the",
"vcard",
"email",
"addresses",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/rdap.py#L182-L212 | train |
secynic/ipwhois | ipwhois/rdap.py | _RDAPContact.parse | def parse(self):
"""
The function for parsing the vcard to the vars dictionary.
"""
keys = {
'fn': self._parse_name,
'kind': self._parse_kind,
'adr': self._parse_address,
'tel': self._parse_phone,
'email': self._parse_email,
... | python | def parse(self):
"""
The function for parsing the vcard to the vars dictionary.
"""
keys = {
'fn': self._parse_name,
'kind': self._parse_kind,
'adr': self._parse_address,
'tel': self._parse_phone,
'email': self._parse_email,
... | [
"def",
"parse",
"(",
"self",
")",
":",
"keys",
"=",
"{",
"'fn'",
":",
"self",
".",
"_parse_name",
",",
"'kind'",
":",
"self",
".",
"_parse_kind",
",",
"'adr'",
":",
"self",
".",
"_parse_address",
",",
"'tel'",
":",
"self",
".",
"_parse_phone",
",",
"... | The function for parsing the vcard to the vars dictionary. | [
"The",
"function",
"for",
"parsing",
"the",
"vcard",
"to",
"the",
"vars",
"dictionary",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/rdap.py#L234-L258 | train |
secynic/ipwhois | ipwhois/utils.py | ipv4_lstrip_zeros | def ipv4_lstrip_zeros(address):
"""
The function to strip leading zeros in each octet of an IPv4 address.
Args:
address (:obj:`str`): An IPv4 address.
Returns:
str: The modified IPv4 address.
"""
# Split the octets.
obj = address.strip().split('.')
for x, y in enumer... | python | def ipv4_lstrip_zeros(address):
"""
The function to strip leading zeros in each octet of an IPv4 address.
Args:
address (:obj:`str`): An IPv4 address.
Returns:
str: The modified IPv4 address.
"""
# Split the octets.
obj = address.strip().split('.')
for x, y in enumer... | [
"def",
"ipv4_lstrip_zeros",
"(",
"address",
")",
":",
"obj",
"=",
"address",
".",
"strip",
"(",
")",
".",
"split",
"(",
"'.'",
")",
"for",
"x",
",",
"y",
"in",
"enumerate",
"(",
"obj",
")",
":",
"obj",
"[",
"x",
"]",
"=",
"y",
".",
"split",
"("... | The function to strip leading zeros in each octet of an IPv4 address.
Args:
address (:obj:`str`): An IPv4 address.
Returns:
str: The modified IPv4 address. | [
"The",
"function",
"to",
"strip",
"leading",
"zeros",
"in",
"each",
"octet",
"of",
"an",
"IPv4",
"address",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/utils.py#L117-L138 | train |
secynic/ipwhois | ipwhois/utils.py | get_countries | def get_countries(is_legacy_xml=False):
"""
The function to generate a dictionary containing ISO_3166-1 country codes
to names.
Args:
is_legacy_xml (:obj:`bool`): Whether to use the older country code
list (iso_3166-1_list_en.xml).
Returns:
dict: A mapping of country co... | python | def get_countries(is_legacy_xml=False):
"""
The function to generate a dictionary containing ISO_3166-1 country codes
to names.
Args:
is_legacy_xml (:obj:`bool`): Whether to use the older country code
list (iso_3166-1_list_en.xml).
Returns:
dict: A mapping of country co... | [
"def",
"get_countries",
"(",
"is_legacy_xml",
"=",
"False",
")",
":",
"countries",
"=",
"{",
"}",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
"and",
"getattr",
"(",
"sys",
",",
"'frozen'",
",",
"False",
")",
":",
"data_dir",
"=",
"path",
".",
"dirna... | The function to generate a dictionary containing ISO_3166-1 country codes
to names.
Args:
is_legacy_xml (:obj:`bool`): Whether to use the older country code
list (iso_3166-1_list_en.xml).
Returns:
dict: A mapping of country codes as the keys to the country names as
... | [
"The",
"function",
"to",
"generate",
"a",
"dictionary",
"containing",
"ISO_3166",
"-",
"1",
"country",
"codes",
"to",
"names",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/utils.py#L178-L261 | train |
secynic/ipwhois | ipwhois/utils.py | unique_everseen | def unique_everseen(iterable, key=None):
"""
The generator to list unique elements, preserving the order. Remember all
elements ever seen. This was taken from the itertools recipes.
Args:
iterable (:obj:`iter`): An iterable to process.
key (:obj:`callable`): Optional function to run whe... | python | def unique_everseen(iterable, key=None):
"""
The generator to list unique elements, preserving the order. Remember all
elements ever seen. This was taken from the itertools recipes.
Args:
iterable (:obj:`iter`): An iterable to process.
key (:obj:`callable`): Optional function to run whe... | [
"def",
"unique_everseen",
"(",
"iterable",
",",
"key",
"=",
"None",
")",
":",
"seen",
"=",
"set",
"(",
")",
"seen_add",
"=",
"seen",
".",
"add",
"if",
"key",
"is",
"None",
":",
"for",
"element",
"in",
"filterfalse",
"(",
"seen",
".",
"__contains__",
... | The generator to list unique elements, preserving the order. Remember all
elements ever seen. This was taken from the itertools recipes.
Args:
iterable (:obj:`iter`): An iterable to process.
key (:obj:`callable`): Optional function to run when checking
elements (e.g., str.lower)
... | [
"The",
"generator",
"to",
"list",
"unique",
"elements",
"preserving",
"the",
"order",
".",
"Remember",
"all",
"elements",
"ever",
"seen",
".",
"This",
"was",
"taken",
"from",
"the",
"itertools",
"recipes",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/utils.py#L424-L457 | train |
secynic/ipwhois | ipwhois/whois.py | Whois.get_nets_arin | def get_nets_arin(self, response):
"""
The function for parsing network blocks from ARIN whois data.
Args:
response (:obj:`str`): The response from the ARIN whois server.
Returns:
list of dict: Mapping of networks with start and end positions.
::
... | python | def get_nets_arin(self, response):
"""
The function for parsing network blocks from ARIN whois data.
Args:
response (:obj:`str`): The response from the ARIN whois server.
Returns:
list of dict: Mapping of networks with start and end positions.
::
... | [
"def",
"get_nets_arin",
"(",
"self",
",",
"response",
")",
":",
"nets",
"=",
"[",
"]",
"pattern",
"=",
"re",
".",
"compile",
"(",
"r'^NetRange:[^\\S\\n]+(.+)$'",
",",
"re",
".",
"MULTILINE",
")",
"temp",
"=",
"pattern",
".",
"search",
"(",
"response",
")... | The function for parsing network blocks from ARIN whois data.
Args:
response (:obj:`str`): The response from the ARIN whois server.
Returns:
list of dict: Mapping of networks with start and end positions.
::
[{
'cidr' (str) - Th... | [
"The",
"function",
"for",
"parsing",
"network",
"blocks",
"from",
"ARIN",
"whois",
"data",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/whois.py#L337-L416 | train |
secynic/ipwhois | ipwhois/whois.py | Whois.get_nets_lacnic | def get_nets_lacnic(self, response):
"""
The function for parsing network blocks from LACNIC whois data.
Args:
response (:obj:`str`): The response from the LACNIC whois server.
Returns:
list of dict: Mapping of networks with start and end positions.
... | python | def get_nets_lacnic(self, response):
"""
The function for parsing network blocks from LACNIC whois data.
Args:
response (:obj:`str`): The response from the LACNIC whois server.
Returns:
list of dict: Mapping of networks with start and end positions.
... | [
"def",
"get_nets_lacnic",
"(",
"self",
",",
"response",
")",
":",
"nets",
"=",
"[",
"]",
"for",
"match",
"in",
"re",
".",
"finditer",
"(",
"r'^(inetnum|inet6num|route):[^\\S\\n]+(.+?,[^\\S\\n].+|.+)$'",
",",
"response",
",",
"re",
".",
"MULTILINE",
")",
":",
"... | The function for parsing network blocks from LACNIC whois data.
Args:
response (:obj:`str`): The response from the LACNIC whois server.
Returns:
list of dict: Mapping of networks with start and end positions.
::
[{
'cidr' (str) ... | [
"The",
"function",
"for",
"parsing",
"network",
"blocks",
"from",
"LACNIC",
"whois",
"data",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/whois.py#L428-L496 | train |
secynic/ipwhois | ipwhois/whois.py | Whois.get_nets_other | def get_nets_other(self, response):
"""
The function for parsing network blocks from generic whois data.
Args:
response (:obj:`str`): The response from the whois/rwhois server.
Returns:
list of dict: Mapping of networks with start and end positions.
... | python | def get_nets_other(self, response):
"""
The function for parsing network blocks from generic whois data.
Args:
response (:obj:`str`): The response from the whois/rwhois server.
Returns:
list of dict: Mapping of networks with start and end positions.
... | [
"def",
"get_nets_other",
"(",
"self",
",",
"response",
")",
":",
"nets",
"=",
"[",
"]",
"for",
"match",
"in",
"re",
".",
"finditer",
"(",
"r'^(inetnum|inet6num|route):[^\\S\\n]+((.+?)[^\\S\\n]-[^\\S\\n](.+)|'",
"'.+)$'",
",",
"response",
",",
"re",
".",
"MULTILINE... | The function for parsing network blocks from generic whois data.
Args:
response (:obj:`str`): The response from the whois/rwhois server.
Returns:
list of dict: Mapping of networks with start and end positions.
::
[{
'cidr' (str)... | [
"The",
"function",
"for",
"parsing",
"network",
"blocks",
"from",
"generic",
"whois",
"data",
"."
] | b5d634d36b0b942d538d38d77b3bdcd815f155a0 | https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/whois.py#L508-L578 | train |
klen/marshmallow-peewee | marshmallow_peewee/convert.py | ModelConverter.convert_default | def convert_default(self, field, **params):
"""Return raw field."""
for klass, ma_field in self.TYPE_MAPPING:
if isinstance(field, klass):
return ma_field(**params)
return fields.Raw(**params) | python | def convert_default(self, field, **params):
"""Return raw field."""
for klass, ma_field in self.TYPE_MAPPING:
if isinstance(field, klass):
return ma_field(**params)
return fields.Raw(**params) | [
"def",
"convert_default",
"(",
"self",
",",
"field",
",",
"**",
"params",
")",
":",
"for",
"klass",
",",
"ma_field",
"in",
"self",
".",
"TYPE_MAPPING",
":",
"if",
"isinstance",
"(",
"field",
",",
"klass",
")",
":",
"return",
"ma_field",
"(",
"**",
"par... | Return raw field. | [
"Return",
"raw",
"field",
"."
] | a5985daa4072605882a9c7c41d74881631943953 | https://github.com/klen/marshmallow-peewee/blob/a5985daa4072605882a9c7c41d74881631943953/marshmallow_peewee/convert.py#L78-L83 | train |
klen/marshmallow-peewee | marshmallow_peewee/schema.py | ModelSchema.make_instance | def make_instance(self, data):
"""Build object from data."""
if not self.opts.model:
return data
if self.instance is not None:
for key, value in data.items():
setattr(self.instance, key, value)
return self.instance
return self.opts.mo... | python | def make_instance(self, data):
"""Build object from data."""
if not self.opts.model:
return data
if self.instance is not None:
for key, value in data.items():
setattr(self.instance, key, value)
return self.instance
return self.opts.mo... | [
"def",
"make_instance",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"opts",
".",
"model",
":",
"return",
"data",
"if",
"self",
".",
"instance",
"is",
"not",
"None",
":",
"for",
"key",
",",
"value",
"in",
"data",
".",
"items",
"(",... | Build object from data. | [
"Build",
"object",
"from",
"data",
"."
] | a5985daa4072605882a9c7c41d74881631943953 | https://github.com/klen/marshmallow-peewee/blob/a5985daa4072605882a9c7c41d74881631943953/marshmallow_peewee/schema.py#L68-L78 | train |
tyarkoni/pliers | pliers/extractors/text.py | ComplexTextExtractor._extract | def _extract(self, stim):
''' Returns all words. '''
props = [(e.text, e.onset, e.duration) for e in stim.elements]
vals, onsets, durations = map(list, zip(*props))
return ExtractorResult(vals, stim, self, ['word'], onsets, durations) | python | def _extract(self, stim):
''' Returns all words. '''
props = [(e.text, e.onset, e.duration) for e in stim.elements]
vals, onsets, durations = map(list, zip(*props))
return ExtractorResult(vals, stim, self, ['word'], onsets, durations) | [
"def",
"_extract",
"(",
"self",
",",
"stim",
")",
":",
"props",
"=",
"[",
"(",
"e",
".",
"text",
",",
"e",
".",
"onset",
",",
"e",
".",
"duration",
")",
"for",
"e",
"in",
"stim",
".",
"elements",
"]",
"vals",
",",
"onsets",
",",
"durations",
"=... | Returns all words. | [
"Returns",
"all",
"words",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/extractors/text.py#L44-L48 | train |
tyarkoni/pliers | pliers/stimuli/base.py | Stim.get_filename | def get_filename(self):
''' Return the source filename of the current Stim. '''
if self.filename is None or not os.path.exists(self.filename):
tf = tempfile.mktemp() + self._default_file_extension
self.save(tf)
yield tf
os.remove(tf)
else:
... | python | def get_filename(self):
''' Return the source filename of the current Stim. '''
if self.filename is None or not os.path.exists(self.filename):
tf = tempfile.mktemp() + self._default_file_extension
self.save(tf)
yield tf
os.remove(tf)
else:
... | [
"def",
"get_filename",
"(",
"self",
")",
":",
"if",
"self",
".",
"filename",
"is",
"None",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"filename",
")",
":",
"tf",
"=",
"tempfile",
".",
"mktemp",
"(",
")",
"+",
"self",
".",
"_... | Return the source filename of the current Stim. | [
"Return",
"the",
"source",
"filename",
"of",
"the",
"current",
"Stim",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/stimuli/base.py#L55-L63 | train |
tyarkoni/pliers | pliers/stimuli/compound.py | CompoundStim.get_stim | def get_stim(self, type_, return_all=False):
''' Returns component elements of the specified type.
Args:
type_ (str or Stim class): the desired Stim subclass to return.
return_all (bool): when True, returns all elements that matched the
specified type as a list. ... | python | def get_stim(self, type_, return_all=False):
''' Returns component elements of the specified type.
Args:
type_ (str or Stim class): the desired Stim subclass to return.
return_all (bool): when True, returns all elements that matched the
specified type as a list. ... | [
"def",
"get_stim",
"(",
"self",
",",
"type_",
",",
"return_all",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"type_",
",",
"string_types",
")",
":",
"type_",
"=",
"_get_stim_class",
"(",
"type_",
")",
"matches",
"=",
"[",
"]",
"for",
"s",
"in",
... | Returns component elements of the specified type.
Args:
type_ (str or Stim class): the desired Stim subclass to return.
return_all (bool): when True, returns all elements that matched the
specified type as a list. When False (default), returns only
the fi... | [
"Returns",
"component",
"elements",
"of",
"the",
"specified",
"type",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/stimuli/compound.py#L57-L81 | train |
tyarkoni/pliers | pliers/stimuli/compound.py | CompoundStim.has_types | def has_types(self, types, all_=True):
''' Check whether the current component list matches all Stim types
in the types argument.
Args:
types (Stim, list): a Stim class or iterable of Stim classes.
all_ (bool): if True, all input types must match; if False, at
... | python | def has_types(self, types, all_=True):
''' Check whether the current component list matches all Stim types
in the types argument.
Args:
types (Stim, list): a Stim class or iterable of Stim classes.
all_ (bool): if True, all input types must match; if False, at
... | [
"def",
"has_types",
"(",
"self",
",",
"types",
",",
"all_",
"=",
"True",
")",
":",
"func",
"=",
"all",
"if",
"all_",
"else",
"any",
"return",
"func",
"(",
"[",
"self",
".",
"get_stim",
"(",
"t",
")",
"for",
"t",
"in",
"listify",
"(",
"types",
")"... | Check whether the current component list matches all Stim types
in the types argument.
Args:
types (Stim, list): a Stim class or iterable of Stim classes.
all_ (bool): if True, all input types must match; if False, at
least one input type must match.
Ret... | [
"Check",
"whether",
"the",
"current",
"component",
"list",
"matches",
"all",
"Stim",
"types",
"in",
"the",
"types",
"argument",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/stimuli/compound.py#L87-L101 | train |
tyarkoni/pliers | pliers/stimuli/audio.py | AudioStim.save | def save(self, path):
''' Save clip data to file.
Args:
path (str): Filename to save audio data to.
'''
self.clip.write_audiofile(path, fps=self.sampling_rate) | python | def save(self, path):
''' Save clip data to file.
Args:
path (str): Filename to save audio data to.
'''
self.clip.write_audiofile(path, fps=self.sampling_rate) | [
"def",
"save",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"clip",
".",
"write_audiofile",
"(",
"path",
",",
"fps",
"=",
"self",
".",
"sampling_rate",
")"
] | Save clip data to file.
Args:
path (str): Filename to save audio data to. | [
"Save",
"clip",
"data",
"to",
"file",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/stimuli/audio.py#L77-L83 | train |
tyarkoni/pliers | pliers/converters/base.py | get_converter | def get_converter(in_type, out_type, *args, **kwargs):
''' Scans the list of available Converters and returns an instantiation
of the first one whose input and output types match those passed in.
Args:
in_type (type): The type of input the converter must have.
out_type (type): The type of o... | python | def get_converter(in_type, out_type, *args, **kwargs):
''' Scans the list of available Converters and returns an instantiation
of the first one whose input and output types match those passed in.
Args:
in_type (type): The type of input the converter must have.
out_type (type): The type of o... | [
"def",
"get_converter",
"(",
"in_type",
",",
"out_type",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"convs",
"=",
"pliers",
".",
"converters",
".",
"__all__",
"out_type",
"=",
"listify",
"(",
"out_type",
")",
"[",
":",
":",
"-",
"1",
"]",
"defa... | Scans the list of available Converters and returns an instantiation
of the first one whose input and output types match those passed in.
Args:
in_type (type): The type of input the converter must have.
out_type (type): The type of output the converter must have.
args, kwargs: Optional p... | [
"Scans",
"the",
"list",
"of",
"available",
"Converters",
"and",
"returns",
"an",
"instantiation",
"of",
"the",
"first",
"one",
"whose",
"input",
"and",
"output",
"types",
"match",
"those",
"passed",
"in",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/converters/base.py#L27-L61 | train |
tyarkoni/pliers | pliers/external/tensorflow/classify_image.py | create_graph | def create_graph():
"""Creates a graph from saved GraphDef file and returns a saver."""
# Creates graph from saved graph_def.pb.
with tf.gfile.FastGFile(os.path.join(
FLAGS.model_dir, 'classify_image_graph_def.pb'), 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
_ = tf... | python | def create_graph():
"""Creates a graph from saved GraphDef file and returns a saver."""
# Creates graph from saved graph_def.pb.
with tf.gfile.FastGFile(os.path.join(
FLAGS.model_dir, 'classify_image_graph_def.pb'), 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
_ = tf... | [
"def",
"create_graph",
"(",
")",
":",
"with",
"tf",
".",
"gfile",
".",
"FastGFile",
"(",
"os",
".",
"path",
".",
"join",
"(",
"FLAGS",
".",
"model_dir",
",",
"'classify_image_graph_def.pb'",
")",
",",
"'rb'",
")",
"as",
"f",
":",
"graph_def",
"=",
"tf"... | Creates a graph from saved GraphDef file and returns a saver. | [
"Creates",
"a",
"graph",
"from",
"saved",
"GraphDef",
"file",
"and",
"returns",
"a",
"saver",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/external/tensorflow/classify_image.py#L120-L127 | train |
tyarkoni/pliers | pliers/external/tensorflow/classify_image.py | run_inference_on_image | def run_inference_on_image(image):
"""Runs inference on an image.
Args:
image: Image file name.
Returns:
Nothing
"""
if not tf.gfile.Exists(image):
tf.logging.fatal('File does not exist %s', image)
image_data = tf.gfile.FastGFile(image, 'rb').read()
# Creates graph from saved GraphDef.
cr... | python | def run_inference_on_image(image):
"""Runs inference on an image.
Args:
image: Image file name.
Returns:
Nothing
"""
if not tf.gfile.Exists(image):
tf.logging.fatal('File does not exist %s', image)
image_data = tf.gfile.FastGFile(image, 'rb').read()
# Creates graph from saved GraphDef.
cr... | [
"def",
"run_inference_on_image",
"(",
"image",
")",
":",
"if",
"not",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"image",
")",
":",
"tf",
".",
"logging",
".",
"fatal",
"(",
"'File does not exist %s'",
",",
"image",
")",
"image_data",
"=",
"tf",
".",
"gfile"... | Runs inference on an image.
Args:
image: Image file name.
Returns:
Nothing | [
"Runs",
"inference",
"on",
"an",
"image",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/external/tensorflow/classify_image.py#L130-L167 | train |
tyarkoni/pliers | pliers/external/tensorflow/classify_image.py | NodeLookup.load | def load(self, label_lookup_path, uid_lookup_path):
"""Loads a human readable English name for each softmax node.
Args:
label_lookup_path: string UID to integer node ID.
uid_lookup_path: string UID to human-readable string.
Returns:
dict from integer node ID to human-readable string.
... | python | def load(self, label_lookup_path, uid_lookup_path):
"""Loads a human readable English name for each softmax node.
Args:
label_lookup_path: string UID to integer node ID.
uid_lookup_path: string UID to human-readable string.
Returns:
dict from integer node ID to human-readable string.
... | [
"def",
"load",
"(",
"self",
",",
"label_lookup_path",
",",
"uid_lookup_path",
")",
":",
"if",
"not",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"uid_lookup_path",
")",
":",
"tf",
".",
"logging",
".",
"fatal",
"(",
"'File does not exist %s'",
",",
"uid_lookup_pa... | Loads a human readable English name for each softmax node.
Args:
label_lookup_path: string UID to integer node ID.
uid_lookup_path: string UID to human-readable string.
Returns:
dict from integer node ID to human-readable string. | [
"Loads",
"a",
"human",
"readable",
"English",
"name",
"for",
"each",
"softmax",
"node",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/external/tensorflow/classify_image.py#L69-L112 | train |
tyarkoni/pliers | pliers/datasets/text.py | fetch_dictionary | def fetch_dictionary(name, url=None, format=None, index=0, rename=None,
save=True, force_retrieve=False):
''' Retrieve a dictionary of text norms from the web or local storage.
Args:
name (str): The name of the dictionary. If no url is passed, this must
match either one... | python | def fetch_dictionary(name, url=None, format=None, index=0, rename=None,
save=True, force_retrieve=False):
''' Retrieve a dictionary of text norms from the web or local storage.
Args:
name (str): The name of the dictionary. If no url is passed, this must
match either one... | [
"def",
"fetch_dictionary",
"(",
"name",
",",
"url",
"=",
"None",
",",
"format",
"=",
"None",
",",
"index",
"=",
"0",
",",
"rename",
"=",
"None",
",",
"save",
"=",
"True",
",",
"force_retrieve",
"=",
"False",
")",
":",
"file_path",
"=",
"os",
".",
"... | Retrieve a dictionary of text norms from the web or local storage.
Args:
name (str): The name of the dictionary. If no url is passed, this must
match either one of the keys in the predefined dictionary file (see
dictionaries.json), or the name assigned to a previous dictionary
... | [
"Retrieve",
"a",
"dictionary",
"of",
"text",
"norms",
"from",
"the",
"web",
"or",
"local",
"storage",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/datasets/text.py#L57-L111 | train |
tyarkoni/pliers | pliers/extractors/api/google.py | GoogleVisionAPIFaceExtractor._to_df | def _to_df(self, result, handle_annotations=None):
'''
Converts a Google API Face JSON response into a Pandas Dataframe.
Args:
result (ExtractorResult): Result object from which to parse out a
Dataframe.
handle_annotations (str): How returned face annotat... | python | def _to_df(self, result, handle_annotations=None):
'''
Converts a Google API Face JSON response into a Pandas Dataframe.
Args:
result (ExtractorResult): Result object from which to parse out a
Dataframe.
handle_annotations (str): How returned face annotat... | [
"def",
"_to_df",
"(",
"self",
",",
"result",
",",
"handle_annotations",
"=",
"None",
")",
":",
"annotations",
"=",
"result",
".",
"_data",
"if",
"handle_annotations",
"==",
"'first'",
":",
"annotations",
"=",
"[",
"annotations",
"[",
"0",
"]",
"]",
"face_r... | Converts a Google API Face JSON response into a Pandas Dataframe.
Args:
result (ExtractorResult): Result object from which to parse out a
Dataframe.
handle_annotations (str): How returned face annotations should be
handled in cases where there are multipl... | [
"Converts",
"a",
"Google",
"API",
"Face",
"JSON",
"response",
"into",
"a",
"Pandas",
"Dataframe",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/extractors/api/google.py#L50-L89 | train |
tyarkoni/pliers | pliers/diagnostics/diagnostics.py | correlation_matrix | def correlation_matrix(df):
'''
Returns a pandas DataFrame with the pair-wise correlations of the columns.
Args:
df: pandas DataFrame with columns to run diagnostics on
'''
columns = df.columns.tolist()
corr = pd.DataFrame(
np.corrcoef(df, rowvar=0), columns=columns, index=colum... | python | def correlation_matrix(df):
'''
Returns a pandas DataFrame with the pair-wise correlations of the columns.
Args:
df: pandas DataFrame with columns to run diagnostics on
'''
columns = df.columns.tolist()
corr = pd.DataFrame(
np.corrcoef(df, rowvar=0), columns=columns, index=colum... | [
"def",
"correlation_matrix",
"(",
"df",
")",
":",
"columns",
"=",
"df",
".",
"columns",
".",
"tolist",
"(",
")",
"corr",
"=",
"pd",
".",
"DataFrame",
"(",
"np",
".",
"corrcoef",
"(",
"df",
",",
"rowvar",
"=",
"0",
")",
",",
"columns",
"=",
"columns... | Returns a pandas DataFrame with the pair-wise correlations of the columns.
Args:
df: pandas DataFrame with columns to run diagnostics on | [
"Returns",
"a",
"pandas",
"DataFrame",
"with",
"the",
"pair",
"-",
"wise",
"correlations",
"of",
"the",
"columns",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/diagnostics/diagnostics.py#L12-L22 | train |
tyarkoni/pliers | pliers/diagnostics/diagnostics.py | eigenvalues | def eigenvalues(df):
'''
Returns a pandas Series with eigenvalues of the correlation matrix.
Args:
df: pandas DataFrame with columns to run diagnostics on
'''
corr = np.corrcoef(df, rowvar=0)
eigvals = np.linalg.eigvals(corr)
return pd.Series(eigvals, df.columns, name='Eigenvalue') | python | def eigenvalues(df):
'''
Returns a pandas Series with eigenvalues of the correlation matrix.
Args:
df: pandas DataFrame with columns to run diagnostics on
'''
corr = np.corrcoef(df, rowvar=0)
eigvals = np.linalg.eigvals(corr)
return pd.Series(eigvals, df.columns, name='Eigenvalue') | [
"def",
"eigenvalues",
"(",
"df",
")",
":",
"corr",
"=",
"np",
".",
"corrcoef",
"(",
"df",
",",
"rowvar",
"=",
"0",
")",
"eigvals",
"=",
"np",
".",
"linalg",
".",
"eigvals",
"(",
"corr",
")",
"return",
"pd",
".",
"Series",
"(",
"eigvals",
",",
"df... | Returns a pandas Series with eigenvalues of the correlation matrix.
Args:
df: pandas DataFrame with columns to run diagnostics on | [
"Returns",
"a",
"pandas",
"Series",
"with",
"eigenvalues",
"of",
"the",
"correlation",
"matrix",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/diagnostics/diagnostics.py#L25-L34 | train |
tyarkoni/pliers | pliers/diagnostics/diagnostics.py | condition_indices | def condition_indices(df):
'''
Returns a pandas Series with condition indices of the df columns.
Args:
df: pandas DataFrame with columns to run diagnostics on
'''
eigvals = eigenvalues(df)
cond_idx = np.sqrt(eigvals.max() / eigvals)
return pd.Series(cond_idx, df.columns, name='Condi... | python | def condition_indices(df):
'''
Returns a pandas Series with condition indices of the df columns.
Args:
df: pandas DataFrame with columns to run diagnostics on
'''
eigvals = eigenvalues(df)
cond_idx = np.sqrt(eigvals.max() / eigvals)
return pd.Series(cond_idx, df.columns, name='Condi... | [
"def",
"condition_indices",
"(",
"df",
")",
":",
"eigvals",
"=",
"eigenvalues",
"(",
"df",
")",
"cond_idx",
"=",
"np",
".",
"sqrt",
"(",
"eigvals",
".",
"max",
"(",
")",
"/",
"eigvals",
")",
"return",
"pd",
".",
"Series",
"(",
"cond_idx",
",",
"df",
... | Returns a pandas Series with condition indices of the df columns.
Args:
df: pandas DataFrame with columns to run diagnostics on | [
"Returns",
"a",
"pandas",
"Series",
"with",
"condition",
"indices",
"of",
"the",
"df",
"columns",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/diagnostics/diagnostics.py#L37-L46 | train |
tyarkoni/pliers | pliers/diagnostics/diagnostics.py | mahalanobis_distances | def mahalanobis_distances(df, axis=0):
'''
Returns a pandas Series with Mahalanobis distances for each sample on the
axis.
Note: does not work well when # of observations < # of dimensions
Will either return NaN in answer
or (in the extreme case) fail with a Singular Matrix LinAlgError
Arg... | python | def mahalanobis_distances(df, axis=0):
'''
Returns a pandas Series with Mahalanobis distances for each sample on the
axis.
Note: does not work well when # of observations < # of dimensions
Will either return NaN in answer
or (in the extreme case) fail with a Singular Matrix LinAlgError
Arg... | [
"def",
"mahalanobis_distances",
"(",
"df",
",",
"axis",
"=",
"0",
")",
":",
"df",
"=",
"df",
".",
"transpose",
"(",
")",
"if",
"axis",
"==",
"1",
"else",
"df",
"means",
"=",
"df",
".",
"mean",
"(",
")",
"try",
":",
"inv_cov",
"=",
"np",
".",
"l... | Returns a pandas Series with Mahalanobis distances for each sample on the
axis.
Note: does not work well when # of observations < # of dimensions
Will either return NaN in answer
or (in the extreme case) fail with a Singular Matrix LinAlgError
Args:
df: pandas DataFrame with columns to run... | [
"Returns",
"a",
"pandas",
"Series",
"with",
"Mahalanobis",
"distances",
"for",
"each",
"sample",
"on",
"the",
"axis",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/diagnostics/diagnostics.py#L63-L87 | train |
tyarkoni/pliers | pliers/diagnostics/diagnostics.py | Diagnostics.summary | def summary(self, stdout=True, plot=False):
'''
Displays diagnostics to the user
Args:
stdout (bool): print results to the console
plot (bool): use Seaborn to plot results
'''
if stdout:
print('Collinearity summary:')
print(pd.conc... | python | def summary(self, stdout=True, plot=False):
'''
Displays diagnostics to the user
Args:
stdout (bool): print results to the console
plot (bool): use Seaborn to plot results
'''
if stdout:
print('Collinearity summary:')
print(pd.conc... | [
"def",
"summary",
"(",
"self",
",",
"stdout",
"=",
"True",
",",
"plot",
"=",
"False",
")",
":",
"if",
"stdout",
":",
"print",
"(",
"'Collinearity summary:'",
")",
"print",
"(",
"pd",
".",
"concat",
"(",
"[",
"self",
".",
"results",
"[",
"'Eigenvalues'"... | Displays diagnostics to the user
Args:
stdout (bool): print results to the console
plot (bool): use Seaborn to plot results | [
"Displays",
"diagnostics",
"to",
"the",
"user"
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/diagnostics/diagnostics.py#L128-L161 | train |
tyarkoni/pliers | pliers/graph.py | Graph.add_nodes | def add_nodes(self, nodes, parent=None, mode='horizontal'):
''' Adds one or more nodes to the current graph.
Args:
nodes (list): A list of nodes to add. Each element must be one of
the following:
* A dict containing keyword args to pass onto to the Node init... | python | def add_nodes(self, nodes, parent=None, mode='horizontal'):
''' Adds one or more nodes to the current graph.
Args:
nodes (list): A list of nodes to add. Each element must be one of
the following:
* A dict containing keyword args to pass onto to the Node init... | [
"def",
"add_nodes",
"(",
"self",
",",
"nodes",
",",
"parent",
"=",
"None",
",",
"mode",
"=",
"'horizontal'",
")",
":",
"for",
"n",
"in",
"nodes",
":",
"node_args",
"=",
"self",
".",
"_parse_node_args",
"(",
"n",
")",
"if",
"mode",
"==",
"'horizontal'",... | Adds one or more nodes to the current graph.
Args:
nodes (list): A list of nodes to add. Each element must be one of
the following:
* A dict containing keyword args to pass onto to the Node init.
* An iterable containing 1 - 3 elements. The first ele... | [
"Adds",
"one",
"or",
"more",
"nodes",
"to",
"the",
"current",
"graph",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/graph.py#L107-L144 | train |
tyarkoni/pliers | pliers/graph.py | Graph.add_node | def add_node(self, transformer, name=None, children=None, parent=None,
parameters={}, return_node=False):
''' Adds a node to the current graph.
Args:
transformer (str, Transformer): The pliers Transformer to use at
the to-be-added node. Either a case-insensi... | python | def add_node(self, transformer, name=None, children=None, parent=None,
parameters={}, return_node=False):
''' Adds a node to the current graph.
Args:
transformer (str, Transformer): The pliers Transformer to use at
the to-be-added node. Either a case-insensi... | [
"def",
"add_node",
"(",
"self",
",",
"transformer",
",",
"name",
"=",
"None",
",",
"children",
"=",
"None",
",",
"parent",
"=",
"None",
",",
"parameters",
"=",
"{",
"}",
",",
"return_node",
"=",
"False",
")",
":",
"node",
"=",
"Node",
"(",
"transform... | Adds a node to the current graph.
Args:
transformer (str, Transformer): The pliers Transformer to use at
the to-be-added node. Either a case-insensitive string giving
the name of a Transformer class, or an initialized Transformer
instance.
... | [
"Adds",
"a",
"node",
"to",
"the",
"current",
"graph",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/graph.py#L154-L192 | train |
tyarkoni/pliers | pliers/graph.py | Graph.run | def run(self, stim, merge=True, **merge_kwargs):
''' Executes the graph by calling all Transformers in sequence.
Args:
stim (str, Stim, list): One or more valid inputs to any
Transformer's 'transform' call.
merge (bool): If True, all results are merged into a sin... | python | def run(self, stim, merge=True, **merge_kwargs):
''' Executes the graph by calling all Transformers in sequence.
Args:
stim (str, Stim, list): One or more valid inputs to any
Transformer's 'transform' call.
merge (bool): If True, all results are merged into a sin... | [
"def",
"run",
"(",
"self",
",",
"stim",
",",
"merge",
"=",
"True",
",",
"**",
"merge_kwargs",
")",
":",
"results",
"=",
"list",
"(",
"chain",
"(",
"*",
"[",
"self",
".",
"run_node",
"(",
"n",
",",
"stim",
")",
"for",
"n",
"in",
"self",
".",
"ro... | Executes the graph by calling all Transformers in sequence.
Args:
stim (str, Stim, list): One or more valid inputs to any
Transformer's 'transform' call.
merge (bool): If True, all results are merged into a single pandas
DataFrame before being returned. I... | [
"Executes",
"the",
"graph",
"by",
"calling",
"all",
"Transformers",
"in",
"sequence",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/graph.py#L194-L210 | train |
tyarkoni/pliers | pliers/graph.py | Graph.run_node | def run_node(self, node, stim):
''' Executes the Transformer at a specific node.
Args:
node (str, Node): If a string, the name of the Node in the current
Graph. Otherwise the Node instance to execute.
stim (str, stim, list): Any valid input to the Transformer sto... | python | def run_node(self, node, stim):
''' Executes the Transformer at a specific node.
Args:
node (str, Node): If a string, the name of the Node in the current
Graph. Otherwise the Node instance to execute.
stim (str, stim, list): Any valid input to the Transformer sto... | [
"def",
"run_node",
"(",
"self",
",",
"node",
",",
"stim",
")",
":",
"if",
"isinstance",
"(",
"node",
",",
"string_types",
")",
":",
"node",
"=",
"self",
".",
"nodes",
"[",
"node",
"]",
"result",
"=",
"node",
".",
"transformer",
".",
"transform",
"(",... | Executes the Transformer at a specific node.
Args:
node (str, Node): If a string, the name of the Node in the current
Graph. Otherwise the Node instance to execute.
stim (str, stim, list): Any valid input to the Transformer stored
at the target node. | [
"Executes",
"the",
"Transformer",
"at",
"a",
"specific",
"node",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/graph.py#L214-L235 | train |
tyarkoni/pliers | pliers/graph.py | Graph.draw | def draw(self, filename, color=True):
''' Render a plot of the graph via pygraphviz.
Args:
filename (str): Path to save the generated image to.
color (bool): If True, will color graph nodes based on their type,
otherwise will draw a black-and-white graph.
... | python | def draw(self, filename, color=True):
''' Render a plot of the graph via pygraphviz.
Args:
filename (str): Path to save the generated image to.
color (bool): If True, will color graph nodes based on their type,
otherwise will draw a black-and-white graph.
... | [
"def",
"draw",
"(",
"self",
",",
"filename",
",",
"color",
"=",
"True",
")",
":",
"verify_dependencies",
"(",
"[",
"'pgv'",
"]",
")",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_results'",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Graph cannot be drawn b... | Render a plot of the graph via pygraphviz.
Args:
filename (str): Path to save the generated image to.
color (bool): If True, will color graph nodes based on their type,
otherwise will draw a black-and-white graph. | [
"Render",
"a",
"plot",
"of",
"the",
"graph",
"via",
"pygraphviz",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/graph.py#L237-L298 | train |
tyarkoni/pliers | pliers/graph.py | Graph.to_json | def to_json(self):
''' Returns the JSON representation of this graph. '''
roots = []
for r in self.roots:
roots.append(r.to_json())
return {'roots': roots} | python | def to_json(self):
''' Returns the JSON representation of this graph. '''
roots = []
for r in self.roots:
roots.append(r.to_json())
return {'roots': roots} | [
"def",
"to_json",
"(",
"self",
")",
":",
"roots",
"=",
"[",
"]",
"for",
"r",
"in",
"self",
".",
"roots",
":",
"roots",
".",
"append",
"(",
"r",
".",
"to_json",
"(",
")",
")",
"return",
"{",
"'roots'",
":",
"roots",
"}"
] | Returns the JSON representation of this graph. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"this",
"graph",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/graph.py#L300-L305 | train |
tyarkoni/pliers | pliers/utils/base.py | flatten | def flatten(l):
''' Flatten an iterable. '''
for el in l:
if isinstance(el, collections.Iterable) and not isinstance(el, string_types):
for sub in flatten(el):
yield sub
else:
yield el | python | def flatten(l):
''' Flatten an iterable. '''
for el in l:
if isinstance(el, collections.Iterable) and not isinstance(el, string_types):
for sub in flatten(el):
yield sub
else:
yield el | [
"def",
"flatten",
"(",
"l",
")",
":",
"for",
"el",
"in",
"l",
":",
"if",
"isinstance",
"(",
"el",
",",
"collections",
".",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"el",
",",
"string_types",
")",
":",
"for",
"sub",
"in",
"flatten",
"(",
"e... | Flatten an iterable. | [
"Flatten",
"an",
"iterable",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/utils/base.py#L20-L27 | train |
tyarkoni/pliers | pliers/utils/base.py | set_iterable_type | def set_iterable_type(obj):
''' Returns either a generator or a list depending on config-level
settings. Should be used to wrap almost every internal iterable return.
Also inspects elements recursively in the case of list returns, to
ensure that there are no nested generators. '''
if not isiterable(... | python | def set_iterable_type(obj):
''' Returns either a generator or a list depending on config-level
settings. Should be used to wrap almost every internal iterable return.
Also inspects elements recursively in the case of list returns, to
ensure that there are no nested generators. '''
if not isiterable(... | [
"def",
"set_iterable_type",
"(",
"obj",
")",
":",
"if",
"not",
"isiterable",
"(",
"obj",
")",
":",
"return",
"obj",
"if",
"config",
".",
"get_option",
"(",
"'use_generators'",
")",
":",
"return",
"obj",
"if",
"isgenerator",
"(",
"obj",
")",
"else",
"(",
... | Returns either a generator or a list depending on config-level
settings. Should be used to wrap almost every internal iterable return.
Also inspects elements recursively in the case of list returns, to
ensure that there are no nested generators. | [
"Returns",
"either",
"a",
"generator",
"or",
"a",
"list",
"depending",
"on",
"config",
"-",
"level",
"settings",
".",
"Should",
"be",
"used",
"to",
"wrap",
"almost",
"every",
"internal",
"iterable",
"return",
".",
"Also",
"inspects",
"elements",
"recursively",... | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/utils/base.py#L55-L66 | train |
tyarkoni/pliers | pliers/utils/base.py | isgenerator | def isgenerator(obj):
''' Returns True if object is a generator, or a generator wrapped by a
tqdm object. '''
return isinstance(obj, GeneratorType) or (hasattr(obj, 'iterable') and
isinstance(getattr(obj, 'iterable'), GeneratorType)) | python | def isgenerator(obj):
''' Returns True if object is a generator, or a generator wrapped by a
tqdm object. '''
return isinstance(obj, GeneratorType) or (hasattr(obj, 'iterable') and
isinstance(getattr(obj, 'iterable'), GeneratorType)) | [
"def",
"isgenerator",
"(",
"obj",
")",
":",
"return",
"isinstance",
"(",
"obj",
",",
"GeneratorType",
")",
"or",
"(",
"hasattr",
"(",
"obj",
",",
"'iterable'",
")",
"and",
"isinstance",
"(",
"getattr",
"(",
"obj",
",",
"'iterable'",
")",
",",
"GeneratorT... | Returns True if object is a generator, or a generator wrapped by a
tqdm object. | [
"Returns",
"True",
"if",
"object",
"is",
"a",
"generator",
"or",
"a",
"generator",
"wrapped",
"by",
"a",
"tqdm",
"object",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/utils/base.py#L85-L89 | train |
tyarkoni/pliers | pliers/utils/base.py | progress_bar_wrapper | def progress_bar_wrapper(iterable, **kwargs):
''' Wrapper that applies tqdm progress bar conditional on config settings.
'''
return tqdm(iterable, **kwargs) if (config.get_option('progress_bar')
and not isinstance(iterable, tqdm)) else iterable | python | def progress_bar_wrapper(iterable, **kwargs):
''' Wrapper that applies tqdm progress bar conditional on config settings.
'''
return tqdm(iterable, **kwargs) if (config.get_option('progress_bar')
and not isinstance(iterable, tqdm)) else iterable | [
"def",
"progress_bar_wrapper",
"(",
"iterable",
",",
"**",
"kwargs",
")",
":",
"return",
"tqdm",
"(",
"iterable",
",",
"**",
"kwargs",
")",
"if",
"(",
"config",
".",
"get_option",
"(",
"'progress_bar'",
")",
"and",
"not",
"isinstance",
"(",
"iterable",
","... | Wrapper that applies tqdm progress bar conditional on config settings. | [
"Wrapper",
"that",
"applies",
"tqdm",
"progress",
"bar",
"conditional",
"on",
"config",
"settings",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/utils/base.py#L92-L96 | train |
tyarkoni/pliers | pliers/stimuli/video.py | VideoFrameCollectionStim.get_frame | def get_frame(self, index):
''' Get video frame at the specified index.
Args:
index (int): Positional index of the desired frame.
'''
frame_num = self.frame_index[index]
onset = float(frame_num) / self.fps
if index < self.n_frames - 1:
next_fram... | python | def get_frame(self, index):
''' Get video frame at the specified index.
Args:
index (int): Positional index of the desired frame.
'''
frame_num = self.frame_index[index]
onset = float(frame_num) / self.fps
if index < self.n_frames - 1:
next_fram... | [
"def",
"get_frame",
"(",
"self",
",",
"index",
")",
":",
"frame_num",
"=",
"self",
".",
"frame_index",
"[",
"index",
"]",
"onset",
"=",
"float",
"(",
"frame_num",
")",
"/",
"self",
".",
"fps",
"if",
"index",
"<",
"self",
".",
"n_frames",
"-",
"1",
... | Get video frame at the specified index.
Args:
index (int): Positional index of the desired frame. | [
"Get",
"video",
"frame",
"at",
"the",
"specified",
"index",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/stimuli/video.py#L94-L114 | train |
tyarkoni/pliers | pliers/stimuli/video.py | VideoFrameCollectionStim.save | def save(self, path):
''' Save source video to file.
Args:
path (str): Filename to save to.
Notes: Saves entire source video to file, not just currently selected
frames.
'''
# IMPORTANT WARNING: saves entire source video
self.clip.write_videofile... | python | def save(self, path):
''' Save source video to file.
Args:
path (str): Filename to save to.
Notes: Saves entire source video to file, not just currently selected
frames.
'''
# IMPORTANT WARNING: saves entire source video
self.clip.write_videofile... | [
"def",
"save",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"clip",
".",
"write_videofile",
"(",
"path",
",",
"audio_fps",
"=",
"self",
".",
"clip",
".",
"audio",
".",
"fps",
")"
] | Save source video to file.
Args:
path (str): Filename to save to.
Notes: Saves entire source video to file, not just currently selected
frames. | [
"Save",
"source",
"video",
"to",
"file",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/stimuli/video.py#L125-L135 | train |
tyarkoni/pliers | pliers/stimuli/video.py | VideoStim.get_frame | def get_frame(self, index=None, onset=None):
''' Overrides the default behavior by giving access to the onset
argument.
Args:
index (int): Positional index of the desired frame.
onset (float): Onset (in seconds) of the desired frame.
'''
if onset:
... | python | def get_frame(self, index=None, onset=None):
''' Overrides the default behavior by giving access to the onset
argument.
Args:
index (int): Positional index of the desired frame.
onset (float): Onset (in seconds) of the desired frame.
'''
if onset:
... | [
"def",
"get_frame",
"(",
"self",
",",
"index",
"=",
"None",
",",
"onset",
"=",
"None",
")",
":",
"if",
"onset",
":",
"index",
"=",
"int",
"(",
"onset",
"*",
"self",
".",
"fps",
")",
"return",
"super",
"(",
"VideoStim",
",",
"self",
")",
".",
"get... | Overrides the default behavior by giving access to the onset
argument.
Args:
index (int): Positional index of the desired frame.
onset (float): Onset (in seconds) of the desired frame. | [
"Overrides",
"the",
"default",
"behavior",
"by",
"giving",
"access",
"to",
"the",
"onset",
"argument",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/stimuli/video.py#L159-L170 | train |
tyarkoni/pliers | pliers/utils/updater.py | hash_data | def hash_data(data, blocksize=65536):
"""" Hashes list of data, strings or data """
data = pickle.dumps(data)
hasher = hashlib.sha1()
hasher.update(data)
return hasher.hexdigest() | python | def hash_data(data, blocksize=65536):
"""" Hashes list of data, strings or data """
data = pickle.dumps(data)
hasher = hashlib.sha1()
hasher.update(data)
return hasher.hexdigest() | [
"def",
"hash_data",
"(",
"data",
",",
"blocksize",
"=",
"65536",
")",
":",
"data",
"=",
"pickle",
".",
"dumps",
"(",
"data",
")",
"hasher",
"=",
"hashlib",
".",
"sha1",
"(",
")",
"hasher",
".",
"update",
"(",
"data",
")",
"return",
"hasher",
".",
"... | Hashes list of data, strings or data | [
"Hashes",
"list",
"of",
"data",
"strings",
"or",
"data"
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/utils/updater.py#L13-L20 | train |
tyarkoni/pliers | pliers/utils/updater.py | check_updates | def check_updates(transformers, datastore=None, stimuli=None):
""" Run transformers through a battery of stimuli, and check if output has
changed. Store results in csv file for comparison.
Args:
transformers (list): A list of tuples of transformer names and
dictionary of parameters to i... | python | def check_updates(transformers, datastore=None, stimuli=None):
""" Run transformers through a battery of stimuli, and check if output has
changed. Store results in csv file for comparison.
Args:
transformers (list): A list of tuples of transformer names and
dictionary of parameters to i... | [
"def",
"check_updates",
"(",
"transformers",
",",
"datastore",
"=",
"None",
",",
"stimuli",
"=",
"None",
")",
":",
"datastore",
"=",
"datastore",
"or",
"expanduser",
"(",
"'~/.pliers_updates'",
")",
"prior_data",
"=",
"pd",
".",
"read_csv",
"(",
"datastore",
... | Run transformers through a battery of stimuli, and check if output has
changed. Store results in csv file for comparison.
Args:
transformers (list): A list of tuples of transformer names and
dictionary of parameters to instantiate with (or empty dict).
datastore (str): Filepath of C... | [
"Run",
"transformers",
"through",
"a",
"battery",
"of",
"stimuli",
"and",
"check",
"if",
"output",
"has",
"changed",
".",
"Store",
"results",
"in",
"csv",
"file",
"for",
"comparison",
"."
] | 5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b | https://github.com/tyarkoni/pliers/blob/5b3385960ebd8c6ef1e86dd5e1be0080b2cb7f2b/pliers/utils/updater.py#L23-L95 | train |
open-homeautomation/miflora | demo.py | scan | def scan(args):
"""Scan for sensors."""
backend = _get_backend(args)
print('Scanning for 10 seconds...')
devices = miflora_scanner.scan(backend, 10)
print('Found {} devices:'.format(len(devices)))
for device in devices:
print(' {}'.format(device)) | python | def scan(args):
"""Scan for sensors."""
backend = _get_backend(args)
print('Scanning for 10 seconds...')
devices = miflora_scanner.scan(backend, 10)
print('Found {} devices:'.format(len(devices)))
for device in devices:
print(' {}'.format(device)) | [
"def",
"scan",
"(",
"args",
")",
":",
"backend",
"=",
"_get_backend",
"(",
"args",
")",
"print",
"(",
"'Scanning for 10 seconds...'",
")",
"devices",
"=",
"miflora_scanner",
".",
"scan",
"(",
"backend",
",",
"10",
")",
"print",
"(",
"'Found {} devices:'",
".... | Scan for sensors. | [
"Scan",
"for",
"sensors",
"."
] | 916606e7edc70bdc017dfbe681bc81771e0df7f3 | https://github.com/open-homeautomation/miflora/blob/916606e7edc70bdc017dfbe681bc81771e0df7f3/demo.py#L37-L44 | train |
open-homeautomation/miflora | demo.py | _get_backend | def _get_backend(args):
"""Extract the backend class from the command line arguments."""
if args.backend == 'gatttool':
backend = GatttoolBackend
elif args.backend == 'bluepy':
backend = BluepyBackend
elif args.backend == 'pygatt':
backend = PygattBackend
else:
raise ... | python | def _get_backend(args):
"""Extract the backend class from the command line arguments."""
if args.backend == 'gatttool':
backend = GatttoolBackend
elif args.backend == 'bluepy':
backend = BluepyBackend
elif args.backend == 'pygatt':
backend = PygattBackend
else:
raise ... | [
"def",
"_get_backend",
"(",
"args",
")",
":",
"if",
"args",
".",
"backend",
"==",
"'gatttool'",
":",
"backend",
"=",
"GatttoolBackend",
"elif",
"args",
".",
"backend",
"==",
"'bluepy'",
":",
"backend",
"=",
"BluepyBackend",
"elif",
"args",
".",
"backend",
... | Extract the backend class from the command line arguments. | [
"Extract",
"the",
"backend",
"class",
"from",
"the",
"command",
"line",
"arguments",
"."
] | 916606e7edc70bdc017dfbe681bc81771e0df7f3 | https://github.com/open-homeautomation/miflora/blob/916606e7edc70bdc017dfbe681bc81771e0df7f3/demo.py#L47-L57 | train |
open-homeautomation/miflora | demo.py | list_backends | def list_backends(_):
"""List all available backends."""
backends = [b.__name__ for b in available_backends()]
print('\n'.join(backends)) | python | def list_backends(_):
"""List all available backends."""
backends = [b.__name__ for b in available_backends()]
print('\n'.join(backends)) | [
"def",
"list_backends",
"(",
"_",
")",
":",
"backends",
"=",
"[",
"b",
".",
"__name__",
"for",
"b",
"in",
"available_backends",
"(",
")",
"]",
"print",
"(",
"'\\n'",
".",
"join",
"(",
"backends",
")",
")"
] | List all available backends. | [
"List",
"all",
"available",
"backends",
"."
] | 916606e7edc70bdc017dfbe681bc81771e0df7f3 | https://github.com/open-homeautomation/miflora/blob/916606e7edc70bdc017dfbe681bc81771e0df7f3/demo.py#L60-L63 | train |
open-homeautomation/miflora | miflora/miflora_scanner.py | scan | def scan(backend, timeout=10):
"""Scan for miflora devices.
Note: this must be run as root!
"""
result = []
for (mac, name) in backend.scan_for_devices(timeout):
if (name is not None and name.lower() in VALID_DEVICE_NAMES) or \
mac is not None and mac.upper().startswith(DEVI... | python | def scan(backend, timeout=10):
"""Scan for miflora devices.
Note: this must be run as root!
"""
result = []
for (mac, name) in backend.scan_for_devices(timeout):
if (name is not None and name.lower() in VALID_DEVICE_NAMES) or \
mac is not None and mac.upper().startswith(DEVI... | [
"def",
"scan",
"(",
"backend",
",",
"timeout",
"=",
"10",
")",
":",
"result",
"=",
"[",
"]",
"for",
"(",
"mac",
",",
"name",
")",
"in",
"backend",
".",
"scan_for_devices",
"(",
"timeout",
")",
":",
"if",
"(",
"name",
"is",
"not",
"None",
"and",
"... | Scan for miflora devices.
Note: this must be run as root! | [
"Scan",
"for",
"miflora",
"devices",
"."
] | 916606e7edc70bdc017dfbe681bc81771e0df7f3 | https://github.com/open-homeautomation/miflora/blob/916606e7edc70bdc017dfbe681bc81771e0df7f3/miflora/miflora_scanner.py#L10-L20 | train |
open-homeautomation/miflora | miflora/miflora_poller.py | MiFloraPoller.parameter_value | def parameter_value(self, parameter, read_cached=True):
"""Return a value of one of the monitored paramaters.
This method will try to retrieve the data from cache and only
request it by bluetooth if no cached value is stored or the cache is
expired.
This behaviour can be overwri... | python | def parameter_value(self, parameter, read_cached=True):
"""Return a value of one of the monitored paramaters.
This method will try to retrieve the data from cache and only
request it by bluetooth if no cached value is stored or the cache is
expired.
This behaviour can be overwri... | [
"def",
"parameter_value",
"(",
"self",
",",
"parameter",
",",
"read_cached",
"=",
"True",
")",
":",
"if",
"parameter",
"==",
"MI_BATTERY",
":",
"return",
"self",
".",
"battery_level",
"(",
")",
"with",
"self",
".",
"lock",
":",
"if",
"(",
"read_cached",
... | Return a value of one of the monitored paramaters.
This method will try to retrieve the data from cache and only
request it by bluetooth if no cached value is stored or the cache is
expired.
This behaviour can be overwritten by the "read_cached" parameter. | [
"Return",
"a",
"value",
"of",
"one",
"of",
"the",
"monitored",
"paramaters",
"."
] | 916606e7edc70bdc017dfbe681bc81771e0df7f3 | https://github.com/open-homeautomation/miflora/blob/916606e7edc70bdc017dfbe681bc81771e0df7f3/miflora/miflora_poller.py#L115-L141 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | parse_version_string | def parse_version_string(version_string):
"""Parses a semver version string, stripping off "rc" stuff if present."""
string_parts = version_string.split(".")
version_parts = [
int(re.match("([0-9]*)", string_parts[0]).group(0)),
int(re.match("([0-9]*)", string_parts[1]).group(0)),
i... | python | def parse_version_string(version_string):
"""Parses a semver version string, stripping off "rc" stuff if present."""
string_parts = version_string.split(".")
version_parts = [
int(re.match("([0-9]*)", string_parts[0]).group(0)),
int(re.match("([0-9]*)", string_parts[1]).group(0)),
i... | [
"def",
"parse_version_string",
"(",
"version_string",
")",
":",
"string_parts",
"=",
"version_string",
".",
"split",
"(",
"\".\"",
")",
"version_parts",
"=",
"[",
"int",
"(",
"re",
".",
"match",
"(",
"\"([0-9]*)\"",
",",
"string_parts",
"[",
"0",
"]",
")",
... | Parses a semver version string, stripping off "rc" stuff if present. | [
"Parses",
"a",
"semver",
"version",
"string",
"stripping",
"off",
"rc",
"stuff",
"if",
"present",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L42-L50 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | bigger_version | def bigger_version(version_string_a, version_string_b):
"""Returns the bigger version of two version strings."""
major_a, minor_a, patch_a = parse_version_string(version_string_a)
major_b, minor_b, patch_b = parse_version_string(version_string_b)
if major_a > major_b:
return version_string_a
... | python | def bigger_version(version_string_a, version_string_b):
"""Returns the bigger version of two version strings."""
major_a, minor_a, patch_a = parse_version_string(version_string_a)
major_b, minor_b, patch_b = parse_version_string(version_string_b)
if major_a > major_b:
return version_string_a
... | [
"def",
"bigger_version",
"(",
"version_string_a",
",",
"version_string_b",
")",
":",
"major_a",
",",
"minor_a",
",",
"patch_a",
"=",
"parse_version_string",
"(",
"version_string_a",
")",
"major_b",
",",
"minor_b",
",",
"patch_b",
"=",
"parse_version_string",
"(",
... | Returns the bigger version of two version strings. | [
"Returns",
"the",
"bigger",
"version",
"of",
"two",
"version",
"strings",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L52-L63 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | api_version | def api_version(created_ver, last_changed_ver, return_value_ver):
"""Version check decorator. Currently only checks Bigger Than."""
def api_min_version_decorator(function):
def wrapper(function, self, *args, **kwargs):
if not self.version_check_mode == "none":
if self.v... | python | def api_version(created_ver, last_changed_ver, return_value_ver):
"""Version check decorator. Currently only checks Bigger Than."""
def api_min_version_decorator(function):
def wrapper(function, self, *args, **kwargs):
if not self.version_check_mode == "none":
if self.v... | [
"def",
"api_version",
"(",
"created_ver",
",",
"last_changed_ver",
",",
"return_value_ver",
")",
":",
"def",
"api_min_version_decorator",
"(",
"function",
")",
":",
"def",
"wrapper",
"(",
"function",
",",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
"... | Version check decorator. Currently only checks Bigger Than. | [
"Version",
"check",
"decorator",
".",
"Currently",
"only",
"checks",
"Bigger",
"Than",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L65-L85 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.verify_minimum_version | def verify_minimum_version(self, version_str):
"""
Update version info from server and verify that at least the specified version is present.
Returns True if version requirement is satisfied, False if not.
"""
self.retrieve_mastodon_version()
major, minor, patch ... | python | def verify_minimum_version(self, version_str):
"""
Update version info from server and verify that at least the specified version is present.
Returns True if version requirement is satisfied, False if not.
"""
self.retrieve_mastodon_version()
major, minor, patch ... | [
"def",
"verify_minimum_version",
"(",
"self",
",",
"version_str",
")",
":",
"self",
".",
"retrieve_mastodon_version",
"(",
")",
"major",
",",
"minor",
",",
"patch",
"=",
"parse_version_string",
"(",
"version_str",
")",
"if",
"major",
">",
"self",
".",
"mastodo... | Update version info from server and verify that at least the specified version is present.
Returns True if version requirement is satisfied, False if not. | [
"Update",
"version",
"info",
"from",
"server",
"and",
"verify",
"that",
"at",
"least",
"the",
"specified",
"version",
"is",
"present",
".",
"Returns",
"True",
"if",
"version",
"requirement",
"is",
"satisfied",
"False",
"if",
"not",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L359-L373 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.log_in | def log_in(self, username=None, password=None,
code=None, redirect_uri="urn:ietf:wg:oauth:2.0:oob", refresh_token=None,
scopes=__DEFAULT_SCOPES, to_file=None):
"""
Get the access token for a user.
The username is the e-mail used to log in into mastodon.
... | python | def log_in(self, username=None, password=None,
code=None, redirect_uri="urn:ietf:wg:oauth:2.0:oob", refresh_token=None,
scopes=__DEFAULT_SCOPES, to_file=None):
"""
Get the access token for a user.
The username is the e-mail used to log in into mastodon.
... | [
"def",
"log_in",
"(",
"self",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"code",
"=",
"None",
",",
"redirect_uri",
"=",
"\"urn:ietf:wg:oauth:2.0:oob\"",
",",
"refresh_token",
"=",
"None",
",",
"scopes",
"=",
"__DEFAULT_SCOPES",
",",
"to... | Get the access token for a user.
The username is the e-mail used to log in into mastodon.
Can persist access token to file `to_file`, to be used in the constructor.
Handles password and OAuth-based authorization.
Will throw a `MastodonIllegalArgumentError` if the OAut... | [
"Get",
"the",
"access",
"token",
"for",
"a",
"user",
".",
"The",
"username",
"is",
"the",
"e",
"-",
"mail",
"used",
"to",
"log",
"in",
"into",
"mastodon",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L414-L481 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.timeline_list | def timeline_list(self, id, max_id=None, min_id=None, since_id=None, limit=None):
"""
Fetches a timeline containing all the toots by users in a given list.
Returns a list of `toot dicts`_.
"""
id = self.__unpack_id(id)
return self.timeline('list/{0}'.format(id), max_id=m... | python | def timeline_list(self, id, max_id=None, min_id=None, since_id=None, limit=None):
"""
Fetches a timeline containing all the toots by users in a given list.
Returns a list of `toot dicts`_.
"""
id = self.__unpack_id(id)
return self.timeline('list/{0}'.format(id), max_id=m... | [
"def",
"timeline_list",
"(",
"self",
",",
"id",
",",
"max_id",
"=",
"None",
",",
"min_id",
"=",
"None",
",",
"since_id",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"return",
"self",
".",... | Fetches a timeline containing all the toots by users in a given list.
Returns a list of `toot dicts`_. | [
"Fetches",
"a",
"timeline",
"containing",
"all",
"the",
"toots",
"by",
"users",
"in",
"a",
"given",
"list",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L709-L717 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.conversations | def conversations(self, max_id=None, min_id=None, since_id=None, limit=None):
"""
Fetches a users conversations.
Returns a list of `conversation dicts`_.
"""
if max_id != None:
max_id = self.__unpack_id(max_id)
if min_id != None:
... | python | def conversations(self, max_id=None, min_id=None, since_id=None, limit=None):
"""
Fetches a users conversations.
Returns a list of `conversation dicts`_.
"""
if max_id != None:
max_id = self.__unpack_id(max_id)
if min_id != None:
... | [
"def",
"conversations",
"(",
"self",
",",
"max_id",
"=",
"None",
",",
"min_id",
"=",
"None",
",",
"since_id",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"if",
"max_id",
"!=",
"None",
":",
"max_id",
"=",
"self",
".",
"__unpack_id",
"(",
"max_id... | Fetches a users conversations.
Returns a list of `conversation dicts`_. | [
"Fetches",
"a",
"users",
"conversations",
".",
"Returns",
"a",
"list",
"of",
"conversation",
"dicts",
"_",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L720-L736 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status | def status(self, id):
"""
Fetch information about a single toot.
Does not require authentication for publicly visible statuses.
Returns a `toot dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}'.format(str(id))
return self.__api_request('... | python | def status(self, id):
"""
Fetch information about a single toot.
Does not require authentication for publicly visible statuses.
Returns a `toot dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}'.format(str(id))
return self.__api_request('... | [
"def",
"status",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'GET'",
",",... | Fetch information about a single toot.
Does not require authentication for publicly visible statuses.
Returns a `toot dict`_. | [
"Fetch",
"information",
"about",
"a",
"single",
"toot",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L742-L752 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_context | def status_context(self, id):
"""
Fetch information about ancestors and descendants of a toot.
Does not require authentication for publicly visible statuses.
Returns a `context dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/context'.format(str... | python | def status_context(self, id):
"""
Fetch information about ancestors and descendants of a toot.
Does not require authentication for publicly visible statuses.
Returns a `context dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/context'.format(str... | [
"def",
"status_context",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/context'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
... | Fetch information about ancestors and descendants of a toot.
Does not require authentication for publicly visible statuses.
Returns a `context dict`_. | [
"Fetch",
"information",
"about",
"ancestors",
"and",
"descendants",
"of",
"a",
"toot",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L769-L779 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_reblogged_by | def status_reblogged_by(self, id):
"""
Fetch a list of users that have reblogged a status.
Does not require authentication for publicly visible statuses.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/reblogged_by'.for... | python | def status_reblogged_by(self, id):
"""
Fetch a list of users that have reblogged a status.
Does not require authentication for publicly visible statuses.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/reblogged_by'.for... | [
"def",
"status_reblogged_by",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/reblogged_by'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request"... | Fetch a list of users that have reblogged a status.
Does not require authentication for publicly visible statuses.
Returns a list of `user dicts`_. | [
"Fetch",
"a",
"list",
"of",
"users",
"that",
"have",
"reblogged",
"a",
"status",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L782-L792 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.status_favourited_by | def status_favourited_by(self, id):
"""
Fetch a list of users that have favourited a status.
Does not require authentication for publicly visible statuses.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/favourited_by'.... | python | def status_favourited_by(self, id):
"""
Fetch a list of users that have favourited a status.
Does not require authentication for publicly visible statuses.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/statuses/{0}/favourited_by'.... | [
"def",
"status_favourited_by",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/statuses/{0}/favourited_by'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_reques... | Fetch a list of users that have favourited a status.
Does not require authentication for publicly visible statuses.
Returns a list of `user dicts`_. | [
"Fetch",
"a",
"list",
"of",
"users",
"that",
"have",
"favourited",
"a",
"status",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L795-L805 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.scheduled_status | def scheduled_status(self, id):
"""
Fetch information about the scheduled status with the given id.
Returns a `scheduled toot dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/scheduled_statuses/{0}'.format(str(id))
return self.__api_request('GET', url) | python | def scheduled_status(self, id):
"""
Fetch information about the scheduled status with the given id.
Returns a `scheduled toot dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/scheduled_statuses/{0}'.format(str(id))
return self.__api_request('GET', url) | [
"def",
"scheduled_status",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/scheduled_statuses/{0}'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(... | Fetch information about the scheduled status with the given id.
Returns a `scheduled toot dict`_. | [
"Fetch",
"information",
"about",
"the",
"scheduled",
"status",
"with",
"the",
"given",
"id",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L820-L828 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.poll | def poll(self, id):
"""
Fetch information about the poll with the given id
Returns a `poll dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/polls/{0}'.format(str(id))
return self.__api_request('GET', url) | python | def poll(self, id):
"""
Fetch information about the poll with the given id
Returns a `poll dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/polls/{0}'.format(str(id))
return self.__api_request('GET', url) | [
"def",
"poll",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/polls/{0}'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'GET'",
",",
"u... | Fetch information about the poll with the given id
Returns a `poll dict`_. | [
"Fetch",
"information",
"about",
"the",
"poll",
"with",
"the",
"given",
"id"
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L834-L842 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account | def account(self, id):
"""
Fetch account information by user `id`.
Does not require authentication.
Returns a `user dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}'.format(str(id))
return self.__api_request('GET', url) | python | def account(self, id):
"""
Fetch account information by user `id`.
Does not require authentication.
Returns a `user dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/accounts/{0}'.format(str(id))
return self.__api_request('GET', url) | [
"def",
"account",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/accounts/{0}'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'GET'",
","... | Fetch account information by user `id`.
Does not require authentication.
Returns a `user dict`_. | [
"Fetch",
"account",
"information",
"by",
"user",
"id",
".",
"Does",
"not",
"require",
"authentication",
".",
"Returns",
"a",
"user",
"dict",
"_",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L878-L888 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_following | def account_following(self, id, max_id=None, min_id=None, since_id=None, limit=None):
"""
Fetch users the given user is following.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(id)
if max_id != None:
max_id = self.__unpack_id(max_id)
... | python | def account_following(self, id, max_id=None, min_id=None, since_id=None, limit=None):
"""
Fetch users the given user is following.
Returns a list of `user dicts`_.
"""
id = self.__unpack_id(id)
if max_id != None:
max_id = self.__unpack_id(max_id)
... | [
"def",
"account_following",
"(",
"self",
",",
"id",
",",
"max_id",
"=",
"None",
",",
"min_id",
"=",
"None",
",",
"since_id",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"if",
"max_id",
"!... | Fetch users the given user is following.
Returns a list of `user dicts`_. | [
"Fetch",
"users",
"the",
"given",
"user",
"is",
"following",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L938-L956 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.account_lists | def account_lists(self, id):
"""
Get all of the logged-in users lists which the specified user is
a member of.
Returns a list of `list dicts`_.
"""
id = self.__unpack_id(id)
params = self.__generate_params(locals(), ['id'])
url = '/api/v1/accounts... | python | def account_lists(self, id):
"""
Get all of the logged-in users lists which the specified user is
a member of.
Returns a list of `list dicts`_.
"""
id = self.__unpack_id(id)
params = self.__generate_params(locals(), ['id'])
url = '/api/v1/accounts... | [
"def",
"account_lists",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"params",
"=",
"self",
".",
"__generate_params",
"(",
"locals",
"(",
")",
",",
"[",
"'id'",
"]",
")",
"url",
"=",
"'/api/v1/accounts/{0}/li... | Get all of the logged-in users lists which the specified user is
a member of.
Returns a list of `list dicts`_. | [
"Get",
"all",
"of",
"the",
"logged",
"-",
"in",
"users",
"lists",
"which",
"the",
"specified",
"user",
"is",
"a",
"member",
"of",
".",
"Returns",
"a",
"list",
"of",
"list",
"dicts",
"_",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1009-L1019 | train |
halcy/Mastodon.py | mastodon/Mastodon.py | Mastodon.filter | def filter(self, id):
"""
Fetches information about the filter with the specified `id`.
Returns a `filter dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/filters/{0}'.format(str(id))
return self.__api_request('GET', url) | python | def filter(self, id):
"""
Fetches information about the filter with the specified `id`.
Returns a `filter dict`_.
"""
id = self.__unpack_id(id)
url = '/api/v1/filters/{0}'.format(str(id))
return self.__api_request('GET', url) | [
"def",
"filter",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"__unpack_id",
"(",
"id",
")",
"url",
"=",
"'/api/v1/filters/{0}'",
".",
"format",
"(",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"__api_request",
"(",
"'GET'",
",",
... | Fetches information about the filter with the specified `id`.
Returns a `filter dict`_. | [
"Fetches",
"information",
"about",
"the",
"filter",
"with",
"the",
"specified",
"id",
".",
"Returns",
"a",
"filter",
"dict",
"_",
"."
] | 35c43562dd3d34d6ebf7a0f757c09e8fcccc957c | https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1034-L1042 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.