repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
Nominatim | Nominatim-master/test/python/api/test_api_lookup.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for lookup API call.
"""
import pytest
import nominatim.api as napi
def test_lookup_empty_list(ap... | 3,693 | 34.864078 | 77 | py |
Nominatim | Nominatim-master/test/python/api/conftest.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Helper fixtures for API call tests.
"""
from pathlib import Path
import pytest
import time
import datetime as... | 7,661 | 39.539683 | 89 | py |
Nominatim | Nominatim-master/test/python/api/test_result_formatting_v1.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for formatting results for the V1 API.
These test only ensure that the Python code is correct.
For fun... | 13,140 | 39.064024 | 166 | py |
Nominatim | Nominatim-master/test/python/api/test_results.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for result datatype helper functions.
"""
import struct
from binascii import hexlify
import pytest... | 2,779 | 32.095238 | 84 | py |
Nominatim | Nominatim-master/test/python/api/test_server_glue_v1.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the Python web frameworks adaptor, v1 API.
"""
from collections import namedtuple
import json
i... | 18,533 | 29.284314 | 87 | py |
Nominatim | Nominatim-master/test/python/api/test_result_formatting_v1_reverse.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for formatting reverse results for the V1 API.
These test only ensure that the Python code is correct.... | 12,990 | 39.095679 | 87 | py |
Nominatim | Nominatim-master/test/python/api/test_api_status.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the status API call.
"""
from pathlib import Path
import datetime as dt
import pytest
from nominat... | 1,705 | 30.018182 | 81 | py |
Nominatim | Nominatim-master/test/python/api/test_api_types.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for loading of parameter dataclasses.
"""
import pytest
from nominatim.errors import UsageError
im... | 1,100 | 29.583333 | 69 | py |
Nominatim | Nominatim-master/test/python/api/test_api_reverse.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for reverse API call.
These tests make sure that all Python code is correct and executable.
Functi... | 14,724 | 41.805233 | 111 | py |
Nominatim | Nominatim-master/test/python/api/test_localization.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Test functions for adapting results to the user's locale.
"""
import pytest
from nominatim.api import Lo... | 1,783 | 32.037037 | 78 | py |
Nominatim | Nominatim-master/test/python/api/test_api_search.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for search API calls.
These tests make sure that all Python code is correct and executable.
Functi... | 6,198 | 37.74375 | 106 | py |
Nominatim | Nominatim-master/test/python/api/test_api_connection.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for enhanced connection class for API functions.
"""
from pathlib import Path
import pytest
import ... | 2,872 | 29.56383 | 82 | py |
Nominatim | Nominatim-master/test/python/api/test_api_details.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for details API call.
"""
import datetime as dt
import pytest
import nominatim.api as napi
@pyte... | 25,663 | 43.633043 | 100 | py |
Nominatim | Nominatim-master/test/python/api/test_helpers_v1.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the helper functions for v1 API.
"""
import pytest
import nominatim.api.v1.helpers as helper
... | 4,043 | 34.787611 | 94 | py |
Nominatim | Nominatim-master/test/python/api/search/test_icu_query_analyzer.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for query analyzer for ICU tokenizer.
"""
from pathlib import Path
import pytest
import pytest_asy... | 6,199 | 32.15508 | 101 | py |
Nominatim | Nominatim-master/test/python/api/search/test_api_search_query.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for tokenized query data structures.
"""
import pytest
from nominatim.api.search import query
cla... | 3,768 | 35.95098 | 97 | py |
Nominatim | Nominatim-master/test/python/api/search/test_token_assignment.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Test for creation of token assignments from tokenized queries.
"""
import pytest
from nominatim.api.sear... | 15,194 | 43.171512 | 111 | py |
Nominatim | Nominatim-master/test/python/api/search/test_search_poi.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for running the POI searcher.
"""
import pytest
import nominatim.api as napi
from nominatim.api.ty... | 4,178 | 37.33945 | 88 | py |
Nominatim | Nominatim-master/test/python/api/search/test_query_analyzer_factory.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for query analyzer creation.
"""
from pathlib import Path
import pytest
from nominatim.api import... | 1,934 | 32.362069 | 92 | py |
Nominatim | Nominatim-master/test/python/api/search/test_legacy_query_analyzer.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for query analyzer for legacy tokenizer.
"""
from pathlib import Path
import pytest
import pytest_... | 8,133 | 32.2 | 101 | py |
Nominatim | Nominatim-master/test/python/api/search/test_search_near.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for running the near searcher.
"""
import pytest
import nominatim.api as napi
from nominatim.api.t... | 3,643 | 34.378641 | 89 | py |
Nominatim | Nominatim-master/test/python/api/search/test_search_places.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for running the generic place searcher.
"""
import pytest
import nominatim.api as napi
from nomina... | 16,819 | 42.57513 | 106 | py |
Nominatim | Nominatim-master/test/python/api/search/test_db_search_builder.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for creating abstract searches from token assignments.
"""
import pytest
from nominatim.api.search... | 14,165 | 33.720588 | 111 | py |
Nominatim | Nominatim-master/test/python/api/search/test_search_postcode.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for running the postcode searcher.
"""
import pytest
import nominatim.api as napi
from nominatim.a... | 3,591 | 35.653061 | 88 | py |
Nominatim | Nominatim-master/test/python/api/search/test_search_country.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for running the country searcher.
"""
import pytest
import nominatim.api as napi
from nominatim.ap... | 1,951 | 30.483871 | 92 | py |
Nominatim | Nominatim-master/test/python/tokenizer/test_icu.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for ICU tokenizer.
"""
import shutil
import yaml
import itertools
import pytest
from nominatim.tokeni... | 25,149 | 33.078591 | 120 | py |
Nominatim | Nominatim-master/test/python/tokenizer/test_place_sanitizer.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for execution of the sanitztion step.
"""
import pytest
from nominatim.errors import UsageError
import... | 2,379 | 29.512821 | 84 | py |
Nominatim | Nominatim-master/test/python/tokenizer/test_factory.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for creating new tokenizers.
"""
import pytest
from nominatim.db import properties
from nominatim.toke... | 2,402 | 28.304878 | 76 | py |
Nominatim | Nominatim-master/test/python/tokenizer/test_legacy.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Test for legacy tokenizer.
"""
import shutil
import re
import pytest
from nominatim.data.place_info import ... | 21,117 | 34.672297 | 105 | py |
Nominatim | Nominatim-master/test/python/tokenizer/test_icu_rule_loader.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for converting a config file to ICU rules.
"""
from textwrap import dedent
import pytest
import yaml
... | 8,899 | 31.129964 | 89 | py |
Nominatim | Nominatim-master/test/python/tokenizer/sanitizers/test_delete_tags.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the sanitizer that normalizes housenumbers.
"""
import pytest
from nominatim.data.place_info impo... | 11,161 | 33.134557 | 99 | py |
Nominatim | Nominatim-master/test/python/tokenizer/sanitizers/test_split_name_list.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the sanitizer that splits multivalue lists.
"""
import pytest
from nominatim.tokenizer.place_sanit... | 3,013 | 36.675 | 99 | py |
Nominatim | Nominatim-master/test/python/tokenizer/sanitizers/test_clean_tiger_tags.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for sanitizer that clean up TIGER tags.
"""
import pytest
from nominatim.tokenizer.place_sanitizer imp... | 1,470 | 32.431818 | 101 | py |
Nominatim | Nominatim-master/test/python/tokenizer/sanitizers/test_tag_analyzer_by_language.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the sanitizer that enables language-dependent analyzers.
"""
import pytest
from nominatim.data.pla... | 10,499 | 35.33218 | 88 | py |
Nominatim | Nominatim-master/test/python/tokenizer/sanitizers/test_strip_brace_terms.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the sanitizer that handles braced suffixes.
"""
import pytest
from nominatim.tokenizer.place_sanit... | 2,024 | 34.526316 | 100 | py |
Nominatim | Nominatim-master/test/python/tokenizer/sanitizers/test_sanitizer_config.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for sanitizer configuration helper functions.
"""
import pytest
from nominatim.errors import UsageErro... | 4,802 | 31.02 | 90 | py |
Nominatim | Nominatim-master/test/python/tokenizer/sanitizers/test_clean_postcodes.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the sanitizer that normalizes postcodes.
"""
import pytest
from nominatim.tokenizer.place_sanitize... | 3,980 | 37.650485 | 94 | py |
Nominatim | Nominatim-master/test/python/tokenizer/sanitizers/test_clean_housenumbers.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the sanitizer that normalizes housenumbers.
"""
import pytest
from nominatim.tokenizer.place_sanit... | 2,573 | 36.304348 | 87 | py |
Nominatim | Nominatim-master/test/python/tokenizer/token_analysis/test_analysis_postcodes.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for special postcode analysis and variant generation.
"""
import pytest
from icu import Transliterator... | 2,234 | 35.048387 | 87 | py |
Nominatim | Nominatim-master/test/python/tokenizer/token_analysis/test_generic_mutation.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for generic token analysis, mutation part.
"""
import pytest
from icu import Transliterator
import no... | 2,991 | 31.879121 | 85 | py |
Nominatim | Nominatim-master/test/python/tokenizer/token_analysis/test_generic.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for import name normalisation and variant generation.
"""
import pytest
from icu import Transliterator... | 9,562 | 33.648551 | 85 | py |
Nominatim | Nominatim-master/test/python/indexer/test_indexing.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for running the indexing.
"""
import itertools
import pytest
from nominatim.indexer import indexer
fro... | 12,335 | 40.395973 | 93 | py |
Nominatim | Nominatim-master/test/python/utils/test_json_writer.py | # SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for the streaming JSON writer.
"""
import json
import pytest
from nominatim.utils.json_writer imp... | 2,998 | 27.028037 | 81 | py |
Nominatim | Nominatim-master/test/python/utils/test_centroid.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for centroid computation.
"""
import pytest
from nominatim.utils.centroid import PointsCentroid
def t... | 1,493 | 25.210526 | 84 | py |
Nominatim | Nominatim-master/test/python/data/test_country_info.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for function that handle country properties.
"""
from textwrap import dedent
import pytest
from nomina... | 6,498 | 36.784884 | 88 | py |
Nominatim | Nominatim-master/test/bdd/environment.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
from pathlib import Path
from behave import *
from steps.geometry_factory import GeometryFactory
from steps.nom... | 2,331 | 31.84507 | 84 | py |
Nominatim | Nominatim-master/test/bdd/steps/nominatim_environment.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
from pathlib import Path
import importlib
import sys
import tempfile
import psycopg2
import psycopg2.extras
sys... | 14,891 | 39.248649 | 113 | py |
Nominatim | Nominatim-master/test/bdd/steps/steps_api_queries.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
""" Steps that run queries against the API.
Queries may either be run directly via PHP using the query scrip... | 13,257 | 34.167109 | 113 | py |
Nominatim | Nominatim-master/test/bdd/steps/check_functions.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Collection of assertion functions used for the steps.
"""
import json
import math
import re
class Almost:
... | 3,252 | 27.535088 | 81 | py |
Nominatim | Nominatim-master/test/bdd/steps/place_inserter.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Helper classes for filling the place table.
"""
import random
import string
class PlaceColumn:
""" Helpe... | 4,186 | 34.483051 | 79 | py |
Nominatim | Nominatim-master/test/bdd/steps/utils.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Various smaller helps for step execution.
"""
import logging
import subprocess
LOG = logging.getLogger(__nam... | 887 | 29.62069 | 93 | py |
Nominatim | Nominatim-master/test/bdd/steps/geometry_factory.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
from pathlib import Path
import os
from steps.geometry_alias import ALIASES
class GeometryFactory:
""" Prov... | 3,085 | 31.484211 | 90 | py |
Nominatim | Nominatim-master/test/bdd/steps/steps_db_ops.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
import logging
from itertools import chain
import psycopg2.extras
from place_inserter import PlaceColumn
from t... | 19,513 | 44.487179 | 115 | py |
Nominatim | Nominatim-master/test/bdd/steps/table_compare.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Functions to facilitate accessing and comparing the content of DB tables.
"""
import re
import json
from ste... | 7,597 | 33.071749 | 112 | py |
Nominatim | Nominatim-master/test/bdd/steps/http_responses.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Classes wrapping HTTP responses from the Nominatim API.
"""
import re
import json
import xml.etree.ElementTre... | 10,105 | 37.869231 | 103 | py |
Nominatim | Nominatim-master/test/bdd/steps/geometry_alias.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Collection of aliases for various world coordinates.
"""
ALIASES = {
# Country aliases
'AD': (1.58972, 42.54... | 7,329 | 26.870722 | 58 | py |
Nominatim | Nominatim-master/test/bdd/steps/steps_osm_data.py | # SPDX-License-Identifier: GPL-2.0-only
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
import tempfile
import random
import os
from pathlib import Path
from nominatim.tools.exec_utils import run_osm2... | 5,254 | 35.748252 | 112 | py |
lila | lila-main/setup.py |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="lila",
version="0.0.0",
author="Mahdi Qezlou, Simeon Bird, Adam Lidz, Guochao Sun, Andrew B. Newman",
author_email="mahdi.qezlou@email.ucr.edu",
description="Line Intens... | 869 | 30.071429 | 81 | py |
lila | lila-main/src/lila/inference.py | import numpy as np
from nbodykit.lab import cosmology
class Infer():
"""
some helper routines for inference from a simulation.
Used in notebooks/inference.ipynb
"""
def __init__(self, st, iter_sampling=100_000, chains=6, linear=True, rsd=False, dm_file = None, kmin=None, kmax =None, k_non=None, la... | 30,701 | 46.088957 | 212 | py |
lila | lila-main/src/lila/mock_lya.py | import os
import h5py
import numpy as np
from nbodykit.lab import ArrayMesh
from astropy.cosmology import Planck15
from lytomo_watershed import spectra_mocking as sm
from lytomo_watershed import z_bin
from scipy.ndimage import gaussian_filter as gf
from nbodykit import setup_logging
import logging
import logging.config... | 12,246 | 43.534545 | 135 | py |
lila | lila-main/src/lila/stats.py | import numpy as np
import h5py
import astropy.constants as const
from astropy.cosmology import Planck15 as cosmo
from nbodykit.lab import FFTPower
from nbodykit.lab import ArrayMesh
from nbodykit import utils
from lytomo_watershed import spectra_mocking as sm
import lim_lytomo
from . import git_handler
from nbodykit im... | 30,594 | 44.393175 | 149 | py |
lila | lila-main/src/lila/exclaim.py | import os
import glob
import h5py
import numpy as np
import dask.array as da
from astropy import constants, units
from astropy.cosmology import Planck15 as cosmo
from nbodykit import setup_logging
import logging
import logging.config
from nbodykit.lab import ArrayMesh
from nbodykit.lab import HDFCatalog
from nbodykit i... | 3,646 | 41.406977 | 127 | py |
lila | lila-main/src/lila/comap.py | import os
import glob
import h5py
import numpy as np
import dask.array as da
from astropy import constants as const
from astropy.cosmology import Planck15 as cosmo
from nbodykit import setup_logging
import logging
import logging.config
from nbodykit.lab import ArrayMesh
from . import lim
class MockComap(lim.MockLim):... | 7,071 | 47.108844 | 136 | py |
lila | lila-main/src/lila/plot.py | import numpy as np
import h5py
import matplotlib
from matplotlib import pyplot as plt
import corner
import matplotlib.lines as mlines
from astropy.cosmology import Planck15 as cosmo
class Maps():
"""Methods to plot our results"""
def __init__(self):
a=1
def mass_luminosity(self, COMAP21_params,ls=... | 38,319 | 48.960887 | 165 | py |
lila | lila-main/src/lila/__init__.py | 0 | 0 | 0 | py | |
lila | lila-main/src/lila/git_handler.py | import os
import subprocess
def get_head_hash(pack):
"""Get the long hash of the commit on HEAD
Paramters:
Pack : The package you are using
Returns: The hash as a binary
"""
repo_path = os.path.dirname(pack.__file__)
proc = subprocess.Popen('git -C '+repo_path+' rev-parse HEAD', stdo... | 425 | 25.625 | 102 | py |
lila | lila-main/src/lila/lim.py | import os
import glob
import h5py
import numpy as np
import dask.array as da
from astropy import constants as const
from astropy.cosmology import Planck15 as cosmo
from nbodykit import setup_logging
import logging
import logging.config
from nbodykit.lab import ArrayMesh, HDFCatalog, CurrentMPIComm
class MockLim():
... | 16,797 | 45.531856 | 134 | py |
lila | lila-main/src/lila/mock_galaxy.py | import os
import glob
import copy
from matplotlib.pyplot import axis
from pandas import to_timedelta
import h5py
import numpy as np
import dask.array as da
from astropy import constants as const
from astropy.cosmology import Planck15 as cosmo
from nbodykit import setup_logging
import logging
import logging.config
from ... | 13,425 | 43.310231 | 138 | py |
lila | lila-main/src/lila/tests/test_lim.py | import numpy as np
import h5py
import importlib
from os import system
from lim_lytomo import lim
from nbodykit.lab import *
import dask.array as da
def make_fake_sim(boxsize):
a = np.linspace(0,1,5)*boxsize*1000
x, y, z = np.meshgrid(a,a,a)
parts = np.zeros((a.size**3,3))
parts[:,0] = x.ravel()
... | 2,142 | 33.564516 | 111 | py |
lila | lila-main/helper_scripts/get_gal.py | # Helper functions to get stats for one mock
import argparse
from os.path import join
import numpy as np
from lim_lytomo import stats
from lim_lytomo import comap, mock_galaxy
from os.path import join
## Specifics of the simulation
boxsize= [250,250,250]
seed = 13
snap='z2.5'
basepath='/rhome/mqezl001/bigdata/ASTRID/s... | 3,474 | 38.942529 | 123 | py |
lila | lila-main/helper_scripts/get_latis_source_pk.py | import numpy as np
import h5py
from nbodykit.lab import HDFCatalog
from nbodykit.lab import FFTPower
cat = HDFCatalog('./LATIS_source_catalog.hdf5', dataset='source')
print(cat['Coordinates'].shape)
boxsize = [94,54,484]
Nmesh = [19, 11, 95]
mesh = cat.to_mesh(Nmesh=Nmesh, position='Coordinates',
BoxS... | 858 | 29.678571 | 82 | py |
lila | lila-main/helper_scripts/get_lya.py | # Helper functions to get stats for one mock
import argparse
from os.path import join
import numpy as np
from lim_lytomo import stats
from lim_lytomo import comap, mock_lya
from os.path import join
## Specifics of the simulation
boxsize= [250]*3
seed = 13
snap='z2.5'
#snap = None
basepath='/rhome/mqezl001/bigdata/ASTR... | 2,896 | 37.118421 | 108 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/fusion.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, random, math
import time
import glob
import numpy as np
import shutil
import torch
import logging
import argparse
import traceback
import torch.nn as nn
import torch.utils
import torchvision.datasets as dset
import torch.backends.cudnn as cudnn... | 16,382 | 45.279661 | 160 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/train.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import time
import glob
import numpy as np
import shutil
import cv2
import os, random, math
import sys
# sys.path.append(os.path.join('..', os.path.abspath(os.path.join(os.getcwd()))) )
from pathlib import Path
from timm.scheduler import create_scheduler
f... | 33,323 | 44.154472 | 182 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/train_fusion.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import time
import glob
import numpy as np
import shutil
import cv2
import os, random, math
import sys
from pathlib import Path
from timm.scheduler import create_scheduler
from timm.utils import ApexScaler, NativeScaler
from timm.optim import create_optimi... | 30,632 | 45.064662 | 183 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/tools/fusion.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, random, math
import time
import glob
import numpy as np
import shutil
import torch
import logging
import argparse
import traceback
import torch.nn as nn
import torch.utils
import torchvision.datasets as dset
import torch.backends.cudnn as cudnn... | 16,564 | 40.830808 | 192 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/config/config.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import yaml
# from easydict import EasyDict as edict
def Config(args):
print()
print('='*80)
with open(args.config) as f:
config = yaml.load(f, Loader=yaml.FullLoader)
for dic in config:
for k, v in config[dic].items():
... | 424 | 22.611111 | 54 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/config/__init__.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
from .config import Config | 90 | 17.2 | 54 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/demo/cluster.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import torch
import torch.nn.functional as F
from scipy.spatial.distance import pdist
import pandas as pd
from sklearn import manifold
import numpy as np
import sys
import sklearn
from sklearn import metrics
import matplotlib
matplotlib.use('agg')
from mat... | 2,693 | 37.485714 | 121 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/demo/plot.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
from mpl_toolkits import axisartist
import seaborn as sns
import numpy as np
import re
import sys
import os, argparse, random
import torch
def p... | 20,739 | 39.826772 | 187 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/utils/evaluate_metric.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
# -------------------
# import modules
# -------------------
import random, os
import numpy as np
import cv2
import heapq
import shutil
from textwrap import wrap
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.image as mpimage
from sk... | 5,573 | 39.100719 | 150 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/utils/print_function.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import logging
def print_func(info):
'''
:param info: {name: value}
:return:
'''
txts = []
for name, value in info.items():
txts.append('{}: {}'.format(name, value))
logging.info('\t'.join(txts)) | 296 | 18.8 | 54 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/utils/utils.py | '''
This file is modified from:
https://github.com/yuhuixu1993/PC-DARTS/blob/master/utils.py
'''
import os
import numpy as np
import torch
import torch.distributed as dist
import shutil
import torchvision.transforms as transforms
from torch.autograd import Variable
from collections import OrderedDict
import random
fro... | 21,656 | 41.216374 | 338 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/utils/mixup.py | """
This file is modified from:
https://github.com/rwightman/pytorch-image-models/blob/main/timm/data/mixup.py
Mixup and Cutmix
Papers:
mixup: Beyond Empirical Risk Minimization (https://arxiv.org/abs/1710.09412)
CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features (https://arxiv.or... | 17,254 | 44.890957 | 120 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/utils/visualizer.py | '''
This file is modified from:
https://github.com/zhoubenjia/RAAR3DNet/blob/master/Network_Train/utils/visualizer.py
'''
#coding: utf8
import numpy as np
import time
class Visualizer():
def __init__(self, env='default', **kwargs):
import visdom
self.vis = visdom.Visdom(env=env, use_incoming_so... | 3,190 | 29.980583 | 107 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/utils/shufflemix.py | import numpy as np
import torch
import random
def Vmixup(x, lam):
x_flipped = x.flip(0).mul_(1. - lam)
x.mul_(lam).add_(x_flipped)
def ShuffleMix(x, lam):
x_flipped = x.flip(0)
replace_idx = random.sample(range(0, x.size(2)), round((1. - lam)*x.size(2)))
x[:, :, replace_idx, :, :] = x_flipped[:, :... | 5,200 | 35.626761 | 127 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/utils/__init__.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
from .print_function import print_func
from .build import *
from .evaluate_metric import EvaluateMetric
from .utils import *
from .mixup import Mixup
| 214 | 20.5 | 54 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/utils/build.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import torch
import math
import torch.nn.functional as F
# from .utils import cosine_scheduler
import matplotlib.pyplot as plt
import numpy as np
class LabelSmoothingCrossEntropy(torch.nn.Module):
def __init__(self, smoothing: float = 0.1,
... | 5,901 | 37.575163 | 118 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/data/data_preprose_for_NTU.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
NTU-RGBD Data preprocessing function
'''
import cv2
from PIL import Image
import numpy as np
import os, glob, re
import argparse
import csv
import random
from tqdm import tqdm
from multiprocessing import Process
import shutil
from multiprocessing import Pool... | 8,756 | 34.597561 | 117 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/data/video2Images.py | import cv2
from PIL import Image
import numpy as np
import os, glob, re, sys
import argparse
import csv
import random
from tqdm import tqdm
from multiprocessing import Process
import shutil
from multiprocessing import Pool, cpu_count
def video2image(v_p):
img_path = os.path.join(args.img_path, v_p.split('/')[-1]... | 5,096 | 33.439189 | 145 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/__init__.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
from .datasets import *
from .model import * | 107 | 20.6 | 54 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/base.py | '''
This file is modified from:
https://github.com/zhoubenjia/RAAR3DNet/blob/master/Network_Train/lib/datasets/base.py
'''
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, set_image_backend
import torch.nn.functional as F
from PIL import Image
from PIL import ImageFilt... | 12,341 | 41.412371 | 210 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/Jester.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import torch
from .base import Datasets
from torchvision import transforms, set_image_backend
import random, os
from PIL import Image
import numpy as np
import logging
# import accimage
# set_image_backend('accimage')
np.random.seed(123)
class JesterData(... | 2,115 | 37.472727 | 186 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/IsoGD.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import torch
from .base import Datasets
from torchvision import transforms, set_image_backend
import random, os
from PIL import Image
import numpy as np
# import accimage
# set_image_backend('accimage')
class IsoGDData(Datasets):
def __init__(self, ar... | 1,844 | 40 | 155 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/augmentation.py | '''
This file is modified from:
https://github.com/okankop/vidaug/blob/master/vidaug/augmentors/affine.py
'''
import PIL
from PIL import ImageFilter, ImageOps, Image
import os, glob
import math, random
import numpy as np
import logging
import cv2
from scipy.ndimage.filters import gaussian_filter
import numbers
class S... | 9,621 | 34.116788 | 102 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/THU_READ.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import torch
from .base import Datasets
from torchvision import transforms, set_image_backend
import random, os
from PIL import Image
import numpy as np
import logging
import cv2
from einops import rearrange, repeat
from torchvision.utils import save_imag... | 1,708 | 33.18 | 118 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/transforms_factory.py | """ Transforms Factory
Factory methods for building image transforms for use with TIMM (PyTorch Image Models)
Hacked together by / Copyright 2019, Ross Wightman
"""
import math
import torch
from torchvision import transforms
from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, DEFAULT_CROP_PCT... | 8,665 | 34.08502 | 115 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/distributed_sampler.py | '''
This file is modified from:
https://github.com/open-mmlab/mmdetection/blob/master/mmdet/datasets/samplers/distributed_sampler.py
'''
import math
import torch
from torch.utils.data import DistributedSampler as _DistributedSampler
class DistributedSampler(_DistributedSampler):
def __init__(self, dataset, num_r... | 1,240 | 33.472222 | 100 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/NvGesture.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import torch
from .base import Datasets
from torchvision import transforms, set_image_backend
import random, os
from PIL import Image
import numpy as np
import logging
# import accimage
# set_image_backend('accimage')
np.random.seed(123)
class NvData(Data... | 1,963 | 36.769231 | 146 | py |
MotionRGBD-PAMI | MotionRGBD-PAMI-main/lib/datasets/__init__.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
from .build import *
| 85 | 13.333333 | 54 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.