Project Meta
ProjectMeta class¶
A ProjectMeta
object stores project metainfo. Supports different i/o formats (enum ProjectMetaFmt
).
Current i/o format is described here.
class ProjectMeta: def __init__(self, py_container=None):
Create ProjectMeta
object.
py_container
— list of classes or dictionary with predefined fields:classes
,tags
. Each class should be represented as a dict with fieldstitle
andshape
.
Fields¶
classes
¶
FigClasses
object which stores list of classes.
tags
¶
Set of image or object tags.
Methods¶
to_json_file(self, fpath, out_fmt=_DEFAULT_OUT_FMT)
¶
Save meta to json file.
fpath
— path to new file.out_fmt
— output format.
to_json_str(self, out_fmt=_DEFAULT_OUT_FMT)
¶
Save meta to string.
out_fmt
— output format.
to_dir(self, dir_path, out_fmt=_DEFAULT_OUT_FMT)
¶
Save meta to project directory.
dir_path
— path to project directory (includes project name).out_fmt
— output format.
@classmethod dir_path_to_fpath(cls, dir_path, fmt=_DEFAULT_OUT_FMT)
¶
Get path to output meta file.
dir_path
— path to project directory (includes project name).out_fmt
— meta i/o format.
@classmethod from_json_file(cls, fpath)
¶
Read meta from json file. Auto-determine input format. Returns a ProjectMeta
object.
fpath
— path to json file.
@classmethod from_json_str(cls, s)
¶
Read meta from JSON string. Auto-determine input format. Returns a ProjectMeta
object.
s
— JSON string.
@classmethod find_in_dir(cls, dir_path)
¶
Determine if there is a meta file in project directory. Returns path to the file or None
.
dir_path
— path to project directory (includes project name).
@classmethod from_dir(cls, dir_path)
¶
Read meta from project directory. Auto-determine input format. Returns a ProjectMeta
object.
dir_path
— path to project directory (includes project name).