repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
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",
"(",
")",
"# Create reference to TU so it isn't GC'd before Cursor.",
"field",
".",
"_... | Return an iterator for accessing the fields of this type. | [
"Return",
"an",
"iterator",
"for",
"accessing",
"the",
"fields",
"of",
"this",
"type",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2174-L2187 |
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",
... | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2471-L2485 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2604-L2623 |
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... | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2648-L2666 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2673-L2687 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2689-L2727 |
hotdoc/hotdoc | hotdoc/extensions/c/clang/cindex.py | TranslationUnit.diagnostics | def diagnostics(self):
"""
Return an iterable (and indexable) object containing the diagnostics.
"""
class DiagIterator:
def __init__(self, tu):
self.tu = tu
def __len__(self):
return int(conf.lib.clang_getNumDiagnostics(self.tu))
... | python | def diagnostics(self):
"""
Return an iterable (and indexable) object containing the diagnostics.
"""
class DiagIterator:
def __init__(self, tu):
self.tu = tu
def __len__(self):
return int(conf.lib.clang_getNumDiagnostics(self.tu))
... | [
"def",
"diagnostics",
"(",
"self",
")",
":",
"class",
"DiagIterator",
":",
"def",
"__init__",
"(",
"self",
",",
"tu",
")",
":",
"self",
".",
"tu",
"=",
"tu",
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"int",
"(",
"conf",
".",
"lib",
".",
... | Return an iterable (and indexable) object containing the diagnostics. | [
"Return",
"an",
"iterable",
"(",
"and",
"indexable",
")",
"object",
"containing",
"the",
"diagnostics",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2730-L2747 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2749-L2776 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2778-L2798 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2800-L2843 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2845-L2856 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2870-L2872 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2957-L2966 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L3013-L3022 |
hotdoc/hotdoc | hotdoc/extensions/gi/node_cache.py | make_translations | def make_translations(unique_name, node):
'''
Compute and store the title that should be displayed
when linking to a given unique_name, eg in python
when linking to test_greeter_greet() we want to display
Test.Greeter.greet
'''
introspectable = not node.attrib.get('introspectable') == '0'
... | python | def make_translations(unique_name, node):
'''
Compute and store the title that should be displayed
when linking to a given unique_name, eg in python
when linking to test_greeter_greet() we want to display
Test.Greeter.greet
'''
introspectable = not node.attrib.get('introspectable') == '0'
... | [
"def",
"make_translations",
"(",
"unique_name",
",",
"node",
")",
":",
"introspectable",
"=",
"not",
"node",
".",
"attrib",
".",
"get",
"(",
"'introspectable'",
")",
"==",
"'0'",
"if",
"node",
".",
"tag",
"==",
"core_ns",
"(",
"'member'",
")",
":",
"__TR... | Compute and store the title that should be displayed
when linking to a given unique_name, eg in python
when linking to test_greeter_greet() we want to display
Test.Greeter.greet | [
"Compute",
"and",
"store",
"the",
"title",
"that",
"should",
"be",
"displayed",
"when",
"linking",
"to",
"a",
"given",
"unique_name",
"eg",
"in",
"python",
"when",
"linking",
"to",
"test_greeter_greet",
"()",
"we",
"want",
"to",
"display",
"Test",
".",
"Gree... | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L85-L141 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L173-L183 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L186-L199 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L202-L277 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L318-L335 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/gi/node_cache.py#L338-L348 |
hotdoc/hotdoc | hotdoc/core/links.py | dict_to_html_attrs | def dict_to_html_attrs(dict_):
"""
Banana banana
"""
res = ' '.join('%s="%s"' % (k, v) for k, v in dict_.items())
return res | python | def dict_to_html_attrs(dict_):
"""
Banana banana
"""
res = ' '.join('%s="%s"' % (k, v) for k, v in dict_.items())
return res | [
"def",
"dict_to_html_attrs",
"(",
"dict_",
")",
":",
"res",
"=",
"' '",
".",
"join",
"(",
"'%s=\"%s\"'",
"%",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"dict_",
".",
"items",
"(",
")",
")",
"return",
"res"
] | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/links.py#L27-L32 |
hotdoc/hotdoc | hotdoc/core/links.py | Link.title | def title(self):
"""
Banana banana
"""
resolved_title = Link.resolving_title_signal(self)
resolved_title = [elem for elem in resolved_title if elem is not
None]
if resolved_title:
return str(resolved_title[0])
return self._tit... | python | def title(self):
"""
Banana banana
"""
resolved_title = Link.resolving_title_signal(self)
resolved_title = [elem for elem in resolved_title if elem is not
None]
if resolved_title:
return str(resolved_title[0])
return self._tit... | [
"def",
"title",
"(",
"self",
")",
":",
"resolved_title",
"=",
"Link",
".",
"resolving_title_signal",
"(",
"self",
")",
"resolved_title",
"=",
"[",
"elem",
"for",
"elem",
"in",
"resolved_title",
"if",
"elem",
"is",
"not",
"None",
"]",
"if",
"resolved_title",
... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/links.py#L53-L62 |
hotdoc/hotdoc | hotdoc/core/links.py | Link.get_link | def get_link(self, link_resolver):
"""
Banana banana
"""
res = link_resolver.resolving_link_signal(self)
if not res:
return self.ref, None
ref = res[0] or self.ref
if res[1]:
return ref, dict_to_html_attrs(res[1])
return ref, None | python | def get_link(self, link_resolver):
"""
Banana banana
"""
res = link_resolver.resolving_link_signal(self)
if not res:
return self.ref, None
ref = res[0] or self.ref
if res[1]:
return ref, dict_to_html_attrs(res[1])
return ref, None | [
"def",
"get_link",
"(",
"self",
",",
"link_resolver",
")",
":",
"res",
"=",
"link_resolver",
".",
"resolving_link_signal",
"(",
"self",
")",
"if",
"not",
"res",
":",
"return",
"self",
".",
"ref",
",",
"None",
"ref",
"=",
"res",
"[",
"0",
"]",
"or",
"... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/links.py#L76-L86 |
hotdoc/hotdoc | hotdoc/core/links.py | LinkResolver.add_link | def add_link(self, link):
"""
Banana banana
"""
if link.id_ not in self.__links:
self.__links[link.id_] = link | python | def add_link(self, link):
"""
Banana banana
"""
if link.id_ not in self.__links:
self.__links[link.id_] = link | [
"def",
"add_link",
"(",
"self",
",",
"link",
")",
":",
"if",
"link",
".",
"id_",
"not",
"in",
"self",
".",
"__links",
":",
"self",
".",
"__links",
"[",
"link",
".",
"id_",
"]",
"=",
"link"
] | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/links.py#L143-L148 |
hotdoc/hotdoc | hotdoc/core/links.py | LinkResolver.upsert_link | def upsert_link(self, link, overwrite_ref=False):
"""
Banana banana
"""
elink = self.__links.get(link.id_)
if elink:
if elink.ref is None or overwrite_ref and link.ref:
elink.ref = link.ref
# pylint: disable=protected-access
if... | python | def upsert_link(self, link, overwrite_ref=False):
"""
Banana banana
"""
elink = self.__links.get(link.id_)
if elink:
if elink.ref is None or overwrite_ref and link.ref:
elink.ref = link.ref
# pylint: disable=protected-access
if... | [
"def",
"upsert_link",
"(",
"self",
",",
"link",
",",
"overwrite_ref",
"=",
"False",
")",
":",
"elink",
"=",
"self",
".",
"__links",
".",
"get",
"(",
"link",
".",
"id_",
")",
"if",
"elink",
":",
"if",
"elink",
".",
"ref",
"is",
"None",
"or",
"overwr... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/links.py#L150-L172 |
hotdoc/hotdoc | hotdoc/core/inclusions.py | find_file | def find_file(filename, include_paths):
"""Banana banana
"""
if os.path.isabs(filename):
if os.path.exists(filename):
return filename
return None
for include_path in include_paths:
fpath = os.path.join(include_path, filename)
if os.path.exists(fpath) and os.p... | python | def find_file(filename, include_paths):
"""Banana banana
"""
if os.path.isabs(filename):
if os.path.exists(filename):
return filename
return None
for include_path in include_paths:
fpath = os.path.join(include_path, filename)
if os.path.exists(fpath) and os.p... | [
"def",
"find_file",
"(",
"filename",
",",
"include_paths",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"return",
"filename",
"return",
"None",
"for",
"... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/inclusions.py#L45-L58 |
hotdoc/hotdoc | hotdoc/core/inclusions.py | resolve | def resolve(uri, include_paths):
"""
Banana banana
"""
include_filename, line_ranges, symbol = __parse_include(uri)
if include_filename is None:
return None
include_path = find_file(include_filename, include_paths)
if include_path is None:
return None
return __get_content... | python | def resolve(uri, include_paths):
"""
Banana banana
"""
include_filename, line_ranges, symbol = __parse_include(uri)
if include_filename is None:
return None
include_path = find_file(include_filename, include_paths)
if include_path is None:
return None
return __get_content... | [
"def",
"resolve",
"(",
"uri",
",",
"include_paths",
")",
":",
"include_filename",
",",
"line_ranges",
",",
"symbol",
"=",
"__parse_include",
"(",
"uri",
")",
"if",
"include_filename",
"is",
"None",
":",
"return",
"None",
"include_path",
"=",
"find_file",
"(",
... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/inclusions.py#L94-L105 |
hotdoc/hotdoc | hotdoc/core/config.py | load_config_json | def load_config_json(conf_file):
"""Banana?"""
try:
with open(conf_file) as _:
try:
json_conf = json.load(_)
except ValueError as ze_error:
error('invalid-config',
'The provided configuration file %s is not valid json.\n'
... | python | def load_config_json(conf_file):
"""Banana?"""
try:
with open(conf_file) as _:
try:
json_conf = json.load(_)
except ValueError as ze_error:
error('invalid-config',
'The provided configuration file %s is not valid json.\n'
... | [
"def",
"load_config_json",
"(",
"conf_file",
")",
":",
"try",
":",
"with",
"open",
"(",
"conf_file",
")",
"as",
"_",
":",
"try",
":",
"json_conf",
"=",
"json",
".",
"load",
"(",
"_",
")",
"except",
"ValueError",
"as",
"ze_error",
":",
"error",
"(",
"... | Banana? | [
"Banana?"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L31-L52 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L164-L179 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L187-L205 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L207-L230 |
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",
... | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L232-L262 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L264-L288 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L290-L332 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L334-L360 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/config.py#L363-L405 |
hotdoc/hotdoc | hotdoc/utils/setup_utils.py | _check_submodule_status | def _check_submodule_status(root, submodules):
"""check submodule status
Has three return values:
'missing' - submodules are absent
'unclean' - submodules have unstaged changes
'clean' - all submodules are up to date
"""
if hasattr(sys, "frozen"):
# frozen via py2exe or similar, don... | python | def _check_submodule_status(root, submodules):
"""check submodule status
Has three return values:
'missing' - submodules are absent
'unclean' - submodules have unstaged changes
'clean' - all submodules are up to date
"""
if hasattr(sys, "frozen"):
# frozen via py2exe or similar, don... | [
"def",
"_check_submodule_status",
"(",
"root",
",",
"submodules",
")",
":",
"if",
"hasattr",
"(",
"sys",
",",
"\"frozen\"",
")",
":",
"# frozen via py2exe or similar, don't bother",
"return",
"'clean'",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
... | check submodule status
Has three return values:
'missing' - submodules are absent
'unclean' - submodules have unstaged changes
'clean' - all submodules are up to date | [
"check",
"submodule",
"status",
"Has",
"three",
"return",
"values",
":",
"missing",
"-",
"submodules",
"are",
"absent",
"unclean",
"-",
"submodules",
"have",
"unstaged",
"changes",
"clean",
"-",
"all",
"submodules",
"are",
"up",
"to",
"date"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L33-L72 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L75-L79 |
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",
")",
":",
"# PACKAGERS: Add a return here to skip checks for git submodules",
"# don't do anything if nothing is actually supposed to happen",
"for",
"do_nothing",
"in",
"(",
"'-h'",
",",
"'--help'",
",",
"'-... | 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... | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L93-L113 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L116-L133 |
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'",
",",
"''",
")",
"# { <distutils Exte... | 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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L135-L180 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L201-L204 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L207-L210 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L213-L222 |
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... | 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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L225-L231 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L234-L259 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L262-L267 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L270-L275 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L298-L304 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L307-L314 |
hotdoc/hotdoc | hotdoc/utils/loggable.py | Logger.set_verbosity | def set_verbosity(verbosity):
"""Banana banana
"""
Logger._verbosity = min(max(0, WARNING - verbosity), 2)
debug("Verbosity set to %d" % (WARNING - Logger._verbosity), 'logging') | python | def set_verbosity(verbosity):
"""Banana banana
"""
Logger._verbosity = min(max(0, WARNING - verbosity), 2)
debug("Verbosity set to %d" % (WARNING - Logger._verbosity), 'logging') | [
"def",
"set_verbosity",
"(",
"verbosity",
")",
":",
"Logger",
".",
"_verbosity",
"=",
"min",
"(",
"max",
"(",
"0",
",",
"WARNING",
"-",
"verbosity",
")",
",",
"2",
")",
"debug",
"(",
"\"Verbosity set to %d\"",
"%",
"(",
"WARNING",
"-",
"Logger",
".",
"... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/loggable.py#L329-L333 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/sitemap.py#L77-L87 |
hotdoc/hotdoc | hotdoc/parsers/sitemap.py | Sitemap.get_all_sources | def get_all_sources(self):
"""
Returns:
OrderedDict: all source file names in the hierarchy, paired with
the names of their subpages.
"""
if self.__all_sources is None:
self.__all_sources = OrderedDict()
self.walk(self.__add_one)
... | python | def get_all_sources(self):
"""
Returns:
OrderedDict: all source file names in the hierarchy, paired with
the names of their subpages.
"""
if self.__all_sources is None:
self.__all_sources = OrderedDict()
self.walk(self.__add_one)
... | [
"def",
"get_all_sources",
"(",
"self",
")",
":",
"if",
"self",
".",
"__all_sources",
"is",
"None",
":",
"self",
".",
"__all_sources",
"=",
"OrderedDict",
"(",
")",
"self",
".",
"walk",
"(",
"self",
".",
"__add_one",
")",
"return",
"self",
".",
"__all_sou... | Returns:
OrderedDict: all source file names in the hierarchy, paired with
the names of their subpages. | [
"Returns",
":",
"OrderedDict",
":",
"all",
"source",
"file",
"names",
"in",
"the",
"hierarchy",
"paired",
"with",
"the",
"names",
"of",
"their",
"subpages",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/sitemap.py#L101-L110 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/sitemap.py#L144-L218 |
hotdoc/hotdoc | hotdoc/parsers/gtk_doc.py | _grouper | def _grouper(iterable, n_args, fillvalue=None):
"""
Banana banana
"""
args = [iter(iterable)] * n_args
return zip_longest(*args, fillvalue=fillvalue) | python | def _grouper(iterable, n_args, fillvalue=None):
"""
Banana banana
"""
args = [iter(iterable)] * n_args
return zip_longest(*args, fillvalue=fillvalue) | [
"def",
"_grouper",
"(",
"iterable",
",",
"n_args",
",",
"fillvalue",
"=",
"None",
")",
":",
"args",
"=",
"[",
"iter",
"(",
"iterable",
")",
"]",
"*",
"n_args",
"return",
"zip_longest",
"(",
"*",
"args",
",",
"fillvalue",
"=",
"fillvalue",
")"
] | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L48-L53 |
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"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L303-L382 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L396-L464 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L467-L478 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L480-L490 |
hotdoc/hotdoc | hotdoc/parsers/gtk_doc.py | GtkDocStringFormatter.translate_tags | def translate_tags(self, comment, link_resolver):
"""Banana banana
"""
for tname in ('deprecated',):
tag = comment.tags.get(tname)
if tag is not None and tag.description:
comment = comment_from_tag(tag)
ast = self.comment_to_ast(comment, li... | python | def translate_tags(self, comment, link_resolver):
"""Banana banana
"""
for tname in ('deprecated',):
tag = comment.tags.get(tname)
if tag is not None and tag.description:
comment = comment_from_tag(tag)
ast = self.comment_to_ast(comment, li... | [
"def",
"translate_tags",
"(",
"self",
",",
"comment",
",",
"link_resolver",
")",
":",
"for",
"tname",
"in",
"(",
"'deprecated'",
",",
")",
":",
"tag",
"=",
"comment",
".",
"tags",
".",
"get",
"(",
"tname",
")",
"if",
"tag",
"is",
"not",
"None",
"and"... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L492-L500 |
hotdoc/hotdoc | hotdoc/parsers/gtk_doc.py | GtkDocStringFormatter.parse_config | def parse_config(self, config):
"""Banana banana
"""
self.remove_xml_tags = config.get('gtk_doc_remove_xml')
self.escape_html = config.get('gtk_doc_escape_html')
self.gdbus_codegen_sources = config.get_paths('gdbus_codegen_sources') | python | def parse_config(self, config):
"""Banana banana
"""
self.remove_xml_tags = config.get('gtk_doc_remove_xml')
self.escape_html = config.get('gtk_doc_escape_html')
self.gdbus_codegen_sources = config.get_paths('gdbus_codegen_sources') | [
"def",
"parse_config",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"remove_xml_tags",
"=",
"config",
".",
"get",
"(",
"'gtk_doc_remove_xml'",
")",
"self",
".",
"escape_html",
"=",
"config",
".",
"get",
"(",
"'gtk_doc_escape_html'",
")",
"self",
".",
... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/parsers/gtk_doc.py#L520-L525 |
hotdoc/hotdoc | hotdoc/core/symbols.py | Symbol.add_extension_attribute | def add_extension_attribute(self, ext_name, key, value):
"""
Banana banana
"""
attributes = self.extension_attributes.pop(ext_name, {})
attributes[key] = value
self.extension_attributes[ext_name] = attributes | python | def add_extension_attribute(self, ext_name, key, value):
"""
Banana banana
"""
attributes = self.extension_attributes.pop(ext_name, {})
attributes[key] = value
self.extension_attributes[ext_name] = attributes | [
"def",
"add_extension_attribute",
"(",
"self",
",",
"ext_name",
",",
"key",
",",
"value",
")",
":",
"attributes",
"=",
"self",
".",
"extension_attributes",
".",
"pop",
"(",
"ext_name",
",",
"{",
"}",
")",
"attributes",
"[",
"key",
"]",
"=",
"value",
"sel... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/symbols.py#L68-L74 |
hotdoc/hotdoc | hotdoc/core/symbols.py | Symbol.get_extension_attribute | def get_extension_attribute(self, ext_name, key):
"""
Banana banana
"""
attributes = self.extension_attributes.get(ext_name)
if not attributes:
return None
return attributes.get(key) | python | def get_extension_attribute(self, ext_name, key):
"""
Banana banana
"""
attributes = self.extension_attributes.get(ext_name)
if not attributes:
return None
return attributes.get(key) | [
"def",
"get_extension_attribute",
"(",
"self",
",",
"ext_name",
",",
"key",
")",
":",
"attributes",
"=",
"self",
".",
"extension_attributes",
".",
"get",
"(",
"ext_name",
")",
"if",
"not",
"attributes",
":",
"return",
"None",
"return",
"attributes",
".",
"ge... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/symbols.py#L76-L83 |
hotdoc/hotdoc | hotdoc/core/symbols.py | Symbol.update_children_comments | def update_children_comments(self):
"""
Banana banana
"""
if self.comment is None:
return
for sym in self.get_children_symbols():
if isinstance(sym, ParameterSymbol):
sym.comment = self.comment.params.get(sym.argname)
elif isin... | python | def update_children_comments(self):
"""
Banana banana
"""
if self.comment is None:
return
for sym in self.get_children_symbols():
if isinstance(sym, ParameterSymbol):
sym.comment = self.comment.params.get(sym.argname)
elif isin... | [
"def",
"update_children_comments",
"(",
"self",
")",
":",
"if",
"self",
".",
"comment",
"is",
"None",
":",
"return",
"for",
"sym",
"in",
"self",
".",
"get_children_symbols",
"(",
")",
":",
"if",
"isinstance",
"(",
"sym",
",",
"ParameterSymbol",
")",
":",
... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/symbols.py#L94-L114 |
hotdoc/hotdoc | hotdoc/core/symbols.py | Symbol.resolve_links | def resolve_links(self, link_resolver):
"""
Banana banana
"""
if self.link is None:
self.link = Link(self.unique_name, self._make_name(),
self.unique_name)
self.link = link_resolver.upsert_link(self.link, overwrite_ref=True)
for ... | python | def resolve_links(self, link_resolver):
"""
Banana banana
"""
if self.link is None:
self.link = Link(self.unique_name, self._make_name(),
self.unique_name)
self.link = link_resolver.upsert_link(self.link, overwrite_ref=True)
for ... | [
"def",
"resolve_links",
"(",
"self",
",",
"link_resolver",
")",
":",
"if",
"self",
".",
"link",
"is",
"None",
":",
"self",
".",
"link",
"=",
"Link",
"(",
"self",
".",
"unique_name",
",",
"self",
".",
"_make_name",
"(",
")",
",",
"self",
".",
"unique_... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/symbols.py#L131-L143 |
hotdoc/hotdoc | hotdoc/core/symbols.py | QualifiedSymbol.resolve_links | def resolve_links(self, link_resolver):
"""
Banana banana
"""
self.type_link = None
self.type_tokens = []
for child in self.get_children_symbols():
child.resolve_links(link_resolver)
for tok in self.input_tokens:
if isinstance(tok, Link):... | python | def resolve_links(self, link_resolver):
"""
Banana banana
"""
self.type_link = None
self.type_tokens = []
for child in self.get_children_symbols():
child.resolve_links(link_resolver)
for tok in self.input_tokens:
if isinstance(tok, Link):... | [
"def",
"resolve_links",
"(",
"self",
",",
"link_resolver",
")",
":",
"self",
".",
"type_link",
"=",
"None",
"self",
".",
"type_tokens",
"=",
"[",
"]",
"for",
"child",
"in",
"self",
".",
"get_children_symbols",
"(",
")",
":",
"child",
".",
"resolve_links",
... | Banana banana | [
"Banana",
"banana"
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/symbols.py#L188-L203 |
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",
"."
] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/comment.py#L159-L170 |
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",
"."
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/modifiedutf8.py#L103-L160 |
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",
"."
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/modifiedutf8.py#L163-L190 |
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",
"."
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/modifiedutf8.py#L55-L75 |
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",
")",
":",
"# Read keyword argument",
"ignore_remaining_data",
"=",
"kwargs",
".",
"get",
"(",
"\"ignore_remaining_data\"",
",",
"False",
")",
"marshaller",
"=",
"JavaObjectUnmars... | 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",
"."
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L101-L125 |
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",
")",
":",
"# Read keyword argument",
"ignore_remaining_data",
"=",
"kwargs",
".",
"get",
"(",
"\"ignore_remaining_data\"",
",",
"False",
")",
"# Reuse the load method (avoid code duplica... | 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",
"."
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L128-L145 |
tcalmant/python-javaobj | javaobj/core.py | dumps | def dumps(obj, *transformers):
"""
Serializes Java primitive data and objects unmarshaled by load(s) before
into string.
:param obj: A Python primitive object, or one loaded using load(s)
:param transformers: Custom transformers to use
:return: The serialized data as a string
"""
marsha... | python | def dumps(obj, *transformers):
"""
Serializes Java primitive data and objects unmarshaled by load(s) before
into string.
:param obj: A Python primitive object, or one loaded using load(s)
:param transformers: Custom transformers to use
:return: The serialized data as a string
"""
marsha... | [
"def",
"dumps",
"(",
"obj",
",",
"*",
"transformers",
")",
":",
"marshaller",
"=",
"JavaObjectMarshaller",
"(",
")",
"# Add custom transformers",
"for",
"transformer",
"in",
"transformers",
":",
"marshaller",
".",
"add_transformer",
"(",
"transformer",
")",
"retur... | Serializes Java primitive data and objects unmarshaled by load(s) before
into string.
:param obj: A Python primitive object, or one loaded using load(s)
:param transformers: Custom transformers to use
:return: The serialized data as a string | [
"Serializes",
"Java",
"primitive",
"data",
"and",
"objects",
"unmarshaled",
"by",
"load",
"(",
"s",
")",
"before",
"into",
"string",
"."
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L148-L162 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1666-L1676 |
tcalmant/python-javaobj | javaobj/core.py | read_string | def read_string(data, length_fmt="H"):
"""
Reads a serialized string
:param data: Bytes where to read the string from
:param length_fmt: Structure format of the string length (H or Q)
:return: The deserialized string
"""
(length,), data = read(data, ">{0}".format(length_fmt))
ba, data =... | python | def read_string(data, length_fmt="H"):
"""
Reads a serialized string
:param data: Bytes where to read the string from
:param length_fmt: Structure format of the string length (H or Q)
:return: The deserialized string
"""
(length,), data = read(data, ">{0}".format(length_fmt))
ba, data =... | [
"def",
"read_string",
"(",
"data",
",",
"length_fmt",
"=",
"\"H\"",
")",
":",
"(",
"length",
",",
")",
",",
"data",
"=",
"read",
"(",
"data",
",",
"\">{0}\"",
".",
"format",
"(",
"length_fmt",
")",
")",
"ba",
",",
"data",
"=",
"data",
"[",
":",
"... | Reads a serialized string
:param data: Bytes where to read the string from
:param length_fmt: Structure format of the string length (H or Q)
:return: The deserialized string | [
"Reads",
"a",
"serialized",
"string"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1679-L1689 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L457-L468 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L559-L570 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L572-L607 |
tcalmant/python-javaobj | javaobj/core.py | JavaObjectUnmarshaller._readString | def _readString(self, length_fmt="H"):
"""
Reads a serialized string
:param length_fmt: Structure format of the string length (H or Q)
:return: The deserialized string
:raise RuntimeError: Unexpected end of stream
"""
(length,) = self._readStruct(">{0}".format(le... | python | def _readString(self, length_fmt="H"):
"""
Reads a serialized string
:param length_fmt: Structure format of the string length (H or Q)
:return: The deserialized string
:raise RuntimeError: Unexpected end of stream
"""
(length,) = self._readStruct(">{0}".format(le... | [
"def",
"_readString",
"(",
"self",
",",
"length_fmt",
"=",
"\"H\"",
")",
":",
"(",
"length",
",",
")",
"=",
"self",
".",
"_readStruct",
"(",
"\">{0}\"",
".",
"format",
"(",
"length_fmt",
")",
")",
"ba",
"=",
"self",
".",
"object_stream",
".",
"read",
... | Reads a serialized string
:param length_fmt: Structure format of the string length (H or Q)
:return: The deserialized string
:raise RuntimeError: Unexpected end of stream | [
"Reads",
"a",
"serialized",
"string"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L625-L635 |
tcalmant/python-javaobj | javaobj/core.py | JavaObjectUnmarshaller.do_classdesc | def do_classdesc(self, parent=None, ident=0):
"""
Handles a TC_CLASSDESC opcode
:param parent:
:param ident: Log indentation level
:return: A JavaClass object
"""
# TC_CLASSDESC className serialVersionUID newHandle classDescInfo
# classDescInfo:
#... | python | def do_classdesc(self, parent=None, ident=0):
"""
Handles a TC_CLASSDESC opcode
:param parent:
:param ident: Log indentation level
:return: A JavaClass object
"""
# TC_CLASSDESC className serialVersionUID newHandle classDescInfo
# classDescInfo:
#... | [
"def",
"do_classdesc",
"(",
"self",
",",
"parent",
"=",
"None",
",",
"ident",
"=",
"0",
")",
":",
"# TC_CLASSDESC className serialVersionUID newHandle classDescInfo",
"# classDescInfo:",
"# classDescFlags fields classAnnotation superClassDesc",
"# classDescFlags:",
"# (byte) ... | Handles a TC_CLASSDESC opcode
:param parent:
:param ident: Log indentation level
:return: A JavaClass object | [
"Handles",
"a",
"TC_CLASSDESC",
"opcode"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L637-L753 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L941-L952 |
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",
")",
":",
"# TC_ARRAY classDesc newHandle (int)<size> values[size]",
"log_debug",
"(",
"\"[array]\"",
",",
"ident",
")",
"_",
",",
"classdesc",
"=",
"self",
".",
"_read_and_exec_... | Handles a TC_ARRAY opcode
:param parent:
:param ident: Log indentation level
:return: A list of deserialized objects | [
"Handles",
"a",
"TC_ARRAY",
"opcode"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L967-L1019 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1021-L1033 |
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",
")",
":",
"# TC_ENUM classDesc newHandle enumConstantName",
"enum",
"=",
"JavaEnum",
"(",
")",
"_",
",",
"classdesc",
"=",
"self",
".",
"_read_and_exec_opcode",
"(",
"ident",
... | Handles a TC_ENUM opcode
:param parent:
:param ident: Log indentation level
:return: A JavaEnum object | [
"Handles",
"a",
"TC_ENUM",
"opcode"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1046-L1071 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1074-L1096 |
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",
"."
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1140-L1157 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1159-L1174 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1176-L1199 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1229-L1238 |
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",
")",
":",
"# Deserialized... | 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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1246-L1280 |
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",
")",
":",
"# TODO: Convert to \"modified UTF-8\"",
"# http://docs.oracle.com/javase/7/docs/api/java/io/DataInput.html#modified-utf-8",
"string",
"=",
"to_bytes",
"(",
"obj",
",",
"\"utf-8\"",
... | 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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1293-L1328 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1330-L1355 |
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",
")",
":",
"# FIXME: the output doesn't have the same references as the real",
"# serializable form",
"self",
".",
"_writeStruct",
"(",
"\">B\"",
",",
"1",
",",
"(",
"self",
".",
"TC_ENUM",
",",
")",
")",
"try",
":",
... | Writes an Enum value
:param obj: A JavaEnum object | [
"Writes",
"an",
"Enum",
"value"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1357-L1382 |
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",
":",
"# Latin-1: keep bytes as is",
"obj",
"=",
"to_bytes",
"(",
"obj",
",",
"\"latin-1\"",
")",
"length",
"=",
"len",
... | 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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1384-L1406 |
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",
")",
":",
"# Transform object",
"for",
"transformer",
"in",
"self",
".",
"object_transformers",
":",
"tmp_object",
"=",
"transformer",
".",
"transform",
"(",
"obj",
")",
"if",
"tmp_o... | 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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1414-L1484 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1486-L1494 |
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",
":",
"# Add reference",
"self",
".",
"references",
".",
"append",
"(",
"obj",
")",
"logging",
".",
"debug",
"(... | Writes a class description
:param obj: Class description to write
:param parent: | [
"Writes",
"a",
"class",
"description"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1496-L1550 |
tcalmant/python-javaobj | javaobj/core.py | JavaObjectMarshaller.write_reference | def write_reference(self, ref_index):
"""
Writes a reference
:param ref_index: Local index (0-based) to the reference
"""
self._writeStruct(
">BL", 1, (self.TC_REFERENCE, ref_index + self.BASE_REFERENCE_IDX)
) | python | def write_reference(self, ref_index):
"""
Writes a reference
:param ref_index: Local index (0-based) to the reference
"""
self._writeStruct(
">BL", 1, (self.TC_REFERENCE, ref_index + self.BASE_REFERENCE_IDX)
) | [
"def",
"write_reference",
"(",
"self",
",",
"ref_index",
")",
":",
"self",
".",
"_writeStruct",
"(",
"\">BL\"",
",",
"1",
",",
"(",
"self",
".",
"TC_REFERENCE",
",",
"ref_index",
"+",
"self",
".",
"BASE_REFERENCE_IDX",
")",
")"
] | Writes a reference
:param ref_index: Local index (0-based) to the reference | [
"Writes",
"a",
"reference",
":",
"param",
"ref_index",
":",
"Local",
"index",
"(",
"0",
"-",
"based",
")",
"to",
"the",
"reference"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1552-L1559 |
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"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1561-L1593 |
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",
":",
"# We don't need details for arrays and objects",
"field_type",
"=",
"field_type",
"[",
"0",
"]",
"if",
"field_type",
"==",
"self... | Writes an item of an array
:param field_type: Value type
:param value: The value itself | [
"Writes",
"an",
"item",
"of",
"an",
"array"
] | train | https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1595-L1638 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.