source
stringlengths
3
86
python
stringlengths
75
1.04M
launch.py
#!/usr/bin/python from __future__ import print_function import os import subprocess import threading import sys def worker(local_rank, local_size, command): my_env = os.environ.copy() my_env["BYTEPS_LOCAL_RANK"] = str(local_rank) my_env["BYTEPS_LOCAL_SIZE"] = str(local_size) if os.getenv("BYTEPS_ENAB...
run_dash.py
import threading import subprocess import webbrowser import time def run_dash(): """ Run dash application in this function and then open then dash url in the new window. :return: None """ proc = subprocess.Popen(['python', './template/only_dash.py'], stdout=sub...
communication.py
#!/usr/bin/env python """Module for managing communication lines Include class for Java and ROS communication """ import abc from socket import socket, timeout from threading import Thread import sys import time from std_msgs.msg import String from sonia_msgs.msg import filterchain_return_message as ret_str import ro...
subproc_vec_env.py
import multiprocessing as mp from collections import OrderedDict from typing import Any, Callable, List, Optional, Sequence, Tuple, Type, Union import gym import numpy as np from hmlf import spaces from hmlf.environments.vec_env.base_vec_env import CloudpickleWrapper, VecEnv, VecEnvIndices, VecEnvObs, VecEnvStepRetur...
email.py
from threading impor Thread from flask_mail import Message from flask import current_app, render_template #from . import mail def send_async_mail(message): #with app.app_context(): #mail.send(message) pass def welcome_mail(user): message = Message('Bienvenido!', sender=current...
VideoServer.py
import netifaces import SocketServer,threading # Network stream object. # Open a server to send bytes to clients. def getPreferredIp( ) : for myIf in ['eth0', 'wlan0' ]: try : iface = netifaces.ifaddresses( myIf).get(netifaces.AF_INET) if iface == None: continue ...
main.py
import logging import os import socket import sys import threading from client_connection import PeerConnectionThread, TrackerConnectionThread from pathlib import Path from db_operations import DataBase from models.peer_info import PeerInfo from peer import Peer from models.product import Product from tracker import Tr...
experiments.py
from __future__ import print_function from .. import datasets from . import metrics from . import models from . import methods from .. import __version__ import numpy as np import sklearn import os import pickle import sys import time import subprocess from multiprocessing import Pool import itertools import copy impor...
main.py
# Copyright 2020 Google Research. 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...
CustomHighlighter.py
import re import os import time import zlib import struct import threading from functools import partial import sublime import sublime_plugin from .settings import Settings, SettingTogglerCommandMixin from .colorizer import SchemaColorizer # if $$highlighter$$ is colored in this comment # then no colors have been co...
collector.py
def collect(config_out, input_data_out, data_path_out, collector_n_out, global_var_actor_out=None, steps=10): import abc import time from multiprocessing import Process import tensorflow as tf import gym # import reverb # import ray import lux_gym.agents.agents as agents ...
scapy_isolated_test.py
#!/usr/bin/python import sys, os from multiprocessing import Process import tempfile from functools import wraps def check_offsets(build, scapy_str): import sys # clean this env for key in sys.modules.copy().keys(): if key.startswith('scapy.'): del sys.modules[key] globals().clear...
test_mp_full.py
from __future__ import print_function """ multiproc full tests. """ import importlib import multiprocessing import platform import pytest import time import wandb from wandb.errors import UsageError import sys def train(add_val): time.sleep(1) wandb.log(dict(mystep=1, val=2 + add_val)) wandb.log(dict(my...
queue.py
# Using queue.Queue # • The queue.Queue data structure can be used to synchronize both threads and processes import threading import queue q = queue.Queue() def worker(): while True: item = q.get() print(f"Item {item}.", end=" ") q.task_done() threading.Thread(target=worker, daemon=True)...
test_util.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 a...
DenseAmpcor.py
#! /usr/bin/env python #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Copyright 2014 California Institute of Technology. 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. # Yo...
BER_confidence_level_calculator_v0p2.py
#!python3 # -*- coding: utf-8 -*- """ @author: yanbin Any suggestion? Please contract yanbin_c@hotmail.com """ import os import wx import sys import time,datetime import numpy as np import math from time import clock from threading import Thread from wx.lib.embeddedimage import PyEmbeddedImage class ...
notification.py
#!/usr/bin/env python3 import logging import re import smtplib import time from abc import ABC from email.message import EmailMessage from threading import Thread from typing import List, Dict import pymsteams import validators from mf import BRAND from mf.utils import EnvironmentVariableFetcher class SendEventDec...
parallel.py
import os import sys from collections import OrderedDict, deque from threading import Event, Semaphore, Thread from tox import reporter from tox.config.parallel import ENV_VAR_KEY_PRIVATE as PARALLEL_ENV_VAR_KEY_PRIVATE from tox.config.parallel import ENV_VAR_KEY_PUBLIC as PARALLEL_ENV_VAR_KEY_PUBLIC from tox.exceptio...
test_enum.py
import enum import inspect import pydoc import unittest import threading from collections import OrderedDict from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto from io import StringIO from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL from test import support from datetime import timede...
rpi76.py
# importing libraries import paho.mqtt.client as mqtt from PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGui from PyQt5.QtGui import * from PyQt5.QtCore import * import sys import time import threading import RPi.GPIO as GPIO try: GPIO.setmode(GPIO.BCM) GPIO.setup(23, GPIO.IN) # RFID GPIO.setup(24,...
test_mturk_manager.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import os import time import json import threading import pickle from unittest import mock from parlai.m...
admin_pwr.py
#!/usr/bin/env python2.7 import RPi.GPIO as GPIO import time import os import subprocess from threading import Thread import socket import sys import syslog # Connect the socket to the port where the server is listening server_address = '/var/run/uds_led' hardware = os.popen("cat /proc/cpuinfo | grep Hardware | awk ...
mining.py
# Copyright 2021 Hathor Labs # # 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, s...
test_queue.py
# Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. import Queue import time import unittest from test import test_support threading = test_support.import_module('threading') QUEUE_SIZE = 5 # A thread to run a function that unclogs a blocked Queue. class _TriggerT...
spinner.py
# Copyright 2021 MONAI Consortium # 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, s...
programs.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """Running programs utilities.""" from __future__ import print_function # Standard library imports from ast import literal_eval from getpass import getuser from tex...
processing1.py
#! /usr/bin/env python3 # -*-coding:utf-8 -*- # @Time : 2019/06/16 18:52:49 # @Author : che # @Email : ch1huizong@gmail.com from multiprocessing import Process, Queue import time def f(q): x = q.get() print("Process number %s, sleeps for %s seconds" % (x, x)) time.sleep(x) # 若time.sleep(10-x) p...
HydrusPaths.py
import gc from . import HydrusConstants as HC from . import HydrusData from . import HydrusExceptions from . import HydrusGlobals as HG from . import HydrusThreading import os import psutil import re import send2trash import shlex import shutil import stat import subprocess import sys import tempfile import threading i...
test_worker.py
# -*- encoding: utf-8 -*- # # 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 ...
spinny.py
__doc__, __version__ = "A simple spinner library.", "1.1.0" import itertools, time, threading, sys class Spinner: def __init__(self, dt='Loading...', at='Done.'): self.spinner,self.dt,self.at,self.busy = itertools.cycle('⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'),dt,at,True def spin(self): while self.busy: [print(f'{next(self.spinne...
visual_feedback_generator.py
from queue import Queue from threading import Thread from os import path import gzip import pickle import os import numpy as np import cv2 import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.backends.backend_pdf from libs.configuration_manager import ConfigurationManager as gconfi...
pdp11.py
#!/usr/bin/env python3 # This code is based on Julius Schmidt's PDP-11 emulator for JavaScript. # You can run that one in your browser: http://pdp11.aiju.de # (c) 2011, Julius Schmidt, JavaScript/HTML implementation, MIT License # (c) 2019, Andriy Makukha, ported to Python 3, MIT License # Version 6 Unix (in the disk ...
rpc_manager.py
# # Copyright 2013 Free Software Foundation, Inc. # # This file is part of GNU Radio. # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Thi...
exported-sql-viewer.py
#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # exported-sql-viewer.py: view data from sql database # Copyright (c) 2014-2018, Intel Corporation. # To use this script you will need to have exported data using either the # export-to-sqlite.py or the export-to-postgresql.py script. Refer to those # scripts f...
archiver.py
import argparse import dateutil.tz import errno import io import json import logging import os import pstats import random import re import shutil import socket import stat import subprocess import sys import tempfile import time import unittest from binascii import unhexlify, b2a_base64 from configparser import Config...
trainer.py
class Trainer: def __init__(self, gamma, agent, window = 15, workers = 8, **kwargs): super().__init__(**kwargs) self.agent = agent self.window = window self.gamma = gamma self.optimizer = optim.Adam(self.agent.parameters(), lr=1e-4) self.workers = workers # ...
streaming.py
# Tweepy # Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. import httplib from socket import timeout from threading import Thread from time import sleep import urllib import zlib from tweepy import __version__ from tweepy.models import Status from tweepy.api import API from tweepy.error import TweepEr...
test_api.py
import mock import re import socket import threading import time import warnings from unittest import TestCase import pytest from ddtrace.api import API, Response from ddtrace.compat import iteritems, httplib, PY3 from ddtrace.internal.runtime.container import CGroupInfo from ddtrace.vendor.six.moves import BaseHTTP...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import StringIO import errno import os try: import ssl except ImportError: ssl = None from unittest import TestCase ...
worker.py
import time import datetime import json import redis import threading import sys sys.path.append('..') import variables from logger.Logger import Logger, LOG_LEVEL def log(func): def wrapper(*args, **kwargs): print("MudPi Debug Log: " + " ".join([str(arg) for arg in args]) + " at " + str(datetime.datetime.now())) ...
sensor_interface.py
import copy import logging import numpy as np import os import time from threading import Thread import carla def threaded(fn): def wrapper(*args, **kwargs): thread = Thread(target=fn, args=args, kwargs=kwargs) thread.setDaemon(True) thread.start() return thread return wrappe...
connection.py
# Copyright DataStax, 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 writing, softwa...
signals_files_group.py
import os from multiprocessing import Process, Manager from os.path import basename import pandas as pd from rl_coach.dashboard_components.globals import x_axis_options, add_directory_csv_files, show_spinner, x_axis from rl_coach.dashboard_components.signals_file_base import SignalsFileBase from rl_coach.dashboard_co...
views.py
from threading import Thread from django.conf import settings from django.contrib.sites.shortcuts import get_current_site from django.http import HttpResponse from django.shortcuts import redirect, get_object_or_404 from django.views import View from drf_yasg.utils import swagger_auto_schema from rest_framework import...
test_telnetlib.py
import socket import select import telnetlib import time import contextlib import unittest from unittest import TestCase from test import support threading = support.import_module('threading') HOST = support.HOST def server(evt, serv): serv.listen(5) evt.set() try: conn, addr = serv.accept() ...
modelArchitectureX.py
from openvino.inference_engine import IECore import threading import time from multiprocessing import Process import pickle import cv2 import os import numpy as np from scipy.spatial.distance import cosine from numpy import load recognizedIdentity=[''] INPUT_STREAM=r"C:\Users\LENOVO\Downloads\Power...
app.py
#!/usr/bin/env python3 # encoding: UTF-8 import re, socket, os, time, sys, threading, pkgutil, json from xml.sax.saxutils import escape as xmlescape from urllib.error import HTTPError from twisted.internet import reactor from twisted.web.resource import Resource from twisted.web.server import Site from twisted.web.st...
execution_summary_test.py
# -*- coding: utf-8 -*- # # Copyright 2015-2015 Spotify AB # # 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...
netbeacon.py
#!/usr/bin/python # -*- coding: utf-8 -*- ################################################################################ # Copyright 1998-2018 by authors (see AUTHORS.txt) # # This file is part of LuxCoreRender. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
mp.py
import os import pickle import struct import sys from functools import partial from multiprocessing import Lock, Event as ProcessEvent from threading import Thread, Event as TrEvent from time import sleep, time from typing import List, Dict, Optional from multiprocessing import Process import psutil from six.moves.que...
server.py
import hmac import json import urllib.parse from .main import ( PullReqState, parse_commands, db_query, INTERRUPTED_BY_HOMU_RE, synchronize, LabelEvent, ) from . import comments from . import utils from .utils import lazy_debug import github3 import jinja2 import requests import pkg_resources fr...
led.py
# Copyright 2017 Google 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 writing, ...
test_process.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, print_function, unicode_literals import datetime import functools import io import multiprocessing import os import signal import sys import threading import time import warnings import psutil # Import salt libs import salt.utils.p...
swiss.py
import socket,os,threading,sys import subprocess as sub def usage(): print("nc.py [target] [port] [-e destanation] {-h] [-l]") if "-h" in sys.argv: usage() exit() try: target = sys.argv[1] port = int(sys.argv[2]) except: usage() exit() listen = ("-l" in sys.argv) exec...
controller.py
#!/usr/bin/env python3 # MIT License ## # Copyright (c) 2017 Sayak Brahmachari ## # 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 # righ...
scratchpad.py
# -*- coding: utf-8 -*- """ Display number of scratchpad windows and urgency hints. Configuration parameters: cache_timeout: refresh interval for i3-msg or swaymsg (default 5) format: display format for this module (default "\u232b [\?color=scratchpad {scratchpad}]") thresholds: specify color thres...
TestAutoReload.py
import nanome from multiprocessing import Process import time import sys def start_process(): print("Start subproc") sys.stdout.flush() while True: print("Hello") sys.stdout.flush() time.sleep(3) class Test(nanome.PluginInstance): pass process = None def pre_run(): p...
necedge.py
#!/usr/bin/env python3 # # Copyright (c) 2020 Giovanni Baggio # # 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 applicab...
test_dispatcher.py
from __future__ import print_function, division, absolute_import import errno import multiprocessing import os import platform import shutil import subprocess import sys import threading import warnings import inspect import pickle import weakref from itertools import chain try: import jinja2 except ImportError: ...
ot.py
#!/usr/bin/python3 import traceback import paho.mqtt.client as mqtt from threading import Thread, Condition, Timer from signal import signal, SIGTERM from configuration import env import json import time import datetime import sys import struct from iou_tracker import IOUTracker from utils import BBUtil mqtthost = env...
tso.py
import argparse import threading from subprocess import Popen, PIPE from typing import List def run_process(process_args: List): """ Runs a python process and prints the stderr to the current console Args: process_args: The args to pass through to the process """ process = Popen(process_ar...
NonSSL.py
#!/bin/env python3 ''' ''' # 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 ...
08_赠送.py
""" pip3 install requests """ import threading import requests import uuid url_list = [ 'https://www3.autoimg.cn/newsdfs/g28/M05/F9/98/120x90_0_autohomecar__ChsEnluQmUmARAhAAAFES6mpmTM281.jpg', 'https://www2.autoimg.cn/newsdfs/g28/M09/FC/06/120x90_0_autohomecar__ChcCR1uQlD6AT4P3AAGRMJX7834274.jpg', 'https...
textbox.py
import copy import time from threading import Thread from ..graphics import Color from .component import Component from .panel import Panel from .label import Label from .layout import Relative class Textbox(Component): """@brief Box for users to type text into. """ def __init__(self, controller, num_cha...
produtor_consumidor.py
from threading import Thread, Condition from time import sleep import random from random import randint import sys import argparse import string import logging # ---- # logging.basicConfig(level=logging.DEBUG, format='> %(threadName)-9s: %(message)s',) # ---- # parser = argparse.ArgumentParser( ...
leetcode.py
import json import logging import re import time import os import pickle from threading import Semaphore, Thread, current_thread try: from bs4 import BeautifulSoup import requests inited = 1 except ImportError: inited = 0 try: import vim except ImportError: vim = None try: import browser_...
test_logging.py
# Copyright 2001-2019 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
bruteforcer_3000.py
#!/bin/python3 #Script to win overthewire bandit 24 challenge import threading import socket from time import sleep HOST = "127.0.0.1" PORT = 30002 BUFFERSIZE = 2048 PASS = "" # Input password for user #Types 0 - Normal, 1 - Warning, 2 - Success def outputMessage(msg, type): if (type == 1): print("[!] "...
cache.py
# cache.py # A minimalist caching decorator which json serializes the output of functions import json import time import threading from functools import wraps from inspect import getcallargs class CacheNameClashException(Exception): pass # Though it might make sense to look for name clashes on # per-cache level,...
bot.py
# Copyright 2008, Sean B. Palmer, inamidst.com # Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> # Copyright 2012-2015, Elsie Powell, http://embolalia.com # Copyright 2019, Florian Strzelecki <florian.strzelecki@gmail.com> # # Licensed under the Eiffel Forum License 2. from __future__ import generator_stop fr...
console.py
# Copyright 2010 New Relic, 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 writ...
LockMonitor.py
# Copyright (c) 2012, Jeff Melville # 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 an...
capture.py
from threading import Thread import cv2 class VideoGet: """ Class that continuously gets frames from a VideoCapture object with a dedicated thread. """ def __init__(self, src=0): self.stream = cv2.VideoCapture(src,cv2.CAP_GSTREAMER) (self.grabbed, self.frame) = self.stream.read() ...
es_api.py
""" Serve the elasticsearch API as a threaded Flask app. """ import json import logging import threading import time from random import randint from typing import Dict, Optional from flask import Flask, jsonify, make_response, request from localstack import config, constants from localstack.constants import TEST_AWS_...
env_wrappers.py
"""Env wrappers Most common wrappers can be checked from following links for usage: `https://pypi.org/project/gym-vec-env` `https://github.com/openai/baselines/blob/master/baselines/common/*wrappers.py` """ from collections import deque from functools import partial from multiprocessing import Pipe, Process, cpu_count...
testConnection.py
############################################################################## # # Copyright (c) 2001, 2002 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 distribution. # TH...
app.py
# Adapted from https://github.com/dropbox/mdwebhook from hashlib import sha256 import hmac import json import os import threading from urllib.parse import urlparse from dropbox.client import DropboxClient, DropboxOAuth2Flow from flask import abort, Flask, redirect, render_template, request, session, url_for # App ke...
exp_circle_cb.py
from lib_fin_simple_c import * from time import sleep import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) import numpy as np from lib_camera import Camera import threading from lib_leds import LEDS from lib_depthsensor import DepthSensor from lib_fin import Fin from lib_photodiode import Photodiode...
SCardBeginTransaction_deadlock.py
#! /usr/bin/env python # SCardBeginTransaction_deadlock.py: Unitary test for locking in # SCardBeginTransaction, SCardTransmit, SCardStatus and SCardReconnect # Copyright (C) 2012 Ludovic Rousseau # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Genera...
game.py
from random import * import playsound from tkinter import * from PIL import Image, ImageTk from threading import Thread import speech_recognition as sr import pyttsx3 import time from pynput.keyboard import Key, Controller def closeWindow(): keyboard = Controller() keyboard.press(Key.alt_l) ke...
bq_client.py
import argparse import sys import logging from utils.bigquery_utils import BigQueryUtils from utils.common_utils import * from gcputils.utils.bigquery_utils import * from gcputils.utils.common_utils import * logging.basicConfig(stream=sys.stdout, level=logging.INFO) class BigQueryClient: def __init__(self, args...
bazelci.py
#!/usr/bin/env python3 # # Copyright 2018 The Bazel 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 ...
emails.py
from threading import Thread from flask import url_for, current_app from flask_mail import Message from bluelog.extensions import mail def _send_async_mail(app, message): with app.app_context(): mail.send(message) def send_mail(subject, to, html): app = current_app._get_current_object() messag...
runBT_multiple.py
import sys import os dirpath_base = "C:\\Users\\zhouyou\\Documents\\BaiduNetdiskWorkspace\\GitHub\\" print(dirpath_base) sys.path.append(os.path.join(dirpath_base, 'wtpy')) from wtpy import WtBtEngine, EngineType #from strategies.HftStraDemo import HftStraDemo, myTestHftStrat, myTestHftArbitrageStrat, mySimpleArbitrag...
tests.py
# -*- coding: utf-8 -*- # Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. from __future__ import unicode_literals import os import re import copy import shutil import tempfile import threading import time import unittest import warnings from django.conf import settings ...
utils.py
# Copyright 2012-present MongoDB, 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 wri...
broker.py
""" Broker class that is part of the session object. Handles distributing parts of the emulation out to other emulation servers. The broker is consulted when handling messages to determine if messages should be handled locally or forwarded on to another emulation server. """ import logging import os import select impo...
rheatrace.py
#!/usr/bin/env python # Copyright (C) 2021 ByteDance 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...
animation.py
''' Steps for adding a new pattern: 1. Create new animation function using the template 2. Add the new animation function to the setPattern switch statement 3. Increase the shufflePattern() function's randint by 1 ''' ''' Animation Function Template: def Function(): global animation animation = Function #s...
client.py
import socket import sys import json import threading import random import base64 from simplecrypt import encrypt, decrypt from config import SERVER_ADDRESS, BUFSIZE, MODULUS, BASE sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(SERVER_ADDRESS) secret_key = random.randint(1, MODULUS) public_ke...
iprofile_app.py
import os import sys import time import webbrowser import threading import json try: import tornado import tornado.ioloop import tornado.web except ImportError: tornado = None from collections import defaultdict, deque from itertools import groupby from openmdao.devtools.iprofile import _process_pro...
views.py
from django.shortcuts import render from django.contrib import messages import threading from .Functions import gan_generate from .Functions.rnn_generate import RNN_generator from .forms import * def index(request): """ A start view """ form = TaskForm() context = {'form': form} return rende...
watchdog.py
# coding=utf8 # Watch background processes/threads import threading from time import sleep from lib._logging import logger class Watchdog(): def __init__(self,interval=30): ''' Initialize Watchdog Keyword Arguments: interval {number} -- time to sleep between checking watchlist...
__main__.py
from discord.ext import commands import os from threading import Thread import time import re import lavalink import discord class Bot: def __init__(self, **kwargs): self.intents = discord.Intents.default() self.intents.members = True if "prefix" not in kwargs: raise "You must provide a prefix" else: se...
things3_app.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """KanbanView (app) for Things 3.""" from __future__ import print_function # pylint: disable=duplicate-code __author__ = "Alexander Willner" __copyright__ = "Copyright 2020 Alexander Willner" __credits__ = ["Luc Beaulieu", "Alexander Willner"] __license__ = "Apache Lice...
enviroplus_exporter.py
#!/usr/bin/env python3 import os import random import requests import time import logging import argparse import subprocess from threading import Thread from prometheus_client import start_http_server, Gauge, Histogram from bme280 import BME280 from enviroplus import gas from pms5003 import PMS5003, ReadTimeoutError ...
io.py
# Copyright (c) 2018 PaddlePaddle 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 app...
build.py
#!/usr/bin/env python import os import sys from queue import Queue, Empty from threading import Thread from subprocess import PIPE, Popen BUILD_IMAGE = 'build/nevercast_tinysoc_tinysoc_0.1/tinyfpga_bx-icestorm/nevercast_tinysoc_tinysoc_0.1.bin' RISCV_TOOLCHAIN_PATH = '/opt/riscv32i/bin/' FIRMWARE_OUTPUT_PA...
mock_remote_server.py
""" An HTTP server that listens on localhost and returns a variety of responses for mocking remote servers. """ from contextlib import contextmanager from threading import Thread from time import sleep from wsgiref.simple_server import make_server import urllib2 import socket import os class MockHTTPServer(object): ...