def wordCloudGenerator(msglist: List[ChatRecord]) -> str:
    font_path = path.abspath(path.dirname(path.dirname('.'))) + '\\data\\SourceHanSans-Normal.ttc'
    text = ''
    for i in msglist:
        if not i.messagechain.has(Plain):
            continue
        wordlist = jieba.lcut(i.messagechain.get(Plain)[0].text)
        for j in wordlist:
            text = text + j + ' '
    w = wordcloud.WordCloud(font_path=font_path)
    w.generate(text)
    w.to_file('wordCloudCache.png')
    return 'wordCloudCache.png'
Ejemplo n.º 2
0
 def okayClickedHandeler(self):
     print("Clicked okay button")
     basePath = path.dirname(path.realpath(__file__))
     self.logFileName = self.ticTagtoe.log()
     self.logFileName = "ticTactoe.log"
     self.preferencesGroup = (('logFile', self.logFileName), )
     #write settings values.
     for setting, variableName in self.preferencesGroup:
         # if self.appSettings.contains(setting):
         self.appSettings.setValue(setting, variableName)
     self.close()
Ejemplo n.º 3
0
 def restoreGame(self):
     if self.appSettings.conatains('pickleFilename'):
         self.appSettings.value('pickleFilename', type=str)
         with open(
                 path.join(
                     path.dirname(path.realpath(__file__)),
                     self.appSettings.value('pickleFilename', type=str)),
                 'rb') as pickleFile:
             return load(pickleFile)
     else:
         self.logger.critical('No pickle Filename')
Ejemplo n.º 4
0
def renameFortranCUDAfile (generatedFiles):
	from shutil import move
	from os import path

	cudaCodeName = "rose_cuda_code.F95"
	debug.verboseMessage("Looking for the ROSE generated file '%s'" % cudaCodeName)

	for f in generatedFiles:
		if path.basename(f) == cudaCodeName:
			destinationName = path.dirname(f) + sep + cudaCodeName[:-4] + ".CUF" 
			debug.verboseMessage("Moving '%s' into '%s'" % (f, destinationName))
			move(f, destinationName)
Ejemplo n.º 5
0
 def saveGame(self):
     if self.createLogFile:
         self.logger.debug("Saving Game")
     saveItem = ()
     if self.appSetting.contain('pickleFilename'):
         with open(
                 path.join(
                     path.dirname(path.realpath(__file__)),
                     self.appSettings.value('pickleFilename', type=str)),
                 'wb') as pickleFile:
             dump(saveItem, pickleFile)
             return load(pickleFile)
     else:
         self.logger.critical("No pickle Filename")
    def create_wordcloud(self):
        file = open("snippet_twitter.txt", "r", encoding='utf8')
        text = file.read()
        currdir = path.dirname(__file__)

        # create numpy araay for wordcloud mask image
        mask = np.array(Image.open(path.join(currdir, "cloud.png")))

        # create set of stopwords
        stopwords = set(STOPWORDS)

        # create wordcloud object
        wc = WordCloud(background_color="white",
                       max_words=200,
                       mask=mask,
                       stopwords=stopwords)

        # generate wordcloud
        wc.generate(text)

        # save wordcloud
        wc.to_file(path.join(currdir, "static/img/h.jpg"))
Ejemplo n.º 7
0
        self.preferencesGroup = (('logFile', self.logFileName), )
        #write settings values.
        for setting, variableName in self.preferencesGroup:
            # if self.appSettings.contains(setting):
            self.appSettings.setValue(setting, variableName)
        self.close()

    def cancleClickedHandler(self):
        self.close()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    testApp = Board()
    testApp.show()
    sys.exit(app.exec_())

if __name__ == "__main__":
    QCoreApplication.setOrganizationName("Jazmine's Organization")
    QCoreApplication.setOrganizationDomain("jazminezation.com")
    QCoreApplication.setApplicationName("TicTacToe")
    appSettings = QSettings()
    startingFolderName = path.dirname(path.realpath(__file__))
    if appSettings.contains('logFile'):
        logFileName = appSettings.value('logFile', type=str)
    else:
        logFileName = 'ticTactoe.log'
        appSettings.setValue('logFile', logFileName)
    basicConfig(filename=path.join(startingFolderName, logFileName),
                level=INFO,
                format='%(asctime)s %(name)-8s %(levelName)-8s %(message)s')
Ejemplo n.º 8
0
 --tool tomopy --algorithm sirt --num-iter 10  --cor 123 --max-angle 360 --in-img-format=tiff\
 --out-img-format png --region-of-interest='[5, 252, 507, 507]' --rotation=-1

ipython -- scripts/Imaging/IMAT/tomo_reconstruct.py\
 --input-path=../tomography-tests/stack_larmor_metals_summed_all_bands/ --output-path=test_REMOVE_ME\
 --tool astra --algorithm FP3D_CUDA  --num-iter 10  --cor 123 --max-angle 360 --in-img-format=tiff\
 --region-of-interest='[5, 252, 507, 507]' --rotation=-1
"""

# find first the package/subpackages in the path of this file.
import sys
from sys import path
import os
from os import path
# So insert in the path the directory that contains this file
sys.path.insert(0, os.path.split(path.dirname(__file__))[0])

from IMAT.tomorec import reconstruction_command as tomocmd
import IMAT.tomorec.configs as tomocfg


def setup_cmd_options():
    """
    Build an argument parser

    Returns :: Python ArgumentParser set up and ready to parse command line arguments
    """

    import argparse

    parser = argparse.ArgumentParser(
        def okayClickedHandler(self):
            # print("Clicked okay button")
            basePath = path.dirname(path.realpath('_file_'))

            self.close()
Ejemplo n.º 10
0
 --tool tomopy --algorithm sirt --num-iter 10  --cor 123 --max-angle 360 --in-img-format=tiff\
 --out-img-format png --region-of-interest='[5, 252, 507, 507]' --rotation=-1

ipython -- scripts/Imaging/IMAT/tomo_reconstruct.py\
 --input-path=../tomography-tests/stack_larmor_metals_summed_all_bands/ --output-path=test_REMOVE_ME\
 --tool astra --algorithm FP3D_CUDA  --num-iter 10  --cor 123 --max-angle 360 --in-img-format=tiff\
 --region-of-interest='[5, 252, 507, 507]' --rotation=-1
"""

# find first the package/subpackages in the path of this file.
import sys
from sys import path
import os
from os import path
# So insert in the path the directory that contains this file
sys.path.insert(0, os.path.split(path.dirname(__file__))[0])

from IMAT.tomorec import reconstruction_command as tomocmd
import IMAT.tomorec.configs as tomocfg

def setup_cmd_options():
    """
    Build an argument parser

    Returns :: Python ArgumentParser set up and ready to parse command line arguments
    """

    import argparse

    parser = argparse.ArgumentParser(description='Run tomographic reconstruction via third party tools')
Ejemplo n.º 11
0
# 日志文件配置读取测试
import logging
import logging.config
from sys import path

folder = "C:\project\python\config"
#log_path = "logging.conf"

log_path = f"{folder}/logging.conf"

log_file_path = path.join(path.dirname(path.abspath(__file__)), log_path)
#logging.config.fileConfig(log_file_path)
logging.config.fileConfig(log_path)
#logging.config.fileConfig(fname='logtest.conf', disable_existing_loggers=False)
logs = logging.getLogger('error')
logs.error('errorsssss')