Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add black check workflow #1398

Merged
merged 2 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/black-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# For more information on how to use this template please refer to:
# http://tardis-sn.github.io/tardis/development/continuous_integration.html

name: black

on:
pull_request:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install Black
run: pip install black

- name: Run Black
run: black --check tardis
jaladh-singhal marked this conversation as resolved.
Show resolved Hide resolved
26 changes: 13 additions & 13 deletions tardis/gui/datahandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ class Node(object):

Attributes
----------
parent : None/Node
parent : None/Node
The parent of the node.
children : list of Node
The children of the node.
data : list of string
data : list of string
The data stored on the node. Can be a key or a value.
siblings : dictionary
A dictionary of nodes that are siblings of this node. The
keys are the values of the nodes themselves. This is
siblings : dictionary
A dictionary of nodes that are siblings of this node. The
keys are the values of the nodes themselves. This is
used to keep track of which value the user has selected
if the parent of this node happens to be a key that can
take values from a list.
Expand All @@ -60,8 +60,8 @@ def __init__(self, data, parent=None):
----------
data : list of string
The data that is intended to be stored on the node.
parent : Node
Another node which is the parent of this node. The
parent : Node
Another node which is the parent of this node. The
root node has parent set to None.

Note
Expand Down Expand Up @@ -164,10 +164,10 @@ class TreeModel(QtCore.QAbstractItemModel):
----------
root : Node
Root node of the tree.
disabledNodes : list of Node
disabledNodes : list of Node
List of leaf nodes that are not editable currently.
typenodes : list of Node
List of nodes that correspond to keys that set container
typenodes : list of Node
List of nodes that correspond to keys that set container
types. Look at tardis configuration template. These are the
nodes that have values that can be set from a list.
"""
Expand All @@ -177,9 +177,9 @@ def __init__(self, dictionary, parent=None):

Parameters
----------
dictionary : dictionary
dictionary : dictionary
The dictionary that needs to be converted to the tree.
parent : None
parent : None
Used to instantiate the QAbstractItemModel
"""
QtCore.QAbstractItemModel.__init__(self, parent)
Expand Down Expand Up @@ -347,7 +347,7 @@ def dict_to_tree(self, dictionary, root):
----------
dictionary : dictionary
The dictionary that is to be converted to the tree.
root : Node
root : Node
The root node of the tree.
"""
# Construct tree with all nodes
Expand Down
2 changes: 1 addition & 1 deletion tardis/gui/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def show(model):
show method is called.

Finally the eventloop is started using IPython functions (which start them
consistently) if they were imported. Otherwise it is started explicitly.
consistently) if they were imported. Otherwise it is started explicitly.
"""
if importFailed:
app = QtWidgets.QApplication([])
Expand Down
2 changes: 1 addition & 1 deletion tardis/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def match_dicts(self, dict1, dict2): # dict1<=dict2
The template dictionary with all default values set. This
one may have some keys missing that are present in the
`dict1`. Such keys will be appended.

Raises
------
IOError
Expand Down
2 changes: 1 addition & 1 deletion tardis/io/config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def quantity_representer(dumper, data):
def cns_representer(dumper, data):
"""
Represents Configuration as dict

Parameters
----------
dumper :
Expand Down
4 changes: 2 additions & 2 deletions tardis/io/decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def as_atoms(self):
Returns
-------
pandas.DataFrame
Merged isotope abundances
Merged isotope abundances
"""

return self.groupby("atomic_number").sum()
Expand All @@ -117,7 +117,7 @@ def merge(self, other, normalize=True):

Parameters
----------
other : pd.DataFrame
other : pd.DataFrame
normalize : bool
If true, resultant dataframe will be normalized

Expand Down
8 changes: 4 additions & 4 deletions tardis/io/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ def to_hdf_util(
):
"""
A function to uniformly store TARDIS data to an HDF file.

Scalars will be stored in a Series under path/scalars
1D arrays will be stored under path/property_name as distinct Series
2D arrays will be stored under path/property_name as distinct DataFrames

Units will be stored as their CGS value

Parameters
----------
path_or_buf : str or pandas.io.pytables.HDFStore
Expand All @@ -223,7 +223,7 @@ def to_hdf_util(
stored.
overwrite : bool
If the HDF file path already exists, whether to overwrite it or not

Notes
-----
`overwrite` option doesn't have any effect when `path_or_buf` is an
Expand Down
6 changes: 3 additions & 3 deletions tardis/plasma/properties/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Levels(BaseAtomicDataProperty):
"""
Attributes
----------
levels : pandas.MultiIndex
levels : pandas.MultiIndex
(atomic_number, ion_number, level_number)
Index of filtered atomic data. Index used for all other attribute dataframes for this class
excitation_energy : pandas.DataFrame, dtype float
Expand Down Expand Up @@ -70,7 +70,7 @@ class Lines(BaseAtomicDataProperty):
"""
Attributes
----------
lines : pandas.DataFrame
lines : pandas.DataFrame
Atomic lines data. Columns are wavelength, atomic_number,ion_number,
f_ul, f_lu, level_number_lower, level_number_upper, nu, B_lu, B_ul, A_ul,
wavelength. Index is line_id.
Expand Down Expand Up @@ -192,7 +192,7 @@ class IonizationData(BaseAtomicDataProperty):
"""
Attributes
----------
ionization_data : pandas.Series
ionization_data : pandas.Series
Holding ionization energies
Indexed by atomic number, ion number.
"""
Expand Down
4 changes: 2 additions & 2 deletions tardis/plasma/properties/ion_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class IonNumberDensity(ProcessingPlasmaProperty):
for the electron densities are not similar to within the threshold
value, a new guess for the value of the electron density is chosen
and the process is repeated.

Attributes
----------
ion_number_density : pandas.DataFrame, dtype float
Expand Down Expand Up @@ -401,7 +401,7 @@ class IonNumberDensityHeNLTE(ProcessingPlasmaProperty):
for the electron densities are not similar to within the threshold
value, a new guess for the value of the electron density is chosen
and the process is repeated.

Attributes
----------
ion_number_density : pandas.DataFrame, dtype float
Expand Down
4 changes: 3 additions & 1 deletion tardis/widgets/tests/test_shell_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def simulation_shell_info(simulation_verysimple):

@pytest.fixture(scope="class")
def hdf_shell_info(hdf_file_path, simulation_verysimple):
simulation_verysimple.to_hdf(hdf_file_path, overwrite=True) # save sim at hdf_file_path
simulation_verysimple.to_hdf(
hdf_file_path, overwrite=True
) # save sim at hdf_file_path
return HDFShellInfo(hdf_file_path)


Expand Down