Skip to content

Commit

Permalink
Run ruff formating
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSava committed Dec 3, 2024
1 parent 3f66b2b commit 0ffb900
Show file tree
Hide file tree
Showing 59 changed files with 185 additions and 174 deletions.
55 changes: 40 additions & 15 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,45 @@
name: style
name: Style

on: [pull_request]
on:
push:
branches:
- main
- 'version-**'
pull_request:

env:
UV_SYSTEM_PYTHON: 1

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
lint_and_black:
check-style:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install everviz with style dependencies
run: |
pip install ".[style]"
- name: Run style check
run: |
ruff .
black --check .
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install ERT with style dependencies
run: |
uv pip install ".[style]"
- name: Run style check
if: ${{ always() }}
run: |
SKIP=no-commit-to-branch pre-commit run --all-files --show-diff-on-failure
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ dmypy.json
.pyre/

# pytype static type analyzer
.pytype/
.pytype/
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In addition to any definition or interpretation of the open source code of condu

If at any point concerns are raised that a group or member is not acting according to our values, the behaviour in question should cease, be discussed, and tried to be resolved.

We expect everyone to have a low threshold for raising issues, or in general discuss how we live up to our values.
We expect everyone to have a low threshold for raising issues, or in general discuss how we live up to our values.
Equally, we encourage all community members to appreciate when concerns are raised and do their best to solve them.

Project maintainers are responsible both for *what* is delivered, as well as *how* it is delivered.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# everviz: web based visualization for everest

