repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
crackinglandia/pype32
pype32/pype32.py
PE.write
def write(self, filename = ""): """ Writes data from L{PE} object to a file. @rtype: str @return: The L{PE} stream data. @raise IOError: If the file could not be opened for write operations. """ file_data = str(self) if filename: try:...
python
def write(self, filename = ""): """ Writes data from L{PE} object to a file. @rtype: str @return: The L{PE} stream data. @raise IOError: If the file could not be opened for write operations. """ file_data = str(self) if filename: try:...
[ "def", "write", "(", "self", ",", "filename", "=", "\"\"", ")", ":", "file_data", "=", "str", "(", "self", ")", "if", "filename", ":", "try", ":", "self", ".", "__write", "(", "filename", ",", "file_data", ")", "except", "IOError", ":", "raise", "IOE...
Writes data from L{PE} object to a file. @rtype: str @return: The L{PE} stream data. @raise IOError: If the file could not be opened for write operations.
[ "Writes", "data", "from", "L", "{", "PE", "}", "object", "to", "a", "file", ".", "@rtype", ":", "str", "@return", ":", "The", "L", "{", "PE", "}", "stream", "data", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L201-L217
crackinglandia/pype32
pype32/pype32.py
PE.__write
def __write(self, thePath, theData): """ Write data to a file. @type thePath: str @param thePath: The file path. @type theData: str @param theData: The data to write. """ fd = open(thePath, "wb") fd.write(theData) fd.c...
python
def __write(self, thePath, theData): """ Write data to a file. @type thePath: str @param thePath: The file path. @type theData: str @param theData: The data to write. """ fd = open(thePath, "wb") fd.write(theData) fd.c...
[ "def", "__write", "(", "self", ",", "thePath", ",", "theData", ")", ":", "fd", "=", "open", "(", "thePath", ",", "\"wb\"", ")", "fd", ".", "write", "(", "theData", ")", "fd", ".", "close", "(", ")" ]
Write data to a file. @type thePath: str @param thePath: The file path. @type theData: str @param theData: The data to write.
[ "Write", "data", "to", "a", "file", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L219-L231
crackinglandia/pype32
pype32/pype32.py
PE._updateDirectoriesData
def _updateDirectoriesData(self, peStr): """ Updates the data in every L{Directory} object. @type peStr: str @param peStr: C{str} representation of the L{PE} object. @rtype: str @return: A C{str} representation of the L{PE} object. """ da...
python
def _updateDirectoriesData(self, peStr): """ Updates the data in every L{Directory} object. @type peStr: str @param peStr: C{str} representation of the L{PE} object. @rtype: str @return: A C{str} representation of the L{PE} object. """ da...
[ "def", "_updateDirectoriesData", "(", "self", ",", "peStr", ")", ":", "dataDirs", "=", "self", ".", "ntHeaders", ".", "optionalHeader", ".", "dataDirectory", "wr", "=", "utils", ".", "WriteData", "(", "data", ")", "for", "dir", "in", "dataDirs", ":", "data...
Updates the data in every L{Directory} object. @type peStr: str @param peStr: C{str} representation of the L{PE} object. @rtype: str @return: A C{str} representation of the L{PE} object.
[ "Updates", "the", "data", "in", "every", "L", "{", "Directory", "}", "object", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L247-L266
crackinglandia/pype32
pype32/pype32.py
PE._getPaddingDataToSectionOffset
def _getPaddingDataToSectionOffset(self): """ Returns the data between the last section header and the begenning of data from the first section. @rtype: str @return: Data between last section header and the begenning of the first section. """ start = self._getPad...
python
def _getPaddingDataToSectionOffset(self): """ Returns the data between the last section header and the begenning of data from the first section. @rtype: str @return: Data between last section header and the begenning of the first section. """ start = self._getPad...
[ "def", "_getPaddingDataToSectionOffset", "(", "self", ")", ":", "start", "=", "self", ".", "_getPaddingToSectionOffset", "(", ")", "end", "=", "self", ".", "sectionHeaders", "[", "0", "]", ".", "pointerToRawData", ".", "value", "-", "start", "return", "self", ...
Returns the data between the last section header and the begenning of data from the first section. @rtype: str @return: Data between last section header and the begenning of the first section.
[ "Returns", "the", "data", "between", "the", "last", "section", "header", "and", "the", "begenning", "of", "data", "from", "the", "first", "section", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L268-L277
crackinglandia/pype32
pype32/pype32.py
PE._getSignature
def _getSignature(self, readDataInstance, dataDirectoryInstance): """ Returns the digital signature within a digital signed PE file. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance containing a PE file data. @type dataDirector...
python
def _getSignature(self, readDataInstance, dataDirectoryInstance): """ Returns the digital signature within a digital signed PE file. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance containing a PE file data. @type dataDirector...
[ "def", "_getSignature", "(", "self", ",", "readDataInstance", ",", "dataDirectoryInstance", ")", ":", "signature", "=", "\"\"", "if", "readDataInstance", "is", "not", "None", "and", "dataDirectoryInstance", "is", "not", "None", ":", "securityDirectory", "=", "data...
Returns the digital signature within a digital signed PE file. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance containing a PE file data. @type dataDirectoryInstance: L{DataDirectory} @param dataDirectoryInstance: A L{DataDirectory} o...
[ "Returns", "the", "digital", "signature", "within", "a", "digital", "signed", "PE", "file", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L279-L306
crackinglandia/pype32
pype32/pype32.py
PE._getOverlay
def _getOverlay(self, readDataInstance, sectionHdrsInstance): """ Returns the overlay data from the PE file. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance containing the PE file data. @type sectionHdrsInstance: L{SectionHead...
python
def _getOverlay(self, readDataInstance, sectionHdrsInstance): """ Returns the overlay data from the PE file. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance containing the PE file data. @type sectionHdrsInstance: L{SectionHead...
[ "def", "_getOverlay", "(", "self", ",", "readDataInstance", ",", "sectionHdrsInstance", ")", ":", "if", "readDataInstance", "is", "not", "None", "and", "sectionHdrsInstance", "is", "not", "None", ":", "# adjust the offset in readDataInstance to the RawOffset + RawSize of th...
Returns the overlay data from the PE file. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance containing the PE file data. @type sectionHdrsInstance: L{SectionHeaders} @param sectionHdrsInstance: A L{SectionHeaders} instance containing t...
[ "Returns", "the", "overlay", "data", "from", "the", "PE", "file", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L308-L334
crackinglandia/pype32
pype32/pype32.py
PE.getOffsetFromRva
def getOffsetFromRva(self, rva): """ Converts an offset to an RVA. @type rva: int @param rva: The RVA to be converted. @rtype: int @return: An integer value representing an offset in the PE file. """ offset = -1 s = self.getSectio...
python
def getOffsetFromRva(self, rva): """ Converts an offset to an RVA. @type rva: int @param rva: The RVA to be converted. @rtype: int @return: An integer value representing an offset in the PE file. """ offset = -1 s = self.getSectio...
[ "def", "getOffsetFromRva", "(", "self", ",", "rva", ")", ":", "offset", "=", "-", "1", "s", "=", "self", ".", "getSectionByRva", "(", "rva", ")", "if", "s", "!=", "offset", ":", "offset", "=", "(", "rva", "-", "self", ".", "sectionHeaders", "[", "s...
Converts an offset to an RVA. @type rva: int @param rva: The RVA to be converted. @rtype: int @return: An integer value representing an offset in the PE file.
[ "Converts", "an", "offset", "to", "an", "RVA", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L336-L354
crackinglandia/pype32
pype32/pype32.py
PE.getRvaFromOffset
def getRvaFromOffset(self, offset): """ Converts a RVA to an offset. @type offset: int @param offset: The offset value to be converted to RVA. @rtype: int @return: The RVA obtained from the given offset. """ rva = -1 s = self.getS...
python
def getRvaFromOffset(self, offset): """ Converts a RVA to an offset. @type offset: int @param offset: The offset value to be converted to RVA. @rtype: int @return: The RVA obtained from the given offset. """ rva = -1 s = self.getS...
[ "def", "getRvaFromOffset", "(", "self", ",", "offset", ")", ":", "rva", "=", "-", "1", "s", "=", "self", ".", "getSectionByOffset", "(", "offset", ")", "if", "s", ":", "rva", "=", "(", "offset", "-", "self", ".", "sectionHeaders", "[", "s", "]", "....
Converts a RVA to an offset. @type offset: int @param offset: The offset value to be converted to RVA. @rtype: int @return: The RVA obtained from the given offset.
[ "Converts", "a", "RVA", "to", "an", "offset", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L356-L372
crackinglandia/pype32
pype32/pype32.py
PE.getSectionByOffset
def getSectionByOffset(self, offset): """ Given an offset in the file, tries to determine the section this offset belong to. @type offset: int @param offset: Offset value. @rtype: int @return: An index, starting at 0, that represents the section the give...
python
def getSectionByOffset(self, offset): """ Given an offset in the file, tries to determine the section this offset belong to. @type offset: int @param offset: Offset value. @rtype: int @return: An index, starting at 0, that represents the section the give...
[ "def", "getSectionByOffset", "(", "self", ",", "offset", ")", ":", "index", "=", "-", "1", "for", "i", "in", "range", "(", "len", "(", "self", ".", "sectionHeaders", ")", ")", ":", "if", "(", "offset", "<", "self", ".", "sectionHeaders", "[", "i", ...
Given an offset in the file, tries to determine the section this offset belong to. @type offset: int @param offset: Offset value. @rtype: int @return: An index, starting at 0, that represents the section the given offset belongs to.
[ "Given", "an", "offset", "in", "the", "file", "tries", "to", "determine", "the", "section", "this", "offset", "belong", "to", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L374-L389
crackinglandia/pype32
pype32/pype32.py
PE.getSectionIndexByName
def getSectionIndexByName(self, name): """ Given a string representing a section name, tries to find the section index. @type name: str @param name: A section name. @rtype: int @return: The index, starting at 0, of the section. """ index = -1 ...
python
def getSectionIndexByName(self, name): """ Given a string representing a section name, tries to find the section index. @type name: str @param name: A section name. @rtype: int @return: The index, starting at 0, of the section. """ index = -1 ...
[ "def", "getSectionIndexByName", "(", "self", ",", "name", ")", ":", "index", "=", "-", "1", "if", "name", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "sectionHeaders", ")", ")", ":", "if", "self", ".", "sectionHeaders", "[", "i", ...
Given a string representing a section name, tries to find the section index. @type name: str @param name: A section name. @rtype: int @return: The index, starting at 0, of the section.
[ "Given", "a", "string", "representing", "a", "section", "name", "tries", "to", "find", "the", "section", "index", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L391-L408
crackinglandia/pype32
pype32/pype32.py
PE.getSectionByRva
def getSectionByRva(self, rva): """ Given a RVA in the file, tries to determine the section this RVA belongs to. @type rva: int @param rva: RVA value. @rtype: int @return: An index, starting at 1, that represents the section the given RVA belongs to. ...
python
def getSectionByRva(self, rva): """ Given a RVA in the file, tries to determine the section this RVA belongs to. @type rva: int @param rva: RVA value. @rtype: int @return: An index, starting at 1, that represents the section the given RVA belongs to. ...
[ "def", "getSectionByRva", "(", "self", ",", "rva", ")", ":", "index", "=", "-", "1", "if", "rva", "<", "self", ".", "sectionHeaders", "[", "0", "]", ".", "virtualAddress", ".", "value", ":", "return", "index", "for", "i", "in", "range", "(", "len", ...
Given a RVA in the file, tries to determine the section this RVA belongs to. @type rva: int @param rva: RVA value. @rtype: int @return: An index, starting at 1, that represents the section the given RVA belongs to.
[ "Given", "a", "RVA", "in", "the", "file", "tries", "to", "determine", "the", "section", "this", "RVA", "belongs", "to", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L410-L437
crackinglandia/pype32
pype32/pype32.py
PE._getPaddingToSectionOffset
def _getPaddingToSectionOffset(self): """ Returns the offset to last section header present in the PE file. @rtype: int @return: The offset where the end of the last section header resides in the PE file. """ return len(str(self.dosHeader) + str(self.dosStub) + s...
python
def _getPaddingToSectionOffset(self): """ Returns the offset to last section header present in the PE file. @rtype: int @return: The offset where the end of the last section header resides in the PE file. """ return len(str(self.dosHeader) + str(self.dosStub) + s...
[ "def", "_getPaddingToSectionOffset", "(", "self", ")", ":", "return", "len", "(", "str", "(", "self", ".", "dosHeader", ")", "+", "str", "(", "self", ".", "dosStub", ")", "+", "str", "(", "self", ".", "ntHeaders", ")", "+", "str", "(", "self", ".", ...
Returns the offset to last section header present in the PE file. @rtype: int @return: The offset where the end of the last section header resides in the PE file.
[ "Returns", "the", "offset", "to", "last", "section", "header", "present", "in", "the", "PE", "file", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L449-L456
crackinglandia/pype32
pype32/pype32.py
PE.fullLoad
def fullLoad(self): """Parse all the directories in the PE file.""" self._parseDirectories(self.ntHeaders.optionalHeader.dataDirectory, self.PE_TYPE)
python
def fullLoad(self): """Parse all the directories in the PE file.""" self._parseDirectories(self.ntHeaders.optionalHeader.dataDirectory, self.PE_TYPE)
[ "def", "fullLoad", "(", "self", ")", ":", "self", ".", "_parseDirectories", "(", "self", ".", "ntHeaders", ".", "optionalHeader", ".", "dataDirectory", ",", "self", ".", "PE_TYPE", ")" ]
Parse all the directories in the PE file.
[ "Parse", "all", "the", "directories", "in", "the", "PE", "file", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L458-L460
crackinglandia/pype32
pype32/pype32.py
PE._internalParse
def _internalParse(self, readDataInstance): """ Populates the attributes of the L{PE} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance with the data of a PE file. """ self.dosHeader = DosHeader.parse(readDataInstance) ...
python
def _internalParse(self, readDataInstance): """ Populates the attributes of the L{PE} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance with the data of a PE file. """ self.dosHeader = DosHeader.parse(readDataInstance) ...
[ "def", "_internalParse", "(", "self", ",", "readDataInstance", ")", ":", "self", ".", "dosHeader", "=", "DosHeader", ".", "parse", "(", "readDataInstance", ")", "self", ".", "dosStub", "=", "readDataInstance", ".", "read", "(", "self", ".", "dosHeader", ".",...
Populates the attributes of the L{PE} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} instance with the data of a PE file.
[ "Populates", "the", "attributes", "of", "the", "L", "{", "PE", "}", "object", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L462-L493
crackinglandia/pype32
pype32/pype32.py
PE.addSection
def addSection(self, data, name =".pype32\x00", flags = 0x60000000): """ Adds a new section to the existing L{PE} instance. @type data: str @param data: The data to be added in the new section. @type name: str @param name: (Optional) The name for the new...
python
def addSection(self, data, name =".pype32\x00", flags = 0x60000000): """ Adds a new section to the existing L{PE} instance. @type data: str @param data: The data to be added in the new section. @type name: str @param name: (Optional) The name for the new...
[ "def", "addSection", "(", "self", ",", "data", ",", "name", "=", "\".pype32\\x00\"", ",", "flags", "=", "0x60000000", ")", ":", "fa", "=", "self", ".", "ntHeaders", ".", "optionalHeader", ".", "fileAlignment", ".", "value", "sa", "=", "self", ".", "ntHea...
Adds a new section to the existing L{PE} instance. @type data: str @param data: The data to be added in the new section. @type name: str @param name: (Optional) The name for the new section. @type flags: int @param flags: (Optional) The attribut...
[ "Adds", "a", "new", "section", "to", "the", "existing", "L", "{", "PE", "}", "instance", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L495-L532
crackinglandia/pype32
pype32/pype32.py
PE.extendSection
def extendSection(self, sectionIndex, data): """ Extends an existing section in the L{PE} instance. @type sectionIndex: int @param sectionIndex: The index for the section to be extended. @type data: str @param data: The data to include in the section. ...
python
def extendSection(self, sectionIndex, data): """ Extends an existing section in the L{PE} instance. @type sectionIndex: int @param sectionIndex: The index for the section to be extended. @type data: str @param data: The data to include in the section. ...
[ "def", "extendSection", "(", "self", ",", "sectionIndex", ",", "data", ")", ":", "fa", "=", "self", ".", "ntHeaders", ".", "optionalHeader", ".", "fileAlignment", ".", "value", "sa", "=", "self", ".", "ntHeaders", ".", "optionalHeader", ".", "sectionAlignmen...
Extends an existing section in the L{PE} instance. @type sectionIndex: int @param sectionIndex: The index for the section to be extended. @type data: str @param data: The data to include in the section. @raise IndexError: If an invalid C{sectionIndex} w...
[ "Extends", "an", "existing", "section", "in", "the", "L", "{", "PE", "}", "instance", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L534-L616
crackinglandia/pype32
pype32/pype32.py
PE._fixPe
def _fixPe(self): """ Fixes the necessary fields in the PE file instance in order to create a valid PE32. i.e. SizeOfImage. """ sizeOfImage = 0 for sh in self.sectionHeaders: sizeOfImage += sh.misc self.ntHeaders.optionaHeader.sizeoOfImage.value = self._sectio...
python
def _fixPe(self): """ Fixes the necessary fields in the PE file instance in order to create a valid PE32. i.e. SizeOfImage. """ sizeOfImage = 0 for sh in self.sectionHeaders: sizeOfImage += sh.misc self.ntHeaders.optionaHeader.sizeoOfImage.value = self._sectio...
[ "def", "_fixPe", "(", "self", ")", ":", "sizeOfImage", "=", "0", "for", "sh", "in", "self", ".", "sectionHeaders", ":", "sizeOfImage", "+=", "sh", ".", "misc", "self", ".", "ntHeaders", ".", "optionaHeader", ".", "sizeoOfImage", ".", "value", "=", "self"...
Fixes the necessary fields in the PE file instance in order to create a valid PE32. i.e. SizeOfImage.
[ "Fixes", "the", "necessary", "fields", "in", "the", "PE", "file", "instance", "in", "order", "to", "create", "a", "valid", "PE32", ".", "i", ".", "e", ".", "SizeOfImage", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L618-L625
crackinglandia/pype32
pype32/pype32.py
PE._adjustFileAlignment
def _adjustFileAlignment(self, value, fileAlignment): """ Align a value to C{FileAligment}. @type value: int @param value: The value to align. @type fileAlignment: int @param fileAlignment: The value to be used to align the C{value} parameter. ...
python
def _adjustFileAlignment(self, value, fileAlignment): """ Align a value to C{FileAligment}. @type value: int @param value: The value to align. @type fileAlignment: int @param fileAlignment: The value to be used to align the C{value} parameter. ...
[ "def", "_adjustFileAlignment", "(", "self", ",", "value", ",", "fileAlignment", ")", ":", "if", "fileAlignment", ">", "consts", ".", "DEFAULT_FILE_ALIGNMENT", ":", "if", "not", "utils", ".", "powerOfTwo", "(", "fileAlignment", ")", ":", "print", "\"Warning: File...
Align a value to C{FileAligment}. @type value: int @param value: The value to align. @type fileAlignment: int @param fileAlignment: The value to be used to align the C{value} parameter. @rtype: int @return: The aligned value.
[ "Align", "a", "value", "to", "C", "{", "FileAligment", "}", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L627-L650
crackinglandia/pype32
pype32/pype32.py
PE._adjustSectionAlignment
def _adjustSectionAlignment(self, value, fileAlignment, sectionAlignment): """ Align a value to C{SectionAligment}. @type value: int @param value: The value to be aligned. @type fileAlignment: int @param fileAlignment: The value to be used as C{FileAlig...
python
def _adjustSectionAlignment(self, value, fileAlignment, sectionAlignment): """ Align a value to C{SectionAligment}. @type value: int @param value: The value to be aligned. @type fileAlignment: int @param fileAlignment: The value to be used as C{FileAlig...
[ "def", "_adjustSectionAlignment", "(", "self", ",", "value", ",", "fileAlignment", ",", "sectionAlignment", ")", ":", "if", "fileAlignment", "<", "consts", ".", "DEFAULT_FILE_ALIGNMENT", ":", "if", "fileAligment", "!=", "sectionAlignment", ":", "print", "\"FileAlign...
Align a value to C{SectionAligment}. @type value: int @param value: The value to be aligned. @type fileAlignment: int @param fileAlignment: The value to be used as C{FileAlignment}. @type sectionAlignment: int @param sectionAlignment: The value...
[ "Align", "a", "value", "to", "C", "{", "SectionAligment", "}", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L652-L677
crackinglandia/pype32
pype32/pype32.py
PE.getDwordAtRva
def getDwordAtRva(self, rva): """ Returns a C{DWORD} from a given RVA. @type rva: int @param rva: The RVA to get the C{DWORD} from. @rtype: L{DWORD} @return: The L{DWORD} obtained at the given RVA. """ return datatypes.DWORD.parse(utils....
python
def getDwordAtRva(self, rva): """ Returns a C{DWORD} from a given RVA. @type rva: int @param rva: The RVA to get the C{DWORD} from. @rtype: L{DWORD} @return: The L{DWORD} obtained at the given RVA. """ return datatypes.DWORD.parse(utils....
[ "def", "getDwordAtRva", "(", "self", ",", "rva", ")", ":", "return", "datatypes", ".", "DWORD", ".", "parse", "(", "utils", ".", "ReadData", "(", "self", ".", "getDataAtRva", "(", "rva", ",", "4", ")", ")", ")" ]
Returns a C{DWORD} from a given RVA. @type rva: int @param rva: The RVA to get the C{DWORD} from. @rtype: L{DWORD} @return: The L{DWORD} obtained at the given RVA.
[ "Returns", "a", "C", "{", "DWORD", "}", "from", "a", "given", "RVA", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L679-L689
crackinglandia/pype32
pype32/pype32.py
PE.getWordAtRva
def getWordAtRva(self, rva): """ Returns a C{WORD} from a given RVA. @type rva: int @param rva: The RVA to get the C{WORD} from. @rtype: L{WORD} @return: The L{WORD} obtained at the given RVA. """ return datatypes.WORD.parse(utils.ReadDa...
python
def getWordAtRva(self, rva): """ Returns a C{WORD} from a given RVA. @type rva: int @param rva: The RVA to get the C{WORD} from. @rtype: L{WORD} @return: The L{WORD} obtained at the given RVA. """ return datatypes.WORD.parse(utils.ReadDa...
[ "def", "getWordAtRva", "(", "self", ",", "rva", ")", ":", "return", "datatypes", ".", "WORD", ".", "parse", "(", "utils", ".", "ReadData", "(", "self", ".", "getDataAtRva", "(", "rva", ",", "2", ")", ")", ")" ]
Returns a C{WORD} from a given RVA. @type rva: int @param rva: The RVA to get the C{WORD} from. @rtype: L{WORD} @return: The L{WORD} obtained at the given RVA.
[ "Returns", "a", "C", "{", "WORD", "}", "from", "a", "given", "RVA", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L691-L701
crackinglandia/pype32
pype32/pype32.py
PE.getDwordAtOffset
def getDwordAtOffset(self, offset): """ Returns a C{DWORD} from a given offset. @type offset: int @param offset: The offset to get the C{DWORD} from. @rtype: L{DWORD} @return: The L{DWORD} obtained at the given offset. """ return datatyp...
python
def getDwordAtOffset(self, offset): """ Returns a C{DWORD} from a given offset. @type offset: int @param offset: The offset to get the C{DWORD} from. @rtype: L{DWORD} @return: The L{DWORD} obtained at the given offset. """ return datatyp...
[ "def", "getDwordAtOffset", "(", "self", ",", "offset", ")", ":", "return", "datatypes", ".", "DWORD", ".", "parse", "(", "utils", ".", "ReadData", "(", "self", ".", "getDataAtOffset", "(", "offset", ",", "4", ")", ")", ")" ]
Returns a C{DWORD} from a given offset. @type offset: int @param offset: The offset to get the C{DWORD} from. @rtype: L{DWORD} @return: The L{DWORD} obtained at the given offset.
[ "Returns", "a", "C", "{", "DWORD", "}", "from", "a", "given", "offset", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L703-L713
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L715-L725
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L727-L737
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L739-L749
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L751-L764
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L766-L780
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L782-L798
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L800-L809
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L811-L820
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L822-L836
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L838-L847
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L849-L858
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", "}", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L860-L870
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"...
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L872-L880
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", ...
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L886-L895
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"...
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L897-L905
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", ".", ...
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L907-L926
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L928-L956
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L958-L974
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L976-L992
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L994-L1010
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1012-L1042
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1044-L1077
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1079-L1104
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1106-L1130
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1132-L1202
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1204-L1224
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1226-L1362
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1364-L1458
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1617-L1656
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1682-L1696
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1726-L1744
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L1802-L1849
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L2017-L2038
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L2069-L2097
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", "." ]
train
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/pype32.py#L2118-L2151
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" ]
train
https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L153-L202
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" ]
train
https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L205-L254
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" ]
train
https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L869-L932
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" ]
train
https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L935-L998
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" ]
train
https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L1001-L1034
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", ")" ]
train
https://github.com/blockcypher/bcwallet/blob/4c623a8e19705332c9398c3fea9d5dc3c1dafb9b/bcwallet/bcwallet.py#L1091-L1173
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", "." ]
train
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/solver.py#L80-L88
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", ")" ]
train
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/solver.py#L120-L140
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", ")" ]
train
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/solver.py#L142-L147
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", "." ]
train
https://github.com/tansey/gfl/blob/ae0f078bab57aba9e827ed6162f247ff9dc2aa19/pygfl/solver.py#L152-L217
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", "." ]
train
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/generate_sequences.py#L144-L345
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", "." ]
train
https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L212-L232
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", "." ]
train
https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L280-L290
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", "." ]
train
https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L302-L321
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", "." ]
train
https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L334-L352
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", "." ]
train
https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L398-L430
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", "." ]
train
https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L432-L507
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", "." ]
train
https://github.com/napalm-automation-community/napalm-panos/blob/9210a81a7a4a47c724d169031414a0743de4b035/napalm_panos/panos.py#L561-L660
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" ]
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L75-L111
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", ")" ]
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L113-L121
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" ]
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L124-L152
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", ")", "." ]
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L154-L193
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", "." ]
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L195-L216
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",...
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L218-L242
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", "." ]
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L308-L315
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...
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L318-L356
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", ...
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L359-L451
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", "]", ...
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L454-L508
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...
train
https://github.com/timknip/pycsg/blob/b8f9710fd15c38dcc275d56a2108f604af38dcc8/csg/core.py#L511-L573
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...
train
https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/nbt.py#L17-L37
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...
train
https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/nbt.py#L90-L100
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", ...
train
https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/nbt.py#L103-L112
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", ...
train
https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/nbt.py#L114-L137
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" ]
train
https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/util.py#L47-L56
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" ]
train
https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/stop.py#L166-L172
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" ]
train
https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L94-L105
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" ]
train
https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L107-L161
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" ]
train
https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L163-L174
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" ]
train
https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L251-L262
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", "." ]
train
https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/fields/seconds.py#L72-L76
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", "." ]
train
https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/fields/seconds.py#L78-L84
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", "." ]
train
https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/fields/seconds.py#L87-L109
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", "." ]
train
https://github.com/tulsawebdevs/django-multi-gtfs/blob/8c442bfb67e87566c24a7364d8fa0aacd4a0a652/multigtfs/models/fields/seconds.py#L111-L118