コード例 #1
0
    def load_metadata(self, directory, plugin_name):
        metadata = {}

        with io.OpenWrapper(f"{directory}/{plugin_name}/__init__.py",
                            "rt",
                            encoding="utf8") as open_file:
            file_content = open_file.read()

        metadata["version"] = self.parse_metadata("__version__", file_content)
        metadata["name"] = self.parse_metadata("__name__", file_content)
        metadata["author"] = self.parse_metadata("__author__", file_content)
        metadata["description"] = self.parse_metadata("__description__",
                                                      file_content)
        metadata["license"] = self.parse_metadata("__license__", file_content)
        metadata["min_python_version"] = self.parse_metadata(
            "__min_python_version__", file_content)
        metadata["requirements_file"] = self.parse_metadata(
            "__requirements_file__", file_content)
        metadata["url"] = self.parse_metadata("__url__", file_content)
        metadata["year"] = self.parse_metadata("__year__", file_content)
        metadata["type"] = self.parse_metadata("__type__", file_content)
        metadata["plugins"] = self.parse_metadata("__plugins__", file_content)
        metadata["addons"] = self.parse_metadata("__addons__", file_content)

        return metadata
コード例 #2
0
ファイル: storage.py プロジェクト: elijahjcooke/nidaba
 def __init__(self, jobID, path, *args, **kwargs):
     self.path = get_abs_path(jobID, path)
     self.lock = lock(self.path)
     self.lock.acquire()
     try:
         self.fd = io.OpenWrapper(self.path, *args, **kwargs)
     except:
         self.lock.release()
         raise
コード例 #3
0
ファイル: ggplot.py プロジェクト: nomadcube/customized_weibo
 def _repr_svg_(self, width=6, height=4):
     # Hack with a temp file (use buffer later ?)
     fn = tempfile.NamedTemporaryFile(mode='wb',
                                      suffix='.svg',
                                      delete=False)
     fn.close()
     grdevices.svg(fn.name, width=width, height=height)
     self.plot()
     grdevices.dev_off()
     import io
     with io.OpenWrapper(fn.name, mode='rb') as data:
         res = data.read().decode('utf-8')
     return res
コード例 #4
0
def load_metadata(init_path):
    metadata = {}

    with io.OpenWrapper(init_path, 'rt', encoding='utf8') as open_file:
        file_content = open_file.read()

    metadata['version'] = parse_metadata('__version__', file_content)
    metadata['name'] = parse_metadata('__name__', file_content)
    metadata['author'] = parse_metadata('__author__', file_content)
    metadata['description'] = parse_metadata('__description__', file_content)
    metadata['license'] = parse_metadata('__license__', file_content)
    metadata['min_python_version'] = parse_metadata('__min_python_version__',
                                                    file_content)
    metadata['requirements_file'] = parse_metadata('__requirements_file__',
                                                   file_content)
    metadata['url'] = parse_metadata('__url__', file_content)
    metadata['year'] = parse_metadata('__year__', file_content)
    metadata['type'] = parse_metadata('__type__', file_content)

    return metadata
コード例 #5
0
ファイル: show.py プロジェクト: hellik/grass
def raw_figure(figpath):
    with io.OpenWrapper(figpath, mode="rb") as data:
        res = data.read()
    return res
コード例 #6
0
 def update_event(self, inp=-1):
     self.set_output_val(
         0,
         io.OpenWrapper(self.input(0), self.input(1), self.input(2),
                        self.input(3), self.input(4), self.input(5),
                        self.input(6), self.input(7)))
コード例 #7
0
 def __init__(self, jobID, path, *args, **kwargs):
     self.path = get_abs_path(jobID, path)
     self.fd = io.OpenWrapper(self.path, *args, **kwargs)