source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
StorageServer.py | ##############################################################################
#
# Copyright (c) 2001, 2002, 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution... |
version.py | # Adapted from https://github.com/snap-stanford/ogb/blob/master/ogb/version.py
import os
import logging
from threading import Thread
__version__ = '1.2.2'
try:
os.environ['OUTDATED_IGNORE'] = '1'
from outdated import check_outdated # noqa
except ImportError:
check_outdated = None
def check():
try:
... |
test_xsorted.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# std
import os
import random
import threading
import time
import collections
# 3rd party
import pygal
from pygal.style import CleanStyle as memory_profile_chart_style
import psutil
import pytest
from mock import Mock
from hypothesis import given, example, strategies as s... |
gcsio_test.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... |
installwizard.py |
from functools import partial
import threading
import os
from typing import TYPE_CHECKING
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Butto... |
fine_grained_tune.py | from neural_net import *
from threading import *
from data_utils import *
def get_CIFAR10_data(num_training=49000, num_validation=1000, num_test=1000):
"""
Load the CIFAR-10 dataset from disk and perform preprocessing to prepare
it for the two-layer neural net classifier. These are the same steps ... |
test.py | # Copyright 2012 Mozilla 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 agreed to in wr... |
ix.py | import os, configparser, argparse
import re, threading, json, hashlib
import pathlib
from datetime import datetime
# Global verbosity check
# Get's changed by command line flag '-v'
verbose = False
# Colors
RED = '\x1B[31;1m'
CYAN = '\x1B[36m'
GREEN = '\x1B[32;1m'
YELLOW = '\x1B[33;1m'
RESET = '\x1B[0m... |
clientPerf2Nossl.py | #!/usr/bin/env python2.7
from multiprocessing import Process, Value
import time
import sys
import xmlrpclib
def call_rpc(errors, i, num):
try:
for j in range(0, num):
s = xmlrpclib.ServerProxy('http://localhost:8000')
s.test(i)
except Exception as Ex:
errors.value += 1
... |
help_window.py | import threading
import webbrowser
from tkinter import *
from tkinter import ttk
from tkinter.font import *
count = 1
def reset(win):
global count
count = 1
win.destroy()
class Help:
def __init__(self, version):
self.version = version
global count
if count == 1:
se... |
carema2.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2022/3/8 5:32 下午
# @File : carema2.py
# @author : Akaya
# @Software: PyCharm
# carema2 :
import cv2
import queue
import os
import numpy as np
from threading import Thread
import datetime, _thread
import subprocess as sp
import time
# 使用线程锁,防止线程死锁
mutex... |
db_import_multiplexer.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... |
extech-ea15.py | #!/usr/bin/env python
# Copyright 2020 Kent A. Vander Velden <kent.vandervelden@gmail.com>
#
# If you use this software, please consider contacting me. I'd like to hear
# about your work.
#
# This file is part of Extech-EA15, a decoder for the Extech EA15 thermocouple
# datalogging thermometer.
#
# Please see LICENSE ... |
main.py | import hashlib
import json
import os
import threading
import time
import engine
import requests
import uuid
import subprocess
import socket
import shutil
from pathlib import Path
from fastapi import FastAPI, Request, File, UploadFile
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileR... |
vtmanager.py | #####################
# VT Manager #
#####################
# yliu301@iit.edu #
#####################
# EMB VT #
# Version 0.9.1 #
#####################
import time, datetime
import random
import ast
import os, sys, signal
import multiprocessing
import logging
import subprocess # Watch out for sh... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.contacts import Contacts
from electrum.paymentrequest import InvoiceStore
from electrum.... |
test_fetcher.py | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import BaseHTTPServer
import hashlib
import os
import SocketServer
import unittest
from c... |
GUI_passing_queues.py | '''
Created on May 28, 2019
Ch06
@author: Burkhard A. Meier
'''
#======================
# imports
#======================
import tkinter as tk
from tkinter import ttk
from tkinter import scrolledtext
from tkinter import Menu
from tkinter import messagebox as msg
from tkinter import Spinbox
from time impor... |
compare_Wchain_sgd_1layers.py | import qiskit
import numpy as np
import sys
sys.path.insert(1, '../')
import qtm.base, qtm.constant, qtm.nqubit, qtm.fubini_study, qtm.encoding
import importlib
import multiprocessing
importlib.reload(qtm.base)
importlib.reload(qtm.constant)
importlib.reload(qtm.onequbit)
importlib.reload(qtm.nqubit)
importlib.reload(q... |
deadlock.py | #! /usr/bin/env python
# -*- coding:UTF-8 -*-
# 死锁,就是线程互相等待相互的资源,互不想让,本质相互依赖
import threading
import time
a = 5
alock = threading.Lock()
b = 5
block = threading.Lock()
def thread1calc():
print "Thread1 acquiring lock a"
alock.acquire()
time.sleep(5)
print "Thread1 again attempt acquiring lock b"
... |
extension_manager.py | """This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import... |
logger_test.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... |
TFSparkNode.py | # Copyright 2017 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
"""
This module provides Spark-compatible functions to launch TensorFlow on the executors.
There are three main phases of operation:
1. Reservation - reserves a port for the Tenso... |
test_nuage_static_nat.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... |
Test7BotProgramMK14Idea.py | from __future__ import print_function
import serial
import numpy as np
import time
import threading
NUM_SERVOS = 7
isAllConverge = False
measuredForces = [0] * NUM_SERVOS
measuredRotationDegs = [0] * NUM_SERVOS
# Serial connection to 7Bot
serialIsClosing = False
botPort = serial.Serial(port="COM3", baudrate=115200, t... |
pymultiprocess.py | #!/usr/bin/env python3
from multiprocessing import Process
import time
import os
def sleep(n: float):
print("start process: %d" % os.getpid())
time.sleep(10)
def start():
now = time.time()
processes = []
for _ in range(0,10):
p = Process(target=sleep, args=(5,))
p.start()
... |
Serial_.py |
import serial
import time
import threading
from collections import deque
exitFlag = 0
class serialTread():
def __init__(self, ser):
self.maxLen = 100
self.ser = ser
self.buf = bytes()
def run(self,buf_broadcast,buf_stm):
thread = threading.Thread(target=self.r... |
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... |
dataloader_iter.py | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
test_threading_local.py | import unittest
from doctest import DocTestSuite
from test import support
import weakref
import gc
# Modules under test
_thread = support.import_module('_thread')
threading = support.import_module('threading')
import _threading_local
class Weak(object):
pass
def target(local, weaklist):
weak = Weak()
lo... |
send.py | #!/usr/bin/env python3
"""
@summary: submit many contract.set(arg) transactions to the example contract
@version: v52 (22/January/2019)
@since: 17/April/2018
@author: https://github.com/drandreaskrueger
@see: https://github.com/drandreaskrueger/chainhammer for updates
"""
# extend sys.path for imports:
if __na... |
test_bz2.py | #!/usr/bin/env python3
from test import support
from test.support import TESTFN
import unittest
from io import BytesIO
import os
import subprocess
import sys
try:
import threading
except ImportError:
threading = None
# Skip tests if the bz2 module doesn't exist.
bz2 = support.import_module('bz2')
from bz2 im... |
profiling_base.py | # Copyright 2019 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 agreed to... |
final_script_mini_camera_2.2_4_windows_for_2_crates _2.py | from tkinter import *
from math import sin, cos, pi
from random import randrange
import os
import time, threading
import subprocess
import pickle
import numpy as np
import random
from math import cos, sin, sqrt, pi
from matplotlib.patches import Polygon
import matplotlib.pyplot as plt
from tkinter import *
import matpl... |
vnokcoin.py | # encoding: UTF-8
import hashlib
import zlib
import json
from time import sleep
from threading import Thread
import websocket
# OKCOIN网站
OKCOIN_CNY = 'wss://real.okcoin.cn:10440/websocket/okcoinapi'
OKCOIN_USD = 'wss://real.okex.com:10441/websocket/okexapi'
# 账户货币代码
CURRENCY_CNY = 'cny'
CURRENCY_USD = 'usd'
#... |
train.py | # -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2019 Megvii Technology
#
# 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
#... |
flaskApp.py | """
Copyright (c) 2021 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein must be in accordance with t... |
PyShell.py | #! /usr/bin/env python
from __future__ import print_function
import os
import os.path
import sys
import string
import getopt
import re
import socket
import time
import threading
import io
import linecache
from code import InteractiveInterpreter
from platform import python_version, system
try:
from Tkinter import... |
test_monitors.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
import os
import pytest
import subprocess
import time
import ray
from ray.tests.utils import run_and_get_output
def _test_cleanup_on_driver_exit(num_redis_shards):
stdout = run_an... |
rdd.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... |
__init__.py | import logging
try:
from gevent.event import Event
from gevent.lock import RLock
except ImportError:
from threading import Event, RLock
logger = logging.getLogger(__name__)
ERR_LOCK = RLock()
UNHANDLED_ERRORS = set()
def defer_error(error):
with ERR_LOCK:
UNHANDLED_ERRORS.add(error)
def re... |
bot_utils.py | import logging
import re
import threading
import time
from bot import download_dict, download_dict_lock
LOGGER = logging.getLogger(__name__)
MAGNET_REGEX = r"magnet:\?xt=urn:btih:[a-zA-Z0-9]*"
URL_REGEX = r"(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+"
class MirrorStatus:
STATUS_UPLOADING = "𝗨𝗽�... |
subproc_vec_env.py | # The MIT License
#
# Copyright (c) 2017 OpenAI (http://openai.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to u... |
run.py | #!/usr/bin/env python3
# SPDX-License-Identifier: MIT
##################
# Use this script to start the Cytom server
##################
import socket
import sys
import argparse
# import pickle
import os
import json
import subprocess
import psutil
import shlex
import time
import math
import datetime
import matplotlib... |
main.py | from sqlite3.dbapi2 import Cursor
from prettytable import PrettyTable
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from vk_api.keyboard import VkKeyboard, VkKeyboardColor
import random
import sqlite3
from game_math import RandomNumber
import psycopg2
import threading
import datetime
from... |
cmdlineframes.py |
from __future__ import absolute_import, division, print_function
from iotbx.reflection_file_reader import any_reflection_file
from iotbx.gui_tools.reflections import ArrayInfo
from cctbx.miller import display2 as display
from crys3d.hklviewer import jsview_3d as view_3d
#from crys3d.hklviewer.jsview_3d import ArrayIn... |
serialproxy.py | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... |
pgrep_v2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Process, Value, Queue, Semaphore
import argparse
import re
import os
import sys
q = Queue() #inicialização da queue
sem = Semaphore(1) #inicialização do semáforo
n = Value('i',0) #inicialização da variável partilhada
def pgrep(list_files, tex... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import test_support
import asyncore
import socket
import select
import time
import gc
import os
import errno
import pprint
import urllib, urlparse
import traceback
import weakref
import functools
import platform
from BaseHTTPServer import HTT... |
slam_demo.py | #!/usr/bin/env python3.7
import socket
import time
import math
import queue
import struct
import threading
from hokuyo.driver import hokuyo
from hokuyo.tools import hokuyo_socket
from roboclaw.motorcontrol import MotorControl
server_host = 'phantom-edison'
server_port = 60000
lidar_host = 'phantom-zynq'
lidar_port = ... |
detect_motor_test.py | #!/usr/bin/env python
#!coding=utf-8
import rospy
import numpy as np
import PIL.Image as pilimage
from sensor_msgs.msg import CompressedImage
from sensor_msgs.msg import Image
from std_msgs.msg import Float64
from cv_bridge import CvBridge, CvBridgeError
import cv2
import time
from yolo import YOLO
from sensor_msgs.ms... |
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... |
mysql_test.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import contextlib
import logging
import os
import threading
import unittest
import uuid
import warnings
from absl import app
from absl import flags... |
ctf_run.py | #!/usr/bin/python3
"""CTF challenges runner
This script builds, compiles, and optionally deploys to docker-compose all the
challenges located in the current working directory.
Challenge directories are expected to include a `challenge.yml` file defining
the different challenge attributes, such as its name, flag, sco... |
network.py |
# Electrum - Lightweight Bitcoin Client
# Copyright (c) 2011-2016 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 ri... |
executorselenium.py | import json
import os
import socket
import threading
import time
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
st... |
__init__.py | import functools
import threading
import schedule
import time
from fHDHR.tools import checkattr
class Scheduler():
"""
fHDHR Scheduling events system.
"""
def __init__(self, settings, logger, db):
self.config = settings
self.logger = logger
self.db = db
self.schedule... |
schedule.py | import time
from multiprocessing import Process
import asyncio
import aiohttp
from aiohttp import ClientProxyConnectionError as ProxyConnectionError, ServerDisconnectedError, ClientResponseError, \
ClientConnectorError
from proxypool.db import RedisClient
from proxypool.error import ResourceDepletionError
from pro... |
subproc_env_vec.py | # Inspired from OpenAI Baselines
import numpy as np
from multiprocessing import Process, Pipe
from rl.common.vec_env import VecEnv, CloudpickleWrapper
from rl.common.tile_images import tile_images
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while True:... |
test_socketserver.py | """
Test suite for socketserver.
"""
import contextlib
import io
import os
import select
import signal
import socket
import tempfile
import threading
import unittest
import socketserver
import test.support
from test.support import reap_children, reap_threads, verbose
from test.support import socket_helper
test.supp... |
utils.py | import re
import requests
import xml.etree.ElementTree as ET
from datetime import datetime, date
import threading
from decimal import Decimal
from django.core.cache import caches
from django.core.exceptions import (PermissionDenied,
ObjectDoesNotExist)
from django.db.models import Q
... |
gtest_parallel.py | # Copyright 2022 PingCAP, 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 agreed to in writing... |
relay.py | from asyncio.runners import run
from threading import Thread, Lock
from arduino import STORE_FILE as arduino_remember_cache, RememberedDeviceIsNotConnectedException, get_arduino_serial_connection
import socketio
import serial
import json
import time
io = socketio.Client()
try:
arduino = get_arduino_serial_connect... |
better_logging.py | import thread
import threading
import time
import io
import Queue
import atexit
import ctypes
import datetime
__libc = ctypes.cdll.LoadLibrary('libc.so.6')
__log_levels_ints = {
0: "DEBUG",
1: "INFO",
2: "WARN",
3: "ERROR",
4: "FATAL"
}
__log_levels_strings = {
"... |
Day5.py | import os
import time
import threading
import pyautogui
print("Integration Testing (Day 5) ...")
os.system("mvn compile")
os.chdir("./target/classes")
validAcc = " ../../ValidAccList.txt "
transSumDir = "../../TransactionFiles/"
master = " ../../Master.txt "
def runJava(session, arg1, arg2):
os.system("java mai... |
dumping_callback_test.py | # Copyright 2019 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... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
from threading import Thread
import time
import csv
from decimal import Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintError, ThreadJob
# See https://en.wikipedia.org/wiki/ISO_4217
CCY_PRECISIONS = {}
'''
{'BHD': 3,... |
test_core.py | from datetime import timedelta
from functools import partial
import itertools
import json
import operator
from operator import add
import os
from time import sleep
import sys
import pytest
from tornado.queues import Queue
from tornado.ioloop import IOLoop
import streamz as sz
from streamz import RefCounter
from str... |
benchmark_djangocache.py | """Benchmark diskcache.DjangoCache
$ export PYTHONPATH=/Users/grantj/repos/python-diskcache
$ python tests/benchmark_djangocache.py > tests/timings_djangocache.txt
"""
from __future__ import print_function
import collections as co
import multiprocessing as mp
import os
import random
import shutil
import sys
import... |
test_client_integration.py | # -*- coding: utf-8 -*-
import pytest
from client import MultibotClient
from random import randint
from os import path
from json import loads
from requests import head
from requests.exceptions import RequestException
from multiprocessing.pool import ThreadPool
from threading import Thread
# Set global config values f... |
index.py | # this is a modified version of the original index.py.
# Copyright (c) Alex Ellis 2017. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
from flask import Flask, request, current_app, request, Response
from function import handler
from waitress i... |
test_application.py | # GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# ... |
main.py |
import tensorflow as tf
import threading
import time
from tensorflow.python.client import timeline
import Actor
import GUI
from Learner import Learner
from Displayer import DISPLAYER
import settings
class Sess(tf.Session):
def __init__(self, options, meta, *args, **kwargs):
super().__init__(*args, **kw... |
TN_utils.py | # Individual Cases Text Parser
# From Tamil Nadu Bulletins
from __future__ import annotations
import multiprocessing
import sys
import pathlib
import argparse
import os
import re
import json
import pdfplumber
if sys.version_info >= (3, 8):
from typing import TypedDict, Dict, List, Optional
else:
from typing_... |
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... |
test_s3boto3.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gzip
import pickle
import threading
import warnings
from datetime import datetime
from textwrap import dedent
from unittest import skipIf
from botocore.exceptions import ClientError
from django.conf import settings
from django.core.exceptions impo... |
weiqi_online_2.py | #!/usr/bin/python3
# 使用Python内建GUI模組tkinter
from tkinter import *
# ttk覆寫tkinter部分物件,ttk對tkinter進行了優化
from tkinter.ttk import *
# deepcopy需要用到copy模組
from MyOwnPeer2PeerNode import MyOwnPeer2PeerNode
import copy
import tkinter.messagebox
import sys
import time
import threading
sys.path.insert(0, '..') # Import the fi... |
nrf_driver.py | #
# Copyright (c) 2016 Nordic Semiconductor ASA
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of con... |
fakeserver.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import json
import multiprocessing
import six
from threading import Thread
from argparse import ArgumentParser
from six.moves.socketserver import TCPServer
from six.moves.SimpleHTTPServer import SimpleHTTPRequestHandler
f... |
GIL_effect.py | import threading
import time
def worker(r):
tid = threading.currentThread().name
# do some hard and time consuming work:
global result
res = 0
for i in r:
res += i
result += res
print("Worker {} is working with {}".format(tid, r))
#################################################
# Sequential Pr... |
pydoc.py | #! /usr/bin/python2.7
# -*- coding: latin-1 -*-
"""Generate Python documentation in HTML or text for interactive use.
In the Python interpreter, do "from pydoc import help" to provide online
help. Calling help(thing) on a Python object documents the object.
Or, at the shell command line outside of Python:
Run "pydo... |
withlocks.py | import threading, time, random
counter_lock = threading.Lock()
printer_lock = threading.Lock()
counter = 0
def worker():
'My job is to increment the counter and print the current count'
global counter
with counter_lock:
counter += 1
with printer_lock:
print('The count is %d' %... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_nmc.util import bfh, bh2u, UserCancelled
from electrum_nmc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT,
is_segwit_address)
from electrum_... |
redshift.py | # pylint: disable=C0111,R0903
"""Displays the current color temperature of redshift
Requires the following executable:
* redshift
Parameters:
* redshift.location : location provider, either of 'auto' (default), 'geoclue2',
'ipinfo' or 'manual'
'auto' uses whatever redshift is configured to do
... |
tasks.py |
import schedule
import time, threading
import requests
import json
import datetime, pytz, django.utils
import logging
from monitor.configure import configure
from monitor.models import BalanceHistory
from monitor.models import ExchangeHistory
from monitor.models import BotHistory
logger = logging.getLogger("tasks")... |
xmlrpc_server_example.py | from __future__ import absolute_import, division, print_function
# This is an example of how a 3rd-party program with Python embedded, such
# as Coot or PyMOL, can be interfaced with CCTBX-based software. Something
# much like this is used for the Phenix GUI extensions to those programs.
# I haven't tried this with a... |
cisd.py | #!/usr/bin/env python
# Copyright 2014-2021 The PySCF Developers. 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
#
# U... |
kafka.py | import json
import logging
from typing import List
from threading import Thread
from multiprocessing import Queue, Value
from confluent_kafka.admin import AdminClient, NewTopic
from confluent_kafka import Consumer, TopicPartition
from .model import EventSourceHook
class KafkaEventSource(EventSourceHook):
def __i... |
example_binance_futures.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_binance_futures.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api
# PyPI: https://p... |
__init__.py | """Support for functionality to download files."""
from http import HTTPStatus
import logging
import os
import re
import threading
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.util import raise_if_invalid_filename, raise_if_invalid_path
_LOGGER = lo... |
app.py | from flask import Flask, render_template, jsonify
import serial
import threading
app = Flask(__name__)
curTemp = 0.0
curHumi = 0.0
tempDataList = []
humiDataList = []
ser = serial.Serial(
port='COM6',
baudrate=115200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBI... |
test_config.py | import asyncio
import copy
import pytest
import random
import yaml
from tad.util.config import create_default_chia_config, initial_config_file, load_config, save_config
from tad.util.path import mkdir
from multiprocessing import Pool
from pathlib import Path
from threading import Thread
from time import sleep
from typ... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/1/14 4:35 PM
# @Author : w8ay
# @File : main.py
import os
import random
import sys
import threading
import time
from config import THREAD_NUM, DEBUG, NODE_NAME
from lib.data import PATHS, logger
from lib.engine import Schedular
from lib.redis import ... |
main.py | from flask import (Flask,
make_response,
abort,
redirect,
render_template,
url_for,
flash,
session, )
from flask_script import Manager, Shell
from flask_bootstrap import Bootstrap
... |
KmapMerger.py | #!/usr/bin/python
# coding: utf8
# /*##########################################################################
#
# Copyright (c) 2015-2016 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ... |
burst.py | # -*- coding: utf-8 -*-
"""
Burst processing thread
"""
import re
import json
import time
import xbmc
import xbmcaddon
import xbmcgui
from Queue import Queue
from threading import Thread
from urlparse import urlparse
from urllib import unquote
from elementum.provider import append_headers, get_setting, log
from pars... |
worker.py | # -*- coding: utf-8 -*-
"""
Created on November 11, 2017
@author: neerbek
"""
import subprocess
from threading import Lock
from typing import List
from typing import Tuple
from typing import IO
from typing import cast
# from threading import Thread
import os
import controller
FileDescriptorType = IO[str]
class Ex... |
config.py | import logging
import sched
import threading
import time
import pyodbc
import requests
import yaml
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s')
LOGGER = logging.getLogger(__name__)
class AppConfig:
def __init__(self):
self.config = None
self.scheduler =... |
JumpscriptFactory.py | from JumpScale import j
import time
import imp
import linecache
import inspect
import JumpScale.baselib.redis
import multiprocessing
import tarfile
import StringIO
import collections
import os
import base64
import traceback
import signal
import sys
class Jumpscript(object):
def __init__(self, ddict=None, path=None... |
_channel.py | # Copyright 2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.