Skip to content

Commit

Permalink
refactor: untangle classes in helper_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sieboldianus committed Nov 19, 2019
1 parent e1975a6 commit 3a139fa
Show file tree
Hide file tree
Showing 20 changed files with 281 additions and 267 deletions.
11 changes: 6 additions & 5 deletions lbsntransform/__init__.py
Expand Up @@ -4,10 +4,11 @@

from .version import __version__

from .lbsntransform_ import LBSNTransform
from .tools.helper_functions import (GeocodeLocations, HelperFunctions,
LBSNRecordDicts, TimeMonitor)
from .config.config import BaseConfig
from .input.load_data import LoadData
from .output.lbsn.shared_structure_proto_lbsndb import ProtoLBSNMapping
from .lbsntransform_ import LBSNTransform
from .output.hll.shared_structure_proto_hlldb import ProtoHLLMapping
from .config.config import BaseConfig
from .output.lbsn.shared_structure_proto_lbsndb import ProtoLBSNMapping
from .output.shared_structure import (GeocodeLocations, LBSNRecordDicts,
TimeMonitor)
from .tools.helper_functions import HelperFunctions as HF
2 changes: 1 addition & 1 deletion lbsntransform/__main__.py
Expand Up @@ -22,7 +22,7 @@
import traceback

from lbsntransform.tools.helper_functions import HelperFunctions as HF
from lbsntransform.tools.helper_functions import TimeMonitor
from lbsntransform.output.shared_structure import TimeMonitor
from lbsntransform.input.load_data import LoadData
from lbsntransform.output.submit_data import LBSNTransfer
from lbsntransform.config.config import BaseConfig
Expand Down
2 changes: 1 addition & 1 deletion lbsntransform/input/load_data.py
Expand Up @@ -22,7 +22,7 @@
from lbsnstructure import lbsnstructure_pb2 as lbsn

from ..tools.db_connection import DBConnection
from ..tools.helper_functions import GeocodeLocations
from ..output.shared_structure import GeocodeLocations
from ..tools.helper_functions import HelperFunctions as HF


Expand Down
2 changes: 1 addition & 1 deletion lbsntransform/input/mappings/field_mapping_fb.py
Expand Up @@ -18,7 +18,7 @@
from shapely.geometry.polygon import Polygon

from ...tools.helper_functions import HelperFunctions as HF
from ...tools.helper_functions import LBSNRecordDicts
from ...output.shared_structure import LBSNRecordDicts


class FieldMappingFBPlace():
Expand Down
2 changes: 1 addition & 1 deletion lbsntransform/input/mappings/field_mapping_flickr.py
Expand Up @@ -14,7 +14,7 @@
from lbsnstructure import lbsnstructure_pb2 as lbsn

from ...tools.helper_functions import HelperFunctions as HF
from ...tools.helper_functions import LBSNRecordDicts
from ...output.shared_structure import LBSNRecordDicts


class FieldMappingFlickr():
Expand Down
2 changes: 1 addition & 1 deletion lbsntransform/input/mappings/field_mapping_twitter.py
Expand Up @@ -19,7 +19,7 @@
from shapely.geometry.polygon import Polygon

from ...tools.helper_functions import HelperFunctions as HF
from ...tools.helper_functions import LBSNRecordDicts
from ...output.shared_structure import LBSNRecordDicts


class FieldMappingTwitter():
Expand Down
2 changes: 1 addition & 1 deletion lbsntransform/input/mappings/field_mapping_yfcc100m.py
Expand Up @@ -18,7 +18,7 @@
from lbsnstructure import lbsnstructure_pb2 as lbsn

from ...tools.helper_functions import HelperFunctions as HF
from ...tools.helper_functions import LBSNRecordDicts
from ...output.shared_structure import LBSNRecordDicts

# pylint: disable=no-member

Expand Down
2 changes: 1 addition & 1 deletion lbsntransform/lbsntransform_.py
Expand Up @@ -16,7 +16,7 @@
from pathlib import Path

from .tools.helper_functions import HelperFunctions as HF
from .tools.helper_functions import LBSNRecordDicts
from .output.shared_structure import LBSNRecordDicts
from .input.load_data import LoadData
from .output.submit_data import LBSNTransfer
from .config.config import BaseConfig
Expand Down
10 changes: 6 additions & 4 deletions lbsntransform/output/csv/store_csv.py
Expand Up @@ -21,8 +21,10 @@
from google.protobuf import text_format
from google.protobuf.timestamp_pb2 import Timestamp

from lbsntransform.tools.helper_functions import HelperFunctions, LBSNRecordDicts
from lbsntransform.output.lbsn.shared_structure_proto_lbsndb import ProtoLBSNMapping
from lbsntransform.output.lbsn.shared_structure_proto_lbsndb import \
ProtoLBSNMapping
from lbsntransform.tools.helper_functions import HelperFunctions as HF
from lbsntransform.output.shared_structure import LBSNRecordDicts


class LBSNcsv():
Expand Down Expand Up @@ -160,7 +162,7 @@ def merge_files(self, filelist, type_name):
def create_proto_by_descriptor_name(self, desc_name):
"""Create new proto record by name
"""
new_record = HelperFunctions.dict_type_switcher(desc_name)
new_record = HF.dict_type_switcher(desc_name)
return new_record

