source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
email.py | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from ..extensions import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(recipients, subject, template, **kwargs):
if len(recipients) == 0:
re... |
installwizard.py | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import os
import json
import sys
import threading
import traceback
from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CH... |
testcluster.py | """
Cluster API module tests
"""
import json
import os
import tempfile
import unittest
from http.server import HTTPServer, BaseHTTPRequestHandler
from threading import Thread
from unittest.mock import patch
from fastapi.testclient import TestClient
from txtai.api import app, start
# Configuration for an embeddings... |
main_aisle.py | global_rssi = 0
import os, sys, time, struct
import bluetooth._bluetooth as bluez
import bluetooth
import threading
from time import gmtime, strftime
from PyQt4 import QtCore, QtGui
sys.path.insert(0, 'User_Interface/')
sys.path.insert(0, 'Bluetooth/')
sys.path.insert(0, 'Sensors/')
sys.path.insert(0, 'Comms/')
from... |
engine.py | # Copyright 2013: Mirantis 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 b... |
blinker.py | import RPi.GPIO as GPIO
import logging
import threading
__modes = None
__mode = None
__blink_event = None
__blink_thread = None
__quit_mode = "QUIT"
LED = 7
def setup_and_start(modes={}, inital_mode="RUN", quit_mode="QUIT"):
global __modes, __mode, __blink_event, __blink_thread, __quit_mode
if __... |
get_and_display_data_avg.py | from __future__ import division
import threading
import rethinkdb as r
import math
import numpy as np
import cv2
from matplotlib import pyplot as plt
import os
plt.scatter([0,5],[0,5])
plt.ion()
plt.show()
plt.clf()
x1=0
y1=0
x2=3.4
y2=0
x3=1.7
y3=1.4
def kmeans(Z,STO):# pg please make Z a np array like the one des... |
deployCVEcluster.py | #!/usr/bin/env python
# from os import system, path
# from sys import exit
from threading import Thread
from time import sleep
from getpass import getpass
import tarfile
import urllib2
import ssl
from pyVim import connect
from pyVmomi import vim
from pyhesity import *
from datetime import datetime
### command line a... |
test_utils.py | # This file is part of the MapProxy project.
# Copyright (C) 2010-2013 Omniscale <http://omniscale.de>
#
# 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/LI... |
axis.py | import pglive.examples_pyqt5 as examples
import signal
import time
from math import sin
from threading import Thread
from time import sleep
import pyqtgraph as pg
from pglive.kwargs import Axis
from pglive.sources.data_connector import DataConnector
from pglive.sources.live_axis import LiveAxis
from pglive.sources.li... |
pylistener.py | #!/usr/bin/python3 -B
import time
import math
from aoyun_fdcanusb.moteusController import Controller
from aoyun_fdcanusb.moteusReg import MoteusReg
import rospy
import rospy
from std_msgs.msg import String
from sensor_msgs.msg import JointState
import threading
def thread_job():
rospy.spin()
positions = [0 fo... |
smoke.py | # Copyright 2018 John Reese
# Licensed under the MIT license
import asyncio
import sqlite3
import sys
from pathlib import Path
from sqlite3 import OperationalError
from threading import Thread
from unittest import skipIf, SkipTest, skipUnless
import aiounittest
import aiosqlite
from .helpers import setup_logger
TEST... |
test_memalloc.py | # -*- encoding: utf-8 -*-
import gc
import os
import threading
import pytest
try:
from ddtrace.profiling.collector import _memalloc
except ImportError:
pytestmark = pytest.mark.skip("_memalloc not available")
from ddtrace.internal import nogevent
from ddtrace.profiling import _periodic
from ddtrace.profilin... |
nbsp.py | # _*_ coding:UTF-8 _*_
import time
from threading import Thread, Event
from six.moves import queue
from deval.utils.logger import get_logger
LOGGING = get_logger(__name__)
class NonBlockingStreamReader:
def __init__(self, stream, raise_EOF=False, print_output=True, print_new_line=True, name=None):
'''
... |
test_interrupt.py | import os
import time
from threading import Thread
from dagster import DagsterEventType, execute_pipeline_iterator, lambda_solid, pipeline
from dagster.utils import safe_tempfile_path
try:
import _thread as thread
except ImportError:
import thread
def _send_kbd_int(temp_file):
while not os.path.exists(t... |
notes.py | #################################################
# notes.py
#
# Code snippets and examples for future reference
#################################################
# basic block hit detection
def blockHitTest():
while True:
blockHits = mc.events.pollBlockHits()
for blockHit in blockHits:
print(str(blockHit.pos)... |
TargetManager.py | ##############################################################################
# Copyright (c) 2016 Intel 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... |
12 test.py | # encoding = utf-8
__author__ = "mcabana.com"
# 订单要求生产1000个杯子,组织10个工人生产。请忽略老板,关注工人生成杯子
import logging
import threading
import time
FORMAT = "%(asctime)s %(threadName)s %(thread)d: %(message)s"
logging.basicConfig(format=FORMAT, level=logging.DEBUG)
cups = []
lock = threading.Lock()
def worker(count=1000):
lo... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return 'FreddyBot is running!'
def run():
app.run(host='0.0.0.0', port=8080)
def keep_alive():
server = Thread(target=run)
server.start() |
threaded_call.py | from .callable_wrapper import CallableWrapper
from functools import wraps
from threading import Thread
def run_async_thread(log=None, callbackFunc=None):
'''
def printCallback(result=None):
print("CALLBACK DONE")
print("Return: %s"% result)
@run_async_thread(callbackFunc=printCallback)
... |
debugger_unittest.py | from collections import namedtuple
from contextlib import contextmanager
import json
try:
from urllib import quote, quote_plus, unquote_plus
except ImportError:
from urllib.parse import quote, quote_plus, unquote_plus # @UnresolvedImport
import re
import socket
import subprocess
import threading
import time
i... |
logging.py | """Logging utilities."""
import asyncio
from asyncio.events import AbstractEventLoop
from functools import partial, wraps
import inspect
import logging
import threading
import traceback
from typing import Any, Callable, Coroutine, Optional
from .async_ import run_coroutine_threadsafe
class HideSensitiveDataFilter(lo... |
athenad.py | #!/usr/bin/env python3
import base64
import hashlib
import io
import json
import os
import sys
import queue
import random
import select
import socket
import threading
import time
from collections import namedtuple
from functools import partial
from typing import Any
import requests
from jsonrpc import JSONRPCResponseM... |
ssh_client.py | #Copyright 2018, The RouterSploit Framework (RSF) by Threat9 All rights reserved.
import socket
import paramiko
import os
import select
import sys
import threading
import io
from secistsploit.core.exploit.exploit import Exploit
from secistsploit.core.exploit.exploit import Protocol
from secistsploit.core.exploit.optio... |
data_append2therad.py | import tushare as ts
import datetime
import pymongo
import logging
import time
import threading
"""
并行版本数据更新,不需要无限循环,每天只需要跑一次,最新更改版本,目前线上版本 。
"""
logger = logging.getLogger(__name__)
logger.setLevel(level=logging.INFO)
handler = logging.FileHandler("y_append")
handler.setLevel(logging.INFO)
formatter = logging.Format... |
lookup.py | #!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
import threading
def parseMarketPage(pageId):
print('- Parsing MaketPage {}'.format(pageId))
url = 'https://steamcommunity.com/market/search?appid=730#p{}_price_desc'.format(pageId)
res = requests.get(url)
if (res.status_code != 200):
pr... |
module.py | import time
import logging
import queue
import threading
import mpd
import pyowm
import pydbus as dbus
from asteroid import Asteroid, DBusEavesdropper, WeatherPredictions
from gi.repository import GLib
def merge_dicts(first, second):
""" Recursively deep merges two dictionaries """
ret = first.copy()
for ... |
EmulatorStub.py | import random
import threading
from emulators.Medium import Medium
from emulators.MessageStub import MessageStub
class EmulatorStub:
def __init__(self, number_of_devices: int, kind):
self._nids = number_of_devices
self._devices = []
self._threads = []
self._media = []
sel... |
alans_jobServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
node_logic.py | from node import Ui_MainWindow
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QThread, QTimer, QEvent, pyqtSignal, QStringListModel
import sys, time, os
from core import get_nodes, connect_nodes, async_run
import threading
from Utils import ReadConfig
class RenderWind... |
Bee_POST.py | import pythoncom
import pyHook
from os import path
from time import sleep
from threading import Thread
import urllib, urllib2
import datetime
import win32com.client
import win32event, win32api, winerror
from _winreg import *
import shutil
import sys
import base64
import requests
ironm = win32event.CreateMutex(None, 1,... |
auto_start_lilibot.py | #! /usr/bin/python3
import os
import sys
import time
from multiprocessing import Process
def launch_ros(bluetooth):
'''
launch ros node by joy stick
'''
startpath=os.environ['GOROBOTS'] + "/utils/real_robots/stbot/catkin_ws/src/start_robot/start_lilibot"
data=[]
with open(bluetooth, 'rb') as f... |
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.
from __future__ import print_function
import argparse
... |
freeproxylist.py | import sys
import requests
from lxml.html import fromstring
from threading import Thread
if __name__ == "__main__":
from utils import test_proxy, validate_ip
else:
from .utils import test_proxy, validate_ip
# these sites got all the same structure
# proxy lists:
URLS = [
"https://www.us-proxy.org/",
... |
cli.py | # -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import ast
import inspect
import os
import re
import sys
import traceback
from functools import update_wrap... |
test_spark.py | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import json
import os
import ssl
import threading
import time
import mock
import pytest
import requests
import urllib3
from requests import RequestException
from six import iteritems
from six.moves import... |
main.py | import discum_c844aef
import time
import multiprocessing
import json
import random
import re
import os
try:
from tkinter import messagebox
use_terminal=False
except:
use_terminal=True
once=False
wbm=[12,16]
update = 0
class bot:
owoid=408785106942164992 #user id of the owo bot
with open('settings.json', "w+"... |
SerialClient.py | #!/usr/bin/env python
#####################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that th... |
monitor.py | import logging
from threading import Thread
import time
class MonitorError(Exception):
pass
class Monitor:
"""Abstract class implementing monitor."""
def __init__(self, config, publishers):
self._log = logging.getLogger('iotconnect.monitors.' + self.__class__.__name__)
self._log.info("... |
ptdm.py | from pitopcommon.logger import PTLogger
from pitopcommon.type_helper import TypeHelper
from threading import Thread
from time import sleep
from inspect import signature
from traceback import format_exc
import zmq
from atexit import (
register,
unregister,
)
_TIMEOUT_MS = 1000
# Messages sent to/from pt-devi... |
manager.py | #!/usr/bin/env python3
import datetime
import importlib
import os
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import textwrap
import time
import traceback
from multiprocessing import Process
from typing import Dict, List
from common.basedir import BASEDIR
from common.spinner imp... |
game.py | import json
import threading
import time
from common.game_logic import GameLogic
class Game:
def __init__(self, admin_user, identity, name):
self.ticks = 0
self.players = []
self.started = False
self.running = False
self.stopped = False
self.add_player(admin_user)... |
server.py | import logging
import os
import threading
import time
import traceback
import webbrowser
from argparse import ArgumentParser
from pathlib import Path
from urllib.request import urlopen
from flask import Flask, json, jsonify, request, send_from_directory
from flask_cors import CORS
import handlers
__doc__ = """
A Fla... |
wshygiene.py | # -*- coding: utf-8 -*-
# wah wah wah
# SyntaxError: from __future__ imports must occur at the beginning of the file
from __future__ import print_function
#import sys
# deal with print function
#if sys.version_info[0] < 3:
from rdflib import ConjunctiveGraph, URIRef, BNode, Literal, RDF, RDFS, OWL, XSD
from rdflib.n... |
SerialDataGateway.py | #!/usr/bin/env python
'''
Created on November 20, 2010
@author: Dr. Rainer Hessmer
'''
import threading
import serial
from cStringIO import StringIO
import time
import rospy
def _OnLineReceived(line):
print(line)
class SerialDataGateway(object):
'''
Helper class for receiving lines from a serial port
'''
def ... |
test_error.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... |
streambox.py | #!/usr/bin/python3
#
# Installation
# pip3 install keyboard python-vlc matplotlib certifi humanize pyautogui
# References
# https://git.videolan.org/?p=vlc/bindings/python.git;a=blob;f=examples/play_buffer.py;h=23a52f96b5367531838c28079d6263b69cab0ca9;hb=HEAD
# API documentation: https://www.olivieraubert.net/vlc/pyth... |
relay_integration.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 u... |
test_sync.py | # test_sync.py
#
# Different test scenarios designed to run under management of a kernel
from collections import deque
from curio import *
import pytest
import threading
import time
import asyncio
# ---- Synchronization primitives
class TestEvent:
def test_event_get_wait(self, kernel):
results = []
... |
LTJRead.py | #/usr/bin/env python
# -*- coding: UTF-8 -*-
from bs4 import BeautifulSoup
import urllib2
import os
from threading import Thread
def get_html(main_url):
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = {'User-Agent': user_agent}
req = urllib2.Request(main_url, headers=headers)
... |
option.py | #!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import binascii
import cookielib
import glob
import inspect
import logging
import httplib
import os
import random
import re
import socket
import string
import sys
import tempf... |
subscribe_io.py | __all__ = ['FlexibleDistribute', 'pop_subs_to_admin', 'detach']
import threading
from uuid import uuid4
from BusinessCentralLayer.middleware.flow_io import FlowTransferStation
from BusinessCentralLayer.middleware.redis_io import RedisClient
from BusinessCentralLayer.middleware.work_io import Middleware
from BusinessC... |
run-with-video.py | # import the necessary packages
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
from imutils.video import VideoStream
import numpy as np
import imutils
import cv2
import os
from playsound... |
filewatcher.py | #####################################################################
# #
# filewatcher.py #
# #
# Copyright 2013, Monash University ... |
launcher.py | #!/usr/bin/env python3
"""
- Initiates the LED visuals
- Installs new requirements as part of an update
(if needed, might want to have a seprate process for this)
- Checks for connection to server,
- If no connection is found then LED indication is set.
- Pulls configuration files from server.
- Launches main program... |
start_sploit.py | #!/usr/bin/env python3
import argparse
import binascii
import itertools
import json
import logging
import os
import random
import re
import stat
import subprocess
import sys
import time
import threading
from concurrent.futures import ThreadPoolExecutor
from enum import Enum
from math import ceil
from urllib.parse impo... |
multiprocess.py | import multiprocessing
import Tkinter as tk
import cv2
import sys
import os
import time
from PIL import Image
import glob
cascPath = 'haarcascade_frontalface_default.xml'
faceCascade = cv2.CascadeClassifier(cascPath)
baseDir = '/home/aishwarya/Documents/Smart-Mirror-Project/'
e = multiprocessing.Event()
p = None
#... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
fast_port_scan.py | import argparse
import socket # for connecting
from colorama import init, Fore
from threading import Thread, Lock
from queue import Queue
# some colors
init()
GREEN = Fore.GREEN
RESET = Fore.RESET
GRAY = Fore.LIGHTBLACK_EX
host = 5003
# number of threads, feel free to tune this parameter as you wish
N_THREADS = 200
#... |
rewind.py | import logging
import os
import shlex
import six
import subprocess
from threading import Lock, Thread
from .connection import get_connection_cursor
from .misc import format_lsn, parse_history, parse_lsn
from ..async_executor import CriticalTask
from ..dcs import Leader
logger = logging.getLogger(__name__)
REWIND_ST... |
store_warmup_binance_spot.py | import threading
import time
import traceback
import ccxt
class StoreWarpupBinanceSpot:
def __init__(self, store=None, logger=None, min_interval=None):
self.store = store
self.logger = logger
self.min_interval = min_interval
def start(self):
self.thread = threading.Thread(targe... |
testrunner.py | #!/usr/bin/env python3
import base64
import gzip
from http.client import BadStatusLine
import os
import urllib.request, urllib.error, urllib.parse
import sys
import threading
from os.path import basename, splitext
from multiprocessing import Process
from pprint import pprint
sys.path = ["lib", "pytests", "pysystests"]... |
webserver.py | #!/usr/bin/env python
import os
import base64
from urllib.parse import urlencode
import flask
import requests
from pte import settings
from pte.gcal.access import set_refresh_token
app = flask.Flask(__name__)
state = None
@app.route("/")
def index():
global state
state = base64.b64encode(os.urandom(12)).dec... |
zeromq.py | # -*- coding: utf-8 -*-
'''
Zeromq transport classes
'''
# Import Python Libs
from __future__ import absolute_import
import os
import copy
import errno
import hashlib
import logging
import weakref
from random import randint
# Import Salt Libs
import salt.auth
import salt.crypt
import salt.utils
import salt.utils.veri... |
xssmap.py | #!/usr/bin/env python3
# coding=utf-8
# Author: Jewel591
from data import payloads, test_result
from lib import connect
from lib import format, lists
from lib import output
from lib.output import get_time
from lib import encoding
import random
import string
import re
import os
import signal
import sys
import threading... |
stage.py | from threading import Thread
from pygame.locals import QUIT, MOUSEBUTTONDOWN, MOUSEBUTTONUP, MOUSEMOTION, KEYDOWN
import pygame as pg
import os
from . import screen
WHITE = (255, 255, 255) # unbeaten
GRAY = (211, 211, 211) # beaten
TEAL = (0, 128, 128) # peaceful
YELLOW = (128, 128, 0)
BLACK = (0, 0, 0)
STAGE_SI... |
s3op.py | from __future__ import print_function
import json
import time
import math
import sys
import os
import traceback
from functools import partial
from hashlib import sha1
from tempfile import NamedTemporaryFile
from multiprocessing import Process, Queue
from itertools import starmap, chain, islice
from boto3.s3.transfer ... |
request_historical_data.py |
# Copyright (C) 2019 LYNX B.V. All rights reserved.
# Import ibapi deps
from ibapi import wrapper
from ibapi.client import EClient
from ibapi.common import *
from ibapi.contract import *
from threading import Thread
from datetime import datetime
from datetime import timedelta
from time import sleep
import pandas a... |
test_executor.py | # Copyright 2017 Open Source Robotics Foundation, 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... |
runner.py | import envoy
import requests
from multiprocessing import Process
import time
import server_config
SERVER = server_config.SERVER
def check_live(port):
live = False
print "Waiting "
while not live:
try:
resp = requests.get("http://%s:%d/ping" % (SERVER, port))
print resp
... |
orchestrator.py | from multiprocessing import Process, Pipe
from multiprocessing.spawn import freeze_support
import detector
import presenter
import streamer
import argparse
if __name__ == '__main__':
freeze_support()
ap = argparse.ArgumentParser()
ap.add_argument("-v", "--video", help="path to the video file")
args = ... |
test_eap_proto.py | # EAP protocol tests
# Copyright (c) 2014-2015, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import binascii
import hashlib
import hmac
import logging
logger = logging.getLogger()
import os
import select
import struct
import threading
i... |
test_context.py | # Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
test_client.py | from multiprocessing import Process, cpu_count
from app.client import Client
def test_client(start_time, end_time, resolution, tmpdir, timeout, correct_hash):
path = tmpdir.mkdir('test')
client = Client(
path=path,
num_processes=max(cpu_count() - 1, 1),
start_time=start_time.isoforma... |
base.py | import multiprocessing as mp
import threading as td
def job(a, b):
print('%d + %d = %d' % (a, b, a + b))
def main():
# t1 = td.Thread(target=job, args=(1, 2))
# t1.start()
p1 = mp.Process(target=job, args=(1, 2))
p1.start()
if __name__ == '__main__':
main()
|
tests.py | # Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import copy
import io
import os
import pickle
import re
import shutil
import sys
import tempfile
import threading
import time
import unittest
import warnings
from pathlib import Path
from unittest import mock, skipIf
from ... |
test_mongo_core.py | """Testing the MongoDB core of cachier."""
from __future__ import print_function
import sys
import datetime
from datetime import timedelta
from random import random
from time import sleep
import threading
try:
import queue
except ImportError: # python 2
import Queue as queue
import pytest
import pymongo
from... |
server.py | # -*- coding:utf-8 -*-
"""
* Copyright@2016 Jingtum Inc. or 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
*
* Un... |
manager.py | #!/usr/bin/env python3.7
import os
import sys
import fcntl
import errno
import signal
import subprocess
import datetime
from common.spinner import Spinner
from common.basedir import BASEDIR
sys.path.append(os.path.join(BASEDIR, "pyextra"))
os.environ['BASEDIR'] = BASEDIR
def unblock_stdout():
# get a non-blocking s... |
run-server.py | import multiprocessing as mp
import socket
import subprocess
import sys
import time
# While we could use something like requests (or any other 3rd-party module),
# this script aims to work with the default Python 3.6+.
CLEAR = "\033[39m"
MAGENTA = "\033[95m"
BLUE = "\033[94m"
def kill_process(name, process):
if... |
Process.py | import os
import sys
from pywps import WPS, OWS, E
from pywps.app.WPSResponse import WPSResponse
from pywps.exceptions import StorageNotSupported, OperationNotSupported
import pywps.configuration as config
import traceback
class Process(object):
"""
:param handler: A callable that gets invoked for each incomi... |
builder.py | # Copyright 2018 DeepMind Technologies Limited. 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 ... |
main.py | import logging
import logging.handlers
import signal
import threading
from curses import window, wrapper # type: ignore
from functools import partial
from tg import config, update_handlers, utils
from tg.controllers import Controller
from tg.models import Model
from tg.tdlib import Tdlib
from tg.views import ChatView... |
main.py | # the unblockme.py was implemented from https://github.com/KentZuntov/Unblock-Me
# the whackamole.py was implemented from https://github.com/sonlexqt/whack-a-mole
# the spaceinvaders.py was implemented from https://github.com/leerob/space-invaders
# the rpsgame.py was implemented from https://github.com/seekpl/rps-game... |
main.py | import tkinter as tk
from tkinter.ttk import *
import threading
import wget
import os
from functools import partial
from Animations import Header_Menu_Animation
from Backend import Feature_Set_Backend, Download_Backend, Device_Download_Backend, Build_Download_Backend
app = tk.Tk()
app.geometry('600x400')
app.resizable... |
session_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... |
sidechain_interaction.py | #!/usr/bin/env python3
"""
Script to test and debug sidechains.
The mainchain exe location can be set through the command line or
the environment variable RIPPLED_MAINCHAIN_EXE
The sidechain exe location can be set through the command line or
the environment variable RIPPLED_SIDECHAIN_EXE
The configs_dir (generated ... |
key_remapper.py | #!/usr/bin/python3
import argparse
import collections
import fcntl
import os
import random
import re
import sys
import threading
import traceback
from typing import Optional, Dict, List, TextIO, Tuple, Union, Iterable, Callable
import evdev
import gi
import notify2
import pyudev
from evdev import UInput, ecodes as e, ... |
IntegrationTests.py | from __future__ import absolute_import
import os
import multiprocessing
import time
import unittest
import percy
import threading
import platform
import flask
import requests
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
class IntegrationTests(unittest.TestCase):
@classmet... |
cothread.py | # cothread.py
#
# A thread object that runs a coroutine inside it. Messages get sent
# via a Queue object
from threading import Thread
from queue import Queue
from coroutine import *
@coroutine
def threaded(target):
messages = Queue()
def run_target():
while True:
item = messages.get()
... |
flask_gunicorn_embed.py | from flask import Flask, render_template
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from bokeh.application import Application
from bokeh.application.handlers import FunctionHandler
from bokeh.embed import server_document
from bokeh.layouts import column
from bokeh.models import Column... |
mirrorcast_server_pi.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Mirrorcast Server for Raspberry Pi.
#Please use python3 and not 2.7, 2.7 will cause problems
#Mirrorcast Server Version 0.7.5b
import socket,subprocess,time,logging, threading, os, datetime
from omx import Omx
logging.basicConfig(filename='/var/log/mirrorcast_server.log'... |
ib_gateway.py | """
IB Symbol Rules
SPY-USD-STK SMART
EUR-USD-CASH IDEALPRO
XAUUSD-USD-CMDTY SMART
ES-202002-USD-FUT GLOBEX
SI-202006-1000-USD-FUT NYMEX
ES-2020006-C-2430-50-USD-FOP GLOBEX
"""
from copy import copy
from datetime import datetime, timedelta
from threading import Thread, Condition
from typing import Optional, D... |
common.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2018-present mundialis GmbH & Co. KG
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
... |
lock.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""These tests ensure that our lock works correctly.
This can be run in two ways.
First, it can be run as a node-local t... |
datastream.py | # ----------------------------------------------------------------------
# Datastream endpoint
# ----------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Python m... |
virtual_mirror_node.py | #!/usr/bin/env python
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import CompressedImage, Image
from duckietown_msgs_atacchet.msg import HorzVert
import rospy
import cv2
import io
import numpy as np
import threading
class VirtualMirrorNode(object):
def __init__(self):
self.node_name = "Virtua... |
notice_client.py | # -*- coding: utf-8 -*-
import time
import random
import threading
from gevent.queue import JoinableQueue
from inner_lib.func_ext import get_md5, http_request, message_format, singleton
from conf.config import MAXSIZE
@singleton
class NoticeClient(object):
init_flag = False
def __init__(self, app_key, app_... |
jobs.py | # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
import errno
from threading import BoundedSemaphore, Event, Thread
from pex.compatibility import Queue, cpu_count
from pex.tracer import TRACER
c... |
learn1.py | #!/usr/bin/python3
import io
import csv
import json
import warnings
import pickle
import operator
import time
import logging
import math
import functools
import numpy
from sklearn.preprocessing import MinMaxScaler
from threading import Thread
from random import shuffle
from sklearn.neural_network import MLPClassifier
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.