repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TokenGroup.get_tokens
def get_tokens(tu, extent): """Helper method to return all tokens in an extent. This functionality is needed multiple places in this module. We define it here because it seems like a logical place. """ tokens_memory = POINTER(Token)() tokens_count = c_uint() con...
python
def get_tokens(tu, extent): """Helper method to return all tokens in an extent. This functionality is needed multiple places in this module. We define it here because it seems like a logical place. """ tokens_memory = POINTER(Token)() tokens_count = c_uint() con...
[ "def", "get_tokens", "(", "tu", ",", "extent", ")", ":", "tokens_memory", "=", "POINTER", "(", "Token", ")", "(", ")", "tokens_count", "=", "c_uint", "(", ")", "conf", ".", "lib", ".", "clang_tokenize", "(", "tu", ",", "extent", ",", "byref", "(", "t...
Helper method to return all tokens in an extent. This functionality is needed multiple places in this module. We define it here because it seems like a logical place.
[ "Helper", "method", "to", "return", "all", "tokens", "in", "an", "extent", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L500-L530
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TokenKind.from_value
def from_value(value): """Obtain a registered TokenKind instance from its value.""" result = TokenKind._value_map.get(value, None) if result is None: raise ValueError('Unknown TokenKind: %d' % value) return result
python
def from_value(value): """Obtain a registered TokenKind instance from its value.""" result = TokenKind._value_map.get(value, None) if result is None: raise ValueError('Unknown TokenKind: %d' % value) return result
[ "def", "from_value", "(", "value", ")", ":", "result", "=", "TokenKind", ".", "_value_map", ".", "get", "(", "value", ",", "None", ")", "if", "result", "is", "None", ":", "raise", "ValueError", "(", "'Unknown TokenKind: %d'", "%", "value", ")", "return", ...
Obtain a registered TokenKind instance from its value.
[ "Obtain", "a", "registered", "TokenKind", "instance", "from", "its", "value", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L546-L553
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TokenKind.register
def register(value, name): """Register a new TokenKind enumeration. This should only be called at module load time by code within this package. """ if value in TokenKind._value_map: raise ValueError('TokenKind already registered: %d' % value) kind = TokenKin...
python
def register(value, name): """Register a new TokenKind enumeration. This should only be called at module load time by code within this package. """ if value in TokenKind._value_map: raise ValueError('TokenKind already registered: %d' % value) kind = TokenKin...
[ "def", "register", "(", "value", ",", "name", ")", ":", "if", "value", "in", "TokenKind", ".", "_value_map", ":", "raise", "ValueError", "(", "'TokenKind already registered: %d'", "%", "value", ")", "kind", "=", "TokenKind", "(", "value", ",", "name", ")", ...
Register a new TokenKind enumeration. This should only be called at module load time by code within this package.
[ "Register", "a", "new", "TokenKind", "enumeration", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L556-L567
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.canonical
def canonical(self): """Return the canonical Cursor corresponding to this Cursor. The canonical cursor is the cursor which is representative for the underlying entity. For example, if you have multiple forward declarations for the same class, the canonical cursor for the forward ...
python
def canonical(self): """Return the canonical Cursor corresponding to this Cursor. The canonical cursor is the cursor which is representative for the underlying entity. For example, if you have multiple forward declarations for the same class, the canonical cursor for the forward ...
[ "def", "canonical", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_canonical'", ")", ":", "self", ".", "_canonical", "=", "conf", ".", "lib", ".", "clang_getCanonicalCursor", "(", "self", ")", "return", "self", ".", "_canonical" ]
Return the canonical Cursor corresponding to this Cursor. The canonical cursor is the cursor which is representative for the underlying entity. For example, if you have multiple forward declarations for the same class, the canonical cursor for the forward declarations will be identical.
[ "Return", "the", "canonical", "Cursor", "corresponding", "to", "this", "Cursor", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1542-L1553
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.result_type
def result_type(self): """Retrieve the Type of the result for this Cursor.""" if not hasattr(self, '_result_type'): self._result_type = conf.lib.clang_getResultType(self.type) return self._result_type
python
def result_type(self): """Retrieve the Type of the result for this Cursor.""" if not hasattr(self, '_result_type'): self._result_type = conf.lib.clang_getResultType(self.type) return self._result_type
[ "def", "result_type", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_result_type'", ")", ":", "self", ".", "_result_type", "=", "conf", ".", "lib", ".", "clang_getResultType", "(", "self", ".", "type", ")", "return", "self", ".", "...
Retrieve the Type of the result for this Cursor.
[ "Retrieve", "the", "Type", "of", "the", "result", "for", "this", "Cursor", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1556-L1561
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.underlying_typedef_type
def underlying_typedef_type(self): """Return the underlying type of a typedef declaration. Returns a Type for the typedef this cursor is a declaration for. If the current cursor is not a typedef, this raises. """ if not hasattr(self, '_underlying_type'): assert self....
python
def underlying_typedef_type(self): """Return the underlying type of a typedef declaration. Returns a Type for the typedef this cursor is a declaration for. If the current cursor is not a typedef, this raises. """ if not hasattr(self, '_underlying_type'): assert self....
[ "def", "underlying_typedef_type", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_underlying_type'", ")", ":", "assert", "self", ".", "kind", ".", "is_declaration", "(", ")", "self", ".", "_underlying_type", "=", "conf", ".", "lib", "."...
Return the underlying type of a typedef declaration. Returns a Type for the typedef this cursor is a declaration for. If the current cursor is not a typedef, this raises.
[ "Return", "the", "underlying", "type", "of", "a", "typedef", "declaration", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1564-L1575
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.enum_type
def enum_type(self): """Return the integer type of an enum declaration. Returns a Type corresponding to an integer. If the cursor is not for an enum, this raises. """ if not hasattr(self, '_enum_type'): assert self.kind == CursorKind.ENUM_DECL self._enum_...
python
def enum_type(self): """Return the integer type of an enum declaration. Returns a Type corresponding to an integer. If the cursor is not for an enum, this raises. """ if not hasattr(self, '_enum_type'): assert self.kind == CursorKind.ENUM_DECL self._enum_...
[ "def", "enum_type", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_enum_type'", ")", ":", "assert", "self", ".", "kind", "==", "CursorKind", ".", "ENUM_DECL", "self", ".", "_enum_type", "=", "conf", ".", "lib", ".", "clang_getEnumDec...
Return the integer type of an enum declaration. Returns a Type corresponding to an integer. If the cursor is not for an enum, this raises.
[ "Return", "the", "integer", "type", "of", "an", "enum", "declaration", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1578-L1588
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.enum_value
def enum_value(self): """Return the value of an enum constant.""" if not hasattr(self, '_enum_value'): assert self.kind == CursorKind.ENUM_CONSTANT_DECL # Figure out the underlying type of the enum to know if it # is a signed or unsigned quantity. underlyi...
python
def enum_value(self): """Return the value of an enum constant.""" if not hasattr(self, '_enum_value'): assert self.kind == CursorKind.ENUM_CONSTANT_DECL # Figure out the underlying type of the enum to know if it # is a signed or unsigned quantity. underlyi...
[ "def", "enum_value", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_enum_value'", ")", ":", "assert", "self", ".", "kind", "==", "CursorKind", ".", "ENUM_CONSTANT_DECL", "underlying_type", "=", "self", ".", "type", "if", "underlying_type...
Return the value of an enum constant.
[ "Return", "the", "value", "of", "an", "enum", "constant", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1591-L1613
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.hash
def hash(self): """Returns a hash of the cursor as an int.""" if not hasattr(self, '_hash'): self._hash = conf.lib.clang_hashCursor(self) return self._hash
python
def hash(self): """Returns a hash of the cursor as an int.""" if not hasattr(self, '_hash'): self._hash = conf.lib.clang_hashCursor(self) return self._hash
[ "def", "hash", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_hash'", ")", ":", "self", ".", "_hash", "=", "conf", ".", "lib", ".", "clang_hashCursor", "(", "self", ")", "return", "self", ".", "_hash" ]
Returns a hash of the cursor as an int.
[ "Returns", "a", "hash", "of", "the", "cursor", "as", "an", "int", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1625-L1630
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.semantic_parent
def semantic_parent(self): """Return the semantic parent for this cursor.""" if not hasattr(self, '_semantic_parent'): self._semantic_parent = conf.lib.clang_getCursorSemanticParent(self) return self._semantic_parent
python
def semantic_parent(self): """Return the semantic parent for this cursor.""" if not hasattr(self, '_semantic_parent'): self._semantic_parent = conf.lib.clang_getCursorSemanticParent(self) return self._semantic_parent
[ "def", "semantic_parent", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_semantic_parent'", ")", ":", "self", ".", "_semantic_parent", "=", "conf", ".", "lib", ".", "clang_getCursorSemanticParent", "(", "self", ")", "return", "self", "."...
Return the semantic parent for this cursor.
[ "Return", "the", "semantic", "parent", "for", "this", "cursor", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1633-L1638
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.lexical_parent
def lexical_parent(self): """Return the lexical parent for this cursor.""" if not hasattr(self, '_lexical_parent'): self._lexical_parent = conf.lib.clang_getCursorLexicalParent(self) return self._lexical_parent
python
def lexical_parent(self): """Return the lexical parent for this cursor.""" if not hasattr(self, '_lexical_parent'): self._lexical_parent = conf.lib.clang_getCursorLexicalParent(self) return self._lexical_parent
[ "def", "lexical_parent", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_lexical_parent'", ")", ":", "self", ".", "_lexical_parent", "=", "conf", ".", "lib", ".", "clang_getCursorLexicalParent", "(", "self", ")", "return", "self", ".", ...
Return the lexical parent for this cursor.
[ "Return", "the", "lexical", "parent", "for", "this", "cursor", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1641-L1646
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.referenced
def referenced(self): """ For a cursor that is a reference, returns a cursor representing the entity that it references. """ if not hasattr(self, '_referenced'): self._referenced = conf.lib.clang_getCursorReferenced(self) return self._referenced
python
def referenced(self): """ For a cursor that is a reference, returns a cursor representing the entity that it references. """ if not hasattr(self, '_referenced'): self._referenced = conf.lib.clang_getCursorReferenced(self) return self._referenced
[ "def", "referenced", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_referenced'", ")", ":", "self", ".", "_referenced", "=", "conf", ".", "lib", ".", "clang_getCursorReferenced", "(", "self", ")", "return", "self", ".", "_referenced" ]
For a cursor that is a reference, returns a cursor representing the entity that it references.
[ "For", "a", "cursor", "that", "is", "a", "reference", "returns", "a", "cursor", "representing", "the", "entity", "that", "it", "references", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1656-L1664
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.brief_comment
def brief_comment(self): """Returns the brief comment text associated with that Cursor""" r = conf.lib.clang_Cursor_getBriefCommentText(self) if not r: return None return str(r)
python
def brief_comment(self): """Returns the brief comment text associated with that Cursor""" r = conf.lib.clang_Cursor_getBriefCommentText(self) if not r: return None return str(r)
[ "def", "brief_comment", "(", "self", ")", ":", "r", "=", "conf", ".", "lib", ".", "clang_Cursor_getBriefCommentText", "(", "self", ")", "if", "not", "r", ":", "return", "None", "return", "str", "(", "r", ")" ]
Returns the brief comment text associated with that Cursor
[ "Returns", "the", "brief", "comment", "text", "associated", "with", "that", "Cursor" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1667-L1672
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.raw_comment
def raw_comment(self): """Returns the raw comment text associated with that Cursor""" r = conf.lib.clang_Cursor_getRawCommentText(self) if not r: return None return str(r)
python
def raw_comment(self): """Returns the raw comment text associated with that Cursor""" r = conf.lib.clang_Cursor_getRawCommentText(self) if not r: return None return str(r)
[ "def", "raw_comment", "(", "self", ")", ":", "r", "=", "conf", ".", "lib", ".", "clang_Cursor_getRawCommentText", "(", "self", ")", "if", "not", "r", ":", "return", "None", "return", "str", "(", "r", ")" ]
Returns the raw comment text associated with that Cursor
[ "Returns", "the", "raw", "comment", "text", "associated", "with", "that", "Cursor" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1675-L1680
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.get_arguments
def get_arguments(self): """Return an iterator for accessing the arguments of this cursor.""" num_args = conf.lib.clang_Cursor_getNumArguments(self) for i in xrange(0, num_args): yield conf.lib.clang_Cursor_getArgument(self, i)
python
def get_arguments(self): """Return an iterator for accessing the arguments of this cursor.""" num_args = conf.lib.clang_Cursor_getNumArguments(self) for i in xrange(0, num_args): yield conf.lib.clang_Cursor_getArgument(self, i)
[ "def", "get_arguments", "(", "self", ")", ":", "num_args", "=", "conf", ".", "lib", ".", "clang_Cursor_getNumArguments", "(", "self", ")", "for", "i", "in", "xrange", "(", "0", ",", "num_args", ")", ":", "yield", "conf", ".", "lib", ".", "clang_Cursor_ge...
Return an iterator for accessing the arguments of this cursor.
[ "Return", "an", "iterator", "for", "accessing", "the", "arguments", "of", "this", "cursor", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1682-L1686
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.get_children
def get_children(self): """Return an iterator for accessing the children of this cursor.""" # FIXME: Expose iteration from CIndex, PR6125. def visitor(child, parent, children): # FIXME: Document this assertion in API. # FIXME: There should just be an isNull method. ...
python
def get_children(self): """Return an iterator for accessing the children of this cursor.""" # FIXME: Expose iteration from CIndex, PR6125. def visitor(child, parent, children): # FIXME: Document this assertion in API. # FIXME: There should just be an isNull method. ...
[ "def", "get_children", "(", "self", ")", ":", "def", "visitor", "(", "child", ",", "parent", ",", "children", ")", ":", "assert", "child", "!=", "conf", ".", "lib", ".", "clang_getNullCursor", "(", ")", "child", ".", "_tu", "=", "self", ".", "_tu", "...
Return an iterator for accessing the children of this cursor.
[ "Return", "an", "iterator", "for", "accessing", "the", "children", "of", "this", "cursor", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1709-L1725
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.walk_preorder
def walk_preorder(self): """Depth-first preorder walk over the cursor and its descendants. Yields cursors. """ yield self for child in self.get_children(): for descendant in child.walk_preorder(): yield descendant
python
def walk_preorder(self): """Depth-first preorder walk over the cursor and its descendants. Yields cursors. """ yield self for child in self.get_children(): for descendant in child.walk_preorder(): yield descendant
[ "def", "walk_preorder", "(", "self", ")", ":", "yield", "self", "for", "child", "in", "self", ".", "get_children", "(", ")", ":", "for", "descendant", "in", "child", ".", "walk_preorder", "(", ")", ":", "yield", "descendant" ]
Depth-first preorder walk over the cursor and its descendants. Yields cursors.
[ "Depth", "-", "first", "preorder", "walk", "over", "the", "cursor", "and", "its", "descendants", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1727-L1735
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Cursor.is_anonymous
def is_anonymous(self): """ Check if the record is anonymous. """ if self.kind == CursorKind.FIELD_DECL: return self.type.get_declaration().is_anonymous() return conf.lib.clang_Cursor_isAnonymous(self)
python
def is_anonymous(self): """ Check if the record is anonymous. """ if self.kind == CursorKind.FIELD_DECL: return self.type.get_declaration().is_anonymous() return conf.lib.clang_Cursor_isAnonymous(self)
[ "def", "is_anonymous", "(", "self", ")", ":", "if", "self", ".", "kind", "==", "CursorKind", ".", "FIELD_DECL", ":", "return", "self", ".", "type", ".", "get_declaration", "(", ")", ".", "is_anonymous", "(", ")", "return", "conf", ".", "lib", ".", "cla...
Check if the record is anonymous.
[ "Check", "if", "the", "record", "is", "anonymous", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1749-L1755
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Type.argument_types
def argument_types(self): """Retrieve a container for the non-variadic arguments for this type. The returned object is iterable and indexable. Each item in the container is a Type instance. """ class ArgumentsIterator(collections.Sequence): def __init__(self, parent)...
python
def argument_types(self): """Retrieve a container for the non-variadic arguments for this type. The returned object is iterable and indexable. Each item in the container is a Type instance. """ class ArgumentsIterator(collections.Sequence): def __init__(self, parent)...
[ "def", "argument_types", "(", "self", ")", ":", "class", "ArgumentsIterator", "(", "collections", ".", "Sequence", ")", ":", "def", "__init__", "(", "self", ",", "parent", ")", ":", "self", ".", "parent", "=", "parent", "self", ".", "length", "=", "None"...
Retrieve a container for the non-variadic arguments for this type. The returned object is iterable and indexable. Each item in the container is a Type instance.
[ "Retrieve", "a", "container", "for", "the", "non", "-", "variadic", "arguments", "for", "this", "type", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L1974-L2010
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Type.element_type
def element_type(self): """Retrieve the Type of elements within this Type. If accessed on a type that is not an array, complex, or vector type, an exception will be raised. """ result = conf.lib.clang_getElementType(self) if result.kind == TypeKind.INVALID: r...
python
def element_type(self): """Retrieve the Type of elements within this Type. If accessed on a type that is not an array, complex, or vector type, an exception will be raised. """ result = conf.lib.clang_getElementType(self) if result.kind == TypeKind.INVALID: r...
[ "def", "element_type", "(", "self", ")", ":", "result", "=", "conf", ".", "lib", ".", "clang_getElementType", "(", "self", ")", "if", "result", ".", "kind", "==", "TypeKind", ".", "INVALID", ":", "raise", "Exception", "(", "'Element type not available on this ...
Retrieve the Type of elements within this Type. If accessed on a type that is not an array, complex, or vector type, an exception will be raised.
[ "Retrieve", "the", "Type", "of", "elements", "within", "this", "Type", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2013-L2023
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Type.element_count
def element_count(self): """Retrieve the number of elements in this type. Returns an int. If the Type is not an array or vector, this raises. """ result = conf.lib.clang_getNumElements(self) if result < 0: raise Exception('Type does not have elements.') ...
python
def element_count(self): """Retrieve the number of elements in this type. Returns an int. If the Type is not an array or vector, this raises. """ result = conf.lib.clang_getNumElements(self) if result < 0: raise Exception('Type does not have elements.') ...
[ "def", "element_count", "(", "self", ")", ":", "result", "=", "conf", ".", "lib", ".", "clang_getNumElements", "(", "self", ")", "if", "result", "<", "0", ":", "raise", "Exception", "(", "'Type does not have elements.'", ")", "return", "result" ]
Retrieve the number of elements in this type. Returns an int. If the Type is not an array or vector, this raises.
[ "Retrieve", "the", "number", "of", "elements", "in", "this", "type", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2026-L2037
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Type.is_function_variadic
def is_function_variadic(self): """Determine whether this function Type is a variadic function type.""" assert self.kind == TypeKind.FUNCTIONPROTO return conf.lib.clang_isFunctionTypeVariadic(self)
python
def is_function_variadic(self): """Determine whether this function Type is a variadic function type.""" assert self.kind == TypeKind.FUNCTIONPROTO return conf.lib.clang_isFunctionTypeVariadic(self)
[ "def", "is_function_variadic", "(", "self", ")", ":", "assert", "self", ".", "kind", "==", "TypeKind", ".", "FUNCTIONPROTO", "return", "conf", ".", "lib", ".", "clang_isFunctionTypeVariadic", "(", "self", ")" ]
Determine whether this function Type is a variadic function type.
[ "Determine", "whether", "this", "function", "Type", "is", "a", "variadic", "function", "type", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2097-L2101
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Type.get_fields
def get_fields(self): """Return an iterator for accessing the fields of this type.""" def visitor(field, children): assert field != conf.lib.clang_getNullCursor() # Create reference to TU so it isn't GC'd before Cursor. field._tu = self._tu fields.append...
python
def get_fields(self): """Return an iterator for accessing the fields of this type.""" def visitor(field, children): assert field != conf.lib.clang_getNullCursor() # Create reference to TU so it isn't GC'd before Cursor. field._tu = self._tu fields.append...
[ "def", "get_fields", "(", "self", ")", ":", "def", "visitor", "(", "field", ",", "children", ")", ":", "assert", "field", "!=", "conf", ".", "lib", ".", "clang_getNullCursor", "(", ")", "field", ".", "_tu", "=", "self", ".", "_tu", "fields", ".", "ap...
Return an iterator for accessing the fields of this type.
[ "Return", "an", "iterator", "for", "accessing", "the", "fields", "of", "this", "type", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2174-L2187
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Index.parse
def parse(self, path, args=None, unsaved_files=None, options = 0): """Load the translation unit from the given source code file by running clang and generating the AST before loading. Additional command line parameters can be passed to clang via the args parameter. In-memory contents fo...
python
def parse(self, path, args=None, unsaved_files=None, options = 0): """Load the translation unit from the given source code file by running clang and generating the AST before loading. Additional command line parameters can be passed to clang via the args parameter. In-memory contents fo...
[ "def", "parse", "(", "self", ",", "path", ",", "args", "=", "None", ",", "unsaved_files", "=", "None", ",", "options", "=", "0", ")", ":", "return", "TranslationUnit", ".", "from_source", "(", "path", ",", "args", ",", "unsaved_files", ",", "options", ...
Load the translation unit from the given source code file by running clang and generating the AST before loading. Additional command line parameters can be passed to clang via the args parameter. In-memory contents for files can be provided by passing a list of pairs to as unsaved_files...
[ "Load", "the", "translation", "unit", "from", "the", "given", "source", "code", "file", "by", "running", "clang", "and", "generating", "the", "AST", "before", "loading", ".", "Additional", "command", "line", "parameters", "can", "be", "passed", "to", "clang", ...
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2471-L2485
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TranslationUnit.from_ast_file
def from_ast_file(cls, filename, index=None): """Create a TranslationUnit instance from a saved AST file. A previously-saved AST file (provided with -emit-ast or TranslationUnit.save()) is loaded from the filename specified. If the file cannot be loaded, a TranslationUnitLoadError will...
python
def from_ast_file(cls, filename, index=None): """Create a TranslationUnit instance from a saved AST file. A previously-saved AST file (provided with -emit-ast or TranslationUnit.save()) is loaded from the filename specified. If the file cannot be loaded, a TranslationUnitLoadError will...
[ "def", "from_ast_file", "(", "cls", ",", "filename", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "index", "=", "Index", ".", "create", "(", ")", "ptr", "=", "conf", ".", "lib", ".", "clang_createTranslationUnit", "(", "index"...
Create a TranslationUnit instance from a saved AST file. A previously-saved AST file (provided with -emit-ast or TranslationUnit.save()) is loaded from the filename specified. If the file cannot be loaded, a TranslationUnitLoadError will be raised. index is optional and is the...
[ "Create", "a", "TranslationUnit", "instance", "from", "a", "saved", "AST", "file", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2604-L2623
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TranslationUnit.get_includes
def get_includes(self): """ Return an iterable sequence of FileInclusion objects that describe the sequence of inclusions in a translation unit. The first object in this sequence is always the input file. Note that this method will not recursively iterate over header files includ...
python
def get_includes(self): """ Return an iterable sequence of FileInclusion objects that describe the sequence of inclusions in a translation unit. The first object in this sequence is always the input file. Note that this method will not recursively iterate over header files includ...
[ "def", "get_includes", "(", "self", ")", ":", "def", "visitor", "(", "fobj", ",", "lptr", ",", "depth", ",", "includes", ")", ":", "if", "depth", ">", "0", ":", "loc", "=", "lptr", ".", "contents", "includes", ".", "append", "(", "FileInclusion", "("...
Return an iterable sequence of FileInclusion objects that describe the sequence of inclusions in a translation unit. The first object in this sequence is always the input file. Note that this method will not recursively iterate over header files included through precompiled headers.
[ "Return", "an", "iterable", "sequence", "of", "FileInclusion", "objects", "that", "describe", "the", "sequence", "of", "inclusions", "in", "a", "translation", "unit", ".", "The", "first", "object", "in", "this", "sequence", "is", "always", "the", "input", "fil...
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2648-L2666
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TranslationUnit.get_location
def get_location(self, filename, position): """Obtain a SourceLocation for a file in this translation unit. The position can be specified by passing: - Integer file offset. Initial file offset is 0. - 2-tuple of (line number, column number). Initial file position is (0,...
python
def get_location(self, filename, position): """Obtain a SourceLocation for a file in this translation unit. The position can be specified by passing: - Integer file offset. Initial file offset is 0. - 2-tuple of (line number, column number). Initial file position is (0,...
[ "def", "get_location", "(", "self", ",", "filename", ",", "position", ")", ":", "f", "=", "self", ".", "get_file", "(", "filename", ")", "if", "isinstance", "(", "position", ",", "int", ")", ":", "return", "SourceLocation", ".", "from_offset", "(", "self...
Obtain a SourceLocation for a file in this translation unit. The position can be specified by passing: - Integer file offset. Initial file offset is 0. - 2-tuple of (line number, column number). Initial file position is (0, 0)
[ "Obtain", "a", "SourceLocation", "for", "a", "file", "in", "this", "translation", "unit", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2673-L2687
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TranslationUnit.get_extent
def get_extent(self, filename, locations): """Obtain a SourceRange from this translation unit. The bounds of the SourceRange must ultimately be defined by a start and end SourceLocation. For the locations argument, you can pass: - 2 SourceLocation instances in a 2-tuple or list. ...
python
def get_extent(self, filename, locations): """Obtain a SourceRange from this translation unit. The bounds of the SourceRange must ultimately be defined by a start and end SourceLocation. For the locations argument, you can pass: - 2 SourceLocation instances in a 2-tuple or list. ...
[ "def", "get_extent", "(", "self", ",", "filename", ",", "locations", ")", ":", "f", "=", "self", ".", "get_file", "(", "filename", ")", "if", "len", "(", "locations", ")", "<", "2", ":", "raise", "Exception", "(", "'Must pass object with at least 2 elements'...
Obtain a SourceRange from this translation unit. The bounds of the SourceRange must ultimately be defined by a start and end SourceLocation. For the locations argument, you can pass: - 2 SourceLocation instances in a 2-tuple or list. - 2 int file offsets via a 2-tuple or list. ...
[ "Obtain", "a", "SourceRange", "from", "this", "translation", "unit", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2689-L2727
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TranslationUnit.reparse
def reparse(self, unsaved_files=None, options=0): """ Reparse an already parsed translation unit. In-memory contents for files can be provided by passing a list of pairs as unsaved_files, the first items should be the filenames to be mapped and the second should be the contents ...
python
def reparse(self, unsaved_files=None, options=0): """ Reparse an already parsed translation unit. In-memory contents for files can be provided by passing a list of pairs as unsaved_files, the first items should be the filenames to be mapped and the second should be the contents ...
[ "def", "reparse", "(", "self", ",", "unsaved_files", "=", "None", ",", "options", "=", "0", ")", ":", "if", "unsaved_files", "is", "None", ":", "unsaved_files", "=", "[", "]", "unsaved_files_array", "=", "0", "if", "len", "(", "unsaved_files", ")", ":", ...
Reparse an already parsed translation unit. In-memory contents for files can be provided by passing a list of pairs as unsaved_files, the first items should be the filenames to be mapped and the second should be the contents to be substituted for the file. The contents may be passed as ...
[ "Reparse", "an", "already", "parsed", "translation", "unit", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2749-L2776
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TranslationUnit.save
def save(self, filename): """Saves the TranslationUnit to a file. This is equivalent to passing -emit-ast to the clang frontend. The saved file can be loaded back into a TranslationUnit. Or, if it corresponds to a header, it can be used as a pre-compiled header file. If an erro...
python
def save(self, filename): """Saves the TranslationUnit to a file. This is equivalent to passing -emit-ast to the clang frontend. The saved file can be loaded back into a TranslationUnit. Or, if it corresponds to a header, it can be used as a pre-compiled header file. If an erro...
[ "def", "save", "(", "self", ",", "filename", ")", ":", "options", "=", "conf", ".", "lib", ".", "clang_defaultSaveOptions", "(", "self", ")", "result", "=", "int", "(", "conf", ".", "lib", ".", "clang_saveTranslationUnit", "(", "self", ",", "filename", "...
Saves the TranslationUnit to a file. This is equivalent to passing -emit-ast to the clang frontend. The saved file can be loaded back into a TranslationUnit. Or, if it corresponds to a header, it can be used as a pre-compiled header file. If an error occurs while saving, a TranslationU...
[ "Saves", "the", "TranslationUnit", "to", "a", "file", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2778-L2798
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TranslationUnit.codeComplete
def codeComplete(self, path, line, column, unsaved_files=None, include_macros=False, include_code_patterns=False, include_brief_comments=False): """ Code complete in this translation unit. In-memory contents for files can be provided by passing a list o...
python
def codeComplete(self, path, line, column, unsaved_files=None, include_macros=False, include_code_patterns=False, include_brief_comments=False): """ Code complete in this translation unit. In-memory contents for files can be provided by passing a list o...
[ "def", "codeComplete", "(", "self", ",", "path", ",", "line", ",", "column", ",", "unsaved_files", "=", "None", ",", "include_macros", "=", "False", ",", "include_code_patterns", "=", "False", ",", "include_brief_comments", "=", "False", ")", ":", "options", ...
Code complete in this translation unit. In-memory contents for files can be provided by passing a list of pairs as unsaved_files, the first items should be the filenames to be mapped and the second should be the contents to be substituted for the file. The contents may be passed as stri...
[ "Code", "complete", "in", "this", "translation", "unit", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2800-L2843
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
TranslationUnit.get_tokens
def get_tokens(self, locations=None, extent=None): """Obtain tokens in this translation unit. This is a generator for Token instances. The caller specifies a range of source code to obtain tokens for. The range can be specified as a 2-tuple of SourceLocation or as a SourceRange. If both...
python
def get_tokens(self, locations=None, extent=None): """Obtain tokens in this translation unit. This is a generator for Token instances. The caller specifies a range of source code to obtain tokens for. The range can be specified as a 2-tuple of SourceLocation or as a SourceRange. If both...
[ "def", "get_tokens", "(", "self", ",", "locations", "=", "None", ",", "extent", "=", "None", ")", ":", "if", "locations", "is", "not", "None", ":", "extent", "=", "SourceRange", "(", "start", "=", "locations", "[", "0", "]", ",", "end", "=", "locatio...
Obtain tokens in this translation unit. This is a generator for Token instances. The caller specifies a range of source code to obtain tokens for. The range can be specified as a 2-tuple of SourceLocation or as a SourceRange. If both are defined, behavior is undefined.
[ "Obtain", "tokens", "in", "this", "translation", "unit", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2845-L2856
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
File.name
def name(self): """Return the complete file and path name of the file.""" return str(conf.lib.clang_getCString(conf.lib.clang_getFileName(self)))
python
def name(self): """Return the complete file and path name of the file.""" return str(conf.lib.clang_getCString(conf.lib.clang_getFileName(self)))
[ "def", "name", "(", "self", ")", ":", "return", "str", "(", "conf", ".", "lib", ".", "clang_getCString", "(", "conf", ".", "lib", ".", "clang_getFileName", "(", "self", ")", ")", ")" ]
Return the complete file and path name of the file.
[ "Return", "the", "complete", "file", "and", "path", "name", "of", "the", "file", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2870-L2872
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
CompileCommand.arguments
def arguments(self): """ Get an iterable object providing each argument in the command line for the compiler invocation as a _CXString. Invariant : the first argument is the compiler executable """ length = conf.lib.clang_CompileCommand_getNumArgs(self.cmd) for i...
python
def arguments(self): """ Get an iterable object providing each argument in the command line for the compiler invocation as a _CXString. Invariant : the first argument is the compiler executable """ length = conf.lib.clang_CompileCommand_getNumArgs(self.cmd) for i...
[ "def", "arguments", "(", "self", ")", ":", "length", "=", "conf", ".", "lib", ".", "clang_CompileCommand_getNumArgs", "(", "self", ".", "cmd", ")", "for", "i", "in", "xrange", "(", "length", ")", ":", "yield", "str", "(", "conf", ".", "lib", ".", "cl...
Get an iterable object providing each argument in the command line for the compiler invocation as a _CXString. Invariant : the first argument is the compiler executable
[ "Get", "an", "iterable", "object", "providing", "each", "argument", "in", "the", "command", "line", "for", "the", "compiler", "invocation", "as", "a", "_CXString", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2957-L2966
train
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
CompilationDatabase.fromDirectory
def fromDirectory(buildDir): """Builds a CompilationDatabase from the database found in buildDir""" errorCode = c_uint() try: cdb = conf.lib.clang_CompilationDatabase_fromDirectory(buildDir, byref(errorCode)) except CompilationDatabaseError as e: r...
python
def fromDirectory(buildDir): """Builds a CompilationDatabase from the database found in buildDir""" errorCode = c_uint() try: cdb = conf.lib.clang_CompilationDatabase_fromDirectory(buildDir, byref(errorCode)) except CompilationDatabaseError as e: r...
[ "def", "fromDirectory", "(", "buildDir", ")", ":", "errorCode", "=", "c_uint", "(", ")", "try", ":", "cdb", "=", "conf", ".", "lib", ".", "clang_CompilationDatabase_fromDirectory", "(", "buildDir", ",", "byref", "(", "errorCode", ")", ")", "except", "Compila...
Builds a CompilationDatabase from the database found in buildDir
[ "Builds", "a", "CompilationDatabase", "from", "the", "database", "found", "in", "buildDir" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L3013-L3022
train
hotdoc/hotdoc
hotdoc/extensions/gi/node_cache.py
get_klass_parents
def get_klass_parents(gi_name): ''' Returns a sorted list of qualified symbols representing the parents of the klass-like symbol named gi_name ''' res = [] parents = __HIERARCHY_GRAPH.predecessors(gi_name) if not parents: return [] __get_parent_link_recurse(parents[0], res) r...
python
def get_klass_parents(gi_name): ''' Returns a sorted list of qualified symbols representing the parents of the klass-like symbol named gi_name ''' res = [] parents = __HIERARCHY_GRAPH.predecessors(gi_name) if not parents: return [] __get_parent_link_recurse(parents[0], res) r...
[ "def", "get_klass_parents", "(", "gi_name", ")", ":", "res", "=", "[", "]", "parents", "=", "__HIERARCHY_GRAPH", ".", "predecessors", "(", "gi_name", ")", "if", "not", "parents", ":", "return", "[", "]", "__get_parent_link_recurse", "(", "parents", "[", "0",...
Returns a sorted list of qualified symbols representing the parents of the klass-like symbol named gi_name
[ "Returns", "a", "sorted", "list", "of", "qualified", "symbols", "representing", "the", "parents", "of", "the", "klass", "-", "like", "symbol", "named", "gi_name" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L173-L183
train
hotdoc/hotdoc
hotdoc/extensions/gi/node_cache.py
get_klass_children
def get_klass_children(gi_name): ''' Returns a dict of qualified symbols representing the children of the klass-like symbol named gi_name ''' res = {} children = __HIERARCHY_GRAPH.successors(gi_name) for gi_name in children: ctype_name = ALL_GI_TYPES[gi_name] qs = QualifiedSy...
python
def get_klass_children(gi_name): ''' Returns a dict of qualified symbols representing the children of the klass-like symbol named gi_name ''' res = {} children = __HIERARCHY_GRAPH.successors(gi_name) for gi_name in children: ctype_name = ALL_GI_TYPES[gi_name] qs = QualifiedSy...
[ "def", "get_klass_children", "(", "gi_name", ")", ":", "res", "=", "{", "}", "children", "=", "__HIERARCHY_GRAPH", ".", "successors", "(", "gi_name", ")", "for", "gi_name", "in", "children", ":", "ctype_name", "=", "ALL_GI_TYPES", "[", "gi_name", "]", "qs", ...
Returns a dict of qualified symbols representing the children of the klass-like symbol named gi_name
[ "Returns", "a", "dict", "of", "qualified", "symbols", "representing", "the", "children", "of", "the", "klass", "-", "like", "symbol", "named", "gi_name" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L186-L199
train
hotdoc/hotdoc
hotdoc/extensions/gi/node_cache.py
cache_nodes
def cache_nodes(gir_root, all_girs): ''' Identify and store all the gir symbols the symbols we will document may link to, or be typed with ''' ns_node = gir_root.find('./{%s}namespace' % NS_MAP['core']) id_prefixes = ns_node.attrib['{%s}identifier-prefixes' % NS_MAP['c']] sym_prefixes = ns_n...
python
def cache_nodes(gir_root, all_girs): ''' Identify and store all the gir symbols the symbols we will document may link to, or be typed with ''' ns_node = gir_root.find('./{%s}namespace' % NS_MAP['core']) id_prefixes = ns_node.attrib['{%s}identifier-prefixes' % NS_MAP['c']] sym_prefixes = ns_n...
[ "def", "cache_nodes", "(", "gir_root", ",", "all_girs", ")", ":", "ns_node", "=", "gir_root", ".", "find", "(", "'./{%s}namespace'", "%", "NS_MAP", "[", "'core'", "]", ")", "id_prefixes", "=", "ns_node", ".", "attrib", "[", "'{%s}identifier-prefixes'", "%", ...
Identify and store all the gir symbols the symbols we will document may link to, or be typed with
[ "Identify", "and", "store", "all", "the", "gir", "symbols", "the", "symbols", "we", "will", "document", "may", "link", "to", "or", "be", "typed", "with" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L202-L277
train
hotdoc/hotdoc
hotdoc/extensions/gi/node_cache.py
type_description_from_node
def type_description_from_node(gi_node): ''' Parse a typed node, returns a usable description ''' ctype_name, gi_name, array_nesting = unnest_type (gi_node) cur_ns = get_namespace(gi_node) if ctype_name is not None: type_tokens = __type_tokens_from_cdecl (ctype_name) else: ...
python
def type_description_from_node(gi_node): ''' Parse a typed node, returns a usable description ''' ctype_name, gi_name, array_nesting = unnest_type (gi_node) cur_ns = get_namespace(gi_node) if ctype_name is not None: type_tokens = __type_tokens_from_cdecl (ctype_name) else: ...
[ "def", "type_description_from_node", "(", "gi_node", ")", ":", "ctype_name", ",", "gi_name", ",", "array_nesting", "=", "unnest_type", "(", "gi_node", ")", "cur_ns", "=", "get_namespace", "(", "gi_node", ")", "if", "ctype_name", "is", "not", "None", ":", "type...
Parse a typed node, returns a usable description
[ "Parse", "a", "typed", "node", "returns", "a", "usable", "description" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L318-L335
train
hotdoc/hotdoc
hotdoc/extensions/gi/node_cache.py
is_introspectable
def is_introspectable(name, language): ''' Do not call this before caching the nodes ''' if name in FUNDAMENTALS[language]: return True if name not in __TRANSLATED_NAMES[language]: return False return True
python
def is_introspectable(name, language): ''' Do not call this before caching the nodes ''' if name in FUNDAMENTALS[language]: return True if name not in __TRANSLATED_NAMES[language]: return False return True
[ "def", "is_introspectable", "(", "name", ",", "language", ")", ":", "if", "name", "in", "FUNDAMENTALS", "[", "language", "]", ":", "return", "True", "if", "name", "not", "in", "__TRANSLATED_NAMES", "[", "language", "]", ":", "return", "False", "return", "T...
Do not call this before caching the nodes
[ "Do", "not", "call", "this", "before", "caching", "the", "nodes" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L338-L348
train
hotdoc/hotdoc
hotdoc/core/config.py
Config.get_markdown_files
def get_markdown_files(self, dir_): """ Get all the markdown files in a folder, recursively Args: dir_: str, a toplevel folder to walk. """ md_files = OrderedSet() for root, _, files in os.walk(dir_): for name in files: split = os....
python
def get_markdown_files(self, dir_): """ Get all the markdown files in a folder, recursively Args: dir_: str, a toplevel folder to walk. """ md_files = OrderedSet() for root, _, files in os.walk(dir_): for name in files: split = os....
[ "def", "get_markdown_files", "(", "self", ",", "dir_", ")", ":", "md_files", "=", "OrderedSet", "(", ")", "for", "root", ",", "_", ",", "files", "in", "os", ".", "walk", "(", "dir_", ")", ":", "for", "name", "in", "files", ":", "split", "=", "os", ...
Get all the markdown files in a folder, recursively Args: dir_: str, a toplevel folder to walk.
[ "Get", "all", "the", "markdown", "files", "in", "a", "folder", "recursively" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L164-L179
train
hotdoc/hotdoc
hotdoc/core/config.py
Config.get
def get(self, key, default=None): """ Get the value for `key`. Gives priority to command-line overrides. Args: key: str, the key to get the value for. Returns: object: The value for `key` """ if key in self.__cli: return self...
python
def get(self, key, default=None): """ Get the value for `key`. Gives priority to command-line overrides. Args: key: str, the key to get the value for. Returns: object: The value for `key` """ if key in self.__cli: return self...
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "if", "key", "in", "self", ".", "__cli", ":", "return", "self", ".", "__cli", "[", "key", "]", "if", "key", "in", "self", ".", "__config", ":", "return", "self", ".", ...
Get the value for `key`. Gives priority to command-line overrides. Args: key: str, the key to get the value for. Returns: object: The value for `key`
[ "Get", "the", "value", "for", "key", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L187-L205
train
hotdoc/hotdoc
hotdoc/core/config.py
Config.get_index
def get_index(self, prefix=''): """ Retrieve the absolute path to an index, according to `prefix`. Args: prefix: str, the desired prefix or `None`. Returns: str: An absolute path, or `None` """ if prefix: prefixed = '%s_index'...
python
def get_index(self, prefix=''): """ Retrieve the absolute path to an index, according to `prefix`. Args: prefix: str, the desired prefix or `None`. Returns: str: An absolute path, or `None` """ if prefix: prefixed = '%s_index'...
[ "def", "get_index", "(", "self", ",", "prefix", "=", "''", ")", ":", "if", "prefix", ":", "prefixed", "=", "'%s_index'", "%", "prefix", "else", ":", "prefixed", "=", "'index'", "if", "prefixed", "in", "self", ".", "__cli", "and", "self", ".", "__cli", ...
Retrieve the absolute path to an index, according to `prefix`. Args: prefix: str, the desired prefix or `None`. Returns: str: An absolute path, or `None`
[ "Retrieve", "the", "absolute", "path", "to", "an", "index", "according", "to", "prefix", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L207-L230
train
hotdoc/hotdoc
hotdoc/core/config.py
Config.get_path
def get_path(self, key, rel_to_cwd=False, rel_to_conf=False): """ Retrieve a path from the config, resolving it against the invokation directory or the configuration file directory, depending on whether it was passed through the command-line or the configuration file. Ar...
python
def get_path(self, key, rel_to_cwd=False, rel_to_conf=False): """ Retrieve a path from the config, resolving it against the invokation directory or the configuration file directory, depending on whether it was passed through the command-line or the configuration file. Ar...
[ "def", "get_path", "(", "self", ",", "key", ",", "rel_to_cwd", "=", "False", ",", "rel_to_conf", "=", "False", ")", ":", "if", "key", "in", "self", ".", "__cli", ":", "path", "=", "self", ".", "__cli", "[", "key", "]", "from_conf", "=", "False", "e...
Retrieve a path from the config, resolving it against the invokation directory or the configuration file directory, depending on whether it was passed through the command-line or the configuration file. Args: key: str, the key to lookup the path with Returns: ...
[ "Retrieve", "a", "path", "from", "the", "config", "resolving", "it", "against", "the", "invokation", "directory", "or", "the", "configuration", "file", "directory", "depending", "on", "whether", "it", "was", "passed", "through", "the", "command", "-", "line", ...
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L232-L262
train
hotdoc/hotdoc
hotdoc/core/config.py
Config.get_paths
def get_paths(self, key): """ Same as `ConfigParser.get_path` for a list of paths. Args: key: str, the key to lookup the paths with Returns: list: The paths. """ final_paths = [] if key in self.__cli: paths = self.__cli[key] ...
python
def get_paths(self, key): """ Same as `ConfigParser.get_path` for a list of paths. Args: key: str, the key to lookup the paths with Returns: list: The paths. """ final_paths = [] if key in self.__cli: paths = self.__cli[key] ...
[ "def", "get_paths", "(", "self", ",", "key", ")", ":", "final_paths", "=", "[", "]", "if", "key", "in", "self", ".", "__cli", ":", "paths", "=", "self", ".", "__cli", "[", "key", "]", "or", "[", "]", "from_conf", "=", "False", "else", ":", "paths...
Same as `ConfigParser.get_path` for a list of paths. Args: key: str, the key to lookup the paths with Returns: list: The paths.
[ "Same", "as", "ConfigParser", ".", "get_path", "for", "a", "list", "of", "paths", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L264-L288
train
hotdoc/hotdoc
hotdoc/core/config.py
Config.get_sources
def get_sources(self, prefix=''): """ Retrieve a set of absolute paths to sources, according to `prefix` `ConfigParser` will perform wildcard expansion and filtering. Args: prefix: str, the desired prefix. Returns: utils.utils.OrderedSet: The se...
python
def get_sources(self, prefix=''): """ Retrieve a set of absolute paths to sources, according to `prefix` `ConfigParser` will perform wildcard expansion and filtering. Args: prefix: str, the desired prefix. Returns: utils.utils.OrderedSet: The se...
[ "def", "get_sources", "(", "self", ",", "prefix", "=", "''", ")", ":", "prefix", "=", "prefix", ".", "replace", "(", "'-'", ",", "'_'", ")", "prefixed", "=", "'%s_sources'", "%", "prefix", "if", "prefixed", "in", "self", ".", "__cli", ":", "sources", ...
Retrieve a set of absolute paths to sources, according to `prefix` `ConfigParser` will perform wildcard expansion and filtering. Args: prefix: str, the desired prefix. Returns: utils.utils.OrderedSet: The set of sources for the given `prefix`.
[ "Retrieve", "a", "set", "of", "absolute", "paths", "to", "sources", "according", "to", "prefix" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L290-L332
train
hotdoc/hotdoc
hotdoc/core/config.py
Config.get_dependencies
def get_dependencies(self): """ Retrieve the set of all dependencies for a given configuration. Returns: utils.utils.OrderedSet: The set of all dependencies for the tracked configuration. """ all_deps = OrderedSet() for key, _ in list(self.__c...
python
def get_dependencies(self): """ Retrieve the set of all dependencies for a given configuration. Returns: utils.utils.OrderedSet: The set of all dependencies for the tracked configuration. """ all_deps = OrderedSet() for key, _ in list(self.__c...
[ "def", "get_dependencies", "(", "self", ")", ":", "all_deps", "=", "OrderedSet", "(", ")", "for", "key", ",", "_", "in", "list", "(", "self", ".", "__config", ".", "items", "(", ")", ")", ":", "if", "key", "in", "self", ".", "__cli", ":", "continue...
Retrieve the set of all dependencies for a given configuration. Returns: utils.utils.OrderedSet: The set of all dependencies for the tracked configuration.
[ "Retrieve", "the", "set", "of", "all", "dependencies", "for", "a", "given", "configuration", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L334-L360
train
hotdoc/hotdoc
hotdoc/core/config.py
Config.dump
def dump(self, conf_file=None): """ Dump the possibly updated config to a file. Args: conf_file: str, the destination, or None to overwrite the existing configuration. """ if conf_file: conf_dir = os.path.dirname(conf_file) if...
python
def dump(self, conf_file=None): """ Dump the possibly updated config to a file. Args: conf_file: str, the destination, or None to overwrite the existing configuration. """ if conf_file: conf_dir = os.path.dirname(conf_file) if...
[ "def", "dump", "(", "self", ",", "conf_file", "=", "None", ")", ":", "if", "conf_file", ":", "conf_dir", "=", "os", ".", "path", ".", "dirname", "(", "conf_file", ")", "if", "not", "conf_dir", ":", "conf_dir", "=", "self", ".", "__invoke_dir", "elif", ...
Dump the possibly updated config to a file. Args: conf_file: str, the destination, or None to overwrite the existing configuration.
[ "Dump", "the", "possibly", "updated", "config", "to", "a", "file", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L363-L405
train
hotdoc/hotdoc
hotdoc/utils/setup_utils.py
_update_submodules
def _update_submodules(repo_dir): """update submodules in a repo""" subprocess.check_call("git submodule init", cwd=repo_dir, shell=True) subprocess.check_call( "git submodule update --recursive", cwd=repo_dir, shell=True)
python
def _update_submodules(repo_dir): """update submodules in a repo""" subprocess.check_call("git submodule init", cwd=repo_dir, shell=True) subprocess.check_call( "git submodule update --recursive", cwd=repo_dir, shell=True)
[ "def", "_update_submodules", "(", "repo_dir", ")", ":", "subprocess", ".", "check_call", "(", "\"git submodule init\"", ",", "cwd", "=", "repo_dir", ",", "shell", "=", "True", ")", "subprocess", ".", "check_call", "(", "\"git submodule update --recursive\"", ",", ...
update submodules in a repo
[ "update", "submodules", "in", "a", "repo" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L75-L79
train
hotdoc/hotdoc
hotdoc/utils/setup_utils.py
require_clean_submodules
def require_clean_submodules(repo_root, submodules): """Check on git submodules before distutils can do anything Since distutils cannot be trusted to update the tree after everything has been set in motion, this is not a distutils command. """ # PACKAGERS: Add a return here to skip checks for gi...
python
def require_clean_submodules(repo_root, submodules): """Check on git submodules before distutils can do anything Since distutils cannot be trusted to update the tree after everything has been set in motion, this is not a distutils command. """ # PACKAGERS: Add a return here to skip checks for gi...
[ "def", "require_clean_submodules", "(", "repo_root", ",", "submodules", ")", ":", "for", "do_nothing", "in", "(", "'-h'", ",", "'--help'", ",", "'--help-commands'", ",", "'clean'", ",", "'submodule'", ")", ":", "if", "do_nothing", "in", "sys", ".", "argv", "...
Check on git submodules before distutils can do anything Since distutils cannot be trusted to update the tree after everything has been set in motion, this is not a distutils command.
[ "Check", "on", "git", "submodules", "before", "distutils", "can", "do", "anything", "Since", "distutils", "cannot", "be", "trusted", "to", "update", "the", "tree", "after", "everything", "has", "been", "set", "in", "motion", "this", "is", "not", "a", "distut...
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L93-L113
train
hotdoc/hotdoc
hotdoc/utils/setup_utils.py
symlink
def symlink(source, link_name): """ Method to allow creating symlinks on Windows """ if os.path.islink(link_name) and os.readlink(link_name) == source: return os_symlink = getattr(os, "symlink", None) if callable(os_symlink): os_symlink(source, link_name) else: impor...
python
def symlink(source, link_name): """ Method to allow creating symlinks on Windows """ if os.path.islink(link_name) and os.readlink(link_name) == source: return os_symlink = getattr(os, "symlink", None) if callable(os_symlink): os_symlink(source, link_name) else: impor...
[ "def", "symlink", "(", "source", ",", "link_name", ")", ":", "if", "os", ".", "path", ".", "islink", "(", "link_name", ")", "and", "os", ".", "readlink", "(", "link_name", ")", "==", "source", ":", "return", "os_symlink", "=", "getattr", "(", "os", "...
Method to allow creating symlinks on Windows
[ "Method", "to", "allow", "creating", "symlinks", "on", "Windows" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L116-L133
train
hotdoc/hotdoc
hotdoc/utils/setup_utils.py
pkgconfig
def pkgconfig(*packages, **kw): """ Query pkg-config for library compile and linking options. Return configuration in distutils Extension format. Usage: pkgconfig('opencv') pkgconfig('opencv', 'libavformat') pkgconfig('opencv', optional='--static') pkgconfig('opencv', config=c) ...
python
def pkgconfig(*packages, **kw): """ Query pkg-config for library compile and linking options. Return configuration in distutils Extension format. Usage: pkgconfig('opencv') pkgconfig('opencv', 'libavformat') pkgconfig('opencv', optional='--static') pkgconfig('opencv', config=c) ...
[ "def", "pkgconfig", "(", "*", "packages", ",", "**", "kw", ")", ":", "config", "=", "kw", ".", "setdefault", "(", "'config'", ",", "{", "}", ")", "optional_args", "=", "kw", ".", "setdefault", "(", "'optional'", ",", "''", ")", "flag_map", "=", "{", ...
Query pkg-config for library compile and linking options. Return configuration in distutils Extension format. Usage: pkgconfig('opencv') pkgconfig('opencv', 'libavformat') pkgconfig('opencv', optional='--static') pkgconfig('opencv', config=c) returns e.g. {'extra_compile_args': []...
[ "Query", "pkg", "-", "config", "for", "library", "compile", "and", "linking", "options", ".", "Return", "configuration", "in", "distutils", "Extension", "format", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L135-L180
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger.register_error_code
def register_error_code(code, exception_type, domain='core'): """Register a new error code""" Logger._error_code_to_exception[code] = (exception_type, domain) Logger._domain_codes[domain].add(code)
python
def register_error_code(code, exception_type, domain='core'): """Register a new error code""" Logger._error_code_to_exception[code] = (exception_type, domain) Logger._domain_codes[domain].add(code)
[ "def", "register_error_code", "(", "code", ",", "exception_type", ",", "domain", "=", "'core'", ")", ":", "Logger", ".", "_error_code_to_exception", "[", "code", "]", "=", "(", "exception_type", ",", "domain", ")", "Logger", ".", "_domain_codes", "[", "domain"...
Register a new error code
[ "Register", "a", "new", "error", "code" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L201-L204
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger.register_warning_code
def register_warning_code(code, exception_type, domain='core'): """Register a new warning code""" Logger._warning_code_to_exception[code] = (exception_type, domain) Logger._domain_codes[domain].add(code)
python
def register_warning_code(code, exception_type, domain='core'): """Register a new warning code""" Logger._warning_code_to_exception[code] = (exception_type, domain) Logger._domain_codes[domain].add(code)
[ "def", "register_warning_code", "(", "code", ",", "exception_type", ",", "domain", "=", "'core'", ")", ":", "Logger", ".", "_warning_code_to_exception", "[", "code", "]", "=", "(", "exception_type", ",", "domain", ")", "Logger", ".", "_domain_codes", "[", "dom...
Register a new warning code
[ "Register", "a", "new", "warning", "code" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L207-L210
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger._log
def _log(code, message, level, domain): """Call this to add an entry in the journal""" entry = LogEntry(level, domain, code, message) Logger.journal.append(entry) if Logger.silent: return if level >= Logger._verbosity: _print_entry(entry)
python
def _log(code, message, level, domain): """Call this to add an entry in the journal""" entry = LogEntry(level, domain, code, message) Logger.journal.append(entry) if Logger.silent: return if level >= Logger._verbosity: _print_entry(entry)
[ "def", "_log", "(", "code", ",", "message", ",", "level", ",", "domain", ")", ":", "entry", "=", "LogEntry", "(", "level", ",", "domain", ",", "code", ",", "message", ")", "Logger", ".", "journal", ".", "append", "(", "entry", ")", "if", "Logger", ...
Call this to add an entry in the journal
[ "Call", "this", "to", "add", "an", "entry", "in", "the", "journal" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L213-L222
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger.error
def error(code, message, **kwargs): """Call this to raise an exception and have it stored in the journal""" assert code in Logger._error_code_to_exception exc_type, domain = Logger._error_code_to_exception[code] exc = exc_type(message, **kwargs) Logger._log(code, exc.message, ERR...
python
def error(code, message, **kwargs): """Call this to raise an exception and have it stored in the journal""" assert code in Logger._error_code_to_exception exc_type, domain = Logger._error_code_to_exception[code] exc = exc_type(message, **kwargs) Logger._log(code, exc.message, ERR...
[ "def", "error", "(", "code", ",", "message", ",", "**", "kwargs", ")", ":", "assert", "code", "in", "Logger", ".", "_error_code_to_exception", "exc_type", ",", "domain", "=", "Logger", ".", "_error_code_to_exception", "[", "code", "]", "exc", "=", "exc_type"...
Call this to raise an exception and have it stored in the journal
[ "Call", "this", "to", "raise", "an", "exception", "and", "have", "it", "stored", "in", "the", "journal" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L225-L231
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger.warn
def warn(code, message, **kwargs): """ Call this to store a warning in the journal. Will raise if `Logger.fatal_warnings` is set to True. """ if code in Logger._ignored_codes: return assert code in Logger._warning_code_to_exception exc_type, domain ...
python
def warn(code, message, **kwargs): """ Call this to store a warning in the journal. Will raise if `Logger.fatal_warnings` is set to True. """ if code in Logger._ignored_codes: return assert code in Logger._warning_code_to_exception exc_type, domain ...
[ "def", "warn", "(", "code", ",", "message", ",", "**", "kwargs", ")", ":", "if", "code", "in", "Logger", ".", "_ignored_codes", ":", "return", "assert", "code", "in", "Logger", ".", "_warning_code_to_exception", "exc_type", ",", "domain", "=", "Logger", "....
Call this to store a warning in the journal. Will raise if `Logger.fatal_warnings` is set to True.
[ "Call", "this", "to", "store", "a", "warning", "in", "the", "journal", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L234-L259
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger.debug
def debug(message, domain): """Log debugging information""" if domain in Logger._ignored_domains: return Logger._log(None, message, DEBUG, domain)
python
def debug(message, domain): """Log debugging information""" if domain in Logger._ignored_domains: return Logger._log(None, message, DEBUG, domain)
[ "def", "debug", "(", "message", ",", "domain", ")", ":", "if", "domain", "in", "Logger", ".", "_ignored_domains", ":", "return", "Logger", ".", "_log", "(", "None", ",", "message", ",", "DEBUG", ",", "domain", ")" ]
Log debugging information
[ "Log", "debugging", "information" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L262-L267
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger.info
def info(message, domain): """Log simple info""" if domain in Logger._ignored_domains: return Logger._log(None, message, INFO, domain)
python
def info(message, domain): """Log simple info""" if domain in Logger._ignored_domains: return Logger._log(None, message, INFO, domain)
[ "def", "info", "(", "message", ",", "domain", ")", ":", "if", "domain", "in", "Logger", ".", "_ignored_domains", ":", "return", "Logger", ".", "_log", "(", "None", ",", "message", ",", "INFO", ",", "domain", ")" ]
Log simple info
[ "Log", "simple", "info" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L270-L275
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger.get_issues
def get_issues(): """Get actual issues in the journal.""" issues = [] for entry in Logger.journal: if entry.level >= WARNING: issues.append(entry) return issues
python
def get_issues(): """Get actual issues in the journal.""" issues = [] for entry in Logger.journal: if entry.level >= WARNING: issues.append(entry) return issues
[ "def", "get_issues", "(", ")", ":", "issues", "=", "[", "]", "for", "entry", "in", "Logger", ".", "journal", ":", "if", "entry", ".", "level", ">=", "WARNING", ":", "issues", ".", "append", "(", "entry", ")", "return", "issues" ]
Get actual issues in the journal.
[ "Get", "actual", "issues", "in", "the", "journal", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L298-L304
train
hotdoc/hotdoc
hotdoc/utils/loggable.py
Logger.reset
def reset(): """Resets Logger to its initial state""" Logger.journal = [] Logger.fatal_warnings = False Logger._ignored_codes = set() Logger._ignored_domains = set() Logger._verbosity = 2 Logger._last_checkpoint = 0
python
def reset(): """Resets Logger to its initial state""" Logger.journal = [] Logger.fatal_warnings = False Logger._ignored_codes = set() Logger._ignored_domains = set() Logger._verbosity = 2 Logger._last_checkpoint = 0
[ "def", "reset", "(", ")", ":", "Logger", ".", "journal", "=", "[", "]", "Logger", ".", "fatal_warnings", "=", "False", "Logger", ".", "_ignored_codes", "=", "set", "(", ")", "Logger", ".", "_ignored_domains", "=", "set", "(", ")", "Logger", ".", "_verb...
Resets Logger to its initial state
[ "Resets", "Logger", "to", "its", "initial", "state" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L307-L314
train
hotdoc/hotdoc
hotdoc/parsers/sitemap.py
Sitemap.walk
def walk(self, action, user_data=None): """ Walk the hierarchy, applying action to each filename. Args: action: callable, the callable to invoke for each filename, will be invoked with the filename, the subfiles, and the level in the sitemap. ...
python
def walk(self, action, user_data=None): """ Walk the hierarchy, applying action to each filename. Args: action: callable, the callable to invoke for each filename, will be invoked with the filename, the subfiles, and the level in the sitemap. ...
[ "def", "walk", "(", "self", ",", "action", ",", "user_data", "=", "None", ")", ":", "action", "(", "self", ".", "index_file", ",", "self", ".", "__root", ",", "0", ",", "user_data", ")", "self", ".", "__do_walk", "(", "self", ".", "__root", ",", "1...
Walk the hierarchy, applying action to each filename. Args: action: callable, the callable to invoke for each filename, will be invoked with the filename, the subfiles, and the level in the sitemap.
[ "Walk", "the", "hierarchy", "applying", "action", "to", "each", "filename", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/sitemap.py#L77-L87
train
hotdoc/hotdoc
hotdoc/parsers/sitemap.py
SitemapParser.parse
def parse(self, filename): """ Parse a sitemap file. Args: filename: str, the path to the sitemap file. Returns: Sitemap: the generated sitemap. """ with io.open(filename, 'r', encoding='utf-8') as _: lines = _.readlines() al...
python
def parse(self, filename): """ Parse a sitemap file. Args: filename: str, the path to the sitemap file. Returns: Sitemap: the generated sitemap. """ with io.open(filename, 'r', encoding='utf-8') as _: lines = _.readlines() al...
[ "def", "parse", "(", "self", ",", "filename", ")", ":", "with", "io", ".", "open", "(", "filename", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "_", ":", "lines", "=", "_", ".", "readlines", "(", ")", "all_source_files", "=", "set", "("...
Parse a sitemap file. Args: filename: str, the path to the sitemap file. Returns: Sitemap: the generated sitemap.
[ "Parse", "a", "sitemap", "file", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/sitemap.py#L144-L218
train
hotdoc/hotdoc
hotdoc/parsers/gtk_doc.py
GtkDocParser.parse_comment
def parse_comment(self, comment, filename, lineno, endlineno, include_paths=None, stripped=False): """ Returns a Comment given a string """ if not stripped and not self.__validate_c_comment(comment.strip()): return None title_offset = 0 ...
python
def parse_comment(self, comment, filename, lineno, endlineno, include_paths=None, stripped=False): """ Returns a Comment given a string """ if not stripped and not self.__validate_c_comment(comment.strip()): return None title_offset = 0 ...
[ "def", "parse_comment", "(", "self", ",", "comment", ",", "filename", ",", "lineno", ",", "endlineno", ",", "include_paths", "=", "None", ",", "stripped", "=", "False", ")", ":", "if", "not", "stripped", "and", "not", "self", ".", "__validate_c_comment", "...
Returns a Comment given a string
[ "Returns", "a", "Comment", "given", "a", "string" ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L303-L382
train
hotdoc/hotdoc
hotdoc/parsers/gtk_doc.py
GtkDocStringFormatter.comment_to_ast
def comment_to_ast(self, comment, link_resolver): """ Given a gtk-doc comment string, returns an opaque PyCapsule containing the document root. This is an optimization allowing to parse the docstring only once, and to render it multiple times with `ast_to_html`, links di...
python
def comment_to_ast(self, comment, link_resolver): """ Given a gtk-doc comment string, returns an opaque PyCapsule containing the document root. This is an optimization allowing to parse the docstring only once, and to render it multiple times with `ast_to_html`, links di...
[ "def", "comment_to_ast", "(", "self", ",", "comment", ",", "link_resolver", ")", ":", "assert", "comment", "is", "not", "None", "text", "=", "comment", ".", "description", "if", "(", "self", ".", "remove_xml_tags", "or", "comment", ".", "filename", "in", "...
Given a gtk-doc comment string, returns an opaque PyCapsule containing the document root. This is an optimization allowing to parse the docstring only once, and to render it multiple times with `ast_to_html`, links discovery and most of the link resolution being lazily done in t...
[ "Given", "a", "gtk", "-", "doc", "comment", "string", "returns", "an", "opaque", "PyCapsule", "containing", "the", "document", "root", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L396-L464
train
hotdoc/hotdoc
hotdoc/parsers/gtk_doc.py
GtkDocStringFormatter.ast_to_html
def ast_to_html(self, ast, link_resolver): """ See the documentation of `to_ast` for more information. Args: ast: PyCapsule, a capsule as returned by `to_ast` link_resolver: hotdoc.core.links.LinkResolver, a link resolver instance. """ ...
python
def ast_to_html(self, ast, link_resolver): """ See the documentation of `to_ast` for more information. Args: ast: PyCapsule, a capsule as returned by `to_ast` link_resolver: hotdoc.core.links.LinkResolver, a link resolver instance. """ ...
[ "def", "ast_to_html", "(", "self", ",", "ast", ",", "link_resolver", ")", ":", "out", ",", "_", "=", "cmark", ".", "ast_to_html", "(", "ast", ",", "link_resolver", ")", "return", "out" ]
See the documentation of `to_ast` for more information. Args: ast: PyCapsule, a capsule as returned by `to_ast` link_resolver: hotdoc.core.links.LinkResolver, a link resolver instance.
[ "See", "the", "documentation", "of", "to_ast", "for", "more", "information", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L467-L478
train
hotdoc/hotdoc
hotdoc/parsers/gtk_doc.py
GtkDocStringFormatter.translate_comment
def translate_comment(self, comment, link_resolver): """ Given a gtk-doc comment string, returns the comment translated to the desired format. """ out = u'' self.translate_tags(comment, link_resolver) ast = self.comment_to_ast(comment, link_resolver) out ...
python
def translate_comment(self, comment, link_resolver): """ Given a gtk-doc comment string, returns the comment translated to the desired format. """ out = u'' self.translate_tags(comment, link_resolver) ast = self.comment_to_ast(comment, link_resolver) out ...
[ "def", "translate_comment", "(", "self", ",", "comment", ",", "link_resolver", ")", ":", "out", "=", "u''", "self", ".", "translate_tags", "(", "comment", ",", "link_resolver", ")", "ast", "=", "self", ".", "comment_to_ast", "(", "comment", ",", "link_resolv...
Given a gtk-doc comment string, returns the comment translated to the desired format.
[ "Given", "a", "gtk", "-", "doc", "comment", "string", "returns", "the", "comment", "translated", "to", "the", "desired", "format", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L480-L490
train
hotdoc/hotdoc
hotdoc/core/comment.py
comment_from_tag
def comment_from_tag(tag): """ Convenience function to create a full-fledged comment for a given tag, for example it is convenient to assign a Comment to a ReturnValueSymbol. """ if not tag: return None comment = Comment(name=tag.name, meta={'description': tag.d...
python
def comment_from_tag(tag): """ Convenience function to create a full-fledged comment for a given tag, for example it is convenient to assign a Comment to a ReturnValueSymbol. """ if not tag: return None comment = Comment(name=tag.name, meta={'description': tag.d...
[ "def", "comment_from_tag", "(", "tag", ")", ":", "if", "not", "tag", ":", "return", "None", "comment", "=", "Comment", "(", "name", "=", "tag", ".", "name", ",", "meta", "=", "{", "'description'", ":", "tag", ".", "description", "}", ",", "annotations"...
Convenience function to create a full-fledged comment for a given tag, for example it is convenient to assign a Comment to a ReturnValueSymbol.
[ "Convenience", "function", "to", "create", "a", "full", "-", "fledged", "comment", "for", "a", "given", "tag", "for", "example", "it", "is", "convenient", "to", "assign", "a", "Comment", "to", "a", "ReturnValueSymbol", "." ]
1067cdc8482b585b364a38fb52ca5d904e486280
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/comment.py#L159-L170
train
tcalmant/python-javaobj
javaobj/modifiedutf8.py
decoder
def decoder(data): """ This generator processes a sequence of bytes in Modified UTF-8 encoding and produces a sequence of unicode string characters. It takes bits from the byte until it matches one of the known encoding sequences. It uses ``DecodeMap`` to mask, compare and generate values. ...
python
def decoder(data): """ This generator processes a sequence of bytes in Modified UTF-8 encoding and produces a sequence of unicode string characters. It takes bits from the byte until it matches one of the known encoding sequences. It uses ``DecodeMap`` to mask, compare and generate values. ...
[ "def", "decoder", "(", "data", ")", ":", "def", "next_byte", "(", "_it", ",", "start", ",", "count", ")", ":", "try", ":", "return", "next", "(", "_it", ")", "[", "1", "]", "except", "StopIteration", ":", "raise", "UnicodeDecodeError", "(", "NAME", "...
This generator processes a sequence of bytes in Modified UTF-8 encoding and produces a sequence of unicode string characters. It takes bits from the byte until it matches one of the known encoding sequences. It uses ``DecodeMap`` to mask, compare and generate values. :param data: a string of bytes...
[ "This", "generator", "processes", "a", "sequence", "of", "bytes", "in", "Modified", "UTF", "-", "8", "encoding", "and", "produces", "a", "sequence", "of", "unicode", "string", "characters", "." ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/modifiedutf8.py#L103-L160
train
tcalmant/python-javaobj
javaobj/modifiedutf8.py
decode_modified_utf8
def decode_modified_utf8(data, errors="strict"): """ Decodes a sequence of bytes to a unicode text and length using Modified UTF-8. This function is designed to be used with Python ``codecs`` module. :param data: a string of bytes in Modified UTF-8 :param errors: handle decoding errors :ret...
python
def decode_modified_utf8(data, errors="strict"): """ Decodes a sequence of bytes to a unicode text and length using Modified UTF-8. This function is designed to be used with Python ``codecs`` module. :param data: a string of bytes in Modified UTF-8 :param errors: handle decoding errors :ret...
[ "def", "decode_modified_utf8", "(", "data", ",", "errors", "=", "\"strict\"", ")", ":", "value", ",", "length", "=", "u\"\"", ",", "0", "it", "=", "iter", "(", "decoder", "(", "data", ")", ")", "while", "True", ":", "try", ":", "value", "+=", "next",...
Decodes a sequence of bytes to a unicode text and length using Modified UTF-8. This function is designed to be used with Python ``codecs`` module. :param data: a string of bytes in Modified UTF-8 :param errors: handle decoding errors :return: unicode text and length :raises UnicodeDecodeError: ...
[ "Decodes", "a", "sequence", "of", "bytes", "to", "a", "unicode", "text", "and", "length", "using", "Modified", "UTF", "-", "8", ".", "This", "function", "is", "designed", "to", "be", "used", "with", "Python", "codecs", "module", "." ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/modifiedutf8.py#L163-L190
train
tcalmant/python-javaobj
javaobj/modifiedutf8.py
DecodeMap.apply
def apply(self, byte, value, data, i, count): """ Apply mask, compare to expected value, shift and return result. Eventually, this could become a ``reduce`` function. :param byte: The byte to compare :param value: The currently accumulated value. :param data: The data bu...
python
def apply(self, byte, value, data, i, count): """ Apply mask, compare to expected value, shift and return result. Eventually, this could become a ``reduce`` function. :param byte: The byte to compare :param value: The currently accumulated value. :param data: The data bu...
[ "def", "apply", "(", "self", ",", "byte", ",", "value", ",", "data", ",", "i", ",", "count", ")", ":", "if", "byte", "&", "self", ".", "mask", "==", "self", ".", "value", ":", "value", "<<=", "self", ".", "bits", "value", "|=", "byte", "&", "se...
Apply mask, compare to expected value, shift and return result. Eventually, this could become a ``reduce`` function. :param byte: The byte to compare :param value: The currently accumulated value. :param data: The data buffer, (array of bytes). :param i: The position within the ...
[ "Apply", "mask", "compare", "to", "expected", "value", "shift", "and", "return", "result", ".", "Eventually", "this", "could", "become", "a", "reduce", "function", "." ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/modifiedutf8.py#L55-L75
train
tcalmant/python-javaobj
javaobj/core.py
load
def load(file_object, *transformers, **kwargs): """ Deserializes Java primitive data and objects serialized using ObjectOutputStream from a file-like object. :param file_object: A file-like object :param transformers: Custom transformers to use :param ignore_remaining_data: If True, don't log a...
python
def load(file_object, *transformers, **kwargs): """ Deserializes Java primitive data and objects serialized using ObjectOutputStream from a file-like object. :param file_object: A file-like object :param transformers: Custom transformers to use :param ignore_remaining_data: If True, don't log a...
[ "def", "load", "(", "file_object", ",", "*", "transformers", ",", "**", "kwargs", ")", ":", "ignore_remaining_data", "=", "kwargs", ".", "get", "(", "\"ignore_remaining_data\"", ",", "False", ")", "marshaller", "=", "JavaObjectUnmarshaller", "(", "file_object", ...
Deserializes Java primitive data and objects serialized using ObjectOutputStream from a file-like object. :param file_object: A file-like object :param transformers: Custom transformers to use :param ignore_remaining_data: If True, don't log an error when unused traili...
[ "Deserializes", "Java", "primitive", "data", "and", "objects", "serialized", "using", "ObjectOutputStream", "from", "a", "file", "-", "like", "object", "." ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L101-L125
train
tcalmant/python-javaobj
javaobj/core.py
loads
def loads(string, *transformers, **kwargs): """ Deserializes Java objects and primitive data serialized using ObjectOutputStream from a string. :param string: A Java data string :param transformers: Custom transformers to use :param ignore_remaining_data: If True, don't log an error when unused...
python
def loads(string, *transformers, **kwargs): """ Deserializes Java objects and primitive data serialized using ObjectOutputStream from a string. :param string: A Java data string :param transformers: Custom transformers to use :param ignore_remaining_data: If True, don't log an error when unused...
[ "def", "loads", "(", "string", ",", "*", "transformers", ",", "**", "kwargs", ")", ":", "ignore_remaining_data", "=", "kwargs", ".", "get", "(", "\"ignore_remaining_data\"", ",", "False", ")", "return", "load", "(", "BytesIO", "(", "string", ")", ",", "*",...
Deserializes Java objects and primitive data serialized using ObjectOutputStream from a string. :param string: A Java data string :param transformers: Custom transformers to use :param ignore_remaining_data: If True, don't log an error when unused trailing bytes are re...
[ "Deserializes", "Java", "objects", "and", "primitive", "data", "serialized", "using", "ObjectOutputStream", "from", "a", "string", "." ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L128-L145
train
tcalmant/python-javaobj
javaobj/core.py
read
def read(data, fmt_str): """ Reads input bytes and extract the given structure. Returns both the read elements and the remaining data :param data: Data as bytes :param fmt_str: Struct unpack format string :return: A tuple (results as tuple, remaining data) """ size = struct.calcsize(fmt...
python
def read(data, fmt_str): """ Reads input bytes and extract the given structure. Returns both the read elements and the remaining data :param data: Data as bytes :param fmt_str: Struct unpack format string :return: A tuple (results as tuple, remaining data) """ size = struct.calcsize(fmt...
[ "def", "read", "(", "data", ",", "fmt_str", ")", ":", "size", "=", "struct", ".", "calcsize", "(", "fmt_str", ")", "return", "struct", ".", "unpack", "(", "fmt_str", ",", "data", "[", ":", "size", "]", ")", ",", "data", "[", "size", ":", "]" ]
Reads input bytes and extract the given structure. Returns both the read elements and the remaining data :param data: Data as bytes :param fmt_str: Struct unpack format string :return: A tuple (results as tuple, remaining data)
[ "Reads", "input", "bytes", "and", "extract", "the", "given", "structure", ".", "Returns", "both", "the", "read", "elements", "and", "the", "remaining", "data" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1666-L1676
train
tcalmant/python-javaobj
javaobj/core.py
OpCodeDebug.flags
def flags(flags): """ Returns the names of the class description flags found in the given integer :param flags: A class description flag entry :return: The flags names as a single string """ names = sorted( descr for key, descr in OpCodeDebug.STREAM_C...
python
def flags(flags): """ Returns the names of the class description flags found in the given integer :param flags: A class description flag entry :return: The flags names as a single string """ names = sorted( descr for key, descr in OpCodeDebug.STREAM_C...
[ "def", "flags", "(", "flags", ")", ":", "names", "=", "sorted", "(", "descr", "for", "key", ",", "descr", "in", "OpCodeDebug", ".", "STREAM_CONSTANT", ".", "items", "(", ")", "if", "key", "&", "flags", ")", "return", "\", \"", ".", "join", "(", "name...
Returns the names of the class description flags found in the given integer :param flags: A class description flag entry :return: The flags names as a single string
[ "Returns", "the", "names", "of", "the", "class", "description", "flags", "found", "in", "the", "given", "integer" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L457-L468
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller._readStreamHeader
def _readStreamHeader(self): """ Reads the magic header of a Java serialization stream :raise IOError: Invalid magic header (not a Java stream) """ (magic, version) = self._readStruct(">HH") if magic != self.STREAM_MAGIC or version != self.STREAM_VERSION: rai...
python
def _readStreamHeader(self): """ Reads the magic header of a Java serialization stream :raise IOError: Invalid magic header (not a Java stream) """ (magic, version) = self._readStruct(">HH") if magic != self.STREAM_MAGIC or version != self.STREAM_VERSION: rai...
[ "def", "_readStreamHeader", "(", "self", ")", ":", "(", "magic", ",", "version", ")", "=", "self", ".", "_readStruct", "(", "\">HH\"", ")", "if", "magic", "!=", "self", ".", "STREAM_MAGIC", "or", "version", "!=", "self", ".", "STREAM_VERSION", ":", "rais...
Reads the magic header of a Java serialization stream :raise IOError: Invalid magic header (not a Java stream)
[ "Reads", "the", "magic", "header", "of", "a", "Java", "serialization", "stream" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L559-L570
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller._read_and_exec_opcode
def _read_and_exec_opcode(self, ident=0, expect=None): """ Reads the next opcode, and executes its handler :param ident: Log identation level :param expect: A list of expected opcodes :return: A tuple: (opcode, result of the handler) :raise IOError: Read opcode is not on...
python
def _read_and_exec_opcode(self, ident=0, expect=None): """ Reads the next opcode, and executes its handler :param ident: Log identation level :param expect: A list of expected opcodes :return: A tuple: (opcode, result of the handler) :raise IOError: Read opcode is not on...
[ "def", "_read_and_exec_opcode", "(", "self", ",", "ident", "=", "0", ",", "expect", "=", "None", ")", ":", "position", "=", "self", ".", "object_stream", ".", "tell", "(", ")", "(", "opid", ",", ")", "=", "self", ".", "_readStruct", "(", "\">B\"", ")...
Reads the next opcode, and executes its handler :param ident: Log identation level :param expect: A list of expected opcodes :return: A tuple: (opcode, result of the handler) :raise IOError: Read opcode is not one of the expected ones :raise RuntimeError: Unknown opcode
[ "Reads", "the", "next", "opcode", "and", "executes", "its", "handler" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L572-L607
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller.do_string
def do_string(self, parent=None, ident=0): """ Handles a TC_STRING opcode :param parent: :param ident: Log indentation level :return: A string """ log_debug("[string]", ident) ba = JavaString(self._readString()) self._add_reference(ba, ident) ...
python
def do_string(self, parent=None, ident=0): """ Handles a TC_STRING opcode :param parent: :param ident: Log indentation level :return: A string """ log_debug("[string]", ident) ba = JavaString(self._readString()) self._add_reference(ba, ident) ...
[ "def", "do_string", "(", "self", ",", "parent", "=", "None", ",", "ident", "=", "0", ")", ":", "log_debug", "(", "\"[string]\"", ",", "ident", ")", "ba", "=", "JavaString", "(", "self", ".", "_readString", "(", ")", ")", "self", ".", "_add_reference", ...
Handles a TC_STRING opcode :param parent: :param ident: Log indentation level :return: A string
[ "Handles", "a", "TC_STRING", "opcode" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L941-L952
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller.do_array
def do_array(self, parent=None, ident=0): """ Handles a TC_ARRAY opcode :param parent: :param ident: Log indentation level :return: A list of deserialized objects """ # TC_ARRAY classDesc newHandle (int)<size> values[size] log_debug("[array]", ident) ...
python
def do_array(self, parent=None, ident=0): """ Handles a TC_ARRAY opcode :param parent: :param ident: Log indentation level :return: A list of deserialized objects """ # TC_ARRAY classDesc newHandle (int)<size> values[size] log_debug("[array]", ident) ...
[ "def", "do_array", "(", "self", ",", "parent", "=", "None", ",", "ident", "=", "0", ")", ":", "log_debug", "(", "\"[array]\"", ",", "ident", ")", "_", ",", "classdesc", "=", "self", ".", "_read_and_exec_opcode", "(", "ident", "=", "ident", "+", "1", ...
Handles a TC_ARRAY opcode :param parent: :param ident: Log indentation level :return: A list of deserialized objects
[ "Handles", "a", "TC_ARRAY", "opcode" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L967-L1019
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller.do_reference
def do_reference(self, parent=None, ident=0): """ Handles a TC_REFERENCE opcode :param parent: :param ident: Log indentation level :return: The referenced object """ (handle,) = self._readStruct(">L") log_debug("## Reference handle: 0x{0:X}".format(handle...
python
def do_reference(self, parent=None, ident=0): """ Handles a TC_REFERENCE opcode :param parent: :param ident: Log indentation level :return: The referenced object """ (handle,) = self._readStruct(">L") log_debug("## Reference handle: 0x{0:X}".format(handle...
[ "def", "do_reference", "(", "self", ",", "parent", "=", "None", ",", "ident", "=", "0", ")", ":", "(", "handle", ",", ")", "=", "self", ".", "_readStruct", "(", "\">L\"", ")", "log_debug", "(", "\"## Reference handle: 0x{0:X}\"", ".", "format", "(", "han...
Handles a TC_REFERENCE opcode :param parent: :param ident: Log indentation level :return: The referenced object
[ "Handles", "a", "TC_REFERENCE", "opcode" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1021-L1033
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller.do_enum
def do_enum(self, parent=None, ident=0): """ Handles a TC_ENUM opcode :param parent: :param ident: Log indentation level :return: A JavaEnum object """ # TC_ENUM classDesc newHandle enumConstantName enum = JavaEnum() _, classdesc = self._read_and_...
python
def do_enum(self, parent=None, ident=0): """ Handles a TC_ENUM opcode :param parent: :param ident: Log indentation level :return: A JavaEnum object """ # TC_ENUM classDesc newHandle enumConstantName enum = JavaEnum() _, classdesc = self._read_and_...
[ "def", "do_enum", "(", "self", ",", "parent", "=", "None", ",", "ident", "=", "0", ")", ":", "enum", "=", "JavaEnum", "(", ")", "_", ",", "classdesc", "=", "self", ".", "_read_and_exec_opcode", "(", "ident", "=", "ident", "+", "1", ",", "expect", "...
Handles a TC_ENUM opcode :param parent: :param ident: Log indentation level :return: A JavaEnum object
[ "Handles", "a", "TC_ENUM", "opcode" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1046-L1071
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller._create_hexdump
def _create_hexdump(src, start_offset=0, length=16): """ Prepares an hexadecimal dump string :param src: A string containing binary data :param start_offset: The start offset of the source :param length: Length of a dump line :return: A dump string """ FI...
python
def _create_hexdump(src, start_offset=0, length=16): """ Prepares an hexadecimal dump string :param src: A string containing binary data :param start_offset: The start offset of the source :param length: Length of a dump line :return: A dump string """ FI...
[ "def", "_create_hexdump", "(", "src", ",", "start_offset", "=", "0", ",", "length", "=", "16", ")", ":", "FILTER", "=", "\"\"", ".", "join", "(", "(", "len", "(", "repr", "(", "chr", "(", "x", ")", ")", ")", "==", "3", ")", "and", "chr", "(", ...
Prepares an hexadecimal dump string :param src: A string containing binary data :param start_offset: The start offset of the source :param length: Length of a dump line :return: A dump string
[ "Prepares", "an", "hexadecimal", "dump", "string" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1074-L1096
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller._convert_char_to_type
def _convert_char_to_type(self, type_char): """ Ensures a read character is a typecode. :param type_char: Read typecode :return: The typecode as a string (using chr) :raise RuntimeError: Unknown typecode """ typecode = type_char if type(type_char) is int:...
python
def _convert_char_to_type(self, type_char): """ Ensures a read character is a typecode. :param type_char: Read typecode :return: The typecode as a string (using chr) :raise RuntimeError: Unknown typecode """ typecode = type_char if type(type_char) is int:...
[ "def", "_convert_char_to_type", "(", "self", ",", "type_char", ")", ":", "typecode", "=", "type_char", "if", "type", "(", "type_char", ")", "is", "int", ":", "typecode", "=", "chr", "(", "type_char", ")", "if", "typecode", "in", "self", ".", "TYPECODES_LIS...
Ensures a read character is a typecode. :param type_char: Read typecode :return: The typecode as a string (using chr) :raise RuntimeError: Unknown typecode
[ "Ensures", "a", "read", "character", "is", "a", "typecode", "." ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1140-L1157
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller._add_reference
def _add_reference(self, obj, ident=0): """ Adds a read reference to the marshaler storage :param obj: Reference to add :param ident: Log indentation level """ log_debug( "## New reference handle 0x{0:X}: {1} -> {2}".format( len(self.reference...
python
def _add_reference(self, obj, ident=0): """ Adds a read reference to the marshaler storage :param obj: Reference to add :param ident: Log indentation level """ log_debug( "## New reference handle 0x{0:X}: {1} -> {2}".format( len(self.reference...
[ "def", "_add_reference", "(", "self", ",", "obj", ",", "ident", "=", "0", ")", ":", "log_debug", "(", "\"## New reference handle 0x{0:X}: {1} -> {2}\"", ".", "format", "(", "len", "(", "self", ".", "references", ")", "+", "self", ".", "BASE_REFERENCE_IDX", ","...
Adds a read reference to the marshaler storage :param obj: Reference to add :param ident: Log indentation level
[ "Adds", "a", "read", "reference", "to", "the", "marshaler", "storage" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1159-L1174
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectUnmarshaller._oops_dump_state
def _oops_dump_state(self, ignore_remaining_data=False): """ Log a deserialization error :param ignore_remaining_data: If True, don't log an error when unused trailing bytes are remaining """ log_error("==Oops state dump" + "=" * (30 - 17)) ...
python
def _oops_dump_state(self, ignore_remaining_data=False): """ Log a deserialization error :param ignore_remaining_data: If True, don't log an error when unused trailing bytes are remaining """ log_error("==Oops state dump" + "=" * (30 - 17)) ...
[ "def", "_oops_dump_state", "(", "self", ",", "ignore_remaining_data", "=", "False", ")", ":", "log_error", "(", "\"==Oops state dump\"", "+", "\"=\"", "*", "(", "30", "-", "17", ")", ")", "log_error", "(", "\"References: {0}\"", ".", "format", "(", "self", "...
Log a deserialization error :param ignore_remaining_data: If True, don't log an error when unused trailing bytes are remaining
[ "Log", "a", "deserialization", "error" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1176-L1199
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.dump
def dump(self, obj): """ Dumps the given object in the Java serialization format """ self.references = [] self.object_obj = obj self.object_stream = BytesIO() self._writeStreamHeader() self.writeObject(obj) return self.object_stream.getvalue()
python
def dump(self, obj): """ Dumps the given object in the Java serialization format """ self.references = [] self.object_obj = obj self.object_stream = BytesIO() self._writeStreamHeader() self.writeObject(obj) return self.object_stream.getvalue()
[ "def", "dump", "(", "self", ",", "obj", ")", ":", "self", ".", "references", "=", "[", "]", "self", ".", "object_obj", "=", "obj", "self", ".", "object_stream", "=", "BytesIO", "(", ")", "self", ".", "_writeStreamHeader", "(", ")", "self", ".", "writ...
Dumps the given object in the Java serialization format
[ "Dumps", "the", "given", "object", "in", "the", "Java", "serialization", "format" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1229-L1238
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.writeObject
def writeObject(self, obj): """ Appends an object to the serialization stream :param obj: A string or a deserialized Java object :raise RuntimeError: Unsupported type """ log_debug("Writing object of type {0}".format(type(obj).__name__)) if isinstance(obj, JavaAr...
python
def writeObject(self, obj): """ Appends an object to the serialization stream :param obj: A string or a deserialized Java object :raise RuntimeError: Unsupported type """ log_debug("Writing object of type {0}".format(type(obj).__name__)) if isinstance(obj, JavaAr...
[ "def", "writeObject", "(", "self", ",", "obj", ")", ":", "log_debug", "(", "\"Writing object of type {0}\"", ".", "format", "(", "type", "(", "obj", ")", ".", "__name__", ")", ")", "if", "isinstance", "(", "obj", ",", "JavaArray", ")", ":", "self", ".", ...
Appends an object to the serialization stream :param obj: A string or a deserialized Java object :raise RuntimeError: Unsupported type
[ "Appends", "an", "object", "to", "the", "serialization", "stream" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1246-L1280
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller._writeString
def _writeString(self, obj, use_reference=True): """ Appends a string to the serialization stream :param obj: String to serialize :param use_reference: If True, allow writing a reference """ # TODO: Convert to "modified UTF-8" # http://docs.oracle.com/javase/7/do...
python
def _writeString(self, obj, use_reference=True): """ Appends a string to the serialization stream :param obj: String to serialize :param use_reference: If True, allow writing a reference """ # TODO: Convert to "modified UTF-8" # http://docs.oracle.com/javase/7/do...
[ "def", "_writeString", "(", "self", ",", "obj", ",", "use_reference", "=", "True", ")", ":", "string", "=", "to_bytes", "(", "obj", ",", "\"utf-8\"", ")", "if", "use_reference", "and", "isinstance", "(", "obj", ",", "JavaString", ")", ":", "try", ":", ...
Appends a string to the serialization stream :param obj: String to serialize :param use_reference: If True, allow writing a reference
[ "Appends", "a", "string", "to", "the", "serialization", "stream" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1293-L1328
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.write_string
def write_string(self, obj, use_reference=True): """ Writes a Java string with the TC_STRING type marker :param obj: The string to print :param use_reference: If True, allow writing a reference """ if use_reference and isinstance(obj, JavaString): try: ...
python
def write_string(self, obj, use_reference=True): """ Writes a Java string with the TC_STRING type marker :param obj: The string to print :param use_reference: If True, allow writing a reference """ if use_reference and isinstance(obj, JavaString): try: ...
[ "def", "write_string", "(", "self", ",", "obj", ",", "use_reference", "=", "True", ")", ":", "if", "use_reference", "and", "isinstance", "(", "obj", ",", "JavaString", ")", ":", "try", ":", "idx", "=", "self", ".", "references", ".", "index", "(", "obj...
Writes a Java string with the TC_STRING type marker :param obj: The string to print :param use_reference: If True, allow writing a reference
[ "Writes", "a", "Java", "string", "with", "the", "TC_STRING", "type", "marker" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1330-L1355
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.write_enum
def write_enum(self, obj): """ Writes an Enum value :param obj: A JavaEnum object """ # FIXME: the output doesn't have the same references as the real # serializable form self._writeStruct(">B", 1, (self.TC_ENUM,)) try: idx = self.references....
python
def write_enum(self, obj): """ Writes an Enum value :param obj: A JavaEnum object """ # FIXME: the output doesn't have the same references as the real # serializable form self._writeStruct(">B", 1, (self.TC_ENUM,)) try: idx = self.references....
[ "def", "write_enum", "(", "self", ",", "obj", ")", ":", "self", ".", "_writeStruct", "(", "\">B\"", ",", "1", ",", "(", "self", ".", "TC_ENUM", ",", ")", ")", "try", ":", "idx", "=", "self", ".", "references", ".", "index", "(", "obj", ")", "exce...
Writes an Enum value :param obj: A JavaEnum object
[ "Writes", "an", "Enum", "value" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1357-L1382
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.write_blockdata
def write_blockdata(self, obj, parent=None): """ Appends a block of data to the serialization stream :param obj: String form of the data block """ if type(obj) is str: # Latin-1: keep bytes as is obj = to_bytes(obj, "latin-1") length = len(obj) ...
python
def write_blockdata(self, obj, parent=None): """ Appends a block of data to the serialization stream :param obj: String form of the data block """ if type(obj) is str: # Latin-1: keep bytes as is obj = to_bytes(obj, "latin-1") length = len(obj) ...
[ "def", "write_blockdata", "(", "self", ",", "obj", ",", "parent", "=", "None", ")", ":", "if", "type", "(", "obj", ")", "is", "str", ":", "obj", "=", "to_bytes", "(", "obj", ",", "\"latin-1\"", ")", "length", "=", "len", "(", "obj", ")", "if", "l...
Appends a block of data to the serialization stream :param obj: String form of the data block
[ "Appends", "a", "block", "of", "data", "to", "the", "serialization", "stream" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1384-L1406
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.write_object
def write_object(self, obj, parent=None): """ Writes an object header to the serialization stream :param obj: Not yet used :param parent: Not yet used """ # Transform object for transformer in self.object_transformers: tmp_object = transformer.transfo...
python
def write_object(self, obj, parent=None): """ Writes an object header to the serialization stream :param obj: Not yet used :param parent: Not yet used """ # Transform object for transformer in self.object_transformers: tmp_object = transformer.transfo...
[ "def", "write_object", "(", "self", ",", "obj", ",", "parent", "=", "None", ")", ":", "for", "transformer", "in", "self", ".", "object_transformers", ":", "tmp_object", "=", "transformer", ".", "transform", "(", "obj", ")", "if", "tmp_object", "is", "not",...
Writes an object header to the serialization stream :param obj: Not yet used :param parent: Not yet used
[ "Writes", "an", "object", "header", "to", "the", "serialization", "stream" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1414-L1484
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.write_class
def write_class(self, obj, parent=None): """ Writes a class to the stream :param obj: A JavaClass object :param parent: """ self._writeStruct(">B", 1, (self.TC_CLASS,)) self.write_classdesc(obj)
python
def write_class(self, obj, parent=None): """ Writes a class to the stream :param obj: A JavaClass object :param parent: """ self._writeStruct(">B", 1, (self.TC_CLASS,)) self.write_classdesc(obj)
[ "def", "write_class", "(", "self", ",", "obj", ",", "parent", "=", "None", ")", ":", "self", ".", "_writeStruct", "(", "\">B\"", ",", "1", ",", "(", "self", ".", "TC_CLASS", ",", ")", ")", "self", ".", "write_classdesc", "(", "obj", ")" ]
Writes a class to the stream :param obj: A JavaClass object :param parent:
[ "Writes", "a", "class", "to", "the", "stream" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1486-L1494
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.write_classdesc
def write_classdesc(self, obj, parent=None): """ Writes a class description :param obj: Class description to write :param parent: """ if obj not in self.references: # Add reference self.references.append(obj) logging.debug( ...
python
def write_classdesc(self, obj, parent=None): """ Writes a class description :param obj: Class description to write :param parent: """ if obj not in self.references: # Add reference self.references.append(obj) logging.debug( ...
[ "def", "write_classdesc", "(", "self", ",", "obj", ",", "parent", "=", "None", ")", ":", "if", "obj", "not", "in", "self", ".", "references", ":", "self", ".", "references", ".", "append", "(", "obj", ")", "logging", ".", "debug", "(", "\"*** Adding re...
Writes a class description :param obj: Class description to write :param parent:
[ "Writes", "a", "class", "description" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1496-L1550
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller.write_array
def write_array(self, obj): """ Writes a JavaArray :param obj: A JavaArray object """ classdesc = obj.get_class() self._writeStruct(">B", 1, (self.TC_ARRAY,)) self.write_classdesc(classdesc) self._writeStruct(">i", 1, (len(obj),)) # Add reference...
python
def write_array(self, obj): """ Writes a JavaArray :param obj: A JavaArray object """ classdesc = obj.get_class() self._writeStruct(">B", 1, (self.TC_ARRAY,)) self.write_classdesc(classdesc) self._writeStruct(">i", 1, (len(obj),)) # Add reference...
[ "def", "write_array", "(", "self", ",", "obj", ")", ":", "classdesc", "=", "obj", ".", "get_class", "(", ")", "self", ".", "_writeStruct", "(", "\">B\"", ",", "1", ",", "(", "self", ".", "TC_ARRAY", ",", ")", ")", "self", ".", "write_classdesc", "(",...
Writes a JavaArray :param obj: A JavaArray object
[ "Writes", "a", "JavaArray" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1561-L1593
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller._write_value
def _write_value(self, field_type, value): """ Writes an item of an array :param field_type: Value type :param value: The value itself """ if len(field_type) > 1: # We don't need details for arrays and objects field_type = field_type[0] i...
python
def _write_value(self, field_type, value): """ Writes an item of an array :param field_type: Value type :param value: The value itself """ if len(field_type) > 1: # We don't need details for arrays and objects field_type = field_type[0] i...
[ "def", "_write_value", "(", "self", ",", "field_type", ",", "value", ")", ":", "if", "len", "(", "field_type", ")", ">", "1", ":", "field_type", "=", "field_type", "[", "0", "]", "if", "field_type", "==", "self", ".", "TYPE_BOOLEAN", ":", "self", ".", ...
Writes an item of an array :param field_type: Value type :param value: The value itself
[ "Writes", "an", "item", "of", "an", "array" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1595-L1638
train
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller._convert_type_to_char
def _convert_type_to_char(self, type_char): """ Converts the given type code to an int :param type_char: A type code character """ typecode = type_char if type(type_char) is int: typecode = chr(type_char) if typecode in self.TYPECODES_LIST: ...
python
def _convert_type_to_char(self, type_char): """ Converts the given type code to an int :param type_char: A type code character """ typecode = type_char if type(type_char) is int: typecode = chr(type_char) if typecode in self.TYPECODES_LIST: ...
[ "def", "_convert_type_to_char", "(", "self", ",", "type_char", ")", ":", "typecode", "=", "type_char", "if", "type", "(", "type_char", ")", "is", "int", ":", "typecode", "=", "chr", "(", "type_char", ")", "if", "typecode", "in", "self", ".", "TYPECODES_LIS...
Converts the given type code to an int :param type_char: A type code character
[ "Converts", "the", "given", "type", "code", "to", "an", "int" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1640-L1660
train
tcalmant/python-javaobj
javaobj/core.py
DefaultObjectTransformer.create
def create(self, classdesc, unmarshaller=None): # type: (JavaClass, JavaObjectUnmarshaller) -> JavaObject """ Transforms a deserialized Java object into a Python object :param classdesc: The description of a Java class :return: The Python form of the object, or the original Java...
python
def create(self, classdesc, unmarshaller=None): # type: (JavaClass, JavaObjectUnmarshaller) -> JavaObject """ Transforms a deserialized Java object into a Python object :param classdesc: The description of a Java class :return: The Python form of the object, or the original Java...
[ "def", "create", "(", "self", ",", "classdesc", ",", "unmarshaller", "=", "None", ")", ":", "try", ":", "mapped_type", "=", "self", ".", "TYPE_MAPPER", "[", "classdesc", ".", "name", "]", "except", "KeyError", ":", "return", "JavaObject", "(", ")", "else...
Transforms a deserialized Java object into a Python object :param classdesc: The description of a Java class :return: The Python form of the object, or the original JavaObject
[ "Transforms", "a", "deserialized", "Java", "object", "into", "a", "Python", "object" ]
e042c2cbf1ce9de659b6cb9290b5ccd5442514d1
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L2002-L2023
train
UDST/urbansim
urbansim/urbanchoice/mnl.py
mnl_simulate
def mnl_simulate(data, coeff, numalts, GPU=False, returnprobs=True): """ Get the probabilities for each chooser choosing between `numalts` alternatives. Parameters ---------- data : 2D array The data are expected to be in "long" form where each row is for one alternative. Altern...
python
def mnl_simulate(data, coeff, numalts, GPU=False, returnprobs=True): """ Get the probabilities for each chooser choosing between `numalts` alternatives. Parameters ---------- data : 2D array The data are expected to be in "long" form where each row is for one alternative. Altern...
[ "def", "mnl_simulate", "(", "data", ",", "coeff", ",", "numalts", ",", "GPU", "=", "False", ",", "returnprobs", "=", "True", ")", ":", "logger", ".", "debug", "(", "'start: MNL simulation with len(data)={} and numalts={}'", ".", "format", "(", "len", "(", "dat...
Get the probabilities for each chooser choosing between `numalts` alternatives. Parameters ---------- data : 2D array The data are expected to be in "long" form where each row is for one alternative. Alternatives are in groups of `numalts` rows per choosers. Alternatives must be...
[ "Get", "the", "probabilities", "for", "each", "chooser", "choosing", "between", "numalts", "alternatives", "." ]
79f815a6503e109f50be270cee92d0f4a34f49ef
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/urbanchoice/mnl.py#L124-L175
train
UDST/urbansim
urbansim/urbanchoice/mnl.py
mnl_estimate
def mnl_estimate(data, chosen, numalts, GPU=False, coeffrange=(-3, 3), weights=None, lcgrad=False, beta=None): """ Calculate coefficients of the MNL model. Parameters ---------- data : 2D array The data are expected to be in "long" form where each row is for one alt...
python
def mnl_estimate(data, chosen, numalts, GPU=False, coeffrange=(-3, 3), weights=None, lcgrad=False, beta=None): """ Calculate coefficients of the MNL model. Parameters ---------- data : 2D array The data are expected to be in "long" form where each row is for one alt...
[ "def", "mnl_estimate", "(", "data", ",", "chosen", ",", "numalts", ",", "GPU", "=", "False", ",", "coeffrange", "=", "(", "-", "3", ",", "3", ")", ",", "weights", "=", "None", ",", "lcgrad", "=", "False", ",", "beta", "=", "None", ")", ":", "logg...
Calculate coefficients of the MNL model. Parameters ---------- data : 2D array The data are expected to be in "long" form where each row is for one alternative. Alternatives are in groups of `numalts` rows per choosers. Alternatives must be in the same order for each chooser. ch...
[ "Calculate", "coefficients", "of", "the", "MNL", "model", "." ]
79f815a6503e109f50be270cee92d0f4a34f49ef
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/urbanchoice/mnl.py#L178-L275
train