Skip to content

Commit

Permalink
Updated version-get method, fixed references to util, updated syntax …
Browse files Browse the repository at this point in the history
…for in-module imports
  • Loading branch information
dwest77a committed Oct 29, 2024
1 parent 80780f3 commit 61ca155
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 19 deletions.
5 changes: 4 additions & 1 deletion ceda_elasticsearch_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from .elasticsearch.ceda_elasticsearch_client import CEDAElasticsearchClient

from .index_tools.base import IndexUpdaterBase
from .index_tools.ceda_client import BulkClient
from .index_tools.ceda_client import BulkClient

from importlib.metadata import version
__version__ = version
2 changes: 0 additions & 2 deletions ceda_elasticsearch_tools/cmdline/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
import pkg_resources
__version__ = pkg_resources.require("ceda_elasticsearch_tools")[0].version
8 changes: 3 additions & 5 deletions ceda_elasticsearch_tools/cmdline/ceda_eo/coverage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
from docopt import docopt

import simplejson as json
from ceda_elasticsearch_tools.cmdline import __version__
from ceda_elasticsearch_tools import __version__
import os
import re
from ceda_elasticsearch_tools.core.updater import ElasticsearchUpdater, ElasticsearchQuery
from ceda_elasticsearch_tools.core import util


from ceda_elasticsearch_tools.core import utils

def main():
base = os.path.dirname(__file__)
Expand Down Expand Up @@ -71,7 +69,7 @@ def main():

print(f"Group: {group} Total files: {len(file_list)}"
f" Files in: {len(results['True'])} Files out: {len(results['False'])}"
f" Coverage: {util.percent(len(file_list),len(results['True']))}")
f" Coverage: {utils.percent(len(file_list),len(results['True']))}")



Expand Down
2 changes: 1 addition & 1 deletion ceda_elasticsearch_tools/cmdline/fbs_missing_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import os
from ceda_elasticsearch_tools.core import utils
import subprocess
from ceda_elasticsearch_tools.cmdline import __version__
from ceda_elasticsearch_tools import __version__
from time import sleep
from tqdm import tqdm

Expand Down
4 changes: 2 additions & 2 deletions ceda_elasticsearch_tools/cmdline/nla_sync_es.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from docopt import docopt

import requests
import pkg_resources
from ceda_elasticsearch_tools import __version__
from time import sleep
import itertools, sys
from multiprocessing import Process
Expand Down Expand Up @@ -122,7 +122,7 @@ def main():
"""

# Get command line arguments
args = docopt(__doc__, version=pkg_resources.require("ceda_elasticsearch_tools")[0].version)
args = docopt(__doc__, version=__version__)

if not args["--host"]:
host = "jasmin-es1.ceda.ac.uk"
Expand Down
2 changes: 1 addition & 1 deletion ceda_elasticsearch_tools/cmdline/secondary_scripts/md5.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from ceda_elasticsearch_tools.core import updater
from datetime import datetime
import os, logging
from ceda_elasticsearch_tools.cmdline import __version__
from ceda_elasticsearch_tools import __version__
import hashlib
import simplejson as json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import os
import simplejson as json
from elasticsearch import Elasticsearch
from ceda_elasticsearch_tools.cmdline import __version__
from ceda_elasticsearch_tools import __version__
import hashlib


Expand Down
4 changes: 2 additions & 2 deletions ceda_elasticsearch_tools/cmdline/update_md5.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
from ceda_elasticsearch_tools.core import log_reader
from datetime import datetime
import os, logging
from ceda_elasticsearch_tools.cmdline import __version__
from ceda_elasticsearch_tools import __version__
import subprocess
import simplejson as json
from ceda_elasticsearch_tools.core.updater import ElasticsearchUpdater
import math
from ceda_elasticsearch_tools.core.util import ProgressBar
from ceda_elasticsearch_tools.core.utils import ProgressBar


def logger_setup(log_dir):
Expand Down
3 changes: 1 addition & 2 deletions ceda_elasticsearch_tools/core/log_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import re
import hashlib
from datetime import datetime
from ceda_elasticsearch_tools.core.utils import get_latest_log

import logging

from ceda_elasticsearch_tools.core.utils import get_latest_log

class SpotMapping(object):
"""
Expand Down
5 changes: 3 additions & 2 deletions ceda_elasticsearch_tools/core/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import json
import re
import logging
from .log_reader import MD5LogFile
import utils
import hashlib

from ceda_elasticsearch_tools.elasticsearch import CEDAElasticsearchClient
from .log_reader import MD5LogFile
from . import utils

class ElasticsearchQuery(object):
"""
Expand Down

0 comments on commit 61ca155

Please sign in to comment.