parent
2926e916e4
commit
9f1bae0df6
|
@ -83,12 +83,12 @@ all = [
|
|||
|
||||
[tool.black]
|
||||
target-version = ["py311"]
|
||||
line-length = 120
|
||||
line-length = 80
|
||||
skip-string-normalization = true
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py311"
|
||||
line-length = 120
|
||||
line-length = 80
|
||||
select = [
|
||||
"A",
|
||||
"ARG",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# SPDX-FileCopyrightText: 2023-present Jeff Moe <moe@spacecruft.org>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
__version__ = "0.0.3"
|
||||
__version__ = "0.0.4"
|
||||
|
|
|
@ -6,12 +6,12 @@ import click
|
|||
from gbif_cruft.__about__ import __version__
|
||||
from gbif_cruft.lazy_group import LazyGroup
|
||||
|
||||
|
||||
@click.version_option(version=__version__, prog_name="gbif-cruft")
|
||||
@click.group(
|
||||
cls=LazyGroup,
|
||||
lazy_subcommands={"search": "search.cli", "parquet": "parquet.cli"},
|
||||
context_settings={"help_option_names": ["-h", "--help"]},
|
||||
)
|
||||
|
||||
def gbif_cruft():
|
||||
pass
|
||||
|
|
|
@ -37,5 +37,8 @@ class LazyGroup(click.Group):
|
|||
cmd_object = getattr(mod, cmd_object_name)
|
||||
# check the result to make debugging easier
|
||||
if not isinstance(cmd_object, click.BaseCommand):
|
||||
raise ValueError(f"Lazy loading of {import_path} failed by returning " "a non-command object")
|
||||
raise ValueError(
|
||||
f"Lazy loading of {import_path} failed by returning "
|
||||
"a non-command object"
|
||||
)
|
||||
return cmd_object
|
||||
|
|
|
@ -5,10 +5,20 @@
|
|||
import click
|
||||
from gbif_cruft.__about__ import __version__
|
||||
from gbif_cruft.lazy_group import LazyGroup
|
||||
import pyarrow
|
||||
import pyarrow.parquet as pq
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument('filename', nargs=1, default="/srv/gbif/gbif_2023-10-01/occurrence.parquet/000000", type=str)
|
||||
@click.argument(
|
||||
'filename',
|
||||
nargs=1,
|
||||
default="/srv/gbif/gbif_2023-10-01/occurrence.parquet/000000",
|
||||
type=click.File('rb'),
|
||||
)
|
||||
def cli(filename):
|
||||
print(filename)
|
||||
print("Reading", filename.name)
|
||||
muh = pq.read_table(filename)
|
||||
# print(muh)
|
||||
parquet_file = pq.ParquetFile(filename)
|
||||
muhmeta = parquet_file.metadata
|
||||
print(muhmeta)
|
||||
|
|
|
@ -8,11 +8,10 @@ from gbif_cruft.lazy_group import LazyGroup
|
|||
from pygbif import species
|
||||
import json
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument('name', nargs=1, default="axolotl", type=str)
|
||||
|
||||
def cli(name):
|
||||
foo = species.name_suggest(q=name)
|
||||
foo = json.dumps(foo)
|
||||
print(foo)
|
||||
|
||||
|
|
Loading…
Reference in New Issue