repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
contentful/contentful.py
contentful/client.py
Client._http_get
def _http_get(self, url, query): """ Performs the HTTP GET Request. """ if not self.authorization_as_header: query.update({'access_token': self.access_token}) response = None self._normalize_query(query) kwargs = { 'params': query, ...
python
def _http_get(self, url, query): """ Performs the HTTP GET Request. """ if not self.authorization_as_header: query.update({'access_token': self.access_token}) response = None self._normalize_query(query) kwargs = { 'params': query, ...
[ "def", "_http_get", "(", "self", ",", "url", ",", "query", ")", ":", "if", "not", "self", ".", "authorization_as_header", ":", "query", ".", "update", "(", "{", "'access_token'", ":", "self", ".", "access_token", "}", ")", "response", "=", "None", "self"...
Performs the HTTP GET Request.
[ "Performs", "the", "HTTP", "GET", "Request", "." ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/client.py#L518-L546
contentful/contentful.py
contentful/client.py
Client._get
def _get(self, url, query=None): """ Wrapper for the HTTP Request, Rate Limit Backoff is handled here, Responses are Processed with ResourceBuilder. """ if query is None: query = {} response = retry_request(self)(self._http_get)(url, query=query) ...
python
def _get(self, url, query=None): """ Wrapper for the HTTP Request, Rate Limit Backoff is handled here, Responses are Processed with ResourceBuilder. """ if query is None: query = {} response = retry_request(self)(self._http_get)(url, query=query) ...
[ "def", "_get", "(", "self", ",", "url", ",", "query", "=", "None", ")", ":", "if", "query", "is", "None", ":", "query", "=", "{", "}", "response", "=", "retry_request", "(", "self", ")", "(", "self", ".", "_http_get", ")", "(", "url", ",", "query...
Wrapper for the HTTP Request, Rate Limit Backoff is handled here, Responses are Processed with ResourceBuilder.
[ "Wrapper", "for", "the", "HTTP", "Request", "Rate", "Limit", "Backoff", "is", "handled", "here", "Responses", "are", "Processed", "with", "ResourceBuilder", "." ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/client.py#L548-L576
contentful/contentful.py
contentful/client.py
Client._proxy_parameters
def _proxy_parameters(self): """ Builds Proxy parameters Dict from client options. """ proxy_protocol = '' if self.proxy_host.startswith('https'): proxy_protocol = 'https' else: proxy_protocol = 'http' proxy = '{0}://'.format(prox...
python
def _proxy_parameters(self): """ Builds Proxy parameters Dict from client options. """ proxy_protocol = '' if self.proxy_host.startswith('https'): proxy_protocol = 'https' else: proxy_protocol = 'http' proxy = '{0}://'.format(prox...
[ "def", "_proxy_parameters", "(", "self", ")", ":", "proxy_protocol", "=", "''", "if", "self", ".", "proxy_host", ".", "startswith", "(", "'https'", ")", ":", "proxy_protocol", "=", "'https'", "else", ":", "proxy_protocol", "=", "'http'", "proxy", "=", "'{0}:...
Builds Proxy parameters Dict from client options.
[ "Builds", "Proxy", "parameters", "Dict", "from", "client", "options", "." ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/client.py#L585-L609
contentful/contentful.py
contentful/asset.py
Asset.url
def url(self, **kwargs): """Returns a formatted URL for the Asset's File with serialized parameters. Usage: >>> my_asset.url() "//images.contentful.com/spaces/foobar/..." >>> my_asset.url(w=120, h=160) "//images.contentful.com/spaces/foobar/...?w=...
python
def url(self, **kwargs): """Returns a formatted URL for the Asset's File with serialized parameters. Usage: >>> my_asset.url() "//images.contentful.com/spaces/foobar/..." >>> my_asset.url(w=120, h=160) "//images.contentful.com/spaces/foobar/...?w=...
[ "def", "url", "(", "self", ",", "*", "*", "kwargs", ")", ":", "url", "=", "self", ".", "file", "[", "'url'", "]", "args", "=", "[", "'{0}={1}'", ".", "format", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ...
Returns a formatted URL for the Asset's File with serialized parameters. Usage: >>> my_asset.url() "//images.contentful.com/spaces/foobar/..." >>> my_asset.url(w=120, h=160) "//images.contentful.com/spaces/foobar/...?w=120&h=160"
[ "Returns", "a", "formatted", "URL", "for", "the", "Asset", "s", "File", "with", "serialized", "parameters", "." ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/asset.py#L22-L39
contentful/contentful.py
contentful/resource.py
FieldsResource.fields
def fields(self, locale=None): """Get fields for a specific locale :param locale: (optional) Locale to fetch, defaults to default_locale. """ if locale is None: locale = self._locale() return self._fields.get(locale, {})
python
def fields(self, locale=None): """Get fields for a specific locale :param locale: (optional) Locale to fetch, defaults to default_locale. """ if locale is None: locale = self._locale() return self._fields.get(locale, {})
[ "def", "fields", "(", "self", ",", "locale", "=", "None", ")", ":", "if", "locale", "is", "None", ":", "locale", "=", "self", ".", "_locale", "(", ")", "return", "self", ".", "_fields", ".", "get", "(", "locale", ",", "{", "}", ")" ]
Get fields for a specific locale :param locale: (optional) Locale to fetch, defaults to default_locale.
[ "Get", "fields", "for", "a", "specific", "locale" ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/resource.py#L152-L160
contentful/contentful.py
contentful/resource.py
Link.resolve
def resolve(self, client): """Resolves Link to a specific Resource""" resolve_method = getattr(client, snake_case(self.link_type)) if self.link_type == 'Space': return resolve_method() else: return resolve_method(self.id)
python
def resolve(self, client): """Resolves Link to a specific Resource""" resolve_method = getattr(client, snake_case(self.link_type)) if self.link_type == 'Space': return resolve_method() else: return resolve_method(self.id)
[ "def", "resolve", "(", "self", ",", "client", ")", ":", "resolve_method", "=", "getattr", "(", "client", ",", "snake_case", "(", "self", ".", "link_type", ")", ")", "if", "self", ".", "link_type", "==", "'Space'", ":", "return", "resolve_method", "(", ")...
Resolves Link to a specific Resource
[ "Resolves", "Link", "to", "a", "specific", "Resource" ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/resource.py#L182-L189
contentful/contentful.py
contentful/utils.py
snake_case
def snake_case(a_string): """Returns a snake cased version of a string. :param a_string: any :class:`str` object. Usage: >>> snake_case('FooBar') "foo_bar" """ partial = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', a_string) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', partial).lower(...
python
def snake_case(a_string): """Returns a snake cased version of a string. :param a_string: any :class:`str` object. Usage: >>> snake_case('FooBar') "foo_bar" """ partial = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', a_string) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', partial).lower(...
[ "def", "snake_case", "(", "a_string", ")", ":", "partial", "=", "re", ".", "sub", "(", "'(.)([A-Z][a-z]+)'", ",", "r'\\1_\\2'", ",", "a_string", ")", "return", "re", ".", "sub", "(", "'([a-z0-9])([A-Z])'", ",", "r'\\1_\\2'", ",", "partial", ")", ".", "lowe...
Returns a snake cased version of a string. :param a_string: any :class:`str` object. Usage: >>> snake_case('FooBar') "foo_bar"
[ "Returns", "a", "snake", "cased", "version", "of", "a", "string", "." ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/utils.py#L56-L67
contentful/contentful.py
contentful/utils.py
is_link_array
def is_link_array(value): """Checks if value is an array of links. :param value: any object. :return: Boolean :rtype: bool Usage: >>> is_link_array('foo') False >>> is_link_array([1, 2, 3]) False >>> is_link([{'sys': {'type': 'Link', 'id': 'foobar'}}]) ...
python
def is_link_array(value): """Checks if value is an array of links. :param value: any object. :return: Boolean :rtype: bool Usage: >>> is_link_array('foo') False >>> is_link_array([1, 2, 3]) False >>> is_link([{'sys': {'type': 'Link', 'id': 'foobar'}}]) ...
[ "def", "is_link_array", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", "and", "len", "(", "value", ")", ">", "0", ":", "return", "is_link", "(", "value", "[", "0", "]", ")", "return", "False" ]
Checks if value is an array of links. :param value: any object. :return: Boolean :rtype: bool Usage: >>> is_link_array('foo') False >>> is_link_array([1, 2, 3]) False >>> is_link([{'sys': {'type': 'Link', 'id': 'foobar'}}]) True
[ "Checks", "if", "value", "is", "an", "array", "of", "links", "." ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/utils.py#L90-L108
contentful/contentful.py
contentful/utils.py
resource_for_link
def resource_for_link(link, includes, resources=None, locale=None): """Returns the resource that matches the link""" if resources is not None: cache_key = "{0}:{1}:{2}".format( link['sys']['linkType'], link['sys']['id'], locale ) if cache_key in resou...
python
def resource_for_link(link, includes, resources=None, locale=None): """Returns the resource that matches the link""" if resources is not None: cache_key = "{0}:{1}:{2}".format( link['sys']['linkType'], link['sys']['id'], locale ) if cache_key in resou...
[ "def", "resource_for_link", "(", "link", ",", "includes", ",", "resources", "=", "None", ",", "locale", "=", "None", ")", ":", "if", "resources", "is", "not", "None", ":", "cache_key", "=", "\"{0}:{1}:{2}\"", ".", "format", "(", "link", "[", "'sys'", "]"...
Returns the resource that matches the link
[ "Returns", "the", "resource", "that", "matches", "the", "link" ]
train
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/utils.py#L121-L137
phalt/swapi-python
swapi/utils.py
all_resource_urls
def all_resource_urls(query): ''' Get all the URLs for every resource ''' urls = [] next = True while next: response = requests.get(query) json_data = json.loads(response.content) for resource in json_data['results']: urls.append(resource['url']) if bool(json_...
python
def all_resource_urls(query): ''' Get all the URLs for every resource ''' urls = [] next = True while next: response = requests.get(query) json_data = json.loads(response.content) for resource in json_data['results']: urls.append(resource['url']) if bool(json_...
[ "def", "all_resource_urls", "(", "query", ")", ":", "urls", "=", "[", "]", "next", "=", "True", "while", "next", ":", "response", "=", "requests", ".", "get", "(", "query", ")", "json_data", "=", "json", ".", "loads", "(", "response", ".", "content", ...
Get all the URLs for every resource
[ "Get", "all", "the", "URLs", "for", "every", "resource" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/utils.py#L17-L30
phalt/swapi-python
swapi/swapi.py
_get
def _get(id, type): ''' Return a single person ''' result = query("{0}/{1}/{2}/".format( settings.BASE_URL, type, str(id)) ) return result
python
def _get(id, type): ''' Return a single person ''' result = query("{0}/{1}/{2}/".format( settings.BASE_URL, type, str(id)) ) return result
[ "def", "_get", "(", "id", ",", "type", ")", ":", "result", "=", "query", "(", "\"{0}/{1}/{2}/\"", ".", "format", "(", "settings", ".", "BASE_URL", ",", "type", ",", "str", "(", "id", ")", ")", ")", "return", "result" ]
Return a single person
[ "Return", "a", "single", "person" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/swapi.py#L36-L43
phalt/swapi-python
swapi/swapi.py
get_all
def get_all(resource): ''' Return all of a single resource ''' QUERYSETS = { settings.PEOPLE: PeopleQuerySet, settings.PLANETS: PlanetQuerySet, settings.STARSHIPS: StarshipQuerySet, settings.VEHICLES: VehicleQuerySet, settings.SPECIES: SpeciesQuerySet, settings.FI...
python
def get_all(resource): ''' Return all of a single resource ''' QUERYSETS = { settings.PEOPLE: PeopleQuerySet, settings.PLANETS: PlanetQuerySet, settings.STARSHIPS: StarshipQuerySet, settings.VEHICLES: VehicleQuerySet, settings.SPECIES: SpeciesQuerySet, settings.FI...
[ "def", "get_all", "(", "resource", ")", ":", "QUERYSETS", "=", "{", "settings", ".", "PEOPLE", ":", "PeopleQuerySet", ",", "settings", ".", "PLANETS", ":", "PlanetQuerySet", ",", "settings", ".", "STARSHIPS", ":", "StarshipQuerySet", ",", "settings", ".", "V...
Return all of a single resource
[ "Return", "all", "of", "a", "single", "resource" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/swapi.py#L46-L61
phalt/swapi-python
swapi/swapi.py
get_planet
def get_planet(planet_id): ''' Return a single planet ''' result = _get(planet_id, settings.PLANETS) return Planet(result.content)
python
def get_planet(planet_id): ''' Return a single planet ''' result = _get(planet_id, settings.PLANETS) return Planet(result.content)
[ "def", "get_planet", "(", "planet_id", ")", ":", "result", "=", "_get", "(", "planet_id", ",", "settings", ".", "PLANETS", ")", "return", "Planet", "(", "result", ".", "content", ")" ]
Return a single planet
[ "Return", "a", "single", "planet" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/swapi.py#L64-L67
phalt/swapi-python
swapi/swapi.py
get_person
def get_person(people_id): ''' Return a single person ''' result = _get(people_id, settings.PEOPLE) return People(result.content)
python
def get_person(people_id): ''' Return a single person ''' result = _get(people_id, settings.PEOPLE) return People(result.content)
[ "def", "get_person", "(", "people_id", ")", ":", "result", "=", "_get", "(", "people_id", ",", "settings", ".", "PEOPLE", ")", "return", "People", "(", "result", ".", "content", ")" ]
Return a single person
[ "Return", "a", "single", "person" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/swapi.py#L70-L73
phalt/swapi-python
swapi/swapi.py
get_starship
def get_starship(starship_id): ''' Return a single starship ''' result = _get(starship_id, settings.STARSHIPS) return Starship(result.content)
python
def get_starship(starship_id): ''' Return a single starship ''' result = _get(starship_id, settings.STARSHIPS) return Starship(result.content)
[ "def", "get_starship", "(", "starship_id", ")", ":", "result", "=", "_get", "(", "starship_id", ",", "settings", ".", "STARSHIPS", ")", "return", "Starship", "(", "result", ".", "content", ")" ]
Return a single starship
[ "Return", "a", "single", "starship" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/swapi.py#L76-L79
phalt/swapi-python
swapi/swapi.py
get_vehicle
def get_vehicle(vehicle_id): ''' Return a single vehicle ''' result = _get(vehicle_id, settings.VEHICLES) return Vehicle(result.content)
python
def get_vehicle(vehicle_id): ''' Return a single vehicle ''' result = _get(vehicle_id, settings.VEHICLES) return Vehicle(result.content)
[ "def", "get_vehicle", "(", "vehicle_id", ")", ":", "result", "=", "_get", "(", "vehicle_id", ",", "settings", ".", "VEHICLES", ")", "return", "Vehicle", "(", "result", ".", "content", ")" ]
Return a single vehicle
[ "Return", "a", "single", "vehicle" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/swapi.py#L82-L85
phalt/swapi-python
swapi/swapi.py
get_species
def get_species(species_id): ''' Return a single species ''' result = _get(species_id, settings.SPECIES) return Species(result.content)
python
def get_species(species_id): ''' Return a single species ''' result = _get(species_id, settings.SPECIES) return Species(result.content)
[ "def", "get_species", "(", "species_id", ")", ":", "result", "=", "_get", "(", "species_id", ",", "settings", ".", "SPECIES", ")", "return", "Species", "(", "result", ".", "content", ")" ]
Return a single species
[ "Return", "a", "single", "species" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/swapi.py#L88-L91
phalt/swapi-python
swapi/swapi.py
get_film
def get_film(film_id): ''' Return a single film ''' result = _get(film_id, settings.FILMS) return Film(result.content)
python
def get_film(film_id): ''' Return a single film ''' result = _get(film_id, settings.FILMS) return Film(result.content)
[ "def", "get_film", "(", "film_id", ")", ":", "result", "=", "_get", "(", "film_id", ",", "settings", ".", "FILMS", ")", "return", "Film", "(", "result", ".", "content", ")" ]
Return a single film
[ "Return", "a", "single", "film" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/swapi.py#L94-L97
phalt/swapi-python
swapi/models.py
BaseQuerySet.order_by
def order_by(self, order_attribute): ''' Return the list of items in a certain order ''' to_return = [] for f in sorted(self.items, key=lambda i: getattr(i, order_attribute)): to_return.append(f) return to_return
python
def order_by(self, order_attribute): ''' Return the list of items in a certain order ''' to_return = [] for f in sorted(self.items, key=lambda i: getattr(i, order_attribute)): to_return.append(f) return to_return
[ "def", "order_by", "(", "self", ",", "order_attribute", ")", ":", "to_return", "=", "[", "]", "for", "f", "in", "sorted", "(", "self", ".", "items", ",", "key", "=", "lambda", "i", ":", "getattr", "(", "i", ",", "order_attribute", ")", ")", ":", "t...
Return the list of items in a certain order
[ "Return", "the", "list", "of", "items", "in", "a", "certain", "order" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/models.py#L24-L29
phalt/swapi-python
swapi/models.py
Film.print_crawl
def print_crawl(self): ''' Print the opening crawl one line at a time ''' print("Star Wars") time.sleep(.5) print("Episode {0}".format(self.episode_id)) time.sleep(.5) print("") time.sleep(.5) print("{0}".format(self.title)) for line in self.gen_op...
python
def print_crawl(self): ''' Print the opening crawl one line at a time ''' print("Star Wars") time.sleep(.5) print("Episode {0}".format(self.episode_id)) time.sleep(.5) print("") time.sleep(.5) print("{0}".format(self.title)) for line in self.gen_op...
[ "def", "print_crawl", "(", "self", ")", ":", "print", "(", "\"Star Wars\"", ")", "time", ".", "sleep", "(", ".5", ")", "print", "(", "\"Episode {0}\"", ".", "format", "(", "self", ".", "episode_id", ")", ")", "time", ".", "sleep", "(", ".5", ")", "pr...
Print the opening crawl one line at a time
[ "Print", "the", "opening", "crawl", "one", "line", "at", "a", "time" ]
train
https://github.com/phalt/swapi-python/blob/cb9195fc498a1d1fc3b1998d485edc94b8408ca7/swapi/models.py#L135-L146
gccxml/pygccxml
pygccxml/utils/utils.py
is_str
def is_str(string): """ Python 2 and 3 compatible string checker. Args: string (str | basestring): the string to check Returns: bool: True or False """ if sys.version_info[:2] >= (3, 0): return isinstance(string, str) return isinstance(string, basestring)
python
def is_str(string): """ Python 2 and 3 compatible string checker. Args: string (str | basestring): the string to check Returns: bool: True or False """ if sys.version_info[:2] >= (3, 0): return isinstance(string, str) return isinstance(string, basestring)
[ "def", "is_str", "(", "string", ")", ":", "if", "sys", ".", "version_info", "[", ":", "2", "]", ">=", "(", "3", ",", "0", ")", ":", "return", "isinstance", "(", "string", ",", "str", ")", "return", "isinstance", "(", "string", ",", "basestring", ")...
Python 2 and 3 compatible string checker. Args: string (str | basestring): the string to check Returns: bool: True or False
[ "Python", "2", "and", "3", "compatible", "string", "checker", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/utils/utils.py#L18-L32
gccxml/pygccxml
pygccxml/utils/utils.py
find_xml_generator
def find_xml_generator(name="castxml"): """ Try to find a c++ parser (xml generator) Args: name (str): name of the c++ parser (e.g. castxml) Returns: path (str), name (str): path to the xml generator and it's name If no c++ parser is found the function raises an exception. py...
python
def find_xml_generator(name="castxml"): """ Try to find a c++ parser (xml generator) Args: name (str): name of the c++ parser (e.g. castxml) Returns: path (str), name (str): path to the xml generator and it's name If no c++ parser is found the function raises an exception. py...
[ "def", "find_xml_generator", "(", "name", "=", "\"castxml\"", ")", ":", "if", "sys", ".", "version_info", "[", ":", "2", "]", ">=", "(", "3", ",", "3", ")", ":", "path", "=", "_find_xml_generator_for_python_greater_equals_33", "(", "name", ")", "else", ":"...
Try to find a c++ parser (xml generator) Args: name (str): name of the c++ parser (e.g. castxml) Returns: path (str), name (str): path to the xml generator and it's name If no c++ parser is found the function raises an exception. pygccxml does currently only support castxml as c++ pa...
[ "Try", "to", "find", "a", "c", "++", "parser", "(", "xml", "generator", ")" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/utils/utils.py#L35-L58
gccxml/pygccxml
pygccxml/utils/utils.py
_create_logger_
def _create_logger_(name): """Implementation detail, creates a logger.""" logger = logging.getLogger(name) handler = logging.StreamHandler() handler.setFormatter(logging.Formatter('%(levelname)s %(message)s')) logger.addHandler(handler) logger.setLevel(logging.INFO) return logger
python
def _create_logger_(name): """Implementation detail, creates a logger.""" logger = logging.getLogger(name) handler = logging.StreamHandler() handler.setFormatter(logging.Formatter('%(levelname)s %(message)s')) logger.addHandler(handler) logger.setLevel(logging.INFO) return logger
[ "def", "_create_logger_", "(", "name", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "name", ")", "handler", "=", "logging", ".", "StreamHandler", "(", ")", "handler", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "'%(levelname)s %...
Implementation detail, creates a logger.
[ "Implementation", "detail", "creates", "a", "logger", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/utils/utils.py#L79-L86
gccxml/pygccxml
pygccxml/utils/utils.py
remove_file_no_raise
def remove_file_no_raise(file_name, config): """Removes file from disk if exception is raised.""" # The removal can be disabled by the config for debugging purposes. if config.keep_xml: return True try: if os.path.exists(file_name): os.remove(file_name) except IOError as...
python
def remove_file_no_raise(file_name, config): """Removes file from disk if exception is raised.""" # The removal can be disabled by the config for debugging purposes. if config.keep_xml: return True try: if os.path.exists(file_name): os.remove(file_name) except IOError as...
[ "def", "remove_file_no_raise", "(", "file_name", ",", "config", ")", ":", "# The removal can be disabled by the config for debugging purposes.", "if", "config", ".", "keep_xml", ":", "return", "True", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "file_na...
Removes file from disk if exception is raised.
[ "Removes", "file", "from", "disk", "if", "exception", "is", "raised", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/utils/utils.py#L150-L162
gccxml/pygccxml
pygccxml/utils/utils.py
create_temp_file_name
def create_temp_file_name(suffix, prefix=None, dir=None, directory=None): """ Small convenience function that creates temporary files. This function is a wrapper around the Python built-in function tempfile.mkstemp. """ if dir is not None: warnings.warn( "The dir argument i...
python
def create_temp_file_name(suffix, prefix=None, dir=None, directory=None): """ Small convenience function that creates temporary files. This function is a wrapper around the Python built-in function tempfile.mkstemp. """ if dir is not None: warnings.warn( "The dir argument i...
[ "def", "create_temp_file_name", "(", "suffix", ",", "prefix", "=", "None", ",", "dir", "=", "None", ",", "directory", "=", "None", ")", ":", "if", "dir", "is", "not", "None", ":", "warnings", ".", "warn", "(", "\"The dir argument is deprecated.\\n\"", "+", ...
Small convenience function that creates temporary files. This function is a wrapper around the Python built-in function tempfile.mkstemp.
[ "Small", "convenience", "function", "that", "creates", "temporary", "files", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/utils/utils.py#L166-L186
gccxml/pygccxml
pygccxml/utils/utils.py
contains_parent_dir
def contains_parent_dir(fpath, dirs): """ Returns true if paths in dirs start with fpath. Precondition: dirs and fpath should be normalized before calling this function. """ # Note: this function is used nowhere in pygccxml but is used # at least by pypluplus; so it should stay here. ...
python
def contains_parent_dir(fpath, dirs): """ Returns true if paths in dirs start with fpath. Precondition: dirs and fpath should be normalized before calling this function. """ # Note: this function is used nowhere in pygccxml but is used # at least by pypluplus; so it should stay here. ...
[ "def", "contains_parent_dir", "(", "fpath", ",", "dirs", ")", ":", "# Note: this function is used nowhere in pygccxml but is used", "# at least by pypluplus; so it should stay here.", "return", "bool", "(", "[", "x", "for", "x", "in", "dirs", "if", "_f", "(", "fpath", "...
Returns true if paths in dirs start with fpath. Precondition: dirs and fpath should be normalized before calling this function.
[ "Returns", "true", "if", "paths", "in", "dirs", "start", "with", "fpath", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/utils/utils.py#L194-L205
gccxml/pygccxml
pygccxml/declarations/cpptypes.py
free_function_type_t.create_decl_string
def create_decl_string( return_type, arguments_types, with_defaults=True): """ Returns free function type :param return_type: function return type :type return_type: :class:`type_t` :param arguments_types: list of argument :class:`type <type_t>` :rtype: :clas...
python
def create_decl_string( return_type, arguments_types, with_defaults=True): """ Returns free function type :param return_type: function return type :type return_type: :class:`type_t` :param arguments_types: list of argument :class:`type <type_t>` :rtype: :clas...
[ "def", "create_decl_string", "(", "return_type", ",", "arguments_types", ",", "with_defaults", "=", "True", ")", ":", "return", "free_function_type_t", ".", "NAME_TEMPLATE", "%", "{", "'return_type'", ":", "return_type", ".", "build_decl_string", "(", "with_defaults",...
Returns free function type :param return_type: function return type :type return_type: :class:`type_t` :param arguments_types: list of argument :class:`type <type_t>` :rtype: :class:`free_function_type_t`
[ "Returns", "free", "function", "type" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/cpptypes.py#L696-L711
gccxml/pygccxml
pygccxml/declarations/cpptypes.py
free_function_type_t.create_typedef
def create_typedef(self, typedef_name, unused=None, with_defaults=True): """returns string, that contains valid C++ code, that defines typedef to function type :param name: the desired name of typedef """ return free_function_type_t.TYPEDEF_NAME_TEMPLATE % { 'typede...
python
def create_typedef(self, typedef_name, unused=None, with_defaults=True): """returns string, that contains valid C++ code, that defines typedef to function type :param name: the desired name of typedef """ return free_function_type_t.TYPEDEF_NAME_TEMPLATE % { 'typede...
[ "def", "create_typedef", "(", "self", ",", "typedef_name", ",", "unused", "=", "None", ",", "with_defaults", "=", "True", ")", ":", "return", "free_function_type_t", ".", "TYPEDEF_NAME_TEMPLATE", "%", "{", "'typedef_name'", ":", "typedef_name", ",", "'return_type'...
returns string, that contains valid C++ code, that defines typedef to function type :param name: the desired name of typedef
[ "returns", "string", "that", "contains", "valid", "C", "++", "code", "that", "defines", "typedef", "to", "function", "type" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/cpptypes.py#L728-L739
gccxml/pygccxml
pygccxml/declarations/cpptypes.py
member_function_type_t.create_typedef
def create_typedef( self, typedef_name, class_alias=None, with_defaults=True): """creates typedef to the function type :param typedef_name: desired type name :rtype: string """ has_const_str = '' if self.has_const: ...
python
def create_typedef( self, typedef_name, class_alias=None, with_defaults=True): """creates typedef to the function type :param typedef_name: desired type name :rtype: string """ has_const_str = '' if self.has_const: ...
[ "def", "create_typedef", "(", "self", ",", "typedef_name", ",", "class_alias", "=", "None", ",", "with_defaults", "=", "True", ")", ":", "has_const_str", "=", "''", "if", "self", ".", "has_const", ":", "has_const_str", "=", "'const'", "if", "None", "is", "...
creates typedef to the function type :param typedef_name: desired type name :rtype: string
[ "creates", "typedef", "to", "the", "function", "type" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/cpptypes.py#L781-L806
gccxml/pygccxml
pygccxml/parser/__init__.py
parse
def parse( files, config=None, compilation_mode=COMPILATION_MODE.FILE_BY_FILE, cache=None): """ Parse header files. :param files: The header files that should be parsed :type files: list of str :param config: Configuration object or None :type config: :class:`par...
python
def parse( files, config=None, compilation_mode=COMPILATION_MODE.FILE_BY_FILE, cache=None): """ Parse header files. :param files: The header files that should be parsed :type files: list of str :param config: Configuration object or None :type config: :class:`par...
[ "def", "parse", "(", "files", ",", "config", "=", "None", ",", "compilation_mode", "=", "COMPILATION_MODE", ".", "FILE_BY_FILE", ",", "cache", "=", "None", ")", ":", "if", "not", "config", ":", "config", "=", "xml_generator_configuration_t", "(", ")", "parse...
Parse header files. :param files: The header files that should be parsed :type files: list of str :param config: Configuration object or None :type config: :class:`parser.xml_generator_configuration_t` :param compilation_mode: Determines whether the files are parsed ind...
[ "Parse", "header", "files", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/__init__.py#L29-L53
gccxml/pygccxml
pygccxml/declarations/type_traits.py
__remove_alias
def __remove_alias(type_): """ Implementation detail. Args: type_ (type_t): type Returns: type_t: the type associated to the inputted type """ if isinstance(type_, cpptypes.declarated_t) and \ isinstance(type_.declaration, typedef.typedef_t): return __remove...
python
def __remove_alias(type_): """ Implementation detail. Args: type_ (type_t): type Returns: type_t: the type associated to the inputted type """ if isinstance(type_, cpptypes.declarated_t) and \ isinstance(type_.declaration, typedef.typedef_t): return __remove...
[ "def", "__remove_alias", "(", "type_", ")", ":", "if", "isinstance", "(", "type_", ",", "cpptypes", ".", "declarated_t", ")", "and", "isinstance", "(", "type_", ".", "declaration", ",", "typedef", ".", "typedef_t", ")", ":", "return", "__remove_alias", "(", ...
Implementation detail. Args: type_ (type_t): type Returns: type_t: the type associated to the inputted type
[ "Implementation", "detail", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L26-L42
gccxml/pygccxml
pygccxml/declarations/type_traits.py
remove_alias
def remove_alias(type_): """ Returns `type_t` without typedef Args: type_ (type_t | declaration_t): type or declaration Returns: type_t: the type associated to the inputted declaration """ if isinstance(type_, cpptypes.type_t): type_ref = type_ elif isinstance(type_...
python
def remove_alias(type_): """ Returns `type_t` without typedef Args: type_ (type_t | declaration_t): type or declaration Returns: type_t: the type associated to the inputted declaration """ if isinstance(type_, cpptypes.type_t): type_ref = type_ elif isinstance(type_...
[ "def", "remove_alias", "(", "type_", ")", ":", "if", "isinstance", "(", "type_", ",", "cpptypes", ".", "type_t", ")", ":", "type_ref", "=", "type_", "elif", "isinstance", "(", "type_", ",", "typedef", ".", "typedef_t", ")", ":", "type_ref", "=", "type_",...
Returns `type_t` without typedef Args: type_ (type_t | declaration_t): type or declaration Returns: type_t: the type associated to the inputted declaration
[ "Returns", "type_t", "without", "typedef" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L45-L66
gccxml/pygccxml
pygccxml/declarations/type_traits.py
decompose_type
def decompose_type(tp): """ Implementation detail """ if isinstance(tp, cpptypes.compound_t): return [tp] + decompose_type(tp.base) elif isinstance(tp, typedef.typedef_t): return decompose_type(tp.decl_type) elif isinstance(tp, cpptypes.declarated_t) and \ isinstance(...
python
def decompose_type(tp): """ Implementation detail """ if isinstance(tp, cpptypes.compound_t): return [tp] + decompose_type(tp.base) elif isinstance(tp, typedef.typedef_t): return decompose_type(tp.decl_type) elif isinstance(tp, cpptypes.declarated_t) and \ isinstance(...
[ "def", "decompose_type", "(", "tp", ")", ":", "if", "isinstance", "(", "tp", ",", "cpptypes", ".", "compound_t", ")", ":", "return", "[", "tp", "]", "+", "decompose_type", "(", "tp", ".", "base", ")", "elif", "isinstance", "(", "tp", ",", "typedef", ...
Implementation detail
[ "Implementation", "detail" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L69-L81
gccxml/pygccxml
pygccxml/declarations/type_traits.py
_create_cv_types
def _create_cv_types(base): """ Implementation detail. """ return ( [base, cpptypes.const_t(base), cpptypes.volatile_t(base), cpptypes.volatile_t(cpptypes.const_t(base))] )
python
def _create_cv_types(base): """ Implementation detail. """ return ( [base, cpptypes.const_t(base), cpptypes.volatile_t(base), cpptypes.volatile_t(cpptypes.const_t(base))] )
[ "def", "_create_cv_types", "(", "base", ")", ":", "return", "(", "[", "base", ",", "cpptypes", ".", "const_t", "(", "base", ")", ",", "cpptypes", ".", "volatile_t", "(", "base", ")", ",", "cpptypes", ".", "volatile_t", "(", "cpptypes", ".", "const_t", ...
Implementation detail.
[ "Implementation", "detail", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L99-L109
gccxml/pygccxml
pygccxml/declarations/type_traits.py
does_match_definition
def does_match_definition(given, main, secondary): """implementation details""" assert isinstance(secondary, tuple) assert len(secondary) == 2 # general solution could be provided types = decompose_type(given) if isinstance(types[0], main): return True if len(types) >= 2: cond...
python
def does_match_definition(given, main, secondary): """implementation details""" assert isinstance(secondary, tuple) assert len(secondary) == 2 # general solution could be provided types = decompose_type(given) if isinstance(types[0], main): return True if len(types) >= 2: cond...
[ "def", "does_match_definition", "(", "given", ",", "main", ",", "secondary", ")", ":", "assert", "isinstance", "(", "secondary", ",", "tuple", ")", "assert", "len", "(", "secondary", ")", "==", "2", "# general solution could be provided", "types", "=", "decompos...
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L139-L169
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_pointer
def is_pointer(type_): """returns True, if type represents C++ pointer type, False otherwise""" return does_match_definition(type_, cpptypes.pointer_t, (cpptypes.const_t, cpptypes.volatile_t)) \ or does_match_definition(type_, ...
python
def is_pointer(type_): """returns True, if type represents C++ pointer type, False otherwise""" return does_match_definition(type_, cpptypes.pointer_t, (cpptypes.const_t, cpptypes.volatile_t)) \ or does_match_definition(type_, ...
[ "def", "is_pointer", "(", "type_", ")", ":", "return", "does_match_definition", "(", "type_", ",", "cpptypes", ".", "pointer_t", ",", "(", "cpptypes", ".", "const_t", ",", "cpptypes", ".", "volatile_t", ")", ")", "or", "does_match_definition", "(", "type_", ...
returns True, if type represents C++ pointer type, False otherwise
[ "returns", "True", "if", "type", "represents", "C", "++", "pointer", "type", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L229-L236
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_calldef_pointer
def is_calldef_pointer(type_): """returns True, if type represents pointer to free/member function, False otherwise""" if not is_pointer(type_): return False nake_type = remove_alias(type_) nake_type = remove_cv(nake_type) return isinstance(nake_type, cpptypes.compound_t) \ and i...
python
def is_calldef_pointer(type_): """returns True, if type represents pointer to free/member function, False otherwise""" if not is_pointer(type_): return False nake_type = remove_alias(type_) nake_type = remove_cv(nake_type) return isinstance(nake_type, cpptypes.compound_t) \ and i...
[ "def", "is_calldef_pointer", "(", "type_", ")", ":", "if", "not", "is_pointer", "(", "type_", ")", ":", "return", "False", "nake_type", "=", "remove_alias", "(", "type_", ")", "nake_type", "=", "remove_cv", "(", "nake_type", ")", "return", "isinstance", "(",...
returns True, if type represents pointer to free/member function, False otherwise
[ "returns", "True", "if", "type", "represents", "pointer", "to", "free", "/", "member", "function", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L239-L247
gccxml/pygccxml
pygccxml/declarations/type_traits.py
remove_pointer
def remove_pointer(type_): """removes pointer from the type definition If type is not pointer type, it will be returned as is. """ nake_type = remove_alias(type_) if not is_pointer(nake_type): return type_ elif isinstance(nake_type, cpptypes.volatile_t) and \ isinstance(nake...
python
def remove_pointer(type_): """removes pointer from the type definition If type is not pointer type, it will be returned as is. """ nake_type = remove_alias(type_) if not is_pointer(nake_type): return type_ elif isinstance(nake_type, cpptypes.volatile_t) and \ isinstance(nake...
[ "def", "remove_pointer", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "if", "not", "is_pointer", "(", "nake_type", ")", ":", "return", "type_", "elif", "isinstance", "(", "nake_type", ",", "cpptypes", ".", "volatile_t", ")", ...
removes pointer from the type definition If type is not pointer type, it will be returned as is.
[ "removes", "pointer", "from", "the", "type", "definition" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L250-L271
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_array
def is_array(type_): """returns True, if type represents C++ array type, False otherwise""" nake_type = remove_alias(type_) nake_type = remove_reference(nake_type) nake_type = remove_cv(nake_type) return isinstance(nake_type, cpptypes.array_t)
python
def is_array(type_): """returns True, if type represents C++ array type, False otherwise""" nake_type = remove_alias(type_) nake_type = remove_reference(nake_type) nake_type = remove_cv(nake_type) return isinstance(nake_type, cpptypes.array_t)
[ "def", "is_array", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "nake_type", "=", "remove_reference", "(", "nake_type", ")", "nake_type", "=", "remove_cv", "(", "nake_type", ")", "return", "isinstance", "(", "nake_type", ",", ...
returns True, if type represents C++ array type, False otherwise
[ "returns", "True", "if", "type", "represents", "C", "++", "array", "type", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L280-L285
gccxml/pygccxml
pygccxml/declarations/type_traits.py
array_size
def array_size(type_): """returns array size""" nake_type = remove_alias(type_) nake_type = remove_reference(nake_type) nake_type = remove_cv(nake_type) assert isinstance(nake_type, cpptypes.array_t) return nake_type.size
python
def array_size(type_): """returns array size""" nake_type = remove_alias(type_) nake_type = remove_reference(nake_type) nake_type = remove_cv(nake_type) assert isinstance(nake_type, cpptypes.array_t) return nake_type.size
[ "def", "array_size", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "nake_type", "=", "remove_reference", "(", "nake_type", ")", "nake_type", "=", "remove_cv", "(", "nake_type", ")", "assert", "isinstance", "(", "nake_type", ",", ...
returns array size
[ "returns", "array", "size" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L288-L294
gccxml/pygccxml
pygccxml/declarations/type_traits.py
array_item_type
def array_item_type(type_): """returns array item type""" if is_array(type_): type_ = remove_alias(type_) type_ = remove_cv(type_) return type_.base elif is_pointer(type_): return remove_pointer(type_) else: raise RuntimeError( "array_item_type functio...
python
def array_item_type(type_): """returns array item type""" if is_array(type_): type_ = remove_alias(type_) type_ = remove_cv(type_) return type_.base elif is_pointer(type_): return remove_pointer(type_) else: raise RuntimeError( "array_item_type functio...
[ "def", "array_item_type", "(", "type_", ")", ":", "if", "is_array", "(", "type_", ")", ":", "type_", "=", "remove_alias", "(", "type_", ")", "type_", "=", "remove_cv", "(", "type_", ")", "return", "type_", ".", "base", "elif", "is_pointer", "(", "type_",...
returns array item type
[ "returns", "array", "item", "type" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L297-L308
gccxml/pygccxml
pygccxml/declarations/type_traits.py
remove_reference
def remove_reference(type_): """removes reference from the type definition If type is not reference type, it will be returned as is. """ nake_type = remove_alias(type_) if not is_reference(nake_type): return type_ return nake_type.base
python
def remove_reference(type_): """removes reference from the type definition If type is not reference type, it will be returned as is. """ nake_type = remove_alias(type_) if not is_reference(nake_type): return type_ return nake_type.base
[ "def", "remove_reference", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "if", "not", "is_reference", "(", "nake_type", ")", ":", "return", "type_", "return", "nake_type", ".", "base" ]
removes reference from the type definition If type is not reference type, it will be returned as is.
[ "removes", "reference", "from", "the", "type", "definition" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L311-L320
gccxml/pygccxml
pygccxml/declarations/type_traits.py
remove_const
def remove_const(type_): """removes const from the type definition If type is not const type, it will be returned as is """ nake_type = remove_alias(type_) if not is_const(nake_type): return type_ else: # Handling for const and volatile qualified types. There is a # dif...
python
def remove_const(type_): """removes const from the type definition If type is not const type, it will be returned as is """ nake_type = remove_alias(type_) if not is_const(nake_type): return type_ else: # Handling for const and volatile qualified types. There is a # dif...
[ "def", "remove_const", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "if", "not", "is_const", "(", "nake_type", ")", ":", "return", "type_", "else", ":", "# Handling for const and volatile qualified types. There is a", "# difference in b...
removes const from the type definition If type is not const type, it will be returned as is
[ "removes", "const", "from", "the", "type", "definition" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L335-L366
gccxml/pygccxml
pygccxml/declarations/type_traits.py
remove_declarated
def remove_declarated(type_): """removes type-declaration class-binder :class:`declarated_t` from the `type_` If `type_` is not :class:`declarated_t`, it will be returned as is """ type_ = remove_alias(type_) if isinstance(type_, cpptypes.elaborated_t): type_ = type_.base if isinsta...
python
def remove_declarated(type_): """removes type-declaration class-binder :class:`declarated_t` from the `type_` If `type_` is not :class:`declarated_t`, it will be returned as is """ type_ = remove_alias(type_) if isinstance(type_, cpptypes.elaborated_t): type_ = type_.base if isinsta...
[ "def", "remove_declarated", "(", "type_", ")", ":", "type_", "=", "remove_alias", "(", "type_", ")", "if", "isinstance", "(", "type_", ",", "cpptypes", ".", "elaborated_t", ")", ":", "type_", "=", "type_", ".", "base", "if", "isinstance", "(", "type_", "...
removes type-declaration class-binder :class:`declarated_t` from the `type_` If `type_` is not :class:`declarated_t`, it will be returned as is
[ "removes", "type", "-", "declaration", "class", "-", "binder", ":", "class", ":", "declarated_t", "from", "the", "type_" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L369-L380
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_same
def is_same(type1, type2): """returns True, if type1 and type2 are same types""" nake_type1 = remove_declarated(type1) nake_type2 = remove_declarated(type2) return nake_type1 == nake_type2
python
def is_same(type1, type2): """returns True, if type1 and type2 are same types""" nake_type1 = remove_declarated(type1) nake_type2 = remove_declarated(type2) return nake_type1 == nake_type2
[ "def", "is_same", "(", "type1", ",", "type2", ")", ":", "nake_type1", "=", "remove_declarated", "(", "type1", ")", "nake_type2", "=", "remove_declarated", "(", "type2", ")", "return", "nake_type1", "==", "nake_type2" ]
returns True, if type1 and type2 are same types
[ "returns", "True", "if", "type1", "and", "type2", "are", "same", "types" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L383-L387
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_elaborated
def is_elaborated(type_): """returns True, if type represents C++ elaborated type, False otherwise""" nake_type = remove_alias(type_) if isinstance(nake_type, cpptypes.elaborated_t): return True elif isinstance(nake_type, cpptypes.reference_t): return is_elaborated(nake_type.base) el...
python
def is_elaborated(type_): """returns True, if type represents C++ elaborated type, False otherwise""" nake_type = remove_alias(type_) if isinstance(nake_type, cpptypes.elaborated_t): return True elif isinstance(nake_type, cpptypes.reference_t): return is_elaborated(nake_type.base) el...
[ "def", "is_elaborated", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "if", "isinstance", "(", "nake_type", ",", "cpptypes", ".", "elaborated_t", ")", ":", "return", "True", "elif", "isinstance", "(", "nake_type", ",", "cpptype...
returns True, if type represents C++ elaborated type, False otherwise
[ "returns", "True", "if", "type", "represents", "C", "++", "elaborated", "type", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L390-L403
gccxml/pygccxml
pygccxml/declarations/type_traits.py
remove_elaborated
def remove_elaborated(type_): """removes type-declaration class-binder :class:`elaborated_t` from the `type_` If `type_` is not :class:`elaborated_t`, it will be returned as is """ nake_type = remove_alias(type_) if not is_elaborated(nake_type): return type_ else: if isinsta...
python
def remove_elaborated(type_): """removes type-declaration class-binder :class:`elaborated_t` from the `type_` If `type_` is not :class:`elaborated_t`, it will be returned as is """ nake_type = remove_alias(type_) if not is_elaborated(nake_type): return type_ else: if isinsta...
[ "def", "remove_elaborated", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "if", "not", "is_elaborated", "(", "nake_type", ")", ":", "return", "type_", "else", ":", "if", "isinstance", "(", "type_", ",", "cpptypes", ".", "elab...
removes type-declaration class-binder :class:`elaborated_t` from the `type_` If `type_` is not :class:`elaborated_t`, it will be returned as is
[ "removes", "type", "-", "declaration", "class", "-", "binder", ":", "class", ":", "elaborated_t", "from", "the", "type_" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L406-L418
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_volatile
def is_volatile(type_): """returns True, if type represents C++ volatile type, False otherwise""" nake_type = remove_alias(type_) if isinstance(nake_type, cpptypes.volatile_t): return True elif isinstance(nake_type, cpptypes.const_t): return is_volatile(nake_type.base) elif isinstanc...
python
def is_volatile(type_): """returns True, if type represents C++ volatile type, False otherwise""" nake_type = remove_alias(type_) if isinstance(nake_type, cpptypes.volatile_t): return True elif isinstance(nake_type, cpptypes.const_t): return is_volatile(nake_type.base) elif isinstanc...
[ "def", "is_volatile", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "if", "isinstance", "(", "nake_type", ",", "cpptypes", ".", "volatile_t", ")", ":", "return", "True", "elif", "isinstance", "(", "nake_type", ",", "cpptypes", ...
returns True, if type represents C++ volatile type, False otherwise
[ "returns", "True", "if", "type", "represents", "C", "++", "volatile", "type", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L421-L430
gccxml/pygccxml
pygccxml/declarations/type_traits.py
remove_volatile
def remove_volatile(type_): """removes volatile from the type definition If type is not volatile type, it will be returned as is """ nake_type = remove_alias(type_) if not is_volatile(nake_type): return type_ else: if isinstance(nake_type, cpptypes.array_t): is_c = i...
python
def remove_volatile(type_): """removes volatile from the type definition If type is not volatile type, it will be returned as is """ nake_type = remove_alias(type_) if not is_volatile(nake_type): return type_ else: if isinstance(nake_type, cpptypes.array_t): is_c = i...
[ "def", "remove_volatile", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "if", "not", "is_volatile", "(", "nake_type", ")", ":", "return", "type_", "else", ":", "if", "isinstance", "(", "nake_type", ",", "cpptypes", ".", "arra...
removes volatile from the type definition If type is not volatile type, it will be returned as is
[ "removes", "volatile", "from", "the", "type", "definition" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L433-L452
gccxml/pygccxml
pygccxml/declarations/type_traits.py
remove_cv
def remove_cv(type_): """removes const and volatile from the type definition""" nake_type = remove_alias(type_) if not is_const(nake_type) and not is_volatile(nake_type): return type_ result = nake_type if is_const(result): result = remove_const(result) if is_volatile(result): ...
python
def remove_cv(type_): """removes const and volatile from the type definition""" nake_type = remove_alias(type_) if not is_const(nake_type) and not is_volatile(nake_type): return type_ result = nake_type if is_const(result): result = remove_const(result) if is_volatile(result): ...
[ "def", "remove_cv", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "if", "not", "is_const", "(", "nake_type", ")", "and", "not", "is_volatile", "(", "nake_type", ")", ":", "return", "type_", "result", "=", "nake_type", "if", ...
removes const and volatile from the type definition
[ "removes", "const", "and", "volatile", "from", "the", "type", "definition" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L455-L468
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_fundamental
def is_fundamental(type_): """returns True, if type represents C++ fundamental type""" return does_match_definition( type_, cpptypes.fundamental_t, (cpptypes.const_t, cpptypes.volatile_t)) \ or does_match_definition( type_, cpptypes.fundamental_t, ...
python
def is_fundamental(type_): """returns True, if type represents C++ fundamental type""" return does_match_definition( type_, cpptypes.fundamental_t, (cpptypes.const_t, cpptypes.volatile_t)) \ or does_match_definition( type_, cpptypes.fundamental_t, ...
[ "def", "is_fundamental", "(", "type_", ")", ":", "return", "does_match_definition", "(", "type_", ",", "cpptypes", ".", "fundamental_t", ",", "(", "cpptypes", ".", "const_t", ",", "cpptypes", ".", "volatile_t", ")", ")", "or", "does_match_definition", "(", "ty...
returns True, if type represents C++ fundamental type
[ "returns", "True", "if", "type", "represents", "C", "++", "fundamental", "type" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L471-L480
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_std_string
def is_std_string(type_): """ Returns True, if type represents C++ `std::string`, False otherwise. """ if utils.is_str(type_): return type_ in string_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string in s...
python
def is_std_string(type_): """ Returns True, if type represents C++ `std::string`, False otherwise. """ if utils.is_str(type_): return type_ in string_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string in s...
[ "def", "is_std_string", "(", "type_", ")", ":", "if", "utils", ".", "is_str", "(", "type_", ")", ":", "return", "type_", "in", "string_equivalences", "type_", "=", "remove_alias", "(", "type_", ")", "type_", "=", "remove_reference", "(", "type_", ")", "typ...
Returns True, if type represents C++ `std::string`, False otherwise.
[ "Returns", "True", "if", "type", "represents", "C", "++", "std", "::", "string", "False", "otherwise", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L512-L524
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_std_wstring
def is_std_wstring(type_): """ Returns True, if type represents C++ `std::wstring`, False otherwise. """ if utils.is_str(type_): return type_ in wstring_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string i...
python
def is_std_wstring(type_): """ Returns True, if type represents C++ `std::wstring`, False otherwise. """ if utils.is_str(type_): return type_ in wstring_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string i...
[ "def", "is_std_wstring", "(", "type_", ")", ":", "if", "utils", ".", "is_str", "(", "type_", ")", ":", "return", "type_", "in", "wstring_equivalences", "type_", "=", "remove_alias", "(", "type_", ")", "type_", "=", "remove_reference", "(", "type_", ")", "t...
Returns True, if type represents C++ `std::wstring`, False otherwise.
[ "Returns", "True", "if", "type", "represents", "C", "++", "std", "::", "wstring", "False", "otherwise", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L527-L539
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_std_ostream
def is_std_ostream(type_): """ Returns True, if type represents C++ std::ostream, False otherwise. """ if utils.is_str(type_): return type_ in ostream_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string in ...
python
def is_std_ostream(type_): """ Returns True, if type represents C++ std::ostream, False otherwise. """ if utils.is_str(type_): return type_ in ostream_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string in ...
[ "def", "is_std_ostream", "(", "type_", ")", ":", "if", "utils", ".", "is_str", "(", "type_", ")", ":", "return", "type_", "in", "ostream_equivalences", "type_", "=", "remove_alias", "(", "type_", ")", "type_", "=", "remove_reference", "(", "type_", ")", "t...
Returns True, if type represents C++ std::ostream, False otherwise.
[ "Returns", "True", "if", "type", "represents", "C", "++", "std", "::", "ostream", "False", "otherwise", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L542-L554
gccxml/pygccxml
pygccxml/declarations/type_traits.py
is_std_wostream
def is_std_wostream(type_): """ Returns True, if type represents C++ std::wostream, False otherwise. """ if utils.is_str(type_): return type_ in wostream_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string ...
python
def is_std_wostream(type_): """ Returns True, if type represents C++ std::wostream, False otherwise. """ if utils.is_str(type_): return type_ in wostream_equivalences type_ = remove_alias(type_) type_ = remove_reference(type_) type_ = remove_cv(type_) return type_.decl_string ...
[ "def", "is_std_wostream", "(", "type_", ")", ":", "if", "utils", ".", "is_str", "(", "type_", ")", ":", "return", "type_", "in", "wostream_equivalences", "type_", "=", "remove_alias", "(", "type_", ")", "type_", "=", "remove_reference", "(", "type_", ")", ...
Returns True, if type represents C++ std::wostream, False otherwise.
[ "Returns", "True", "if", "type", "represents", "C", "++", "std", "::", "wostream", "False", "otherwise", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L557-L569
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.has_pattern
def has_pattern(self, decl_string): """ Implementation detail """ if self.__begin == "<": # Cleanup parentheses blocks before checking for the pattern # See also the args() method (in this file) for more explanations. decl_string = re.sub("\\s\\(.*?\\...
python
def has_pattern(self, decl_string): """ Implementation detail """ if self.__begin == "<": # Cleanup parentheses blocks before checking for the pattern # See also the args() method (in this file) for more explanations. decl_string = re.sub("\\s\\(.*?\\...
[ "def", "has_pattern", "(", "self", ",", "decl_string", ")", ":", "if", "self", ".", "__begin", "==", "\"<\"", ":", "# Cleanup parentheses blocks before checking for the pattern", "# See also the args() method (in this file) for more explanations.", "decl_string", "=", "re", "...
Implementation detail
[ "Implementation", "detail" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L32-L46
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.name
def name(self, decl_string): """implementation details""" if not self.has_pattern(decl_string): return decl_string args_begin = decl_string.find(self.__begin) return decl_string[0: args_begin].strip()
python
def name(self, decl_string): """implementation details""" if not self.has_pattern(decl_string): return decl_string args_begin = decl_string.find(self.__begin) return decl_string[0: args_begin].strip()
[ "def", "name", "(", "self", ",", "decl_string", ")", ":", "if", "not", "self", ".", "has_pattern", "(", "decl_string", ")", ":", "return", "decl_string", "args_begin", "=", "decl_string", ".", "find", "(", "self", ".", "__begin", ")", "return", "decl_strin...
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L48-L53
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.__find_args_separator
def __find_args_separator(self, decl_string, start_pos): """implementation details""" bracket_depth = 0 for index, ch in enumerate(decl_string[start_pos:]): if ch not in (self.__begin, self.__end, self.__separator): continue # I am interested only in < and > ...
python
def __find_args_separator(self, decl_string, start_pos): """implementation details""" bracket_depth = 0 for index, ch in enumerate(decl_string[start_pos:]): if ch not in (self.__begin, self.__end, self.__separator): continue # I am interested only in < and > ...
[ "def", "__find_args_separator", "(", "self", ",", "decl_string", ",", "start_pos", ")", ":", "bracket_depth", "=", "0", "for", "index", ",", "ch", "in", "enumerate", "(", "decl_string", "[", "start_pos", ":", "]", ")", ":", "if", "ch", "not", "in", "(", ...
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L55-L70
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.args
def args(self, decl_string): """ Extracts a list of arguments from the provided declaration string. Implementation detail. Example usages: Input: myClass<std::vector<int>, std::vector<double>> Output: [std::vector<int>, std::vector<double>] Args: decl_string ...
python
def args(self, decl_string): """ Extracts a list of arguments from the provided declaration string. Implementation detail. Example usages: Input: myClass<std::vector<int>, std::vector<double>> Output: [std::vector<int>, std::vector<double>] Args: decl_string ...
[ "def", "args", "(", "self", ",", "decl_string", ")", ":", "args_begin", "=", "decl_string", ".", "find", "(", "self", ".", "__begin", ")", "args_end", "=", "decl_string", ".", "rfind", "(", "self", ".", "__end", ")", "if", "-", "1", "in", "(", "args_...
Extracts a list of arguments from the provided declaration string. Implementation detail. Example usages: Input: myClass<std::vector<int>, std::vector<double>> Output: [std::vector<int>, std::vector<double>] Args: decl_string (str): the full declaration string Retur...
[ "Extracts", "a", "list", "of", "arguments", "from", "the", "provided", "declaration", "string", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L72-L150
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.find_args
def find_args(self, text, start=None): """implementation details""" if start is None: start = 0 first_occurance = text.find(self.__begin, start) if first_occurance == -1: return self.NOT_FOUND previous_found, found = first_occurance + 1, 0 while Tr...
python
def find_args(self, text, start=None): """implementation details""" if start is None: start = 0 first_occurance = text.find(self.__begin, start) if first_occurance == -1: return self.NOT_FOUND previous_found, found = first_occurance + 1, 0 while Tr...
[ "def", "find_args", "(", "self", ",", "text", ",", "start", "=", "None", ")", ":", "if", "start", "is", "None", ":", "start", "=", "0", "first_occurance", "=", "text", ".", "find", "(", "self", ".", "__begin", ",", "start", ")", "if", "first_occuranc...
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L155-L170
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.split
def split(self, decl_string): """implementation details""" assert self.has_pattern(decl_string) return self.name(decl_string), self.args(decl_string)
python
def split(self, decl_string): """implementation details""" assert self.has_pattern(decl_string) return self.name(decl_string), self.args(decl_string)
[ "def", "split", "(", "self", ",", "decl_string", ")", ":", "assert", "self", ".", "has_pattern", "(", "decl_string", ")", "return", "self", ".", "name", "(", "decl_string", ")", ",", "self", ".", "args", "(", "decl_string", ")" ]
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L172-L175
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.split_recursive
def split_recursive(self, decl_string): """implementation details""" assert self.has_pattern(decl_string) to_go = [decl_string] while to_go: name, args = self.split(to_go.pop()) for arg in args: if self.has_pattern(arg): to_go.a...
python
def split_recursive(self, decl_string): """implementation details""" assert self.has_pattern(decl_string) to_go = [decl_string] while to_go: name, args = self.split(to_go.pop()) for arg in args: if self.has_pattern(arg): to_go.a...
[ "def", "split_recursive", "(", "self", ",", "decl_string", ")", ":", "assert", "self", ".", "has_pattern", "(", "decl_string", ")", "to_go", "=", "[", "decl_string", "]", "while", "to_go", ":", "name", ",", "args", "=", "self", ".", "split", "(", "to_go"...
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L177-L186
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.join
def join(self, name, args, arg_separator=None): """implementation details""" if None is arg_separator: arg_separator = ', ' args = [_f for _f in args if _f] if not args: args_str = ' ' elif len(args) == 1: args_str = ' ' + args[0] + ' ' ...
python
def join(self, name, args, arg_separator=None): """implementation details""" if None is arg_separator: arg_separator = ', ' args = [_f for _f in args if _f] if not args: args_str = ' ' elif len(args) == 1: args_str = ' ' + args[0] + ' ' ...
[ "def", "join", "(", "self", ",", "name", ",", "args", ",", "arg_separator", "=", "None", ")", ":", "if", "None", "is", "arg_separator", ":", "arg_separator", "=", "', '", "args", "=", "[", "_f", "for", "_f", "in", "args", "if", "_f", "]", "if", "no...
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L188-L201
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.normalize
def normalize(self, decl_string, arg_separator=None): """implementation details""" if not self.has_pattern(decl_string): return decl_string name, args = self.split(decl_string) for i, arg in enumerate(args): args[i] = self.normalize(arg) return self.join(n...
python
def normalize(self, decl_string, arg_separator=None): """implementation details""" if not self.has_pattern(decl_string): return decl_string name, args = self.split(decl_string) for i, arg in enumerate(args): args[i] = self.normalize(arg) return self.join(n...
[ "def", "normalize", "(", "self", ",", "decl_string", ",", "arg_separator", "=", "None", ")", ":", "if", "not", "self", ".", "has_pattern", "(", "decl_string", ")", ":", "return", "decl_string", "name", ",", "args", "=", "self", ".", "split", "(", "decl_s...
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L203-L210
gccxml/pygccxml
pygccxml/declarations/has_operator_matcher.py
has_public_binary_operator
def has_public_binary_operator(type_, operator_symbol): """returns True, if `type_` has public binary operator, otherwise False""" type_ = type_traits.remove_alias(type_) type_ = type_traits.remove_cv(type_) type_ = type_traits.remove_declarated(type_) assert isinstance(type_, class_declaration.clas...
python
def has_public_binary_operator(type_, operator_symbol): """returns True, if `type_` has public binary operator, otherwise False""" type_ = type_traits.remove_alias(type_) type_ = type_traits.remove_cv(type_) type_ = type_traits.remove_declarated(type_) assert isinstance(type_, class_declaration.clas...
[ "def", "has_public_binary_operator", "(", "type_", ",", "operator_symbol", ")", ":", "type_", "=", "type_traits", ".", "remove_alias", "(", "type_", ")", "type_", "=", "type_traits", ".", "remove_cv", "(", "type_", ")", "type_", "=", "type_traits", ".", "remov...
returns True, if `type_` has public binary operator, otherwise False
[ "returns", "True", "if", "type_", "has", "public", "binary", "operator", "otherwise", "False" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/has_operator_matcher.py#L7-L49
gccxml/pygccxml
pygccxml/declarations/pointer_traits.py
_search_in_bases
def _search_in_bases(type_): """Implementation detail.""" found = False for base_type in type_.declaration.bases: try: found = internal_type_traits.get_by_name( base_type.related_class, "element_type") except runtime_errors.declaration_not_found_t: pas...
python
def _search_in_bases(type_): """Implementation detail.""" found = False for base_type in type_.declaration.bases: try: found = internal_type_traits.get_by_name( base_type.related_class, "element_type") except runtime_errors.declaration_not_found_t: pas...
[ "def", "_search_in_bases", "(", "type_", ")", ":", "found", "=", "False", "for", "base_type", "in", "type_", ".", "declaration", ".", "bases", ":", "try", ":", "found", "=", "internal_type_traits", ".", "get_by_name", "(", "base_type", ".", "related_class", ...
Implementation detail.
[ "Implementation", "detail", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pointer_traits.py#L116-L129
gccxml/pygccxml
pygccxml/declarations/pointer_traits.py
smart_pointer_traits.is_smart_pointer
def is_smart_pointer(type_): """returns True, if type represents instantiation of `boost::shared_ptr` or `std::shared_ptr`, False otherwise""" type_ = type_traits.remove_alias(type_) type_ = type_traits.remove_cv(type_) type_ = type_traits.remove_declarated(type_) if not ...
python
def is_smart_pointer(type_): """returns True, if type represents instantiation of `boost::shared_ptr` or `std::shared_ptr`, False otherwise""" type_ = type_traits.remove_alias(type_) type_ = type_traits.remove_cv(type_) type_ = type_traits.remove_declarated(type_) if not ...
[ "def", "is_smart_pointer", "(", "type_", ")", ":", "type_", "=", "type_traits", ".", "remove_alias", "(", "type_", ")", "type_", "=", "type_traits", ".", "remove_cv", "(", "type_", ")", "type_", "=", "type_traits", ".", "remove_declarated", "(", "type_", ")"...
returns True, if type represents instantiation of `boost::shared_ptr` or `std::shared_ptr`, False otherwise
[ "returns", "True", "if", "type", "represents", "instantiation", "of", "boost", "::", "shared_ptr", "or", "std", "::", "shared_ptr", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pointer_traits.py#L48-L65
gccxml/pygccxml
pygccxml/declarations/pointer_traits.py
smart_pointer_traits.value_type
def value_type(type_): """returns reference to `boost::shared_ptr` \ or `std::shared_ptr` value type""" if not smart_pointer_traits.is_smart_pointer(type_): raise TypeError( 'Type "%s" is not an instantiation of \ boost::shared_ptr or std::shared_ptr' ...
python
def value_type(type_): """returns reference to `boost::shared_ptr` \ or `std::shared_ptr` value type""" if not smart_pointer_traits.is_smart_pointer(type_): raise TypeError( 'Type "%s" is not an instantiation of \ boost::shared_ptr or std::shared_ptr' ...
[ "def", "value_type", "(", "type_", ")", ":", "if", "not", "smart_pointer_traits", ".", "is_smart_pointer", "(", "type_", ")", ":", "raise", "TypeError", "(", "'Type \"%s\" is not an instantiation of \\\n boost::shared_ptr or std::shared_ptr'", "%", "type_", "...
returns reference to `boost::shared_ptr` \ or `std::shared_ptr` value type
[ "returns", "reference", "to", "boost", "::", "shared_ptr", "\\", "or", "std", "::", "shared_ptr", "value", "type" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pointer_traits.py#L68-L79
gccxml/pygccxml
pygccxml/declarations/traits_impl_details.py
impl_details.is_defined_in_xxx
def is_defined_in_xxx(xxx, cls): """ Small helper method that checks whether the class `cls` is defined under `::xxx` namespace """ if not cls.parent: return False if not isinstance(cls.parent, namespace.namespace_t): return False if xxx ...
python
def is_defined_in_xxx(xxx, cls): """ Small helper method that checks whether the class `cls` is defined under `::xxx` namespace """ if not cls.parent: return False if not isinstance(cls.parent, namespace.namespace_t): return False if xxx ...
[ "def", "is_defined_in_xxx", "(", "xxx", ",", "cls", ")", ":", "if", "not", "cls", ".", "parent", ":", "return", "False", "if", "not", "isinstance", "(", "cls", ".", "parent", ",", "namespace", ".", "namespace_t", ")", ":", "return", "False", "if", "xxx...
Small helper method that checks whether the class `cls` is defined under `::xxx` namespace
[ "Small", "helper", "method", "that", "checks", "whether", "the", "class", "cls", "is", "defined", "under", "::", "xxx", "namespace" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/traits_impl_details.py#L17-L42
gccxml/pygccxml
pygccxml/declarations/traits_impl_details.py
impl_details.find_value_type
def find_value_type(global_ns, value_type_str): """implementation details""" if not value_type_str.startswith('::'): value_type_str = '::' + value_type_str found = global_ns.decls( name=value_type_str, function=lambda decl: not isinstance(decl, calldef.calldef...
python
def find_value_type(global_ns, value_type_str): """implementation details""" if not value_type_str.startswith('::'): value_type_str = '::' + value_type_str found = global_ns.decls( name=value_type_str, function=lambda decl: not isinstance(decl, calldef.calldef...
[ "def", "find_value_type", "(", "global_ns", ",", "value_type_str", ")", ":", "if", "not", "value_type_str", ".", "startswith", "(", "'::'", ")", ":", "value_type_str", "=", "'::'", "+", "value_type_str", "found", "=", "global_ns", ".", "decls", "(", "name", ...
implementation details
[ "implementation", "details" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/traits_impl_details.py#L45-L88
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t.update
def update(self, source_file, configuration, declarations, included_files): """Replace a cache entry by a new value. :param source_file: a C++ source file name. :type source_file: str :param configuration: configuration object. :type configuration: :class:`xml_generator_configu...
python
def update(self, source_file, configuration, declarations, included_files): """Replace a cache entry by a new value. :param source_file: a C++ source file name. :type source_file: str :param configuration: configuration object. :type configuration: :class:`xml_generator_configu...
[ "def", "update", "(", "self", ",", "source_file", ",", "configuration", ",", "declarations", ",", "included_files", ")", ":", "# Normlize all paths...", "source_file", "=", "os", ".", "path", ".", "normpath", "(", "source_file", ")", "included_files", "=", "[", ...
Replace a cache entry by a new value. :param source_file: a C++ source file name. :type source_file: str :param configuration: configuration object. :type configuration: :class:`xml_generator_configuration_t` :param declarations: declarations contained in the `source_file` ...
[ "Replace", "a", "cache", "entry", "by", "a", "new", "value", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L127-L171
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t.cached_value
def cached_value(self, source_file, configuration): """Return the cached declarations or None. :param source_file: Header file name :type source_file: str :param configuration: Configuration object :type configuration: :class:`parser.xml_generator_configuration_t` :rtype...
python
def cached_value(self, source_file, configuration): """Return the cached declarations or None. :param source_file: Header file name :type source_file: str :param configuration: Configuration object :type configuration: :class:`parser.xml_generator_configuration_t` :rtype...
[ "def", "cached_value", "(", "self", ",", "source_file", ",", "configuration", ")", ":", "# Check if the cache contains an entry for source_file", "key", "=", "self", ".", "_create_cache_key", "(", "source_file", ")", "entry", "=", "self", ".", "__index", ".", "get",...
Return the cached declarations or None. :param source_file: Header file name :type source_file: str :param configuration: Configuration object :type configuration: :class:`parser.xml_generator_configuration_t` :rtype: Cached declarations or None
[ "Return", "the", "cached", "declarations", "or", "None", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L173-L217
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t._load
def _load(self): """Load the cache. Loads the `index.dat` file, which contains the index table and the file name repository. This method is called by the :meth:`__init__` """ indexfilename = os.path.join(self.__dir, "index.dat") if os.path.exists(indexfilename)...
python
def _load(self): """Load the cache. Loads the `index.dat` file, which contains the index table and the file name repository. This method is called by the :meth:`__init__` """ indexfilename = os.path.join(self.__dir, "index.dat") if os.path.exists(indexfilename)...
[ "def", "_load", "(", "self", ")", ":", "indexfilename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "__dir", ",", "\"index.dat\"", ")", "if", "os", ".", "path", ".", "exists", "(", "indexfilename", ")", ":", "data", "=", "self", ".", "_r...
Load the cache. Loads the `index.dat` file, which contains the index table and the file name repository. This method is called by the :meth:`__init__`
[ "Load", "the", "cache", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L219-L243
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t._save
def _save(self): """ save the cache index, in case it was modified. Saves the index table and the file name repository in the file `index.dat` """ if self.__modified_flag: self.__filename_rep.update_id_counter() indexfilename = os.path.join(self....
python
def _save(self): """ save the cache index, in case it was modified. Saves the index table and the file name repository in the file `index.dat` """ if self.__modified_flag: self.__filename_rep.update_id_counter() indexfilename = os.path.join(self....
[ "def", "_save", "(", "self", ")", ":", "if", "self", ".", "__modified_flag", ":", "self", ".", "__filename_rep", ".", "update_id_counter", "(", ")", "indexfilename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "__dir", ",", "\"index.dat\"", ")...
save the cache index, in case it was modified. Saves the index table and the file name repository in the file `index.dat`
[ "save", "the", "cache", "index", "in", "case", "it", "was", "modified", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L245-L261
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t._read_file
def _read_file(self, filename): """ read a Python object from a cache file. Reads a pickled object from disk and returns it. :param filename: Name of the file that should be read. :type filename: str :rtype: object """ if self.__compression: ...
python
def _read_file(self, filename): """ read a Python object from a cache file. Reads a pickled object from disk and returns it. :param filename: Name of the file that should be read. :type filename: str :rtype: object """ if self.__compression: ...
[ "def", "_read_file", "(", "self", ",", "filename", ")", ":", "if", "self", ".", "__compression", ":", "f", "=", "gzip", ".", "GzipFile", "(", "filename", ",", "\"rb\"", ")", "else", ":", "f", "=", "open", "(", "filename", ",", "\"rb\"", ")", "res", ...
read a Python object from a cache file. Reads a pickled object from disk and returns it. :param filename: Name of the file that should be read. :type filename: str :rtype: object
[ "read", "a", "Python", "object", "from", "a", "cache", "file", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L263-L280
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t._write_file
def _write_file(self, filename, data): """Write a data item into a file. The data object is written to a file using the pickle mechanism. :param filename: Output file name :type filename: str :param data: A Python object that will be pickled """ if self.__compr...
python
def _write_file(self, filename, data): """Write a data item into a file. The data object is written to a file using the pickle mechanism. :param filename: Output file name :type filename: str :param data: A Python object that will be pickled """ if self.__compr...
[ "def", "_write_file", "(", "self", ",", "filename", ",", "data", ")", ":", "if", "self", ".", "__compression", ":", "f", "=", "gzip", ".", "GzipFile", "(", "filename", ",", "\"wb\"", ")", "else", ":", "f", "=", "open", "(", "filename", ",", "\"wb\"",...
Write a data item into a file. The data object is written to a file using the pickle mechanism. :param filename: Output file name :type filename: str :param data: A Python object that will be pickled
[ "Write", "a", "data", "item", "into", "a", "file", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L282-L297
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t._remove_entry
def _remove_entry(self, source_file, key): """Remove an entry from the cache. source_file is the name of the header and key is its corresponding cache key (obtained by a call to :meth:_create_cache_key ). The entry is removed from the index table, any referenced file name is rel...
python
def _remove_entry(self, source_file, key): """Remove an entry from the cache. source_file is the name of the header and key is its corresponding cache key (obtained by a call to :meth:_create_cache_key ). The entry is removed from the index table, any referenced file name is rel...
[ "def", "_remove_entry", "(", "self", ",", "source_file", ",", "key", ")", ":", "entry", "=", "self", ".", "__index", ".", "get", "(", "key", ")", "if", "entry", "is", "None", ":", "return", "# Release the referenced files...", "for", "id_", ",", "_", "in...
Remove an entry from the cache. source_file is the name of the header and key is its corresponding cache key (obtained by a call to :meth:_create_cache_key ). The entry is removed from the index table, any referenced file name is released and the cache file is deleted. If key r...
[ "Remove", "an", "entry", "from", "the", "cache", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L299-L333
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t._create_cache_key
def _create_cache_key(source_file): """ return the cache key for a header file. :param source_file: Header file name :type source_file: str :rtype: str """ path, name = os.path.split(source_file) return name + str(hash(path))
python
def _create_cache_key(source_file): """ return the cache key for a header file. :param source_file: Header file name :type source_file: str :rtype: str """ path, name = os.path.split(source_file) return name + str(hash(path))
[ "def", "_create_cache_key", "(", "source_file", ")", ":", "path", ",", "name", "=", "os", ".", "path", ".", "split", "(", "source_file", ")", "return", "name", "+", "str", "(", "hash", "(", "path", ")", ")" ]
return the cache key for a header file. :param source_file: Header file name :type source_file: str :rtype: str
[ "return", "the", "cache", "key", "for", "a", "header", "file", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L336-L345
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t._create_cache_filename
def _create_cache_filename(self, source_file): """ return the cache file name for a header file. :param source_file: Header file name :type source_file: str :rtype: str """ res = self._create_cache_key(source_file) + ".cache" return os.path.join(self.__di...
python
def _create_cache_filename(self, source_file): """ return the cache file name for a header file. :param source_file: Header file name :type source_file: str :rtype: str """ res = self._create_cache_key(source_file) + ".cache" return os.path.join(self.__di...
[ "def", "_create_cache_filename", "(", "self", ",", "source_file", ")", ":", "res", "=", "self", ".", "_create_cache_key", "(", "source_file", ")", "+", "\".cache\"", "return", "os", ".", "path", ".", "join", "(", "self", ".", "__dir", ",", "res", ")" ]
return the cache file name for a header file. :param source_file: Header file name :type source_file: str :rtype: str
[ "return", "the", "cache", "file", "name", "for", "a", "header", "file", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L347-L356
gccxml/pygccxml
pygccxml/parser/directory_cache.py
directory_cache_t._create_config_signature
def _create_config_signature(config): """ return the signature for a config object. The signature is computed as sha1 digest of the contents of working_directory, include_paths, define_symbols and undefine_symbols. :param config: Configuration object :type confi...
python
def _create_config_signature(config): """ return the signature for a config object. The signature is computed as sha1 digest of the contents of working_directory, include_paths, define_symbols and undefine_symbols. :param config: Configuration object :type confi...
[ "def", "_create_config_signature", "(", "config", ")", ":", "m", "=", "hashlib", ".", "sha1", "(", ")", "m", ".", "update", "(", "config", ".", "working_directory", ".", "encode", "(", "\"utf-8\"", ")", ")", "for", "p", "in", "config", ".", "include_path...
return the signature for a config object. The signature is computed as sha1 digest of the contents of working_directory, include_paths, define_symbols and undefine_symbols. :param config: Configuration object :type config: :class:`parser.xml_generator_configuration_t` :...
[ "return", "the", "signature", "for", "a", "config", "object", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L359-L381
gccxml/pygccxml
pygccxml/parser/directory_cache.py
filename_repository_t.acquire_filename
def acquire_filename(self, name): """Acquire a file name and return its id and its signature. """ id_ = self.__id_lut.get(name) # Is this a new entry? if id_ is None: # then create one... id_ = self.__next_id self.__next_id += 1 se...
python
def acquire_filename(self, name): """Acquire a file name and return its id and its signature. """ id_ = self.__id_lut.get(name) # Is this a new entry? if id_ is None: # then create one... id_ = self.__next_id self.__next_id += 1 se...
[ "def", "acquire_filename", "(", "self", ",", "name", ")", ":", "id_", "=", "self", ".", "__id_lut", ".", "get", "(", "name", ")", "# Is this a new entry?", "if", "id_", "is", "None", ":", "# then create one...", "id_", "=", "self", ".", "__next_id", "self"...
Acquire a file name and return its id and its signature.
[ "Acquire", "a", "file", "name", "and", "return", "its", "id", "and", "its", "signature", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L466-L484
gccxml/pygccxml
pygccxml/parser/directory_cache.py
filename_repository_t.release_filename
def release_filename(self, id_): """Release a file name. """ entry = self.__entries.get(id_) if entry is None: raise ValueError("Invalid filename id (%d)" % id_) # Decrease reference count and check if the entry has to be removed... if entry.dec_ref_count() ...
python
def release_filename(self, id_): """Release a file name. """ entry = self.__entries.get(id_) if entry is None: raise ValueError("Invalid filename id (%d)" % id_) # Decrease reference count and check if the entry has to be removed... if entry.dec_ref_count() ...
[ "def", "release_filename", "(", "self", ",", "id_", ")", ":", "entry", "=", "self", ".", "__entries", ".", "get", "(", "id_", ")", "if", "entry", "is", "None", ":", "raise", "ValueError", "(", "\"Invalid filename id (%d)\"", "%", "id_", ")", "# Decrease re...
Release a file name.
[ "Release", "a", "file", "name", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L486-L497
gccxml/pygccxml
pygccxml/parser/directory_cache.py
filename_repository_t.is_file_modified
def is_file_modified(self, id_, signature): """Check if the file referred to by `id_` has been modified. """ entry = self.__entries.get(id_) if entry is None: raise ValueError("Invalid filename id_ (%d)" % id_) # Is the signature already known? if entry.sig_...
python
def is_file_modified(self, id_, signature): """Check if the file referred to by `id_` has been modified. """ entry = self.__entries.get(id_) if entry is None: raise ValueError("Invalid filename id_ (%d)" % id_) # Is the signature already known? if entry.sig_...
[ "def", "is_file_modified", "(", "self", ",", "id_", ",", "signature", ")", ":", "entry", "=", "self", ".", "__entries", ".", "get", "(", "id_", ")", "if", "entry", "is", "None", ":", "raise", "ValueError", "(", "\"Invalid filename id_ (%d)\"", "%", "id_", ...
Check if the file referred to by `id_` has been modified.
[ "Check", "if", "the", "file", "referred", "to", "by", "id_", "has", "been", "modified", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L499-L517
gccxml/pygccxml
pygccxml/parser/directory_cache.py
filename_repository_t.update_id_counter
def update_id_counter(self): """Update the `id_` counter so that it doesn't grow forever. """ if not self.__entries: self.__next_id = 1 else: self.__next_id = max(self.__entries.keys()) + 1
python
def update_id_counter(self): """Update the `id_` counter so that it doesn't grow forever. """ if not self.__entries: self.__next_id = 1 else: self.__next_id = max(self.__entries.keys()) + 1
[ "def", "update_id_counter", "(", "self", ")", ":", "if", "not", "self", ".", "__entries", ":", "self", ".", "__next_id", "=", "1", "else", ":", "self", ".", "__next_id", "=", "max", "(", "self", ".", "__entries", ".", "keys", "(", ")", ")", "+", "1...
Update the `id_` counter so that it doesn't grow forever.
[ "Update", "the", "id_", "counter", "so", "that", "it", "doesn", "t", "grow", "forever", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L519-L526
gccxml/pygccxml
pygccxml/parser/directory_cache.py
filename_repository_t._get_signature
def _get_signature(self, entry): """Return the signature of the file stored in entry. """ if self._sha1_sigs: # return sha1 digest of the file content... if not os.path.exists(entry.filename): return None try: with open(entry.f...
python
def _get_signature(self, entry): """Return the signature of the file stored in entry. """ if self._sha1_sigs: # return sha1 digest of the file content... if not os.path.exists(entry.filename): return None try: with open(entry.f...
[ "def", "_get_signature", "(", "self", ",", "entry", ")", ":", "if", "self", ".", "_sha1_sigs", ":", "# return sha1 digest of the file content...", "if", "not", "os", ".", "path", ".", "exists", "(", "entry", ".", "filename", ")", ":", "return", "None", "try"...
Return the signature of the file stored in entry.
[ "Return", "the", "signature", "of", "the", "file", "stored", "in", "entry", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L528-L548
gccxml/pygccxml
pygccxml/parser/directory_cache.py
filename_repository_t._dump
def _dump(self): # pragma: no cover """ Dump contents for debugging/testing. """ print(70 * "-") print("ID lookup table:") for name in self.__id_lut: id_ = self.__id_lut[name] print(" %s -> %d" % (name, id_)) print(70 * "-") pri...
python
def _dump(self): # pragma: no cover """ Dump contents for debugging/testing. """ print(70 * "-") print("ID lookup table:") for name in self.__id_lut: id_ = self.__id_lut[name] print(" %s -> %d" % (name, id_)) print(70 * "-") pri...
[ "def", "_dump", "(", "self", ")", ":", "# pragma: no cover", "print", "(", "70", "*", "\"-\"", ")", "print", "(", "\"ID lookup table:\"", ")", "for", "name", "in", "self", ".", "__id_lut", ":", "id_", "=", "self", ".", "__id_lut", "[", "name", "]", "pr...
Dump contents for debugging/testing.
[ "Dump", "contents", "for", "debugging", "/", "testing", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L550-L566
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
is_union
def is_union(declaration): """ Returns True if declaration represents a C++ union Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ union """ if not is_class(declaration): return False decl = class_...
python
def is_union(declaration): """ Returns True if declaration represents a C++ union Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ union """ if not is_class(declaration): return False decl = class_...
[ "def", "is_union", "(", "declaration", ")", ":", "if", "not", "is_class", "(", "declaration", ")", ":", "return", "False", "decl", "=", "class_traits", ".", "get_declaration", "(", "declaration", ")", "return", "decl", ".", "class_type", "==", "class_declarati...
Returns True if declaration represents a C++ union Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ union
[ "Returns", "True", "if", "declaration", "represents", "a", "C", "++", "union" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L18-L31
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
is_struct
def is_struct(declaration): """ Returns True if declaration represents a C++ struct Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ struct """ if not is_class(declaration): return False decl = cla...
python
def is_struct(declaration): """ Returns True if declaration represents a C++ struct Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ struct """ if not is_class(declaration): return False decl = cla...
[ "def", "is_struct", "(", "declaration", ")", ":", "if", "not", "is_class", "(", "declaration", ")", ":", "return", "False", "decl", "=", "class_traits", ".", "get_declaration", "(", "declaration", ")", "return", "decl", ".", "class_type", "==", "class_declarat...
Returns True if declaration represents a C++ struct Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ struct
[ "Returns", "True", "if", "declaration", "represents", "a", "C", "++", "struct" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L34-L47
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
find_trivial_constructor
def find_trivial_constructor(type_): """ Returns reference to trivial constructor. Args: type_ (declarations.class_t): the class to be searched. Returns: declarations.constructor_t: the trivial constructor """ assert isinstance(type_, class_declaration.class_t) trivial = ...
python
def find_trivial_constructor(type_): """ Returns reference to trivial constructor. Args: type_ (declarations.class_t): the class to be searched. Returns: declarations.constructor_t: the trivial constructor """ assert isinstance(type_, class_declaration.class_t) trivial = ...
[ "def", "find_trivial_constructor", "(", "type_", ")", ":", "assert", "isinstance", "(", "type_", ",", "class_declaration", ".", "class_t", ")", "trivial", "=", "type_", ".", "constructors", "(", "lambda", "x", ":", "is_trivial_constructor", "(", "x", ")", ",",...
Returns reference to trivial constructor. Args: type_ (declarations.class_t): the class to be searched. Returns: declarations.constructor_t: the trivial constructor
[ "Returns", "reference", "to", "trivial", "constructor", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L111-L131
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
find_copy_constructor
def find_copy_constructor(type_): """ Returns reference to copy constructor. Args: type_ (declarations.class_t): the class to be searched. Returns: declarations.constructor_t: the copy constructor """ copy_ = type_.constructors( lambda x: is_copy_constructor(x), ...
python
def find_copy_constructor(type_): """ Returns reference to copy constructor. Args: type_ (declarations.class_t): the class to be searched. Returns: declarations.constructor_t: the copy constructor """ copy_ = type_.constructors( lambda x: is_copy_constructor(x), ...
[ "def", "find_copy_constructor", "(", "type_", ")", ":", "copy_", "=", "type_", ".", "constructors", "(", "lambda", "x", ":", "is_copy_constructor", "(", "x", ")", ",", "recursive", "=", "False", ",", "allow_empty", "=", "True", ")", "if", "copy_", ":", "...
Returns reference to copy constructor. Args: type_ (declarations.class_t): the class to be searched. Returns: declarations.constructor_t: the copy constructor
[ "Returns", "reference", "to", "copy", "constructor", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L134-L152
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
find_noncopyable_vars
def find_noncopyable_vars(class_type, already_visited_cls_vars=None): """ Returns list of all `noncopyable` variables. If an already_visited_cls_vars list is provided as argument, the returned list will not contain these variables. This list will be extended with whatever variables pointing to clas...
python
def find_noncopyable_vars(class_type, already_visited_cls_vars=None): """ Returns list of all `noncopyable` variables. If an already_visited_cls_vars list is provided as argument, the returned list will not contain these variables. This list will be extended with whatever variables pointing to clas...
[ "def", "find_noncopyable_vars", "(", "class_type", ",", "already_visited_cls_vars", "=", "None", ")", ":", "assert", "isinstance", "(", "class_type", ",", "class_declaration", ".", "class_t", ")", "logger", "=", "utils", ".", "loggers", ".", "cxx_parser", "mvars",...
Returns list of all `noncopyable` variables. If an already_visited_cls_vars list is provided as argument, the returned list will not contain these variables. This list will be extended with whatever variables pointing to classes have been found. Args: class_type (declarations.class_t): the cla...
[ "Returns", "list", "of", "all", "noncopyable", "variables", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L155-L228
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
has_trivial_constructor
def has_trivial_constructor(class_): """if class has public trivial constructor, this function will return reference to it, None otherwise""" class_ = class_traits.get_declaration(class_) trivial = find_trivial_constructor(class_) if trivial and trivial.access_type == 'public': return trivia...
python
def has_trivial_constructor(class_): """if class has public trivial constructor, this function will return reference to it, None otherwise""" class_ = class_traits.get_declaration(class_) trivial = find_trivial_constructor(class_) if trivial and trivial.access_type == 'public': return trivia...
[ "def", "has_trivial_constructor", "(", "class_", ")", ":", "class_", "=", "class_traits", ".", "get_declaration", "(", "class_", ")", "trivial", "=", "find_trivial_constructor", "(", "class_", ")", "if", "trivial", "and", "trivial", ".", "access_type", "==", "'p...
if class has public trivial constructor, this function will return reference to it, None otherwise
[ "if", "class", "has", "public", "trivial", "constructor", "this", "function", "will", "return", "reference", "to", "it", "None", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L231-L237
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
has_copy_constructor
def has_copy_constructor(class_): """if class has public copy constructor, this function will return reference to it, None otherwise""" class_ = class_traits.get_declaration(class_) copy_constructor = find_copy_constructor(class_) if copy_constructor and copy_constructor.access_type == 'public': ...
python
def has_copy_constructor(class_): """if class has public copy constructor, this function will return reference to it, None otherwise""" class_ = class_traits.get_declaration(class_) copy_constructor = find_copy_constructor(class_) if copy_constructor and copy_constructor.access_type == 'public': ...
[ "def", "has_copy_constructor", "(", "class_", ")", ":", "class_", "=", "class_traits", ".", "get_declaration", "(", "class_", ")", "copy_constructor", "=", "find_copy_constructor", "(", "class_", ")", "if", "copy_constructor", "and", "copy_constructor", ".", "access...
if class has public copy constructor, this function will return reference to it, None otherwise
[ "if", "class", "has", "public", "copy", "constructor", "this", "function", "will", "return", "reference", "to", "it", "None", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L240-L246
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
has_destructor
def has_destructor(class_): """if class has destructor, this function will return reference to it, None otherwise""" class_ = class_traits.get_declaration(class_) destructor = class_.decls( decl_type=calldef_members.destructor_t, recursive=False, allow_empty=True) if destruct...
python
def has_destructor(class_): """if class has destructor, this function will return reference to it, None otherwise""" class_ = class_traits.get_declaration(class_) destructor = class_.decls( decl_type=calldef_members.destructor_t, recursive=False, allow_empty=True) if destruct...
[ "def", "has_destructor", "(", "class_", ")", ":", "class_", "=", "class_traits", ".", "get_declaration", "(", "class_", ")", "destructor", "=", "class_", ".", "decls", "(", "decl_type", "=", "calldef_members", ".", "destructor_t", ",", "recursive", "=", "False...
if class has destructor, this function will return reference to it, None otherwise
[ "if", "class", "has", "destructor", "this", "function", "will", "return", "reference", "to", "it", "None", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L249-L258
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
has_public_constructor
def has_public_constructor(class_): """if class has any public constructor, this function will return list of them, otherwise None""" class_ = class_traits.get_declaration(class_) decls = class_.constructors( lambda c: not is_copy_constructor(c) and c.access_type == 'public', recursive=F...
python
def has_public_constructor(class_): """if class has any public constructor, this function will return list of them, otherwise None""" class_ = class_traits.get_declaration(class_) decls = class_.constructors( lambda c: not is_copy_constructor(c) and c.access_type == 'public', recursive=F...
[ "def", "has_public_constructor", "(", "class_", ")", ":", "class_", "=", "class_traits", ".", "get_declaration", "(", "class_", ")", "decls", "=", "class_", ".", "constructors", "(", "lambda", "c", ":", "not", "is_copy_constructor", "(", "c", ")", "and", "c"...
if class has any public constructor, this function will return list of them, otherwise None
[ "if", "class", "has", "any", "public", "constructor", "this", "function", "will", "return", "list", "of", "them", "otherwise", "None" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L261-L270
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
has_public_assign
def has_public_assign(class_): """returns True, if class has public assign operator, False otherwise""" class_ = class_traits.get_declaration(class_) decls = class_.member_operators( lambda o: o.symbol == '=' and o.access_type == 'public', recursive=False, allow_empty=True) retur...
python
def has_public_assign(class_): """returns True, if class has public assign operator, False otherwise""" class_ = class_traits.get_declaration(class_) decls = class_.member_operators( lambda o: o.symbol == '=' and o.access_type == 'public', recursive=False, allow_empty=True) retur...
[ "def", "has_public_assign", "(", "class_", ")", ":", "class_", "=", "class_traits", ".", "get_declaration", "(", "class_", ")", "decls", "=", "class_", ".", "member_operators", "(", "lambda", "o", ":", "o", ".", "symbol", "==", "'='", "and", "o", ".", "a...
returns True, if class has public assign operator, False otherwise
[ "returns", "True", "if", "class", "has", "public", "assign", "operator", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L273-L280
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
has_vtable
def has_vtable(decl_type): """True, if class has virtual table, False otherwise""" assert isinstance(decl_type, class_declaration.class_t) return bool( decl_type.calldefs( lambda f: isinstance(f, calldef_members.member_function_t) and f.virtuality != calldef_types.VIRTUALITY_...
python
def has_vtable(decl_type): """True, if class has virtual table, False otherwise""" assert isinstance(decl_type, class_declaration.class_t) return bool( decl_type.calldefs( lambda f: isinstance(f, calldef_members.member_function_t) and f.virtuality != calldef_types.VIRTUALITY_...
[ "def", "has_vtable", "(", "decl_type", ")", ":", "assert", "isinstance", "(", "decl_type", ",", "class_declaration", ".", "class_t", ")", "return", "bool", "(", "decl_type", ".", "calldefs", "(", "lambda", "f", ":", "isinstance", "(", "f", ",", "calldef_memb...
True, if class has virtual table, False otherwise
[ "True", "if", "class", "has", "virtual", "table", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L289-L297
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
is_base_and_derived
def is_base_and_derived(based, derived): """returns True, if there is "base and derived" relationship between classes, False otherwise""" assert isinstance(based, class_declaration.class_t) assert isinstance(derived, (class_declaration.class_t, tuple)) if isinstance(derived, class_declaration.class...
python
def is_base_and_derived(based, derived): """returns True, if there is "base and derived" relationship between classes, False otherwise""" assert isinstance(based, class_declaration.class_t) assert isinstance(derived, (class_declaration.class_t, tuple)) if isinstance(derived, class_declaration.class...
[ "def", "is_base_and_derived", "(", "based", ",", "derived", ")", ":", "assert", "isinstance", "(", "based", ",", "class_declaration", ".", "class_t", ")", "assert", "isinstance", "(", "derived", ",", "(", "class_declaration", ".", "class_t", ",", "tuple", ")",...
returns True, if there is "base and derived" relationship between classes, False otherwise
[ "returns", "True", "if", "there", "is", "base", "and", "derived", "relationship", "between", "classes", "False", "otherwise" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L300-L315
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
__is_noncopyable_single
def __is_noncopyable_single(class_, already_visited_cls_vars=None): """ Implementation detail. Checks if the class is non copyable, without considering the base classes. Args: class_ (declarations.class_t): the class to be checked already_visited_cls_vars (list): optional list of vars ...
python
def __is_noncopyable_single(class_, already_visited_cls_vars=None): """ Implementation detail. Checks if the class is non copyable, without considering the base classes. Args: class_ (declarations.class_t): the class to be checked already_visited_cls_vars (list): optional list of vars ...
[ "def", "__is_noncopyable_single", "(", "class_", ",", "already_visited_cls_vars", "=", "None", ")", ":", "# It is not enough to check base classes, we should also to check", "# member variables.", "logger", "=", "utils", ".", "loggers", ".", "cxx_parser", "if", "has_copy_cons...
Implementation detail. Checks if the class is non copyable, without considering the base classes. Args: class_ (declarations.class_t): the class to be checked already_visited_cls_vars (list): optional list of vars that should not be checked a second time, to prevent infinite recurs...
[ "Implementation", "detail", "." ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L662-L705
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
is_noncopyable
def is_noncopyable(class_, already_visited_cls_vars=None): """ Checks if class is non copyable Args: class_ (declarations.class_t): the class to be checked already_visited_cls_vars (list): optional list of vars that should not be checked a second time, to prevent infinite recurs...
python
def is_noncopyable(class_, already_visited_cls_vars=None): """ Checks if class is non copyable Args: class_ (declarations.class_t): the class to be checked already_visited_cls_vars (list): optional list of vars that should not be checked a second time, to prevent infinite recurs...
[ "def", "is_noncopyable", "(", "class_", ",", "already_visited_cls_vars", "=", "None", ")", ":", "logger", "=", "utils", ".", "loggers", ".", "cxx_parser", "class_decl", "=", "class_traits", ".", "get_declaration", "(", "class_", ")", "true_header", "=", "\"is_no...
Checks if class is non copyable Args: class_ (declarations.class_t): the class to be checked already_visited_cls_vars (list): optional list of vars that should not be checked a second time, to prevent infinite recursions. In general you can ignore this argument, it is mainly...
[ "Checks", "if", "class", "is", "non", "copyable" ]
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L708-L785