# def parse_message(self,msgType,stringMessage):
Expand Down Expand Up @@ -227,7 +229,7 @@ def merge_records(self, duplicate_record_lines, type_name):
record = self.get_record_from_base64_encoded_string(
duprecord, type_name)
# will modify/overwrite prev_duprecord
HelperFunctions.merge_existing_records(
HF.merge_existing_records(
prev_duprecord, record)
merged_record = self.serialize_encode_record(prev_duprecord)
else:
Expand Down
9 changes: 5 additions & 4 deletions lbsntransform/output/hll/base/social.py
Expand Up @@ -3,13 +3,14 @@
"""Hll bases for social facet
"""

from collections import namedtuple, OrderedDict
from typing import Tuple, List, Any, Dict, Union
from collections import OrderedDict, namedtuple
from typing import Any, Dict, List, Tuple, Union

from lbsntransform.tools.helper_functions import HelperFunctions as HF
from ..hll_functions import HLLFunctions as HLF
from lbsnstructure import lbsnstructure_pb2 as lbsn
from lbsntransform.output.hll import hll_bases as hll
from lbsntransform.tools.helper_functions import HelperFunctions as HF

from ..hll_functions import HLLFunctions as HLF

FACET = 'social'

Expand Down
9 changes: 5 additions & 4 deletions lbsntransform/output/hll/base/spatial.py
Expand Up @@ -3,13 +3,14 @@
"""Hll bases for spatial facet
"""

from collections import namedtuple, OrderedDict
from typing import Tuple, List, Any, Dict, Union
from collections import OrderedDict, namedtuple
from typing import Any, Dict, List, Tuple, Union

from lbsntransform.tools.helper_functions import HelperFunctions as HF
from ..hll_functions import HLLFunctions as HLF
from lbsnstructure import lbsnstructure_pb2 as lbsn
from lbsntransform.output.hll import hll_bases as hll
from lbsntransform.tools.helper_functions import HelperFunctions as HF

from ..hll_functions import HLLFunctions as HLF

FACET = 'spatial'

Expand Down
9 changes: 5 additions & 4 deletions lbsntransform/output/hll/base/temporal.py
Expand Up @@ -3,13 +3,14 @@
"""Hll bases for temporal facet
"""

from collections import namedtuple, OrderedDict
from typing import Tuple, List, Any, Dict, Union
from collections import OrderedDict, namedtuple
from typing import Any, Dict, List, Tuple, Union

from lbsntransform.tools.helper_functions import HelperFunctions as HF
from ..hll_functions import HLLFunctions as HLF
from lbsnstructure import lbsnstructure_pb2 as lbsn
from lbsntransform.output.hll import hll_bases as hll
from lbsntransform.tools.helper_functions import HelperFunctions as HF

from ..hll_functions import HLLFunctions as HLF

FACET = 'temporal'

Expand Down
9 changes: 5 additions & 4 deletions lbsntransform/output/hll/base/topical.py
Expand Up @@ -3,13 +3,14 @@
"""Hll bases for topical facet
"""

from collections import namedtuple, OrderedDict
from typing import Tuple, List, Any, Dict, Union
from collections import OrderedDict, namedtuple
from typing import Any, Dict, List, Tuple, Union

from lbsntransform.tools.helper_functions import HelperFunctions as HF
from ..hll_functions import HLLFunctions as HLF
from lbsnstructure import lbsnstructure_pb2 as lbsn
from lbsntransform.output.hll import hll_bases as hll
from lbsntransform.tools.helper_functions import HelperFunctions as HF

from ..hll_functions import HLLFunctions as HLF

FACET = 'topical'

Expand Down
8 changes: 4 additions & 4 deletions lbsntransform/output/hll/hll_bases.py
Expand Up @@ -54,14 +54,14 @@ class structures defined here, thus it is important that order of keys,
A privacy-aware model to process data from location-based social media.
"""

import sys
import inspect
from collections import namedtuple, OrderedDict
from typing import Tuple, List, Any, Dict, Union
import sys
from collections import OrderedDict, namedtuple
from typing import Any, Dict, List, Tuple, Union

from lbsnstructure import lbsnstructure_pb2 as lbsn

from lbsntransform.tools.helper_functions import HelperFunctions as HF

from .hll_functions import HLLFunctions as HLF

# named tuple of defined hll metrics
Expand Down
3 changes: 2 additions & 1 deletion lbsntransform/output/hll/hll_functions.py
Expand Up @@ -6,7 +6,8 @@

import datetime as dt
from collections import namedtuple
from typing import Any, Generator, List, Set, Tuple, Union, Dict
from typing import Any, Dict, Generator, List, Set, Tuple, Union

from lbsnstructure import lbsnstructure_pb2 as lbsn
from lbsntransform.tools.helper_functions import HelperFunctions as HF

Expand Down
7 changes: 4 additions & 3 deletions lbsntransform/output/hll/shared_structure_proto_hlldb.py
Expand Up @@ -8,14 +8,15 @@

import inspect
import sys
from typing import Tuple, List, Any, Dict, Union
from collections import defaultdict, namedtuple
from typing import Any, Dict, List, Tuple, Union

from lbsnstructure import lbsnstructure_pb2 as lbsn
from lbsntransform.output.hll import hll_bases as hll
from lbsntransform.output.hll.base import social, spatial, temporal, topical
from lbsntransform.tools.helper_functions import HelperFunctions as HF

from .hll_functions import HLLFunctions as HLF
from lbsntransform.output.hll.base import social, spatial, temporal, topical
from lbsntransform.output.hll import hll_bases as hll


class ProtoHLLMapping():
Expand Down
2 changes: 1 addition & 1 deletion lbsntransform/output/hll/sql_hll.py
Expand Up @@ -4,8 +4,8 @@
Module for sql insert functions for LBSN (hll) db
"""

from lbsntransform.tools.helper_functions import HelperFunctions as HF
from lbsntransform.output.hll import hll_bases as hll
from lbsntransform.tools.helper_functions import HelperFunctions as HF


class HLLSql():
Expand Down

0 comments on commit 3a139fa

Please sign in to comment.