Skip to content
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
2 changes: 0 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ jobs:
run: tox -e lint
- name: Format with tox
run: tox -e format
- name: Flake8 with tox
run: tox -e flake8
- name: Test with tox
run: tox -e test

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import sys

sys.path.insert(0, os.path.abspath(".."))
import numpy as np
import numpy as np # noqa: F401
import sphinx_bootstrap_theme

# -- Project information -----------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def check_output(cmd):
"pyproj>=2.1",
"PyYAML>=5.4",
"rasterio>=1.0.23",
"rio-cogeo>=3.0.2",
"requests==2.22.0",
"rtree>=0.9.3",
"scikit-image>=0.16.2",
Expand Down
2 changes: 1 addition & 1 deletion solaris/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import data, utils, vector
from . import data, utils, vector # noqa: F401

# data, eval, preproc, raster, tile, have gdal in them need to replace with rasterio
__version__ = "0.0.1"
2 changes: 1 addition & 1 deletion solaris/eval/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import base, iou, pixel, vector
from . import base, iou, pixel, vector # noqa: F401
2 changes: 0 additions & 2 deletions solaris/eval/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ def eval_iou_spacenet_csv(
scoring_dict_list = []
self.ground_truth_GDF[iou_field] = 0.0
iou_index = self.ground_truth_GDF.columns.get_loc(iou_field)
id_cols = 2
ground_truth_ids = self.ground_truth_GDF.iloc[:, :id_cols]

for imageID in tqdm(imageIDList):
self.ground_truth_GDF_Edit = self.ground_truth_GDF[
Expand Down
2 changes: 1 addition & 1 deletion solaris/preproc/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import image, label, optical, pipesegment, sar
from . import image, label, optical, pipesegment, sar # noqa: F401
2 changes: 1 addition & 1 deletion solaris/preproc/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pandas as pd
from osgeo import gdal_array

from .pipesegment import LoadSegment, MergeSegment, PipeSegment
from .pipesegment import LoadSegment, PipeSegment


class Image:
Expand Down
2 changes: 1 addition & 1 deletion solaris/preproc/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import shapely.wkt

from ..vector.polygon import convert_poly_coords
from .pipesegment import LoadSegment, MergeSegment, PipeSegment
from .pipesegment import LoadSegment, PipeSegment


class LoadString(LoadSegment):
Expand Down
3 changes: 1 addition & 2 deletions solaris/preproc/optical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import numpy as np

from . import image
from .image import Image
from .pipesegment import LoadSegment, MergeSegment, PipeSegment
from .pipesegment import PipeSegment


class RGBToHSL(PipeSegment):
Expand Down
2 changes: 1 addition & 1 deletion solaris/preproc/pipesegment.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def PipeFunction(inner_class=PipeSegment, pin=(), *args, **kwargs):
and *args and **kwargs are sent to the PipeSegment's constructor.
"""
psobject = inner_class(*args, **kwargs)
if issubclass(self.inner_class, LoadSegment):
if issubclass(self.inner_class, LoadSegment): # noqa: F821
return psobject()
else:
return (pin * psobject)()
3 changes: 1 addition & 2 deletions solaris/preproc/sar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import math
import os
import uuid
import warnings
import xml.etree.ElementTree as ET
Expand All @@ -12,7 +11,7 @@

from . import image
from .image import Image
from .pipesegment import LoadSegment, MergeSegment, PipeSegment
from .pipesegment import PipeSegment


class BandMath(PipeSegment):
Expand Down
2 changes: 1 addition & 1 deletion solaris/raster/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import image
from . import image # noqa: F401
2 changes: 0 additions & 2 deletions solaris/raster/image.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

import numpy as np
import rasterio

Expand Down
2 changes: 1 addition & 1 deletion solaris/tile/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import raster_tile, vector_tile
from . import raster_tile, vector_tile # noqa: F401
2 changes: 1 addition & 1 deletion solaris/tile/raster_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from rasterio.mask import mask as rasterio_mask
from rasterio.vrt import WarpedVRT
from rasterio.warp import Resampling, calculate_default_transform
from rio_cogeo.cogeo import cog_translate # ,cog_validate
from shapely.geometry import box
from tqdm.auto import tqdm

# from rio_cogeo.cogeo import cog_validate, cog_translate
from ..utils.core import _check_crs, _check_rasterio_im_load

# removing the following until COG functionality is implemented
Expand Down
2 changes: 1 addition & 1 deletion solaris/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import cli, core, data, geo, io, tile
from . import cli, core, data, geo, io, tile # noqa: F401
6 changes: 0 additions & 6 deletions solaris/utils/tile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import json

import geopandas as gpd
from affine import Affine
from rasterio.enums import Resampling
from rasterio.vrt import WarpedVRT
from rasterio.windows import Window

from .core import _check_crs

# temporarily removing the below until I can get COG functionality implemented
Expand Down
2 changes: 1 addition & 1 deletion solaris/vector/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import graph, mask, polygon
from . import graph, mask, polygon # noqa: F401
2 changes: 0 additions & 2 deletions tests/test_cli/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import pickle
import subprocess

import networkx as nx
import numpy as np
import skimage.io

Expand Down
4 changes: 2 additions & 2 deletions tests/test_data/test_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_multiclass_single_geojson(self):
expected_dict = json.load(f)
with open(os.path.join(data_dir, "tmp_coco.json"), "r") as f:
saved_result = json.load(f)
## Simplified test due to rounding errors- JSS
# Simplified test due to rounding errors- JSS
assert (
coco_dict["annotations"][0]["bbox"]
== expected_dict["annotations"][0]["bbox"]
Expand Down Expand Up @@ -62,7 +62,7 @@ def test_singleclass_multi_geojson(self):

with open(os.path.join(data_dir, "coco_sample_1.json"), "r") as f:
expected_dict = json.load(f)
## Simplified test due to rounding errors- JSS
# Simplified test due to rounding errors- JSS
assert (
expected_dict["annotations"][0]["bbox"]
== coco_dict["annotations"][0]["bbox"]
Expand Down
1 change: 0 additions & 1 deletion tests/test_eval/evaluator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def test_iou_by_building(self):
path_truth = os.path.join(data_folder, "SN2_sample_truth.csv")
path_pred = os.path.join(data_folder, "SN2_sample_preds.csv")
path_ious = os.path.join(data_folder, "SN2_sample_iou_by_building.csv")
path_temp = "./temp.pd"
eb = Evaluator(path_truth)
eb.load_proposal(path_pred, conf_field_list=["Confidence"], proposalCSV=True)
eb.eval_iou_spacenet_csv(miniou=0.5, imageIDField="ImageId", min_area=20)
Expand Down
1 change: 1 addition & 0 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa: F401
class TestImports(object):
def test_imports(self):
import solaris
Expand Down
5 changes: 1 addition & 4 deletions tests/test_raster/test_image.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import os

import numpy as np
import skimage.io
from affine import Affine

import solaris as sol
from solaris.data import sample_load_rasterio
from solaris.raster.image import get_geo_transform, stitch_images
from solaris.raster.image import get_geo_transform

data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../data/"))

Expand Down
25 changes: 10 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
envlist =
lint,
format,
flake8,
test

[testenv:test]
Expand All @@ -13,19 +12,9 @@ commands =
[testenv:lint]
basepython = python3
skip_install = true
deps =
isort
black
commands =
- isort --check-only --df .
- black --check --diff --color .

[testenv:flake8]
basepython = python3
skip_install = true
deps = flake8
commands =
- flake8
flake8 .

[testenv:format]
basepython = python3
Expand All @@ -34,8 +23,8 @@ deps =
isort
black
commands =
- isort .
- black .
isort .
black .

[testenv:build]
basepython = python3
Expand All @@ -61,7 +50,12 @@ commands =

[flake8]
extend-ignore =
E203,
E203, # whitespace before ':'
E501, # line too long
C901, # is too complex
E402, # module level import not at top of file (for docs)
E741, # ambiguous variable name

exclude =
.git,
__pycache__,
Expand All @@ -72,6 +66,7 @@ exclude =
.tox
max-line-length = 88
max-complexity = 10
count=true

[isort]
profile = black
Expand Down