示例#1
0
文件: cache.py 项目: Stretto/glad-web
    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
示例#3
0
    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
示例#4
0
    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
示例#5
0
文件: parse.py 项目: theomission/glad
    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))
示例#6
0
文件: parse.py 项目: dpethes/glad
    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))
示例#7
0
    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
示例#8
0
    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()