source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
sync.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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... |
worm_game.py | import random, math
import socket, threading,struct
from enum import IntEnum, auto
import pyxel as P
from pyxel import btn,btnp,quit
class Human():# Player -it had Player arg """ Human player with controls """
def __init__(self, name, im, kc):
print('debug Human',name)
self.name = name
se... |
test_browser.py | # coding=utf-8
from __future__ import print_function
import multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex
from runner import BrowserCore, path_from_root, has_browser, get_browser
from tools.shared import *
try:
from http.server import BaseHTTPRequestHandler, HTTPServer
except Impo... |
test_monitors.py | import sys
import time
import unittest
from multiprocessing import Process
from boofuzz.monitors import NetworkMonitor, pedrpc, ProcessMonitor
RPC_HOST = "localhost"
RPC_PORT = 31337
# noinspection PyMethodMayBeStatic
class MockRPCServer(pedrpc.Server):
def __init__(self, host, port):
super(MockRPCServe... |
Fuzzer.py | # -*- coding: utf-8 -*-
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope... |
model_average_optimizer_test.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... |
Client 2.py | from socket import *
from threading import *
from tkinter import *
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
hostIp = "127.0.0.1"
portNumber = 5050
clientSocket.connect((hostIp, portNumber))
window = Tk()
window.title("Connected To: "+ hostIp+ ":"+str(portNumbe... |
test_pickle.py | """Test that the pymongo.MongoClient embedded in the dask future can be
pickled/unpickled and sent over the network to dask distributed.
This requires a monkey-patch to pymongo (patch_pymongo.py) which must be loaded by the
interpreter BEFORE unpickling the pymongo.MongoClient object. This is achieved by always
having... |
main.py | #!/usr/bin/env python3
from flask import Flask, render_template, redirect, request, session
from src.webscraper import WebScraper
from src.beebotteclient import BeebotteClient
from src.elasticlient import ElastiClient
import threading, time, re, requests, uuid, logging, hashlib
# Iniciamos los objs necesarios de Flas... |
pub_sub.py | import json
import os
import threading
import time
import logging
from typing import Callable
from django.conf import settings
from pika import (
BasicProperties,
BlockingConnection,
PlainCredentials,
ConnectionParameters,
)
from pika.adapters.blocking_connection import BlockingChannel
from pika.excep... |
shell.py | """
A module for writing shell scripts in Python.
Assumes Python 3.
"""
import os
import os.path
import subprocess
import re
import sys
import atexit
import tempfile
import shutil
import types
import fnmatch
import shutil
from threading import Thread
import traceback
_pyshell_debug = os.environ.get('PYSHELL_DEBUG',... |
__init__.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
__all__ = ['ToastNotifier']
# #############################################################################
# ########## Libraries #############
# ##################################
# standard library
... |
Sniffer.py | from scapy.all import *
import os
import sys
import threading
import time
import netifaces
import platform
import Analyzer
from subprocess import Popen, PIPE
import re
class Sniffer:
packet_count = 1000
interface = "en0"
analyzer = Analyzer.Analyzer()
# Scapy configs; verbosity and interface
con... |
test_dispatcher.py | # Copyright (c) 2017 FlashX, LLC
#
# 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, modify, merge, publish, distrib... |
summationPub.py | """
Created on Sep 19 15:45 2019
@author: nishit
"""
import configparser
import threading
from abc import abstractmethod
from queue import Queue
from random import randrange
import time
from IO.MQTTClient import MQTTClient
from IO.dataReceiver import DataReceiver
from utils_intern.messageLogger import MessageLogger... |
singleton.py | import sys
import os
import tempfile
import unittest
import logging
from multiprocessing import Process
class SingleInstanceException(BaseException):
pass
class SingleInstance:
"""
If you want to prevent your script from running in parallel just instantiate SingleInstance() class. If is ... |
runner.py | # -*- coding: utf-8 -*-
'''
Provides an Acumos model runner for DCAE
'''
import logging
import sys
from argparse import ArgumentParser
from threading import Thread, Event
from dcaeapplib import DcaeEnv
from acumos.wrapped import load_model
logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(asctime)... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
im... |
TargetExtractor.py | import sm
import numpy as np
import sys
import multiprocessing
import Queue
import time
import copy
import cv2
def multicoreExtractionWrapper(detector, taskq, resultq, clearImages, noTransformation):
while 1:
try:
task = taskq.get_nowait()
except Queue.Empty:
return
... |
__init__.py | # We import importlib *ASAP* in order to test #15386
import importlib
import importlib.util
from importlib._bootstrap_external import _get_sourcefile
import builtins
import marshal
import os
import py_compile
import random
import shutil
import subprocess
import stat
import sys
import threading
import time
import unitte... |
__init__.py | import contextlib
import datetime
import errno
import functools
import inspect
import os
import pickle
import re
import signal
import socket
import subprocess
import sys
import tempfile
import threading
from collections import namedtuple
from enum import Enum
from warnings import warn
import six
import yaml
from dagst... |
batch_generator.py | import sys
from multiprocessing import Process, Queue
from random import sample
import numpy as np
from keras.preprocessing.image import list_pictures
from neural_style.utils import load_and_preprocess_img
DEFAULT_MAX_QSIZE = 1000
class BatchGenerator:
def __init__(self, imdir, num_batches, batch_size, image_... |
Server.py | import datetime
from concurrent.futures import thread
import threading
import socket
now = datetime.datetime.now()
#Colors Codes With Their Given Names
#Bright Text Colors
Dark_Black = "\u001b[30;1m"
Dark_Red = "\u001b[31;1m"
Dark_Green = "\u001b[32;1m"
Dark_Yellow = "\u001b[33;1m"
Dark_Blue = "\u001b[34;1m"... |
engine.py | """"""
import importlib
import os
import traceback
from collections import defaultdict
from pathlib import Path
from typing import Any, Callable
from datetime import datetime, timedelta
from threading import Thread
from queue import Queue
from copy import copy
from vnpy.event import Event, EventEngine
from vnpy.trade... |
CO2MINI.py | # CO2 Sensor
from logging import getLogger
from time import sleep
import argparse
import fcntl
import threading
import weakref
CO2METER_CO2 = 0x50
CO2METER_TEMP = 0x42
CO2METER_HUM = 0x44
HIDIOCSFEATURE_9 = 0xC0094806
def _co2_worker(weak_self):
while True:
self = weak_self()
if self is None:
... |
agent.py | #!/usr/bin/env python3
""" HIAS iotJumpWay Agent Abstract Class
HIAS IoT Agents process all data coming from entities connected to the HIAS
iotJumpWay brokers.
MIT License
Copyright (c) 2021 Asociación de Investigacion en Inteligencia Artificial
Para la Leucemia Peter Moss
Permission is hereby granted, free of char... |
server.py | #!/usr/bin/python3
### LIBERARIES
import threading, logging
from random import randint
from time import sleep
from scapy.layers.inet import TCP, IP, Ether
from scapy.sendrecv import sniff, sr1, send, sr
from scapy.arch import get_if_addr, conf
### CONSTANTS
logging.basicConfig(level=logging.INFO, # ... |
frontend.py | """ Displays a tkinter frame to request user input on a tweet query. """
from backend import backend
from datetime import datetime
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from matplotlib.pyplot import close
from tkcalendar import DateEntry
from tkinter import... |
webhooklistener.py | import traceback
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import sys
import socket
import os
import threading
import discord.ext.commands as commands
import asyncio
def runServer(self, bot):
server = HTTPServerV6((os.environ.get("FRED_IP"), int(os.environ.get("FRED_PORT"))), MakeGith... |
analysis.py | __author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
import datetime # Supplies classes for manipulating dates and times in both simple and complex ways
import os.path # The path module suitable for the operating system Python is running on, and therefore usable for local paths
import pysrt # SubRip (.srt... |
win32gui_dialog.py | # A demo of a fairly complex dialog.
#
# Features:
# * Uses a "dynamic dialog resource" to build the dialog.
# * Uses a ListView control.
# * Dynamically resizes content.
# * Uses a second worker thread to fill the list.
# * Demostrates support for windows XP themes.
# If you are on Windows XP, and specify a '--noxp' ... |
thread_safe.py | #!usr/bin/python
# -*- coding:utf8 -*-
import threading
lock = threading.Lock()
n = [0]
def foo():
with lock:
n[0] = n[0] + 1
n[0] = n[0] + 1
threads = []
for i in range(10000):
t = threading.Thread(target=foo)
threads.append(t)
for t in threads:
t.start()
print(n) |
test.py | ###################################################################
# #
# PLOTTING A LIVE GRAPH #
# ---------------------------- #
# EMBED A MATPLOTLIB ANIMATION INSIDE... |
server.py | # Copyright 2020 Tabacaru Eric
#
# 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 ... |
mq_server_base.py | import os
import pika
from multiprocessing.pool import ThreadPool
import threading
import pickle
from functools import partial
from typing import Tuple
from queue import Queue
import time
from abc import ABCMeta,abstractmethod
import sys
sys.setrecursionlimit(100000)
import functools
import termcolor
import datetim... |
file_stream.py | import base64
import binascii
import collections
import itertools
import logging
import os
import sys
import requests
import threading
import time
import wandb
from wandb import util
from wandb import env
from six.moves import queue
from ..lib import file_stream_utils
logger = logging.getLogger(__name__)
Chunk = ... |
test_codegen_vulkan.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... |
server.py | import threading
import traceback
from _shaded_thriftpy.server import TServer
from _shaded_thriftpy.transport import TTransportException
class TSingleThreadedServer(TServer):
"""Server that accepts a single connection and spawns a thread to handle it."""
def __init__(self, *args, **kwargs):
self.dae... |
scheduler.py | # Copyright (c) 2014 Mirantis 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, so... |
main.py | from spotify import Song
import telepot
import spotify
import requests
import threading
token = '5093654421:AAHtO6C6DOFsCbV67jJ3wf1FgTa7uC1z4EY'
bot = telepot.Bot()
sort = {}
def txtfinder(txt):
a = txt.find("https://open.spotify.com")
txt = txt[a:]
return txt
def downloader(link, chat_id, type):
... |
datasets.py | # Dataset utils and dataloaders
import glob
import logging
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, Exif... |
test_io.py | from __future__ import division, absolute_import, print_function
import sys
import gzip
import os
import threading
import shutil
import contextlib
from tempfile import mkstemp, mkdtemp, NamedTemporaryFile
import time
import warnings
import gc
from io import BytesIO
from datetime import datetime
import numpy as np
imp... |
tcp.py | # -*- coding: utf-8 -*-
'''
TCP transport classes
Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})"
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import errno
import logging
import socket
import os
import weakref
import time
import threa... |
get_representations_v2.py | #########################################################################################################################################
# IMPORTS ###############################################################################################################################
from elasticsearch import Elasticsearch as E... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
test.py | """
CLI program to continually send a morse string.
Usage: test [-h] [-s c,w] <string>
where -h means print this help and stop
-s c,w means set char and word speeds
and <string> is the morse string to repeatedly send
The morse sound is created in a separate thread.
"""
import sys
import os
import... |
parameter_server.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch.multiprocessing as _mp
mp = _mp.get_context('spawn')
# XXX hack fix path
import sys, os
sys.path.insert(0... |
floods.py | import os, sys
try:
import socks, requests, wget, cfscrape, urllib3
except:
if sys.platform.startswith("linux"):
os.system("pip3 install pysocks requests wget cfscrape urllib3 scapy")
elif sys.platform.startswith("freebsd"):
os.system("pip3 install pysocks requests wget cfscrape urllib3 sca... |
sms_bomberProxyVersion.py | from requests import get, post
from time import sleep
from threading import Thread
x = input('Proxy file : ')
while True:
try:
f = open(str(x), 'r')
proxies = [i.replace('\n', '') for i in f.readlines()]
f.close()
break
except Exception as e:
print(e)
x = input('... |
sabtraylinux.py | #!/usr/bin/python3 -OO
# Copyright 2007-2020 The SABnzbd-Team <team@sabnzbd.org>
#
# This program 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 2
# of the License, or (at your option) any late... |
inicio.py | import threading
import time
import os
import tkinter
import tarfile
import pyAesCrypt
import shutil
import psutil
import wmi
import pythoncom
import sys
from tkinter.filedialog import askopenfilename
from datetime import datetime
from tkinter import messagebox
from log import LogFile
from pathlib import Path
# Vari... |
rosbag_cli_recording_3_generate_output.py | #!/usr/bin/env python
import roslib
import rospy
import smach
import smach_ros
from geometry_msgs.msg import Point
from geometry_msgs.msg import Point32
from geometry_msgs.msg import PointStamped
from geometry_msgs.msg import Pose
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import Quate... |
maincontrol.py | """
Dynamic CPU shares controller based on the Heracles design
Current pitfalls:
- when shrinking, we penalize all BE containers instead of killing 1-2 of them
TODO
- validate CPU usage measurements
"""
__author__ = "Christos Kozyrakis"
__email__ = "christos@hyperpilot.io"
__copyright__ = "Copyright 2017, HyperPilo... |
decorators.py | from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
from threading import Thread
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.can(permiss... |
test_client.py | # coding=utf-8
# Copyright 2018-2020 EVA
#
# 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 ... |
train_ac_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
im... |
worker_pool_main.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... |
tests.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... |
AVR_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Python AVR Miner (v2.5.6)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
# Import libraries
import sys
from configparser import ConfigPa... |
cvimage.py | from __future__ import annotations
from typing import Tuple, Union
import builtins
import sys
import os
import io
import math
import warnings
import contextlib
from pathlib import Path
import cv2
import numpy as np
def isPath(f):
return isinstance(f, (bytes, str, Path))
NEAREST = NONE = cv2.IN... |
QAhuobi_realtime.py | # coding: utf-8
# Author: 阿财(Rgveda@github)(11652964@qq.com)
# Created date: 2018-06-08
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to de... |
encoder_sample.py | # Copyright (c) 2020-2021, NVIDIA 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 required by ... |
2_multi_threads.py | """
In a process, threading allows multiple tasks to execute concurrently, i.e. appear to run simultaneously
Threading uses a technique called pre-emptive multitasking where the operating system knows about each thread
and can temporarily interrupt (i.e. pause) and resume the execution of any threads "at any time".
... |
app.py | # -*- coding:utf-8 -*-
from flask import Flask
from flask import render_template, session, request, jsonify
from model import code_model, global_model, architecture_model, content_model, activation_model, filter_model
import server_utils.secret.config as config
import os
import threading
app = Flask(__name__)
app.sec... |
test.py | import argparse
import json
import os
from pathlib import Path
from threading import Thread
import numpy as np
import torch
import yaml
from tqdm import tqdm
from models.experimental import attempt_load
from utils.datasets import create_dataloader
from utils.general import coco80_to_coco91_class, check_dataset, check... |
training.py | from __future__ import print_function
from __future__ import absolute_import
import warnings
import copy
import time
import numpy as np
import multiprocessing
import threading
import six
try:
import queue
except ImportError:
import Queue as queue
from .topology import Container
from .. imp... |
test.py | """
The PEW test module contains utilities for running unit tests on a PEW application.
"""
import logging
import os
import re
import tempfile
import threading
import time
import unittest
import pew
has_figleaf = False
try:
import figleaf
import figleaf.annotate_html as html_report
has_figleaf = True
exc... |
writer.py | """
Data Writer
Writes records to a data set partitioned by write time.
Default behaviour is to create a folder structure for year, month
and day, and partitioning data into files of 50,000 records or
are written continuously without a 60 second gap.
When a partition is written a method is called (on_partition_close... |
bctides.py | from datetime import datetime, timedelta
import pathlib
from typing import Dict, Union
import logging
from pyschism import dates
from pyschism.mesh.vgrid import Vgrid
from pyschism.forcing.bctides import iettype, ifltype, isatype, itetype, itrtype, Tides
from pyschism.forcing.bctides.elev2d import Elev2D
from pyschis... |
tests.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... |
addon.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import json
import os
import re
import subprocess
import sys
import threading
import time
import urllib.parse
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
import xbmcvfs
__PLUGIN_ID__ = "plugin.audio.playbulb"
SLOTS = 12
PRESETS = 8
BULB_ICONS = ["icon_lam... |
ssh_remote.py | # Copyright (c) 2013 Mirantis Inc.
# Copyright (c) 2013 Hortonworks, 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... |
http2mllp.py | import http.server
import logging
import socket
import threading
import time
from .mllp import write_mllp
from .net import read_socket_bytes
logger = logging.getLogger(__name__)
class MllpClientOptions:
def __init__(self, keep_alive, max_messages, timeout):
self.address = address
self.keep_alive ... |
bomberman-master-server-multi.py | import time
import socket
import socketserver, threading, time
import socket
import pickle
serverListWtheServerNumber = []
# TCP connexion handling
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
def handle(self):
print("ThreadedTCPRequestHandler:handle")
# self.request is the ... |
_v5_proc_camera.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# COPYRIGHT (C) 2014-2020 Mitsuo KONDOU.
# This software is released under the MIT License.
# https://github.com/konsan1101
# Thank you for keeping the rules.
import sys
import os
import time
import datetime
import codecs
import glob
import queue
impo... |
camera.py | """camera.py
This code implements the Camera class, which encapsulates code to
handle IP CAM, USB webcam or the Jetson onboard camera. In
addition, this Camera class is further extended to take a video
file or an image file as input.
"""
import logging
import threading
import numpy as np
import cv2
def add_camer... |
tasks.py | from __future__ import with_statement
from functools import wraps
import inspect
import sys
import textwrap
from fabric import state
from fabric.utils import abort, warn, error
from fabric.network import to_dict, normalize_to_string, disconnect_all
from fabric.context_managers import settings
from fabric.job_queue im... |
MVC2_5G_Orc8r_deployment_script.py | #!/usr/bin/env python3
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BAS... |
input.py | """Input classes"""
import sys
import json
import uuid
import time
import select
import threading
import bumblebee.util
LEFT_MOUSE = 1
MIDDLE_MOUSE = 2
RIGHT_MOUSE = 3
WHEEL_UP = 4
WHEEL_DOWN = 5
def is_terminated():
for thread in threading.enumerate():
if thread.name == "MainThread" and not thread.is_al... |
server.py | import socket, multiprocessing, requests
# Function for starting and initating the server
def Setup(port=6667):
ServerObj = server(port)
return ServerObj
# Client class on the sever side
class client:
def __init__(self,ServerObj,conn,addr):
self.ServerObj = ServerObj
self.conn = conn
self.addr = addr
# Cli... |
test_collection.py | import numpy
import pandas as pd
import pytest
from pymilvus import DataType
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
from utils.utils import *
from... |
install_apk.py | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# drawElements Quality Program utilities
# --------------------------------------
#
# Copyright 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... |
shutdown_train.py | """Simulate the shutdown sequence on the train pi."""
import socket
import threading
import time
def talk_to_master(startShutdown, shutdownComplete):
with socket.socket() as sock:
sock.bind(('', 31337))
sock.listen()
conn, _ = sock.accept()
print('master pi has asked us to shutdown... |
threadpool.py | # ----------------------------------------------------------------------
# ThreadPool class
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Python modu... |
botslongpoll.py | from .api import api
from .session import session as ses
from .exceptions import mySword
from threading import Thread
import requests
class botsLongPoll(object):
polling = {}
ts = 0
def __init__(self, session):
if not isinstance(session, ses):
raise mySword("invalid session")
... |
fitting.py | '''
(c) 2011 Thomas Holder, MPI for Developmental Biology
License: BSD-2-Clause
'''
if not __name__.endswith('.fitting'):
raise Exception("Must do 'import psico.fitting' instead of 'run ...'")
from pymol import cmd, CmdException
from .mcsalign import mcsalign
def alignwithanymethod(mobile, target, methods=None... |
run.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import configparser
import datetime as dt
import logging
import sys
import time
from enum import Enum
from pathlib import Path
from threading import Lock, Thread
from typing import List, Optional, Tuple
import imageio
import numpy as np
import torch
import typer
from hum... |
task.py | import logging
import threading
from abc import ABC, abstractmethod
from ray.streaming.collector import OutputCollector
from ray.streaming.config import Config
from ray.streaming.context import RuntimeContextImpl
from ray.streaming.runtime import serialization
from ray.streaming.runtime.serialization import \
Pyth... |
test_server.py | import asyncio
import json
import os
import time
import urllib.parse
import uuid
from contextlib import ExitStack
from http import HTTPStatus
from multiprocessing import Process, Manager
from multiprocessing.managers import DictProxy
from pathlib import Path
from typing import List, Text, Type, Generator, NoReturn, Dic... |
smooth_reservoir_model.py | """Module for symbolical treatment of smooth reservoir models.
This module handles the symbolic treatment of compartmental/reservoir/pool
models.
It does not deal with numerical computations and model simulations,
but rather defines the underlying structure of the respective model.
All fluxes or matrix entries are s... |
launchnotebook.py | """Base class for notebook tests."""
from __future__ import print_function
from binascii import hexlify
from contextlib import contextmanager
import errno
import os
import sys
from threading import Thread, Event
import time
from unittest import TestCase
pjoin = os.path.join
from unittest.mock import patch
import r... |
TestPythonParaViewWebiPythonMPI.py | #/usr/bin/env python
# Global python import
import exceptions, traceback, logging, random, sys, threading, time, os
# Update python path to have ParaView libs
build_path='/Volumes/SebKitSSD/Kitware/code/ParaView/build-ninja'
sys.path.append('%s/lib'%build_path)
sys.path.append('%s/lib/site-packages'%build_path)
# Pa... |
main.py | from drive_controller import DriveController
from coordinates import Coordinates
from bolt_settings import BoltSettings
from referee_controller import RefereeController
from mainboard_controller import MainBoardController
import time
from datetime import datetime
import numpy as np
import cv2
import threading
import se... |
server3.py | # IMPORTS
import socket
import time
import threading
from ast import literal_eval
# SETTING THINGS UP
IP = "10.1.21.46"
PORT = 8002
# IP TO PRIORITIZE
SPECIAL_IP = "10.1.20.115"
# LIST OF SERVERS
servers = [(IP, 8000), (IP, 8001)]
# ORIGINAL LIST
L = [x for x in range(10)]
# CREATE SOCKET
serve... |
tps_bucket.py | #!/usr/bin/env python
# _*_ coding: utf-8 _*_
# @author: XYZ
# @file: tps_bucket.py
# @time: 2021.02.24 20:36
# @desc:
import time
import threading
from multiprocessing import Value
class TPSBucket:
def __init__(self, expected_tps):
self.number_of_tokens = Value('i', 0)
self.expected_tps = expect... |
LabPicsVesselInstanceReader.py | # Reader for vessel instance from the LabPics dataset
#############################################################################################
def show(Im):
cv2.imshow("show",Im.astype(np.uint8))
cv2.waitKey()
cv2.destroyAllWindows()
###############################################################... |
websocket_client.py | # cbpro/WebsocketClient.py
# original author: Daniel Paquin
# mongo "support" added by Drew Rice
#
#
# Template object to receive messages from the Coinbase Websocket Feed
from __future__ import print_function
import json
import base64
import hmac
import hashlib
import time
import logging
from threading import Thread
... |
interactive_client.py | #!/usr/bin/env python3
import logging
import sys
import time
import threading
from kik_unofficial.client import KikClient
from kik_unofficial.callbacks import KikClientCallback
from kik_unofficial.datatypes.xmpp.chatting import IncomingChatMessage, IncomingGroupChatMessage, IncomingStatusResponse, IncomingGroupStatus... |
cliente_udp.py | #!/usr/bin/python3
from socket import *
import threading
from threading import Thread
from time import sleep
import sys, ssl
RECV_BUFFER = 2048
global writer
chatting = False
if( len(sys.argv)<=1 or len(sys.argv)>4):
print( "Usage: ./servidor.py ip porta chat_port" )
sys.exit(0)
serverName = sys.argv[1]
server... |
multidownloadXkcd.py | __author__ = 'coiwaxa'
#! python3
# multidownloadXkcd.py - Downloads XKCD comics using multiple threads.
import requests, os, bs4, threading
os.makedirs('xkcd', exists_ok=True) # store comics in ./xkcd
def downloadXkcd(startComic, endComic):
for urlNumber in range(startComic,endComic):
#Download the page... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.