source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
app.py | from urllib import request
import threading
import queue
import re
import os
import webbrowser
import sys
import subprocess
class pixiv:
def __init__(self):
self.folder = 'res'
self.web_coding = 'utf-8'
self.root = os.path.dirname(os.path.abspath(__file__))
self.DefaultHeader = {
... |
proxy_server.py | #!/usr/bin/env python
import socket
import multiprocessing
HOST = ""
PORT = 8001
BUFFER_SIZE = 1024
def handle_conn(conn, addr):
print("Connected by", addr)
with socket.create_connection(("www.google.com", 80)) as goog:
while True:
data = conn.recv(BUFFER_SIZE)
if not data:
... |
joy.py | """
Copyright 2020 Aircomm
SPDX-License-Identifier: MIT
Author: Giovanni Grieco <giovanni@grieco.dev>
"""
import collections
import time
import os
from threading import Thread
from scapy import sendrecv
from scapy.layers.inet import IP, UDP
from scapy.packet import Raw
"""
Importing SDL2 in Windows could lead to an... |
zmq_driver.py | # Copyright 2018 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
test_websocket_integration.py | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
detectortrainingdatabuffer.py | import argparse as argparse
import logging
from tempfile import TemporaryDirectory
from threading import Thread
import msgpack
import zmq
from dpu_utils.utils import RichPath, run_and_debug
from buglab.utils.logging import MetricProvider, configure_logging
from buglab.utils.msgpackutils import load_all_msgpack_l_gz
f... |
Coverage_DiscrepancyServer.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... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
locators.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
try:
import threading
except Imp... |
test.py | import unittest
import glob
import json
import os
import shutil
import time
from datetime import datetime
from threading import Thread
from subprocess import Popen, PIPE, check_output
from pathlib import Path
ROOT = Path(__file__).parent
SRC_DIR = ROOT / 'source'
TARGET_DIR = ROOT / 'target'
class Test(unittest.Test... |
portable_runner.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
shell.py | # Date: 06/05/2018
# Author: Pure-L0G1C
# Description: Recv/Send to master
import sys
import time
from queue import Queue
from threading import Thread, RLock
class Shell(object):
def __init__(self, sess_obj, interface):
self.interface = interface
self.keylogging = False
self... |
env.py | import argparse
import logging
import os
import sys
import random
import time
from datetime import datetime
import gym
from gym import spaces, logger
from gym.utils import seeding
import numpy as np
from droidbot import Device, App
from droidbot.rl.observation import Observation
from droidbot.rl.action import Action
fr... |
timer.py | # -*- coding:utf-8 -*-
# import gevent
# from gevent import monkey; monkey.patch_all()
import threading
import json
import os
import platform
import random
import time
from datetime import datetime, timedelta
import requests
from log import logger
class Timer(object):
def __init__(self, buy_time, sleep_interv... |
TServer.py | #!/usr/bin/env python
#
# Copyright (c) 2006- Facebook
# Distributed under the Thrift Software License
#
# See accompanying file LICENSE or visit the Thrift site at:
# http://developers.facebook.com/thrift/
import sys
import traceback
import threading
import Queue
from thrift.Thrift import TProcessor
from thrift.tran... |
reflector.py | # specifically use concurrent.futures for threadsafety
# asyncio Futures cannot be used across threads
from concurrent.futures import Future
from functools import partial
import json
import time
import threading
from traitlets.config import LoggingConfigurable
from traitlets import Any, Bool, Dict, Int, Unicode
from ... |
tf_resnet50_inference.py | # Copyright 2019 Xilinx 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_ibmq_job.py | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
threads.py | #!/usr/bin/env python3.8
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from logging import basicConfig, INFO, info
from queue import Queue, Empty
from threading import Lock, Thread, current_thread
from time import sleep
from .jobs import CPUBoundJob
class Service:
""" A service that operates usi... |
a3c.py | # -*- coding: utf-8 -*-
import tensorflow as tf
import threading
import numpy as np
import signal
import random
import math
import os
import time
from game_ac_network import GameACFFNetwork, GameACLSTMNetwork
from a3c_training_thread import A3CTrainingThread
from rmsprop_applier import RMSPropApplier
from constants ... |
DNSListener.py | import logging
import threading
import netifaces
import SocketServer
from dnslib import *
import ssl
import socket
from . import *
class DNSListener(object):
def taste(self, data, dport):
confidence = 1 if dport is 53 else 0
try:
d = DNSRecord.parse(data)
except:
... |
Kernel.py | import os
import socket
import struct
import ipaddress
import traceback
from socket import if_nametoindex
from threading import RLock, Thread
from abc import abstractmethod, ABCMeta
from pimdm import UnicastRouting, Main
from pimdm.rwlock.RWLock import RWLockWrite
from pimdm.tree import pim_globals
from mld.Interface... |
util.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# 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 rights t... |
mutefy.py | import os
import tkinter as tk
from tkinter import filedialog
import psutil
import pygetwindow as gw
import spotipy
import spotipy.util as util
import time
from pycaw.pycaw import AudioUtilities
from threading import Thread
import random
from pygame import mixer
username = 'Client Username Here'
cid = 'Client ID Here... |
test_pooling.py | # Copyright 2009-2010 10gen, 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,... |
tpu_estimator.py | # Copyright 2017 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... |
test_partition.py | from functools import reduce
from os import name
import threading
import pytest
from base.partition_wrapper import ApiPartitionWrapper
from base.client_base import TestcaseBase
from common import common_func as cf
from common import common_type as ct
from utils.util_log import test_log as log
from common.common_type i... |
sdk_worker.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
dining_savages.py | from threading import Semaphore, Thread
from itertools import chain
def savage(servings, mutex, pot, empty_pot):
while True:
mutex.acquire()
pot.pot_count -= 1
if pot.pot_count <= 0:
empty_pot.release()
mutex.release()
pot.acquire()
serving = get_serv... |
smtp_server.py | # smtp_server.py
import smtpd
import asyncore
import threading
class CustomSMTPServer(smtpd.SMTPServer):
def process_message(self, peer, mailfrom, rcpttos, data, **kwargs):
print('Receiving message from:', peer)
print('Message addressed from:', mailfrom)
print('Message addressed to:', rcpttos)
print(... |
h4.py | '''
现有两个进程,1号进程向文件写入10个"hello" 2号进程向文件写入10个"world",两个进程并发执行
如何使得文件中的内容一定是"hellohellohellohellohello.....worldworldworld......."
'''
from multiprocessing import Process,Lock
def new1write(name,mylock):
with mylock:
f = open(name,'r+')
f.write('hello'*10)
f.close()
def new2write(name,mylock)... |
01- opencv-opengl.py | #coding:utf-8
'''
OpenCV与OpenGL结合使用
'''
import numpy as np
import cv2
from PIL import Image
import sys
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from threading import Thread
texture_id = 0
threadQuit = 0
X_AXIS = 0.0
Y_AXIS = 0.0
Z_AXIS = 0.0
DIRECTION = 1
cap = cv2.VideoCapture(0)
n... |
manager.py | #!/usr/bin/env python2.7
import os
import sys
import fcntl
import errno
import signal
import subprocess
from common.basedir import BASEDIR
sys.path.append(os.path.join(BASEDIR, "pyextra"))
os.environ['BASEDIR'] = BASEDIR
def unblock_stdout():
# get a non-blocking stdout
child_pid, child_pty = os.forkpty()
if ch... |
cli.py | """
cli.py
Sample CLI Clubhouse Client
RTC: For voice communication
"""
import os
import sys
import threading
import configparser
import keyboard
from termcolor import colored
from rich.table import Table
from rich.console import Console
from clubhouse.clubhouse import Clubhouse
# Set some global variables
try:
... |
cc.py | #!/usr/bin/python3
#Coded by Leeon123
import socket
import socks
import time
import random
import threading
import sys
import ssl
print ('''
____ ____ _ _ _ _
/ ___/ ___| / \ | |_| |_ __ _ ___| | __
| | | | _____ / _ \| __| __/ _` |/ __| |/ /
| |__| |__|_____/ ___ \ |_| || (_| | (__... |
datasets.py | # Copyright 2019-2022 Huawei Technologies Co., Ltd
#
# 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 agre... |
trezor.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum.bip32 import deserialize_xpub
from electrum import constants
from electrum.i18n import _
from el... |
part1.py | from aoc2019.intcode_computer import IntCodeComputer
import multiprocessing as mp
def part1():
pass
if __name__ == '__main__':
iq = mp.Queue()
oq = mp.Queue()
program = '1102,34915192,34915192,7,4,7,99,0'
program = '109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99'
with open('input.t... |
TemplateUpdate.py | import numpy as np
import pandas as pd
from multiprocessing import Process, Queue, current_process, freeze_support, cpu_count
from NW import NW
from DTW import DTW
from utils import *
import copy
import random
class TemplateUpdate(object):
def __init__(self,executor,thetag = 0.4,cpu=0):
self.executor ... |
dbt_integration_test.py | #
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import json
import os
import random
import re
import socket
import string
import subprocess
import sys
import threading
import time
from copy import copy
from typing import Any, Callable, Dict, List
from normalization.destination_type import DestinationTyp... |
agent.py | import logging
import threading
import dbus
import dbus.service
from gi.repository import GLib
from .notify import Notify
AGENT_INTERFACE = "org.bluez.Agent1"
DEVICE_INTERFACE = "org.bluez.Device1"
class Device:
def __init__(self, bus: dbus.SystemBus, device):
self._device = dbus.Interface(
... |
sync.py | #!/usr/bin/env python3
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test sync
#
from test_framework import BitcoinTestFramework
from authproxy import AuthServiceProxy, JSONR... |
test_extractor.py | # Copyright 2022 Cognite AS
#
# 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... |
cache.py | '''
# GIL,全局解释器锁
本质上是类似操作系统的互斥锁 Mutex
1. CPython 引进 GIL 其实主要就是这么两个原因:
一是设计者为了规避类似于内存管理这样的复杂的竞争风险问题(race condition);
二是因为 CPython 大量使用 C 语言库,但大部分 C 语言库都不是原生线程安全的
(线程安全会降低性能和增加复杂度)
2. GIL 是如何工作的
1 . 一个线程在开始执行时,都会锁住 GIL,以阻止别的线程执行;
同样的,每一个线程执行完一段后,会释放 GIL,以允许别的线程开始利用资源
2. check_interval,意思是 CPyt... |
_assetmanager.py | # Released under the MIT License. See LICENSE for details.
#
"""Functionality related to managing cloud based assets."""
from __future__ import annotations
from typing import TYPE_CHECKING
from pathlib import Path
import threading
import urllib.request
import logging
import weakref
import time
import os
import sys
f... |
app.py | #!/user/bin/env python
# Copyright (c) 2017 VisualDL Authors. All Rights Reserve.
#
# 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
#
# Unles... |
monitor.py | # Copyright 2015 Intel Corporation.
# 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 requ... |
app_File.py |
#!/usr/bin/env python3
##jwc o #!/usr/bin/env python
# Key Notes
#
# jwc 2020-0519 Convert from Crickit_Adafruit to RoboHat_4tronix
# jwc 2020-0519 Use 'gpiozero' for noise-free servo-control
# jwc Add 'robohat.init()'
# jwc Make sure 'servod' copied in from 'RoboHat' dir
# jwc Using 'r... |
autodrive.py | import argparse
import importlib
import json
import math
import os
import pprint
import sys
import threading
from copy import deepcopy
from time import sleep, time
import cv2
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
import win32gui
from PIL import Image, ImageGrab... |
ComplexTest.py | import time
from threading import Thread
from PClient import PClient
tracker_address = ("127.0.0.1", 10086)
if __name__ == '__main__':
# A,B,C,D,E join the network
A = PClient(tracker_address, upload_rate=200000, download_rate=50000, name='A')
B = PClient(tracker_address, upload_rate=50000, download_rate... |
transports.py | from __future__ import annotations
from ...typecheck import *
from ...import core
from ...dap import Transport
import socket
import os
import subprocess
import threading
class Process:
@staticmethod
async def check_output(command: list[str], cwd: str|None = None) -> bytes:
return await core.run_in_executor(lambd... |
crashrunner.py | #!/usr/bin/python3
"""
Assume that we have conducted experiments with 30 repetitions and the folder is like:
/c/work/general/afl/exiv2/1/crashes
/c/work/general/afl/exiv2/2/crashes
...
/c/work/general/afl/exiv2/30/crashes
We can run the crash to obtain ASAN output to folder /c/ASAN_OUTPUT/c_work_general/{fuzzername}/... |
queue_channel.py | # Copyright (c) 2008-2013 by Vinay Sajip.
# 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 cond... |
blockchain.py | # Specter BlockChain Implementation
# Nick Frichette 12/9/2017
import json
import hashlib
import requests
import base64
from threading import Thread
from database_orm import *
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.haz... |
web.py | # -*- coding: utf-8 -*-
"""
utils.web
~~~~~~~~~
Some web app tool classes and functions.
:copyright: (c) 2019 by staugur.
:license: BSD 3-Clause, see LICENSE for more details.
"""
import json
import imghdr
from posixpath import basename, splitext
from os import remove
from os.path import join as ... |
server.py | from flask import Flask, render_template, request, jsonify
from flask_cors import CORS, cross_origin
from multiprocessing import Process
from configuration import Config
import json
import boto3
import time
import paramiko
import os
app = Flask(__name__)
CORS(app)
#Paraminko ssh information
dirname = os.path.dirname(... |
USBPrinterOutputDeviceManager.py | # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import threading
import time
import serial.tools.list_ports
from os import environ
from re import search
from PyQt5.QtCore import QObject, pyqtSignal
from UM.Signal import Signal, signalemitter
from UM.OutputDevice.Output... |
proxiesmanager.py | from config import CONFIG
from http.server import BaseHTTPRequestHandler, HTTPServer
from proxyset import ProxySet
import threading
class ProxiesManager:
def __init__(self, proxyset: ProxySet):
class ProxyModifyRequestHandler(BaseHTTPRequestHandler):
def do_PUT(self):
try:
... |
mc_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
'''
.. _module_mc_test:
mc_test
===============================================
'''
import threading
import time
import Queue
import os
import traceback
import salt.exceptions
import salt.output
from sal... |
test_poplib.py | """Test script for poplib module."""
# Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL
# a real test suite
import poplib
import asyncore
import asynchat
import socket
import os
import time
import errno
from unittest import TestCase
from test import support as test_support
threading = test_suppo... |
pi_surveillance.py | import RPi.GPIO as GPIO
import os
import threading
import emoji
import json
import dropbox
from telegram.ext import CommandHandler, Updater, MessageHandler, Filters
import time
import datetime
import argparse
import warnings
from pyimagetemp.tempimage import TempImage
from picamera.array import PiRGBArray
from picamer... |
spy.py | from ast import literal_eval
import json
import os
from socket import socket, AF_INET, SOCK_STREAM
from threading import Thread
from time import sleep
from subprocess import Popen, PIPE
from .exceptions import handle_error_code
import logging
import warnings
import re
pattern = '[\u4e00-\u9fa5]'
formatter = logging.Fo... |
kubernetes_executor.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... |
miniterm.py | #!C:\Users\melih\PycharmProjects\ebook_study\venv\Scripts\python.exe
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
import threading
... |
run.py | #Nạp các dữ liệu càn thiết
import os
import time
from threading import Thread
import threading
import sys
import os.path
from multiprocessing import Process
#----------------------------------------------
# Các giá trị đặt trước
help_error = set(['h','H'])
card_network = os.listdir('/sys/class/net/')
yes = set(['yes'... |
run.py | import OnlineHeart
import Silver
import Tasks
import connect
from rafflehandler import Rafflehandler
import asyncio
import printer
from statistics import Statistics
from bilibili import bilibili
from configloader import ConfigLoader
import threading
import os
import online_net
import bili_console
from bilitimer import ... |
i3bar.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import time
import os
import json
import time
import string
import threading
import subprocess as sp
arr = []
text = ''
def LOG(content):
pass
# with open("/home/pallav/log2", "a") as f:
# f.write(content)
# f.write("\n")
def battery():
... |
background.py | from threading import Thread
from time import sleep
from watersimulation.models import Dataset
def mainThread():
pass
def start():
'''thread = Thread(target = mainThread)
thread.start()
thread.join()
print('.thread finished', end='')
'''
data={
Dataset.objects.all().filter(pl... |
tasQ_utf8.py | # -*- coding: utf-8 -*-
import tweepy
from tweepy.streaming import StreamListener
from tweepy.error import TweepError
import psycopg2
import urlparse
import os
import sys
import time
import re
import datetime
import threading
tweetlock = threading.Lock()
class TimeoutException(Exception):
pass
class MyListener:... |
utils.py | #!/usr/bin/env python3
#
# Oregano - lightweight Ergon client
# Copyright (C) 2012 thomasv@gitorious
#
# This file is:
# Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
#... |
io_handler.py | # *-* encoding: utf-8
from __future__ import division, print_function
import logging
import datetime
import os
import sys
import subprocess
import threading
import time
from .colors import color, FG, BG, Style
from .config import ConfigError
logger = logging.getLogger(__name__)
class StoppableThread(threading.Thre... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
from electrum.bitcoin import TYPE_ADDRESS
from electrum.storage import WalletStorage
from electrum.wallet import Wallet, InternalAddressCorruption
from electrum.paymentrequest import InvoiceStore
fr... |
aoc_day_18.py | from multiprocessing import Event, Pipe, Process, Queue, Value
from collections import defaultdict
from functools import wraps
class Registers:
def __init__(self, program_id, queue_out, queue_in, event, instructions,
counter=None):
self.registers = defaultdict(int)
self.registers['p'] =... |
infolog.py | # Copyright 2017 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... |
detection.py | from imutils.video import VideoStream
from multiprocessing import Process
from multiprocessing import Queue
import numpy as np
import imutils
import time
import cv2
from led import turn_on, turn_off
import datetime as dt
START_TIME = dt.datetime.now()
# load the class labels from disk
rows = open("synset_words.txt").r... |
ipsec_perf_tool.py | #!/usr/bin/env python3
"""
**********************************************************************
Copyright(c) 2021, Intel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redis... |
compare_num_layer_haar_multiprocessing_sgd.py | import qiskit
import numpy as np
import sys
import multiprocessing
sys.path.insert(1, '../')
import qtm.base, qtm.constant, qtm.nqubit, qtm.fubini_study, qtm.encoding
def run_haar(num_layers, num_qubits):
psi = 2*np.random.rand(2**num_qubits)-1
# Haar
thetas = np.ones(num_qubits*num_layers*5)
psi =... |
Link.py | from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptography.fernet import Fernet
fro... |
SuiteVisitorImportProxy.py | #
# Copyright 2017 Nokia Solutions and Networks
# Licensed under the Apache License, Version 2.0,
# see license.txt file for details.
#
import threading
import sys
import json
import types
import inspect
import re
from robot.running.builder import TestSuiteBuilder
from robot.api import SuiteVisitor
from robot.running... |
client.py | import sys
import os
import tkinter as tk
from threading import Thread
from VectorMessenger.MessengerCore.Helpers import Global as h
from VectorMessenger.MessengerCore.Helpers import Client as h_cl
from VectorMessenger.MessengerCore.CoreClient import MessengerClient
from VectorMessenger.MessengerCore.Encryption import... |
portscanner.py | import threading
import socket
import time
import sys
class PortScanner:
__returned_values = []
def __init__(self,host):
self.host = host
def scan(self,port_number):
temp_buffer = []
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... |
test_subprocess.py | import unittest
from test import script_helper
from test import support
import subprocess
import sys
import signal
import io
import locale
import os
import errno
import tempfile
import time
import re
import selectors
import sysconfig
import warnings
import select
import shutil
import gc
import textwrap
try:
import... |
telegram.py | import io
import json
import time
import telebot
from django.conf import settings
from django.db.models import F
from django.utils.translation import gettext as _
from redis import Redis
from telebot import types
from telebot.handler_backends import RedisHandlerBackend
from telebot.types import Update
from bots.decor... |
tickerRequestConsumer.py | #!/usr/bin/python
import threading
import time
import traceback
import confluent_kafka
import ccxt
import json
import datetime
import logging
import os
import click
import uuid
import signal
import queue
import collections
import etcd3
import simpleProducer
import simpleConsumer
import heartbeatProducer
import config... |
cf_logs_downloader.py | #!/usr/bin/env python3
#import libraries needed in this program
#'requests' library needs to be installed first
import requests, time, threading, os, json, logging, sys, argparse, logging.handlers, yaml, yschema, tempfile, signal, persistqueue
from datetime import datetime, timedelta
from pathlib import Path
from shut... |
config.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
from threading import Thread
import cPickle as pickle
import ConfigParser
import logging
import time
import os
from doubanfm.API.login import request_token
from doubanfm.check import is_latest, update_package, is_mplayer
from doubanfm.exceptions import ConfigError
is_mpl... |
server.py | # coding: utf-8
# Author: Leo BRUNEL
# Contact: contact@leobrunel.com
# This file is part of Wizard
# MIT License
# Copyright (c) 2021 Leo brunel
# 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 So... |
test_sign_psbt.py | import pytest
import threading
from decimal import Decimal
from typing import List
from pathlib import Path
from bitcoin_client.ledger_bitcoin import Client, PolicyMapWallet, MultisigWallet, AddressType
from bitcoin_client.ledger_bitcoin.exception.errors import IncorrectDataError, NotSupportedError
from bitcoin_c... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from flask import Flask, render_template_string, request, jsonify
app = Flask(__name__)
import logging
logging.basicConfig(level=logging.DEBUG)
import sys
sys.path.append('..')
from rumble import set_vibration
@app.route("/")
def index():
... |
winmonitor.py | import win32serviceutil
import win32service
import win32event
import socket
import os
import logging
import sys
import multiprocessing as mp
r"""
Notes:
This service expects the 'monitor.ini' file to exist in the same directory.
If you receive an error "The service did not respond to the start
or control request in ... |
_threading_local.py | """Thread-local objects.
(Note that this module provides a Python version of the threading.local
class. Depending on the version of Python you're using, there may be a
faster one available. You should always import the `local` class from
`threading`.)
Thread-local objects support the management of thread-local d... |
server.py | """
Software License Agreement (Apache 2.0)
Copyright (c) 2020, The MITRE Corporation.
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
https://www.apache.org/licenses/LICENSE-... |
upload_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2014 Kitware 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 cop... |
nuc.py | from __future__ import print_function
from __future__ import division
import sys
import getopt
import struct
from functools import partial
import operator
import array
import copy
import time
import re
if sys.version_info[0] < 3:
input = raw_input
sys.path.append("../shell")
import swapforth
def truth(pred):
... |
feeder-checkpoint.py | # Copyright 2017 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... |
test_legacymultiproc_nondaemon.py | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Testing module for functions and classes from multiproc.py
"""
# Import packages
import os
import sys
from tempfile import mkdtemp
from shutil import rmtree
import pytest
import ... |
utils.py | import errno
import os
import sys
from os.path import join as pjoin
from binascii import hexlify
from threading import Thread, Event
try:
from unittest.mock import patch
except ImportError:
from mock import patch # py2
from ipython_genutils.tempdir import TemporaryDirectory
from jupyterlab.labapp import LabA... |
CntlrWebMain.py | '''
Created on Oct 3, 2010
Use this module to start Arelle in web server mode
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from arelle.webserver.bottle import Bottle, request, response, static_file
from arelle.Cntlr import LogFormatter
import os, io, sys, time, t... |
DropPiUI_Dropper.py | #!/usr/bin/python
"""*****************************************************************************************************************
DropPi by Kim Dalmeijer, 2021
Relay board 0: valve relays [VALVE1, VALVE2, VALVE3, VALVE4]
Relay board 1: flash and camera relays [CAM, FLASH1, FLASH2, FLASH3]
************... |
manager.py | #!/usr/bin/env python3
import datetime
import os
import signal
import subprocess
import sys
import traceback
from multiprocessing import Process
import cereal.messaging as messaging
import selfdrive.crash as crash
from common.basedir import BASEDIR
from common.params import Params, ParamKeyType
from common.text_window... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.