#!/usr/bin/env python3 # -*- coding: utf-8 -*- from common.checks import Checks checks = Checks() from datetime import datetime as time from distutils.dir_util import copy_tree from common.runsubprocess import RunSubprocess as run import atexit import ntpath import shutil import os import re import subprocess link = path = "" result_lines = [] OUT = open("./DieterichLab_archive_disk_3-linksearch.COPIED.out", "w+") class CopyGroupCDfolder(): def __init_(self): pass def _runcommand(self, command, test=True): """""" if test: print("RUNNING:", command) _result = subprocess.check_output(command).decode("utf-8") else:
__author__ = "Mike Rightmire" __copyright__ = "Universitäts Klinikum Heidelberg, Section of Bioinformatics and Systems Cardiology" __license__ = "Not licensed for private use." __version__ = "0.9.0.0" __maintainer__ = "Mike Rightmire" __email__ = "*****@*****.**" __status__ = "Development" from argparse import ArgumentParser # ConfigHandler disabled until py3 update # from common.confighandler import ConfigHandler # loghandler disabled until bugfix in Jessie access to self.socket.send(msg) # from common.loghandler import log from common.checks import Checks checks = Checks() _delim = checks.directory_deliminator() from common.loghandler import log from inspect import stack from pathlib import Path from shutil import copyfile import tempfile import abc import grp import inspect import ntpath import os import pwd ### FILE TEMPLATES ##########################################################
def __new__( cls, app_name='UNCHANGED', # DO NOT CHANGE FROM 'UNCHANGED' logfile='UNCHANGED', # DO NOT CHANGE FROM 'UNCHANGED' log_level='UNCHANGED', # DO NOT CHANGE FROM 'UNCHANGED' screendump='UNCHANGED', # DO NOT CHANGE FROM 'UNCHANGED' format='UNCHANGED', # DO NOT CHANGE FROM 'UNCHANGED' create_paths='UNCHANGED', # DO NOT CHANGE FROM 'UNCHANGED' migrate='UNCHANGED', # DO NOT CHANGE FROM 'UNCHANGED' instantiate=True # DO NOT CHANGE FROM True ): """ This is a singleton class. The __new__ method is called prior to instantiation with __init__. If there's already an instance of the class, the existing object is returned. If it doesn't exist, a new object is instantiated with the __init__. """ #============= FOR DEBUGGING =========================================== # try: #333 # print cls.instance,'============' # print datetime.datetime.now().time() # print cls.instance.create_time # except Exception as e: #333 # print 'No instance: ', str(e) #333 #======================================================================= # __init__ is called no matter what, so... # If there is NOT an instance, just create an instance # This WILL run __init__ # Do NOT set self.__exists here, since if _-exists == True, __init__ is # cancelled (it must still run at the first instantiation) if not hasattr(cls, 'instance'): if instantiate: # Create an instance cls.instance = super(SetLogger, cls).__new__(cls) cls.instance.checks = Checks() # SET INSTANCE DEFUALTS HERE ============================================= # These must be set or errors will arise. cls.instance._APP_NAME = 'loghandler' cls.instance._LOGFILE = False cls.instance._LOG_LEVEL = 10 cls.instance._SCREENDUMP = False cls.instance._FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' cls.instance._CREATE_PATHS = True cls.instance.instantiate = True cls.instance._MIGRATE = True cls.instance._FORMATTER = logging.Formatter( cls.instance.format) cls.instance._changed_flag = False cls.instance._changed_flag_message = '' return cls.instance else: return None # Else if an instance does exist, set a flag since # __init__is called, but flag halts completion (just returns) else: cls.instance.__exists = True return cls.instance