Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#205)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/commitizen-tools/commitizen: 3.10.0 → 3.10.1](commitizen-tools/commitizen@3.10.0...3.10.1)
- [github.com/astral-sh/ruff-pre-commit: v0.0.291 → v0.0.292](astral-sh/ruff-pre-commit@v0.0.291...v0.0.292)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Oct 17, 2023
1 parent 39f114a commit 3051961
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
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()

0 comments on commit 3051961

Please sign in to comment.