Ejemplo n.º 1
0
 def __init__(self, **kwargs):
     self.session = None
     self.sessfile = kwargs.get(
         "sessionfile", "C:/Users/{0}/Documents/temp/{1}.txt".format(
             bu.current_user(), os.getpid()))
     self.sessdir = self._set_sessionfiledir(self.sessfile)
     self.log = kwargs.get("log", Logger("Sharepoint").getlog())
Ejemplo n.º 2
0
def run_igr_process(folder=None, file=None):
    homedir = "C:/Users/{}".format(bu.current_user())
    processname = "IGR"
    log = Logger(processname).getlog()
    projpath = "{}/Documents/JLL/Projects/Research/IGR/process".format(homedir)
    utilpath = "{}/Softwares/xpdf/bin64".format(homedir)
    boxpath = "{}/Box Sync/ResearchData/IGRData/Unprocessed".format(homedir)
    foldername = folder
    filename = file
    currdatetime = datetime.now().strftime("%Y%m%d")
    dataexcel = "{0}/igrdata_{1}.xlsx".format(projpath, currdatetime)
    errorexcel = "{0}/igrdata_err_{1}.xlsx".format(projpath, currdatetime)
    connname = "DEVELOPMENT_SQL"
    keymesg = "This is my message"
    oprocess = ProcessIgr(processname=processname,
                          log=log,
                          projpath=projpath,
                          utilpath=utilpath,
                          boxpath=boxpath,
                          homepath=homedir,
                          conn_name=connname,
                          keymesg=keymesg)
    oprocess.process(folder=foldername,
                     filename=filename,
                     outfile=dataexcel,
                     errorfile=errorexcel)
Ejemplo n.º 3
0
def get_authorization():
    from baselib.security.credentialmanager import CredentialManager
    homedir = "C:/users/{}".format(bu.current_user())
    configdir = "{}/repos/gdimindialocal/baselib/database".format(homedir)
    configfile = "{}/credentials.cfg".format(configdir)
    passphrase = 'This is my message'
    try:
        credman = CredentialManager(configfile=configfile)
        config = credman.get_credential(sectionname="BLOSSOM_DATABASE",
                                        passphrase=passphrase)
        for key, value in config.items():
            print("Key: {}. Value: {}".format(key, value))
    except IOError as e:
        print(e.message)
Ejemplo n.º 4
0
def main_run(process=None, model=None):
    model = model if model else "hog"
    home = "C:/Users/{}".format(bu.current_user())
    path = "{}/OneDrive - JLL/Office/CoE/projects/RED/Support/team".format(
        home)
    encodefile = "{}/encoded_file_{}.txt".format(path, model)
    objtest = TestFace(paths=path, model=model, encodefile=encodefile)
    if process == "encode":
        inputdir = "{}/{}".format(path, "source_pics")
        objtest.encodeimage(imagefile=inputdir)
    else:
        # checkimage = "{}/check_pics/{}".format(path, "TeamPicture.png")
        # checkimage = "{}/check_pics/{}".format(path, "Rashmi_Venkatesh.jpg")
        # checkimage = "{}/check_pics/{}".format(path, "Gunjan_Marriage.jpg")
        checkimage = "{}/check_pics/{}".format(path, "Gunjan_Family.jpg")
        objtest.match_image(checkfile=checkimage, tolerance=0.5)
Ejemplo n.º 5
0
 def _set_ocrpath(self, ocrpath=None):
     ocrname = "tesseract.exe"
     paths = [
         "C:/Program Files (x86)/Tesseract-OCR",
         "C:/Users/{0}/Box Sync/CoEUtilities".format(bu.current_user())
     ]
     if os.path.isfile(ocrpath):
         self.ocr = ocrpath
     else:
         for path in paths:
             t_path = "{}/{}".format(path, ocrname)
             if os.path.isfile(t_path):
                 self.ocr = t_path
                 break
     if self.ocr is None:
         raise ce.CommandNotFound(ReadImage._OCR_NOT_FOUND)
Ejemplo n.º 6
0
def add_authorization():
    from baselib.security.credentialmanager import CredentialManager
    homedir = "C:/users/{}".format(bu.current_user())
    configdir = "{}/repos/gdimindialocal/baselib/database".format(homedir)
    configfile = "{}/credentials.cfg".format(configdir)
    try:
        credman = CredentialManager(configfile=configfile)
        credman.add_credential(
            sectionname="BLOSSOM_DATABASE",
            host_name='gimblossomsql.southcentralus.cloudapp.azure.com',
            passphrase='This is my message',
            database='BlossomUAT',
            user='******',
            password='******',
            dbtype='MSSQLServer',
            protocol='Server Authentication')
    except IOError as e:
        print(e.message)
Ejemplo n.º 7
0
 def __init__(self,
              processname,
              homepath=None,
              projpath=None,
              utilpath=None,
              sourcepath=None,
              log=None):
     self.processname = processname
     self.currentuser = bu.current_user()
     self.homepath = self._set_home_path(homepath=homepath)
     self.toppath = os.path.join(self.homepath, projpath)
     self.sourcepath = sourcepath if sourcepath else os.path.join(
         self.homepath, "/Box Sync/{0}/Unprocessed".format(
             self.processname))
     (self.temppath, self.logpath, self.rawpath, self.procpath,
      self.errorpath) = self._set_paths()
     self.log = lo.Logger(self.processname).getlog() if not log else log
     self.utilpath = utilpath if utilpath else os.path.join(
         self.homepath, "Softwares")
Ejemplo n.º 8
0
 def __init__(self, configfile, listsep=';;;'):
     self.configfile = configfile
     self.curruser = bu.current_user()
     self.authfile = self._get_auth_file(configfile)
     self.listsep = listsep
Ejemplo n.º 9
0
#         str(dtable["right"])
#     ), pages="1"
# )
# js = json.loads(df.to_json(orient="records"))
# print(js)
#
# df = wrapper.read_pdf(
#     source, guess=False, stream=True, area="{0},{1},{2},{3}".format(
#         str(dtable2["top"]), str(dtable["left"]), str(dtable2["bottom"]),
#         str(dtable["right"])
#     ), pages="2"
# )
# js = json.loads(df.to_json(orient="records"))
# print(js)

vhome = "C:/Users/{}".format(bu.current_user())
vproject = "{0}/Documents/JLL/Projects/Research/IGR/process".format(vhome)
vtemp = "{}/temp/igr".format(vhome)
vfolder = "Fort"
vpath = "{0}/rawfiles/{1}".format(vproject, vfolder)
vname = "IGR2018_225_718"
#
#
# from baselib.image import imagetxt as it
#
# vpath = "C:/Users/gunjan.kumar/Documents/JLL/Projects/Research/IGR/process"
# vname = "bak_errorfiles-000001"
# source = "{0}\\{1}.png".format(vpath, vname)
#
#
# _OCR_PATH = "C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe"
Ejemplo n.º 10
0
 def _get_def_basedir(projectname):
     t_base = "C:/Users/{}/Documents".format(bu.current_user())
     t_base = "{0}/JLL/CoE/{1}/Reports".format(t_base, projectname)
     return t_base
Ejemplo n.º 11
0
 def __init__(self, authfile):
     self.authfile = authfile
     self.curruser = bu.current_user()