source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
binance_futures_websocket.py | # coding: UTF-8
import hashlib
import hmac
import json
import os
import threading
import time
import traceback
import urllib
import websocket
from datetime import datetime
from pytz import UTC
from src import logger, to_data_frame, notify
from src.config import config as conf
from src.exchange.binance_futures.binance... |
killing_processes.py | import multiprocessing
import time
def foo():
print('Starting function')
for i in range(0, 10):
print('-->%d\n' % i)
time.sleep(1)
print('Finished function')
if __name__ == '__main__':
p = multiprocessing.Process(target=foo)
print('Process before execution:', p, p.is_alive())
... |
notificator.py | # in case python2
from __future__ import print_function
import os
import threading
import yaml
from .notification import MailNotification, SlackNotification, TwitterNotification
class Notificator:
def __init__(self, secrets="~/.secrets/notificator_secrets.yaml", suppress_err=True):
"""
secrets: path to your se... |
demo_enip.py | # -*- coding: utf-8 -*-
# @Time : 2018/9/6 下午2:13
# @Author : shijie luan
# @Email : lsjfy0411@163.com
# @File : demo_protocol.py
# @Software: PyCharm
'''
本模块主要是为了和10个协议的仿真接轨,可以复用数据库模块、server模块、分类模块
鉴于FANUC蜜罐已经实现了各模块,所以此模块改动前可参照上述提到的几个模块
基本思路:
1.筛选10个协议:需要 请求(最好是nmap脚本的,没有也可以标明功能)—— 应答对
2.数据库存储:id-请... |
client.py | import socket
import threading
from threading import Thread
from colored import fg, bg, attr
color1 = fg('green')
color2 = fg('red')
color3 = fg('yellow')
reset = attr('reset')
try:
file1 = open('client-header.txt', 'r')
print(' ')
print (color3 + file1.read() + reset)
file1.close()
except IOError:
print('\nBann... |
build.py | ## @file
# build a platform or a module
#
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR>
#
# This program and the accompanying materials
# are... |
process.py | import os
import multiprocessing as mp
import resource
import time
from ctypes import *
__all__ = ['Manager']
class Manager:
def __init__(self, tab, fun):
self.name = self
self.tab = tab
self.fun = fun
self.n = mp.cpu_count()//2
def Mes(self,q):
start=time.ti... |
watcher.py | import redis
import time
import json
import threading
import logging
from pprint import pprint
class PlayQueueWatcher:
def __init__(self, host, port, password=None, debug=False, wait=5):
"""
:param host:
:param port:
:param password:
:param debug:
:param wait:
... |
monitor.py | # Copyright 2018 Microsoft 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... |
dodge.py |
# By Al Sweigart al@inventwithpython.com
# This program is a demo for the Pygcurse module.
# Simplified BSD License, Copyright 2011 Al Sweigart
import pygame, random, sys, time, pygcurse
from pygame.locals import *
import LED_display as TLD
import HC_SR04 as RS
import random
import threading
import keyboard
#import... |
PlainTasks.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sublime, sublime_plugin
import os
import re
import webbrowser
import itertools
import threading
from datetime import datetime, tzinfo, timedelta
import time
import logging, sys # [HKC] For debugging
logging.basicConfig(format='\n\n----\n%(levelname)-8s| %(message)s', ... |
local.py | import threading
import time
import types
import typing
from concurrent.futures.thread import ThreadPoolExecutor
from . import base
from ..exceptions import LovageRemoteException
class LocalBackend(base.Backend):
def __init__(self):
self._executor = LocalExecutor()
def new_task(self, serializer: bas... |
dagucar.py | # Wrapping the Adafruit API to talk to DC motors with a simpler interface
#
# date: 11/17/2015
#
# authors: Valerio Varricchio <valerio@mit.edu>
# Luca Carlone <lcarlone@mit.edu>
#
# ~~~~~ IMPORTANT !!! ~~~~~
#
# Make sure that the front motor is connected in such a way that a positive
# speed causes an i... |
store.py | from os import unlink, path, mkdir
import json
import uuid as uuid_builder
from threading import Lock
from copy import deepcopy
import logging
import time
import threading
import os
# Is there an existing library to ensure some data store (JSON etc) is in sync with CRUD methods?
# Open a github issue if you know some... |
housekeeper.py | """
Keeps data up to date
"""
import logging, os, time, requests
from multiprocessing import Process
from sqlalchemy.ext.automap import automap_base
import sqlalchemy as s
import pandas as pd
from sqlalchemy import MetaData
logging.basicConfig(filename='housekeeper.log')
class Housekeeper:
def __init__(self, jobs... |
keygen.py | # coding:utf-8
import Tkinter as tk
from ScrolledText import ScrolledText
import threading
import hashlib
from random import randint
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.pack()
self.createWidgets()
def __del__(self):
... |
miniterm3.py | #!/usr/bin/env python
# Very simple serial terminal
# (C)2002-2004 Chris Liechti <cliecht@gmx.net>
# Input characters are sent directly (only LF -> CR/LF/CRLF translation is
# done), received characters are displayed as is (or as trough pythons
# repr, useful for debug purposes)
# Baudrate and echo configuart... |
multiprocess_detect_actions.py | import numpy as np
import cv2
import imageio
#import tensorflow as tf
import json
import os
import sys
import argparse
import object_detection.object_detector as obj
import action_detection.action_detector as act
from multiprocessing import Process, Queue
from queue import Empty
import socket
import struct
import t... |
bouncing_ball_v2.py | import pygame
import threading
from empty_display import EmptyDisplay
import lib.colors as Color
WIDTH = 0
HEIGHT = 1
class Ball(pygame.sprite.Sprite):
def __init__(self,
color,
width,
height,
initial_x_coordinate,
initial_y_coo... |
_optimize.py | from concurrent.futures import FIRST_COMPLETED
from concurrent.futures import Future
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import wait
import copy
import datetime
import gc
import itertools
import math
import os
import sys
from threading import Event
from threading import Thread
from... |
functional.py | import argparse
import time
import uuid
from multiprocessing import Process, Queue
from unittest import mock
from django_sql_sniffer import listener
def test_end_2_end():
query_queue = Queue()
# define dummy method which will utilize Django DB cursor in the target process
def dummy_query_executor():
... |
dnstransfer.py | import os
import re
import threading
import lib.common
import lib.urlentity
MODULE_NAME = 'dnstransfer'
global dns_transfer_is_vul
def init():
global dns_transfer_is_vul
dns_transfer_is_vul = False
def transfer_try(domain, dns):
global dns_transfer_is_vul
subdomain = os.popen("dig @%s %s axfr" % ... |
test_marathon.py | import contextlib
import json
import os
import re
import sys
import threading
import pytest
from six.moves.BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from dcos import constants
from .common import (app, assert_command, assert_lines,
exec_command, list_deployments, popen_tty,
... |
util.py | import os
import tzlocal
from datetime import datetime
import logging
import time
from contextlib import contextmanager
import logging
log = logging.getLogger(__name__)
# https://stackoverflow.com/a/47087513/165783
def next_path(path_pattern):
"""
Finds the next free path in an sequentially named list of file... |
scripts_regression_tests.py | #!/usr/bin/env python
"""
Script containing CIME python regression test suite. This suite should be run
to confirm overall CIME correctness.
"""
import glob, os, re, shutil, signal, sys, tempfile, \
threading, time, logging, unittest, getpass, \
filecmp, time
from xml.etree.ElementTree import ParseError
LIB... |
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... |
grpc.py | """
Utilities for running GRPC services: compile protobuf, patch legacy versions, etc
"""
from __future__ import annotations
import os
import threading
from typing import Any, Dict, Iterable, Iterator, NamedTuple, Optional, Tuple, Type, TypeVar, Union
import grpc
from hivemind.proto import runtime_pb2
from hivemind... |
demoprocess.py | # 作者:甜咖啡
# 新建时间:2021/4/11 22:11
from multiprocessing import Process
def demo1(name):
print('执行自定义函数的参数:', name)
if __name__ == '__main__':
p = Process(target=demo1, args=('123',))
p.start()
p.join()
print(p.name)
print('主进程执行完成')
|
learner.py | from typing import Tuple
import glob
import os
import shutil
import signal
import threading
import time
from collections import OrderedDict, deque
from os.path import join
from queue import Empty, Queue, Full
from threading import Thread
import numpy as np
import psutil
import torch
# from torch.nn.utils.rnn import Pa... |
bkup_runOnLinux.py | #!/usr/bin/env python
"""This script is used by ../../runOnLinux
- THIS IS A BACKUP FILE FOR THE manual sput and sput -b
This is not used anymore
"""
import threading
import warnings
import re
from test_gfe_unittest import *
class BaseGfeForLinux(BaseGfeTest):
def read_uart_out_until_stop (self,run_event,stop_ev... |
upnp.py | import logging
import threading
from queue import Queue
from typing import Optional
try:
import miniupnpc
except ImportError:
pass
log = logging.getLogger(__name__)
class UPnP:
thread: Optional[threading.Thread] = None
queue: Queue = Queue()
def __init__(self):
def run():
t... |
ex6.py | import os
import threading,time
l=[]
i=0
while i<3:
x=input("enter the ip address=")
l.append(x)
i=i+1
def ping(ip):
os.system("ping "+ip)
i=0
while i<len(l):
# if threading.activecount()<len(l):
t=threading.Thread(target=ping,args=(l[i],))
t.start()
... |
zz_reload_default_package.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import sublime
import sublime_plugin
import os
import sys
import shutil
import json
import time
import filecmp
import hashlib
import textwrap
import traceback
import threading
from collections import OrderedDict
skip_packing = False
_lock = thread... |
get_Position_priodicaly.py | #!/usr/bin/python3
# C:\Work\Python\HID_Util\src\get_Position_priodicaly.py
# based on: get_FW_version.py
# date: 28-08-21
from binascii import hexlify
import sys
import argparse
import threading
from time import perf_counter as timer
from time import sleep
# NOTE: about include_dll_path for __init__.py ... |
benchmark_persistent_actor.py | #!/usr/bin/env python3
"""Benchmark for rays ownership system.
Based on https://github.com/stephanie-wang/ownership-nsdi2021-artifact/\
blob/main/recovery-microbenchmark/reconstruction.py
"""
import abc
import argparse
import csv
import numpy as np
import os
import os.path
import time
from queue import SimpleQueue a... |
stonks.py | import asyncio
import datetime
import io
import json
import os
from os import path
import threading
import time
import matplotlib.pyplot as plt
import numpy as np
import schedule
import discord
from discord.ext import commands
LOAD_STORE = threading.Lock()
def load(uid):
if path.exists(f"data/stonks/{uid}"):... |
screenshot.py | #!/usr/bin/env python
# @license
# Copyright 2020 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 applicab... |
_queue_writer.py | import multiprocessing
import queue
import threading
from typing import Generic, Optional, Tuple
import torch
from pytorch_pfn_extras.writing._writer_base import (
Writer, _TargetType, _SaveFun, _TaskFun, _Worker, _FileSystem,
)
from pytorch_pfn_extras.writing._simple_writer import SimpleWriter
_QueUnit = Optio... |
server.py | import socket
import threading
from time import sleep
import colorgb
class Server:
"""A class that implements the server side.
-----------
Parameters :
- ip: :class:`localhost/127.0.0.1` | you cannot change server ip because server ip always use localhost.
- port: :class:`int` | The server port.
... |
scheduler.py | import time
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timedelta
from multiprocessing import Queue, Process
from threading import Thread
import schedule
from scylla.config import get_config
from scylla.database import ProxyIP
from scylla.jobs import validate_proxy_ip
from scylla.... |
phone_util.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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
randomHotBaronClick.py | from random import choice
from time import sleep
from win32api import keybd_event, GetAsyncKeyState
from win32con import KEYEVENTF_KEYUP
from tkinter import StringVar, Button,Label,Entry,Tk,DoubleVar
from queue import Queue
from threading import Thread
from os import path
import json
root = Tk()
FileGUI=StringVar()
t... |
main.py | import logging
from datetime import datetime
from functools import partial
from multiprocessing import Process, Queue
from time import time
from typing import List, Tuple
from asciimatics.effects import Print
from asciimatics.event import Event, KeyboardEvent
from asciimatics.exceptions import ResizeScreenError, StopA... |
utils.py | """Utilities shared by tests."""
import collections
import contextlib
import io
import logging
import os
import re
import selectors
import socket
import socketserver
import sys
import tempfile
import threading
import time
import unittest
import weakref
from unittest import mock
from http.server import HTTPServer
fro... |
Tamura.py | import numpy as np
from util import Util as u
import cv2
from threading import Thread, Lock, Event
from queue import Queue
import time
class TamFeat(object):
q = Queue(maxsize=4)
def __init__(self, img):
t = time.time()
(self.__coarseness, varCrs) = self.__generateCoarseness(img)
prin... |
pixrc.py | #!/usr/bin/env python
import ConfigParser
import datetime
import errno
import logd
import logging
import logging.config
import optparse
import os
import serial
import simple_stats
import socket
import struct
import sys
import threading
import time
logging.config.fileConfig("/etc/sololink.conf")
logger = logging.getL... |
utils.py | import gc
import json
import string
import orjson
import torch
import pickle
import shutil
import time
from tqdm import tqdm
import multiprocessing
from pathlib import Path
from termcolor import colored
from functools import lru_cache
from nltk.stem.snowball import SnowballStemmer
PUNCS = set(string.punctuation) - {'-... |
coap.py | import logging.config
import os
import random
import socket
import threading
import time
from coapthon import defines
from coapthon.layers.blocklayer import BlockLayer
from coapthon.layers.messagelayer import MessageLayer
from coapthon.layers.observelayer import ObserveLayer
from coapthon.layers.requestlayer import Re... |
http.py | # -*- coding: utf-8 -*-
"""
This module contains some helpers to deal with the real http
world.
"""
import threading
import logging
import select
import socket
import time
import os
import six
import webob
from six.moves import http_client
from waitress.server import TcpWSGIServer
def get_free_port():
s = socke... |
search.py | # -*- coding: utf-8 -*-
"""
chemspipy.search
~~~~~~~~~~~~~~~~
A wrapper for asynchronous search requests.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import datetime
import logging
import threading
import time
from six.moves import range
from . ... |
main.py | import requests
import threading
import time
import random
from contextlib import contextmanager
import logging
class Crawler:
""" Requests urls in chunks and then calls the processor func to process the chunk of responses...
This is done so that the processor func does not have to worry about writing to the ... |
test_client.py | from __future__ import annotations
import asyncio
import functools
import gc
import inspect
import logging
import os
import pickle
import random
import subprocess
import sys
import threading
import traceback
import types
import warnings
import weakref
import zipfile
from collections import deque
from collections.abc i... |
SQLiPy.py | """
Name: SQLiPy
Version: 0.1
Date: 9/3/2015
Author: Josh Berry - josh.berry@codewatch.org
Github: https://github.com/codewatchorg/sqlipy
Description: This plugin leverages the SQLMap API to initiate SQLMap scans against the target.
This plugin requires the beta version o... |
app.py | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import os, sys
from soundspider import SoundSpider
from time import sleep
import threading
class Handler:
def onDestroy(self, *args):
try:
download_thread._stop()
except:
pass
Gtk.main_quit()
def onToggleDownload(self, button):
s... |
bench_req_rep_raw.py | import time
from multiprocessing import Process
from nanoservice import Service, Client
import util
def start_service(addr, n):
""" Start a service """
s = Service(addr)
started = time.time()
for _ in range(n):
msg = s.socket.recv()
s.socket.send(msg)
s.socket.close()
duratio... |
httpclient_test.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import base64
import binascii
from contextlib import closing
import copy
import functools
import sys
import threading
import datetime
from io import BytesIO
from tornado.escape import utf8, native_str
from tornado import gen
from ... |
fake_request.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from core.brain.main import Brain
from core.listen import listen
from core.config.settings import logger
from threading import Timer
from output import say
import sys
from multiprocessing import Process, Queue, Pipe
def testing_jabber():
"""docstring for testing_jabb... |
EasyNMT.py | import os
import torch
from .util import http_get, import_from_string, fullname
import json
from . import __DOWNLOAD_SERVER__
from typing import List, Union, Dict, FrozenSet, Set, Iterable
import numpy as np
import tqdm
import nltk
import torch.multiprocessing as mp
import queue
import math
import re
impor... |
servers.py | # Copyright 2014 The Oppia 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 applicable ... |
extract.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
" Extract 10000 episodes from SC2 "
__author__ = "Ruo-Ze Liu"
debug = True
USED_DEVICES = "-1"
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES
imp... |
SimulatedDevice.py | # Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
import random
import time
import threading
# Using the Python Device SDK for IoT Hub:
# https://github.com/Azure/azure-iot-sdk-python
# The sample connects to a device... |
proxy_test.py | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
test_postgresql.py | import mock # for the mock.call method, importing it without a namespace breaks python3
import os
import psutil
import psycopg2
import re
import subprocess
import time
from mock import Mock, MagicMock, PropertyMock, patch, mock_open
from patroni.async_executor import CriticalTask
from patroni.dcs import Cluster, Clus... |
engine.py | """
所有的gateway都放在self.gateways字典里面,对应vnpy UI界面的连接菜单的内容。
Subscribe逻辑:
1.add_gateway生成一个self.gateways字典
2.调用get_gateway函数取出CtpGateway实例
3.调用CtpGateway实例的subscribe函数
4.底层API通过sambol,exchange的形式subscribe
"""
import logging
import smtplib
import os
from abc import ABC
from datetime import datetime
from email.message impor... |
test_fetcher.py | import tempfile
import os.path as op
import sys
import os
import numpy.testing as npt
from nibabel.tmpdirs import TemporaryDirectory
import dipy.data.fetcher as fetcher
from dipy.data import SPHERE_FILES
from threading import Thread
if sys.version_info[0] < 3:
from SimpleHTTPServer import SimpleHTTPRequestHandler ... |
connections.py | import socket
import queue
import threading
import logging
import binascii
from abc import ABC, abstractmethod
from udsoncan.Request import Request
from udsoncan.Response import Response
from udsoncan.exceptions import TimeoutException
class BaseConnection(ABC):
def __init__(self, name=None):
if nam... |
ydl.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from flask_restful import Resource, fields, marshal, reqparse, inputs
from auth import basic_auth
import os
import shutil
import tempfile
import youtube_dl
from pathlib import Path
from os import listdir, stat
from os.path import isfile, join, relpath, d... |
user.py | from util.util import *
from flask import Blueprint
user_bp = Blueprint('user_bp', __name__)
@user_bp.route('/home')
def home():
return getUUID()
@user_bp.route('/register', methods=["POST"])
def user_register():
try:
client_id = request.json["client_id"]
key = request.json["api_key"]
... |
httpd.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2019 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import datetime
import glob
import gzip
import hashlib
import io
import json
import mimetypes
import os
import re
import... |
AVR_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Python AVR Miner (v2.2)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
import socket, threading, time, re, subprocess, configparser, sys... |
__init__.py | from __future__ import print_function
from builtins import input
import sys
import time
import cancat
import struct
import threading
import cancat.iso_tp as cisotp
# In 11-bit CAN, an OBD2 tester typically sends requests with an ID of 7DF, and
# can accept response messages on IDs 7E8 to 7EF, requests to a specific ... |
Task.py | import time
from tqdm import tqdm
from .common import npu_print, NEURO_AI_STR, get_response, get
from .web.urls import TASK_STATUS_URL
from threading import Thread
FAILURE = "FAILURE"
PENDING = "PENDING"
COMPLETE = "COMPLETE"
STOPPED = "STOPPED"
TASK_DONE_LIST = (FAILURE, COMPLETE, STOPPED)
bar_suffix = NEURO_AI_S... |
webfrontend.py | from flask import Flask
from flask import request, send_file, render_template, send_from_directory
import json
import coding
import time
from server_config import SERVER
import keyfilelib
from multiprocessing import Pipe
from threading import Thread
from Queue import Queue
from werkzeug import secure_filename
from cStr... |
test.py | # -*- coding: utf-8 -*-
import redis
import unittest
from hotels import hotels
import random
import time
from RLTest import Env
from includes import *
def testAdd(env):
if env.is_cluster():
raise unittest.SkipTest()
r = env
env.assertOk(r.execute_command(
'ft.create', 'idx', 'schema', 'ti... |
test_aea.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 ... |
director.py | # packages
import os
import sys
import json
import time
import requests
import datetime
import argparse
import sseclient
import numpy as np
import multiprocessing as mpr
# plotting
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import cm
from matplotlib.colors import Normalize
... |
main.py | #coding:utf-8
import time
import threading
from html_downLoader import HtmlDownLoader
import ParseAlexa
SLEEP_TIME=1
def threaded_crawler(alexaCallback,max_threads=10):
threads=[]
result={}
crawl_queue=alexaCallback("http://s3.amazonaws.com/alexa-static/top-1m.csv.zip")
dlownloader=HtmlDownLoader()
... |
cancel_query.py | from django.test import TestCase
from unittest2 import skipIf
from django.db import connection
from time import sleep
from multiprocessing import Process
import json
import re
import os
from sqlshare_rest.util.db import get_backend, is_mssql, is_mysql, is_sqlite3, is_pg
from sqlshare_rest.dao.query import create_query
... |
kernel.py | """Hooks for Jupyter Xonsh Kernel."""
import datetime
import errno
import hashlib
import hmac
import json
import sys
import threading
import uuid
from argparse import ArgumentParser
from collections.abc import Set
from pprint import pformat
import zmq
from xonsh import __version__ as version
from xonsh.built_ins impor... |
test_diskfile.py | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... |
__init__.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... |
manual_ctrl.py | #!/usr/bin/env python3
# set up wheel
import os, struct, array
from fcntl import ioctl
# Iterate over the joystick devices.
print('Available devices:')
for fn in os.listdir('/dev/input'):
if fn.startswith('js'):
print(' /dev/input/%s' % (fn))
# We'll store the states here.
axis_states = {}
button_states ... |
Master.py | import os
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import _thread
import threading
import cProfile, pstats, io
#from pstats import SortKey
from common import *
from test_images import image
from test_videos import video
from calibration import load_calib
class ma... |
application.py | """Main execution body for program. Contains GUI interface and exporting class that creates files instead
of generating HTML Reports
Author: Alastair Chin
Last Updated: 28/02/2017
"""
import argparse
import webbrowser
import textwrap
import xlrd
from tkinter import *
from tkinter import filedialog, ttk
from threading... |
Osu to code.py | import sys
import subprocess
import pygame
import time
import os
import shutil
import threading
import random
global codename
global name
global songsfolder
global songsfolder
global name
osufile = input("Osu file location? ")
osu = open(osufile, encoding="utf8")
osufolder = osufile.split("\\")[0... |
client.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009- Spyder Project Contributors
#
# Distributed under the terms of the MIT License
# (see spyder/__init__.py for details)
# --------------------------------------------------------------------... |
smsSender.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import random
import json
import os
import re
import time
import traceback
from messaging.sms import SmsDeliver
from messaging.sms import SmsSubmit
from Queue import Queue
import flask
app = flask.Flask(__name__)
if not app... |
rbssh.py | #!/usr/bin/env python
#
# rbssh.py -- A custom SSH client for use in Review Board.
#
# This is used as an ssh replacement that can be used across platforms with
# a custom .ssh directory. OpenSSH doesn't respect $HOME, instead reading
# /etc/passwd directly, which causes problems for us. Using rbssh, we can
# work arou... |
sparmap.py | """This module contains a simple parallel map implementation based on
the multiprocessing package. It allows the use of bounded functions
as processing functions, and maintains memory usage under control by
using bounded queues internally.
"""
from multiprocessing import Queue, Process
from collections import namedt... |
reducer.py | import os
import threading
from fedn.clients.reducer.control import ReducerControl
from fedn.clients.reducer.interfaces import ReducerInferenceInterface
from fedn.clients.reducer.restservice import ReducerRestService
from fedn.clients.reducer.state import ReducerStateToString
from fedn.common.security.certificatemanag... |
cbtogen.py | """
cbtogen
~~~~~~~
Simple thread-based code which can convert a call-back style data generation
pattern to a generator style pattern.
Sample use case is to consume data from `xml.sax.parse`. This function takes
a callback object to which all the parsed XML data is sent. By using the
classes in this module, we can ... |
usb_counter_fpga.py | #!/usr/bin/env python3
"""
USB mini counter based on FPGA
Collection of functions to simplify the integration of the USB counter in
Python scripts.
"""
import multiprocessing
import os
import time
from os.path import expanduser
from typing import Tuple
import numpy as np
import serial
import serial.tools.list_ports... |
test_fetcher.py | from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer
import base64
import os
import SocketServer
import threading
import urllib2
from nose.tools import ok_, eq_
from django.test import TestCase
from tardis.tardis_portal.fetcher import get_privileged_opener
class TestWebServer:
'''
Uti... |
demo2.py | """
2019/12/08 14:55
141.【Python多任务编程】join阻塞方法
"""
"""
父进程会等待子进程执行完毕后在退出:
如果在父进程中执行完所有代码后,还有子进程在执行,那么父进程会等待子进程执行完所有代码后再退出。
Process对象的join方法:
使用Process创建子进程,调用start方法后,父子进程会在各自的进程中不断的执行代码。
有时候如果想等待子进程执行完毕后再执行下面的代码,那么这时候调用join方法。
"""
from multiprocessing import Process
import time
def zhiliao():
print('===子进程开始=... |
main.py | import os
os.system('pip3 install -r requirements.txt')
from os import name,system
from random import choice
from colorama import init,Fore,Style
from threading import Thread,Lock,active_count
from sys import stdout
from time import sleep
from datetime import datetime
import requests
import json
import time
import str... |
network_heartbeat.py | """Network server heartbeat wrapper
Perl might be better for efficiency.
But we will use python for now.
Non-zero status means *this* failed, not the wrapped command.
"""
import argparse
import os
import shlex
import socket
import subprocess
import sys
import threading
import time
DESCRIPTION = """
We wrap a system ... |
ilustrado.py | """ This file implements the GA algorithm and acts as main(). """
# standard library
import multiprocessing as mp
import subprocess as sp
import logging
import glob
import shutil
import os
import time
import sys
from traceback import print_exc
from json import dumps, dump
from copy import deepcopy, copy
# external lib... |
client.py | import asyncio
import logging
import sys
import time
from threading import Thread, Event
from typing import Union, List, Tuple
from asyncio import Transport, Protocol
from bs4 import BeautifulSoup
import kik_unofficial.callbacks as callbacks
import kik_unofficial.datatypes.exceptions as exceptions
import kik_unofficia... |
main.py | from tkinter import Tk, Button, filedialog, messagebox, font
from threading import Thread
from utils import Recorder, BarWindow, display_img, ICON
# Animation for when rec_button is pressed
def press_rec(self):
if recorder.is_recording:
rec_btn.configure(image=stop_pressed)
else:
rec... |
test_writer.py | import os
import socket
import tempfile
import threading
import time
import mock
import msgpack
import pytest
from six.moves import BaseHTTPServer
from six.moves import socketserver
from ddtrace.constants import KEEP_SPANS_RATE_KEY
from ddtrace.internal.compat import PY3
from ddtrace.internal.compat import get_connec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.