source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
sandbox.py | # Copyright (c) 2017 Mark D. Hill and David A. Wood
# 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 conditio... |
test_multiprocess_auto_save.py | import multiprocessing as mp
import Putil.trainer.multiprocess_auto_save as mas
from multiprocessing.managers import BaseManager
class TM(BaseManager):
pass
TM.register('T', mas.T)
print(__name__)
if __name__ == '__main__':
mp.set_start_method('spawn')
#tm = TM()
#tm.start()
#t = tm.T()
t =... |
test_runner_local.py | import os
import threading
import time
from unittest import TestCase
import psutil
from galaxy import job_metrics
from galaxy import model
from galaxy.jobs.runners import local
from galaxy.util import bunch
from ..tools_support import (
UsesApp,
UsesTools
)
class TestLocalJobRunner(TestCase, UsesApp, UsesTo... |
request.py | import threading
from copy import deepcopy
from functools import reduce
from requests import exceptions
from remix import utils
class RaiseForStatusMixin(object):
def process_request(self, *args, **kwargs):
response = super(RaiseForStatusMixin, self).process_request(*args, **kwargs)
response.rai... |
email.py | from flask import current_app, render_template
from flask_mail import Message
from threading import Thread
from . import mail
def async_send_email(app, message):
with app.app_content():
mail.send(message)
def send_email(destination, subject, template, **kwargs):
app = current_app._get_current_object(... |
crash_utils.py | # Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import atexit
import cgi
import ConfigParser
import json
import os
import Queue
import threading
import time
from common import utils
from result import... |
server.py | import socket
import threading
from select import select
from config import (SECONDS_COUNT_DOWN, SECONDS_PER_SESSION, SESSION,
UPDATE_RATE)
from network import receive, send
from pygame import time
from .utils import TAPPED, UNTAPPED
class Server:
def __init__(self, host: str, port: int) -> ... |
test_xmlrpc.py | import base64
import datetime
import decimal
import sys
import time
import unittest
from unittest import mock
import xmlrpc.client as xmlrpclib
import xmlrpc.server
import http.client
import http, http.server
import socket
import threading
import re
import io
import contextlib
from test import support
try:
import ... |
lisp-itr.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# 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... |
log4j_poc.py | #!/usr/bin/env python3
import requests
import os
import subprocess
import sys
import argparse
import threading
import time
from colorama import Fore
green = Fore.GREEN
red = Fore.RED
reset = Fore.RESET
def get_arguments():
parser = argparse.ArgumentParser(description='CVE-2021-44228 PoC for web requests')
pars... |
test_amqp.py | from contexture.backend import amqp_handler
import logging
from mock import Mock, patch
from nose.tools import eq_, ok_, with_setup
from pika import channel
from cStringIO import StringIO
import time
import threading
# log = logging.getLogger(__name__)
stream = StringIO() # log output
out_handler = logging.StreamHan... |
ext.py | # -*- coding: utf-8 -*-
__doc__ = '''Allow to run an external process to test your application'''
from webtest import app as testapp
from webtest.sel import _free_port
from webtest.sel import WSGIApplication
from webtest.sel import WSGIServer
from webtest.sel import WSGIRequestHandler
from webtest.compat import HTTPCon... |
keep_alive.py |
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Disord bot OK, Webserver OK!"
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start() |
libgpodder.py | # -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2008 Thomas Perl and the gPodder Team
#
# gPodder is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version... |
util.py | # -*- coding: utf-8 -*-
"""
peregrine.resources.submission.util
----------------------------------
Provides utility functions for the submission resource.
"""
import os
from collections import Counter
import json
from flask import current_app as capp
from flask import request
from functools import wraps
from psqlgra... |
distribute_coordinator_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
neat_es.py | #!/usr/bin/env python3
import numpy as np
import gym
import math
import os
import pickle
import neat
from neat.reporting import *
import time
import torch.multiprocessing as mp
from utils import *
from config import *
class GenomeEvaluator:
def __init__(self, config, neat_config, state_normalizer):
self.co... |
sftp_file.py | # Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... |
open_reliable_multicast.py | import os
import sys
import multiprocessing
import time
import threading
import uuid
sys.path.append(sys.path[0] + "/../..")
from src.core.utils.configuration import Configuration
from src.core.utils.channel import Channel
from src.protocol.base import Message
from src.core.multicast.reliable_multicast import ReliableM... |
player_game.py | import threading
import pygame
from graph.graph import Graph
from zhed.controller import zhed_board, puzzle_reader
from zhed.model.view_state import GameColors, BoardSettings, Hint
from zhed.view.draw_board import draw_board
from zhed.view.game_pieces import size, Title
import zhed.view.menus
def process_mouse(boar... |
example7.py | # ch12/example7.py
import threading
import time
from timeit import default_timer as timer
def thread_a():
print('Thread A is starting...')
print('Thread A is performing some calculation...')
time.sleep(2)
print('Thread A is performing some calculation...')
time.sleep(2)
def thread_b():
prin... |
xsarm_dual.py | import math
import rospy
from threading import Thread
from interbotix_xs_modules.arm import InterbotixManipulatorXS
# This script is used to make two WidowX200 arms work in tandem with one another
#
# To get started, open a terminal and type 'roslaunch interbotix_xsarm_dual xsarm_dual.launch'
# Then change to this dir... |
Solver2.py | import hashlib
import copy
import datetime
import threading
# Notation: [ROW][COL]
# Note: Add Forbidden Cells to improve the efficiency
# Check duplicate state in the search tree, keep DEPTH info
# ?keep DEPTH or STEPS
# Add Progress Monitoring
# ?Store Search Nodes for next batch
# ... |
wrconf_dyn.py | #!/usr/bin/env python3
# scripts/wrconf_dyn.py
#
# Import/Export script for vIOS.
#
# @author Andrea Dainese <andrea.dainese@gmail.com>
# @copyright 2014-2016 Andrea Dainese
# @license BSD-3-Clause https://github.com/dainok/unetlab/blob/master/LICENSE
# @link http://www.unetlab.com/
# @version 20160719
import getopt,... |
tools.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals, print_function
"""
This file contains utilities to generate test repositories.
"""
import datetime
import io
import os
import threading
import time
import six
im... |
synthetic_workload.py | import io
import re
import subprocess
import time
import pandas as pd
import torch
import requests
import os
from functools import partial
from torch.utils.data import DataLoader
# from experiment_impact_tracker.compute_tracker import ImpactTracker
from hfutils.loader import t5_preprocess_function, load_glue_val
from ... |
IndexFiles.py | #!/usr/bin/env python
INDEX_DIR = "IndexFiles.index"
import sys, os, lucene, threading, time
from datetime import datetime
from java.nio.file import Paths
from org.apache.lucene.analysis.miscellaneous import LimitTokenCountAnalyzer
from org.apache.lucene.analysis.standard import StandardAnalyzer
from org.apache.luce... |
decoder.py | #!/usr/bin/env python3
#
# Copyright (c) 2014-2016 Hayaki Saito
#
# 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
# use, copy, ... |
async_socketIO.py | from multiprocessing import Process, Queue
class async_socketIO():
def __init__(self,socketIO):
self.socketIO=socketIO
self.result=[]
def emit(self,msg,data):
self.socketIO.emit(msg,data,self.receiver)
self.socketIO.wait_for_callbacks(seconds=1)
while 1:
if le... |
heartbeat.py | import os
import sys
import http.server
import threading
import nose.tools
sys.path.append(os.path.join(os.path.dirname(
__file__), '../../../libbeat/tests/system'))
from beat.beat import TestCase
from time import sleep
class BaseTest(TestCase):
@classmethod
def setUpClass(self):
self.beat_name... |
TmpGnmAnnApiServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
s3_indexer.py | ## scan an S3 bucket on multiple monotonic axes for new files
import sys
import os
import sqlite3
import glob
import boto3
import logging
from botocore.parsers import PROTOCOL_PARSERS
import requests
import datetime
import dateutil.parser
import time
import multiprocessing
logger = logging.getLogger(__name__)
def ... |
test_postgresql.py | import datetime
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, RemoteMember, SyncState
from patroni.exceptions import PostgresConnectionExce... |
val.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Validate a trained YOLOv5 model accuracy on a custom dataset
Usage:
$ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640
"""
import argparse
import json
import os
import sys
from pathlib import Path
from threading import Thread
... |
helpers.py | """
Helper functions file for OCS QE
"""
import base64
import random
import datetime
import hashlib
import json
import logging
import os
import re
import statistics
import tempfile
import threading
import time
import inspect
from concurrent.futures import ThreadPoolExecutor
from itertools import cycle
from subprocess i... |
PI-Cam-Stream_Infer.py | #!/usr/bin/python3
# Python script to start a PI camera and feed frames to
# the Movidius Neural Compute Stick that is loaded with a
# CNN graph file and report the inferred results
# show two displays on the PI one showing realtime with
# inf result, the other showing the preprocessed image to
# demonstrate what the N... |
playsound.py | import logging
logger = logging.getLogger(__name__)
garbageCollection=[]
class PlaysoundException(Exception):
pass
def _canonicalizePath(path):
"""
Support passing in a pathlib.Path-like object by converting to str.
"""
import sys
if sys.version_info[0] >= 3:
return str(path)
else... |
mainIO.py | from MisProject.serial_reader import serial_loop
from MisProject.OSCserver import osc_loop
from MisProject.arduino import MIS_Arduino
from threading import Thread, Lock
import eventlet
import socketio
import json
# create the arduino object and lock
arduino = MIS_Arduino("/dev/ttyACM0", 115200)
lockduino = Lock()
st... |
test_http.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import multiprocessing
import socket
import time
import pytest
import thriftpy2
thriftpy2.install_import_hook() # noqa
from thriftpy2.http import make_server, make_client, client_context # noqa
from thriftpy2.thrift import TApplicationExcep... |
ssh_cpython_backend.py | """Intermediate process for communicating with the remote Python via SSH"""
import os.path
import sys
import threading
from threading import Thread
import thonny
from thonny.backend import (
SshMixin,
BaseBackend,
interrupt_local_process,
RemoteProcess,
ensure_posix_directory,
)
from thonny.common ... |
main.py | from threading import Thread
from urllib import request, parse
import json
Words = []
def main():
global Words
keywords = open('keywords.txt', 'r').read().split('\n')
for keyword in keywords:
get_pages(keyword)
res = []
for word in Words:
if word not in res:
... |
zeromq_queue.py | # -*- coding: utf-8 -*-
"""ZeroMQ implementations of the Plaso queue interface."""
import abc
import errno
import threading
import time
# The 'Queue' module was renamed to 'queue' in Python 3
try:
import Queue # pylint: disable=import-error
except ImportError:
import queue as Queue # pylint: disable=import-erro... |
__init__.py |
'''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY W... |
start.py | #!/usr/bin/python3
import os
import glob
import shutil
import multiprocessing
import logging as log
import sys
from podop import run_server
from pwd import getpwnam
from socrate import system, conf
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
def start_podop():
os.setuid(getp... |
h02.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: h02.py
Author: Scott Yang(Scott)
Email: yangyingfa@skybility.com
Copyright: Copyright (c) 2021, Skybility Software Co.,Ltd. All rights reserved.
Description:
"""
import multiprocessing
import random
import time
def put_data_to_queue(q: multiprocessing.Queue, nu... |
road.py | from audioop import add
import time
import board
import neopixel
import graph as gr
import itertools
i_counter = itertools.count()
import json
import random
import threading
import signal
import sys
import asyncio, socket
server_addr = '0.0.0.0'
server_port = 8000
import logging
logging.basicConfig(
filenam... |
test_flight.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... |
backup.py | import logging
import os
import random
import signal
import string
import threading
import time
from datetime import datetime, timedelta
from functools import wraps
import sh
import touchphat
import usb1
import werkzeug
from lycheesync.sync import perform_sync
from watchdog.events import FileSystemEventHandler
from wa... |
website.py | from flask import Flask,render_template,redirect
from threading import Thread
app = Flask('')
#--------------------------------------------
@app.route('/',methods=['GET', 'POST'])
def home():
return render_template("index.html")
#--------------------------------------------------
# @app.route('/test',methods=['... |
extract_resnet_feat.py | # -*- coding: utf-8 -*-
import argparse
import json
import os
import sys
import multiprocessing
import numpy as np
import scipy.io
import chainer
from chainer import Variable, serializers, cuda, functions as F
import PIL.Image
parser = argparse.ArgumentParser(description='Convert JSON dataset to pkl')
parser.add_argu... |
start.py | #!/usr/bin/python3
import os
import glob
import shutil
import multiprocessing
import logging as log
import sys
from podop import run_server
from pwd import getpwnam
from socrate import system, conf
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
def start_podop():
os.setuid(getp... |
train_sampling_multi_gpu.py | import dgl
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.multiprocessing as mp
from torch.utils.data import DataLoader
import dgl.function as fn
import dgl.nn.pytorch as dglnn
import time
import argparse
from dgl.data import RedditDa... |
thread_ratio.py | from threading import Thread, Lock
import time
import urllib.request
urls = [
'https://www.yandex.ru', 'https://www.google.com',
'https://habrahabr.ru', 'https://www.python.org',
'https://isocpp.org',
]
lock = Lock()
def read_url(url):
with lock:
with urllib.request.urlopen(url) as u:
... |
http_server.py | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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 derivative wo... |
process.py | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import, with_statement
import copy
import os
import sys
import time
import errno
import types
import signal
import logging
import threading
import contextlib
import subprocess
import multiprocessing
import multiprocessing.util
import socket
... |
api_tts.py | import os, hashlib, asyncio, threading, time, json, urllib, mutagen, edgeTTS
from mutagen.mp3 import MP3
from homeassistant.helpers.network import get_url
from homeassistant.helpers import template
from homeassistant.const import (STATE_PLAYING)
class ApiTTS():
def __init__(self, media, cfg):
self.hass = m... |
mp_manager.py | # -*- coding: utf-8 -*-
__author__ = "Isaac Park(박이삭)"
__email__ = "is9117@me.com"
__version__ = "0.3.1"
import sys
import time
import logging
import datetime
import traceback
import threading
from copy import copy
from multiprocessing import Process, Queue, Value, Semaphore
if sys.version_info[0] < 3:
from Q... |
Search.py |
import services.SearchService as src
import socket
import threading
def startClient(packet):
freeMiner = src.checkOnlineMiners()
skt = socket.socket()
skt.connect((freeMiner[1],int(freeMiner[2])))
skt.send(packet)
skt.close()
def searchProduct():
result = []
print("x" * 20)
userInp... |
executor.py | """HighThroughputExecutor builds on the Swift/T EMEWS architecture to use MPI for fast task distribution
There's a slow but sure deviation from Parsl's Executor interface here, that needs
to be addressed.
"""
from concurrent.futures import Future
import os
import time
import logging
import threading
import queue
impo... |
systemd.py | #!/usr/bin/env python3
# The MIT License
#
# Copyright (c) 2019-, Rick Lan, dragonpilot community, and a number of other of contributors.
#
# 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 wit... |
TestAll.py | # coding=utf-8
import base64
import threading
import unittest
from collections import OrderedDict
import requests
from agency.agency_tools import proxy
from config.emailConf import sendEmail
from config.serverchanConf import sendServerChan
def _set_header_default():
header_dict = OrderedDict()
header_dict["... |
webserver.py | #!/usr/bin/python
""" webserver.py - Flask based web server to handle all legal requests.
Copyright (C) 2019 Basler AG
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
def set_led(red, green, blue):... |
utils.py | #!/usr/bin/env python
"""
General Utilities
(part of web.py)
"""
from __future__ import print_function
__all__ = [
"Storage", "storage", "storify",
"Counter", "counter",
"iters",
"rstrips", "lstrips", "strips",
"safeunicode", "safestr",
"timelimit",
"Memoize", "memoize",
"re_compile", "re_subm",
... |
lock.py | from multiprocessing import Process, Lock
import random
import time
def hello(lock, id):
lock.acquire()
time.sleep(random.uniform(1, id % 4))
print('Hello world! My ID is {0}'.format(id))
lock.release()
lock = Lock()
for i in range(10):
Process(target=hello, args=[lock, i]).start()
|
openssl_run.py | # MIT License
#
# Copyright (c) 2022 Adrian F. Hoefflin [srccircumflex]
#
# 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 use... |
vnrpc.py | # encoding: UTF-8
import threading
import traceback
import signal
import zmq
from msgpack import packb, unpackb
from json import dumps, loads
try:
import cPickle as pickle
except:
# 对 python3 的支持
import pickle
pDumps = pickle.dumps
pLoads = pickle.loads
# 实现Ctrl-c中断recv
signal.signal(signal.SIGINT, sig... |
redeploy.py | from core.commands import BaseCommand
from core.config import Settings
from core import constants as K
from core.terraform.resources.aws.ecs import ECSTaskDefinitionResource, ECSClusterResource
from core.terraform.resources.aws.load_balancer import ALBTargetGroupResource
from resources.pacbot_app.alb import Application... |
RaspberryPiPythonPlugin.py | # Copyright © 2010 - 2013 Apama Ltd.
# Copyright © 2013 - 2019 Software AG, Darmstadt, Germany and/or its licensors
#
# SPDX-License-Identifier: Apache-2.0
#
# 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... |
optimizing_cursor.py | """
Created by adam on 12/15/16
"""
import TextProcessingTools.Processors.SingleWordProcessors
__author__ = 'adam'
from threading import Thread
import ConstantsAndUtilities
# Initialize the tools for filtering and modifying the individual tweet words
import TextProcessors.Processors
from TextProcessingTools.Replac... |
test_pg_cluster.py | # Copyright (c) 2021 Aiven, Helsinki, Finland. https://aiven.io/
from aiven_db_migrate.migrate.pgmigrate import PGCluster
from distutils.version import LooseVersion
from multiprocessing import Process
from test.conftest import PGRunner
from typing import Tuple
import os
import pytest
import signal
import time
def te... |
ghost.py | import time
import logging
import sys
import os
import threading
from selenium.common.exceptions import UnexpectedAlertPresentException
from selenium.webdriver import Chrome, ChromeOptions
from filelock import FileLock
from helios.ext.mefjus.proxy import *
class GhostDriverInterface:
driver_path = "drivers\\chr... |
gui.py | ##########################################################################
# MediPy - Copyright (C) Universite de Strasbourg, 2012
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# ... |
NotificationFimJornada.py | #!/usr/bin/python3
import os
import sys
import json
import time
import glob
from tkinter import *
from PIL import ImageTk, Image
from threading import Thread
from datetime import datetime
from .database.datalocal import *
from .Notifications import *
import pygetwindow as gw
import subprocess
class Noti... |
test_io.py | import sys
import gzip
import os
import threading
import time
import warnings
import io
import re
import pytest
from pathlib import Path
from tempfile import NamedTemporaryFile
from io import BytesIO, StringIO
from datetime import datetime
import locale
import numpy as np
import numpy.ma as ma
from numpy.lib._iotools ... |
threads.py | # Copyright 2019 Uber Technologies, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
store.py | import datetime
import json
import threading
import uuid
from collections import defaultdict
from copy import deepcopy
from dictdiffer import diff
from inspect import signature
from threading import Lock
from pathlib import Path
from tzlocal import get_localzone
from .logger import logger
from .settings import CACHE_... |
polybeast.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
process.py | import os
import threading
from magicbus import base
from magicbus.plugins import lifecycle
class ProcessBus(base.Bus):
"""A Bus subclass for managing the state of a process.
In general, there should only ever be a single ProcessBus object
per process. Frameworks and site containers share a single Proce... |
exercise_ibapi2.py | #!/usr/bin/env python
"""
Import as:
import im.ib.data.extract.gateway.scratch.exercise_ibapi2 as imidegsei
"""
import threading
import time
from ibapi.client import EClient
from ibapi.contract import Contract
from ibapi.wrapper import EWrapper
class IBapi(EWrapper, EClient):
def __init__(self):
EClien... |
primes_queue_less_work.py | import math
import time
import multiprocessing
from multiprocessing import Pool
FLAG_ALL_DONE = b"WORK_FINISHED"
FLAG_WORKER_FINISHED_PROCESSING = b"WORKER_FINISHED_PROCESSING"
def check_prime(possible_primes_queue, definite_primes_queue):
while True:
n = possible_primes_queue.get()
if n == FLAG... |
test_input.py | import os
import signal
import sys
import threading
import time
import unittest
from mock import Mock
try:
from unittest import skip, skipUnless
except ImportError:
def skip(f):
return lambda self: None
def skipUnless(condition, reason):
if condition:
return lambda x: x
... |
annoyer.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foun... |
labels.py | import hashlib
import requests
import threading
import json
import sys
import traceback
import base64
import electrum_commercium
from electrum_commercium.plugins import BasePlugin, hook
from electrum_commercium.i18n import _
class LabelsPlugin(BasePlugin):
def __init__(self, parent, config, name):
Base... |
main.py | from kivy.lang import Builder
from kivymd.uix.button import MDFlatButton
from kivymd.uix.dialog import MDDialog
from kivymd.app import MDApp
from kivymd.toast import toast
from kivymd.uix.list import TwoLineAvatarIconListItem
from kivy.core.window import Window
from kivy.uix.widget import Widget
from kivy.uix.boxlayout... |
download_payload_handler.py | import ftplib
import os
import uuid
from subprocess import call
from payloads.absract_payload_handler import AbstractPayloadHandler
from client import settings
from utils import logger
from threading import Thread
class FTPDownloadPayloadHandler(AbstractPayloadHandler):
@classmethod
def get_platform(cls):
... |
hiashdi.py | #!/usr/bin/env python3
""" HIASHDI Historical Data Broker.
The HIASHDI (HIAS Historical Data Interface) is an implementation of a REST
API Server that stores HIAS network historical data and serves it to
authenticated HIAS devices & applications by exposing the data through a
REST API and pushing data through subscrip... |
joyur5completo.py | import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
import numpy as np
import sympy as sp
from matplotlib.table import table
from matplotlib.widgets import Slider,Button,TextBox
from robolink import *
import serial
import threading
import time
import sys
fig, ax = plt.subplots()
plt.subplots_... |
server.py | from util import unfuck_pythonw
import sys
import os
import logging
import bottle
import json
import gevent
import gevent.queue
import gevent.pywsgi
import gevent.threadpool
import multiprocessing
from geventwebsocket import WebSocketError
import geventwebsocket
import geventwebsocket.websocket
from geven... |
git_projects.py | # -*- coding: utf-8 -*-
"""
cobra
~~~~~
Implements cobra main
:author: BlBana <635373043@qq.com>
:homepage: https://github.com/WhaleShark-Team/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2018 Feei. All rights reserved
"""
import json
import requests
... |
TWCManager.py | #!/usr/bin/python3
################################################################################
# Code and TWC protocol reverse engineering by Chris Dragon.
#
# Additional logs and hints provided by Teslamotorsclub.com users:
# TheNoOne, IanAmber, and twc.
# Thank you!
#
# For support and information, please rea... |
sql_db.py | import os
import concurrent
import queue
import threading
import asyncio
import sqlite3
from .logging import Logger
def sql(func):
"""wrapper for sql methods"""
def wrapper(self, *args, **kwargs):
assert threading.currentThread() != self.sql_thread
f = asyncio.Future()
self.db_request... |
test_lock.py | import contextlib
import logging
import math
import threading
import time
from unittest import mock
from unittest import TestCase
import pytest
from dogpile import Lock
from dogpile import NeedRegenerationException
from dogpile.util import ReadWriteMutex
log = logging.getLogger(__name__)
class ConcurrencyTest(Test... |
lab12_c.py | from sys import setrecursionlimit
import threading
setrecursionlimit(10 ** 9)
threading.stack_size(3 * 67108864)
def main(): #Levenstein readaction diff
first, second = input().strip(), input().strip()
matrix = [["" for _ in range(len(second))] for i in range(len(first))]
for i in range(len(first)):
... |
ram_usage.py | ################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... |
widget.py | #!/-usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
The widget is called from web2py.
"""
import sys
import cStringIO
import time
import thread
import re
imp... |
utils.py | #!/usr/bin/env python
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2 License
# The full license information can be found in LICENSE.txt
# in the root directory of this project.
import logging
from six.moves import queue as Queue
import sys
import threading
import time
from ax... |
thread_explained.py | import threading
def print_something(something):
print(something)
# use daemon
# other thread will stop if main thread stops
t = threading.Thread(target=print_something, args=("hello",), daemon=True)
t.start()
print("thread started")
t.join()
|
handlers.py | # Copyright 2001-2021 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
xyz.py | from typing import Any, Callable, Iterator, Optional, Sequence
import datetime
import logging
import threading
from urllib.parse import urlencode
import warnings
import grpc
from descarteslabs.common.proto.xyz import xyz_pb2
from descarteslabs.workflows.client import get_global_grpc_client, Client
from descarteslabs.... |
test_events.py | """Tests for events.py."""
import collections.abc
import concurrent.futures
import functools
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
import unittest
from unitt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.