Ejemplo n.º 1
0
def main(args=None):
    command_line_arguments = parse_command_line_arguments(args)
    context.logger = utilities.create_logger(command_line_arguments.log_level)
    configuration_settings = utilities.read_configuration_files(command_line_arguments.configuration_file_paths)
    configuration_file_paths_read = configuration_settings.configuration_file_paths_read
    context.logger.info('Read configuration settings from %s.', utilities.and_join(configuration_file_paths_read))
    context.arguments = command_line_arguments
    context.settings = configuration_settings
    context.app.json_encoder = utilities.ISODatetimeJSONEncoder
    context.app.run(debug=command_line_arguments.debug)
Ejemplo n.º 2
0
def main(args=None):
    global LOGGER
    command_line_arguments = parse_command_line_arguments(args)
    LOGGER = utilities.create_logger(command_line_arguments.log_level)
    configuration_settings = utilities.read_configuration_files(command_line_arguments.configuration_file_paths)
    configuration_file_paths_read = configuration_settings.configuration_file_paths_read
    LOGGER.info("Read configuration settings from %s.", utilities.and_join(configuration_file_paths_read))
    context = Context(command_line_arguments, configuration_settings)
    maybe_drop_existing_schema(context)
    create_schema(context)
    create_other_stuff(context)
Ejemplo n.º 3
0
    def update_artisan(self,
                       cess_artigiana_col: str,
                       log_path=None,
                       save: bool = True):
        if log_path:
            if isinstance(log_path, str):
                log_path = Path(log_path)
            elif not isinstance(log_path, Path):
                raise ValueError("Path must be a pathlib.Path istance")

        self.logger = create_logger("InsielPreprocessing",
                                    path=log_path,
                                    verbose=True)

        self.preprocessing_anagrafica(cess_artigiana_column=cess_artigiana_col)
        if save:
            self.logger.debug(
                "Salvataggio dell'anagrafica aggiornata nel foglio 'nFRIULI Anagrafica'"
            )
            self.save_new_anagrafica_into_file()
            self.logger.debug("Salvataggio completato")
Ejemplo n.º 4
0
class Loadbugarchive(object):
    """Install the sample video file and insert the database
    records from the bude report archive.
    """
    def __init__(
            self,
            opts,  # Command line options
    ):
        #
        try:
            self.configuration = get_config(opts, load_db=True)
        except Exception, errmsg:
            sys.stderr.write(
                # TRANSLATORS: Please leave %s as it is,
                # because it is needed by the program.
                # Thank you for contributing to this project.
                _(u'''Processing the configuration file failed. Error(%s)\n''')
                % errmsg)
            sys.exit(1)
        #
        self.configuration['version'] = __version__
        #
        self.logger = create_logger(self.configuration['logfile'],
                                    filename=True)
        #
        try:
            self.mythtvinterface = Mythtvinterface(self.logger,
                                                   self.configuration)
        except Exception, errmsg:
            sys.stderr.write(
                # TRANSLATORS: Please leave %s as it is,
                # because it is needed by the program.
                # Thank you for contributing to this project.
                _(u'''Acquiring access to MythTV failed, aborting script.
Error(%s)\n''') % errmsg)
            sys.exit(1)
Ejemplo n.º 5
0
 def setUpClass(cls):
     cls.maxDiff = None
     cls.logger = create_logger("AnagraficaInsiel", cls.LOG_DIR)
     cls.cert = AnagraficaInsielBuilder()
     super().setUpClass()
