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

1018 do namespaces #1119

Merged
merged 3 commits into from
Oct 24, 2019
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: 1 addition & 3 deletions cartoframes/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

from .dataset.dataset import Dataset
from .dataset.registry.strategies_registry import StrategiesRegistry
from .observatory.catalog import Catalog

__all__ = [
'Dataset',
'StrategiesRegistry',
'Catalog'
'StrategiesRegistry'
]
1 change: 0 additions & 1 deletion cartoframes/data/dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from __future__ import absolute_import
1 change: 0 additions & 1 deletion cartoframes/data/dataset/registry/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from __future__ import absolute_import
6 changes: 0 additions & 6 deletions cartoframes/data/enrichment/__init__.py

This file was deleted.

20 changes: 12 additions & 8 deletions cartoframes/data/observatory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import absolute_import

from .catalog import Catalog
from .category import Category
from .country import Country
from .dataset import CatalogDataset
from .geography import Geography
from .provider import Provider
from .variable import Variable
from .catalog.catalog import Catalog
from .catalog.category import Category
from .catalog.country import Country
from .catalog.dataset import CatalogDataset
from .catalog.geography import Geography
from .catalog.provider import Provider
from .catalog.variable import Variable
from .enrichment.points_enrichment import enrich_points
from .enrichment.polygons_enrichment import enrich_polygons

__all__ = [
'Catalog',
Expand All @@ -15,5 +17,7 @@
'CatalogDataset',
'Geography',
'Provider',
'Variable'
'Variable',
'enrich_points',
'enrich_polygons'
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .subscriptions import Subscriptions
from .repository.constants import COUNTRY_FILTER, CATEGORY_FILTER, GEOGRAPHY_FILTER

from ...auth import Credentials, defaults
from ....auth import Credentials, defaults


class Catalog(object):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from __future__ import absolute_import

from cartoframes.data.observatory.repository.constants import CATEGORY_FILTER

from cartoframes.data.observatory.repository.geography_repo import get_geography_repo

from .entity import CatalogEntity
from .repository.constants import CATEGORY_FILTER
from .repository.category_repo import get_category_repo
from .repository.dataset_repo import get_dataset_repo
from .repository.geography_repo import get_geography_repo


class Category(CatalogEntity):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import absolute_import


from .entity import CatalogEntity
from .repository.geography_repo import get_geography_repo
from .repository.country_repo import get_country_repo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from carto.exceptions import CartoException

from ..clients.bigquery_client import BigQueryClient
from ...auth import Credentials, defaults
from ...clients.bigquery_client import BigQueryClient
from ....auth import Credentials, defaults

try:
from abc import ABC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import absolute_import


from .entity import CatalogEntity
from .repository.dataset_repo import get_dataset_repo
from .repository.geography_repo import get_geography_repo
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self):

@classmethod
def _get_entity_class(cls):
from cartoframes.data.observatory.category import Category
from cartoframes.data.observatory.catalog.category import Category
return Category

def _get_rows(self, filters=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self):

@classmethod
def _get_entity_class(cls):
from cartoframes.data.observatory.country import Country
from cartoframes.data.observatory.catalog.country import Country
return Country

def _get_rows(self, filters=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_all(self, filters=None, credentials=None):

@classmethod
def _get_entity_class(cls):
from cartoframes.data.observatory.dataset import CatalogDataset
from cartoframes.data.observatory.catalog.dataset import CatalogDataset
return CatalogDataset

def _get_rows(self, filters=None):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cartoframes.exceptions import DiscoveryException
from cartoframes.data.observatory.entity import CatalogList, is_slug_value
from .repo_client import RepoClient
from ..entity import CatalogList, is_slug_value

try:
from abc import ABC, abstractmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from __future__ import absolute_import

import geopandas as gpd
from cartoframes.auth import Credentials

from cartoframes.data import Dataset
from cartoframes.auth import Credentials

from .constants import COUNTRY_FILTER, CATEGORY_FILTER
from .entity_repo import EntityRepository

Expand Down Expand Up @@ -32,7 +33,7 @@ def get_all(self, filters=None, credentials=None):

@classmethod
def _get_entity_class(cls):
from cartoframes.data.observatory.geography import Geography
from cartoframes.data.observatory.catalog.geography import Geography
return Geography

def _get_rows(self, filters=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self):

@classmethod
def _get_entity_class(cls):
from cartoframes.data.observatory.provider import Provider
from cartoframes.data.observatory.catalog.provider import Provider
return Provider

def _get_rows(self, filters=None):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import

from ...clients import SQLClient
from ....auth import Credentials
from ....clients import SQLClient
from .....auth import Credentials
from ..subscriptions import get_subscription_ids


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self):

