repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
gccxml/pygccxml
pygccxml/declarations/container_traits.py
container_traits_impl_t.key_type
def key_type(self, type_): """returns reference to the class key type declaration""" if not self.is_mapping(type_): raise TypeError( 'Type "%s" is not "mapping" container' % str(type_)) return self.__find_xxx_type( type_, self.k...
python
def key_type(self, type_): """returns reference to the class key type declaration""" if not self.is_mapping(type_): raise TypeError( 'Type "%s" is not "mapping" container' % str(type_)) return self.__find_xxx_type( type_, self.k...
[ "def", "key_type", "(", "self", ",", "type_", ")", ":", "if", "not", "self", ".", "is_mapping", "(", "type_", ")", ":", "raise", "TypeError", "(", "'Type \"%s\" is not \"mapping\" container'", "%", "str", "(", "type_", ")", ")", "return", "self", ".", "__f...
returns reference to the class key type declaration
[ "returns", "reference", "to", "the", "class", "key", "type", "declaration" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/container_traits.py#L496-L506
train
gccxml/pygccxml
pygccxml/declarations/container_traits.py
container_traits_impl_t.remove_defaults
def remove_defaults(self, type_or_string): """ Removes template defaults from a templated class instantiation. For example: .. code-block:: c++ std::vector< int, std::allocator< int > > will become: .. code-block:: c++ std::vector...
python
def remove_defaults(self, type_or_string): """ Removes template defaults from a templated class instantiation. For example: .. code-block:: c++ std::vector< int, std::allocator< int > > will become: .. code-block:: c++ std::vector...
[ "def", "remove_defaults", "(", "self", ",", "type_or_string", ")", ":", "name", "=", "type_or_string", "if", "not", "utils", ".", "is_str", "(", "type_or_string", ")", ":", "name", "=", "self", ".", "class_declaration", "(", "type_or_string", ")", ".", "name...
Removes template defaults from a templated class instantiation. For example: .. code-block:: c++ std::vector< int, std::allocator< int > > will become: .. code-block:: c++ std::vector< int >
[ "Removes", "template", "defaults", "from", "a", "templated", "class", "instantiation", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/container_traits.py#L508-L532
train
gccxml/pygccxml
pygccxml/declarations/namespace.py
namespace_t.take_parenting
def take_parenting(self, inst): """ Takes parenting from inst and transfers it to self. Args: inst (namespace_t): a namespace declaration """ if self is inst: return for decl in inst.declarations: decl.parent = self self....
python
def take_parenting(self, inst): """ Takes parenting from inst and transfers it to self. Args: inst (namespace_t): a namespace declaration """ if self is inst: return for decl in inst.declarations: decl.parent = self self....
[ "def", "take_parenting", "(", "self", ",", "inst", ")", ":", "if", "self", "is", "inst", ":", "return", "for", "decl", "in", "inst", ".", "declarations", ":", "decl", ".", "parent", "=", "self", "self", ".", "declarations", ".", "append", "(", "decl", ...
Takes parenting from inst and transfers it to self. Args: inst (namespace_t): a namespace declaration
[ "Takes", "parenting", "from", "inst", "and", "transfers", "it", "to", "self", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/namespace.py#L73-L87
train
gccxml/pygccxml
pygccxml/declarations/namespace.py
namespace_t.remove_declaration
def remove_declaration(self, decl): """ Removes declaration from members list. :param decl: declaration to be removed :type decl: :class:`declaration_t` """ del self.declarations[self.declarations.index(decl)] decl.cache.reset()
python
def remove_declaration(self, decl): """ Removes declaration from members list. :param decl: declaration to be removed :type decl: :class:`declaration_t` """ del self.declarations[self.declarations.index(decl)] decl.cache.reset()
[ "def", "remove_declaration", "(", "self", ",", "decl", ")", ":", "del", "self", ".", "declarations", "[", "self", ".", "declarations", ".", "index", "(", "decl", ")", "]", "decl", ".", "cache", ".", "reset", "(", ")" ]
Removes declaration from members list. :param decl: declaration to be removed :type decl: :class:`declaration_t`
[ "Removes", "declaration", "from", "members", "list", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/namespace.py#L94-L104
train
gccxml/pygccxml
pygccxml/declarations/namespace.py
namespace_t.namespace
def namespace(self, name=None, function=None, recursive=None): """ Returns reference to namespace declaration that matches a defined criteria. """ return ( self._find_single( scopedef.scopedef_t._impl_matchers[namespace_t.namespace], ...
python
def namespace(self, name=None, function=None, recursive=None): """ Returns reference to namespace declaration that matches a defined criteria. """ return ( self._find_single( scopedef.scopedef_t._impl_matchers[namespace_t.namespace], ...
[ "def", "namespace", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "recursive", "=", "None", ")", ":", "return", "(", "self", ".", "_find_single", "(", "scopedef", ".", "scopedef_t", ".", "_impl_matchers", "[", "namespace_t", "...
Returns reference to namespace declaration that matches a defined criteria.
[ "Returns", "reference", "to", "namespace", "declaration", "that", "matches", "a", "defined", "criteria", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/namespace.py#L109-L122
train
gccxml/pygccxml
pygccxml/declarations/namespace.py
namespace_t.namespaces
def namespaces( self, name=None, function=None, recursive=None, allow_empty=None): """ Returns a set of namespace declarations that match a defined criteria. """ return ( self._find_multiple( ...
python
def namespaces( self, name=None, function=None, recursive=None, allow_empty=None): """ Returns a set of namespace declarations that match a defined criteria. """ return ( self._find_multiple( ...
[ "def", "namespaces", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "recursive", "=", "None", ",", "allow_empty", "=", "None", ")", ":", "return", "(", "self", ".", "_find_multiple", "(", "scopedef", ".", "scopedef_t", ".", "...
Returns a set of namespace declarations that match a defined criteria.
[ "Returns", "a", "set", "of", "namespace", "declarations", "that", "match", "a", "defined", "criteria", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/namespace.py#L124-L143
train
gccxml/pygccxml
pygccxml/declarations/namespace.py
namespace_t.free_function
def free_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None): """ Returns reference to free function declaration that matches ...
python
def free_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None): """ Returns reference to free function declaration that matches ...
[ "def", "free_function", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ...
Returns reference to free function declaration that matches a defined criteria.
[ "Returns", "reference", "to", "free", "function", "declaration", "that", "matches", "a", "defined", "criteria", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/namespace.py#L145-L171
train
gccxml/pygccxml
pygccxml/declarations/namespace.py
namespace_t.free_functions
def free_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """ Returns a set of free function decla...
python
def free_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """ Returns a set of free function decla...
[ "def", "free_functions", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ...
Returns a set of free function declarations that match a defined criteria.
[ "Returns", "a", "set", "of", "free", "function", "declarations", "that", "match", "a", "defined", "criteria", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/namespace.py#L173-L201
train
gccxml/pygccxml
pygccxml/declarations/namespace.py
namespace_t.free_operator
def free_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None): """ Returns reference to free operator declara...
python
def free_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None): """ Returns reference to free operator declara...
[ "def", "free_operator", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "symbol", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",...
Returns reference to free operator declaration that matches a defined criteria.
[ "Returns", "reference", "to", "free", "operator", "declaration", "that", "matches", "a", "defined", "criteria", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/namespace.py#L203-L230
train
gccxml/pygccxml
pygccxml/declarations/calldef_types.py
CALLING_CONVENTION_TYPES.extract
def extract(text, default=UNKNOWN): """extracts calling convention from the text. If the calling convention could not be found, the "default"is used""" if not text: return default found = CALLING_CONVENTION_TYPES.pattern.match(text) if found: return found....
python
def extract(text, default=UNKNOWN): """extracts calling convention from the text. If the calling convention could not be found, the "default"is used""" if not text: return default found = CALLING_CONVENTION_TYPES.pattern.match(text) if found: return found....
[ "def", "extract", "(", "text", ",", "default", "=", "UNKNOWN", ")", ":", "if", "not", "text", ":", "return", "default", "found", "=", "CALLING_CONVENTION_TYPES", ".", "pattern", ".", "match", "(", "text", ")", "if", "found", ":", "return", "found", ".", ...
extracts calling convention from the text. If the calling convention could not be found, the "default"is used
[ "extracts", "calling", "convention", "from", "the", "text", ".", "If", "the", "calling", "convention", "could", "not", "be", "found", "the", "default", "is", "used" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/calldef_types.py#L38-L47
train
gccxml/pygccxml
pygccxml/declarations/function_traits.py
is_same_function
def is_same_function(f1, f2): """returns true if f1 and f2 is same function Use case: sometimes when user defines some virtual function in base class, it overrides it in a derived one. Sometimes we need to know whether two member functions is actually same function. """ if f1 is f2: ret...
python
def is_same_function(f1, f2): """returns true if f1 and f2 is same function Use case: sometimes when user defines some virtual function in base class, it overrides it in a derived one. Sometimes we need to know whether two member functions is actually same function. """ if f1 is f2: ret...
[ "def", "is_same_function", "(", "f1", ",", "f2", ")", ":", "if", "f1", "is", "f2", ":", "return", "True", "if", "f1", ".", "__class__", "is", "not", "f2", ".", "__class__", ":", "return", "False", "if", "isinstance", "(", "f1", ",", "calldef_members", ...
returns true if f1 and f2 is same function Use case: sometimes when user defines some virtual function in base class, it overrides it in a derived one. Sometimes we need to know whether two member functions is actually same function.
[ "returns", "true", "if", "f1", "and", "f2", "is", "same", "function" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/function_traits.py#L73-L96
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
make_flatten
def make_flatten(decl_or_decls): """ Converts tree representation of declarations to flatten one. :param decl_or_decls: reference to list of declaration's or single declaration :type decl_or_decls: :class:`declaration_t` or [ :class:`declaration_t` ] :rtype: [ all internal declarations ] ...
python
def make_flatten(decl_or_decls): """ Converts tree representation of declarations to flatten one. :param decl_or_decls: reference to list of declaration's or single declaration :type decl_or_decls: :class:`declaration_t` or [ :class:`declaration_t` ] :rtype: [ all internal declarations ] ...
[ "def", "make_flatten", "(", "decl_or_decls", ")", ":", "def", "proceed_single", "(", "decl", ")", ":", "answer", "=", "[", "decl", "]", "if", "not", "isinstance", "(", "decl", ",", "scopedef_t", ")", ":", "return", "answer", "for", "elem", "in", "decl", ...
Converts tree representation of declarations to flatten one. :param decl_or_decls: reference to list of declaration's or single declaration :type decl_or_decls: :class:`declaration_t` or [ :class:`declaration_t` ] :rtype: [ all internal declarations ]
[ "Converts", "tree", "representation", "of", "declarations", "to", "flatten", "one", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L1058-L1088
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
find_all_declarations
def find_all_declarations( declarations, decl_type=None, name=None, parent=None, recursive=True, fullname=None): """ Returns a list of all declarations that match criteria, defined by developer. For more information about arguments see :class:`match_decla...
python
def find_all_declarations( declarations, decl_type=None, name=None, parent=None, recursive=True, fullname=None): """ Returns a list of all declarations that match criteria, defined by developer. For more information about arguments see :class:`match_decla...
[ "def", "find_all_declarations", "(", "declarations", ",", "decl_type", "=", "None", ",", "name", "=", "None", ",", "parent", "=", "None", ",", "recursive", "=", "True", ",", "fullname", "=", "None", ")", ":", "if", "recursive", ":", "decls", "=", "make_f...
Returns a list of all declarations that match criteria, defined by developer. For more information about arguments see :class:`match_declaration_t` class. :rtype: [ matched declarations ]
[ "Returns", "a", "list", "of", "all", "declarations", "that", "match", "criteria", "defined", "by", "developer", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L1091-L1121
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
find_declaration
def find_declaration( declarations, decl_type=None, name=None, parent=None, recursive=True, fullname=None): """ Returns single declaration that match criteria, defined by developer. If more the one declaration was found None will be returned. For more inf...
python
def find_declaration( declarations, decl_type=None, name=None, parent=None, recursive=True, fullname=None): """ Returns single declaration that match criteria, defined by developer. If more the one declaration was found None will be returned. For more inf...
[ "def", "find_declaration", "(", "declarations", ",", "decl_type", "=", "None", ",", "name", "=", "None", ",", "parent", "=", "None", ",", "recursive", "=", "True", ",", "fullname", "=", "None", ")", ":", "decl", "=", "find_all_declarations", "(", "declarat...
Returns single declaration that match criteria, defined by developer. If more the one declaration was found None will be returned. For more information about arguments see :class:`match_declaration_t` class. :rtype: matched declaration :class:`declaration_t` or None
[ "Returns", "single", "declaration", "that", "match", "criteria", "defined", "by", "developer", ".", "If", "more", "the", "one", "declaration", "was", "found", "None", "will", "be", "returned", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L1124-L1150
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
find_first_declaration
def find_first_declaration( declarations, decl_type=None, name=None, parent=None, recursive=True, fullname=None): """ Returns first declaration that match criteria, defined by developer. For more information about arguments see :class:`match_declaration_t` ...
python
def find_first_declaration( declarations, decl_type=None, name=None, parent=None, recursive=True, fullname=None): """ Returns first declaration that match criteria, defined by developer. For more information about arguments see :class:`match_declaration_t` ...
[ "def", "find_first_declaration", "(", "declarations", ",", "decl_type", "=", "None", ",", "name", "=", "None", ",", "parent", "=", "None", ",", "recursive", "=", "True", ",", "fullname", "=", "None", ")", ":", "decl_matcher", "=", "algorithm", ".", "match_...
Returns first declaration that match criteria, defined by developer. For more information about arguments see :class:`match_declaration_t` class. :rtype: matched declaration :class:`declaration_t` or None
[ "Returns", "first", "declaration", "that", "match", "criteria", "defined", "by", "developer", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L1153-L1182
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
declaration_files
def declaration_files(decl_or_decls): """ Returns set of files Every declaration is declared in some file. This function returns set, that contains all file names of declarations. :param decl_or_decls: reference to list of declaration's or single declaration :type decl_or_decls: :class...
python
def declaration_files(decl_or_decls): """ Returns set of files Every declaration is declared in some file. This function returns set, that contains all file names of declarations. :param decl_or_decls: reference to list of declaration's or single declaration :type decl_or_decls: :class...
[ "def", "declaration_files", "(", "decl_or_decls", ")", ":", "files", "=", "set", "(", ")", "decls", "=", "make_flatten", "(", "decl_or_decls", ")", "for", "decl", "in", "decls", ":", "if", "decl", ".", "location", ":", "files", ".", "add", "(", "decl", ...
Returns set of files Every declaration is declared in some file. This function returns set, that contains all file names of declarations. :param decl_or_decls: reference to list of declaration's or single declaration :type decl_or_decls: :class:`declaration_t` or [:class:`declaration_t`] :...
[ "Returns", "set", "of", "files" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L1185-L1204
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
matcher.find
def find(decl_matcher, decls, recursive=True): """ Returns a list of declarations that match `decl_matcher` defined criteria or None :param decl_matcher: Python callable object, that takes one argument - reference to a declaration :param decls: the search scope, :cla...
python
def find(decl_matcher, decls, recursive=True): """ Returns a list of declarations that match `decl_matcher` defined criteria or None :param decl_matcher: Python callable object, that takes one argument - reference to a declaration :param decls: the search scope, :cla...
[ "def", "find", "(", "decl_matcher", ",", "decls", ",", "recursive", "=", "True", ")", ":", "where", "=", "[", "]", "if", "isinstance", "(", "decls", ",", "list", ")", ":", "where", ".", "extend", "(", "decls", ")", "else", ":", "where", ".", "appen...
Returns a list of declarations that match `decl_matcher` defined criteria or None :param decl_matcher: Python callable object, that takes one argument - reference to a declaration :param decls: the search scope, :class:declaration_t object or :class:declaration_t objects...
[ "Returns", "a", "list", "of", "declarations", "that", "match", "decl_matcher", "defined", "criteria", "or", "None" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L29-L49
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
matcher.find_single
def find_single(decl_matcher, decls, recursive=True): """ Returns a reference to the declaration, that match `decl_matcher` defined criteria. if a unique declaration could not be found the method will return None. :param decl_matcher: Python callable object, that takes one argu...
python
def find_single(decl_matcher, decls, recursive=True): """ Returns a reference to the declaration, that match `decl_matcher` defined criteria. if a unique declaration could not be found the method will return None. :param decl_matcher: Python callable object, that takes one argu...
[ "def", "find_single", "(", "decl_matcher", ",", "decls", ",", "recursive", "=", "True", ")", ":", "answer", "=", "matcher", ".", "find", "(", "decl_matcher", ",", "decls", ",", "recursive", ")", "if", "len", "(", "answer", ")", "==", "1", ":", "return"...
Returns a reference to the declaration, that match `decl_matcher` defined criteria. if a unique declaration could not be found the method will return None. :param decl_matcher: Python callable object, that takes one argument - reference to a declaration :param decls: the se...
[ "Returns", "a", "reference", "to", "the", "declaration", "that", "match", "decl_matcher", "defined", "criteria", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L52-L68
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
matcher.get_single
def get_single(decl_matcher, decls, recursive=True): """ Returns a reference to declaration, that match `decl_matcher` defined criteria. If a unique declaration could not be found, an appropriate exception will be raised. :param decl_matcher: Python callable object, tha...
python
def get_single(decl_matcher, decls, recursive=True): """ Returns a reference to declaration, that match `decl_matcher` defined criteria. If a unique declaration could not be found, an appropriate exception will be raised. :param decl_matcher: Python callable object, tha...
[ "def", "get_single", "(", "decl_matcher", ",", "decls", ",", "recursive", "=", "True", ")", ":", "answer", "=", "matcher", ".", "find", "(", "decl_matcher", ",", "decls", ",", "recursive", ")", "if", "len", "(", "answer", ")", "==", "1", ":", "return",...
Returns a reference to declaration, that match `decl_matcher` defined criteria. If a unique declaration could not be found, an appropriate exception will be raised. :param decl_matcher: Python callable object, that takes one argument - reference to a declaration :pa...
[ "Returns", "a", "reference", "to", "declaration", "that", "match", "decl_matcher", "defined", "criteria", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L71-L92
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.clear_optimizer
def clear_optimizer(self): """Cleans query optimizer state""" self._optimized = False self._type2decls = {} self._type2name2decls = {} self._type2decls_nr = {} self._type2name2decls_nr = {} self._all_decls = None self._all_decls_not_recursive = None ...
python
def clear_optimizer(self): """Cleans query optimizer state""" self._optimized = False self._type2decls = {} self._type2name2decls = {} self._type2decls_nr = {} self._type2name2decls_nr = {} self._all_decls = None self._all_decls_not_recursive = None ...
[ "def", "clear_optimizer", "(", "self", ")", ":", "self", ".", "_optimized", "=", "False", "self", ".", "_type2decls", "=", "{", "}", "self", ".", "_type2name2decls", "=", "{", "}", "self", ".", "_type2decls_nr", "=", "{", "}", "self", ".", "_type2name2de...
Cleans query optimizer state
[ "Cleans", "query", "optimizer", "state" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L248-L260
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.init_optimizer
def init_optimizer(self): """ Initializes query optimizer state. There are 4 internals hash tables: 1. from type to declarations 2. from type to declarations for non-recursive queries 3. from type to name to declarations 4. from type to name to de...
python
def init_optimizer(self): """ Initializes query optimizer state. There are 4 internals hash tables: 1. from type to declarations 2. from type to declarations for non-recursive queries 3. from type to name to declarations 4. from type to name to de...
[ "def", "init_optimizer", "(", "self", ")", ":", "if", "self", ".", "name", "==", "'::'", ":", "self", ".", "_logger", ".", "debug", "(", "\"preparing data structures for query optimizer - started\"", ")", "start_time", "=", "timeit", ".", "default_timer", "(", "...
Initializes query optimizer state. There are 4 internals hash tables: 1. from type to declarations 2. from type to declarations for non-recursive queries 3. from type to name to declarations 4. from type to name to declarations for non-recursive queries ...
[ "Initializes", "query", "optimizer", "state", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L262-L314
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.decls
def decls( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of declarations, that are matched defined criteria""" return (...
python
def decls( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of declarations, that are matched defined criteria""" return (...
[ "def", "decls", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "decl_type", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ",", "allow_empty", "=", "None", ")", ...
returns a set of declarations, that are matched defined criteria
[ "returns", "a", "set", "of", "declarations", "that", "are", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L515-L536
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.classes
def classes( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of class declarations, that are matched defined criteria""" return ( ...
python
def classes( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of class declarations, that are matched defined criteria""" return ( ...
[ "def", "classes", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ",", "allow_empty", "=", "None", ")", ":", "return", "(", "self", "...
returns a set of class declarations, that are matched defined criteria
[ "returns", "a", "set", "of", "class", "declarations", "that", "are", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L559-L580
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.variable
def variable( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None): """returns reference to variable declaration, that is matched defined criteria""" return ( ...
python
def variable( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None): """returns reference to variable declaration, that is matched defined criteria""" return ( ...
[ "def", "variable", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "decl_type", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ")", ":", "return", "(", "self", "....
returns reference to variable declaration, that is matched defined criteria
[ "returns", "reference", "to", "variable", "declaration", "that", "is", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L582-L603
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.variables
def variables( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of variable declarations, that are matched defined criter...
python
def variables( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of variable declarations, that are matched defined criter...
[ "def", "variables", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "decl_type", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ",", "allow_empty", "=", "None", ")"...
returns a set of variable declarations, that are matched defined criteria
[ "returns", "a", "set", "of", "variable", "declarations", "that", "are", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L605-L628
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.member_functions
def member_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of member function declaratio...
python
def member_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of member function declaratio...
[ "def", "member_functions", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None"...
returns a set of member function declarations, that are matched defined criteria
[ "returns", "a", "set", "of", "member", "function", "declarations", "that", "are", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L767-L792
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.constructor
def constructor( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None): """returns reference to constructor declaration, that is matched defined ...
python
def constructor( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None): """returns reference to constructor declaration, that is matched defined ...
[ "def", "constructor", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", "...
returns reference to constructor declaration, that is matched defined criteria
[ "returns", "reference", "to", "constructor", "declaration", "that", "is", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L794-L817
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.constructors
def constructors( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of constructor declarations, that...
python
def constructors( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of constructor declarations, that...
[ "def", "constructors", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ...
returns a set of constructor declarations, that are matched defined criteria
[ "returns", "a", "set", "of", "constructor", "declarations", "that", "are", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L819-L844
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.casting_operators
def casting_operators( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of casting operator declarat...
python
def casting_operators( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of casting operator declarat...
[ "def", "casting_operators", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None...
returns a set of casting operator declarations, that are matched defined criteria
[ "returns", "a", "set", "of", "casting", "operator", "declarations", "that", "are", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L931-L956
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.enumerations
def enumerations( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of enumeration declarations, that are matched defined criteria""" return ( ...
python
def enumerations( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of enumeration declarations, that are matched defined criteria""" return ( ...
[ "def", "enumerations", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ",", "allow_empty", "=", "None", ")", ":", "return", "(", "self"...
returns a set of enumeration declarations, that are matched defined criteria
[ "returns", "a", "set", "of", "enumeration", "declarations", "that", "are", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L979-L1000
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.typedef
def typedef( self, name=None, function=None, header_dir=None, header_file=None, recursive=None): """returns reference to typedef declaration, that is matched defined criteria""" return ( self._find_single( ...
python
def typedef( self, name=None, function=None, header_dir=None, header_file=None, recursive=None): """returns reference to typedef declaration, that is matched defined criteria""" return ( self._find_single( ...
[ "def", "typedef", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ")", ":", "return", "(", "self", ".", "_find_single", "(", "self", ...
returns reference to typedef declaration, that is matched defined criteria
[ "returns", "reference", "to", "typedef", "declaration", "that", "is", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L1002-L1021
train
gccxml/pygccxml
pygccxml/declarations/scopedef.py
scopedef_t.typedefs
def typedefs( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of typedef declarations, that are matched defined criteria""" return ( ...
python
def typedefs( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None): """returns a set of typedef declarations, that are matched defined criteria""" return ( ...
[ "def", "typedefs", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ",", "recursive", "=", "None", ",", "allow_empty", "=", "None", ")", ":", "return", "(", "self", ...
returns a set of typedef declarations, that are matched defined criteria
[ "returns", "a", "set", "of", "typedef", "declarations", "that", "are", "matched", "defined", "criteria" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/scopedef.py#L1023-L1044
train
gccxml/pygccxml
pygccxml/parser/config.py
load_xml_generator_configuration
def load_xml_generator_configuration(configuration, **defaults): """ Loads CastXML or GCC-XML configuration. Args: configuration (string|configparser.ConfigParser): can be a string (file path to a configuration file) or instance of :class:`configparser.ConfigParser`. ...
python
def load_xml_generator_configuration(configuration, **defaults): """ Loads CastXML or GCC-XML configuration. Args: configuration (string|configparser.ConfigParser): can be a string (file path to a configuration file) or instance of :class:`configparser.ConfigParser`. ...
[ "def", "load_xml_generator_configuration", "(", "configuration", ",", "**", "defaults", ")", ":", "parser", "=", "configuration", "if", "utils", ".", "is_str", "(", "configuration", ")", ":", "parser", "=", "ConfigParser", "(", ")", "parser", ".", "read", "(",...
Loads CastXML or GCC-XML configuration. Args: configuration (string|configparser.ConfigParser): can be a string (file path to a configuration file) or instance of :class:`configparser.ConfigParser`. defaults: can be used to override single configuration values. Retu...
[ "Loads", "CastXML", "or", "GCC", "-", "XML", "configuration", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/config.py#L333-L410
train
gccxml/pygccxml
pygccxml/parser/config.py
create_compiler_path
def create_compiler_path(xml_generator, compiler_path): """ Try to guess a path for the compiler. If you want ot use a specific compiler, please provide the compiler path manually, as the guess may not be what you are expecting. Providing the path can be done by passing it as an argument (compiler_...
python
def create_compiler_path(xml_generator, compiler_path): """ Try to guess a path for the compiler. If you want ot use a specific compiler, please provide the compiler path manually, as the guess may not be what you are expecting. Providing the path can be done by passing it as an argument (compiler_...
[ "def", "create_compiler_path", "(", "xml_generator", ",", "compiler_path", ")", ":", "if", "xml_generator", "==", "'castxml'", "and", "compiler_path", "is", "None", ":", "if", "platform", ".", "system", "(", ")", "==", "'Windows'", ":", "p", "=", "subprocess",...
Try to guess a path for the compiler. If you want ot use a specific compiler, please provide the compiler path manually, as the guess may not be what you are expecting. Providing the path can be done by passing it as an argument (compiler_path) to the xml_generator_configuration_t() or by defining it i...
[ "Try", "to", "guess", "a", "path", "for", "the", "compiler", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/config.py#L413-L471
train
gccxml/pygccxml
pygccxml/parser/config.py
parser_configuration_t.raise_on_wrong_settings
def raise_on_wrong_settings(self): """ Validates the configuration settings and raises RuntimeError on error """ self.__ensure_dir_exists(self.working_directory, 'working directory') for idir in self.include_paths: self.__ensure_dir_exists(idir, 'include directory') ...
python
def raise_on_wrong_settings(self): """ Validates the configuration settings and raises RuntimeError on error """ self.__ensure_dir_exists(self.working_directory, 'working directory') for idir in self.include_paths: self.__ensure_dir_exists(idir, 'include directory') ...
[ "def", "raise_on_wrong_settings", "(", "self", ")", ":", "self", ".", "__ensure_dir_exists", "(", "self", ".", "working_directory", ",", "'working directory'", ")", "for", "idir", "in", "self", ".", "include_paths", ":", "self", ".", "__ensure_dir_exists", "(", ...
Validates the configuration settings and raises RuntimeError on error
[ "Validates", "the", "configuration", "settings", "and", "raises", "RuntimeError", "on", "error" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/config.py#L210-L220
train
gccxml/pygccxml
pygccxml/declarations/declaration_utils.py
declaration_path
def declaration_path(decl): """ Returns a list of parent declarations names. Args: decl (declaration_t): declaration for which declaration path should be calculated. Returns: list[(str | basestring)]: list of names, where first item is the top ...
python
def declaration_path(decl): """ Returns a list of parent declarations names. Args: decl (declaration_t): declaration for which declaration path should be calculated. Returns: list[(str | basestring)]: list of names, where first item is the top ...
[ "def", "declaration_path", "(", "decl", ")", ":", "if", "not", "decl", ":", "return", "[", "]", "if", "not", "decl", ".", "cache", ".", "declaration_path", ":", "result", "=", "[", "decl", ".", "name", "]", "parent", "=", "decl", ".", "parent", "whil...
Returns a list of parent declarations names. Args: decl (declaration_t): declaration for which declaration path should be calculated. Returns: list[(str | basestring)]: list of names, where first item is the top parent name and la...
[ "Returns", "a", "list", "of", "parent", "declarations", "names", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/declaration_utils.py#L7-L39
train
gccxml/pygccxml
pygccxml/declarations/declaration_utils.py
partial_declaration_path
def partial_declaration_path(decl): """ Returns a list of parent declarations names without template arguments that have default value. Args: decl (declaration_t): declaration for which the partial declaration path should be calculated. Returns: list[(...
python
def partial_declaration_path(decl): """ Returns a list of parent declarations names without template arguments that have default value. Args: decl (declaration_t): declaration for which the partial declaration path should be calculated. Returns: list[(...
[ "def", "partial_declaration_path", "(", "decl", ")", ":", "if", "not", "decl", ":", "return", "[", "]", "if", "not", "decl", ".", "cache", ".", "partial_declaration_path", ":", "result", "=", "[", "decl", ".", "partial_name", "]", "parent", "=", "decl", ...
Returns a list of parent declarations names without template arguments that have default value. Args: decl (declaration_t): declaration for which the partial declaration path should be calculated. Returns: list[(str | basestring)]: list of names, where first i...
[ "Returns", "a", "list", "of", "parent", "declarations", "names", "without", "template", "arguments", "that", "have", "default", "value", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/declaration_utils.py#L42-L78
train
gccxml/pygccxml
pygccxml/declarations/declaration_utils.py
full_name
def full_name(decl, with_defaults=True): """ Returns declaration full qualified name. If `decl` belongs to anonymous namespace or class, the function will return C++ illegal qualified name. Args: decl (declaration_t): declaration for which the full qualified name ...
python
def full_name(decl, with_defaults=True): """ Returns declaration full qualified name. If `decl` belongs to anonymous namespace or class, the function will return C++ illegal qualified name. Args: decl (declaration_t): declaration for which the full qualified name ...
[ "def", "full_name", "(", "decl", ",", "with_defaults", "=", "True", ")", ":", "if", "None", "is", "decl", ":", "raise", "RuntimeError", "(", "\"Unable to generate full name for None object!\"", ")", "if", "with_defaults", ":", "if", "not", "decl", ".", "cache", ...
Returns declaration full qualified name. If `decl` belongs to anonymous namespace or class, the function will return C++ illegal qualified name. Args: decl (declaration_t): declaration for which the full qualified name should be calculated. Returns: list[...
[ "Returns", "declaration", "full", "qualified", "name", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/declaration_utils.py#L90-L128
train
gccxml/pygccxml
pygccxml/declarations/declaration_utils.py
get_named_parent
def get_named_parent(decl): """ Returns a reference to a named parent declaration. Args: decl (declaration_t): the child declaration Returns: declaration_t: the declaration or None if not found. """ if not decl: return None parent = decl.parent while parent a...
python
def get_named_parent(decl): """ Returns a reference to a named parent declaration. Args: decl (declaration_t): the child declaration Returns: declaration_t: the declaration or None if not found. """ if not decl: return None parent = decl.parent while parent a...
[ "def", "get_named_parent", "(", "decl", ")", ":", "if", "not", "decl", ":", "return", "None", "parent", "=", "decl", ".", "parent", "while", "parent", "and", "(", "not", "parent", ".", "name", "or", "parent", ".", "name", "==", "'::'", ")", ":", "par...
Returns a reference to a named parent declaration. Args: decl (declaration_t): the child declaration Returns: declaration_t: the declaration or None if not found.
[ "Returns", "a", "reference", "to", "a", "named", "parent", "declaration", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/declaration_utils.py#L131-L149
train
gccxml/pygccxml
pygccxml/declarations/decl_printer.py
print_declarations
def print_declarations( decls, detailed=True, recursive=True, writer=lambda x: sys.stdout.write(x + os.linesep), verbose=True): """ print declarations tree rooted at each of the included nodes. :param decls: either a single :class:declaration_t object or list ...
python
def print_declarations( decls, detailed=True, recursive=True, writer=lambda x: sys.stdout.write(x + os.linesep), verbose=True): """ print declarations tree rooted at each of the included nodes. :param decls: either a single :class:declaration_t object or list ...
[ "def", "print_declarations", "(", "decls", ",", "detailed", "=", "True", ",", "recursive", "=", "True", ",", "writer", "=", "lambda", "x", ":", "sys", ".", "stdout", ".", "write", "(", "x", "+", "os", ".", "linesep", ")", ",", "verbose", "=", "True",...
print declarations tree rooted at each of the included nodes. :param decls: either a single :class:declaration_t object or list of :class:declaration_t objects
[ "print", "declarations", "tree", "rooted", "at", "each", "of", "the", "included", "nodes", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/decl_printer.py#L434-L452
train
gccxml/pygccxml
pygccxml/declarations/decl_printer.py
dump_declarations
def dump_declarations(declarations, file_path): """ Dump declarations tree rooted at each of the included nodes to the file :param declarations: either a single :class:declaration_t object or a list of :class:declaration_t objects :param file_path: path to a file """ with open(file_pa...
python
def dump_declarations(declarations, file_path): """ Dump declarations tree rooted at each of the included nodes to the file :param declarations: either a single :class:declaration_t object or a list of :class:declaration_t objects :param file_path: path to a file """ with open(file_pa...
[ "def", "dump_declarations", "(", "declarations", ",", "file_path", ")", ":", "with", "open", "(", "file_path", ",", "\"w+\"", ")", "as", "f", ":", "print_declarations", "(", "declarations", ",", "writer", "=", "f", ".", "write", ")" ]
Dump declarations tree rooted at each of the included nodes to the file :param declarations: either a single :class:declaration_t object or a list of :class:declaration_t objects :param file_path: path to a file
[ "Dump", "declarations", "tree", "rooted", "at", "each", "of", "the", "included", "nodes", "to", "the", "file" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/decl_printer.py#L455-L466
train
gccxml/pygccxml
pygccxml/parser/source_reader.py
source_reader_t.__add_symbols
def __add_symbols(self, cmd): """ Add all additional defined and undefined symbols. """ if self.__config.define_symbols: symbols = self.__config.define_symbols cmd.append(''.join( [' -D"%s"' % def_symbol for def_symbol in symbols])) if s...
python
def __add_symbols(self, cmd): """ Add all additional defined and undefined symbols. """ if self.__config.define_symbols: symbols = self.__config.define_symbols cmd.append(''.join( [' -D"%s"' % def_symbol for def_symbol in symbols])) if s...
[ "def", "__add_symbols", "(", "self", ",", "cmd", ")", ":", "if", "self", ".", "__config", ".", "define_symbols", ":", "symbols", "=", "self", ".", "__config", ".", "define_symbols", "cmd", ".", "append", "(", "''", ".", "join", "(", "[", "' -D\"%s\"'", ...
Add all additional defined and undefined symbols.
[ "Add", "all", "additional", "defined", "and", "undefined", "symbols", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/source_reader.py#L183-L199
train
gccxml/pygccxml
pygccxml/parser/source_reader.py
source_reader_t.create_xml_file
def create_xml_file(self, source_file, destination=None): """ This method will generate a xml file using an external tool. The method will return the file path of the generated xml file. :param source_file: path to the source file that should be parsed. :type source_file: str ...
python
def create_xml_file(self, source_file, destination=None): """ This method will generate a xml file using an external tool. The method will return the file path of the generated xml file. :param source_file: path to the source file that should be parsed. :type source_file: str ...
[ "def", "create_xml_file", "(", "self", ",", "source_file", ",", "destination", "=", "None", ")", ":", "xml_file", "=", "destination", "if", "xml_file", ":", "utils", ".", "remove_file_no_raise", "(", "xml_file", ",", "self", ".", "__config", ")", "else", ":"...
This method will generate a xml file using an external tool. The method will return the file path of the generated xml file. :param source_file: path to the source file that should be parsed. :type source_file: str :param destination: if given, will be used as target file path for ...
[ "This", "method", "will", "generate", "a", "xml", "file", "using", "an", "external", "tool", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/source_reader.py#L201-L273
train
gccxml/pygccxml
pygccxml/parser/source_reader.py
source_reader_t.create_xml_file_from_string
def create_xml_file_from_string(self, content, destination=None): """ Creates XML file from text. :param content: C++ source code :type content: str :param destination: file name for xml file :type destination: str :rtype: returns file name of xml file ...
python
def create_xml_file_from_string(self, content, destination=None): """ Creates XML file from text. :param content: C++ source code :type content: str :param destination: file name for xml file :type destination: str :rtype: returns file name of xml file ...
[ "def", "create_xml_file_from_string", "(", "self", ",", "content", ",", "destination", "=", "None", ")", ":", "header_file", "=", "utils", ".", "create_temp_file_name", "(", "suffix", "=", "'.h'", ")", "try", ":", "with", "open", "(", "header_file", ",", "\"...
Creates XML file from text. :param content: C++ source code :type content: str :param destination: file name for xml file :type destination: str :rtype: returns file name of xml file
[ "Creates", "XML", "file", "from", "text", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/source_reader.py#L275-L295
train
gccxml/pygccxml
pygccxml/parser/source_reader.py
source_reader_t.read_cpp_source_file
def read_cpp_source_file(self, source_file): """ Reads C++ source file and returns declarations tree :param source_file: path to C++ source file :type source_file: str """ xml_file = '' try: ffname = self.__file_full_name(source_file) se...
python
def read_cpp_source_file(self, source_file): """ Reads C++ source file and returns declarations tree :param source_file: path to C++ source file :type source_file: str """ xml_file = '' try: ffname = self.__file_full_name(source_file) se...
[ "def", "read_cpp_source_file", "(", "self", ",", "source_file", ")", ":", "xml_file", "=", "''", "try", ":", "ffname", "=", "self", ".", "__file_full_name", "(", "source_file", ")", "self", ".", "logger", ".", "debug", "(", "\"Reading source file: [%s].\"", ",...
Reads C++ source file and returns declarations tree :param source_file: path to C++ source file :type source_file: str
[ "Reads", "C", "++", "source", "file", "and", "returns", "declarations", "tree" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/source_reader.py#L300-L332
train
gccxml/pygccxml
pygccxml/parser/source_reader.py
source_reader_t.read_xml_file
def read_xml_file(self, xml_file): """ Read generated XML file. :param xml_file: path to xml file :type xml_file: str :rtype: declarations tree """ assert self.__config is not None ffname = self.__file_full_name(xml_file) self.logger.debug("Re...
python
def read_xml_file(self, xml_file): """ Read generated XML file. :param xml_file: path to xml file :type xml_file: str :rtype: declarations tree """ assert self.__config is not None ffname = self.__file_full_name(xml_file) self.logger.debug("Re...
[ "def", "read_xml_file", "(", "self", ",", "xml_file", ")", ":", "assert", "self", ".", "__config", "is", "not", "None", "ffname", "=", "self", ".", "__file_full_name", "(", "xml_file", ")", "self", ".", "logger", ".", "debug", "(", "\"Reading xml file: [%s]\...
Read generated XML file. :param xml_file: path to xml file :type xml_file: str :rtype: declarations tree
[ "Read", "generated", "XML", "file", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/source_reader.py#L334-L358
train
gccxml/pygccxml
pygccxml/parser/source_reader.py
source_reader_t.read_string
def read_string(self, content): """ Reads a Python string that contains C++ code, and return the declarations tree. """ header_file = utils.create_temp_file_name(suffix='.h') with open(header_file, "w+") as f: f.write(content) try: decls...
python
def read_string(self, content): """ Reads a Python string that contains C++ code, and return the declarations tree. """ header_file = utils.create_temp_file_name(suffix='.h') with open(header_file, "w+") as f: f.write(content) try: decls...
[ "def", "read_string", "(", "self", ",", "content", ")", ":", "header_file", "=", "utils", ".", "create_temp_file_name", "(", "suffix", "=", "'.h'", ")", "with", "open", "(", "header_file", ",", "\"w+\"", ")", "as", "f", ":", "f", ".", "write", "(", "co...
Reads a Python string that contains C++ code, and return the declarations tree.
[ "Reads", "a", "Python", "string", "that", "contains", "C", "++", "code", "and", "return", "the", "declarations", "tree", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/source_reader.py#L360-L378
train
gccxml/pygccxml
pygccxml/declarations/algorithm.py
apply_visitor
def apply_visitor(visitor, decl_inst): """ Applies a visitor on declaration instance. :param visitor: instance :type visitor: :class:`type_visitor_t` or :class:`decl_visitor_t` """ fname = 'visit_' + \ decl_inst.__class__.__name__[:-2] # removing '_t' from class name if not hasat...
python
def apply_visitor(visitor, decl_inst): """ Applies a visitor on declaration instance. :param visitor: instance :type visitor: :class:`type_visitor_t` or :class:`decl_visitor_t` """ fname = 'visit_' + \ decl_inst.__class__.__name__[:-2] # removing '_t' from class name if not hasat...
[ "def", "apply_visitor", "(", "visitor", ",", "decl_inst", ")", ":", "fname", "=", "'visit_'", "+", "decl_inst", ".", "__class__", ".", "__name__", "[", ":", "-", "2", "]", "if", "not", "hasattr", "(", "visitor", ",", "fname", ")", ":", "raise", "runtim...
Applies a visitor on declaration instance. :param visitor: instance :type visitor: :class:`type_visitor_t` or :class:`decl_visitor_t`
[ "Applies", "a", "visitor", "on", "declaration", "instance", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/algorithm.py#L73-L87
train
gccxml/pygccxml
pygccxml/declarations/algorithm.py
match_declaration_t.does_match_exist
def does_match_exist(self, inst): """ Returns True if inst does match one of specified criteria. :param inst: declaration instance :type inst: :class:`declaration_t` :rtype: bool """ answer = True if self._decl_type is not None: answer &= i...
python
def does_match_exist(self, inst): """ Returns True if inst does match one of specified criteria. :param inst: declaration instance :type inst: :class:`declaration_t` :rtype: bool """ answer = True if self._decl_type is not None: answer &= i...
[ "def", "does_match_exist", "(", "self", ",", "inst", ")", ":", "answer", "=", "True", "if", "self", ".", "_decl_type", "is", "not", "None", ":", "answer", "&=", "isinstance", "(", "inst", ",", "self", ".", "_decl_type", ")", "if", "self", ".", "name", ...
Returns True if inst does match one of specified criteria. :param inst: declaration instance :type inst: :class:`declaration_t` :rtype: bool
[ "Returns", "True", "if", "inst", "does", "match", "one", "of", "specified", "criteria", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/algorithm.py#L37-L60
train
gccxml/pygccxml
pygccxml/declarations/declaration.py
declaration_t.partial_name
def partial_name(self): """ Declaration name, without template default arguments. Right now std containers is the only classes that support this functionality. """ if None is self._partial_name: self._partial_name = self._get_partial_name_impl() re...
python
def partial_name(self): """ Declaration name, without template default arguments. Right now std containers is the only classes that support this functionality. """ if None is self._partial_name: self._partial_name = self._get_partial_name_impl() re...
[ "def", "partial_name", "(", "self", ")", ":", "if", "None", "is", "self", ".", "_partial_name", ":", "self", ".", "_partial_name", "=", "self", ".", "_get_partial_name_impl", "(", ")", "return", "self", ".", "_partial_name" ]
Declaration name, without template default arguments. Right now std containers is the only classes that support this functionality.
[ "Declaration", "name", "without", "template", "default", "arguments", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/declaration.py#L175-L187
train
gccxml/pygccxml
pygccxml/declarations/declaration.py
declaration_t.top_parent
def top_parent(self): """ Reference to top parent declaration. @type: declaration_t """ parent = self.parent while parent is not None: if parent.parent is None: return parent else: parent = parent.parent ...
python
def top_parent(self): """ Reference to top parent declaration. @type: declaration_t """ parent = self.parent while parent is not None: if parent.parent is None: return parent else: parent = parent.parent ...
[ "def", "top_parent", "(", "self", ")", ":", "parent", "=", "self", ".", "parent", "while", "parent", "is", "not", "None", ":", "if", "parent", ".", "parent", "is", "None", ":", "return", "parent", "else", ":", "parent", "=", "parent", ".", "parent", ...
Reference to top parent declaration. @type: declaration_t
[ "Reference", "to", "top", "parent", "declaration", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/declaration.py#L208-L221
train
gccxml/pygccxml
pygccxml/declarations/calldef.py
argument_t.clone
def clone(self, **keywd): """constructs new argument_t instance return argument_t( name=keywd.get('name', self.name), decl_type=keywd.get('decl_type', self.decl_type), default_value=keywd.get('default_value', self.default_value), attributes=keywd.get('att...
python
def clone(self, **keywd): """constructs new argument_t instance return argument_t( name=keywd.get('name', self.name), decl_type=keywd.get('decl_type', self.decl_type), default_value=keywd.get('default_value', self.default_value), attributes=keywd.get('att...
[ "def", "clone", "(", "self", ",", "**", "keywd", ")", ":", "return", "argument_t", "(", "name", "=", "keywd", ".", "get", "(", "'name'", ",", "self", ".", "name", ")", ",", "decl_type", "=", "keywd", ".", "get", "(", "'decl_type'", ",", "self", "."...
constructs new argument_t instance return argument_t( name=keywd.get('name', self.name), decl_type=keywd.get('decl_type', self.decl_type), default_value=keywd.get('default_value', self.default_value), attributes=keywd.get('attributes', self.attributes ))
[ "constructs", "new", "argument_t", "instance" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/calldef.py#L44-L58
train
gccxml/pygccxml
pygccxml/declarations/calldef.py
calldef_t.required_args
def required_args(self): """list of all required arguments""" r_args = [] for arg in self.arguments: if not arg.default_value: r_args.append(arg) else: break return r_args
python
def required_args(self): """list of all required arguments""" r_args = [] for arg in self.arguments: if not arg.default_value: r_args.append(arg) else: break return r_args
[ "def", "required_args", "(", "self", ")", ":", "r_args", "=", "[", "]", "for", "arg", "in", "self", ".", "arguments", ":", "if", "not", "arg", ".", "default_value", ":", "r_args", ".", "append", "(", "arg", ")", "else", ":", "break", "return", "r_arg...
list of all required arguments
[ "list", "of", "all", "required", "arguments" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/calldef.py#L224-L232
train
gccxml/pygccxml
pygccxml/declarations/calldef.py
calldef_t.overloads
def overloads(self): """A list of overloaded "callables" (i.e. other callables with the same name within the same scope. @type: list of :class:`calldef_t` """ if not self.parent: return [] # finding all functions with the same name return self.parent....
python
def overloads(self): """A list of overloaded "callables" (i.e. other callables with the same name within the same scope. @type: list of :class:`calldef_t` """ if not self.parent: return [] # finding all functions with the same name return self.parent....
[ "def", "overloads", "(", "self", ")", ":", "if", "not", "self", ".", "parent", ":", "return", "[", "]", "return", "self", ".", "parent", ".", "calldefs", "(", "name", "=", "self", ".", "name", ",", "function", "=", "lambda", "decl", ":", "decl", "i...
A list of overloaded "callables" (i.e. other callables with the same name within the same scope. @type: list of :class:`calldef_t`
[ "A", "list", "of", "overloaded", "callables", "(", "i", ".", "e", ".", "other", "callables", "with", "the", "same", "name", "within", "the", "same", "scope", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/calldef.py#L273-L286
train
gccxml/pygccxml
pygccxml/parser/declarations_cache.py
file_signature
def file_signature(filename): """ Return a signature for a file. """ if not os.path.isfile(filename): return None if not os.path.exists(filename): return None # Duplicate auto-generated files can be recognized with the sha1 hash. sig = hashlib.sha1() with open(filename...
python
def file_signature(filename): """ Return a signature for a file. """ if not os.path.isfile(filename): return None if not os.path.exists(filename): return None # Duplicate auto-generated files can be recognized with the sha1 hash. sig = hashlib.sha1() with open(filename...
[ "def", "file_signature", "(", "filename", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "return", "None", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "return", "None", "sig", "=", ...
Return a signature for a file.
[ "Return", "a", "signature", "for", "a", "file", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/declarations_cache.py#L17-L34
train
gccxml/pygccxml
pygccxml/parser/declarations_cache.py
file_cache_t.__load
def __load(file_name): """ Load pickled cache from file and return the object. """ if os.path.exists(file_name) and not os.path.isfile(file_name): raise RuntimeError( 'Cache should be initialized with valid full file name') if not os.path.exists(file_name): ...
python
def __load(file_name): """ Load pickled cache from file and return the object. """ if os.path.exists(file_name) and not os.path.isfile(file_name): raise RuntimeError( 'Cache should be initialized with valid full file name') if not os.path.exists(file_name): ...
[ "def", "__load", "(", "file_name", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "file_name", ")", "and", "not", "os", ".", "path", ".", "isfile", "(", "file_name", ")", ":", "raise", "RuntimeError", "(", "'Cache should be initialized with valid ful...
Load pickled cache from file and return the object.
[ "Load", "pickled", "cache", "from", "file", "and", "return", "the", "object", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/declarations_cache.py#L179-L212
train
gccxml/pygccxml
pygccxml/parser/declarations_cache.py
file_cache_t.update
def update(self, source_file, configuration, declarations, included_files): """ Update a cached record with the current key and value contents. """ record = record_t( source_signature=file_signature(source_file), config_signature=configuration_signature(configuration), ...
python
def update(self, source_file, configuration, declarations, included_files): """ Update a cached record with the current key and value contents. """ record = record_t( source_signature=file_signature(source_file), config_signature=configuration_signature(configuration), ...
[ "def", "update", "(", "self", ",", "source_file", ",", "configuration", ",", "declarations", ",", "included_files", ")", ":", "record", "=", "record_t", "(", "source_signature", "=", "file_signature", "(", "source_file", ")", ",", "config_signature", "=", "confi...
Update a cached record with the current key and value contents.
[ "Update", "a", "cached", "record", "with", "the", "current", "key", "and", "value", "contents", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/declarations_cache.py#L234-L250
train
gccxml/pygccxml
pygccxml/parser/declarations_cache.py
file_cache_t.cached_value
def cached_value(self, source_file, configuration): """ Attempt to lookup the cached declarations for the given file and configuration. Returns None if declaration not found or signature check fails. """ key = record_t.create_key(source_file, configuration) if ...
python
def cached_value(self, source_file, configuration): """ Attempt to lookup the cached declarations for the given file and configuration. Returns None if declaration not found or signature check fails. """ key = record_t.create_key(source_file, configuration) if ...
[ "def", "cached_value", "(", "self", ",", "source_file", ",", "configuration", ")", ":", "key", "=", "record_t", ".", "create_key", "(", "source_file", ",", "configuration", ")", "if", "key", "not", "in", "self", ".", "__cache", ":", "return", "None", "reco...
Attempt to lookup the cached declarations for the given file and configuration. Returns None if declaration not found or signature check fails.
[ "Attempt", "to", "lookup", "the", "cached", "declarations", "for", "the", "given", "file", "and", "configuration", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/declarations_cache.py#L252-L271
train
gccxml/pygccxml
release_utils/utils.py
find_version
def find_version(file_path): """ Find the version of pygccxml. Used by setup.py and the sphinx's conf.py. Inspired by https://packaging.python.org/single_source_version/ Args: file_path (str): path to the file containing the version. """ with io.open( os.path.join( ...
python
def find_version(file_path): """ Find the version of pygccxml. Used by setup.py and the sphinx's conf.py. Inspired by https://packaging.python.org/single_source_version/ Args: file_path (str): path to the file containing the version. """ with io.open( os.path.join( ...
[ "def", "find_version", "(", "file_path", ")", ":", "with", "io", ".", "open", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "os", ".", "path", ".", "normpath", "(", "file_path", ")", ")", ...
Find the version of pygccxml. Used by setup.py and the sphinx's conf.py. Inspired by https://packaging.python.org/single_source_version/ Args: file_path (str): path to the file containing the version.
[ "Find", "the", "version", "of", "pygccxml", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/release_utils/utils.py#L12-L34
train
gccxml/pygccxml
pygccxml/parser/scanner.py
scanner_t.__read_byte_size
def __read_byte_size(decl, attrs): """Using duck typing to set the size instead of in constructor""" size = attrs.get(XML_AN_SIZE, 0) # Make sure the size is in bytes instead of bits decl.byte_size = int(size) / 8
python
def __read_byte_size(decl, attrs): """Using duck typing to set the size instead of in constructor""" size = attrs.get(XML_AN_SIZE, 0) # Make sure the size is in bytes instead of bits decl.byte_size = int(size) / 8
[ "def", "__read_byte_size", "(", "decl", ",", "attrs", ")", ":", "size", "=", "attrs", ".", "get", "(", "XML_AN_SIZE", ",", "0", ")", "decl", ".", "byte_size", "=", "int", "(", "size", ")", "/", "8" ]
Using duck typing to set the size instead of in constructor
[ "Using", "duck", "typing", "to", "set", "the", "size", "instead", "of", "in", "constructor" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/scanner.py#L338-L342
train
gccxml/pygccxml
pygccxml/parser/scanner.py
scanner_t.__read_byte_offset
def __read_byte_offset(decl, attrs): """Using duck typing to set the offset instead of in constructor""" offset = attrs.get(XML_AN_OFFSET, 0) # Make sure the size is in bytes instead of bits decl.byte_offset = int(offset) / 8
python
def __read_byte_offset(decl, attrs): """Using duck typing to set the offset instead of in constructor""" offset = attrs.get(XML_AN_OFFSET, 0) # Make sure the size is in bytes instead of bits decl.byte_offset = int(offset) / 8
[ "def", "__read_byte_offset", "(", "decl", ",", "attrs", ")", ":", "offset", "=", "attrs", ".", "get", "(", "XML_AN_OFFSET", ",", "0", ")", "decl", ".", "byte_offset", "=", "int", "(", "offset", ")", "/", "8" ]
Using duck typing to set the offset instead of in constructor
[ "Using", "duck", "typing", "to", "set", "the", "offset", "instead", "of", "in", "constructor" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/scanner.py#L345-L349
train
gccxml/pygccxml
pygccxml/parser/scanner.py
scanner_t.__read_byte_align
def __read_byte_align(decl, attrs): """Using duck typing to set the alignment""" align = attrs.get(XML_AN_ALIGN, 0) # Make sure the size is in bytes instead of bits decl.byte_align = int(align) / 8
python
def __read_byte_align(decl, attrs): """Using duck typing to set the alignment""" align = attrs.get(XML_AN_ALIGN, 0) # Make sure the size is in bytes instead of bits decl.byte_align = int(align) / 8
[ "def", "__read_byte_align", "(", "decl", ",", "attrs", ")", ":", "align", "=", "attrs", ".", "get", "(", "XML_AN_ALIGN", ",", "0", ")", "decl", ".", "byte_align", "=", "int", "(", "align", ")", "/", "8" ]
Using duck typing to set the alignment
[ "Using", "duck", "typing", "to", "set", "the", "alignment" ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/scanner.py#L352-L356
train
gccxml/pygccxml
pygccxml/parser/declarations_joiner.py
bind_aliases
def bind_aliases(decls): """ This function binds between class and it's typedefs. :param decls: list of all declarations :rtype: None """ visited = set() typedefs = [ decl for decl in decls if isinstance(decl, declarations.typedef_t)] for decl in typedefs: type_ = dec...
python
def bind_aliases(decls): """ This function binds between class and it's typedefs. :param decls: list of all declarations :rtype: None """ visited = set() typedefs = [ decl for decl in decls if isinstance(decl, declarations.typedef_t)] for decl in typedefs: type_ = dec...
[ "def", "bind_aliases", "(", "decls", ")", ":", "visited", "=", "set", "(", ")", "typedefs", "=", "[", "decl", "for", "decl", "in", "decls", "if", "isinstance", "(", "decl", ",", "declarations", ".", "typedef_t", ")", "]", "for", "decl", "in", "typedefs...
This function binds between class and it's typedefs. :param decls: list of all declarations :rtype: None
[ "This", "function", "binds", "between", "class", "and", "it", "s", "typedefs", "." ]
2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/declarations_joiner.py#L9-L32
train
d11wtq/dockerpty
features/environment.py
after_scenario
def after_scenario(ctx, scenario): """ Cleans up docker containers used as test fixtures after test completes. """ if hasattr(ctx, 'container') and hasattr(ctx, 'client'): try: ctx.client.remove_container(ctx.container, force=True) except: pass
python
def after_scenario(ctx, scenario): """ Cleans up docker containers used as test fixtures after test completes. """ if hasattr(ctx, 'container') and hasattr(ctx, 'client'): try: ctx.client.remove_container(ctx.container, force=True) except: pass
[ "def", "after_scenario", "(", "ctx", ",", "scenario", ")", ":", "if", "hasattr", "(", "ctx", ",", "'container'", ")", "and", "hasattr", "(", "ctx", ",", "'client'", ")", ":", "try", ":", "ctx", ".", "client", ".", "remove_container", "(", "ctx", ".", ...
Cleans up docker containers used as test fixtures after test completes.
[ "Cleans", "up", "docker", "containers", "used", "as", "test", "fixtures", "after", "test", "completes", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/features/environment.py#L37-L46
train
d11wtq/dockerpty
dockerpty/io.py
set_blocking
def set_blocking(fd, blocking=True): """ Set the given file-descriptor blocking or non-blocking. Returns the original blocking status. """ old_flag = fcntl.fcntl(fd, fcntl.F_GETFL) if blocking: new_flag = old_flag & ~ os.O_NONBLOCK else: new_flag = old_flag | os.O_NONBLOCK...
python
def set_blocking(fd, blocking=True): """ Set the given file-descriptor blocking or non-blocking. Returns the original blocking status. """ old_flag = fcntl.fcntl(fd, fcntl.F_GETFL) if blocking: new_flag = old_flag & ~ os.O_NONBLOCK else: new_flag = old_flag | os.O_NONBLOCK...
[ "def", "set_blocking", "(", "fd", ",", "blocking", "=", "True", ")", ":", "old_flag", "=", "fcntl", ".", "fcntl", "(", "fd", ",", "fcntl", ".", "F_GETFL", ")", "if", "blocking", ":", "new_flag", "=", "old_flag", "&", "~", "os", ".", "O_NONBLOCK", "el...
Set the given file-descriptor blocking or non-blocking. Returns the original blocking status.
[ "Set", "the", "given", "file", "-", "descriptor", "blocking", "or", "non", "-", "blocking", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/io.py#L25-L41
train
d11wtq/dockerpty
dockerpty/io.py
select
def select(read_streams, write_streams, timeout=0): """ Select the streams from `read_streams` that are ready for reading, and streams from `write_streams` ready for writing. Uses `select.select()` internally but only returns two lists of ready streams. """ exception_streams = [] try: ...
python
def select(read_streams, write_streams, timeout=0): """ Select the streams from `read_streams` that are ready for reading, and streams from `write_streams` ready for writing. Uses `select.select()` internally but only returns two lists of ready streams. """ exception_streams = [] try: ...
[ "def", "select", "(", "read_streams", ",", "write_streams", ",", "timeout", "=", "0", ")", ":", "exception_streams", "=", "[", "]", "try", ":", "return", "builtin_select", ".", "select", "(", "read_streams", ",", "write_streams", ",", "exception_streams", ",",...
Select the streams from `read_streams` that are ready for reading, and streams from `write_streams` ready for writing. Uses `select.select()` internally but only returns two lists of ready streams.
[ "Select", "the", "streams", "from", "read_streams", "that", "are", "ready", "for", "reading", "and", "streams", "from", "write_streams", "ready", "for", "writing", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/io.py#L44-L67
train
d11wtq/dockerpty
dockerpty/io.py
Stream.read
def read(self, n=4096): """ Return `n` bytes of data from the Stream, or None at end of stream. """ while True: try: if hasattr(self.fd, 'recv'): return self.fd.recv(n) return os.read(self.fd.fileno(), n) except...
python
def read(self, n=4096): """ Return `n` bytes of data from the Stream, or None at end of stream. """ while True: try: if hasattr(self.fd, 'recv'): return self.fd.recv(n) return os.read(self.fd.fileno(), n) except...
[ "def", "read", "(", "self", ",", "n", "=", "4096", ")", ":", "while", "True", ":", "try", ":", "if", "hasattr", "(", "self", ".", "fd", ",", "'recv'", ")", ":", "return", "self", ".", "fd", ".", "recv", "(", "n", ")", "return", "os", ".", "re...
Return `n` bytes of data from the Stream, or None at end of stream.
[ "Return", "n", "bytes", "of", "data", "from", "the", "Stream", "or", "None", "at", "end", "of", "stream", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/io.py#L112-L124
train
d11wtq/dockerpty
dockerpty/io.py
Stream.do_write
def do_write(self): """ Flushes as much pending data from the internal write buffer as possible. """ while True: try: written = 0 if hasattr(self.fd, 'send'): written = self.fd.send(self.buffer) else: ...
python
def do_write(self): """ Flushes as much pending data from the internal write buffer as possible. """ while True: try: written = 0 if hasattr(self.fd, 'send'): written = self.fd.send(self.buffer) else: ...
[ "def", "do_write", "(", "self", ")", ":", "while", "True", ":", "try", ":", "written", "=", "0", "if", "hasattr", "(", "self", ".", "fd", ",", "'send'", ")", ":", "written", "=", "self", ".", "fd", ".", "send", "(", "self", ".", "buffer", ")", ...
Flushes as much pending data from the internal write buffer as possible.
[ "Flushes", "as", "much", "pending", "data", "from", "the", "internal", "write", "buffer", "as", "possible", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/io.py#L142-L164
train
d11wtq/dockerpty
dockerpty/io.py
Demuxer.read
def read(self, n=4096): """ Read up to `n` bytes of data from the Stream, after demuxing. Less than `n` bytes of data may be returned depending on the available payload, but the number of bytes returned will never exceed `n`. Because demuxing involves scanning 8-byte headers, t...
python
def read(self, n=4096): """ Read up to `n` bytes of data from the Stream, after demuxing. Less than `n` bytes of data may be returned depending on the available payload, but the number of bytes returned will never exceed `n`. Because demuxing involves scanning 8-byte headers, t...
[ "def", "read", "(", "self", ",", "n", "=", "4096", ")", ":", "size", "=", "self", ".", "_next_packet_size", "(", "n", ")", "if", "size", "<=", "0", ":", "return", "else", ":", "data", "=", "six", ".", "binary_type", "(", ")", "while", "len", "(",...
Read up to `n` bytes of data from the Stream, after demuxing. Less than `n` bytes of data may be returned depending on the available payload, but the number of bytes returned will never exceed `n`. Because demuxing involves scanning 8-byte headers, the actual amount of data read from t...
[ "Read", "up", "to", "n", "bytes", "of", "data", "from", "the", "Stream", "after", "demuxing", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/io.py#L224-L247
train
d11wtq/dockerpty
dockerpty/io.py
Pump.flush
def flush(self, n=4096): """ Flush `n` bytes of data from the reader Stream to the writer Stream. Returns the number of bytes that were actually flushed. A return value of zero is not an error. If EOF has been reached, `None` is returned. """ try: r...
python
def flush(self, n=4096): """ Flush `n` bytes of data from the reader Stream to the writer Stream. Returns the number of bytes that were actually flushed. A return value of zero is not an error. If EOF has been reached, `None` is returned. """ try: r...
[ "def", "flush", "(", "self", ",", "n", "=", "4096", ")", ":", "try", ":", "read", "=", "self", ".", "from_stream", ".", "read", "(", "n", ")", "if", "read", "is", "None", "or", "len", "(", "read", ")", "==", "0", ":", "self", ".", "eof", "=",...
Flush `n` bytes of data from the reader Stream to the writer Stream. Returns the number of bytes that were actually flushed. A return value of zero is not an error. If EOF has been reached, `None` is returned.
[ "Flush", "n", "bytes", "of", "data", "from", "the", "reader", "Stream", "to", "the", "writer", "Stream", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/io.py#L356-L378
train
d11wtq/dockerpty
dockerpty/__init__.py
exec_command
def exec_command( client, container, command, interactive=True, stdout=None, stderr=None, stdin=None): """ Run provided command via exec API in provided container. This is just a wrapper for PseudoTerminal(client, container).exec_command() """ exec_id = exec_create(client, container, comman...
python
def exec_command( client, container, command, interactive=True, stdout=None, stderr=None, stdin=None): """ Run provided command via exec API in provided container. This is just a wrapper for PseudoTerminal(client, container).exec_command() """ exec_id = exec_create(client, container, comman...
[ "def", "exec_command", "(", "client", ",", "container", ",", "command", ",", "interactive", "=", "True", ",", "stdout", "=", "None", ",", "stderr", "=", "None", ",", "stdin", "=", "None", ")", ":", "exec_id", "=", "exec_create", "(", "client", ",", "co...
Run provided command via exec API in provided container. This is just a wrapper for PseudoTerminal(client, container).exec_command()
[ "Run", "provided", "command", "via", "exec", "API", "in", "provided", "container", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/__init__.py#L33-L44
train
d11wtq/dockerpty
dockerpty/tty.py
Terminal.start
def start(self): """ Saves the current terminal attributes and makes the tty raw. This method returns None immediately. """ if os.isatty(self.fd.fileno()) and self.israw(): self.original_attributes = termios.tcgetattr(self.fd) tty.setraw(self.fd)
python
def start(self): """ Saves the current terminal attributes and makes the tty raw. This method returns None immediately. """ if os.isatty(self.fd.fileno()) and self.israw(): self.original_attributes = termios.tcgetattr(self.fd) tty.setraw(self.fd)
[ "def", "start", "(", "self", ")", ":", "if", "os", ".", "isatty", "(", "self", ".", "fd", ".", "fileno", "(", ")", ")", "and", "self", ".", "israw", "(", ")", ":", "self", ".", "original_attributes", "=", "termios", ".", "tcgetattr", "(", "self", ...
Saves the current terminal attributes and makes the tty raw. This method returns None immediately.
[ "Saves", "the", "current", "terminal", "attributes", "and", "makes", "the", "tty", "raw", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/tty.py#L100-L109
train
d11wtq/dockerpty
dockerpty/tty.py
Terminal.stop
def stop(self): """ Restores the terminal attributes back to before setting raw mode. If the raw terminal was not started, does nothing. """ if self.original_attributes is not None: termios.tcsetattr( self.fd, termios.TCSADRAIN, ...
python
def stop(self): """ Restores the terminal attributes back to before setting raw mode. If the raw terminal was not started, does nothing. """ if self.original_attributes is not None: termios.tcsetattr( self.fd, termios.TCSADRAIN, ...
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "original_attributes", "is", "not", "None", ":", "termios", ".", "tcsetattr", "(", "self", ".", "fd", ",", "termios", ".", "TCSADRAIN", ",", "self", ".", "original_attributes", ",", ")" ]
Restores the terminal attributes back to before setting raw mode. If the raw terminal was not started, does nothing.
[ "Restores", "the", "terminal", "attributes", "back", "to", "before", "setting", "raw", "mode", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/tty.py#L112-L124
train
d11wtq/dockerpty
dockerpty/pty.py
WINCHHandler.start
def start(self): """ Start trapping WINCH signals and resizing the PTY. This method saves the previous WINCH handler so it can be restored on `stop()`. """ def handle(signum, frame): if signum == signal.SIGWINCH: self.pty.resize() se...
python
def start(self): """ Start trapping WINCH signals and resizing the PTY. This method saves the previous WINCH handler so it can be restored on `stop()`. """ def handle(signum, frame): if signum == signal.SIGWINCH: self.pty.resize() se...
[ "def", "start", "(", "self", ")", ":", "def", "handle", "(", "signum", ",", "frame", ")", ":", "if", "signum", "==", "signal", ".", "SIGWINCH", ":", "self", ".", "pty", ".", "resize", "(", ")", "self", ".", "original_handler", "=", "signal", ".", "...
Start trapping WINCH signals and resizing the PTY. This method saves the previous WINCH handler so it can be restored on `stop()`.
[ "Start", "trapping", "WINCH", "signals", "and", "resizing", "the", "PTY", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/pty.py#L57-L69
train
d11wtq/dockerpty
dockerpty/pty.py
WINCHHandler.stop
def stop(self): """ Stop trapping WINCH signals and restore the previous WINCH handler. """ if self.original_handler is not None: signal.signal(signal.SIGWINCH, self.original_handler)
python
def stop(self): """ Stop trapping WINCH signals and restore the previous WINCH handler. """ if self.original_handler is not None: signal.signal(signal.SIGWINCH, self.original_handler)
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "original_handler", "is", "not", "None", ":", "signal", ".", "signal", "(", "signal", ".", "SIGWINCH", ",", "self", ".", "original_handler", ")" ]
Stop trapping WINCH signals and restore the previous WINCH handler.
[ "Stop", "trapping", "WINCH", "signals", "and", "restore", "the", "previous", "WINCH", "handler", "." ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/pty.py#L71-L77
train
d11wtq/dockerpty
dockerpty/pty.py
RunOperation.resize
def resize(self, height, width, **kwargs): """ resize pty within container """ self.client.resize(self.container, height=height, width=width)
python
def resize(self, height, width, **kwargs): """ resize pty within container """ self.client.resize(self.container, height=height, width=width)
[ "def", "resize", "(", "self", ",", "height", ",", "width", ",", "**", "kwargs", ")", ":", "self", ".", "client", ".", "resize", "(", "self", ".", "container", ",", "height", "=", "height", ",", "width", "=", "width", ")" ]
resize pty within container
[ "resize", "pty", "within", "container" ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/pty.py#L193-L197
train
d11wtq/dockerpty
dockerpty/pty.py
ExecOperation.resize
def resize(self, height, width, **kwargs): """ resize pty of an execed process """ self.client.exec_resize(self.exec_id, height=height, width=width)
python
def resize(self, height, width, **kwargs): """ resize pty of an execed process """ self.client.exec_resize(self.exec_id, height=height, width=width)
[ "def", "resize", "(", "self", ",", "height", ",", "width", ",", "**", "kwargs", ")", ":", "self", ".", "client", ".", "exec_resize", "(", "self", ".", "exec_id", ",", "height", "=", "height", ",", "width", "=", "width", ")" ]
resize pty of an execed process
[ "resize", "pty", "of", "an", "execed", "process" ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/pty.py#L267-L271
train
d11wtq/dockerpty
dockerpty/pty.py
ExecOperation._exec_info
def _exec_info(self): """ Caching wrapper around client.exec_inspect """ if self._info is None: self._info = self.client.exec_inspect(self.exec_id) return self._info
python
def _exec_info(self): """ Caching wrapper around client.exec_inspect """ if self._info is None: self._info = self.client.exec_inspect(self.exec_id) return self._info
[ "def", "_exec_info", "(", "self", ")", ":", "if", "self", ".", "_info", "is", "None", ":", "self", ".", "_info", "=", "self", ".", "client", ".", "exec_inspect", "(", "self", ".", "exec_id", ")", "return", "self", ".", "_info" ]
Caching wrapper around client.exec_inspect
[ "Caching", "wrapper", "around", "client", ".", "exec_inspect" ]
f8d17d893c6758b7cc25825e99f6b02202632a97
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/pty.py#L279-L285
train
mhe/pynrrd
nrrd/formatters.py
format_number
def format_number(x): """Format number to string Function converts a number to string. For numbers of class :class:`float`, up to 17 digits will be used to print the entire floating point number. Any padding zeros will be removed at the end of the number. See :ref:`user-guide:int` and :ref:`user-guide...
python
def format_number(x): """Format number to string Function converts a number to string. For numbers of class :class:`float`, up to 17 digits will be used to print the entire floating point number. Any padding zeros will be removed at the end of the number. See :ref:`user-guide:int` and :ref:`user-guide...
[ "def", "format_number", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "float", ")", ":", "value", "=", "'{:.17g}'", ".", "format", "(", "x", ")", "else", ":", "value", "=", "str", "(", "x", ")", "return", "value" ]
Format number to string Function converts a number to string. For numbers of class :class:`float`, up to 17 digits will be used to print the entire floating point number. Any padding zeros will be removed at the end of the number. See :ref:`user-guide:int` and :ref:`user-guide:double` for more information...
[ "Format", "number", "to", "string" ]
96dd875b302031ea27e2d3aaa611dc6f2dfc7979
https://github.com/mhe/pynrrd/blob/96dd875b302031ea27e2d3aaa611dc6f2dfc7979/nrrd/formatters.py#L4-L38
train
mhe/pynrrd
nrrd/parsers.py
parse_number_auto_dtype
def parse_number_auto_dtype(x): """Parse number from string with automatic type detection. Parses input string and converts to a number using automatic type detection. If the number contains any fractional parts, then the number will be converted to float, otherwise the number will be converted to an int. ...
python
def parse_number_auto_dtype(x): """Parse number from string with automatic type detection. Parses input string and converts to a number using automatic type detection. If the number contains any fractional parts, then the number will be converted to float, otherwise the number will be converted to an int. ...
[ "def", "parse_number_auto_dtype", "(", "x", ")", ":", "value", "=", "float", "(", "x", ")", "if", "value", ".", "is_integer", "(", ")", ":", "value", "=", "int", "(", "value", ")", "return", "value" ]
Parse number from string with automatic type detection. Parses input string and converts to a number using automatic type detection. If the number contains any fractional parts, then the number will be converted to float, otherwise the number will be converted to an int. See :ref:`user-guide:int` and :ref...
[ "Parse", "number", "from", "string", "with", "automatic", "type", "detection", "." ]
96dd875b302031ea27e2d3aaa611dc6f2dfc7979
https://github.com/mhe/pynrrd/blob/96dd875b302031ea27e2d3aaa611dc6f2dfc7979/nrrd/parsers.py#L207-L231
train
mhe/pynrrd
nrrd/reader.py
_determine_datatype
def _determine_datatype(fields): """Determine the numpy dtype of the data.""" # Convert the NRRD type string identifier into a NumPy string identifier using a map np_typestring = _TYPEMAP_NRRD2NUMPY[fields['type']] # This is only added if the datatype has more than one byte and is not using ASCII enco...
python
def _determine_datatype(fields): """Determine the numpy dtype of the data.""" # Convert the NRRD type string identifier into a NumPy string identifier using a map np_typestring = _TYPEMAP_NRRD2NUMPY[fields['type']] # This is only added if the datatype has more than one byte and is not using ASCII enco...
[ "def", "_determine_datatype", "(", "fields", ")", ":", "np_typestring", "=", "_TYPEMAP_NRRD2NUMPY", "[", "fields", "[", "'type'", "]", "]", "if", "np", ".", "dtype", "(", "np_typestring", ")", ".", "itemsize", ">", "1", "and", "fields", "[", "'encoding'", ...
Determine the numpy dtype of the data.
[ "Determine", "the", "numpy", "dtype", "of", "the", "data", "." ]
96dd875b302031ea27e2d3aaa611dc6f2dfc7979
https://github.com/mhe/pynrrd/blob/96dd875b302031ea27e2d3aaa611dc6f2dfc7979/nrrd/reader.py#L145-L163
train
mhe/pynrrd
nrrd/reader.py
_validate_magic_line
def _validate_magic_line(line): """For NRRD files, the first four characters are always "NRRD", and remaining characters give information about the file format version >>> _validate_magic_line('NRRD0005') 8 >>> _validate_magic_line('NRRD0006') Traceback (most recent call last): ... ...
python
def _validate_magic_line(line): """For NRRD files, the first four characters are always "NRRD", and remaining characters give information about the file format version >>> _validate_magic_line('NRRD0005') 8 >>> _validate_magic_line('NRRD0006') Traceback (most recent call last): ... ...
[ "def", "_validate_magic_line", "(", "line", ")", ":", "if", "not", "line", ".", "startswith", "(", "'NRRD'", ")", ":", "raise", "NRRDError", "(", "'Invalid NRRD magic line. Is this an NRRD file?'", ")", "try", ":", "version", "=", "int", "(", "line", "[", "4",...
For NRRD files, the first four characters are always "NRRD", and remaining characters give information about the file format version >>> _validate_magic_line('NRRD0005') 8 >>> _validate_magic_line('NRRD0006') Traceback (most recent call last): ... NrrdError: NRRD file version too new fo...
[ "For", "NRRD", "files", "the", "first", "four", "characters", "are", "always", "NRRD", "and", "remaining", "characters", "give", "information", "about", "the", "file", "format", "version" ]
96dd875b302031ea27e2d3aaa611dc6f2dfc7979
https://github.com/mhe/pynrrd/blob/96dd875b302031ea27e2d3aaa611dc6f2dfc7979/nrrd/reader.py#L166-L193
train
mhe/pynrrd
nrrd/reader.py
read
def read(filename, custom_field_map=None, index_order='F'): """Read a NRRD file and return the header and data See :ref:`user-guide:Reading NRRD files` for more information on reading NRRD files. .. note:: Users should be aware that the `index_order` argument needs to be consistent between `nr...
python
def read(filename, custom_field_map=None, index_order='F'): """Read a NRRD file and return the header and data See :ref:`user-guide:Reading NRRD files` for more information on reading NRRD files. .. note:: Users should be aware that the `index_order` argument needs to be consistent between `nr...
[ "def", "read", "(", "filename", ",", "custom_field_map", "=", "None", ",", "index_order", "=", "'F'", ")", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "fh", ":", "header", "=", "read_header", "(", "fh", ",", "custom_field_map", ")", "...
Read a NRRD file and return the header and data See :ref:`user-guide:Reading NRRD files` for more information on reading NRRD files. .. note:: Users should be aware that the `index_order` argument needs to be consistent between `nrrd.read` and `nrrd.write`. I.e., reading an array with `index_order...
[ "Read", "a", "NRRD", "file", "and", "return", "the", "header", "and", "data" ]
96dd875b302031ea27e2d3aaa611dc6f2dfc7979
https://github.com/mhe/pynrrd/blob/96dd875b302031ea27e2d3aaa611dc6f2dfc7979/nrrd/reader.py#L469-L506
train
bspaans/python-mingus
mingus/containers/track.py
Track.add_notes
def add_notes(self, note, duration=None): """Add a Note, note as string or NoteContainer to the last Bar. If the Bar is full, a new one will automatically be created. If the Bar is not full but the note can't fit in, this method will return False. True otherwise. An Instrument...
python
def add_notes(self, note, duration=None): """Add a Note, note as string or NoteContainer to the last Bar. If the Bar is full, a new one will automatically be created. If the Bar is not full but the note can't fit in, this method will return False. True otherwise. An Instrument...
[ "def", "add_notes", "(", "self", ",", "note", ",", "duration", "=", "None", ")", ":", "if", "self", ".", "instrument", "!=", "None", ":", "if", "not", "self", ".", "instrument", ".", "can_play_notes", "(", "note", ")", ":", "raise", "InstrumentRangeError...
Add a Note, note as string or NoteContainer to the last Bar. If the Bar is full, a new one will automatically be created. If the Bar is not full but the note can't fit in, this method will return False. True otherwise. An InstrumentRangeError exception will be raised if an Instrument ...
[ "Add", "a", "Note", "note", "as", "string", "or", "NoteContainer", "to", "the", "last", "Bar", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/track.py#L51-L80
train
bspaans/python-mingus
mingus/containers/track.py
Track.get_notes
def get_notes(self): """Return an iterator that iterates through every bar in the this track.""" for bar in self.bars: for beat, duration, notes in bar: yield beat, duration, notes
python
def get_notes(self): """Return an iterator that iterates through every bar in the this track.""" for bar in self.bars: for beat, duration, notes in bar: yield beat, duration, notes
[ "def", "get_notes", "(", "self", ")", ":", "for", "bar", "in", "self", ".", "bars", ":", "for", "beat", ",", "duration", ",", "notes", "in", "bar", ":", "yield", "beat", ",", "duration", ",", "notes" ]
Return an iterator that iterates through every bar in the this track.
[ "Return", "an", "iterator", "that", "iterates", "through", "every", "bar", "in", "the", "this", "track", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/track.py#L82-L87
train
bspaans/python-mingus
mingus/containers/track.py
Track.from_chords
def from_chords(self, chords, duration=1): """Add chords to the Track. The given chords should be a list of shorthand strings or list of list of shorthand strings, etc. Each sublist divides the value by 2. If a tuning is set, chords will be expanded so they have a proper ...
python
def from_chords(self, chords, duration=1): """Add chords to the Track. The given chords should be a list of shorthand strings or list of list of shorthand strings, etc. Each sublist divides the value by 2. If a tuning is set, chords will be expanded so they have a proper ...
[ "def", "from_chords", "(", "self", ",", "chords", ",", "duration", "=", "1", ")", ":", "tun", "=", "self", ".", "get_tuning", "(", ")", "def", "add_chord", "(", "chord", ",", "duration", ")", ":", "if", "type", "(", "chord", ")", "==", "list", ":",...
Add chords to the Track. The given chords should be a list of shorthand strings or list of list of shorthand strings, etc. Each sublist divides the value by 2. If a tuning is set, chords will be expanded so they have a proper fingering. Example: >>> t = Track(...
[ "Add", "chords", "to", "the", "Track", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/track.py#L89-L127
train
bspaans/python-mingus
mingus/containers/track.py
Track.get_tuning
def get_tuning(self): """Return a StringTuning object. If an instrument is set and has a tuning it will be returned. Otherwise the track's one will be used. """ if self.instrument and self.instrument.tuning: return self.instrument.tuning return self.tuning
python
def get_tuning(self): """Return a StringTuning object. If an instrument is set and has a tuning it will be returned. Otherwise the track's one will be used. """ if self.instrument and self.instrument.tuning: return self.instrument.tuning return self.tuning
[ "def", "get_tuning", "(", "self", ")", ":", "if", "self", ".", "instrument", "and", "self", ".", "instrument", ".", "tuning", ":", "return", "self", ".", "instrument", ".", "tuning", "return", "self", ".", "tuning" ]
Return a StringTuning object. If an instrument is set and has a tuning it will be returned. Otherwise the track's one will be used.
[ "Return", "a", "StringTuning", "object", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/track.py#L129-L137
train
bspaans/python-mingus
mingus/containers/track.py
Track.transpose
def transpose(self, interval, up=True): """Transpose all the notes in the track up or down the interval. Call transpose() on every Bar. """ for bar in self.bars: bar.transpose(interval, up) return self
python
def transpose(self, interval, up=True): """Transpose all the notes in the track up or down the interval. Call transpose() on every Bar. """ for bar in self.bars: bar.transpose(interval, up) return self
[ "def", "transpose", "(", "self", ",", "interval", ",", "up", "=", "True", ")", ":", "for", "bar", "in", "self", ".", "bars", ":", "bar", ".", "transpose", "(", "interval", ",", "up", ")", "return", "self" ]
Transpose all the notes in the track up or down the interval. Call transpose() on every Bar.
[ "Transpose", "all", "the", "notes", "in", "the", "track", "up", "or", "down", "the", "interval", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/track.py#L150-L157
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.set_meter
def set_meter(self, meter): """Set the meter of this bar. Meters in mingus are represented by a single tuple. If the format of the meter is not recognised, a MeterFormatError will be raised. """ # warning should raise exception if _meter.valid_beat_duration(mete...
python
def set_meter(self, meter): """Set the meter of this bar. Meters in mingus are represented by a single tuple. If the format of the meter is not recognised, a MeterFormatError will be raised. """ # warning should raise exception if _meter.valid_beat_duration(mete...
[ "def", "set_meter", "(", "self", ",", "meter", ")", ":", "if", "_meter", ".", "valid_beat_duration", "(", "meter", "[", "1", "]", ")", ":", "self", ".", "meter", "=", "(", "meter", "[", "0", "]", ",", "meter", "[", "1", "]", ")", "self", ".", "...
Set the meter of this bar. Meters in mingus are represented by a single tuple. If the format of the meter is not recognised, a MeterFormatError will be raised.
[ "Set", "the", "meter", "of", "this", "bar", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L54-L72
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.place_notes
def place_notes(self, notes, duration): """Place the notes on the current_beat. Notes can be strings, Notes, list of strings, list of Notes or a NoteContainer. Raise a MeterFormatError if the duration is not valid. Return True if succesful, False otherwise (ie. the Bar hasn't ...
python
def place_notes(self, notes, duration): """Place the notes on the current_beat. Notes can be strings, Notes, list of strings, list of Notes or a NoteContainer. Raise a MeterFormatError if the duration is not valid. Return True if succesful, False otherwise (ie. the Bar hasn't ...
[ "def", "place_notes", "(", "self", ",", "notes", ",", "duration", ")", ":", "if", "hasattr", "(", "notes", ",", "'notes'", ")", ":", "pass", "elif", "hasattr", "(", "notes", ",", "'name'", ")", ":", "notes", "=", "NoteContainer", "(", "notes", ")", "...
Place the notes on the current_beat. Notes can be strings, Notes, list of strings, list of Notes or a NoteContainer. Raise a MeterFormatError if the duration is not valid. Return True if succesful, False otherwise (ie. the Bar hasn't got enough room for a note of that duration...
[ "Place", "the", "notes", "on", "the", "current_beat", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L74-L101
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.place_notes_at
def place_notes_at(self, notes, at): """Place notes at the given index.""" for x in self.bar: if x[0] == at: x[0][2] += notes
python
def place_notes_at(self, notes, at): """Place notes at the given index.""" for x in self.bar: if x[0] == at: x[0][2] += notes
[ "def", "place_notes_at", "(", "self", ",", "notes", ",", "at", ")", ":", "for", "x", "in", "self", ".", "bar", ":", "if", "x", "[", "0", "]", "==", "at", ":", "x", "[", "0", "]", "[", "2", "]", "+=", "notes" ]
Place notes at the given index.
[ "Place", "notes", "at", "the", "given", "index", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L103-L107
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.remove_last_entry
def remove_last_entry(self): """Remove the last NoteContainer in the Bar.""" self.current_beat -= 1.0 / self.bar[-1][1] self.bar = self.bar[:-1] return self.current_beat
python
def remove_last_entry(self): """Remove the last NoteContainer in the Bar.""" self.current_beat -= 1.0 / self.bar[-1][1] self.bar = self.bar[:-1] return self.current_beat
[ "def", "remove_last_entry", "(", "self", ")", ":", "self", ".", "current_beat", "-=", "1.0", "/", "self", ".", "bar", "[", "-", "1", "]", "[", "1", "]", "self", ".", "bar", "=", "self", ".", "bar", "[", ":", "-", "1", "]", "return", "self", "."...
Remove the last NoteContainer in the Bar.
[ "Remove", "the", "last", "NoteContainer", "in", "the", "Bar", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L116-L120
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.is_full
def is_full(self): """Return False if there is room in this Bar for another NoteContainer, True otherwise.""" if self.length == 0.0: return False if len(self.bar) == 0: return False if self.current_beat >= self.length - 0.001: return True ...
python
def is_full(self): """Return False if there is room in this Bar for another NoteContainer, True otherwise.""" if self.length == 0.0: return False if len(self.bar) == 0: return False if self.current_beat >= self.length - 0.001: return True ...
[ "def", "is_full", "(", "self", ")", ":", "if", "self", ".", "length", "==", "0.0", ":", "return", "False", "if", "len", "(", "self", ".", "bar", ")", "==", "0", ":", "return", "False", "if", "self", ".", "current_beat", ">=", "self", ".", "length",...
Return False if there is room in this Bar for another NoteContainer, True otherwise.
[ "Return", "False", "if", "there", "is", "room", "in", "this", "Bar", "for", "another", "NoteContainer", "True", "otherwise", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L122-L131
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.change_note_duration
def change_note_duration(self, at, to): """Change the note duration at the given index to the given duration.""" if valid_beat_duration(to): diff = 0 for x in self.bar: if diff != 0: x[0][0] -= diff if x[0] == at: ...
python
def change_note_duration(self, at, to): """Change the note duration at the given index to the given duration.""" if valid_beat_duration(to): diff = 0 for x in self.bar: if diff != 0: x[0][0] -= diff if x[0] == at: ...
[ "def", "change_note_duration", "(", "self", ",", "at", ",", "to", ")", ":", "if", "valid_beat_duration", "(", "to", ")", ":", "diff", "=", "0", "for", "x", "in", "self", ".", "bar", ":", "if", "diff", "!=", "0", ":", "x", "[", "0", "]", "[", "0...
Change the note duration at the given index to the given duration.
[ "Change", "the", "note", "duration", "at", "the", "given", "index", "to", "the", "given", "duration", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L133-L144
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.get_range
def get_range(self): """Return the highest and the lowest note in a tuple.""" (min, max) = (100000, -1) for cont in self.bar: for note in cont[2]: if int(note) < int(min): min = note elif int(note) > int(max): ma...
python
def get_range(self): """Return the highest and the lowest note in a tuple.""" (min, max) = (100000, -1) for cont in self.bar: for note in cont[2]: if int(note) < int(min): min = note elif int(note) > int(max): ma...
[ "def", "get_range", "(", "self", ")", ":", "(", "min", ",", "max", ")", "=", "(", "100000", ",", "-", "1", ")", "for", "cont", "in", "self", ".", "bar", ":", "for", "note", "in", "cont", "[", "2", "]", ":", "if", "int", "(", "note", ")", "<...
Return the highest and the lowest note in a tuple.
[ "Return", "the", "highest", "and", "the", "lowest", "note", "in", "a", "tuple", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L146-L155
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.transpose
def transpose(self, interval, up=True): """Transpose the notes in the bar up or down the interval. Call transpose() on all NoteContainers in the bar. """ for cont in self.bar: cont[2].transpose(interval, up)
python
def transpose(self, interval, up=True): """Transpose the notes in the bar up or down the interval. Call transpose() on all NoteContainers in the bar. """ for cont in self.bar: cont[2].transpose(interval, up)
[ "def", "transpose", "(", "self", ",", "interval", ",", "up", "=", "True", ")", ":", "for", "cont", "in", "self", ".", "bar", ":", "cont", "[", "2", "]", ".", "transpose", "(", "interval", ",", "up", ")" ]
Transpose the notes in the bar up or down the interval. Call transpose() on all NoteContainers in the bar.
[ "Transpose", "the", "notes", "in", "the", "bar", "up", "or", "down", "the", "interval", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L175-L181
train
bspaans/python-mingus
mingus/containers/bar.py
Bar.get_note_names
def get_note_names(self): """Return a list of unique note names in the Bar.""" res = [] for cont in self.bar: for x in cont[2].get_note_names(): if x not in res: res.append(x) return res
python
def get_note_names(self): """Return a list of unique note names in the Bar.""" res = [] for cont in self.bar: for x in cont[2].get_note_names(): if x not in res: res.append(x) return res
[ "def", "get_note_names", "(", "self", ")", ":", "res", "=", "[", "]", "for", "cont", "in", "self", ".", "bar", ":", "for", "x", "in", "cont", "[", "2", "]", ".", "get_note_names", "(", ")", ":", "if", "x", "not", "in", "res", ":", "res", ".", ...
Return a list of unique note names in the Bar.
[ "Return", "a", "list", "of", "unique", "note", "names", "in", "the", "Bar", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/bar.py#L198-L205
train
bspaans/python-mingus
mingus/midi/midi_file_in.py
MidiFile.parse_midi_file_header
def parse_midi_file_header(self, fp): """Read the header of a MIDI file and return a tuple containing the format type, number of tracks and parsed time division information.""" # Check header try: if fp.read(4) != 'MThd': raise HeaderError('Not a valid MIDI fi...
python
def parse_midi_file_header(self, fp): """Read the header of a MIDI file and return a tuple containing the format type, number of tracks and parsed time division information.""" # Check header try: if fp.read(4) != 'MThd': raise HeaderError('Not a valid MIDI fi...
[ "def", "parse_midi_file_header", "(", "self", ",", "fp", ")", ":", "try", ":", "if", "fp", ".", "read", "(", "4", ")", "!=", "'MThd'", ":", "raise", "HeaderError", "(", "'Not a valid MIDI file header. Byte %d.'", "%", "self", ".", "bytes_read", ")", "self", ...
Read the header of a MIDI file and return a tuple containing the format type, number of tracks and parsed time division information.
[ "Read", "the", "header", "of", "a", "MIDI", "file", "and", "return", "a", "tuple", "containing", "the", "format", "type", "number", "of", "tracks", "and", "parsed", "time", "division", "information", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_file_in.py#L171-L215
train
bspaans/python-mingus
mingus/midi/midi_file_in.py
MidiFile.parse_time_division
def parse_time_division(self, bytes): """Parse the time division found in the header of a MIDI file and return a dictionary with the boolean fps set to indicate whether to use frames per second or ticks per beat. If fps is True, the values SMPTE_frames and clock_ticks will also be ...
python
def parse_time_division(self, bytes): """Parse the time division found in the header of a MIDI file and return a dictionary with the boolean fps set to indicate whether to use frames per second or ticks per beat. If fps is True, the values SMPTE_frames and clock_ticks will also be ...
[ "def", "parse_time_division", "(", "self", ",", "bytes", ")", ":", "value", "=", "self", ".", "bytes_to_int", "(", "bytes", ")", "if", "not", "value", "&", "0x8000", ":", "return", "{", "'fps'", ":", "False", ",", "'ticks_per_beat'", ":", "value", "&", ...
Parse the time division found in the header of a MIDI file and return a dictionary with the boolean fps set to indicate whether to use frames per second or ticks per beat. If fps is True, the values SMPTE_frames and clock_ticks will also be set. If fps is False, ticks_per_beat will hold...
[ "Parse", "the", "time", "division", "found", "in", "the", "header", "of", "a", "MIDI", "file", "and", "return", "a", "dictionary", "with", "the", "boolean", "fps", "set", "to", "indicate", "whether", "to", "use", "frames", "per", "second", "or", "ticks", ...
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_file_in.py#L220-L241
train
bspaans/python-mingus
mingus/midi/midi_file_in.py
MidiFile.parse_track
def parse_track(self, fp): """Parse a MIDI track from its header to its events. Return a list of events and the number of bytes that were read. """ events = [] chunk_size = self.parse_track_header(fp) bytes = chunk_size while chunk_size > 0: (delta_ti...
python
def parse_track(self, fp): """Parse a MIDI track from its header to its events. Return a list of events and the number of bytes that were read. """ events = [] chunk_size = self.parse_track_header(fp) bytes = chunk_size while chunk_size > 0: (delta_ti...
[ "def", "parse_track", "(", "self", ",", "fp", ")", ":", "events", "=", "[", "]", "chunk_size", "=", "self", ".", "parse_track_header", "(", "fp", ")", "bytes", "=", "chunk_size", "while", "chunk_size", ">", "0", ":", "(", "delta_time", ",", "chunk_delta"...
Parse a MIDI track from its header to its events. Return a list of events and the number of bytes that were read.
[ "Parse", "a", "MIDI", "track", "from", "its", "header", "to", "its", "events", "." ]
aa5a5d992d45ada61be0f9f86261380731bd7749
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/midi_file_in.py#L243-L259
train