bw2data.project#
Attributes#
Classes#
Functions#
|
|
|
|
|
|
|
Not sure why this is necessary, but fails silently if call add_revision directly |
|
Module Contents#
- class bw2data.project.ProjectDataset[source]#
Bases:
peewee.Model
- _fast_forward(graph: bw2data.revisions.RevisionGraph, revision: bw2data.revisions.ID)[source]#
Moves the current head forward, if necessary.
- _load_revisions(head: bw2data.revisions.ID | None = None) Tuple[bw2data.revisions.ID, Sequence[bw2data.revisions.Revision]] | None [source]#
Reads all revisions from disk.
- _rebase(graph: bw2data.revisions.RevisionGraph) collections.abc.Iterable[bw2data.revisions.Revision] [source]#
Rebases current revision list on top of remote head, if necessary.
In a trivial fast-forward merge, this function will simply return the revisions which need to be applied. If a rebase is necessary, it will: - move the head to the merge base - return the (remote) revision range to be applied on top of it - move the head of the graph to the rebased head, the project head can
be fast-forwarded to it after the application of the remote revisions
- add_revision(delta: Sequence[bw2data.revisions.Delta], metadata: dict[str, Any] | None = None) int | None [source]#
Add a revision to the project changing the state of one or more objects.
- {
- “metadata”: {
“revision”: <this-revision-id> “parent_revision”: <parent-revision-id> “title”: “<optional>” “description”: “<optional>” “authors”: “<optional>” (maybe shouldn’t be optional)
}, “data”: [
- {
“type”: “database object type” (e.g. “activity”, “exchange”, “parameter”), “id”: “database object id” (e.g. “foo”, “bar”, “baz”), “delta”: <difference between revisions>
}, …
]
}
- apply_revision(revision: dict) None [source]#
Load a patch generated from a previous add_revision into the project.
- class bw2data.project.ProjectManager[source]#
Bases:
collections.abc.Iterable
- _project_dir(p: ProjectDataset | None = None) pathlib.Path [source]#
- change_base_directories(base_dir: pathlib.Path, base_logs_dir: pathlib.Path | None = None, project_name: str | None = 'default', update: bool | None = True) None [source]#
- copy_project(new_name, switch=True)[source]#
Copy current project to a new project named
new_name
. Ifswitch
, switch to new project.
- delete_project(name=None, delete_dir=False)[source]#
Delete project
name
, or the current project.name
is the project to delete. Ifname
is not provided, delete the current project.By default, the underlying project directory is not deleted; only the project name is removed from the list of active projects. If
delete_dir
isTrue
, then also delete the project directory.If deleting the current project, this function sets the current directory to
default
if it exists, or to a random project.Returns the current project.
- migrate_project_25()[source]#
Migrate project to Brightway 2.5.
Reprocesses all databases and LCIA objects.
- purge_deleted_directories()[source]#
Delete project directories for projects which are no longer registered.
Returns number of directories deleted.
- report()[source]#
Give a report on current projects, including installed databases and file sizes.
Returns tuples of
(project name, number of databases, size of all databases (GB))
.
- request_directory(name)[source]#
Return the absolute path to the subdirectory dirname, creating it if necessary.
Returns False if directory can’t be created.
- bw2data.project.add_full_hash_column(base_data_dir: pathlib.Path, db: peewee.SqliteDatabase) None [source]#
- bw2data.project.add_sourced_columns(base_data_dir: pathlib.Path, db: peewee.SqliteDatabase) None [source]#
- bw2data.project.signal_dispatcher(sender, old: Any | None = None, new: Any | None = None, operation: str | None = None) int | None [source]#
Not sure why this is necessary, but fails silently if call add_revision directly
- bw2data.project.signal_dispatcher_generic_no_diff(sender, name: str, verb: str, prefix: str, obj_type: str) int [source]#
- bw2data.project.signal_dispatcher_on_update_formula_parameter_name(sender, old: str, new: str, kind: str, extra: str = '') int [source]#
- bw2data.project.READ_ONLY_PROJECT = Multiline-String[source]#
Show Value
""" ***Read only project*** This project is being used by another process and no writes can be made until: 1. You close the other program, or switch to a different project, *and* 2. You call `projects.enable_writes` *and* get the response `True`. If you are **sure** that this warning is incorrect, call `projects.enable_writes(force=True)` to enable writes. """
- bw2data.project.signal_dispatcher_on_activity_parameter_update_formula_activity_parameter_name[source]#
- bw2data.project.signal_dispatcher_on_activity_parameter_update_formula_database_parameter_name[source]#
- bw2data.project.signal_dispatcher_on_activity_parameter_update_formula_project_parameter_name[source]#
- bw2data.project.signal_dispatcher_on_database_parameter_update_formula_database_parameter_name[source]#