@classmethod
def _get_entity_class(cls):
from cartoframes.data.observatory.variable_group import VariableGroup
from cartoframes.data.observatory.catalog.variable_group import VariableGroup
return VariableGroup

def _get_rows(self, filters=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self):

@classmethod
def _get_entity_class(cls):
from cartoframes.data.observatory.variable import Variable
from cartoframes.data.observatory.catalog.variable import Variable
return Variable

def _get_rows(self, filters=None):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

from collections import defaultdict

from ...auth import get_default_credentials
from ...exceptions import EnrichmentException
from ...utils.geom_utils import (_compute_geometry_from_geom, geojson_to_wkt,
wkt_to_geojson)
from ..clients import bigquery_client
from ..dataset.dataset import Dataset
from ..observatory import Variable
from ..observatory import CatalogDataset
from ..catalog.variable import Variable
from ..catalog.dataset import CatalogDataset
from ...dataset.dataset import Dataset
from ...clients import bigquery_client
from ....auth import get_default_credentials
from ....exceptions import EnrichmentException
from ....utils.geom_utils import _compute_geometry_from_geom, geojson_to_wkt, wkt_to_geojson


_ENRICHMENT_ID = 'enrichment_id'
Expand Down
1 change: 0 additions & 1 deletion cartoframes/data/observatory/repository/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tox -e e2e

### Linter

We use `flake8` in CI because it's standard, fast and compatible with GitHub tools like Hound. However, we use also `pylint`for a deeper lint analysis with `tox -e pylint`.
We use `flake8` in CI because it's standard, fast and compatible with GitHub tools like Hound. However, we use also `pylint`for a deeper lint analysis with `tox -e lint`.

### Testing

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from cartoframes.data.observatory.variable import Variable
from cartoframes.data.observatory.dataset import CatalogDataset
from cartoframes.data.observatory.category import Category
from cartoframes.data.observatory.geography import Geography
from cartoframes.data.observatory.country import Country
from cartoframes.data.observatory.provider import Provider
from cartoframes.data.observatory.variable_group import VariableGroup
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.catalog.variable import Variable
from cartoframes.data.observatory.catalog.dataset import CatalogDataset
from cartoframes.data.observatory.catalog.category import Category
from cartoframes.data.observatory.catalog.geography import Geography
from cartoframes.data.observatory.catalog.country import Country
from cartoframes.data.observatory.catalog.provider import Provider
from cartoframes.data.observatory.catalog.variable_group import VariableGroup
from cartoframes.data.observatory.catalog.entity import CatalogList

db_country1 = {'id': 'esp'}
db_country2 = {'id': 'usa'}
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import pytest

from cartoframes.data.observatory.category import Category

from cartoframes.exceptions import DiscoveryException
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.repository.category_repo import CategoryRepository
from cartoframes.data.observatory.repository.repo_client import RepoClient
from cartoframes.data.observatory.catalog.category import Category
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.repository.category_repo import CategoryRepository
from cartoframes.data.observatory.catalog.repository.repo_client import RepoClient
from ..examples import test_category1, test_categories, db_category1, db_category2

try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest

from cartoframes.exceptions import DiscoveryException
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.country import Country
from cartoframes.data.observatory.repository.country_repo import CountryRepository
from cartoframes.data.observatory.repository.repo_client import RepoClient
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.country import Country
from cartoframes.data.observatory.catalog.repository.country_repo import CountryRepository
from cartoframes.data.observatory.catalog.repository.repo_client import RepoClient
from ..examples import test_countries, test_country1, db_country1, db_country2

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from cartoframes.auth import Credentials

