source
stringlengths
3
86
python
stringlengths
75
1.04M
build_imagenet_data.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
DouTuSpider.py
# 抓取斗图网的表情包 # 在原有基础上加上一个多线程:threading 库是 Python 原生多线程处理与控制库 # 亲测抓取一个页面完整的所有图片需要 2 秒左右,比未添加超线程的满了5倍,提速明显 # 继续改进,使用 lxml 的 etree 代替 BeautifulSoup 进一步提升速度 import os import requests import threading from lxml import etree from Download import dl def get(): """创建主文件夹,开始爬取""" os.mkdir('/Users/yton/Do...
mix_vctk_ljs.py
from pathlib import Path import torch import hp from threading import Thread from queue import Queue import numpy as np from audio.audio_io import load_to_torch from audio.sfx import mix_with_snr from torch.nn.utils.rnn import pad_sequence from utils.text import text_to_sequence from random import randint, sample, rand...
plugin-remote.py
from __future__ import annotations import asyncio import base64 import gc import json import os import platform import resource import shutil import subprocess import threading import time import zipfile from asyncio.events import AbstractEventLoop from asyncio.futures import Future from asyncio.streams import StreamR...
lisp-rtr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain...
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import unicode_literals import copy import datetime import re import threading import unittest import warnings from decimal import Decimal, Rounded from django.conf import settings from django.core.exceptions import Improperly...
windfarm.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import threading import math import random import pywt import numpy as np import logging import time import os from turbine import WindTurbine from edgeagentclient import EdgeAgentClient from ota import OTAModelUpdate ...
test_update_pr_preview.py
import BaseHTTPServer import json import os import subprocess import tempfile import threading subject = os.path.join( os.path.dirname(os.path.abspath(__file__)), '..', 'update_pr_preview.py' ) test_host = 'localhost' class MockHandler(BaseHTTPServer.BaseHTTPRequestHandler, object): def do_all(self): ...
main_color.py
import json import crawlKoreaData_All as crawl1 import crawlKoreaData_Gyeonggi as crawl2 import crawlKoreaData_Seoul as crawl3 import LED_Display as LMD import threading from datetime import date, timedelta import datetime from matrix import * today = date.today() oneday = datetime.timedelta(days=1) yester...
demo.py
#!/usr/bin/python3 """ This file is provided as a demonstration tool for using pystributor """ from pystributor.pystributor import Hub, Worker from time import perf_counter from os import system, name import multiprocessing from multiprocessing.managers import BaseManager SAMPLE_ARGS = [(i,) for i in range(10**8, (1...
thread.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
tfs.py
import subprocess import traceback from threading import Thread class TFS: def __init__(self, site_id, site_path, app): self._site_id = site_id self._site_path = site_path self._app = app self._proc = None def start_pull(self): self._proc = subprocess.Popen(('tfs.bat',...
compare_apk_sizes.py
#!/usr/bin/env python # Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. # Script for checking impact of a change by comparing the sizes of generated # classes ...
isolateserver.py
#!/usr/bin/env python # Copyright 2013 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Archives a set of files or directories to an Isolate Server.""" __version__ = '0.9.0' import collections import errno i...
run_designs.py
# Copyright 2020 Efabless Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
fisheye.py
# -*- coding: utf-8 -*- # Dual-fisheye to 360-photo conversion tool # Supports equirectangular and cubemap output formats # # Usage instructions: # python fisheye.py' # Start interactive alignment GUI. # python fisheye.py -help # Print this help message. # python fisheye.py lens.cfg in1.jpg in2.jpg gui # ...
configure_and_test_integration_instances.py
from __future__ import print_function import argparse import ast import json import os import subprocess import sys import uuid import zipfile from datetime import datetime from distutils.version import LooseVersion from enum import IntEnum from pprint import pformat from threading import Thread from time import sleep...
test_httplib.py
import errno from http import client import io import itertools import os import array import re import socket import threading import unittest TestCase = unittest.TestCase from test import support here = os.path.dirname(__file__) # Self-signed cert file for 'localhost' CERT_localhost = os.path.join(here, 'keycert.p...
_fixtures.py
import collections import itertools import json import random from threading import Lock from threading import Thread import time from unittest import TestCase import pytest from dogpile.cache import CacheRegion from dogpile.cache import register_backend from dogpile.cache.api import CacheBackend from dogpile.cache.a...
oepoll.py
# -*- coding: utf-8 -*- from .client import LINE from types import * import os, sys, threading, time class OEPoll(object): OpInterrupt = {} client = None __squareSubId = {} __squareSyncToken = {} def __init__(self, client): if type(client) is not LINE: raise Exception('You nee...
get_tags.py
from threading import Thread from requests_html import HTMLSession from django.core.management.base import BaseCommand from django.utils.text import slugify from catalog.models import Tag def crawler(url): with HTMLSession() as session: response = session.get(url) tag_urls = response.html.xpath('//...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2009-2015 Bitcoin Developers # Copyright (c) 2014-2015 MonetaryUnit Developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import s...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_ltc.util import bfh, bh2u, UserCancelled, UserFacingException from electrum_ltc.bip32 import BIP32Node from electrum_ltc import constants from electrum...
main.py
# Copyright (c) 2022 Ed Harry, Wellcome Sanger Institute, Genome Research Limited # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the right...
gcp_hub_client.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
g_code_engine.py
import os import sys import asyncio import time from multiprocessing import Process from typing import Generator, Callable, Iterator from collections import namedtuple from opentrons.hardware_control.emulation.settings import Settings from opentrons.hardware_control.emulation.types import ModuleType from opentrons.pro...
person.py
from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.ext.mutable import MutableDict from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import deferred from sqlalchemy import orm from sqlalchemy import text from sqlalchemy import func from app import db from models import product # needed for s...
DKJ.py
import RPi.GPIO as GPIO from time import sleep from threading import Thread import multiprocessing as mp import ds18b20_temp_sensor led1 = 3 led2 = 18 button= 11 counter = 0 Led = True def setup(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(led1, GPIO.OUT) GPIO.setup(led2, GPIO.OUT) ...
cim_objects_definitions.py
# This contains the definitions of CIM objects and their containers. # These containers are filled when functiosn calls detect the creation # or handling of such an object. # This modules contaisn specilized containers for thsee objects, # which are later used to create a Dockerfile. import os import re import six imp...
main.py
import argparse import github3 import toml import json import re import functools from . import comments from . import utils from .parse_issue_comment import parse_issue_comment from .auth import verify as verify_auth from .utils import lazy_debug import logging from threading import Thread, Lock, Timer import time imp...
train.py
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch from pytorch_pretrained_bert import BertConfig import distributed from models import data_loader, model_builder from models.data_loader i...
strategy_engine.py
# -*- coding: utf-8 -*- import sys import platform import threading import traceback from queue import Queue, Empty from .client_api import * class Engine(object): handle = None if platform.system() == 'Windows': client_api = ClientAPI('./swordfish_api/client_api.dll') elif platform.system() == 'D...
_server_adaptations.py
# Copyright 2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
handler_qos.py
""" SLAs' notifications handler This is being developed for the MF2C Project: http://www.mf2c-project.eu/ Copyright: Roi Sucasas Font, Atos Research and Innovation, 2017. This code is licensed under an Apache 2.0 license. Please, refer to the LICENSE.TXT file for more information Created on 27 sept. 2017 @author: R...
main.py
from threading import Thread, Event import tkinter as tk from tkinter import messagebox import boto3 import time import configparser event_configuration_ready = Event() def server_monitor(): event_configuration_ready.wait() global ec2; ec2 = boto3.client('ec2', aws_access_key_id=config['default']['ACCES...
app.py
#!/usr/bin/env python3 # The MIT License (MIT) # Copyright (c) 2016 RascalTwo @ therealrascaltwo@gmail.com # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including wi...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import electrumpq from electrumpq.bitcoin import TYPE_ADDRESS from electrumpq import WalletStorage, Wallet from electrumpq_gui.kivy.i18n import _ from electrumpq.paymentrequest import InvoiceStore f...
FoE Bot.py
import pyautogui from time import sleep from random import randint import threading #opencv-python is required! (pip install opencv-python). #functions to be run, you can change these! collectGold = True #collect gold from buildings. collectSupplies = True #collect supplies from buildings. restartIdleBuilding...
multi_process_runner.py
import logging from multiprocessing.context import Process from airflow_monitor.common import capture_monitor_exception from airflow_monitor.multiserver.runners.base_runner import BaseRunner logger = logging.getLogger(__name__) class MultiProcessRunner(BaseRunner): JOIN_TIMEOUT = 60 def __init__(self, ta...
mod_d42.py
#!/usr/bin/env python from requests import get as reqget, post as reqpost from json import loads as jsonloads, dumps as jsondumps from config import configSystem from threading import Thread from res_d42 import D42 import time, sys, os cfg = configSystem('config.cfg') # Override #dccode = '' dccode = cfg.getConfigVal...
client.py
import socket from threading import Thread class Client: def __init__(self, server_host="127.0.0.1", server_port=5002, message_size=1024): """クライアントです。 Parameters ---------- server_host : str 接続先サーバーのホスト名、またはIPアドレスです。 規定値 "127.0.0.1" server_port : int ...
interval_scheduler.py
# XXX Rename this to "interval_scheduler.py" and delete the old file after this is confirmed to work for both async and regula routines # XXX Rename this class to represent running the same routine to run in an interval from datetime import timedelta from types import coroutine from typing import Callable, Coroutine im...
simulation.py
''' Created on Oct 12, 2016 @author: mwittie ''' import network_1 import link import threading from time import sleep ##configuration parameters router_queue_size = 0 #0 means unlimited simulation_time = 1 #give the network sufficient time to transfer all packets before quitting if __name__ == '__main__': object...
tinc_client.py
from enum import auto import threading import time import socket from tinc.variant import VariantType from typing import List, Any import struct import socket # For gethostname() from threading import Lock # TINC imports from .parameter import Parameter, ParameterString, ParameterInt, ParameterChoice, ParameterBool, P...
gsi_index_partitioning.py
import copy import json import threading import time from .base_gsi import BaseSecondaryIndexingTests from membase.api.rest_client import RestConnection, RestHelper import random from lib import testconstants from lib.couchbase_helper.tuq_generators import TuqGenerators from lib.memcached.helper.data_helper import Mem...
pa_tengxunxinwen.py
import re import json import gevent import random import pymysql import requests import threading from queue import Queue def conn_mysql(): conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', password='123456', ...
tensorflow.py
# -*- coding: utf-8 -*- try: import tensorflow as tf from object_detection.utils import label_map_util as lm_util except ImportError as error: raise ImportError( "Usage of the TensorFlow detectors requires that TensorFlow and the TensorFlow Object " "Detection API are installed. A quick gui...
reltestbase.py
# -*- coding: utf-8; -*- ############################################################################## # # Copyright (c) 2008 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this...
remote_execution.py
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. import multiprocessing import os import sys import stat import tempfile import traceback import subprocess import runpy from typing import List, Callable, Any, AnyStr from string import Template from dace.sdfg import SDFG from dace.codegen.comp...
i3lasts.py
#!/usr/bin/env python3 import os import socket import selectors import threading from argparse import ArgumentParser import i3ipc import dynmen from shlex import split import collections import sys SOCKET_FILE = '/tmp/i3_focus_last' MAX_WIN_HISTORY = 15 class FocusWatcher: def __init__(self): self.i3 = ...
__init__.py
# -*- coding: utf-8 -*- ''' Set up the Salt multimaster test suite ''' # Import Python libs from __future__ import absolute_import, print_function import copy import logging import os import shutil import stat import sys import threading import time from collections import OrderedDict # Import salt tests support dir...
thread_deadlock.py
""" thread deadlock demo """ import threading import time counter1_lock = threading.Lock() counter2_lock = threading.Lock() counter1 = 2 counter2 = 4 def task_one() -> None: """ task one """ global counter1 global counter2 with counter1_lock: time.sleep(1) with counter2_lock: ...
draw_out.py
# coding: UTF-8 import os import json import re # in_path = r"D:\work\law_pre\test\in" # out_path = r"D:\work\law_pre\test\out" in_path = r"/disk/mysql/law_data/formed_data" out_path = r"/disk/mysql/law_data/critical_data" mid_text = u" _(:з」∠)_ " title_list = ["docId", "caseNumber", "caseName", "spcx", "court", "t...
web_server_1.py
#!/usr/bin/python3 # file: multiprocess_web_server.py # Created by Guang at 19-7-19 # description: # *-* coding:utf8 *-* import multiprocessing import socket import re import time import sys sys.path.insert(0, "../../") from mini_web.framework import mini_frame_1 class WSGIServer(object): def __init__(self, i...
main.py
#! /usr/bin/env python import subprocess # try to import this libraries of install it try: import ipaddress except: print "install ipaddress" subprocess.call("pip install ipaddress", shell=True) import ipaddress try: import pexpect except: print "install pexpect" subprocess.call("pip insta...
iebrowser.py
# Copyright 2017 Carnegie Mellon University. See LICENSE.md file for terms. # Ali Kidwai # July 26, 2017 # Adapted from code written by Rotem Guttman and Joe Vessella import functools import platform import queue import random import threading import time import traceback import psutil try: import pythoncom ...
test_cache.py
# -*- coding: utf-8 -*- import cachetools import pytest import six import threading import large_image.cache_util.cache from large_image import config from large_image.cache_util import cached, strhash, Cache, MemCache, \ methodcache, LruCacheMetaclass, cachesInfo, cachesClear, getTileCache class Fib(object): ...
distribute_coordinator_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
env_stock_papertrading.py
import datetime import threading import time import alpaca_trade_api as tradeapi import gym import numpy as np import pandas as pd import torch from finrl_meta.data_processors.processor_alpaca import AlpacaProcessor class AlpacaPaperTrading(): def __init__(self, ticker_list, time_interval, drl_l...
portal.py
__all__ = ("Portal", "create_portal") import asyncio import threading import typing as t class Portal: def __init__(self, stop_event: t.Any) -> None: """ The portal for async to sync conversion. Parameters ---------- stop_event: t.Any The stop event. "...
test_rest_v2_0_0.py
import json import os import random import string import subprocess import sys import time import unittest from multiprocessing import Process import requests from dateutil.parser import parse from test.apiv2.rest_api import Podman PODMAN_URL = "http://localhost:8080" def _url(path): return PODMAN_URL + "/v2.0...
run-buildbot-test.py
#!/usr/bin/env python # # Copyright (C) 2017 Igalia S.L. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and t...
fuzzer.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
interface.py
import copy import json import threading import time import numpy as np from src.system.identity_tracker import IdentityTracker from src.system.model_factory import ModelFactory from src.utils.pose import PoseConfig, Pose2D, Pose3D class AnnotatorInterface: EXTRA_OBJECT_DETECTION_DELAY = 0.50 def __init...
test_browser.py
# coding=utf-8 # Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. import argparse import json import multiprocessing imp...
serve.py
# Most of this code is: # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # The server command includes the additional header: # For discussion of daemonizing: # http://aspn.activestate.com/ASPN/C...
captcha_solver.py
# -*- coding: utf-8 -*- import os import pytesseract import time import Queue from BeautifulSoup import BeautifulSoup import re import threading import pickle import pyautogui import cv2 from PIL import Image from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.key...
test_win32file.py
import unittest from pywin32_testutil import str2bytes, TestSkipped, testmain import win32api, win32file, win32pipe, pywintypes, winerror, win32event import win32con, ntsecuritycon import sys import os import tempfile import threading import time import shutil import socket import datetime import random im...
GBucketDump.py
#!/usr/bin/env python # GBucketDump is a tool to quickly enumerate Google Storage buckets to look for loot. # It's similar to a subdomain bruteforcer but is made specifically to Google Storage # buckets and also has some extra features that allow you to grep for # delicous files as well as download interesting files i...
main.py
import platform from os import system from time import sleep from requests import Session from threading import Thread, RLock proxy_list = 'proxies.txt' target_site = 'https://instagram.com' def get_proxies(): proxies = [] with open(proxy_list, 'rt', encoding='utf-8') as proxies_file: for line in p...
monobeast.py
# Copyright (c) Facebook, Inc. and its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
data_ingester.py
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
WaveForceCodec.py
import logging import os import struct import threading from Waves.WaveEnsemble import WaveEnsemble logger = logging.getLogger("WaveForce Codec") logger.setLevel(logging.ERROR) FORMAT = '[%(asctime)-15s][%(levelname)s][%(name)s:%(funcName)s] %(message)s' logging.basicConfig(format=FORMAT) class WaveForceCodec: "...
mimic_tts.py
# Copyright 2017 Mycroft AI Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
main.py
import cx_Oracle as ora import pandas as pd import pyarrow as pa import pyarrow.parquet as parquet import uuid import threading as th PARTS = 10 ARRSIZE = 2000 def get_min_max(pool, table, column): conn = pool.acquire() cursor = conn.cursor() minmax = """select min(t.{}), max(t.{}) from (select * from {}...
Drum AR Stella.py
import cv2 import numpy as np import time import pyaudio import wave from array import array from struct import pack import os import threading import sys from collections import deque from imutils.video import VideoStream import argparse import imutils ##Sound ''' def drumThreadCreator(file): drumThread = thread...
_app.py
""" websocket - WebSocket client library for Python Copyright (C) 2010 Hiroki Ohtani(liris) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, ...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
mock_web_api_server.py
import json import logging import re import sys import threading import time from http import HTTPStatus from http.server import HTTPServer, SimpleHTTPRequestHandler from multiprocessing.context import Process from typing import Type from unittest import TestCase from urllib.request import Request, urlopen from tests....
helper.py
import asyncio import functools import json import math import os import random import re import sys import threading import time import uuid import warnings from argparse import ArgumentParser, Namespace from datetime import datetime from itertools import islice from types import SimpleNamespace from typing import ( ...
diamond-1.py
#!/usr/bin/python # coding=utf-8 #jangan di recode ngentot #recode jomblo seumur hidup # (MR.K7C8NG) PEMBUAT #SUBSCRIBE CHANNEL mrk7c8ng-ices #FOLLOW INSTAGRAM @pranata_pasha #Import module import os,sys,time,datetime,random,hashlib,re,threading,json,getpass,urllib,cookielib from multiprocessing.pool import ThreadPool...
test_events.py
from __future__ import print_function from __future__ import absolute_import from __future__ import division from future import standard_library standard_library.install_aliases() from builtins import range from builtins import object import logging import mock import queue import sys import threading import time impor...
xtp_gateway.py
from typing import Any, Sequence from datetime import datetime from threading import Thread from vnpy.api.xtp.vnxtp import ( XTP, set_async_callback_exception_handler, AsyncDispatchException, OrderBookStruct, XTPMarketDataStruct, XTPQuoteStaticInfo, XTPRspInfoStruct, XTPSpecificTickerSt...
magic_castle.py
from os import path, environ, mkdir, remove, scandir, rename from subprocess import run, CalledProcessError from shutil import rmtree from threading import Thread from marshmallow import ValidationError from models.magic_castle.magic_castle_configuration import MagicCastleConfiguration from models.magic_castle.cluster_...
userspider.py
# -*- coding=utf-8 -*- import threading import time, requests, random, sys, codecs import MySQLdb import math from bs4 import BeautifulSoup # 代理 from utils.myutils import spider # 数据库更新语句执行操作 def sql_opt(sql): db = MySQLdb.connect("localhost", "root", "123456789", "db_csdn_user", charse...
dl-imgnet.py
#! /bin/env python3 """ Helper script to download image-net.org image corresponding to a given ID. Author: Patrice FERLET <metal3d@gmail.com> Licence: MIT """ import requests import os import hashlib import imghdr import io import queue import threading import multiprocessing import sys CPUs = multiprocessing.cpu_cou...
action_manager.py
import json import logging import threading import time from collections import deque from typing import (Any, Callable, Deque, Dict, List, Tuple, cast) from actions.commands.auto_refill import AutoRefillCommand from actions.commands.get_gripsense import GetGripsenseCommand from actions.commands.get_position import Ge...
sideinputs.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
test_translation.py
import unittest import threading import model_server as ms import available_models import time import requests import os dir_path = os.path.dirname(os.path.realpath(__file__)) os.chdir(dir_path[:-5]) class TestTranslation(unittest.TestCase): """Starting the translation server here""" model_server_thread = ...
control.py
import os from time import sleep import json from multiprocessing import Process states_json_path = "/workspace/go_proj/src/Ai_WebServer/algorithm_utils/model_states.json" model_name = "firstOrder" def run_model_server(): os.system("python run.py") if __name__ == '__main__': running = False while True: ...
AgRec.py
#-*- coding: utf-8 -*- import re import os import sys import requests import random import m3u8 import datetime import argparse import subprocess from pathlib import Path from time import sleep from datetime import datetime as dt from datetime import timedelta from threading import (Event, Thread) parser = argparse....
main.py
import pygame import threading import time from bot import * from maps import * from find_path import * from picToMap import * pygame.init() # set map size map_size = (50, 50) # create paint screen screen = pygame.display.set_mode((map_size[0] * 10, map_size[1] * 10)) # set window title pygame.display.set_caption(...
drone_controller.py
import json from drones.CrazyFlie import CrazyFlie from drones.ProxyDrone import ProxyDrone from drones.drone import serial_connection, Drone, control_drone, WayPoint import threading # TODO: this is just a temporary solution import serial class DroneController: def __init__(self, vinter_receiver): se...
thermald.py
#!/usr/bin/env python3 import datetime import os import queue import threading import time from collections import OrderedDict, namedtuple from pathlib import Path from typing import Dict, Optional, Tuple import psutil import cereal.messaging as messaging from cereal import log from common.dict_helpers import strip_d...
health.py
import datetime import time import threading import redis from flask import Flask, jsonify from random import randint OK = 'OK' app = Flask(__name__) app.healthy = True r = redis.Redis() APP_NAME = "TESTABLE_HEALTH_APP" def update_health(status): if status: r.setex(APP_NAME, 5, status) else: ...
views.py
from django.shortcuts import render from django.views.generic.edit import CreateView from django.urls import reverse_lazy from django.shortcuts import render from django.http import HttpResponse from genome_assembly.functions.functions import * from genome_assembly.forms import * from genome_assembl...
harmonyNode.py
############################################# ## harmonyNode ############################################# print('Load harmonyNode.py') import sys, os, io, time, traceback, threading, asyncio, json, importlib path = os.path.join('/aioharmony', os.path.dirname(__file__)) sys.path.append(path) path = os.pat...
gui.py
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QGraphicsDropShadowEffect import process from threading import Thread import time from process import loading,time_tk,limite import json from PIL import * import os import face_recognition as frc import numpy as np #Setting up the load class limite...
batch_project.py
import json import networkx as nx import argparse import sys from networkx.readwrite import json_graph import os from maskgen import software_loader from maskgen import scenario_model import random from maskgen import tool_set import shutil from maskgen import plugins from maskgen import group_operations import loggin...
test_service.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from tests.factories import UpdateFactory import threading from django.conf import settings settings.configure( DEBUG=True, USE_TZ=True, DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", } }, ROO...