## What is everviz
everviz is a visualization plugin for everest based on [dash](https://github.com/plotly/dash)
everviz is a visualization plugin for everest based on [dash](https://github.com/plotly/dash)
and [webviz-config](https://github.com/equinor/webviz-config).

## Download project
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ The following information will help us triage your report more quickly:
- Proof-of-concept or exploit code (if possible)
- Impact of the issue, including how an attacker might exploit the issue

We prefer all communications to be in English.
We prefer all communications to be in English.
4 changes: 2 additions & 2 deletions docs/installing_everviz.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
******************
Installing Everviz
******************
*Everviz* is a plugin of *Everest*, and therefore *Everest* must be installed in the same Python enviroment before you install *Everviz*.
*Everviz* is a plugin of *Everest*, and therefore *Everest* must be installed in the same Python enviroment before you install *Everviz*.

*Everviz* is based on `Webviz <https://github.com/equinor/webviz-config>`_, which must be installed before installing *Everviz*.

Expand All @@ -19,4 +19,4 @@ If you want to download the latest source code and install it manually use the f
cd ./everviz
pip install .
After installation *Everviz* can be started from the *Everest* tool.
After installation *Everviz* can be started from the *Everest* tool.
2 changes: 1 addition & 1 deletion docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Introduction

*Everviz* is a plugin for *Everest* that enables plotting of the results of an optimization. The *Everest* tool is designed for optimizing well drilling order and time under geological uncertainty. The results of the optimization include control and function values, as they evolve during the optimization. In addition, the simulators that are used in the optimization process produce various time series of summary values at each iteration, each of which may involve multiple simulation runs.

*Everviz* is designed to plot the control, function and summary values produced during the optimization run. *Everviz* is based on `Webviz <https://github.com/equinor/webviz-config>`_, a *Dash*-based tool for creating plotting applications using `yaml` configuration files.
*Everviz* is designed to plot the control, function and summary values produced during the optimization run. *Everviz* is based on `Webviz <https://github.com/equinor/webviz-config>`_, a *Dash*-based tool for creating plotting applications using `yaml` configuration files.
2 changes: 1 addition & 1 deletion docs/running_everviz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ Cross plots allow you to plot any arbitrary value in the optimization resuls aga

Everviz configuration
=====================
This page shows the configuration file that is used to generate all the plots.
This page shows the configuration file that is used to generate all the plots.
9 changes: 4 additions & 5 deletions everviz/components/list_select.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from typing import List
import dash

from dash.development.base_component import Component
from dash.dependencies import Output, Input, State
from dash import html, dcc

import dash
import webviz_core_components as wcc
from dash import dcc, html
from dash.dependencies import Input, Output, State
from dash.development.base_component import Component


def layout(uuid: str, default_options: List[str] = None) -> Component:
Expand Down
11 changes: 6 additions & 5 deletions everviz/config.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import os

import yaml

from everviz.log import get_logger
from everviz.util import get_everviz_folder, DEFAULT_CONFIG
from everviz.pages import (
controls,
configuration,
controls,
crossplot,
summary_values,
objectives,
deltaplot,
wells_values,
gradientplot,
objectives,
summary_values,
wells_values,
)
from everviz.util import DEFAULT_CONFIG, get_everviz_folder

logger = get_logger()

Expand Down
7 changes: 4 additions & 3 deletions everviz/everest_hooks.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import subprocess
import os
import shutil
import signal
import subprocess
import sys
import os

from everest.plugins import hookimpl # pylint: disable=import-error
from everviz.util import get_everviz_folder

from everviz.config import setup_default_everviz_config
from everviz.log import setup_logger
from everviz.util import get_everviz_folder


def handle_exit(*args): # pylint: disable=unused-argument)
Expand Down
2 changes: 1 addition & 1 deletion everviz/log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import sys
import os
import sys


def _formatter():
Expand Down
3 changes: 2 additions & 1 deletion everviz/pages/configuration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from everviz.util import get_everviz_folder, DEFAULT_CONFIG

from everviz.util import DEFAULT_CONFIG, get_everviz_folder


def page_layout(api):
Expand Down
3 changes: 2 additions & 1 deletion everviz/pages/controls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
from collections import namedtuple

import pandas as pd
from everviz.log import get_logger

from everviz.log import get_logger

DataSources = namedtuple("DataSource", "controls_per_batch, controls_initial_vs_best")

Expand Down
3 changes: 2 additions & 1 deletion everviz/pages/deltaplot.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
from collections import namedtuple

import pandas as pd
from everviz.log import get_logger

from everviz.log import get_logger

DataSources = namedtuple(
"DataSource", ["objective_delta_values", "summary_delta_values"]
Expand Down
3 changes: 2 additions & 1 deletion everviz/pages/gradientplot.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
from collections import namedtuple

import pandas as pd
from everviz.log import get_logger

from everviz.log import get_logger

DataSources = namedtuple("DataSource", "gradient_values")

Expand Down
1 change: 1 addition & 0 deletions everviz/pages/objectives.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from collections import namedtuple

import pandas as pd

from everviz.log import get_logger
Expand Down
1 change: 0 additions & 1 deletion everviz/pages/summary_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from everviz.log import get_logger


DataSources = namedtuple("DataSource", ["summary_values"])

logger = get_logger()
Expand Down
2 changes: 1 addition & 1 deletion everviz/pages/wells_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
WELLS_EXPLANATION = """
The well plot requires well summary data to be loaded from the forward model.
Make sure the wells are specified in the Everest config file and exported from
Eclipse/Flow to *.UNSMRY. To visualize target rates they also need to be added
Eclipse/Flow to *.UNSMRY. To visualize target rates they also need to be added
to the simulator summary data section.
"""

Expand Down
24 changes: 12 additions & 12 deletions everviz/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
from everviz.plugins.best_controls_plot.best_controls_plot import BestControlsPlot
from everviz.plugins.config_editor.config_editor import ConfigEditor
from everviz.plugins.controls_plot.controls_plot import ControlsPlot
from everviz.plugins.crossplot.crossplot import Crossplot
from everviz.plugins.crossplot.crossplot_indexed import CrossplotIndexed
from everviz.plugins.summary_plot.summary_plot import SummaryPlot
from everviz.plugins.objectives_plot.objectives_plot import ObjectivesPlot
from everviz.plugins.objectives_plot.single_objectives_plot import SingleObjectivesPlot
from everviz.plugins.controls_plot.controls_plot import ControlsPlot
from everviz.plugins.best_controls_plot.best_controls_plot import BestControlsPlot
from everviz.plugins.delta_plot.delta_plot import DeltaPlot
from everviz.plugins.gradient_plot import GradientPlot
from everviz.plugins.config_editor.config_editor import ConfigEditor
from everviz.plugins.objectives_plot.objectives_plot import ObjectivesPlot
from everviz.plugins.objectives_plot.single_objectives_plot import SingleObjectivesPlot
from everviz.plugins.summary_plot.summary_plot import SummaryPlot
from everviz.plugins.summary_plot.wells_plot import WellsPlot

__all__ = [
"BestControlsPlot",
"ConfigEditor",
"ControlsPlot",
"Crossplot",
"CrossplotIndexed",
"SummaryPlot",
"ObjectivesPlot",
"SingleObjectivesPlot",
"ControlsPlot",
"BestControlsPlot",
"DeltaPlot",
"GradientPlot",
"ConfigEditor",
"ObjectivesPlot",
"SingleObjectivesPlot",
"SummaryPlot",
"WellsPlot",
]
7 changes: 3 additions & 4 deletions everviz/plugins/best_controls_plot/best_controls_plot.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from uuid import uuid4
from pathlib import Path

from dash import html, dcc
from uuid import uuid4

import plotly.express as px
from dash import dcc, html

from everviz.plugins.plugin_abc import EvervizPluginABC
from everviz.data.load_csv.get_data import get_data
from everviz.plugins.plugin_abc import EvervizPluginABC
from everviz.util import base64encode


Expand Down
5 changes: 3 additions & 2 deletions everviz/plugins/config_editor/config_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import os
from pathlib import Path
from uuid import uuid4

import yaml
from dash import callback_context
from dash import callback_context, dcc, html
from dash.dependencies import Input, Output, State
from dash import html, dcc

from everviz.plugins.plugin_abc import EvervizPluginABC


Expand Down
8 changes: 4 additions & 4 deletions everviz/plugins/controls_plot/controls_plot.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from uuid import uuid4
from pathlib import Path
from uuid import uuid4

import plotly.graph_objs as go
from dash import dcc, html
from dash.dependencies import Input, Output

from dash import html, dcc
from dash.dependencies import Output, Input
from everviz.plugins.plugin_abc import EvervizPluginABC
from everviz.data.load_csv.get_data import get_data
from everviz.plugins.plugin_abc import EvervizPluginABC
from everviz.util import base64encode


Expand Down
9 changes: 4 additions & 5 deletions everviz/plugins/crossplot/crossplot.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from pathlib import Path
from uuid import uuid4
from dash import html, dcc

from dash import dcc, html
from dash.dependencies import Input, Output
from everviz.plugins.plugin_abc import EvervizPluginABC


from everviz.plugins.utils.layout.sidebar_layout import get_sidebar_layout
from everviz.data.load_csv.get_data import get_data
from everviz.plugins.crossplot.callback.crossplot_callback import (
crossplot_update_graph,
get_graph_line,
)
from everviz.data.load_csv.get_data import get_data
from everviz.plugins.plugin_abc import EvervizPluginABC
from everviz.plugins.utils.layout.sidebar_layout import get_sidebar_layout
from everviz.util import base64encode


Expand Down
10 changes: 5 additions & 5 deletions everviz/plugins/crossplot/crossplot_indexed.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from pathlib import Path
from uuid import uuid4

from dash import html, dcc
from dash.dependencies import Output, Input
from everviz.plugins.plugin_abc import EvervizPluginABC
from dash import dcc, html
from dash.dependencies import Input, Output

from everviz.data.load_csv.get_data import get_data
from everviz.plugins.crossplot.callback.crossplot_callback import (
get_graph_line,
crossplot_update_graph,
get_graph_line,
)
from everviz.util import identify_indexed_controls, base64encode
from everviz.plugins.crossplot.callback.crossplot_indexed_dropdown import (
dropdown_callback,
)
from everviz.plugins.plugin_abc import EvervizPluginABC
from everviz.plugins.utils.layout.sidebar_layout import get_sidebar_layout
from everviz.util import base64encode, identify_indexed_controls


class CrossplotIndexed(EvervizPluginABC):
Expand Down
Loading

0 comments on commit 0ffb900

Please sign in to comment.