def __init__(self, path, opener=None): self.path = os.path.abspath(path) self.opener = opener if self.opener is None: self.opener = URLOpener.default() self._allowed_chars = string.ascii_letters + string.digits
def __init__(self, path, spec, api, extension_names=None, loader=None, opener=None, local_files=False, omit_khrplatform=False, header_template=HEADER_TEMPLATE, **options): self.path = os.path.abspath(path) self.spec = spec for a in api: if a not in self.spec.features: raise ValueError( 'Unknown API "{0}" for specification "{1}"' .format(a, self.spec.NAME) ) self.api = api self.extension_names = extension_names self.has_loader = not loader.disabled self.loader = loader if self.loader is None: self.loader = NullLoader self.opener = opener if self.opener is None: self.opener = URLOpener.default() self.local_files = local_files self.omit_khrplatform = omit_khrplatform self.options = options self._header_template = header_template
def __init__(self, path, spec, api, extension_names=None, loader=None, opener=None, local_files=False, omit_khrplatform=False, header_template=HEADER_TEMPLATE): self.path = os.path.abspath(path) self.spec = spec for a in api: if a not in self.spec.features: raise ValueError( 'Unknown API "{0}" for specification "{1}"' .format(a, self.spec.NAME) ) self.api = api self.extension_names = extension_names self.has_loader = not loader.disabled self.loader = loader if self.loader is None: self.loader = NullLoader self.opener = opener if self.opener is None: self.opener = URLOpener.default() self.local_files = local_files self.omit_khrplatform = omit_khrplatform self._header_template = header_template
def from_url(cls, url, opener=None): if opener is None: opener = URLOpener.default() with closing(opener.urlopen(url)) as f: raw = f.read() return cls(xml_fromstring(raw))
def __init__(self, path, opener=None, gen_info_factory=None): self.path = os.path.abspath(path) self.opener = opener if self.opener is None: self.opener = URLOpener.default() self.gen_info_factory = gen_info_factory or GenerationInfo.create
def __init__(self, path, spec, api, loader=None, opener=None): self.path = os.path.abspath(path) self.spec = spec for a in api: if a not in self.spec.features: raise ValueError( 'Unknown API "{0}" for specification "{1}"' .format(a, self.spec.NAME) ) self.api = api self.loader = loader if self.loader is None: self.loader = NullLoader self.opener = opener if self.opener is None: self.opener = URLOpener.default()