from cartoframes.exceptions import DiscoveryException
from cartoframes.data.observatory.dataset import CatalogDataset
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.repository.dataset_repo import DatasetRepository
from cartoframes.data.observatory.repository.repo_client import RepoClient
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.dataset import CatalogDataset
from cartoframes.data.observatory.catalog.repository.dataset_repo import DatasetRepository
from cartoframes.data.observatory.catalog.repository.repo_client import RepoClient
from ..examples import test_dataset1, test_datasets, db_dataset1, db_dataset2

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from cartoframes.auth import Credentials
from cartoframes.exceptions import DiscoveryException
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.geography import Geography
from cartoframes.data.observatory.repository.geography_repo import GeographyRepository
from cartoframes.data.observatory.repository.repo_client import RepoClient
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.geography import Geography
from cartoframes.data.observatory.catalog.repository.geography_repo import GeographyRepository
from cartoframes.data.observatory.catalog.repository.repo_client import RepoClient
from ..examples import test_geography1, test_geographies, db_geography1, db_geography2

try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest

from cartoframes.exceptions import DiscoveryException
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.provider import Provider
from cartoframes.data.observatory.repository.provider_repo import ProviderRepository
from cartoframes.data.observatory.repository.repo_client import RepoClient
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.provider import Provider
from cartoframes.data.observatory.catalog.repository.provider_repo import ProviderRepository
from cartoframes.data.observatory.catalog.repository.repo_client import RepoClient
from ..examples import test_provider1, test_providers, db_provider1, db_provider2

try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from cartoframes.data.clients import SQLClient
from cartoframes.data.observatory.repository.repo_client import RepoClient
from cartoframes.data.observatory.catalog.repository.repo_client import RepoClient

from ..examples import db_dataset1, db_dataset2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest

from cartoframes.exceptions import DiscoveryException
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.variable_group import VariableGroup
from cartoframes.data.observatory.repository.variable_group_repo import VariableGroupRepository
from cartoframes.data.observatory.repository.repo_client import RepoClient
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.variable_group import VariableGroup
from cartoframes.data.observatory.catalog.repository.variable_group_repo import VariableGroupRepository
from cartoframes.data.observatory.catalog.repository.repo_client import RepoClient
from ..examples import test_variable_group1, test_variables_groups, db_variable_group1, db_variable_group2

try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest

from cartoframes.exceptions import DiscoveryException
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.variable import Variable
from cartoframes.data.observatory.repository.variable_repo import VariableRepository
from cartoframes.data.observatory.repository.repo_client import RepoClient
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.variable import Variable
from cartoframes.data.observatory.catalog.repository.variable_repo import VariableRepository
from cartoframes.data.observatory.catalog.repository.repo_client import RepoClient
from ..examples import test_variable1, test_variables, db_variable1, db_variable2

try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest

from cartoframes.auth import Credentials
from cartoframes.data.observatory.dataset import CatalogDataset
from cartoframes.data.observatory.geography import Geography
from cartoframes.data.observatory.country import Country
from cartoframes.data.observatory.category import Category
from cartoframes.data.observatory.catalog import Catalog
from cartoframes.data.observatory.subscriptions import Subscriptions
from cartoframes.data.observatory.repository.geography_repo import GeographyRepository
from cartoframes.data.observatory.catalog.dataset import CatalogDataset
from cartoframes.data.observatory.catalog.geography import Geography
from cartoframes.data.observatory.catalog.country import Country
from cartoframes.data.observatory.catalog.category import Category
from cartoframes.data.observatory.catalog.catalog import Catalog
from cartoframes.data.observatory.catalog.subscriptions import Subscriptions
from cartoframes.data.observatory.catalog.repository.geography_repo import GeographyRepository
from .examples import test_country2, test_country1, test_category1, test_category2, test_dataset1, test_dataset2, \
test_geographies, test_datasets, test_categories, test_countries, test_geography1, test_geography2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pandas as pd
from cartoframes.data.observatory.repository.geography_repo import GeographyRepository

from cartoframes.data.observatory.category import Category
from cartoframes.data.observatory.repository.category_repo import CategoryRepository
from cartoframes.data.observatory.repository.dataset_repo import DatasetRepository
from cartoframes.data.observatory.entity import CatalogList
from cartoframes.data.observatory.catalog.category import Category
from cartoframes.data.observatory.catalog.repository.dataset_repo import DatasetRepository
from cartoframes.data.observatory.catalog.repository.category_repo import CategoryRepository
from cartoframes.data.observatory.catalog.repository.geography_repo import GeographyRepository
from cartoframes.data.observatory.catalog.entity import CatalogList
from .examples import test_category1, test_datasets, test_categories, db_category1, test_category2, db_category2, \
test_geographies

Expand Down
Loading