Ejemplo n.º 6
0
    def __init__(
            self,
            opts,  # Command line options
    ):
        #
        try:
            self.configuration = get_config(opts, load_db=True)
        except Exception as errmsg:
            sys.stderr.write(
                # TRANSLATORS: Please leave %s as it is,
                # because it is needed by the program.
                # Thank you for contributing to this project.
                _(u'''Processing the configuration file failed. Error(%s)\n''')
                % errmsg)
            sys.exit(1)
        #
        self.configuration['version'] = __version__
        #
        self.logger = create_logger(self.configuration['logfile'],
                                    filename=True)
        #
        try:
            self.mythtvinterface = Mythtvinterface(self.logger,
                                                   self.configuration)
        except Exception as errmsg:
            sys.stderr.write(
                # TRANSLATORS: Please leave %s as it is,
                # because it is needed by the program.
                # Thank you for contributing to this project.
                _(u'''Acquiring access to MythTV failed, aborting script.
Error(%s)\n''') % errmsg)
            sys.exit(1)
        #
        ## Set if mythtv v0.24 is installed
        if self.mythtvinterface.OWN_VERSION[1] == 24:
            self.v024 = True
        else:
            self.v024 = False
        #
        # Determine if the system is 64 or 32 bit architecture
        if (sys.maxsize > 2**32):
            bit_arch = common.BIT_ARCH_64
        else:
            bit_arch = common.BIT_ARCH_32
        #
        # Set the subtitle extraction utilities based on the system
        # architecture
        self.configuration['ccextractor'] = bit_arch % (common.APPDIR,
                                                        common.CCEXTRACTOR)
        #
        try:
            self.configuration['mythutil'] = check_dependancies(
                self.configuration)
        except Exception as errmsg:
            sys.stderr.write(
                # TRANSLATORS: Please leave %s as it is,
                # because it is needed by the program.
                # Thank you for contributing to this project.
                _(u'''
One or more script dependencies could not be satisfied, aborting script.
Error(%s)\n''') % errmsg)
            sys.exit(1)
        #
        self.mythtvinterface.stdout = sys.stdout
        self.mythtvinterface.stderr = sys.stderr
        #
        self.processing_started = datetime.now()
        self.filename = u''
        self.subtitles = u''
        self.configuration['verbose'] = True
Ejemplo n.º 7
0
 def setUpClass(cls):
     cls.maxDiff = None
     cls.logger = create_logger("AtecoInfocamere", cls.LOG_DIR)
     cls.cert = AtecoBuilder()
     super().setUpClass()
Ejemplo n.º 8
0
 def setUpClass(cls):
     cls.maxDiff = None
     cls.logger = create_logger("BilanciInfocamere", cls.LOG_DIR)
     cls.cert = BilanciBuilder()
     super().setUpClass()
Ejemplo n.º 9
0
 def setUpClass(cls):
     cls.logger = create_logger("RatingLegalita", path=cls.LOG_DIR)
     cls.cert = RatingLegalitaBuilder()
     super().setUpClass()
Ejemplo n.º 10
0
 def setUpClass(cls):
     cls.logger = create_logger("Accredia", path=cls.LOG_DIR)
     cls.cert = AccrediaBuilder()
     super().setUpClass()
Ejemplo n.º 11
0
 def make_logger(self):
     self.logger = util.create_logger(level='DEBUG',
                                      log_folder='%s/logs' %
                                      self.file_folder,
                                      file_name=self.filename,
                                      do_print=True)
Ejemplo n.º 12
0
import shutil
from math import ceil, degrees, floor, radians

import cv2
import numpy as np
import pandas as pd
import PyPDF2
from pdf2image import convert_from_path
from pdftabextract.common import parse_pages, read_xml

import utilities as util
from multi_processor import multithread_processor
from tablextract import do_tablextract

logger = util.create_logger(level='DEBUG',
                            log_folder='logs',
                            file_name='logs',
                            do_print=True)


class Globals:
    pass


g = util.add_params_to_object_from_dict_path(Globals(), 'config.json')


class PDFToExcel:
    def __init__(self, file_path):
        self.file_path = file_path
        print('\n########## Starting parsing for %s ##########\n' % file_path)
        self.filename = os.path.basename(file_path).split('.')[0]
Ejemplo n.º 13
0
from keys import (consumer_key, consumer_secret,
                  access_token_key, access_token_secret, SELF_SCREEN_NAME)
from db_handlers import TweetStorage
from utilities import (get_now, bot_in_name,
                       parse_embedded_tweet, create_logger)

# global variable of bot spotters
spotters = ["BotSpotterBot", "RealBotSpotter", "bufbvr"]
MAX_DAYS_BACK = 3
SECONDS_TO_WAIT = 11
MINUTES_TO_WAIT = 15

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token_key, access_token_secret)
api = tweepy.API(auth)
tweet_log = create_logger('Tweets')
error_log = create_logger('Errors')

# begin class definition
class MyStreamListener(tweepy.StreamListener):
    def on_status(self, status):
        try:
            tweet_to_retweet = self.get_og_tweet(status)
            if not self.is_invalid(tweet_to_retweet):
                self.retweet(tweet_to_retweet)
                self.favorite(tweet_to_retweet)
                self.follow(tweet_to_retweet)
        except HTTPError as e:
            print e

    # returns a status object (earliest tweet we can find)
Ejemplo n.º 14
0
 def setUpClass(cls):
     cls.logger = create_logger("ContrattiRete", path=cls.LOG_DIR)        
     cls.cert = ContrattiReteBuilder()
     super().setUpClass()