Skip to content

Commit

Permalink
Merge pull request #396 from Crunch-io/isort-cube
Browse files Browse the repository at this point in the history
ruff on codebase
  • Loading branch information
ernestoarbitrio authored Feb 27, 2024
2 parents e91cd94 + a8f10e6 commit 33948c7
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 22 deletions.
21 changes: 9 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.4.0-1
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/ambv/black
rev: 24.1.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: black
- id: ruff-format
- id: ruff

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: flake8
- id: trailing-whitespace
- id: check-merge-conflict
- id: end-of-file-fixer

- repo: https://github.com/milin/giticket
rev: v1.2
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ testpaths =
[flake8]
show-source = True
max-line-length = 88
ignore = W503 # line break after binary operator (e.g. 'and')
ignore =
# line break after binary operator (e.g. 'and')
W503

[isort]
combine_as_imports=1
Expand Down
2 changes: 1 addition & 1 deletion src/cr/cube/collator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import numpy as np

from cr.cube.dimension import Dimension, Element, _OrderSpec, _Subtotals
from cr.cube.util import lazyproperty
from cr.cube.enums import ORDER_FORMAT
from cr.cube.util import lazyproperty


class _BaseCollator:
Expand Down
5 changes: 3 additions & 2 deletions src/cr/cube/cubepart.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@
"""

import math

import numpy as np
from tabulate import tabulate

from cr.cube.collator import PayloadOrderCollator
from cr.cube.enums import (
CUBE_MEASURE as CM,
DIMENSION_TYPE as DT,
ORDER_FORMAT,
MARGINAL_ORIENTATION as MO,
ORDER_FORMAT,
)
from cr.cube.matrix.assembler import _BaseOrderHelper
from cr.cube.matrix.measure import SecondOrderMeasures
from cr.cube.matrix.subtotals import SumSubtotals
from cr.cube.min_base_size_mask import MinBaseSizeMask
from cr.cube.measures.pairwise_significance import PairwiseSignificance
from cr.cube.min_base_size_mask import MinBaseSizeMask
from cr.cube.scalar import MeansScalar
from cr.cube.stripe.assembler import _BaseOrderHelper as stripe_BaseOrderHelper
from cr.cube.stripe.measure import StripeMeasures
Expand Down
6 changes: 3 additions & 3 deletions src/cr/cube/matrix/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from cr.cube.matrix.subtotals import (
NanSubtotals,
NegativeTermSubtotals,
OverlapSubtotals,
PositiveTermSubtotals,
SumSubtotals,
OverlapSubtotals,
)
from cr.cube.smoothing import Smoother
from cr.cube.util import lazyproperty
Expand Down Expand Up @@ -711,7 +711,7 @@ def is_defined(self):
We cannot sum counts across subvariable dimensions.
"""
return not self._dimensions[1].dimension_type in DT.ARRAY_TYPES
return self._dimensions[1].dimension_type not in DT.ARRAY_TYPES


class _ColumnIndex(_BaseSecondOrderMeasure):
Expand Down Expand Up @@ -1819,7 +1819,7 @@ def is_defined(self):
We cannot sum counts across subvariable dimensions.
"""
return not self._dimensions[0].dimension_type in DT.ARRAY_TYPES
return self._dimensions[0].dimension_type not in DT.ARRAY_TYPES


class _RowProportions(_BaseSecondOrderMeasure):
Expand Down
1 change: 0 additions & 1 deletion src/cr/cube/stripe/assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from cr.cube.enums import COLLATION_METHOD as CM, ORDER_FORMAT
from cr.cube.util import lazyproperty


# === ORDER HELPERS ===


Expand Down
1 change: 0 additions & 1 deletion src/cr/cube/stripe/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
)
from cr.cube.util import lazyproperty


# === MEASURE COLLECTION ===


Expand Down
2 changes: 1 addition & 1 deletion src/cr/cube/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

"""Utility functions for crunch cube, as well as other modules."""

from datetime import datetime
import functools
from datetime import datetime


def format(x) -> str:
Expand Down

0 comments on commit 33948c7

Please sign in to comment.