Exemplo n.º 1
0
def save_image(content):
    file_path = '{0}/{1}.{2}'.format(os.getcwd(),
                                     md5(content).hexdigest(), 'jpg')
    if not os.path.exists(file_path):
        with open(file_path, 'wb') as f:
            f.write(content)
            f.close()
Exemplo n.º 2
0
    def setUp(self):
        self.dir = os.getcwd()

        self.spatialPatter = SpatialPatterns(
            comparison=Comparison(),
            postGISServiceProvider=PostGISServiceProvider())

        self.fileActions = FileActions()
        self.testTableName = "test_travel_time_matrix"
        self.rushHourTableName = "rush_hour_time_car"
        self.middayTableName = "midday_time_car"
        self.rushHourTableNameDetailed = "rush_hour_time_car_detailed"
        self.bicycleTravelTimeMatrix = "bicycle_travel_time_matrix"
Exemplo n.º 3
0
'''
初始化登录
'''
import json
import re
import subprocess
import sys
import time
from urllib import parse

import chardet
import requests
from gevent import os

captcha_path = os.path.join(os.getcwd(), "captcha")
if (not os.path.exists(captcha_path)):
    os.mkdir(captcha_path)
captcha_path = os.path.join(captcha_path, "telecom")
if (not os.path.exists(captcha_path)):
    os.mkdir(captcha_path)

def gen_image_name(name):
    return os.path.join(captcha_path, "{}.jpg".format(name))

def save_image(name, content):
    file_name = gen_image_name(name)
    with open(file_name, 'wb') as f:
        f.write(content)
    f.close()
    return file_name
Exemplo n.º 4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2019/9/4 17:29
# @Author  : ChenYQ
# @Site    : 
# @File    : conftest.py
# @Software: PyCharm
import sys

import pytest
from gevent import os

presentPath = os.getcwd()
print(presentPath)
sys.path.append(presentPath)
from conf.test_evn import conf
'''
设置在本包下fixture 的作用范围在本包下
'''

Exemplo n.º 5
0
import subprocess

from gevent import os

#compiledModuleSubfolder = "/Ba/Cython"
fileToCompile_list = ['Compute_Similarity_Cython.pyx']

for fileToCompile in fileToCompile_list:

    command = [
        'python', 'compileCython.py', fileToCompile, 'build_ext', '--inplace'
    ]

    output = subprocess.check_output(' '.join(command),
                                     shell=True,
                                     cwd=os.getcwd())

    try:

        command = ['cython', fileToCompile, '-a']

        output = subprocess.check_output(' '.join(command),
                                         shell=True,
                                         cwd=os.getcwd())

    except:
        pass
Exemplo n.º 6
0
import sys

from gevent import os

sys.path.append(os.getcwd())
import util.database as db


def fetch_user_definition():
    print("Query user_definition ...\n")
    my_db = db.Database(
        user="******",
        password="******",
        host="localhost",
        port="5432",
        database="dashboard"
    )

    result = my_db.query("select * from operations.user_definition")

    for row in result:
        print(row, "\n")

    my_db.close()


if __name__ == "__main__":
    fetch_user_definition()