source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
Cold_Downloader.py | import tkinter
from tkinter import *
from tkinter.ttk import *
from PIL import Image, ImageTk
from threading import Thread
from pytube import YouTube, Playlist
import tkinter.filedialog
import subprocess
import os
from urllib import request, error
import io
from tkinter import messagebox
# variable to s... |
receiver.py | import os
import sys
import time
import tkinter as tk
import threading
import socket
import pyaudio
from tkinter import Button, PhotoImage, ttk
import selectors
from threading import Thread
import struct
from PIL import ImageTk, Image
LARGE_FONT= ("Verdana", 12)
logo_png = os.path.dirname(os.path.realpath(__file__))+'... |
trojan.py | import base64
import ctypes
import json
import multiprocessing
import os
import random
import re
import shutil
import sys
import threading
import time
import webbrowser
from urllib import request
import mouse
import psutil
import requests
import win32api
from playsound import playsound
# Disable/E... |
linkcheck.py | # -*- coding: utf-8 -*-
"""
sphinx.builders.linkcheck
~~~~~~~~~~~~~~~~~~~~~~~~~
The CheckExternalLinksBuilder class.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import socket
import codecs
import threading
from os import p... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
amqp_client.py | ########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... |
mutate_parr.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 31 12:15:57 2021
@author: akshat
"""
from __future__ import print_function
import rdkit
import random
import multiprocessing
from rdkit import Chem
from rdkit.Chem import MolFromSmiles as smi2mol
from rdkit.Chem import MolToSmiles as mol2smi
from se... |
appserver.py | import os
import sys
import re
import random
import time
import threading
import Queue
import hashlib
import logging
import shutil
import smtplib
import socket
import sqlite3
from email.mime.text import MIMEText
from dynamo.core.components.appmanager import AppManager
from dynamo.utils.classutil import get_instance
fr... |
train.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
test_minique.py | import threading
import pytest
from redis.client import Redis
from minique.api import cancel_job, enqueue, get_job
from minique.enums import JobStatus
from minique.models.queue import Queue
from minique.testing import run_synchronously
from minique_tests.jobs import (
reverse_job_id,
job_with_a_message,
m... |
scheduler.py | import json
import logging
import logging.config
import logging.handlers
import os
import pytz
import requests
import signal
import sys
import zmq
from datetime import date, datetime, time, timedelta
from pytz import timezone
from threading import Thread
from tornado.tcpserver import TCPServer
from zmq.eventloop.ioloo... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 23 22:39:27 2020
@author: abdulroqeeb
"""
import sys
import os
from PyQt5 import QtWidgets, QtCore, uic, QtWebEngineWidgets
from base import TraderPro
import threading
import datetime
from tproconfig import host, port, states
from order import Orde... |
a3c.py | # sources: https://medium.com/emergent-future/simple-reinforcement-learning-with-tensorflow-part-8-asynchronous-actor-critic-agents-a3c-c88f72a5e9f2
# https://jaromiru.com/2017/03/26/lets-make-an-a3c-implementation/
# https://github.com/openai/universe-starter-agent
'''
A3C ALGORITHM
Global network: input (s) --> net... |
httpd.py | #!/usr/bin/env python2
"""
Copyright (c) 2014-2019 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
import BaseHTTPServer
import cStringIO
import datetime
import httplib
import glob
import gzip
import hashlib
import io
import json
import mimetypes
import os... |
GrabImage.py | # -- coding: utf-8 --
import sys
import threading
import msvcrt
from ctypes import *
sys.path.append("../MvImport")
from MvCameraControl_class import *
g_bExit = False
# 为线程定义一个函数
def work_thread(cam=0, pData=0, nDataSize=0):
stOutFrame = MV_FRAME_OUT()
memset(byref(stOutFrame), 0, sizeof(stOutFrame))
... |
multithreading.py | import threading
import os
x=0
def process():
global x
print("process")
x+=1
def thread_task(lock):
"""
This function process each inference
"""
print("Task assigned to thread: {}".format(threading.current_thread().name))
print("ID of process running task: {}".format(os.getpid()))
... |
mqtt_tcp_example_test.py | import re
import os
import sys
import socket
from threading import Thread
import struct
import time
from tiny_test_fw import DUT
import ttfw_idf
msgid = -1
def get_my_ip():
s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s1.connect(("8.8.8.8", 80))
my_ip = s1.getsockname()[0]
s1.close()
re... |
mediocreTypewriter.py | #!/usr/bin/env python
# coding=utf-8
import sys
import threading
import time
import readchar
import serial
try:
from queue import Queue
except ImportError:
from Queue import Queue
# define a function that will be run in a thread and will
# read character input and buffer it
def readChars(q):
t = thread... |
test_sys.py | # -*- coding: iso-8859-1 -*-
import unittest, test.test_support
from test.script_helper import assert_python_ok, assert_python_failure
import sys, os, cStringIO
import struct
import operator
class SysModuleTest(unittest.TestCase):
def tearDown(self):
test.test_support.reap_children()
def test_origina... |
server.py | import socket
import threading
import time
CODE = 'utf-8'
HEADER_LEN = 16
IP = 'localhost'
PORT = 5001
# Лист подключенных clients - socket это ключ, user header и name это данные
clients_list = {}
# Для чтения данных используется функция recv, которой первым параметром нужно передать количество получаемых
# байт да... |
DtnAbstractSimEnvironment.py | import abc
import logging
import simpy
import os
from pathlib import Path
from threading import Thread
import time
import traceback
from simulator.utils.time_utils import sec2hms
class SimEnvironment(simpy.Environment, metaclass=abc.ABCMeta):
section_length = 100
logger_name = 'DTN Simulation'
header_msg ... |
create_flask_app.py | import os
import argparse
def check_for_pkg(pkg):
try:
exec("import " + pkg)
except:
os.system("pip3 install --user " + pkg)
def create_flask_app(app='flask_app', threading=False, wsgiserver=False, unwanted_warnings=False, logging=False, further_logging=False, site_endpoints=None, endpoints=None, request_endpoi... |
display.py | import os
import tempfile
import threading
import time
import webbrowser
from typing import ClassVar
class HTMLViewer:
"""A class for opening html text in browser."""
_THREAD_WAIT_TIME: ClassVar[float] = 5 # seconds
@staticmethod
def _remove_file_thread(fname: str) -> None:
time.sleep(HTMLV... |
networking.py | """
Defines helper methods useful for setting up ports, launching servers, and
creating tunnels.
"""
from __future__ import annotations
import fastapi
import http
import json
import os
import requests
import socket
import threading
import time
from typing import Optional, Tuple, TYPE_CHECKING
import urllib.parse
import... |
dinosaur.py | """
@author: Viet Nguyen <nhviet1009@gmail.com>
"""
import tensorflow as tf
import cv2
import multiprocessing as _mp
from src.utils import load_graph, dinosaur, detect_hands, predict
from src.config import RED, GREEN, YELLOW
tf.flags.DEFINE_integer("width", 640, "Screen width")
tf.flags.DEFINE_integer("height", 480, "... |
main.py | import traceback
import logging
from logging import handlers
import time
import argparse
import configparser
from datetime import datetime
from feed import CbFeed, CbFeedInfo, CbReport
from cbapi.response import CbResponseAPI
from threatconnect import ThreatConnect
from threatconnect.Config.FilterOperator import Filter... |
automated_users.py | import subprocess
import threading
import argparse
import os
def output_reader(proc):
for line in iter(proc.stdout.readline, b''):
print(line.decode('utf-8'), end='')
class Process(subprocess.Popen):
def __init__(
self,
filename,
password,
annotate_end... |
updown.py | """ Uplink and Downlink handling for communications layer
Downlink needs to happen in several stages. First, raw data is read from the adapter. This data is collected in a pool
and the pool is passed to a deframer that extracts frames from this pool. Frames are queued and sent to the ground
side where they are and pas... |
AE_DDPG.py | import random
import imageio
import datetime
import numpy as np
from collections import deque
import threading
import time
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dense, Lambda, Concatenate
from tensorflow.keras.optimizers import Adam
'''
Original pa... |
asyn.py | import asyncio
import functools
import inspect
import re
import os
import sys
import threading
from .utils import other_paths
from .spec import AbstractFileSystem
# this global variable holds whether this thread is running async or not
thread_state = threading.local()
private = re.compile("_[^_]")
def _run_until_do... |
sakal2.py | '''
Description : Multiprocessing V2
Function Date : 14 Mar 2021
Function Author : Prasad Dangare
Input : Int
Output : Int
'''
import os
import multiprocessing
from time import sleep
def Process1(no):
print("Process 1 is created")
print("PID of process 1 is :... |
java_gateway_test.py | # -*- coding: UTF-8 -*-
'''
Created on Dec 10, 2009
@author: barthelemy
'''
from __future__ import unicode_literals, absolute_import
from decimal import Decimal
import gc
from multiprocessing import Process
import os
from socket import AF_INET, SOCK_STREAM, socket
import subprocess
from threading import Thread
import... |
console.py | from __future__ import absolute_import, division, print_function
from io import TextIOBase
import sys
import threading
if sys.version_info[0] < 3:
from Queue import Queue
else:
from queue import Queue
def start_thread(runnable):
threading.Thread(target=lambda: runnable.run()).start()
class ConsoleInpu... |
email.py | # app/email.py
# данный модуль служит для асинхроной отправки электроной почты
# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
# :::::::::::::::::::::::::::::::::... |
server.py | from flask import Flask, render_template, request, redirect, url_for
import atexit
import threading
import pages
import settings
def close_running_threads():
settings.db.commit()
print ("Threads complete, ready to finish")
settings.plc.close()
app = Flask(__name__)
app.add_url_rule('/pkt', view_func=pages... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including witho... |
LookAtProxy.py | # tutorial to create a python module:
# http://doc.aldebaran.com/2-1/dev/python/reacting_to_events.html#python-reacting-to-events
# http://doc.aldebaran.com/2-1/dev/python/running_python_code_on_the_robot.html?highlight=autoload
# or
# http://doc.aldebaran.com/2-5/dev/libqi/guide/py-service.html?highlight=onbang
# an... |
asyncPool.py | """
.. Hint::
asyncio 实现的协程池 asyncio为python原生支持
调用时需要引入
import asyncio
还有另外一个版本的实现 asyncPoolGevent 为 Gevent实现协程
.. literalinclude:: ../../../pyefun/asyncPool/asyncPool_test.py
:language: python
:caption: 代码示例
:linenos:
"""
import asyncio
import queue
from concurrent.futures import Thr... |
manager.py | #!/usr/bin/env python3
import os
import time
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import datetime
import textwrap
from typing import Dict, List
from selfdrive.swaglog import cloudlog, add_logentries_handler
from common.basedir import BASEDIR, PARAMS
from common.android im... |
rpc_test.py | import concurrent.futures
import contextlib
import json
import os
import sys
import threading
import time
from collections import namedtuple
from functools import partial
from threading import Event
from threading import Lock
from unittest import mock
import torch
import torch.nn as nn
import torch.distributed as dis... |
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 datetime
import sys
import cStringIO
import time
import threa... |
7_rms_wound_wait_gui.py | from functools import reduce
from sys import *
import numpy as np
import random as r
import ping_code as pc
import socket
import struct
import subprocess as sp
import threading
from threading import Thread
import ast
import time
import datetime as dt
import os
import getpass as gp
import psutil
from drawnow import *
fr... |
mem_reader.py | #!/usr/bin/python3
from time import time, sleep
from threading import Thread, Event
import argparse
def _waitinput(event):
input('Press any key to exit')
event.set()
if __name__ == '__main__':
parser = argparse.ArgumentParser('Memory measuring tool')
parser.add_argument('file', help='File to save da... |
conftest.py | import fcntl
import inspect
import json
import os
import platform
import re
import shutil
import signal
import stat
import subprocess
import sys
import tempfile
import time
from multiprocessing import Process
import pytest
from unit.check.chroot import check_chroot
from unit.check.go import check_go
from unit.check.i... |
WebHTTPServer.py | from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn
import time
import threading
import logging
_HTTP_PORT = 8030
def _getModulePath( path ):
import os.path
return os.path.dirname( __file__ ) + '/' + path
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
... |
zookeeper_basic.py | # Copyright 2015 LinkedIn Corp.
#
# 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.... |
roputils.py | #!/usr/bin/env python
import sys
import os
import re
import struct
import socket
import select
import random
import tempfile
from subprocess import Popen, PIPE
from threading import Thread, Event
from telnetlib import Telnet
from contextlib import contextmanager
def int16(x):
if isinstance(x, (list, tuple)):
... |
test-server-metrics-bridge.py | #!/usr/bin/env python3
# Creates a ghostunnel. Ensures that /_status endpoint works.
from subprocess import Popen
from common import *
import urllib.request, urllib.error, urllib.parse, socket, ssl, time, os, signal, json, http.server, threading
received_metrics = None
class FakeMetricsBridgeHandler(http.server.Bas... |
biggest_sales.py | import threading
import random
import time
from app import models
class GetSales(object):
sale = random.randint(10, 30000)
finished = False
def __init__(self):
thread = threading.Thread(target=self.run, args=())
thread.daemon = True # Daemonize thread
t... |
celery.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 use ... |
pychecksum.py | # The MIT License (MIT)
#
# Copyright (c) 2018 Bryan San Juan Tavera
#
# 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... |
Hiwin_RT605_ArmCommand_Socket_20190627192736.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
map_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... |
web_control.py | #!/usr/bin/env python
# coding:utf-8
import urlparse
import os
import cgi
import time
import hashlib
from xlog import getLogger
import threading
xlog = getLogger("x_tunnel")
import simple_http_server
import global_var as g
import proxy_session
from cloudflare_front import web_control as cloudflare_web
from tls_relay... |
Hiwin_RT605_ArmCommand_Socket_20190627204159.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
_runner.py | # Copyright 2015 gRPC authors.
#
# 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... |
fast_scan_ports.py | import threading
import socket
import os
import subprocess
import sys
import psutil
import time
from colorama import Fore, Back, Style
print("""
Для данного сканирования у вас должен быть установлен Nmap
""")
target = str(input("[ ====> ] IP/HOST цели : "))
# Чтобы использовать инструмент на постоянной осно... |
apex_dqn.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import multiprocessing as mp
import tensorflow as tf
import numpy as np
import argparse
import time
import gym
import random
from actor import Actor
from learner import Learner
def actor_work(args, queues, num):
# with tf.device('/cpu:0'):
sess = tf.In... |
test_user_session.py | import json
import os
import threading
import unittest
from http.server import BaseHTTPRequestHandler, HTTPServer
from test.support import EnvironmentVarGuard
from urllib.parse import urlparse
from kaggle_session import UserSessionClient
from kaggle_web_client import (_KAGGLE_URL_BASE_ENV_VAR_NAME,
... |
ops_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... |
mail_service.py | from threading import Thread
from flask_mail import Mail, Message
from resources.errors import InternalServerError
mail = Mail(app=None)
app = None
def initialize_mail_service(appiclation):
global mail
global app
mail = Mail(app=appiclation)
app = appiclation
def send_async_email(app, msg, mail):
... |
attacker.py | import threading
import requests
import time
def kupon_request():
global toplam_req
x = requests.get("http://127.0.0.1:8000/kupon_kullan", verify=False)
print(x.text)
toplam_req += 1
toplam_req = 0
num = 500
for i in range(num):
threading.Thread(target=kupon_request).start()
time.sleep(2)
print(s... |
auto.py | import os
import glob
import time
import threading
import re
from .util import now, CasedFunction
try:
from .controller import Controller
USE_TK = True
except Exception:
from .altcontroller import Controller
USE_TK = False
class AutoAnalyzer:
def __init__(self, path, recursive=False, include=... |
server.py | """
Server
======
Contains the directives necessary to start the DPF server.
"""
from threading import Thread
import io
import platform
import logging
import time
import os
import socket
import subprocess
import grpc
import psutil
import weakref
import copy
from ansys import dpf
from ansys.dpf.core.misc import find_an... |
pyFolderLock.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import os
import base64
import joblib
import threading
import multiprocessing
import psutil
import logging
import argparse
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor, wait
from threading import Event, Thread
from Crypto.Cipher i... |
console.py | from __future__ import absolute_import, division, print_function
import asyncio
import binascii
import copy
from code import InteractiveConsole
import json
import os
import time
from decimal import Decimal
from os.path import exists, join
import pkgutil
import unittest
import threading
import random
import string
from... |
batch_reranking.py | import os
import time
import torch
import queue
import threading
from collections import defaultdict
from colbert.utils.runs import Run
from colbert.modeling.inference import ModelInference
from colbert.evaluation.ranking_logger import RankingLogger
from colbert.utils.utils import print_message, flatten, zipstar
fro... |
test3.py | import transcribe
import cv2
import threading
import testRecordAudio
import time
import combineAudioVideo
class Test2:
def __init__(self, subtitle, isRecognizing):
self.subtitle = subtitle
self.isRecognizing = isRecognizing
def stt(self):
# The duration in seconds of the video captured... |
cli.py | import logging
import os
import threading
import webbrowser
from typing import Any, Dict, List
import toml
import typer
import uvicorn
from fps_uvicorn.config import UvicornConfig
from fps.config import Config
from fps.logging import configure_loggers, get_loggers_config
from fps.utils import merge_dicts
app = typer... |
_helper.py | # Copyright 2016-2019 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
python_pg1.py | # %%
# to test impots
import sys
from typing import List, NewType, Any
for path in sys.path:
print(path)
# %%
def __path_bn_layer_for_functional_eval(self, module, input):
for attr_str in dir(module):
target_attr = getattr(module, attr_str)
print(target_attr)
if type(target_attr) == ... |
rocket.py | # -*- coding: utf-8 -*-
# This file is part of the Rocket Web Server
# Copyright (c) 2011 Timothy Farrell
# Modified by Massimo Di Pierro
# Import System Modules
import sys
import errno
import socket
import logging
import platform
from gluon._compat import iteritems, to_bytes, to_unicode, StringIO
from gluon._compat... |
stolen_token_generate.py | # Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. licenses this file to you 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/LICE... |
index.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import hashlib
import logging
import os
import shutil
import subprocess
import tempfile
try:
from threading import Thread
except ImportErr... |
test_shell_interactive.py | #!/usr/bin/env impala-python
# -*- coding: utf-8 -*-
#
# 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 Apach... |
DOS_py2.py | import threading
import urllib2
import random as r
import ssl
mn = 0
mx = 0
d = 0
i = 1
agents_array=[]
target = raw_input('URL: ')
ctx = ssl._create_unverified_context() #Create context
with open("user-agents.txt") as file:
for line in file:
agents_array.append(line)
def send_req(f):
global target
try:
req=u... |
test_dbapi.py | # pysqlite2/test/dbapi.py: tests for DB-API compliance
#
# Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of t... |
funProf.py |
from threading import Semaphore, Thread
from time import sleep
from random import random,choice
def Asesoria(id_estudiante, cubiculo, profesor):
print("\tllego el Estudiante %d" % id_estudiante)
sleep(random())
cubiculo.acquire() # semáforo que permite regular que solo 3 alumnos estén dentro del cubículo
p... |
gui.py | import json
import cv2
import base64
import threading
import time
from datetime import datetime
from websocket_server import WebsocketServer
import logging
# Graphical User Interface Class
class GUI:
# Initialization function
# The actual initialization
def __init__(self, host, hal):
t = threading... |
ConvertToUTF8.py | # -*- coding: utf-8 -*-
import sublime, sublime_plugin
import sys
import os
if sys.version_info < (3, 0):
from chardet.universaldetector import UniversalDetector
NONE_COMMAND = (None, None, 0)
ST3 = False
else:
from .chardet.universaldetector import UniversalDetector
NONE_COMMAND = ('', None, 0)
ST3 = True
impor... |
chatServer.py | #!/usr/bin/env python3
"""Server for multithreaded (asynchronous) chat application."""
from socket import *
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
def accept_incoming_connections():
"""Sets up handling for incoming clients."""
while True:
client, client_address = ... |
writer.py | #
# Copyright (c) 2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
_background_server.py | # Note: the code in this file is adapted from source at
# https://github.com/googlecolab/colabtools/blob/master/google/colab/html/_background_server.py
# The following is its original license:
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ex... |
WebSocketServer.py | import time
import threading
import logging
from SimpleWebSocketServer import WebSocket, SimpleWebSocketServer
_WS_PORT = 8037
_onMessage = None
class WebSocketHandler(WebSocket):
def handleMessage(self):
if self.data is None:
self.data = ''
# echo message back to client
# self.sendMessage(str(self.data))
... |
TP81.py | #! /usr/bin/env python3
#encoding: UTF-8
import threading, random, time
# Exemple lancement de thread
# def f(x, y):
# # fonction à exécuter sur un thread à part
# # ...
# pass
#
# # création du thread
# th = threading.Thread(target=f, kwargs={'x' : valeur1, 'y' : valeur2})
# # démarrage du thread
# th.s... |
__main__.py | """
Main script that starts the framework
"""
from threading import Thread
from config import FrameworkConfiguration
from discovery import network_analyzer, yeelight_analyzer
from learning import learning_yeelight
from discovery.network_analyzer import load_report_to_file
if __name__ == '__main__':
# Discover... |
scheduler.py | import time
from multiprocessing import Process
from proxypool.api import app
from proxypool.getter import Getter
from proxypool.tester import Tester
from proxypool.setting import *
class Scheduler():
def schedule_tester(self, cycle=TESTER_CYCLE):
"""
定时测试代理
"""
tester = Tester()
... |
lenovo_fix.py | #!/usr/bin/env python3
from __future__ import print_function
import argparse
import configparser
import glob
import gzip
import os
import re
import struct
import subprocess
import sys
from collections import defaultdict
from datetime import datetime
from errno import EACCES, EPERM
from multiprocessing import cpu_count... |
sync_rl.py |
import multiprocessing as mp
import time
import torch.distributed
from rlpyt.runners.minibatch_rl import MinibatchRl, MinibatchRlEval
from rlpyt.utils.seed import make_seed
from rlpyt.utils.collections import AttrDict
from rlpyt.utils.quick_args import save__init__args
from rlpyt.utils.synchronize import drain_queue,... |
gpio_server.py | import socket
import threading
from queue import Queue
import time
import struct
class GPIOServer:
""" Create a TCP server to control/manipulate GPIO pins on the client (Pi). """
def __init__(self, host_ip=socket.gethostbyname(socket.gethostname()), port=5000):
""" Class constructor.
Args:
... |
test_decorator_list.py | # -*- coding: utf-8 -*-
import unittest
from lutino.caching import create_cache_key
from lutino.caching.tests.base import CachingTestCase
from datetime import datetime
import threading
__author__ = 'vahid'
def th():
return threading.current_thread().name
class TestCacheDecoratorList(CachingTestCase):
@clas... |
mokylin_server.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# data collector
# 数据收集服务端
# 时间:2014-10-21
#
import multiprocessing
import socket
import pymongo
import datetime
import json
def insert_into_mongodb(data, address, dbconfig):
dbaddress = dbconfig[0]['dbaddress']
dbport = dbconfig[1]['dbport']
dbuser = dbconfig[... |
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_... |
_app.py | # coding=utf-8
from __future__ import print_function
import inspect
import logging
import numbers
import os
import sys
import threading
import time
import warnings
from os.path import isfile
import numpy as np
from phi import struct, math
from phi.field import CenteredGrid, Field, StaggeredGrid, Scene
from phi.physic... |
virshbmc.py | #!/usr/bin/env python
# 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, software
... |
renderer.py | import pygame
from threading import Thread
size=int(input("input size: "))
class rendered():
def __init__(self,color,pos,radious) -> None:
self.color=color
self.pos=pos
self.rad=radious
def move(self,new):
self.pos = (self.pos[0]+new[0],self.pos[1]+new[1])
class enemy(rendered):... |
test_partition.py | import threading
import pytest
from base.partition_wrapper import ApiPartitionWrapper
from base.client_base import TestcaseBase
from common import common_func as cf
from common import common_type as ct
from utils.util_log import test_log as log
from common.common_type import CaseLabel, CheckTasks
from common.code_mapp... |
test_sigma_dut.py | # Test cases for sigma_dut
# Copyright (c) 2017, Qualcomm Atheros, Inc.
# Copyright (c) 2018-2019, The Linux Foundation
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import binascii
import errno
import fcntl
import hashlib
import logging
logger = logging.getLog... |
thread3.py | # Python Program To Pass Argument To A Function And Execute It Using A Thread
'''
Function Name : Pass Argument To A Function And Execute It Using A Thread
Function Date : 3 Oct 2020
Function Author : Prasad Dangare
Input : String
Output : String
'''
from threading import* #... |
pyshell.py | #! /usr/bin/env python3
import sys
if __name__ == "__main__":
sys.modules['idlelib.pyshell'] = sys.modules['__main__']
try:
from tkinter import *
except ImportError:
print("** IDLE can't import Tkinter.\n"
"Your Python may not be configured for Tk. **", file=sys.__stderr__)
raise SystemExit(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.