repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
crackinglandia/pype32 | pype32/pype32.py | PE.getWordAtOffset | def getWordAtOffset(self, offset):
"""
Returns a C{WORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{WORD} from.
@rtype: L{WORD}
@return: The L{WORD} obtained at the given offset.
"""
return datatypes.WO... | python | def getWordAtOffset(self, offset):
"""
Returns a C{WORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{WORD} from.
@rtype: L{WORD}
@return: The L{WORD} obtained at the given offset.
"""
return datatypes.WO... | [
"def",
"getWordAtOffset",
"(",
"self",
",",
"offset",
")",
":",
"return",
"datatypes",
".",
"WORD",
".",
"parse",
"(",
"utils",
".",
"ReadData",
"(",
"self",
".",
"getDataAtOffset",
"(",
"offset",
",",
"2",
")",
")",
")"
] | Returns a C{WORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{WORD} from.
@rtype: L{WORD}
@return: The L{WORD} obtained at the given offset. | [
"Returns",
"a",
"C",
"{",
"WORD",
"}",
"from",
"a",
"given",
"offset",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L715-L725 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getQwordAtRva | def getQwordAtRva(self, rva):
"""
Returns a C{QWORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{QWORD} from.
@rtype: L{QWORD}
@return: The L{QWORD} obtained at the given RVA.
"""
return datatypes.QWORD.parse(utils.... | python | def getQwordAtRva(self, rva):
"""
Returns a C{QWORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{QWORD} from.
@rtype: L{QWORD}
@return: The L{QWORD} obtained at the given RVA.
"""
return datatypes.QWORD.parse(utils.... | [
"def",
"getQwordAtRva",
"(",
"self",
",",
"rva",
")",
":",
"return",
"datatypes",
".",
"QWORD",
".",
"parse",
"(",
"utils",
".",
"ReadData",
"(",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"8",
")",
")",
")"
] | Returns a C{QWORD} from a given RVA.
@type rva: int
@param rva: The RVA to get the C{QWORD} from.
@rtype: L{QWORD}
@return: The L{QWORD} obtained at the given RVA. | [
"Returns",
"a",
"C",
"{",
"QWORD",
"}",
"from",
"a",
"given",
"RVA",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L727-L737 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getQwordAtOffset | def getQwordAtOffset(self, offset):
"""
Returns a C{QWORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{QWORD} from.
@rtype: L{QWORD}
@return: The L{QWORD} obtained at the given offset.
"""
return datatyp... | python | def getQwordAtOffset(self, offset):
"""
Returns a C{QWORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{QWORD} from.
@rtype: L{QWORD}
@return: The L{QWORD} obtained at the given offset.
"""
return datatyp... | [
"def",
"getQwordAtOffset",
"(",
"self",
",",
"offset",
")",
":",
"return",
"datatypes",
".",
"QWORD",
".",
"parse",
"(",
"utils",
".",
"ReadData",
"(",
"self",
".",
"getDataAtOffset",
"(",
"offset",
",",
"8",
")",
")",
")"
] | Returns a C{QWORD} from a given offset.
@type offset: int
@param offset: The offset to get the C{QWORD} from.
@rtype: L{QWORD}
@return: The L{QWORD} obtained at the given offset. | [
"Returns",
"a",
"C",
"{",
"QWORD",
"}",
"from",
"a",
"given",
"offset",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L739-L749 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getDataAtRva | def getDataAtRva(self, rva, size):
"""
Gets binary data at a given RVA.
@type rva: int
@param rva: The RVA to get the data from.
@type size: int
@param size: The size of the data to be obtained.
@rtype: str
@return: The data obt... | python | def getDataAtRva(self, rva, size):
"""
Gets binary data at a given RVA.
@type rva: int
@param rva: The RVA to get the data from.
@type size: int
@param size: The size of the data to be obtained.
@rtype: str
@return: The data obt... | [
"def",
"getDataAtRva",
"(",
"self",
",",
"rva",
",",
"size",
")",
":",
"return",
"self",
".",
"getDataAtOffset",
"(",
"self",
".",
"getOffsetFromRva",
"(",
"rva",
")",
",",
"size",
")"
] | Gets binary data at a given RVA.
@type rva: int
@param rva: The RVA to get the data from.
@type size: int
@param size: The size of the data to be obtained.
@rtype: str
@return: The data obtained at the given RVA. | [
"Gets",
"binary",
"data",
"at",
"a",
"given",
"RVA",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L751-L764 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.getDataAtOffset | def getDataAtOffset(self, offset, size):
"""
Gets binary data at a given offset.
@type offset: int
@param offset: The offset to get the data from.
@type size: int
@param size: The size of the data to be obtained.
@rtype: str
@ret... | python | def getDataAtOffset(self, offset, size):
"""
Gets binary data at a given offset.
@type offset: int
@param offset: The offset to get the data from.
@type size: int
@param size: The size of the data to be obtained.
@rtype: str
@ret... | [
"def",
"getDataAtOffset",
"(",
"self",
",",
"offset",
",",
"size",
")",
":",
"data",
"=",
"str",
"(",
"self",
")",
"return",
"data",
"[",
"offset",
":",
"offset",
"+",
"size",
"]"
] | Gets binary data at a given offset.
@type offset: int
@param offset: The offset to get the data from.
@type size: int
@param size: The size of the data to be obtained.
@rtype: str
@return: The data obtained at the given offset. | [
"Gets",
"binary",
"data",
"at",
"a",
"given",
"offset",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L766-L780 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.readStringAtRva | def readStringAtRva(self, rva):
"""
Returns a L{String} object from a given RVA.
@type rva: int
@param rva: The RVA to get the string from.
@rtype: L{String}
@return: A new L{String} object from the given RVA.
"""
d = self.getDataAtRva(r... | python | def readStringAtRva(self, rva):
"""
Returns a L{String} object from a given RVA.
@type rva: int
@param rva: The RVA to get the string from.
@rtype: L{String}
@return: A new L{String} object from the given RVA.
"""
d = self.getDataAtRva(r... | [
"def",
"readStringAtRva",
"(",
"self",
",",
"rva",
")",
":",
"d",
"=",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"1",
")",
"resultStr",
"=",
"datatypes",
".",
"String",
"(",
"\"\"",
")",
"while",
"d",
"!=",
"\"\\x00\"",
":",
"resultStr",
".",
"va... | Returns a L{String} object from a given RVA.
@type rva: int
@param rva: The RVA to get the string from.
@rtype: L{String}
@return: A new L{String} object from the given RVA. | [
"Returns",
"a",
"L",
"{",
"String",
"}",
"object",
"from",
"a",
"given",
"RVA",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L782-L798 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isExe | def isExe(self):
"""
Determines if the current L{PE} instance is an Executable file.
@rtype: bool
@return: C{True} if the current L{PE} instance is an Executable file. Otherwise, returns C{False}.
"""
if not self.isDll() and not self.isDriver() and ( consts.IMAGE... | python | def isExe(self):
"""
Determines if the current L{PE} instance is an Executable file.
@rtype: bool
@return: C{True} if the current L{PE} instance is an Executable file. Otherwise, returns C{False}.
"""
if not self.isDll() and not self.isDriver() and ( consts.IMAGE... | [
"def",
"isExe",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"isDll",
"(",
")",
"and",
"not",
"self",
".",
"isDriver",
"(",
")",
"and",
"(",
"consts",
".",
"IMAGE_FILE_EXECUTABLE_IMAGE",
"&",
"self",
".",
"ntHeaders",
".",
"fileHeader",
".",
"chara... | Determines if the current L{PE} instance is an Executable file.
@rtype: bool
@return: C{True} if the current L{PE} instance is an Executable file. Otherwise, returns C{False}. | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"is",
"an",
"Executable",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L800-L809 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isDll | def isDll(self):
"""
Determines if the current L{PE} instance is a Dynamic Link Library file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a DLL. Otherwise, returns C{False}.
"""
if (consts.IMAGE_FILE_DLL & self.ntHeaders.fileHeader.characterist... | python | def isDll(self):
"""
Determines if the current L{PE} instance is a Dynamic Link Library file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a DLL. Otherwise, returns C{False}.
"""
if (consts.IMAGE_FILE_DLL & self.ntHeaders.fileHeader.characterist... | [
"def",
"isDll",
"(",
"self",
")",
":",
"if",
"(",
"consts",
".",
"IMAGE_FILE_DLL",
"&",
"self",
".",
"ntHeaders",
".",
"fileHeader",
".",
"characteristics",
".",
"value",
")",
"==",
"consts",
".",
"IMAGE_FILE_DLL",
":",
"return",
"True",
"return",
"False"
... | Determines if the current L{PE} instance is a Dynamic Link Library file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a DLL. Otherwise, returns C{False}. | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"is",
"a",
"Dynamic",
"Link",
"Library",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L811-L820 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isDriver | def isDriver(self):
"""
Determines if the current L{PE} instance is a driver (.sys) file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a driver. Otherwise, returns C{False}.
"""
modules = []
imports = self.ntHeaders.optionalHeader.dataDi... | python | def isDriver(self):
"""
Determines if the current L{PE} instance is a driver (.sys) file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a driver. Otherwise, returns C{False}.
"""
modules = []
imports = self.ntHeaders.optionalHeader.dataDi... | [
"def",
"isDriver",
"(",
"self",
")",
":",
"modules",
"=",
"[",
"]",
"imports",
"=",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"dataDirectory",
"[",
"consts",
".",
"IMPORT_DIRECTORY",
"]",
".",
"info",
"for",
"module",
"in",
"imports",
":",
"m... | Determines if the current L{PE} instance is a driver (.sys) file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a driver. Otherwise, returns C{False}. | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"is",
"a",
"driver",
"(",
".",
"sys",
")",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L822-L836 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isPe32 | def isPe32(self):
"""
Determines if the current L{PE} instance is a PE32 file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a PE32 file. Otherwise, returns C{False}.
"""
if self.ntHeaders.optionalHeader.magic.value == consts.PE32:
re... | python | def isPe32(self):
"""
Determines if the current L{PE} instance is a PE32 file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a PE32 file. Otherwise, returns C{False}.
"""
if self.ntHeaders.optionalHeader.magic.value == consts.PE32:
re... | [
"def",
"isPe32",
"(",
"self",
")",
":",
"if",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"magic",
".",
"value",
"==",
"consts",
".",
"PE32",
":",
"return",
"True",
"return",
"False"
] | Determines if the current L{PE} instance is a PE32 file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a PE32 file. Otherwise, returns C{False}. | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"is",
"a",
"PE32",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L838-L847 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isPe64 | def isPe64(self):
"""
Determines if the current L{PE} instance is a PE64 file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a PE64 file. Otherwise, returns C{False}.
"""
if self.ntHeaders.optionalHeader.magic.value == consts.PE64:
re... | python | def isPe64(self):
"""
Determines if the current L{PE} instance is a PE64 file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a PE64 file. Otherwise, returns C{False}.
"""
if self.ntHeaders.optionalHeader.magic.value == consts.PE64:
re... | [
"def",
"isPe64",
"(",
"self",
")",
":",
"if",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"magic",
".",
"value",
"==",
"consts",
".",
"PE64",
":",
"return",
"True",
"return",
"False"
] | Determines if the current L{PE} instance is a PE64 file.
@rtype: bool
@return: C{True} if the current L{PE} instance is a PE64 file. Otherwise, returns C{False}. | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"is",
"a",
"PE64",
"file",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L849-L858 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isPeBounded | def isPeBounded(self):
"""
Determines if the current L{PE} instance is bounded, i.e. has a C{BOUND_IMPORT_DIRECTORY}.
@rtype: bool
@return: Returns C{True} if the current L{PE} instance is bounded. Otherwise, returns C{False}.
"""
boundImportsDir = self.ntHeaders... | python | def isPeBounded(self):
"""
Determines if the current L{PE} instance is bounded, i.e. has a C{BOUND_IMPORT_DIRECTORY}.
@rtype: bool
@return: Returns C{True} if the current L{PE} instance is bounded. Otherwise, returns C{False}.
"""
boundImportsDir = self.ntHeaders... | [
"def",
"isPeBounded",
"(",
"self",
")",
":",
"boundImportsDir",
"=",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"dataDirectory",
"[",
"consts",
".",
"BOUND_IMPORT_DIRECTORY",
"]",
"if",
"boundImportsDir",
".",
"rva",
".",
"value",
"and",
"boundImports... | Determines if the current L{PE} instance is bounded, i.e. has a C{BOUND_IMPORT_DIRECTORY}.
@rtype: bool
@return: Returns C{True} if the current L{PE} instance is bounded. Otherwise, returns C{False}. | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"is",
"bounded",
"i",
".",
"e",
".",
"has",
"a",
"C",
"{",
"BOUND_IMPORT_DIRECTORY",
"}",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L860-L870 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isNXEnabled | def isNXEnabled(self):
"""
Determines if the current L{PE} instance has the NXCOMPAT (Compatible with Data Execution Prevention) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/ms235442.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has t... | python | def isNXEnabled(self):
"""
Determines if the current L{PE} instance has the NXCOMPAT (Compatible with Data Execution Prevention) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/ms235442.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has t... | [
"def",
"isNXEnabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"dllCharacteristics",
".",
"value",
"&",
"consts",
".",
"IMAGE_DLL_CHARACTERISTICS_NX_COMPAT",
"==",
"consts",
".",
"IMAGE_DLL_CHARACTERISTICS_NX_COMPAT"
] | Determines if the current L{PE} instance has the NXCOMPAT (Compatible with Data Execution Prevention) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/ms235442.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has the NXCOMPAT flag enabled. Otherwise, return... | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"has",
"the",
"NXCOMPAT",
"(",
"Compatible",
"with",
"Data",
"Execution",
"Prevention",
")",
"flag",
"enabled",
".",
"@see",
":",
"U",
"{",
"http",
":",
"//",
"msdn",
".",
"microsoft"... | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L872-L880 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isCFGEnabled | def isCFGEnabled(self):
"""
Determines if the current L{PE} instance has CFG (Control Flow Guard) flag enabled.
@see: U{http://blogs.msdn.com/b/vcblog/archive/2014/12/08/visual-studio-2015-preview-work-in-progress-security-feature.aspx}
@see: U{https://msdn.microsoft.com/en-us/library/dn... | python | def isCFGEnabled(self):
"""
Determines if the current L{PE} instance has CFG (Control Flow Guard) flag enabled.
@see: U{http://blogs.msdn.com/b/vcblog/archive/2014/12/08/visual-studio-2015-preview-work-in-progress-security-feature.aspx}
@see: U{https://msdn.microsoft.com/en-us/library/dn... | [
"def",
"isCFGEnabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"dllCharacteristics",
".",
"value",
"&",
"consts",
".",
"IMAGE_DLL_CHARACTERISTICS_GUARD_CF",
"==",
"consts",
".",
"IMAGE_DLL_CHARACTERISTICS_GUARD_CF"
] | Determines if the current L{PE} instance has CFG (Control Flow Guard) flag enabled.
@see: U{http://blogs.msdn.com/b/vcblog/archive/2014/12/08/visual-studio-2015-preview-work-in-progress-security-feature.aspx}
@see: U{https://msdn.microsoft.com/en-us/library/dn919635%%28v=vs.140%%29.aspx}
@rtype... | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"has",
"CFG",
"(",
"Control",
"Flow",
"Guard",
")",
"flag",
"enabled",
".",
"@see",
":",
"U",
"{",
"http",
":",
"//",
"blogs",
".",
"msdn",
".",
"com",
"/",
"b",
"/",
"vcblog",
... | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L886-L895 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isASLREnabled | def isASLREnabled(self):
"""
Determines if the current L{PE} instance has the DYNAMICBASE (Use address space layout randomization) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/bb384887.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has... | python | def isASLREnabled(self):
"""
Determines if the current L{PE} instance has the DYNAMICBASE (Use address space layout randomization) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/bb384887.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has... | [
"def",
"isASLREnabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"dllCharacteristics",
".",
"value",
"&",
"consts",
".",
"IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE",
"==",
"consts",
".",
"IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE"... | Determines if the current L{PE} instance has the DYNAMICBASE (Use address space layout randomization) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/bb384887.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has the DYNAMICBASE flag enabled. Otherwise, ret... | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"has",
"the",
"DYNAMICBASE",
"(",
"Use",
"address",
"space",
"layout",
"randomization",
")",
"flag",
"enabled",
".",
"@see",
":",
"U",
"{",
"http",
":",
"//",
"msdn",
".",
"microsoft"... | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L897-L905 | train |
crackinglandia/pype32 | pype32/pype32.py | PE.isSAFESEHEnabled | def isSAFESEHEnabled(self):
"""
Determines if the current L{PE} instance has the SAFESEH (Image has Safe Exception Handlers) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/9a89h429.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has the S... | python | def isSAFESEHEnabled(self):
"""
Determines if the current L{PE} instance has the SAFESEH (Image has Safe Exception Handlers) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/9a89h429.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has the S... | [
"def",
"isSAFESEHEnabled",
"(",
"self",
")",
":",
"NOSEH",
"=",
"-",
"1",
"SAFESEH_OFF",
"=",
"0",
"SAFESEH_ON",
"=",
"1",
"if",
"self",
".",
"ntHeaders",
".",
"optionalHeader",
".",
"dllCharacteristics",
".",
"value",
"&",
"consts",
".",
"IMAGE_DLL_CHARACTE... | Determines if the current L{PE} instance has the SAFESEH (Image has Safe Exception Handlers) flag enabled.
@see: U{http://msdn.microsoft.com/en-us/library/9a89h429.aspx}
@rtype: bool
@return: Returns C{True} if the current L{PE} instance has the SAFESEH flag enabled. Returns C{False} if SAFESEH... | [
"Determines",
"if",
"the",
"current",
"L",
"{",
"PE",
"}",
"instance",
"has",
"the",
"SAFESEH",
"(",
"Image",
"has",
"Safe",
"Exception",
"Handlers",
")",
"flag",
"enabled",
".",
"@see",
":",
"U",
"{",
"http",
":",
"//",
"msdn",
".",
"microsoft",
".",
... | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L907-L926 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseDirectories | def _parseDirectories(self, dataDirectoryInstance, magic = consts.PE32):
"""
Parses all the directories in the L{PE} instance.
@type dataDirectoryInstance: L{DataDirectory}
@param dataDirectoryInstance: A L{DataDirectory} object with the directories data.
@type ... | python | def _parseDirectories(self, dataDirectoryInstance, magic = consts.PE32):
"""
Parses all the directories in the L{PE} instance.
@type dataDirectoryInstance: L{DataDirectory}
@param dataDirectoryInstance: A L{DataDirectory} object with the directories data.
@type ... | [
"def",
"_parseDirectories",
"(",
"self",
",",
"dataDirectoryInstance",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"directories",
"=",
"[",
"(",
"consts",
".",
"EXPORT_DIRECTORY",
",",
"self",
".",
"_parseExportDirectory",
")",
",",
"(",
"consts",
".... | Parses all the directories in the L{PE} instance.
@type dataDirectoryInstance: L{DataDirectory}
@param dataDirectoryInstance: A L{DataDirectory} object with the directories data.
@type magic: int
@param magic: (Optional) The type of PE. This value could be L{consts.PE32... | [
"Parses",
"all",
"the",
"directories",
"in",
"the",
"L",
"{",
"PE",
"}",
"instance",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L928-L956 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseResourceDirectory | def _parseResourceDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_RESOURCE_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_RESOURCE_DIRECTORY} starts.
@type size: int
@param size: The size of the C{IMAG... | python | def _parseResourceDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_RESOURCE_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_RESOURCE_DIRECTORY} starts.
@type size: int
@param size: The size of the C{IMAG... | [
"def",
"_parseResourceDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"return",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")"
] | Parses the C{IMAGE_RESOURCE_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_RESOURCE_DIRECTORY} starts.
@type size: int
@param size: The size of the C{IMAGE_RESOURCE_DIRECTORY} directory.
@type magic: int
@param magic... | [
"Parses",
"the",
"C",
"{",
"IMAGE_RESOURCE_DIRECTORY",
"}",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L958-L974 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseExceptionDirectory | def _parseExceptionDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_EXCEPTION_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_EXCEPTION_DIRECTORY} starts.
@type size: int
@param size: The size of the C{I... | python | def _parseExceptionDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_EXCEPTION_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_EXCEPTION_DIRECTORY} starts.
@type size: int
@param size: The size of the C{I... | [
"def",
"_parseExceptionDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"return",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")"
] | Parses the C{IMAGE_EXCEPTION_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_EXCEPTION_DIRECTORY} starts.
@type size: int
@param size: The size of the C{IMAGE_EXCEPTION_DIRECTORY} directory.
@type magic: int
@param ma... | [
"Parses",
"the",
"C",
"{",
"IMAGE_EXCEPTION_DIRECTORY",
"}",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L976-L992 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseDelayImportDirectory | def _parseDelayImportDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the delay imports directory.
@type rva: int
@param rva: The RVA where the delay imports directory starts.
@type size: int
@param size: The size of the delay imports directo... | python | def _parseDelayImportDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the delay imports directory.
@type rva: int
@param rva: The RVA where the delay imports directory starts.
@type size: int
@param size: The size of the delay imports directo... | [
"def",
"_parseDelayImportDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"return",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")"
] | Parses the delay imports directory.
@type rva: int
@param rva: The RVA where the delay imports directory starts.
@type size: int
@param size: The size of the delay imports directory.
@type magic: int
@param magic: (Optional) The type of PE. Thi... | [
"Parses",
"the",
"delay",
"imports",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L994-L1010 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseBoundImportDirectory | def _parseBoundImportDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the bound import directory.
@type rva: int
@param rva: The RVA where the bound import directory starts.
@type size: int
@param size: The size of the bound import directory.... | python | def _parseBoundImportDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the bound import directory.
@type rva: int
@param rva: The RVA where the bound import directory starts.
@type size: int
@param size: The size of the bound import directory.... | [
"def",
"_parseBoundImportDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"data",
"=",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")",
"rd",
"=",
"utils",
".",
"ReadData",
"(",
"data",
"... | Parses the bound import directory.
@type rva: int
@param rva: The RVA where the bound import directory starts.
@type size: int
@param size: The size of the bound import directory.
@type magic: int
@param magic: (Optional) The type of PE. This v... | [
"Parses",
"the",
"bound",
"import",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1012-L1042 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseLoadConfigDirectory | def _parseLoadConfigDirectory(self, rva, size, magic = consts.PE32):
"""
Parses IMAGE_LOAD_CONFIG_DIRECTORY.
@type rva: int
@param rva: The RVA where the IMAGE_LOAD_CONFIG_DIRECTORY starts.
@type size: int
@param size: The size of the IMAGE_LOAD_CONFIG_... | python | def _parseLoadConfigDirectory(self, rva, size, magic = consts.PE32):
"""
Parses IMAGE_LOAD_CONFIG_DIRECTORY.
@type rva: int
@param rva: The RVA where the IMAGE_LOAD_CONFIG_DIRECTORY starts.
@type size: int
@param size: The size of the IMAGE_LOAD_CONFIG_... | [
"def",
"_parseLoadConfigDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"# print \"RVA: %x - SIZE: %x\" % (rva, size)",
"# I've found some issues when parsing the IMAGE_LOAD_CONFIG_DIRECTORY in some DLLs. ",
"# There is an inc... | Parses IMAGE_LOAD_CONFIG_DIRECTORY.
@type rva: int
@param rva: The RVA where the IMAGE_LOAD_CONFIG_DIRECTORY starts.
@type size: int
@param size: The size of the IMAGE_LOAD_CONFIG_DIRECTORY.
@type magic: int
@param magic: (Optional) The type of... | [
"Parses",
"IMAGE_LOAD_CONFIG_DIRECTORY",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1044-L1077 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseTlsDirectory | def _parseTlsDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the TLS directory.
@type rva: int
@param rva: The RVA where the TLS directory starts.
@type size: int
@param size: The size of the TLS directory.
@type magic: int
... | python | def _parseTlsDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the TLS directory.
@type rva: int
@param rva: The RVA where the TLS directory starts.
@type size: int
@param size: The size of the TLS directory.
@type magic: int
... | [
"def",
"_parseTlsDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"data",
"=",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")",
"rd",
"=",
"utils",
".",
"ReadData",
"(",
"data",
")",
"i... | Parses the TLS directory.
@type rva: int
@param rva: The RVA where the TLS directory starts.
@type size: int
@param size: The size of the TLS directory.
@type magic: int
@param magic: (Optional) The type of PE. This value could be L{consts.PE32... | [
"Parses",
"the",
"TLS",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1079-L1104 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseRelocsDirectory | def _parseRelocsDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the relocation directory.
@type rva: int
@param rva: The RVA where the relocation directory starts.
@type size: int
@param size: The size of the relocation directory.
... | python | def _parseRelocsDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the relocation directory.
@type rva: int
@param rva: The RVA where the relocation directory starts.
@type size: int
@param size: The size of the relocation directory.
... | [
"def",
"_parseRelocsDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"data",
"=",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")",
"#print \"Length Relocation data: %x\" % len(data)",
"rd",
"=",
... | Parses the relocation directory.
@type rva: int
@param rva: The RVA where the relocation directory starts.
@type size: int
@param size: The size of the relocation directory.
@type magic: int
@param magic: (Optional) The type of PE. This value c... | [
"Parses",
"the",
"relocation",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1106-L1130 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseExportDirectory | def _parseExportDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_EXPORT_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_EXPORT_DIRECTORY} directory starts.
@type size: int
@param size: The size of the C{... | python | def _parseExportDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_EXPORT_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_EXPORT_DIRECTORY} directory starts.
@type size: int
@param size: The size of the C{... | [
"def",
"_parseExportDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"data",
"=",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")",
"rd",
"=",
"utils",
".",
"ReadData",
"(",
"data",
")",
... | Parses the C{IMAGE_EXPORT_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_EXPORT_DIRECTORY} directory starts.
@type size: int
@param size: The size of the C{IMAGE_EXPORT_DIRECTORY} directory.
@type magic: int
@param m... | [
"Parses",
"the",
"C",
"{",
"IMAGE_EXPORT_DIRECTORY",
"}",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1132-L1202 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseDebugDirectory | def _parseDebugDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_DEBUG_DIRECTORY} directory.
@see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680307(v=vs.85).aspx}
@type rva: int
@param rva: The RVA where the C{IMAGE_DEBUG_DIRECTOR... | python | def _parseDebugDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_DEBUG_DIRECTORY} directory.
@see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680307(v=vs.85).aspx}
@type rva: int
@param rva: The RVA where the C{IMAGE_DEBUG_DIRECTOR... | [
"def",
"_parseDebugDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"debugDirData",
"=",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")",
"numberOfEntries",
"=",
"size",
"/",
"consts",
".",
... | Parses the C{IMAGE_DEBUG_DIRECTORY} directory.
@see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680307(v=vs.85).aspx}
@type rva: int
@param rva: The RVA where the C{IMAGE_DEBUG_DIRECTORY} directory starts.
@type size: int
@param size: The size ... | [
"Parses",
"the",
"C",
"{",
"IMAGE_DEBUG_DIRECTORY",
"}",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1204-L1224 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseImportDirectory | def _parseImportDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_IMPORT_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_IMPORT_DIRECTORY} directory starts.
@type size: int
@param size: The size of the C{... | python | def _parseImportDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the C{IMAGE_IMPORT_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_IMPORT_DIRECTORY} directory starts.
@type size: int
@param size: The size of the C{... | [
"def",
"_parseImportDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"#print \"RVA: %x - Size: %x\" % (rva, size) ",
"importsDirData",
"=",
"self",
".",
"getDataAtRva",
"(",
"rva",
",",
"size",
")",
"#p... | Parses the C{IMAGE_IMPORT_DIRECTORY} directory.
@type rva: int
@param rva: The RVA where the C{IMAGE_IMPORT_DIRECTORY} directory starts.
@type size: int
@param size: The size of the C{IMAGE_IMPORT_DIRECTORY} directory.
@type magic: int
@param m... | [
"Parses",
"the",
"C",
"{",
"IMAGE_IMPORT_DIRECTORY",
"}",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1226-L1362 | train |
crackinglandia/pype32 | pype32/pype32.py | PE._parseNetDirectory | def _parseNetDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the NET directory.
@see: U{http://www.ntcore.com/files/dotnetformat.htm}
@type rva: int
@param rva: The RVA where the NET directory starts.
@type size: int
@param size: The... | python | def _parseNetDirectory(self, rva, size, magic = consts.PE32):
"""
Parses the NET directory.
@see: U{http://www.ntcore.com/files/dotnetformat.htm}
@type rva: int
@param rva: The RVA where the NET directory starts.
@type size: int
@param size: The... | [
"def",
"_parseNetDirectory",
"(",
"self",
",",
"rva",
",",
"size",
",",
"magic",
"=",
"consts",
".",
"PE32",
")",
":",
"if",
"not",
"rva",
"or",
"not",
"size",
":",
"return",
"None",
"# create a NETDirectory class to hold the data",
"netDirectoryClass",
"=",
"... | Parses the NET directory.
@see: U{http://www.ntcore.com/files/dotnetformat.htm}
@type rva: int
@param rva: The RVA where the NET directory starts.
@type size: int
@param size: The size of the NET directory.
@type magic: int
@param magic... | [
"Parses",
"the",
"NET",
"directory",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1364-L1458 | train |
crackinglandia/pype32 | pype32/pype32.py | DosHeader.parse | def parse(readDataInstance):
"""
Returns a new L{DosHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{DosHeader} object.
@rtype: L{DosHeader}
@return: A new L{DosHeader} object... | python | def parse(readDataInstance):
"""
Returns a new L{DosHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{DosHeader} object.
@rtype: L{DosHeader}
@return: A new L{DosHeader} object... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"dosHdr",
"=",
"DosHeader",
"(",
")",
"dosHdr",
".",
"e_magic",
".",
"value",
"=",
"readDataInstance",
".",
"readWord",
"(",
")",
"dosHdr",
".",
"e_cblp",
".",
"value",
"=",
"readDataInstance",
".",
"readW... | Returns a new L{DosHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{DosHeader} object.
@rtype: L{DosHeader}
@return: A new L{DosHeader} object. | [
"Returns",
"a",
"new",
"L",
"{",
"DosHeader",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1617-L1656 | train |
crackinglandia/pype32 | pype32/pype32.py | NtHeaders.parse | def parse(readDataInstance):
"""
Returns a new L{NtHeaders} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NtHeaders} object.
@rtype: L{NtHeaders}
@return: A new L{NtHeaders} object... | python | def parse(readDataInstance):
"""
Returns a new L{NtHeaders} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NtHeaders} object.
@rtype: L{NtHeaders}
@return: A new L{NtHeaders} object... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"nt",
"=",
"NtHeaders",
"(",
")",
"nt",
".",
"signature",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"(",
")",
"nt",
".",
"fileHeader",
"=",
"FileHeader",
".",
"parse",
"(",
"readDataInstance... | Returns a new L{NtHeaders} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{NtHeaders} object.
@rtype: L{NtHeaders}
@return: A new L{NtHeaders} object. | [
"Returns",
"a",
"new",
"L",
"{",
"NtHeaders",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1682-L1696 | train |
crackinglandia/pype32 | pype32/pype32.py | FileHeader.parse | def parse(readDataInstance):
"""
Returns a new L{FileHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{FileHeader} object.
@rtype: L{FileHeader}
@return: A new L{ReadData} obje... | python | def parse(readDataInstance):
"""
Returns a new L{FileHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{FileHeader} object.
@rtype: L{FileHeader}
@return: A new L{ReadData} obje... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"fh",
"=",
"FileHeader",
"(",
")",
"fh",
".",
"machine",
".",
"value",
"=",
"readDataInstance",
".",
"readWord",
"(",
")",
"fh",
".",
"numberOfSections",
".",
"value",
"=",
"readDataInstance",
".",
"readWo... | Returns a new L{FileHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{FileHeader} object.
@rtype: L{FileHeader}
@return: A new L{ReadData} object. | [
"Returns",
"a",
"new",
"L",
"{",
"FileHeader",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1726-L1744 | train |
crackinglandia/pype32 | pype32/pype32.py | OptionalHeader.parse | def parse(readDataInstance):
"""
Returns a new L{OptionalHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{OptionalHeader} object.
@rtype: L{OptionalHeader}
@return: A new L{Op... | python | def parse(readDataInstance):
"""
Returns a new L{OptionalHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{OptionalHeader} object.
@rtype: L{OptionalHeader}
@return: A new L{Op... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"oh",
"=",
"OptionalHeader",
"(",
")",
"oh",
".",
"magic",
".",
"value",
"=",
"readDataInstance",
".",
"readWord",
"(",
")",
"oh",
".",
"majorLinkerVersion",
".",
"value",
"=",
"readDataInstance",
".",
"re... | Returns a new L{OptionalHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{OptionalHeader} object.
@rtype: L{OptionalHeader}
@return: A new L{OptionalHeader} object. | [
"Returns",
"a",
"new",
"L",
"{",
"OptionalHeader",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1802-L1849 | train |
crackinglandia/pype32 | pype32/pype32.py | SectionHeader.parse | def parse(readDataInstance):
"""
Returns a new L{SectionHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{SectionHeader} object.
@rtype: L{SectionHeader}
@return: A new L{Secti... | python | def parse(readDataInstance):
"""
Returns a new L{SectionHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{SectionHeader} object.
@rtype: L{SectionHeader}
@return: A new L{Secti... | [
"def",
"parse",
"(",
"readDataInstance",
")",
":",
"sh",
"=",
"SectionHeader",
"(",
")",
"sh",
".",
"name",
".",
"value",
"=",
"readDataInstance",
".",
"read",
"(",
"8",
")",
"sh",
".",
"misc",
".",
"value",
"=",
"readDataInstance",
".",
"readDword",
"... | Returns a new L{SectionHeader} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{SectionHeader} object.
@rtype: L{SectionHeader}
@return: A new L{SectionHeader} object. | [
"Returns",
"a",
"new",
"L",
"{",
"SectionHeader",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L2017-L2038 | train |
crackinglandia/pype32 | pype32/pype32.py | SectionHeaders.parse | def parse(readDataInstance, numberOfSectionHeaders):
"""
Returns a new L{SectionHeaders} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{SectionHeaders} object.
@type numberOfSectionHeaders... | python | def parse(readDataInstance, numberOfSectionHeaders):
"""
Returns a new L{SectionHeaders} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{SectionHeaders} object.
@type numberOfSectionHeaders... | [
"def",
"parse",
"(",
"readDataInstance",
",",
"numberOfSectionHeaders",
")",
":",
"sHdrs",
"=",
"SectionHeaders",
"(",
"numberOfSectionHeaders",
"=",
"0",
")",
"for",
"i",
"in",
"range",
"(",
"numberOfSectionHeaders",
")",
":",
"sh",
"=",
"SectionHeader",
"(",
... | Returns a new L{SectionHeaders} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{SectionHeaders} object.
@type numberOfSectionHeaders: int
@param numberOfSectionHeaders: The number of L{SectionHeader... | [
"Returns",
"a",
"new",
"L",
"{",
"SectionHeaders",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L2069-L2097 | train |
crackinglandia/pype32 | pype32/pype32.py | Sections.parse | def parse(readDataInstance, sectionHeadersInstance):
"""
Returns a new L{Sections} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{Sections} object.
@type sectionHeadersInstance: instance
... | python | def parse(readDataInstance, sectionHeadersInstance):
"""
Returns a new L{Sections} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{Sections} object.
@type sectionHeadersInstance: instance
... | [
"def",
"parse",
"(",
"readDataInstance",
",",
"sectionHeadersInstance",
")",
":",
"sData",
"=",
"Sections",
"(",
")",
"for",
"sectionHdr",
"in",
"sectionHeadersInstance",
":",
"if",
"sectionHdr",
".",
"sizeOfRawData",
".",
"value",
">",
"len",
"(",
"readDataInst... | Returns a new L{Sections} object.
@type readDataInstance: L{ReadData}
@param readDataInstance: A L{ReadData} object with data to be parsed as a L{Sections} object.
@type sectionHeadersInstance: instance
@param sectionHeadersInstance: The L{SectionHeaders} instance with ... | [
"Returns",
"a",
"new",
"L",
"{",
"Sections",
"}",
"object",
"."
] | 192fd14dfc0dd36d953739a81c17fbaf5e3d6076 | https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L2118-L2151 | train |
blockcypher/bcwallet | bcwallet/bcwallet.py | get_addresses_on_both_chains | def get_addresses_on_both_chains(wallet_obj, used=None, zero_balance=None):
'''
Get addresses across both subchains based on the filter criteria passed in
Returns a list of dicts of the following form:
[
{'address': '1abc123...', 'path': 'm/0/9', 'pubkeyhex': '0123456...'},
... | python | def get_addresses_on_both_chains(wallet_obj, used=None, zero_balance=None):
'''
Get addresses across both subchains based on the filter criteria passed in
Returns a list of dicts of the following form:
[
{'address': '1abc123...', 'path': 'm/0/9', 'pubkeyhex': '0123456...'},
... | [
"def",
"get_addresses_on_both_chains",
"(",
"wallet_obj",
",",
"used",
"=",
"None",
",",
"zero_balance",
"=",
"None",
")",
":",
"mpub",
"=",
"wallet_obj",
".",
"serialize_b58",
"(",
"private",
"=",
"False",
")",
"wallet_name",
"=",
"get_blockcypher_walletname_from... | Get addresses across both subchains based on the filter criteria passed in
Returns a list of dicts of the following form:
[
{'address': '1abc123...', 'path': 'm/0/9', 'pubkeyhex': '0123456...'},
...,
]
Dicts may also contain WIF and privkeyhex if wallet_obj has private ... | [
"Get",
"addresses",
"across",
"both",
"subchains",
"based",
"on",
"the",
"filter",
"criteria",
"passed",
"in"
] | 4c623a8e19705332c9398c3fea9d5dc3c1dafb9b | https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L153-L202 | train |
blockcypher/bcwallet | bcwallet/bcwallet.py | register_unused_addresses | def register_unused_addresses(wallet_obj, subchain_index, num_addrs=1):
'''
Hit /derive to register new unused_addresses on a subchain_index and verify them client-side
Returns a list of dicts of the following form:
[
{'address': '1abc123...', 'path': 'm/0/9', 'public': '0123456...'},
... | python | def register_unused_addresses(wallet_obj, subchain_index, num_addrs=1):
'''
Hit /derive to register new unused_addresses on a subchain_index and verify them client-side
Returns a list of dicts of the following form:
[
{'address': '1abc123...', 'path': 'm/0/9', 'public': '0123456...'},
... | [
"def",
"register_unused_addresses",
"(",
"wallet_obj",
",",
"subchain_index",
",",
"num_addrs",
"=",
"1",
")",
":",
"verbose_print",
"(",
"'register_unused_addresses called on subchain %s for %s addrs'",
"%",
"(",
"subchain_index",
",",
"num_addrs",
",",
")",
")",
"asse... | Hit /derive to register new unused_addresses on a subchain_index and verify them client-side
Returns a list of dicts of the following form:
[
{'address': '1abc123...', 'path': 'm/0/9', 'public': '0123456...'},
...,
] | [
"Hit",
"/",
"derive",
"to",
"register",
"new",
"unused_addresses",
"on",
"a",
"subchain_index",
"and",
"verify",
"them",
"client",
"-",
"side"
] | 4c623a8e19705332c9398c3fea9d5dc3c1dafb9b | https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L205-L254 | train |
blockcypher/bcwallet | bcwallet/bcwallet.py | dump_all_keys_or_addrs | def dump_all_keys_or_addrs(wallet_obj):
'''
Offline-enabled mechanism to dump addresses
'''
print_traversal_warning()
puts('\nDo you understand this warning?')
if not confirm(user_prompt=DEFAULT_PROMPT, default=False):
puts(colored.red('Dump Cancelled!'))
return
mpub = wal... | python | def dump_all_keys_or_addrs(wallet_obj):
'''
Offline-enabled mechanism to dump addresses
'''
print_traversal_warning()
puts('\nDo you understand this warning?')
if not confirm(user_prompt=DEFAULT_PROMPT, default=False):
puts(colored.red('Dump Cancelled!'))
return
mpub = wal... | [
"def",
"dump_all_keys_or_addrs",
"(",
"wallet_obj",
")",
":",
"print_traversal_warning",
"(",
")",
"puts",
"(",
"'\\nDo you understand this warning?'",
")",
"if",
"not",
"confirm",
"(",
"user_prompt",
"=",
"DEFAULT_PROMPT",
",",
"default",
"=",
"False",
")",
":",
... | Offline-enabled mechanism to dump addresses | [
"Offline",
"-",
"enabled",
"mechanism",
"to",
"dump",
"addresses"
] | 4c623a8e19705332c9398c3fea9d5dc3c1dafb9b | https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L869-L932 | train |
blockcypher/bcwallet | bcwallet/bcwallet.py | dump_selected_keys_or_addrs | def dump_selected_keys_or_addrs(wallet_obj, used=None, zero_balance=None):
'''
Works for both public key only or private key access
'''
if wallet_obj.private_key:
content_str = 'private keys'
else:
content_str = 'addresses'
if not USER_ONLINE:
puts(colored.red('\nInterne... | python | def dump_selected_keys_or_addrs(wallet_obj, used=None, zero_balance=None):
'''
Works for both public key only or private key access
'''
if wallet_obj.private_key:
content_str = 'private keys'
else:
content_str = 'addresses'
if not USER_ONLINE:
puts(colored.red('\nInterne... | [
"def",
"dump_selected_keys_or_addrs",
"(",
"wallet_obj",
",",
"used",
"=",
"None",
",",
"zero_balance",
"=",
"None",
")",
":",
"if",
"wallet_obj",
".",
"private_key",
":",
"content_str",
"=",
"'private keys'",
"else",
":",
"content_str",
"=",
"'addresses'",
"if"... | Works for both public key only or private key access | [
"Works",
"for",
"both",
"public",
"key",
"only",
"or",
"private",
"key",
"access"
] | 4c623a8e19705332c9398c3fea9d5dc3c1dafb9b | https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L935-L998 | train |
blockcypher/bcwallet | bcwallet/bcwallet.py | dump_private_keys_or_addrs_chooser | def dump_private_keys_or_addrs_chooser(wallet_obj):
'''
Offline-enabled mechanism to dump everything
'''
if wallet_obj.private_key:
puts('Which private keys and addresses do you want?')
else:
puts('Which addresses do you want?')
with indent(2):
puts(colored.cyan('1: Acti... | python | def dump_private_keys_or_addrs_chooser(wallet_obj):
'''
Offline-enabled mechanism to dump everything
'''
if wallet_obj.private_key:
puts('Which private keys and addresses do you want?')
else:
puts('Which addresses do you want?')
with indent(2):
puts(colored.cyan('1: Acti... | [
"def",
"dump_private_keys_or_addrs_chooser",
"(",
"wallet_obj",
")",
":",
"if",
"wallet_obj",
".",
"private_key",
":",
"puts",
"(",
"'Which private keys and addresses do you want?'",
")",
"else",
":",
"puts",
"(",
"'Which addresses do you want?'",
")",
"with",
"indent",
... | Offline-enabled mechanism to dump everything | [
"Offline",
"-",
"enabled",
"mechanism",
"to",
"dump",
"everything"
] | 4c623a8e19705332c9398c3fea9d5dc3c1dafb9b | https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L1001-L1034 | train |
blockcypher/bcwallet | bcwallet/bcwallet.py | wallet_home | def wallet_home(wallet_obj):
'''
Loaded on bootup (and stays in while loop until quitting)
'''
mpub = wallet_obj.serialize_b58(private=False)
if wallet_obj.private_key is None:
print_pubwallet_notice(mpub=mpub)
else:
print_bcwallet_basic_pub_opening(mpub=mpub)
coin_symbol =... | python | def wallet_home(wallet_obj):
'''
Loaded on bootup (and stays in while loop until quitting)
'''
mpub = wallet_obj.serialize_b58(private=False)
if wallet_obj.private_key is None:
print_pubwallet_notice(mpub=mpub)
else:
print_bcwallet_basic_pub_opening(mpub=mpub)
coin_symbol =... | [
"def",
"wallet_home",
"(",
"wallet_obj",
")",
":",
"mpub",
"=",
"wallet_obj",
".",
"serialize_b58",
"(",
"private",
"=",
"False",
")",
"if",
"wallet_obj",
".",
"private_key",
"is",
"None",
":",
"print_pubwallet_notice",
"(",
"mpub",
"=",
"mpub",
")",
"else",... | Loaded on bootup (and stays in while loop until quitting) | [
"Loaded",
"on",
"bootup",
"(",
"and",
"stays",
"in",
"while",
"loop",
"until",
"quitting",
")"
] | 4c623a8e19705332c9398c3fea9d5dc3c1dafb9b | https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L1091-L1173 | train |
tansey/gfl | pygfl/solver.py | TrailSolver.solve | def solve(self, lam):
'''Solves the GFL for a fixed value of lambda.'''
if self.penalty == 'dp':
return self.solve_dp(lam)
if self.penalty == 'gfl':
return self.solve_gfl(lam)
if self.penalty == 'gamlasso':
return self.solve_gfl(lam)
raise Exce... | python | def solve(self, lam):
'''Solves the GFL for a fixed value of lambda.'''
if self.penalty == 'dp':
return self.solve_dp(lam)
if self.penalty == 'gfl':
return self.solve_gfl(lam)
if self.penalty == 'gamlasso':
return self.solve_gfl(lam)
raise Exce... | [
"def",
"solve",
"(",
"self",
",",
"lam",
")",
":",
"if",
"self",
".",
"penalty",
"==",
"'dp'",
":",
"return",
"self",
".",
"solve_dp",
"(",
"lam",
")",
"if",
"self",
".",
"penalty",
"==",
"'gfl'",
":",
"return",
"self",
".",
"solve_gfl",
"(",
"lam"... | Solves the GFL for a fixed value of lambda. | [
"Solves",
"the",
"GFL",
"for",
"a",
"fixed",
"value",
"of",
"lambda",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/solver.py#L80-L88 | train |
tansey/gfl | pygfl/solver.py | TrailSolver.solve_dp | def solve_dp(self, lam):
'''Solves the Graph-fused double Pareto (non-convex, local optima only)'''
cur_converge = self.converge+1
step = 0
# Get an initial estimate using the GFL
self.solve_gfl(lam)
beta2 = np.copy(self.beta)
while cur_converge > self.converge an... | python | def solve_dp(self, lam):
'''Solves the Graph-fused double Pareto (non-convex, local optima only)'''
cur_converge = self.converge+1
step = 0
# Get an initial estimate using the GFL
self.solve_gfl(lam)
beta2 = np.copy(self.beta)
while cur_converge > self.converge an... | [
"def",
"solve_dp",
"(",
"self",
",",
"lam",
")",
":",
"cur_converge",
"=",
"self",
".",
"converge",
"+",
"1",
"step",
"=",
"0",
"# Get an initial estimate using the GFL",
"self",
".",
"solve_gfl",
"(",
"lam",
")",
"beta2",
"=",
"np",
".",
"copy",
"(",
"s... | Solves the Graph-fused double Pareto (non-convex, local optima only) | [
"Solves",
"the",
"Graph",
"-",
"fused",
"double",
"Pareto",
"(",
"non",
"-",
"convex",
"local",
"optima",
"only",
")"
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/solver.py#L120-L140 | train |
tansey/gfl | pygfl/solver.py | TrailSolver.solve_gamlasso | def solve_gamlasso(self, lam):
'''Solves the Graph-fused gamma lasso via POSE (Taddy, 2013)'''
weights = lam / (1 + self.gamma * np.abs(self.beta[self.trails[::2]] - self.beta[self.trails[1::2]]))
s = self.solve_gfl(u)
self.steps.append(s)
return self.beta | python | def solve_gamlasso(self, lam):
'''Solves the Graph-fused gamma lasso via POSE (Taddy, 2013)'''
weights = lam / (1 + self.gamma * np.abs(self.beta[self.trails[::2]] - self.beta[self.trails[1::2]]))
s = self.solve_gfl(u)
self.steps.append(s)
return self.beta | [
"def",
"solve_gamlasso",
"(",
"self",
",",
"lam",
")",
":",
"weights",
"=",
"lam",
"/",
"(",
"1",
"+",
"self",
".",
"gamma",
"*",
"np",
".",
"abs",
"(",
"self",
".",
"beta",
"[",
"self",
".",
"trails",
"[",
":",
":",
"2",
"]",
"]",
"-",
"self... | Solves the Graph-fused gamma lasso via POSE (Taddy, 2013) | [
"Solves",
"the",
"Graph",
"-",
"fused",
"gamma",
"lasso",
"via",
"POSE",
"(",
"Taddy",
"2013",
")"
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/solver.py#L142-L147 | train |
tansey/gfl | pygfl/solver.py | TrailSolver.solution_path | def solution_path(self, min_lambda, max_lambda, lambda_bins, verbose=0):
'''Follows the solution path to find the best lambda value.'''
lambda_grid = np.exp(np.linspace(np.log(max_lambda), np.log(min_lambda), lambda_bins))
aic_trace = np.zeros(lambda_grid.shape) # The AIC score for each lambda v... | python | def solution_path(self, min_lambda, max_lambda, lambda_bins, verbose=0):
'''Follows the solution path to find the best lambda value.'''
lambda_grid = np.exp(np.linspace(np.log(max_lambda), np.log(min_lambda), lambda_bins))
aic_trace = np.zeros(lambda_grid.shape) # The AIC score for each lambda v... | [
"def",
"solution_path",
"(",
"self",
",",
"min_lambda",
",",
"max_lambda",
",",
"lambda_bins",
",",
"verbose",
"=",
"0",
")",
":",
"lambda_grid",
"=",
"np",
".",
"exp",
"(",
"np",
".",
"linspace",
"(",
"np",
".",
"log",
"(",
"max_lambda",
")",
",",
"... | Follows the solution path to find the best lambda value. | [
"Follows",
"the",
"solution",
"path",
"to",
"find",
"the",
"best",
"lambda",
"value",
"."
] | ae0f078bab57aba9e827ed6162f247ff9dc2aa19 | https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/solver.py#L152-L217 | train |
zsethna/OLGA | olga/generate_sequences.py | main | def main():
""" Generate sequences."""
parser = OptionParser(conflict_handler="resolve")
parser.add_option('--humanTRA', '--human_T_alpha', action='store_true', dest='humanTRA', default=False, help='use default human TRA model (T cell alpha chain)')
parser.add_option('--humanTRB', '--human_T_beta', ac... | python | def main():
""" Generate sequences."""
parser = OptionParser(conflict_handler="resolve")
parser.add_option('--humanTRA', '--human_T_alpha', action='store_true', dest='humanTRA', default=False, help='use default human TRA model (T cell alpha chain)')
parser.add_option('--humanTRB', '--human_T_beta', ac... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"OptionParser",
"(",
"conflict_handler",
"=",
"\"resolve\"",
")",
"parser",
".",
"add_option",
"(",
"'--humanTRA'",
",",
"'--human_T_alpha'",
",",
"action",
"=",
"'store_true'",
",",
"dest",
"=",
"'humanTRA'",
",",
... | Generate sequences. | [
"Generate",
"sequences",
"."
] | e825c333f0f9a4eb02132e0bcf86f0dca9123114 | https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generate_sequences.py#L144-L345 | train |
napalm-automation-community/napalm-panos | napalm_panos/panos.py | PANOSDriver._send_merge_commands | def _send_merge_commands(self, config, file_config):
"""
Netmiko is being used to push set commands.
"""
if self.loaded is False:
if self._save_backup() is False:
raise MergeConfigException('Error while storing backup '
... | python | def _send_merge_commands(self, config, file_config):
"""
Netmiko is being used to push set commands.
"""
if self.loaded is False:
if self._save_backup() is False:
raise MergeConfigException('Error while storing backup '
... | [
"def",
"_send_merge_commands",
"(",
"self",
",",
"config",
",",
"file_config",
")",
":",
"if",
"self",
".",
"loaded",
"is",
"False",
":",
"if",
"self",
".",
"_save_backup",
"(",
")",
"is",
"False",
":",
"raise",
"MergeConfigException",
"(",
"'Error while sto... | Netmiko is being used to push set commands. | [
"Netmiko",
"is",
"being",
"used",
"to",
"push",
"set",
"commands",
"."
] | 9210a81a7a4a47c724d169031414a0743de4b035 | https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L212-L232 | train |
napalm-automation-community/napalm-panos | napalm_panos/panos.py | PANOSDriver.compare_config | def compare_config(self):
"""
Netmiko is being used to obtain config diffs because pan-python
doesn't support the needed command.
"""
if self.ssh_connection is False:
self._open_ssh()
self.ssh_device.exit_config_mode()
diff = self.ssh_device.send_comm... | python | def compare_config(self):
"""
Netmiko is being used to obtain config diffs because pan-python
doesn't support the needed command.
"""
if self.ssh_connection is False:
self._open_ssh()
self.ssh_device.exit_config_mode()
diff = self.ssh_device.send_comm... | [
"def",
"compare_config",
"(",
"self",
")",
":",
"if",
"self",
".",
"ssh_connection",
"is",
"False",
":",
"self",
".",
"_open_ssh",
"(",
")",
"self",
".",
"ssh_device",
".",
"exit_config_mode",
"(",
")",
"diff",
"=",
"self",
".",
"ssh_device",
".",
"send_... | Netmiko is being used to obtain config diffs because pan-python
doesn't support the needed command. | [
"Netmiko",
"is",
"being",
"used",
"to",
"obtain",
"config",
"diffs",
"because",
"pan",
"-",
"python",
"doesn",
"t",
"support",
"the",
"needed",
"command",
"."
] | 9210a81a7a4a47c724d169031414a0743de4b035 | https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L280-L290 | train |
napalm-automation-community/napalm-panos | napalm_panos/panos.py | PANOSDriver.commit_config | def commit_config(self):
"""
Netmiko is being used to commit the configuration because it takes
a better care of results compared to pan-python.
"""
if self.loaded:
if self.ssh_connection is False:
self._open_ssh()
try:
self... | python | def commit_config(self):
"""
Netmiko is being used to commit the configuration because it takes
a better care of results compared to pan-python.
"""
if self.loaded:
if self.ssh_connection is False:
self._open_ssh()
try:
self... | [
"def",
"commit_config",
"(",
"self",
")",
":",
"if",
"self",
".",
"loaded",
":",
"if",
"self",
".",
"ssh_connection",
"is",
"False",
":",
"self",
".",
"_open_ssh",
"(",
")",
"try",
":",
"self",
".",
"ssh_device",
".",
"commit",
"(",
")",
"time",
".",... | Netmiko is being used to commit the configuration because it takes
a better care of results compared to pan-python. | [
"Netmiko",
"is",
"being",
"used",
"to",
"commit",
"the",
"configuration",
"because",
"it",
"takes",
"a",
"better",
"care",
"of",
"results",
"compared",
"to",
"pan",
"-",
"python",
"."
] | 9210a81a7a4a47c724d169031414a0743de4b035 | https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L302-L321 | train |
napalm-automation-community/napalm-panos | napalm_panos/panos.py | PANOSDriver.rollback | def rollback(self):
"""
Netmiko is being used to commit the rollback configuration because
it takes a better care of results compared to pan-python.
"""
if self.changed:
rollback_cmd = '<load><config><from>{0}</from></config></load>'.format(self.backup_file)
... | python | def rollback(self):
"""
Netmiko is being used to commit the rollback configuration because
it takes a better care of results compared to pan-python.
"""
if self.changed:
rollback_cmd = '<load><config><from>{0}</from></config></load>'.format(self.backup_file)
... | [
"def",
"rollback",
"(",
"self",
")",
":",
"if",
"self",
".",
"changed",
":",
"rollback_cmd",
"=",
"'<load><config><from>{0}</from></config></load>'",
".",
"format",
"(",
"self",
".",
"backup_file",
")",
"self",
".",
"device",
".",
"op",
"(",
"cmd",
"=",
"rol... | Netmiko is being used to commit the rollback configuration because
it takes a better care of results compared to pan-python. | [
"Netmiko",
"is",
"being",
"used",
"to",
"commit",
"the",
"rollback",
"configuration",
"because",
"it",
"takes",
"a",
"better",
"care",
"of",
"results",
"compared",
"to",
"pan",
"-",
"python",
"."
] | 9210a81a7a4a47c724d169031414a0743de4b035 | https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L334-L352 | train |
napalm-automation-community/napalm-panos | napalm_panos/panos.py | PANOSDriver.get_lldp_neighbors | def get_lldp_neighbors(self):
"""Return LLDP neighbors details."""
neighbors = {}
cmd = '<show><lldp><neighbors>all</neighbors></lldp></show>'
try:
self.device.op(cmd=cmd)
lldp_table_xml = xmltodict.parse(self.device.xml_root())
lldp_table_json = jso... | python | def get_lldp_neighbors(self):
"""Return LLDP neighbors details."""
neighbors = {}
cmd = '<show><lldp><neighbors>all</neighbors></lldp></show>'
try:
self.device.op(cmd=cmd)
lldp_table_xml = xmltodict.parse(self.device.xml_root())
lldp_table_json = jso... | [
"def",
"get_lldp_neighbors",
"(",
"self",
")",
":",
"neighbors",
"=",
"{",
"}",
"cmd",
"=",
"'<show><lldp><neighbors>all</neighbors></lldp></show>'",
"try",
":",
"self",
".",
"device",
".",
"op",
"(",
"cmd",
"=",
"cmd",
")",
"lldp_table_xml",
"=",
"xmltodict",
... | Return LLDP neighbors details. | [
"Return",
"LLDP",
"neighbors",
"details",
"."
] | 9210a81a7a4a47c724d169031414a0743de4b035 | https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L398-L430 | train |
napalm-automation-community/napalm-panos | napalm_panos/panos.py | PANOSDriver.get_route_to | def get_route_to(self, destination='', protocol=''):
"""Return route details to a specific destination, learned from a certain protocol."""
# Note, it should be possible to query the FIB:
# "<show><routing><fib></fib></routing></show>"
# To add informations to this getter
routes... | python | def get_route_to(self, destination='', protocol=''):
"""Return route details to a specific destination, learned from a certain protocol."""
# Note, it should be possible to query the FIB:
# "<show><routing><fib></fib></routing></show>"
# To add informations to this getter
routes... | [
"def",
"get_route_to",
"(",
"self",
",",
"destination",
"=",
"''",
",",
"protocol",
"=",
"''",
")",
":",
"# Note, it should be possible to query the FIB:",
"# \"<show><routing><fib></fib></routing></show>\"",
"# To add informations to this getter",
"routes",
"=",
"{",
"}",
... | Return route details to a specific destination, learned from a certain protocol. | [
"Return",
"route",
"details",
"to",
"a",
"specific",
"destination",
"learned",
"from",
"a",
"certain",
"protocol",
"."
] | 9210a81a7a4a47c724d169031414a0743de4b035 | https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L432-L507 | train |
napalm-automation-community/napalm-panos | napalm_panos/panos.py | PANOSDriver.get_interfaces_ip | def get_interfaces_ip(self):
'''Return IP interface data.'''
def extract_ip_info(parsed_intf_dict):
'''
IPv4:
- Primary IP is in the '<ip>' tag. If no v4 is configured the return value is 'N/A'.
- Secondary IP's are in '<addr>'. If no secondaries, thi... | python | def get_interfaces_ip(self):
'''Return IP interface data.'''
def extract_ip_info(parsed_intf_dict):
'''
IPv4:
- Primary IP is in the '<ip>' tag. If no v4 is configured the return value is 'N/A'.
- Secondary IP's are in '<addr>'. If no secondaries, thi... | [
"def",
"get_interfaces_ip",
"(",
"self",
")",
":",
"def",
"extract_ip_info",
"(",
"parsed_intf_dict",
")",
":",
"'''\n IPv4:\n - Primary IP is in the '<ip>' tag. If no v4 is configured the return value is 'N/A'.\n - Secondary IP's are in '<addr>'. If no s... | Return IP interface data. | [
"Return",
"IP",
"interface",
"data",
"."
] | 9210a81a7a4a47c724d169031414a0743de4b035 | https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L561-L660 | train |
timknip/pycsg | csg/core.py | CSG.refine | def refine(self):
"""
Return a refined CSG. To each polygon, a middle point is added to each edge and to the center
of the polygon
"""
newCSG = CSG()
for poly in self.polygons:
verts = poly.vertices
numVerts = len(verts)
if numVerts ... | python | def refine(self):
"""
Return a refined CSG. To each polygon, a middle point is added to each edge and to the center
of the polygon
"""
newCSG = CSG()
for poly in self.polygons:
verts = poly.vertices
numVerts = len(verts)
if numVerts ... | [
"def",
"refine",
"(",
"self",
")",
":",
"newCSG",
"=",
"CSG",
"(",
")",
"for",
"poly",
"in",
"self",
".",
"polygons",
":",
"verts",
"=",
"poly",
".",
"vertices",
"numVerts",
"=",
"len",
"(",
"verts",
")",
"if",
"numVerts",
"==",
"0",
":",
"continue... | Return a refined CSG. To each polygon, a middle point is added to each edge and to the center
of the polygon | [
"Return",
"a",
"refined",
"CSG",
".",
"To",
"each",
"polygon",
"a",
"middle",
"point",
"is",
"added",
"to",
"each",
"edge",
"and",
"to",
"the",
"center",
"of",
"the",
"polygon"
] | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L75-L111 | train |
timknip/pycsg | csg/core.py | CSG.translate | def translate(self, disp):
"""
Translate Geometry.
disp: displacement (array of floats)
"""
d = Vector(disp[0], disp[1], disp[2])
for poly in self.polygons:
for v in poly.vertices:
v.pos = v.pos.plus(d) | python | def translate(self, disp):
"""
Translate Geometry.
disp: displacement (array of floats)
"""
d = Vector(disp[0], disp[1], disp[2])
for poly in self.polygons:
for v in poly.vertices:
v.pos = v.pos.plus(d) | [
"def",
"translate",
"(",
"self",
",",
"disp",
")",
":",
"d",
"=",
"Vector",
"(",
"disp",
"[",
"0",
"]",
",",
"disp",
"[",
"1",
"]",
",",
"disp",
"[",
"2",
"]",
")",
"for",
"poly",
"in",
"self",
".",
"polygons",
":",
"for",
"v",
"in",
"poly",
... | Translate Geometry.
disp: displacement (array of floats) | [
"Translate",
"Geometry",
".",
"disp",
":",
"displacement",
"(",
"array",
"of",
"floats",
")"
] | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L113-L121 | train |
timknip/pycsg | csg/core.py | CSG.rotate | def rotate(self, axis, angleDeg):
"""
Rotate geometry.
axis: axis of rotation (array of floats)
angleDeg: rotation angle in degrees
"""
ax = Vector(axis[0], axis[1], axis[2]).unit()
cosAngle = math.cos(math.pi * angleDeg / 180.)
sinAngle = math.sin(m... | python | def rotate(self, axis, angleDeg):
"""
Rotate geometry.
axis: axis of rotation (array of floats)
angleDeg: rotation angle in degrees
"""
ax = Vector(axis[0], axis[1], axis[2]).unit()
cosAngle = math.cos(math.pi * angleDeg / 180.)
sinAngle = math.sin(m... | [
"def",
"rotate",
"(",
"self",
",",
"axis",
",",
"angleDeg",
")",
":",
"ax",
"=",
"Vector",
"(",
"axis",
"[",
"0",
"]",
",",
"axis",
"[",
"1",
"]",
",",
"axis",
"[",
"2",
"]",
")",
".",
"unit",
"(",
")",
"cosAngle",
"=",
"math",
".",
"cos",
... | Rotate geometry.
axis: axis of rotation (array of floats)
angleDeg: rotation angle in degrees | [
"Rotate",
"geometry",
".",
"axis",
":",
"axis",
"of",
"rotation",
"(",
"array",
"of",
"floats",
")",
"angleDeg",
":",
"rotation",
"angle",
"in",
"degrees"
] | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L124-L152 | train |
timknip/pycsg | csg/core.py | CSG.toVerticesAndPolygons | def toVerticesAndPolygons(self):
"""
Return list of vertices, polygons (cells), and the total
number of vertex indices in the polygon connectivity list
(count).
"""
offset = 1.234567890
verts = []
polys = []
vertexIndexMap = {}
count = 0
... | python | def toVerticesAndPolygons(self):
"""
Return list of vertices, polygons (cells), and the total
number of vertex indices in the polygon connectivity list
(count).
"""
offset = 1.234567890
verts = []
polys = []
vertexIndexMap = {}
count = 0
... | [
"def",
"toVerticesAndPolygons",
"(",
"self",
")",
":",
"offset",
"=",
"1.234567890",
"verts",
"=",
"[",
"]",
"polys",
"=",
"[",
"]",
"vertexIndexMap",
"=",
"{",
"}",
"count",
"=",
"0",
"for",
"poly",
"in",
"self",
".",
"polygons",
":",
"verts",
"=",
... | Return list of vertices, polygons (cells), and the total
number of vertex indices in the polygon connectivity list
(count). | [
"Return",
"list",
"of",
"vertices",
"polygons",
"(",
"cells",
")",
"and",
"the",
"total",
"number",
"of",
"vertex",
"indices",
"in",
"the",
"polygon",
"connectivity",
"list",
"(",
"count",
")",
"."
] | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L154-L193 | train |
timknip/pycsg | csg/core.py | CSG.saveVTK | def saveVTK(self, filename):
"""
Save polygons in VTK file.
"""
with open(filename, 'w') as f:
f.write('# vtk DataFile Version 3.0\n')
f.write('pycsg output\n')
f.write('ASCII\n')
f.write('DATASET POLYDATA\n')
verts, ce... | python | def saveVTK(self, filename):
"""
Save polygons in VTK file.
"""
with open(filename, 'w') as f:
f.write('# vtk DataFile Version 3.0\n')
f.write('pycsg output\n')
f.write('ASCII\n')
f.write('DATASET POLYDATA\n')
verts, ce... | [
"def",
"saveVTK",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"'# vtk DataFile Version 3.0\\n'",
")",
"f",
".",
"write",
"(",
"'pycsg output\\n'",
")",
"f",
".",
"wri... | Save polygons in VTK file. | [
"Save",
"polygons",
"in",
"VTK",
"file",
"."
] | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L195-L216 | train |
timknip/pycsg | csg/core.py | CSG.union | def union(self, csg):
"""
Return a new CSG solid representing space in either this solid or in the
solid `csg`. Neither this solid nor the solid `csg` are modified.::
A.union(B)
+-------+ +-------+
| | | |
... | python | def union(self, csg):
"""
Return a new CSG solid representing space in either this solid or in the
solid `csg`. Neither this solid nor the solid `csg` are modified.::
A.union(B)
+-------+ +-------+
| | | |
... | [
"def",
"union",
"(",
"self",
",",
"csg",
")",
":",
"a",
"=",
"BSPNode",
"(",
"self",
".",
"clone",
"(",
")",
".",
"polygons",
")",
"b",
"=",
"BSPNode",
"(",
"csg",
".",
"clone",
"(",
")",
".",
"polygons",
")",
"a",
".",
"clipTo",
"(",
"b",
")... | Return a new CSG solid representing space in either this solid or in the
solid `csg`. Neither this solid nor the solid `csg` are modified.::
A.union(B)
+-------+ +-------+
| | | |
| A | | |
... | [
"Return",
"a",
"new",
"CSG",
"solid",
"representing",
"space",
"in",
"either",
"this",
"solid",
"or",
"in",
"the",
"solid",
"csg",
".",
"Neither",
"this",
"solid",
"nor",
"the",
"solid",
"csg",
"are",
"modified",
".",
"::",
"A",
".",
"union",
"(",
"B",... | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L218-L242 | train |
timknip/pycsg | csg/core.py | CSG.inverse | def inverse(self):
"""
Return a new CSG solid with solid and empty space switched. This solid is
not modified.
"""
csg = self.clone()
map(lambda p: p.flip(), csg.polygons)
return csg | python | def inverse(self):
"""
Return a new CSG solid with solid and empty space switched. This solid is
not modified.
"""
csg = self.clone()
map(lambda p: p.flip(), csg.polygons)
return csg | [
"def",
"inverse",
"(",
"self",
")",
":",
"csg",
"=",
"self",
".",
"clone",
"(",
")",
"map",
"(",
"lambda",
"p",
":",
"p",
".",
"flip",
"(",
")",
",",
"csg",
".",
"polygons",
")",
"return",
"csg"
] | Return a new CSG solid with solid and empty space switched. This solid is
not modified. | [
"Return",
"a",
"new",
"CSG",
"solid",
"with",
"solid",
"and",
"empty",
"space",
"switched",
".",
"This",
"solid",
"is",
"not",
"modified",
"."
] | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L308-L315 | train |
timknip/pycsg | csg/core.py | CSG.cube | def cube(cls, center=[0,0,0], radius=[1,1,1]):
"""
Construct an axis-aligned solid cuboid. Optional parameters are `center` and
`radius`, which default to `[0, 0, 0]` and `[1, 1, 1]`. The radius can be
specified using a single number or a list of three numbers, one for each axis.
... | python | def cube(cls, center=[0,0,0], radius=[1,1,1]):
"""
Construct an axis-aligned solid cuboid. Optional parameters are `center` and
`radius`, which default to `[0, 0, 0]` and `[1, 1, 1]`. The radius can be
specified using a single number or a list of three numbers, one for each axis.
... | [
"def",
"cube",
"(",
"cls",
",",
"center",
"=",
"[",
"0",
",",
"0",
",",
"0",
"]",
",",
"radius",
"=",
"[",
"1",
",",
"1",
",",
"1",
"]",
")",
":",
"c",
"=",
"Vector",
"(",
"0",
",",
"0",
",",
"0",
")",
"r",
"=",
"[",
"1",
",",
"1",
... | Construct an axis-aligned solid cuboid. Optional parameters are `center` and
`radius`, which default to `[0, 0, 0]` and `[1, 1, 1]`. The radius can be
specified using a single number or a list of three numbers, one for each axis.
Example code::
cube = CSG.cube(
... | [
"Construct",
"an",
"axis",
"-",
"aligned",
"solid",
"cuboid",
".",
"Optional",
"parameters",
"are",
"center",
"and",
"radius",
"which",
"default",
"to",
"[",
"0",
"0",
"0",
"]",
"and",
"[",
"1",
"1",
"1",
"]",
".",
"The",
"radius",
"can",
"be",
"spec... | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L318-L356 | train |
timknip/pycsg | csg/core.py | CSG.sphere | def sphere(cls, **kwargs):
""" Returns a sphere.
Kwargs:
center (list): Center of sphere, default [0, 0, 0].
radius (float): Radius of sphere, default 1.0.
slices (int): Number of slices, default 16.
... | python | def sphere(cls, **kwargs):
""" Returns a sphere.
Kwargs:
center (list): Center of sphere, default [0, 0, 0].
radius (float): Radius of sphere, default 1.0.
slices (int): Number of slices, default 16.
... | [
"def",
"sphere",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"center",
"=",
"kwargs",
".",
"get",
"(",
"'center'",
",",
"[",
"0.0",
",",
"0.0",
",",
"0.0",
"]",
")",
"if",
"isinstance",
"(",
"center",
",",
"float",
")",
":",
"center",
"=",
"... | Returns a sphere.
Kwargs:
center (list): Center of sphere, default [0, 0, 0].
radius (float): Radius of sphere, default 1.0.
slices (int): Number of slices, default 16.
stacks (int... | [
"Returns",
"a",
"sphere",
".",
"Kwargs",
":",
"center",
"(",
"list",
")",
":",
"Center",
"of",
"sphere",
"default",
"[",
"0",
"0",
"0",
"]",
".",
"radius",
"(",
"float",
")",
":",
"Radius",
"of",
"sphere",
"default",
"1",
".",
"0",
".",
"slices",
... | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L359-L451 | train |
timknip/pycsg | csg/core.py | CSG.cylinder | def cylinder(cls, **kwargs):
""" Returns a cylinder.
Kwargs:
start (list): Start of cylinder, default [0, -1, 0].
end (list): End of cylinder, default [0, 1, 0].
radius (float): Radius of cylinder, default... | python | def cylinder(cls, **kwargs):
""" Returns a cylinder.
Kwargs:
start (list): Start of cylinder, default [0, -1, 0].
end (list): End of cylinder, default [0, 1, 0].
radius (float): Radius of cylinder, default... | [
"def",
"cylinder",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"kwargs",
".",
"get",
"(",
"'start'",
",",
"Vector",
"(",
"0.0",
",",
"-",
"1.0",
",",
"0.0",
")",
")",
"e",
"=",
"kwargs",
".",
"get",
"(",
"'end'",
",",
"Vector",
"... | Returns a cylinder.
Kwargs:
start (list): Start of cylinder, default [0, -1, 0].
end (list): End of cylinder, default [0, 1, 0].
radius (float): Radius of cylinder, default 1.0.
sl... | [
"Returns",
"a",
"cylinder",
".",
"Kwargs",
":",
"start",
"(",
"list",
")",
":",
"Start",
"of",
"cylinder",
"default",
"[",
"0",
"-",
"1",
"0",
"]",
".",
"end",
"(",
"list",
")",
":",
"End",
"of",
"cylinder",
"default",
"[",
"0",
"1",
"0",
"]",
... | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L454-L508 | train |
timknip/pycsg | csg/core.py | CSG.cone | def cone(cls, **kwargs):
""" Returns a cone.
Kwargs:
start (list): Start of cone, default [0, -1, 0].
end (list): End of cone, default [0, 1, 0].
radius (float): Maximum radius of cone at start, default 1.... | python | def cone(cls, **kwargs):
""" Returns a cone.
Kwargs:
start (list): Start of cone, default [0, -1, 0].
end (list): End of cone, default [0, 1, 0].
radius (float): Maximum radius of cone at start, default 1.... | [
"def",
"cone",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"kwargs",
".",
"get",
"(",
"'start'",
",",
"Vector",
"(",
"0.0",
",",
"-",
"1.0",
",",
"0.0",
")",
")",
"e",
"=",
"kwargs",
".",
"get",
"(",
"'end'",
",",
"Vector",
"(",
... | Returns a cone.
Kwargs:
start (list): Start of cone, default [0, -1, 0].
end (list): End of cone, default [0, 1, 0].
radius (float): Maximum radius of cone at start, default 1.0.
s... | [
"Returns",
"a",
"cone",
".",
"Kwargs",
":",
"start",
"(",
"list",
")",
":",
"Start",
"of",
"cone",
"default",
"[",
"0",
"-",
"1",
"0",
"]",
".",
"end",
"(",
"list",
")",
":",
"End",
"of",
"cone",
"default",
"[",
"0",
"1",
"0",
"]",
".",
"radi... | b8f9710fd15c38dcc275d56a2108f604af38dcc8 | https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L511-L573 | train |
vberlier/nbtlib | nbtlib/nbt.py | load | def load(filename, *, gzipped=None, byteorder='big'):
"""Load the nbt file at the specified location.
By default, the function will figure out by itself if the file is
gzipped before loading it. You can pass a boolean to the `gzipped`
keyword only argument to specify explicitly whether the file is... | python | def load(filename, *, gzipped=None, byteorder='big'):
"""Load the nbt file at the specified location.
By default, the function will figure out by itself if the file is
gzipped before loading it. You can pass a boolean to the `gzipped`
keyword only argument to specify explicitly whether the file is... | [
"def",
"load",
"(",
"filename",
",",
"*",
",",
"gzipped",
"=",
"None",
",",
"byteorder",
"=",
"'big'",
")",
":",
"if",
"gzipped",
"is",
"not",
"None",
":",
"return",
"File",
".",
"load",
"(",
"filename",
",",
"gzipped",
",",
"byteorder",
")",
"# if w... | Load the nbt file at the specified location.
By default, the function will figure out by itself if the file is
gzipped before loading it. You can pass a boolean to the `gzipped`
keyword only argument to specify explicitly whether the file is
compressed or not. You can also use the `byteorder` keyw... | [
"Load",
"the",
"nbt",
"file",
"at",
"the",
"specified",
"location",
".",
"By",
"default",
"the",
"function",
"will",
"figure",
"out",
"by",
"itself",
"if",
"the",
"file",
"is",
"gzipped",
"before",
"loading",
"it",
".",
"You",
"can",
"pass",
"a",
"boolea... | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/nbt.py#L17-L37 | train |
vberlier/nbtlib | nbtlib/nbt.py | File.from_buffer | def from_buffer(cls, buff, byteorder='big'):
"""Load nbt file from a file-like object.
The `buff` argument can be either a standard `io.BufferedReader`
for uncompressed nbt or a `gzip.GzipFile` for gzipped nbt data.
"""
self = cls.parse(buff, byteorder)
self.filen... | python | def from_buffer(cls, buff, byteorder='big'):
"""Load nbt file from a file-like object.
The `buff` argument can be either a standard `io.BufferedReader`
for uncompressed nbt or a `gzip.GzipFile` for gzipped nbt data.
"""
self = cls.parse(buff, byteorder)
self.filen... | [
"def",
"from_buffer",
"(",
"cls",
",",
"buff",
",",
"byteorder",
"=",
"'big'",
")",
":",
"self",
"=",
"cls",
".",
"parse",
"(",
"buff",
",",
"byteorder",
")",
"self",
".",
"filename",
"=",
"getattr",
"(",
"buff",
",",
"'name'",
",",
"self",
".",
"f... | Load nbt file from a file-like object.
The `buff` argument can be either a standard `io.BufferedReader`
for uncompressed nbt or a `gzip.GzipFile` for gzipped nbt data. | [
"Load",
"nbt",
"file",
"from",
"a",
"file",
"-",
"like",
"object",
".",
"The",
"buff",
"argument",
"can",
"be",
"either",
"a",
"standard",
"io",
".",
"BufferedReader",
"for",
"uncompressed",
"nbt",
"or",
"a",
"gzip",
".",
"GzipFile",
"for",
"gzipped",
"n... | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/nbt.py#L90-L100 | train |
vberlier/nbtlib | nbtlib/nbt.py | File.load | def load(cls, filename, gzipped, byteorder='big'):
"""Read, parse and return the file at the specified location.
The `gzipped` argument is used to indicate if the specified
file is gzipped. The `byteorder` argument lets you specify
whether the file is big-endian or little-endian.
... | python | def load(cls, filename, gzipped, byteorder='big'):
"""Read, parse and return the file at the specified location.
The `gzipped` argument is used to indicate if the specified
file is gzipped. The `byteorder` argument lets you specify
whether the file is big-endian or little-endian.
... | [
"def",
"load",
"(",
"cls",
",",
"filename",
",",
"gzipped",
",",
"byteorder",
"=",
"'big'",
")",
":",
"open_file",
"=",
"gzip",
".",
"open",
"if",
"gzipped",
"else",
"open",
"with",
"open_file",
"(",
"filename",
",",
"'rb'",
")",
"as",
"buff",
":",
"... | Read, parse and return the file at the specified location.
The `gzipped` argument is used to indicate if the specified
file is gzipped. The `byteorder` argument lets you specify
whether the file is big-endian or little-endian. | [
"Read",
"parse",
"and",
"return",
"the",
"file",
"at",
"the",
"specified",
"location",
".",
"The",
"gzipped",
"argument",
"is",
"used",
"to",
"indicate",
"if",
"the",
"specified",
"file",
"is",
"gzipped",
".",
"The",
"byteorder",
"argument",
"lets",
"you",
... | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/nbt.py#L103-L112 | train |
vberlier/nbtlib | nbtlib/nbt.py | File.save | def save(self, filename=None, *, gzipped=None, byteorder=None):
"""Write the file at the specified location.
The `gzipped` keyword only argument indicates if the file should
be gzipped. The `byteorder` keyword only argument lets you
specify whether the file should be big-endian or ... | python | def save(self, filename=None, *, gzipped=None, byteorder=None):
"""Write the file at the specified location.
The `gzipped` keyword only argument indicates if the file should
be gzipped. The `byteorder` keyword only argument lets you
specify whether the file should be big-endian or ... | [
"def",
"save",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"*",
",",
"gzipped",
"=",
"None",
",",
"byteorder",
"=",
"None",
")",
":",
"if",
"gzipped",
"is",
"None",
":",
"gzipped",
"=",
"self",
".",
"gzipped",
"if",
"filename",
"is",
"None",
":... | Write the file at the specified location.
The `gzipped` keyword only argument indicates if the file should
be gzipped. The `byteorder` keyword only argument lets you
specify whether the file should be big-endian or little-endian.
If the method is called without any argument, it w... | [
"Write",
"the",
"file",
"at",
"the",
"specified",
"location",
".",
"The",
"gzipped",
"keyword",
"only",
"argument",
"indicates",
"if",
"the",
"file",
"should",
"be",
"gzipped",
".",
"The",
"byteorder",
"keyword",
"only",
"argument",
"lets",
"you",
"specify",
... | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/nbt.py#L114-L137 | train |
aheadley/python-crunchyroll | crunchyroll/util.py | return_collection | def return_collection(collection_type):
"""Change method return value from raw API output to collection of models
"""
def outer_func(func):
@functools.wraps(func)
def inner_func(self, *pargs, **kwargs):
result = func(self, *pargs, **kwargs)
return list(map(collection_... | python | def return_collection(collection_type):
"""Change method return value from raw API output to collection of models
"""
def outer_func(func):
@functools.wraps(func)
def inner_func(self, *pargs, **kwargs):
result = func(self, *pargs, **kwargs)
return list(map(collection_... | [
"def",
"return_collection",
"(",
"collection_type",
")",
":",
"def",
"outer_func",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"inner_func",
"(",
"self",
",",
"*",
"pargs",
",",
"*",
"*",
"kwargs",
")",
":",
"result"... | Change method return value from raw API output to collection of models | [
"Change",
"method",
"return",
"value",
"from",
"raw",
"API",
"output",
"to",
"collection",
"of",
"models"
] | 9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178 | https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/util.py#L47-L56 | train |
tulsawebdevs/django-multi-gtfs | multigtfs/models/stop.py | post_save_stop | def post_save_stop(sender, instance, **kwargs):
'''Update related objects when the Stop is updated'''
from multigtfs.models.trip import Trip
trip_ids = instance.stoptime_set.filter(
trip__shape=None).values_list('trip_id', flat=True).distinct()
for trip in Trip.objects.filter(id__in=trip_ids):
... | python | def post_save_stop(sender, instance, **kwargs):
'''Update related objects when the Stop is updated'''
from multigtfs.models.trip import Trip
trip_ids = instance.stoptime_set.filter(
trip__shape=None).values_list('trip_id', flat=True).distinct()
for trip in Trip.objects.filter(id__in=trip_ids):
... | [
"def",
"post_save_stop",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"multigtfs",
".",
"models",
".",
"trip",
"import",
"Trip",
"trip_ids",
"=",
"instance",
".",
"stoptime_set",
".",
"filter",
"(",
"trip__shape",
"=",
"None",... | Update related objects when the Stop is updated | [
"Update",
"related",
"objects",
"when",
"the",
"Stop",
"is",
"updated"
] | 8c442bfb67e87566c24a7364d8fa0aacd4a0a652 | https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/stop.py#L166-L172 | train |
aheadley/python-crunchyroll | crunchyroll/apis/android_manga.py | AndroidMangaApi._do_post_request_tasks | def _do_post_request_tasks(self, response_data):
"""Handle actions that need to be done with every response
I'm not sure what these session_ops are actually used for yet, seems to
be a way to tell the client to do *something* if needed.
"""
try:
sess_ops = response_d... | python | def _do_post_request_tasks(self, response_data):
"""Handle actions that need to be done with every response
I'm not sure what these session_ops are actually used for yet, seems to
be a way to tell the client to do *something* if needed.
"""
try:
sess_ops = response_d... | [
"def",
"_do_post_request_tasks",
"(",
"self",
",",
"response_data",
")",
":",
"try",
":",
"sess_ops",
"=",
"response_data",
".",
"get",
"(",
"'ops'",
",",
"[",
"]",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"self",
".",
"_session_ops",
"."... | Handle actions that need to be done with every response
I'm not sure what these session_ops are actually used for yet, seems to
be a way to tell the client to do *something* if needed. | [
"Handle",
"actions",
"that",
"need",
"to",
"be",
"done",
"with",
"every",
"response"
] | 9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178 | https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L94-L105 | train |
aheadley/python-crunchyroll | crunchyroll/apis/android_manga.py | AndroidMangaApi._build_request | def _build_request(self, method, url, params=None):
"""Build a function to do an API request
"We have to go deeper" or "It's functions all the way down!"
"""
full_params = self._get_base_params()
if params is not None:
full_params.update(params)
try:
... | python | def _build_request(self, method, url, params=None):
"""Build a function to do an API request
"We have to go deeper" or "It's functions all the way down!"
"""
full_params = self._get_base_params()
if params is not None:
full_params.update(params)
try:
... | [
"def",
"_build_request",
"(",
"self",
",",
"method",
",",
"url",
",",
"params",
"=",
"None",
")",
":",
"full_params",
"=",
"self",
".",
"_get_base_params",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"full_params",
".",
"update",
"(",
"params",
... | Build a function to do an API request
"We have to go deeper" or "It's functions all the way down!" | [
"Build",
"a",
"function",
"to",
"do",
"an",
"API",
"request"
] | 9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178 | https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L107-L161 | train |
aheadley/python-crunchyroll | crunchyroll/apis/android_manga.py | AndroidMangaApi._build_request_url | def _build_request_url(self, secure, api_method):
"""Build a URL for a API method request
"""
if secure:
proto = ANDROID_MANGA.PROTOCOL_SECURE
else:
proto = ANDROID_MANGA.PROTOCOL_INSECURE
req_url = ANDROID_MANGA.API_URL.format(
protocol=proto,... | python | def _build_request_url(self, secure, api_method):
"""Build a URL for a API method request
"""
if secure:
proto = ANDROID_MANGA.PROTOCOL_SECURE
else:
proto = ANDROID_MANGA.PROTOCOL_INSECURE
req_url = ANDROID_MANGA.API_URL.format(
protocol=proto,... | [
"def",
"_build_request_url",
"(",
"self",
",",
"secure",
",",
"api_method",
")",
":",
"if",
"secure",
":",
"proto",
"=",
"ANDROID_MANGA",
".",
"PROTOCOL_SECURE",
"else",
":",
"proto",
"=",
"ANDROID_MANGA",
".",
"PROTOCOL_INSECURE",
"req_url",
"=",
"ANDROID_MANGA... | Build a URL for a API method request | [
"Build",
"a",
"URL",
"for",
"a",
"API",
"method",
"request"
] | 9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178 | https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L163-L174 | train |
aheadley/python-crunchyroll | crunchyroll/apis/android_manga.py | AndroidMangaApi.cr_login | def cr_login(self, response):
"""
Login using email/username and password, used to get the auth token
@param str account
@param str password
@param str hash_id (optional)
"""
self._state_params['auth'] = response['auth']
self._user_data = response['user']... | python | def cr_login(self, response):
"""
Login using email/username and password, used to get the auth token
@param str account
@param str password
@param str hash_id (optional)
"""
self._state_params['auth'] = response['auth']
self._user_data = response['user']... | [
"def",
"cr_login",
"(",
"self",
",",
"response",
")",
":",
"self",
".",
"_state_params",
"[",
"'auth'",
"]",
"=",
"response",
"[",
"'auth'",
"]",
"self",
".",
"_user_data",
"=",
"response",
"[",
"'user'",
"]",
"if",
"not",
"self",
".",
"logged_in",
":"... | Login using email/username and password, used to get the auth token
@param str account
@param str password
@param str hash_id (optional) | [
"Login",
"using",
"email",
"/",
"username",
"and",
"password",
"used",
"to",
"get",
"the",
"auth",
"token"
] | 9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178 | https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L251-L262 | train |
tulsawebdevs/django-multi-gtfs | multigtfs/models/fields/seconds.py | SecondsField.from_db_value | def from_db_value(self, value, expression, connection, context):
'''Handle data loaded from database.'''
if value is None:
return value
return self.parse_seconds(value) | python | def from_db_value(self, value, expression, connection, context):
'''Handle data loaded from database.'''
if value is None:
return value
return self.parse_seconds(value) | [
"def",
"from_db_value",
"(",
"self",
",",
"value",
",",
"expression",
",",
"connection",
",",
"context",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"value",
"return",
"self",
".",
"parse_seconds",
"(",
"value",
")"
] | Handle data loaded from database. | [
"Handle",
"data",
"loaded",
"from",
"database",
"."
] | 8c442bfb67e87566c24a7364d8fa0aacd4a0a652 | https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/fields/seconds.py#L72-L76 | train |
tulsawebdevs/django-multi-gtfs | multigtfs/models/fields/seconds.py | SecondsField.to_python | def to_python(self, value):
'''Handle data from serialization and form clean() methods.'''
if isinstance(value, Seconds):
return value
if value in self.empty_values:
return None
return self.parse_seconds(value) | python | def to_python(self, value):
'''Handle data from serialization and form clean() methods.'''
if isinstance(value, Seconds):
return value
if value in self.empty_values:
return None
return self.parse_seconds(value) | [
"def",
"to_python",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Seconds",
")",
":",
"return",
"value",
"if",
"value",
"in",
"self",
".",
"empty_values",
":",
"return",
"None",
"return",
"self",
".",
"parse_seconds",
"(",
... | Handle data from serialization and form clean() methods. | [
"Handle",
"data",
"from",
"serialization",
"and",
"form",
"clean",
"()",
"methods",
"."
] | 8c442bfb67e87566c24a7364d8fa0aacd4a0a652 | https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/fields/seconds.py#L78-L84 | train |
tulsawebdevs/django-multi-gtfs | multigtfs/models/fields/seconds.py | SecondsField.parse_seconds | def parse_seconds(value):
'''
Parse string into Seconds instances.
Handled formats:
HH:MM:SS
HH:MM
SS
'''
svalue = str(value)
colons = svalue.count(':')
if colons == 2:
hours, minutes, seconds = [int(v) for v in svalue.split(':... | python | def parse_seconds(value):
'''
Parse string into Seconds instances.
Handled formats:
HH:MM:SS
HH:MM
SS
'''
svalue = str(value)
colons = svalue.count(':')
if colons == 2:
hours, minutes, seconds = [int(v) for v in svalue.split(':... | [
"def",
"parse_seconds",
"(",
"value",
")",
":",
"svalue",
"=",
"str",
"(",
"value",
")",
"colons",
"=",
"svalue",
".",
"count",
"(",
"':'",
")",
"if",
"colons",
"==",
"2",
":",
"hours",
",",
"minutes",
",",
"seconds",
"=",
"[",
"int",
"(",
"v",
"... | Parse string into Seconds instances.
Handled formats:
HH:MM:SS
HH:MM
SS | [
"Parse",
"string",
"into",
"Seconds",
"instances",
"."
] | 8c442bfb67e87566c24a7364d8fa0aacd4a0a652 | https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/fields/seconds.py#L87-L109 | train |
tulsawebdevs/django-multi-gtfs | multigtfs/models/fields/seconds.py | SecondsField.get_prep_value | def get_prep_value(self, value):
'''Prepare value for database storage.'''
if isinstance(value, Seconds):
return value.seconds
elif value:
return self.parse_seconds(value).seconds
else:
return None | python | def get_prep_value(self, value):
'''Prepare value for database storage.'''
if isinstance(value, Seconds):
return value.seconds
elif value:
return self.parse_seconds(value).seconds
else:
return None | [
"def",
"get_prep_value",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Seconds",
")",
":",
"return",
"value",
".",
"seconds",
"elif",
"value",
":",
"return",
"self",
".",
"parse_seconds",
"(",
"value",
")",
".",
"seconds",
... | Prepare value for database storage. | [
"Prepare",
"value",
"for",
"database",
"storage",
"."
] | 8c442bfb67e87566c24a7364d8fa0aacd4a0a652 | https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/fields/seconds.py#L111-L118 | train |
ppinard/matplotlib-colorbar | matplotlib_colorbar/colorbar.py | ColorbarCalculator.calculate_colorbar | def calculate_colorbar(self):
"""
Returns the positions and colors of all intervals inside the colorbar.
"""
self._base._process_values()
self._base._find_range()
X, Y = self._base._mesh()
C = self._base._values[:, np.newaxis]
return X, Y, C | python | def calculate_colorbar(self):
"""
Returns the positions and colors of all intervals inside the colorbar.
"""
self._base._process_values()
self._base._find_range()
X, Y = self._base._mesh()
C = self._base._values[:, np.newaxis]
return X, Y, C | [
"def",
"calculate_colorbar",
"(",
"self",
")",
":",
"self",
".",
"_base",
".",
"_process_values",
"(",
")",
"self",
".",
"_base",
".",
"_find_range",
"(",
")",
"X",
",",
"Y",
"=",
"self",
".",
"_base",
".",
"_mesh",
"(",
")",
"C",
"=",
"self",
".",... | Returns the positions and colors of all intervals inside the colorbar. | [
"Returns",
"the",
"positions",
"and",
"colors",
"of",
"all",
"intervals",
"inside",
"the",
"colorbar",
"."
] | d53748c54dd18ba5183bff8da3f11cfd107282e6 | https://github.com/ppinard/matplotlib-colorbar/blob/d53748c54dd18ba5183bff8da3f11cfd107282e6/matplotlib_colorbar/colorbar.py#L152-L160 | train |
ppinard/matplotlib-colorbar | matplotlib_colorbar/colorbar.py | ColorbarCalculator.calculate_ticks | def calculate_ticks(self):
"""
Returns the sequence of ticks (colorbar data locations),
ticklabels (strings), and the corresponding offset string.
"""
current_version = packaging.version.parse(matplotlib.__version__)
critical_version = packaging.version.parse('3.0.0')
... | python | def calculate_ticks(self):
"""
Returns the sequence of ticks (colorbar data locations),
ticklabels (strings), and the corresponding offset string.
"""
current_version = packaging.version.parse(matplotlib.__version__)
critical_version = packaging.version.parse('3.0.0')
... | [
"def",
"calculate_ticks",
"(",
"self",
")",
":",
"current_version",
"=",
"packaging",
".",
"version",
".",
"parse",
"(",
"matplotlib",
".",
"__version__",
")",
"critical_version",
"=",
"packaging",
".",
"version",
".",
"parse",
"(",
"'3.0.0'",
")",
"if",
"cu... | Returns the sequence of ticks (colorbar data locations),
ticklabels (strings), and the corresponding offset string. | [
"Returns",
"the",
"sequence",
"of",
"ticks",
"(",
"colorbar",
"data",
"locations",
")",
"ticklabels",
"(",
"strings",
")",
"and",
"the",
"corresponding",
"offset",
"string",
"."
] | d53748c54dd18ba5183bff8da3f11cfd107282e6 | https://github.com/ppinard/matplotlib-colorbar/blob/d53748c54dd18ba5183bff8da3f11cfd107282e6/matplotlib_colorbar/colorbar.py#L162-L174 | train |
aheadley/python-crunchyroll | crunchyroll/apis/scraper.py | ScraperApi.get_media_formats | def get_media_formats(self, media_id):
"""CR doesn't seem to provide the video_format and video_quality params
through any of the APIs so we have to scrape the video page
"""
url = (SCRAPER.API_URL + 'media-' + media_id).format(
protocol=SCRAPER.PROTOCOL_INSECURE)
for... | python | def get_media_formats(self, media_id):
"""CR doesn't seem to provide the video_format and video_quality params
through any of the APIs so we have to scrape the video page
"""
url = (SCRAPER.API_URL + 'media-' + media_id).format(
protocol=SCRAPER.PROTOCOL_INSECURE)
for... | [
"def",
"get_media_formats",
"(",
"self",
",",
"media_id",
")",
":",
"url",
"=",
"(",
"SCRAPER",
".",
"API_URL",
"+",
"'media-'",
"+",
"media_id",
")",
".",
"format",
"(",
"protocol",
"=",
"SCRAPER",
".",
"PROTOCOL_INSECURE",
")",
"format_pattern",
"=",
"re... | CR doesn't seem to provide the video_format and video_quality params
through any of the APIs so we have to scrape the video page | [
"CR",
"doesn",
"t",
"seem",
"to",
"provide",
"the",
"video_format",
"and",
"video_quality",
"params",
"through",
"any",
"of",
"the",
"APIs",
"so",
"we",
"have",
"to",
"scrape",
"the",
"video",
"page"
] | 9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178 | https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/scraper.py#L34-L53 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | parse_nbt | def parse_nbt(literal):
"""Parse a literal nbt string and return the resulting tag."""
parser = Parser(tokenize(literal))
tag = parser.parse()
cursor = parser.token_span[1]
leftover = literal[cursor:]
if leftover.strip():
parser.token_span = cursor, cursor + len(leftover)
raise ... | python | def parse_nbt(literal):
"""Parse a literal nbt string and return the resulting tag."""
parser = Parser(tokenize(literal))
tag = parser.parse()
cursor = parser.token_span[1]
leftover = literal[cursor:]
if leftover.strip():
parser.token_span = cursor, cursor + len(leftover)
raise ... | [
"def",
"parse_nbt",
"(",
"literal",
")",
":",
"parser",
"=",
"Parser",
"(",
"tokenize",
"(",
"literal",
")",
")",
"tag",
"=",
"parser",
".",
"parse",
"(",
")",
"cursor",
"=",
"parser",
".",
"token_span",
"[",
"1",
"]",
"leftover",
"=",
"literal",
"["... | Parse a literal nbt string and return the resulting tag. | [
"Parse",
"a",
"literal",
"nbt",
"string",
"and",
"return",
"the",
"resulting",
"tag",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L85-L96 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | tokenize | def tokenize(string):
"""Match and yield all the tokens of the input string."""
for match in TOKENS_REGEX.finditer(string):
yield Token(match.lastgroup, match.group().strip(), match.span()) | python | def tokenize(string):
"""Match and yield all the tokens of the input string."""
for match in TOKENS_REGEX.finditer(string):
yield Token(match.lastgroup, match.group().strip(), match.span()) | [
"def",
"tokenize",
"(",
"string",
")",
":",
"for",
"match",
"in",
"TOKENS_REGEX",
".",
"finditer",
"(",
"string",
")",
":",
"yield",
"Token",
"(",
"match",
".",
"lastgroup",
",",
"match",
".",
"group",
"(",
")",
".",
"strip",
"(",
")",
",",
"match",
... | Match and yield all the tokens of the input string. | [
"Match",
"and",
"yield",
"all",
"the",
"tokens",
"of",
"the",
"input",
"string",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L104-L107 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.next | def next(self):
"""Move to the next token in the token stream."""
self.current_token = next(self.token_stream, None)
if self.current_token is None:
self.token_span = self.token_span[1], self.token_span[1]
raise self.error('Unexpected end of input')
self.token_span... | python | def next(self):
"""Move to the next token in the token stream."""
self.current_token = next(self.token_stream, None)
if self.current_token is None:
self.token_span = self.token_span[1], self.token_span[1]
raise self.error('Unexpected end of input')
self.token_span... | [
"def",
"next",
"(",
"self",
")",
":",
"self",
".",
"current_token",
"=",
"next",
"(",
"self",
".",
"token_stream",
",",
"None",
")",
"if",
"self",
".",
"current_token",
"is",
"None",
":",
"self",
".",
"token_span",
"=",
"self",
".",
"token_span",
"[",
... | Move to the next token in the token stream. | [
"Move",
"to",
"the",
"next",
"token",
"in",
"the",
"token",
"stream",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L133-L140 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.parse | def parse(self):
"""Parse and return an nbt literal from the token stream."""
token_type = self.current_token.type.lower()
handler = getattr(self, f'parse_{token_type}', None)
if handler is None:
raise self.error(f'Invalid literal {self.current_token.value!r}')
return... | python | def parse(self):
"""Parse and return an nbt literal from the token stream."""
token_type = self.current_token.type.lower()
handler = getattr(self, f'parse_{token_type}', None)
if handler is None:
raise self.error(f'Invalid literal {self.current_token.value!r}')
return... | [
"def",
"parse",
"(",
"self",
")",
":",
"token_type",
"=",
"self",
".",
"current_token",
".",
"type",
".",
"lower",
"(",
")",
"handler",
"=",
"getattr",
"(",
"self",
",",
"f'parse_{token_type}'",
",",
"None",
")",
"if",
"handler",
"is",
"None",
":",
"ra... | Parse and return an nbt literal from the token stream. | [
"Parse",
"and",
"return",
"an",
"nbt",
"literal",
"from",
"the",
"token",
"stream",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L142-L148 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.parse_number | def parse_number(self):
"""Parse a number from the token stream."""
value = self.current_token.value
suffix = value[-1].lower()
try:
if suffix in NUMBER_SUFFIXES:
return NUMBER_SUFFIXES[suffix](value[:-1])
return Double(value) if '.' in value else... | python | def parse_number(self):
"""Parse a number from the token stream."""
value = self.current_token.value
suffix = value[-1].lower()
try:
if suffix in NUMBER_SUFFIXES:
return NUMBER_SUFFIXES[suffix](value[:-1])
return Double(value) if '.' in value else... | [
"def",
"parse_number",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"current_token",
".",
"value",
"suffix",
"=",
"value",
"[",
"-",
"1",
"]",
".",
"lower",
"(",
")",
"try",
":",
"if",
"suffix",
"in",
"NUMBER_SUFFIXES",
":",
"return",
"NUMBER_SUFF... | Parse a number from the token stream. | [
"Parse",
"a",
"number",
"from",
"the",
"token",
"stream",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L154-L164 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.parse_string | def parse_string(self):
"""Parse a regular unquoted string from the token stream."""
aliased_value = LITERAL_ALIASES.get(self.current_token.value.lower())
if aliased_value is not None:
return aliased_value
return String(self.current_token.value) | python | def parse_string(self):
"""Parse a regular unquoted string from the token stream."""
aliased_value = LITERAL_ALIASES.get(self.current_token.value.lower())
if aliased_value is not None:
return aliased_value
return String(self.current_token.value) | [
"def",
"parse_string",
"(",
"self",
")",
":",
"aliased_value",
"=",
"LITERAL_ALIASES",
".",
"get",
"(",
"self",
".",
"current_token",
".",
"value",
".",
"lower",
"(",
")",
")",
"if",
"aliased_value",
"is",
"not",
"None",
":",
"return",
"aliased_value",
"re... | Parse a regular unquoted string from the token stream. | [
"Parse",
"a",
"regular",
"unquoted",
"string",
"from",
"the",
"token",
"stream",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L166-L171 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.collect_tokens_until | def collect_tokens_until(self, token_type):
"""Yield the item tokens in a comma-separated tag collection."""
self.next()
if self.current_token.type == token_type:
return
while True:
yield self.current_token
self.next()
if self.current_tok... | python | def collect_tokens_until(self, token_type):
"""Yield the item tokens in a comma-separated tag collection."""
self.next()
if self.current_token.type == token_type:
return
while True:
yield self.current_token
self.next()
if self.current_tok... | [
"def",
"collect_tokens_until",
"(",
"self",
",",
"token_type",
")",
":",
"self",
".",
"next",
"(",
")",
"if",
"self",
".",
"current_token",
".",
"type",
"==",
"token_type",
":",
"return",
"while",
"True",
":",
"yield",
"self",
".",
"current_token",
"self",... | Yield the item tokens in a comma-separated tag collection. | [
"Yield",
"the",
"item",
"tokens",
"in",
"a",
"comma",
"-",
"separated",
"tag",
"collection",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L173-L189 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.parse_compound | def parse_compound(self):
"""Parse a compound from the token stream."""
compound_tag = Compound()
for token in self.collect_tokens_until('CLOSE_COMPOUND'):
item_key = token.value
if token.type not in ('NUMBER', 'STRING', 'QUOTED_STRING'):
raise self.error... | python | def parse_compound(self):
"""Parse a compound from the token stream."""
compound_tag = Compound()
for token in self.collect_tokens_until('CLOSE_COMPOUND'):
item_key = token.value
if token.type not in ('NUMBER', 'STRING', 'QUOTED_STRING'):
raise self.error... | [
"def",
"parse_compound",
"(",
"self",
")",
":",
"compound_tag",
"=",
"Compound",
"(",
")",
"for",
"token",
"in",
"self",
".",
"collect_tokens_until",
"(",
"'CLOSE_COMPOUND'",
")",
":",
"item_key",
"=",
"token",
".",
"value",
"if",
"token",
".",
"type",
"no... | Parse a compound from the token stream. | [
"Parse",
"a",
"compound",
"from",
"the",
"token",
"stream",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L191-L208 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.array_items | def array_items(self, number_type, *, number_suffix=''):
"""Parse and yield array items from the token stream."""
for token in self.collect_tokens_until('CLOSE_BRACKET'):
is_number = token.type == 'NUMBER'
value = token.value.lower()
if not (is_number and value.endswi... | python | def array_items(self, number_type, *, number_suffix=''):
"""Parse and yield array items from the token stream."""
for token in self.collect_tokens_until('CLOSE_BRACKET'):
is_number = token.type == 'NUMBER'
value = token.value.lower()
if not (is_number and value.endswi... | [
"def",
"array_items",
"(",
"self",
",",
"number_type",
",",
"*",
",",
"number_suffix",
"=",
"''",
")",
":",
"for",
"token",
"in",
"self",
".",
"collect_tokens_until",
"(",
"'CLOSE_BRACKET'",
")",
":",
"is_number",
"=",
"token",
".",
"type",
"==",
"'NUMBER'... | Parse and yield array items from the token stream. | [
"Parse",
"and",
"yield",
"array",
"items",
"from",
"the",
"token",
"stream",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L210-L218 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.parse_list | def parse_list(self):
"""Parse a list from the token stream."""
try:
return List([self.parse() for _ in
self.collect_tokens_until('CLOSE_BRACKET')])
except IncompatibleItemType as exc:
raise self.error(f'Item {str(exc.item)!r} is not a '
... | python | def parse_list(self):
"""Parse a list from the token stream."""
try:
return List([self.parse() for _ in
self.collect_tokens_until('CLOSE_BRACKET')])
except IncompatibleItemType as exc:
raise self.error(f'Item {str(exc.item)!r} is not a '
... | [
"def",
"parse_list",
"(",
"self",
")",
":",
"try",
":",
"return",
"List",
"(",
"[",
"self",
".",
"parse",
"(",
")",
"for",
"_",
"in",
"self",
".",
"collect_tokens_until",
"(",
"'CLOSE_BRACKET'",
")",
"]",
")",
"except",
"IncompatibleItemType",
"as",
"exc... | Parse a list from the token stream. | [
"Parse",
"a",
"list",
"from",
"the",
"token",
"stream",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L232-L239 | train |
vberlier/nbtlib | nbtlib/literal/parser.py | Parser.unquote_string | def unquote_string(self, string):
"""Return the unquoted value of a quoted string."""
value = string[1:-1]
forbidden_sequences = {ESCAPE_SUBS[STRING_QUOTES[string[0]]]}
valid_sequences = set(ESCAPE_SEQUENCES) - forbidden_sequences
for seq in ESCAPE_REGEX.findall(value):
... | python | def unquote_string(self, string):
"""Return the unquoted value of a quoted string."""
value = string[1:-1]
forbidden_sequences = {ESCAPE_SUBS[STRING_QUOTES[string[0]]]}
valid_sequences = set(ESCAPE_SEQUENCES) - forbidden_sequences
for seq in ESCAPE_REGEX.findall(value):
... | [
"def",
"unquote_string",
"(",
"self",
",",
"string",
")",
":",
"value",
"=",
"string",
"[",
"1",
":",
"-",
"1",
"]",
"forbidden_sequences",
"=",
"{",
"ESCAPE_SUBS",
"[",
"STRING_QUOTES",
"[",
"string",
"[",
"0",
"]",
"]",
"]",
"}",
"valid_sequences",
"... | Return the unquoted value of a quoted string. | [
"Return",
"the",
"unquoted",
"value",
"of",
"a",
"quoted",
"string",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/parser.py#L245-L259 | train |
tulsawebdevs/django-multi-gtfs | multigtfs/compat.py | opener_from_zipfile | def opener_from_zipfile(zipfile):
"""
Returns a function that will open a file in a zipfile by name.
For Python3 compatibility, the raw file will be converted to text.
"""
def opener(filename):
inner_file = zipfile.open(filename)
if PY3:
from io import TextIOWrapper
... | python | def opener_from_zipfile(zipfile):
"""
Returns a function that will open a file in a zipfile by name.
For Python3 compatibility, the raw file will be converted to text.
"""
def opener(filename):
inner_file = zipfile.open(filename)
if PY3:
from io import TextIOWrapper
... | [
"def",
"opener_from_zipfile",
"(",
"zipfile",
")",
":",
"def",
"opener",
"(",
"filename",
")",
":",
"inner_file",
"=",
"zipfile",
".",
"open",
"(",
"filename",
")",
"if",
"PY3",
":",
"from",
"io",
"import",
"TextIOWrapper",
"return",
"TextIOWrapper",
"(",
... | Returns a function that will open a file in a zipfile by name.
For Python3 compatibility, the raw file will be converted to text. | [
"Returns",
"a",
"function",
"that",
"will",
"open",
"a",
"file",
"in",
"a",
"zipfile",
"by",
"name",
"."
] | 8c442bfb67e87566c24a7364d8fa0aacd4a0a652 | https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/compat.py#L73-L88 | train |
tulsawebdevs/django-multi-gtfs | multigtfs/compat.py | write_text_rows | def write_text_rows(writer, rows):
'''Write CSV row data which may include text.'''
for row in rows:
try:
writer.writerow(row)
except UnicodeEncodeError:
# Python 2 csv does badly with unicode outside of ASCII
new_row = []
for item in row:
... | python | def write_text_rows(writer, rows):
'''Write CSV row data which may include text.'''
for row in rows:
try:
writer.writerow(row)
except UnicodeEncodeError:
# Python 2 csv does badly with unicode outside of ASCII
new_row = []
for item in row:
... | [
"def",
"write_text_rows",
"(",
"writer",
",",
"rows",
")",
":",
"for",
"row",
"in",
"rows",
":",
"try",
":",
"writer",
".",
"writerow",
"(",
"row",
")",
"except",
"UnicodeEncodeError",
":",
"# Python 2 csv does badly with unicode outside of ASCII",
"new_row",
"=",... | Write CSV row data which may include text. | [
"Write",
"CSV",
"row",
"data",
"which",
"may",
"include",
"text",
"."
] | 8c442bfb67e87566c24a7364d8fa0aacd4a0a652 | https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/compat.py#L91-L104 | train |
vberlier/nbtlib | nbtlib/literal/serializer.py | serialize_tag | def serialize_tag(tag, *, indent=None, compact=False, quote=None):
"""Serialize an nbt tag to its literal representation."""
serializer = Serializer(indent=indent, compact=compact, quote=quote)
return serializer.serialize(tag) | python | def serialize_tag(tag, *, indent=None, compact=False, quote=None):
"""Serialize an nbt tag to its literal representation."""
serializer = Serializer(indent=indent, compact=compact, quote=quote)
return serializer.serialize(tag) | [
"def",
"serialize_tag",
"(",
"tag",
",",
"*",
",",
"indent",
"=",
"None",
",",
"compact",
"=",
"False",
",",
"quote",
"=",
"None",
")",
":",
"serializer",
"=",
"Serializer",
"(",
"indent",
"=",
"indent",
",",
"compact",
"=",
"compact",
",",
"quote",
... | Serialize an nbt tag to its literal representation. | [
"Serialize",
"an",
"nbt",
"tag",
"to",
"its",
"literal",
"representation",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/serializer.py#L48-L51 | train |
vberlier/nbtlib | nbtlib/literal/serializer.py | Serializer.depth | def depth(self):
"""Increase the level of indentation by one."""
if self.indentation is None:
yield
else:
previous = self.previous_indent
self.previous_indent = self.indent
self.indent += self.indentation
yield
self.indent =... | python | def depth(self):
"""Increase the level of indentation by one."""
if self.indentation is None:
yield
else:
previous = self.previous_indent
self.previous_indent = self.indent
self.indent += self.indentation
yield
self.indent =... | [
"def",
"depth",
"(",
"self",
")",
":",
"if",
"self",
".",
"indentation",
"is",
"None",
":",
"yield",
"else",
":",
"previous",
"=",
"self",
".",
"previous_indent",
"self",
".",
"previous_indent",
"=",
"self",
".",
"indent",
"self",
".",
"indent",
"+=",
... | Increase the level of indentation by one. | [
"Increase",
"the",
"level",
"of",
"indentation",
"by",
"one",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/serializer.py#L71-L81 | train |
vberlier/nbtlib | nbtlib/literal/serializer.py | Serializer.should_expand | def should_expand(self, tag):
"""Return whether the specified tag should be expanded."""
return self.indentation is not None and tag and (
not self.previous_indent or (
tag.serializer == 'list'
and tag.subtype.serializer in ('array', 'list', 'compound')
... | python | def should_expand(self, tag):
"""Return whether the specified tag should be expanded."""
return self.indentation is not None and tag and (
not self.previous_indent or (
tag.serializer == 'list'
and tag.subtype.serializer in ('array', 'list', 'compound')
... | [
"def",
"should_expand",
"(",
"self",
",",
"tag",
")",
":",
"return",
"self",
".",
"indentation",
"is",
"not",
"None",
"and",
"tag",
"and",
"(",
"not",
"self",
".",
"previous_indent",
"or",
"(",
"tag",
".",
"serializer",
"==",
"'list'",
"and",
"tag",
".... | Return whether the specified tag should be expanded. | [
"Return",
"whether",
"the",
"specified",
"tag",
"should",
"be",
"expanded",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/serializer.py#L83-L92 | train |
vberlier/nbtlib | nbtlib/literal/serializer.py | Serializer.escape_string | def escape_string(self, string):
"""Return the escaped literal representation of an nbt string."""
if self.quote:
quote = self.quote
else:
found = QUOTE_REGEX.search(string)
quote = STRING_QUOTES[found.group()] if found else next(iter(STRING_QUOTES))
... | python | def escape_string(self, string):
"""Return the escaped literal representation of an nbt string."""
if self.quote:
quote = self.quote
else:
found = QUOTE_REGEX.search(string)
quote = STRING_QUOTES[found.group()] if found else next(iter(STRING_QUOTES))
... | [
"def",
"escape_string",
"(",
"self",
",",
"string",
")",
":",
"if",
"self",
".",
"quote",
":",
"quote",
"=",
"self",
".",
"quote",
"else",
":",
"found",
"=",
"QUOTE_REGEX",
".",
"search",
"(",
"string",
")",
"quote",
"=",
"STRING_QUOTES",
"[",
"found",... | Return the escaped literal representation of an nbt string. | [
"Return",
"the",
"escaped",
"literal",
"representation",
"of",
"an",
"nbt",
"string",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/serializer.py#L101-L113 | train |
vberlier/nbtlib | nbtlib/literal/serializer.py | Serializer.stringify_compound_key | def stringify_compound_key(self, key):
"""Escape the compound key if it can't be represented unquoted."""
if UNQUOTED_COMPOUND_KEY.match(key):
return key
return self.escape_string(key) | python | def stringify_compound_key(self, key):
"""Escape the compound key if it can't be represented unquoted."""
if UNQUOTED_COMPOUND_KEY.match(key):
return key
return self.escape_string(key) | [
"def",
"stringify_compound_key",
"(",
"self",
",",
"key",
")",
":",
"if",
"UNQUOTED_COMPOUND_KEY",
".",
"match",
"(",
"key",
")",
":",
"return",
"key",
"return",
"self",
".",
"escape_string",
"(",
"key",
")"
] | Escape the compound key if it can't be represented unquoted. | [
"Escape",
"the",
"compound",
"key",
"if",
"it",
"can",
"t",
"be",
"represented",
"unquoted",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/serializer.py#L115-L119 | train |
vberlier/nbtlib | nbtlib/literal/serializer.py | Serializer.serialize | def serialize(self, tag):
"""Return the literal representation of a tag."""
handler = getattr(self, f'serialize_{tag.serializer}', None)
if handler is None:
raise TypeError(f'Can\'t serialize {type(tag)!r} instance')
return handler(tag) | python | def serialize(self, tag):
"""Return the literal representation of a tag."""
handler = getattr(self, f'serialize_{tag.serializer}', None)
if handler is None:
raise TypeError(f'Can\'t serialize {type(tag)!r} instance')
return handler(tag) | [
"def",
"serialize",
"(",
"self",
",",
"tag",
")",
":",
"handler",
"=",
"getattr",
"(",
"self",
",",
"f'serialize_{tag.serializer}'",
",",
"None",
")",
"if",
"handler",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"f'Can\\'t serialize {type(tag)!r} instance'",
"... | Return the literal representation of a tag. | [
"Return",
"the",
"literal",
"representation",
"of",
"a",
"tag",
"."
] | 9c9d58b5c4a530b0f1ffd76dda176f00406c3547 | https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/serializer.py#L121-L126 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.