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

[pre-commit.ci] pre-commit autoupdate #205

Merged
merged 2 commits into from
Oct 17, 2023
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
# Versioning: Commit messages & changelog
- repo: https://github.com/commitizen-tools/commitizen
rev: 3.10.0
rev: 3.10.1
hooks:
- id: commitizen
stages: [commit-msg]
Expand All @@ -15,7 +15,7 @@ repos:
# Lint / autoformat: Python code
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.0.291"
rev: "v0.0.292"
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand Down
1 change: 1 addition & 0 deletions osm_fieldwork/basemapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ def create_basemap_file(
raise ValueError(msg)
log.info(f"Wrote {outfile}")


def main():
"""This main function lets this class be run standalone by a bash script."""
parser = argparse.ArgumentParser(description="Create an tile basemap for ODK Collect")
Expand Down
2 changes: 1 addition & 1 deletion osm_fieldwork/make_data_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import geojson
import yaml
from geojson import FeatureCollection, dump
from osm_rawdata.config import QueryConfig
from osm_rawdata.postgres import PostgresClient
from shapely.geometry import shape

from osm_fieldwork.data_models import data_models_path
from osm_fieldwork.filter_data import FilterData
from osm_fieldwork.xlsforms import xlsforms_path
from osm_rawdata.config import QueryConfig

# Instantiate logger
log = logging.getLogger(__name__)
Expand Down
29 changes: 13 additions & 16 deletions tests/test_basemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,37 @@
# along with osm_fieldwork. If not, see <https:#www.gnu.org/licenses/>.
#

import argparse
import logging
import os
import shutil

from osm_fieldwork.xlsforms import xlsforms_path
from osm_fieldwork.basemapper import BaseMapper
import geojson
from shapely.geometry import shape
from geojson import Feature, FeatureCollection
from osm_fieldwork.sqlite import DataFile, MapTile
from osm_fieldwork.sqlite import DataFile

log = logging.getLogger(__name__)

infile = f"testdata/Rollinsville.geojson"
infile = "testdata/Rollinsville.geojson"
outfile = "rollinsville.mbtiles"
base = "./tiles"
#boundary = open(infile, "r")
#poly = geojson.load(boundary)
#if "features" in poly:
# boundary = open(infile, "r")
# poly = geojson.load(boundary)
# if "features" in poly:
# geometry = shape(poly["features"][0]["geometry"])
#elif "geometry" in poly:
# elif "geometry" in poly:
# geometry = shape(poly["geometry"])
#else:
# else:
# geometry = shape(poly)



def test_create():
"""See if the file got loaded."""
hits = 0
basemap = BaseMapper(infile, base, 'topo', False)
basemap = BaseMapper(infile, base, "topo", False)
tiles = list()
for level in [8, 9, 10, 11, 12]:
basemap.getTiles(level)
tiles += basemap.tiles

if len(tiles) == 5:
hits += 1

Expand All @@ -64,8 +60,9 @@ def test_create():

os.remove(outfile)
shutil.rmtree(base)

assert hits == 2


if __name__ == "__main__":
test_create()
Loading