source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
run.py | import threading
import traceback
if __name__ == '__main__':
def saveError(error):
from datetime import date
today = date.today().isoformat()
print(error)
file = open('./log.txt', 'a')
file.writelines(today + ' ' + repr(error) + '\n\n')
file.close()
try:
... |
worker.py | import logging
import pickle
import traceback
from base64 import b64decode
from uuid import uuid4
from enum import Enum
from datetime import datetime
from multiprocessing import Process, Queue
from threading import Thread
from collections import defaultdict
from . import storage
from . import eventsources
from . impor... |
run-tests.py | #!/usr/bin/env python
#
# 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 "Li... |
ssvgd.py | import numpy as np
from scipy.spatial.distance import pdist, squareform
weights = []
class SVGD():
def __init__(self):
pass
def svgd_kernel(self, theta, h = -1):
sq_dist = pdist(theta)
pairwise_dists = squareform(sq_dist)**2
if h < 0: # if h < 0, using median trick
... |
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... |
pu.py | import socket
import multiprocessing
import threading
import sys
import select
import os
import queue
import time
import torch.nn as nn
import torch
import numpy as np
import pickle
SERVER_ADDRESS='./pip1.socketpipe'
MODE = 1 #1 for server and 0 for client
def subprocess(mode,que,stop):
if mode == 1:
t... |
test_dispatcher.py | import errno
import multiprocessing
import os
import platform
import shutil
import subprocess
import sys
import threading
import warnings
import inspect
import pickle
import weakref
from itertools import chain
from io import StringIO
import numpy as np
from numba import njit, jit, generated_jit, typeof
from numba.cor... |
commonarea.py | from typing import Any, Dict, Iterable, List, Tuple
import time
import threading
import random
import queue
import pygame
from .. import binds
from .. import constants as c
from .. import control
from .. import gameinfo
from .. import setup
from .. import tools
from .. components import item, non_player_controlled,... |
miniterm.py | #!/home/brightkoech/Code/devnet_work/venv3/bin/python3
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
import threading
import serial
... |
qot_coreapi.py | # @file qot_coreapi.py
# @brief The Core Python application programmer interface to the QoT stack
# @author Anon D'Anon
#
# Copyright (c) Anon, 2018.
# Copyright (c) Anon Inc., 2018.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that... |
pid_file_test.py | import os
import string
import unittest
from os.path import join
from random import choice
from signal import SIGINT
from tempfile import gettempdir
from time import sleep
from multiprocessing import Process
from rocky.process import pid_file, stoppable
def normal_run(pf):
with pid_file(filename=pf) as p, stoppab... |
main.py | from discord.ext import commands
import subprocess
import threading
import aiofiles
import discord
import asyncio
import aiohttp
import random
import ctypes
import re
import os
from keep import keep
token = 'ODY2NDMyMTYyODk0ODM5ODE4.YPSd1Q.EOTh9MHHi0goE2VRiHNNPiDTCaA'
prefix = '/'
intents = discord.In... |
test_list_jy.py | import unittest
import random
import threading
import time
from test import test_support
import test_list
if test_support.is_jython:
from java.util import ArrayList
from java.lang import Integer, String
class ListTestCase(unittest.TestCase):
def test_recursive_list_slices(self):
x = [1,2,3,4,5]
... |
rtest.py | #!/usr/bin/python3
"""Copyright 2021 Advanced Micro Devices, Inc.
Run tests on build"""
import re
import os
import sys
import subprocess
import shlex
import argparse
import pathlib
import platform
from genericpath import exists
from fnmatch import fnmatchcase
from xml.dom import minidom
import multiprocessing
import t... |
console.py | # -*- coding: utf-8 -*-
# *******************************************************
# ____ _ _
# / ___|___ _ __ ___ ___| |_ _ __ ___ | |
# | | / _ \| '_ ` _ \ / _ \ __| | '_ ` _ \| |
# | |__| (_) | | | | | | __/ |_ _| | | | | | |
# \____\___/|_| |_| |_|\___|\__(_)_| |_| |_|_|... |
multiuser_mark.py | import prodigy
from multiprocessing import Process
from time import sleep
from prodigy.recipes.ner import batch_train
import atexit
from pathlib import Path
import datetime as dt
from prodigy.components import printers
from prodigy.components.loaders import get_stream
from prodigy.core import recipe, recipe_args
from ... |
drupalgeddonrce2.py | from queue import Queue
from urllib.parse import urlparse
from threading import Thread
import requests
import threading
import re
import os
from requests import get
from requests import post
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureReques... |
s3_content_type_fixer.py | import requests
from boto.s3.connection import S3Connection
import argparse
import multiprocessing
import sys
import mimetypes
BLOCK_TIME = 60 * 60
def find_matching_files(bucket, prefixes):
"""
Returns a set of files in a given S3 bucket that match the specificed file
path prefixes
"""
return set... |
HackRequest.py | import copy
import gzip
import queue
import socket
import ssl
import threading
import time
import zlib
from http import client
from urllib import parse
class HackError(Exception):
def __init__(self, content):
self.content = content
def __str__(self):
return self.content
def extract_dict(tex... |
routerhunter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================================================================================
# Scanner RouterHunterBR v2.0 - InurlBrasil Team
# Tool used to find and perform tests in vulnerable routers on the internet.
... |
test_unix_events.py | """Tests for unix_events.py."""
import collections
import gc
import errno
import io
import os
import pprint
import signal
import socket
import stat
import sys
import tempfile
import threading
import unittest
from unittest import mock
if sys.platform == 'win32':
raise unittest.SkipTest('UNIX only')
import asynci... |
conftest.py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... |
worker.py | import signal
import logging
from threading import Thread
from banal import ensure_list
from abc import ABC, abstractmethod
from servicelayer import settings
from servicelayer.jobs import Stage
from servicelayer.cache import get_redis
from servicelayer.util import unpack_int
log = logging.getLogger(__name__)
INTERVAL... |
LearnGUI_V2.py | from tkinter import *
from tkinter import messagebox, filedialog
from Modules import PublicModules as libs
from Modules import LSTM_Config as cf
import cv2
import threading
from PIL import Image
from PIL import ImageTk
from Modules.MyComponents import *
from tkcalendar import Calendar
from Modules.MyThreading import My... |
__init__.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Logging utils
"""
import os
import warnings
from threading import Thread
import pkg_resources as pkg
import torch
from torch.utils.tensorboard import SummaryWriter
from utils.general import colorstr, emojis
from utils.loggers.wandb.wandb_utils import Wand... |
CNNSlow.py | import numpy as np
import math
from matplotlib import pyplot as plt
import multiprocessing
class Cnn:
__imgWidth = 0
__imgHeight = 0
__strideHor = 0
__strideVert = 0
__fieldWidth = 0
__fieldHeight = 0
__firstLayerCol = 0
__firstLayerRows = 0
__inputWeights = None
__firstLayerO... |
sniffer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from logging import getLogger, ERROR
from random import choice
from threading import Thread
from scapy.all import *
from scapy.contrib.wpa_eapol import WPA_key
import devices
import globalsx
import packets
import clients
import networks
getLogger("scapy.runtime").setLe... |
utils.py | # -*- coding: utf-8 -*-
# Copyright 2012-2021 CERN
#
# 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 a... |
db_engine.py | import os
import sys
import time
import schedule
import threading
import pymongo
from utils import initlogger
from pymongo import MongoClient
from API.alert import send_alert
from API.tickerprice import StockTicker
from config.configkeys import config_keys
def encode_price(price):
return str(price).replace(".", ... |
test_urllib.py | """Regression tests for urllib"""
import collections
import urllib
import httplib
import io
import unittest
import os
import sys
import mimetools
import tempfile
from test import test_support
from base64 import b64encode
def hexescape(char):
"""Escape char as RFC 2396 specifies"""
hex_repr = hex(ord(char))[... |
main.py | #! /usr/bin/python
# -*- coding: UTF-8 -*-
# Created Time: 2017-03-08 21:02:02
# Last modified: 2017-03-08 22:56:20
#
from pprint import pprint
import time
import threading
import connection
__metaclass__ = type
class MachineLearning:
def __init__(self):
print "python module init !"
self.threads... |
utils.py | """
Simple library for multiple views game aplication with pygame
File: utils.py
Date: 08.02.2022
Github: https://github.com/0xMartin
Email: martin.krcma1@gmail.com
Copyright (C) 2022 Martin Krcma
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and ... |
processv2.py | # Converting bam to read information
# Cell barcode, UMI, gene alignment, and counts
import os
import sys
from multiprocessing import Process
import pandas as pd
from collections import defaultdict
import gzip
#from pylab import *
import numpy as np
import pickle
#import HTSeq
import pysam
PATH = os.path.dirname(__... |
chatclient1.py | import socket
import threading
import sys
"""
Stop at Ctrl+Break
"""
PORT = 50000
BUFFSIZE = 4096
def server_handler(client):
while True:
try:
data = client.recv(BUFFSIZE)
print(data.decode("utf-8"))
except:
sys.exit()
client.close()
cl... |
receiver.py | import pyaudio
import wave
import socket
import sys
from threading import Thread
frames = []
def play(stream, CHUNK):
print("playing")
while True:
for data in frames:
stream.write(data)
print("a")
def receive(CHUNK):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)... |
main.py | """
Home-Monitor:
AI system for the detection of anomalous and possibly recognizersmful events for people.
Written by Gabriel Rojas - 2019
Copyright (c) 2019 G0 S.A.S.
See LICENSE file for details
Class information:
Main class to start whole system
"""
__version__ = "1.0.0"
import sys
import lo... |
time_management_bot.py | #!/usr/bin/env python
import logging
import threading
import time
import random
import os
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
CallbackContext,
)
# Enable logging... |
thread_queue_test.py | #!/usr/bin/python
# coding=utf-8
# 通过queue的方式进行线程间同步
from queue import Queue
import time
import threading
def get_detail_html(queue):
#爬取文章详情页
while True:
url = queue.get()
# for url in detail_url_list:
print("get detail html started")
time.sleep(2)
print("get detail ... |
pytest_advanced_ota.py | # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import http.server
import multiprocessing
import os
import random
import socket
import ssl
import struct
import subprocess
from typing import Callable
import pexpect
import pytest
from pytest_embedded imp... |
eventsources.py | import threading
import requests
import datetime
import logging
import time
from urllib.parse import urlparse
import esppy.espapi.tools as tools
from xml.etree import ElementTree
class EventSources(object):
def __init__(self,connection,delegate = None):
self._connection = connection
self._delega... |
main.py | # -*- coding: utf-8 -*-
import os.path
import traceback
import sys
import urllib
import json
import copy
import datetime
import time
import multiprocessing
import random
import subprocess
from urllib.parse import urlsplit
from urllib.parse import urlencode
from retrying import retry
import requests
from flask impor... |
buttontest_v2.py | from gpiozero import Button
from time import sleep
import tkinter as tk
#from tkinter import *
from threading import Thread
button17 = Button("GPIO17")
button22 = Button("GPIO22")
button23 = Button("GPIO23")
button27 = Button("GPIO27")
class buttonpush():
def __init__(self):
#Thread.__init__(self)
... |
plugin.py | # from __future__ import print_function
import datetime
import enum
import glob
import multiprocessing
import os
import socket
from time import gmtime, sleep, strftime
import ujson
import sys
import signal
from pyepsolartracer.client import EPsolarTracerClient
from pyepsolartracer.registers2 import (coils, registersCha... |
_a4c_pre_configure_source.py |
from cloudify import ctx
from cloudify import utils
from cloudify.exceptions import NonRecoverableError
from StringIO import StringIO
import base64
import os
import platform
import re
import subprocess
import sys
import time
import threading
import platform
import json
def convert_env_value_to_string(envDict):
... |
retrieve_all_pushes_with_iterator_example.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Example retrieve pushes with iterator.
"""
import asyncio
import datetime
import os
import pprint
import sys
import threading
import tkinter as tk
import traceback
from functools import partial
import queue
from typing import List, Callable
from asyncpushbullet.async_... |
do.py | #!/usr/bin/env python
## -*- mode: python -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
from os.path import join, abspath, realpath
import shutil
import tempfile
import subprocess
from subprocess import STDOUT
import platform
impor... |
emails.py | # -*- coding: utf-8 -*-
"""
:author: Grey Li (李辉)
:url: http://greyli.com
:copyright: © 2018 Grey Li <withlihui@gmail.com>
:license: MIT, see LICENSE for more details.
"""
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from LoveAlbumy.extensi... |
mpi.py |
"""
A work manager which uses MPI to distribute tasks and collect results.
"""
import logging, re, threading
from collections import deque
from mpi4py import MPI
import work_managers
from work_managers import WorkManager, WMFuture
log = logging.getLogger(__name__)
class Task:
# tasks are tuples of (task_id, ... |
client.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
import websocket
import threading
from parlai.core.params import ParlaiParser
from parlai.scripts.interactiv... |
app.py | from flask import Flask, render_template, send_from_directory, request
from multiprocessing import Process, Queue
from dqc.main import run_on_network
app = Flask(__name__)
app.debug = True
@app.route('/')
def hello():
return render_template('index.html')
@app.route('/js/<path:path>')
def send_js(path):
re... |
entry_point.py | import sys
import os
import uuid
import flask
import logging
import pkgutil
import multiprocessing
import time
import threading
import importlib
from lithops.version import __version__
from lithops.worker import function_invoker
from lithops.config import DOCKER_FOLDER
from lithops.config import extract_compute_config... |
application.py | import os
import threading
import psutil
import subprocess
import tkinter as tk
from tkinter import PhotoImage
from tkinter import messagebox
import requests
import instaloader
from instaloader import Post, Profile
from PIL import Image, ImageTk
from customWidgets import CustomEntry, CountLabel, CustomLabel, Credenti... |
mp_menu.py | #!/usr/bin/env python
'''
menu handling widgets for wx
Andrew Tridgell
November 2013
'''
from MAVProxy.modules.lib import mp_util
class MPMenuGeneric(object):
'''a MP menu separator'''
def __init__(self):
pass
def find_selected(self, event):
return None
def _append(self, menu):
... |
HydrusPaths.py | import collections
import os
import psutil
import re
import send2trash
import shlex
import shutil
import stat
import subprocess
import threading
import traceback
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusTh... |
utils.py | import asyncio
import atexit
from collections import deque
from contextlib import contextmanager
from datetime import timedelta
import functools
from hashlib import md5
import inspect
import json
import logging
import multiprocessing
from numbers import Number
import os
import re
import shutil
import socket
from time i... |
Methods.py | from threading import Thread
import socket
from time import sleep
from sys import byteorder
from Config import Config
import configparser
from Row import Row
import os
import sys
def bell_indicators(MAX_BELLS,
INDICATE_BELL_NUMBER_SHIFT,
INDICATE_BELL_HANDSTROKE,
... |
test_http.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl import YoutubeDL
from youtube_dl.compat import compat_http_server, comp... |
test_scheduler.py | from datetime import datetime, timedelta
import os
import signal
import time
from threading import Thread
from rq import Queue
from rq.compat import as_text
from rq.job import Job
from rq_scheduler import Scheduler
from rq_scheduler.utils import to_unix, from_unix, get_next_scheduled_time
from tests import RQTestCase... |
request_handler.py | import socketserver
from threading import Thread
from messenger_server.database import *
from messenger_server.user_management import UserManager
from messenger_server.user_notifying import UserNotifier
from messenger_server.responses import Responses
from messenger_server.config import *
class InvalidRequestError(Ex... |
SubprocessingModified.py | # hacked on copy of subprocessing taken from python2.7
# subprocess - Subprocesses with accessible I/O streams
#
# For more information about this module, see PEP 324.
#
# This module should remain compatible with Python 2.2, see PEP 291.
#
# Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
#
# Licens... |
primes_queue_jobs_feeder_thread.py | import math
import time
import multiprocessing
from multiprocessing import Pool
import threading
import argparse
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_... |
IperfThread.py | import logging
import pexpect
import subprocess
import threading
from multiprocessing import Process
import time
import sys
class BandwidthMeter():
def __init__(self, server, server_user, server_pass, client, client_user, client_pass, client_command, server_command):
#threading.Thread.__init__(self)
... |
battery_sim_server.py | #! /usr/bin/env python
import time
import rospy
from multiprocessing import Process
from std_msgs.msg import Int32, Bool
import actionlib
from battery_simulator.msg import battery_simAction, battery_simGoal, battery_simResult, battery_simFeedback
def batterySim():
battery_level = 100
result = battery_simResult()
... |
writer.py | import os
import time
from threading import Thread
from queue import Queue
from collections import deque
import cv2
import numpy as np
import torch
import torch.multiprocessing as mp
from alphapose.utils.transforms import get_func_heatmap_to_coord
from alphapose.utils.pPose_nms import pose_nms, write_json
from alphap... |
test_util.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... |
omni_base_driver.py | #!/usr/bin/python
import rospy
import tf
import time
import sys
import math
from operator import add
import serial
import string
import threading
import geometry_msgs.msg
from geometry_msgs.msg import Twist
from geometry_msgs.msg import Vector3
#from geometry_msgs.msg import Point
from nav_msgs.msg import Odometry
from... |
email.py | from threading import Thread
from flask import render_template
from flask_mail import Message
from app import app, mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, reci... |
process_replay.py | #!/usr/bin/env python3
import importlib
import os
import sys
import threading
import time
import signal
from collections import namedtuple
import capnp
from tqdm import tqdm
import cereal.messaging as messaging
from cereal import car, log
from cereal.services import service_list
from common.params import Params
from ... |
visualization.py | from io import BytesIO
from threading import Thread
from rigid_body_motion.core import _resolve_rf
def hex_to_rgba(h):
""" Convert hex color string to ColorRGBA message.
Parameters
----------
h : str
Hex color string in the format #RRGGBBAA.
Returns
-------
c : ColorRGBA
... |
polybeast_learner.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 ... |
base_web.py | __doc_all__ = []
import unittest
import sys
import exceptions
import datetime
import time
import random
import threading
import thread
import wsgiref.validate
import httplib
from cStringIO import StringIO
from cogen.common import *
from cogen.web import wsgi, async
sys.setcheckinterval(0)
#~ httpli... |
pyshell.py | #! /usr/bin/env python3
import sys
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(1)
# Valid arguments for the ...Awareness call below are defined in the following.
# ht... |
tools.py | from .logger import logging
logger = logging.getLogger(__name__)
def shell(args, **kwargs):
"""
Replacement for subprocess.run on platforms without python3.5
:param args: Command and parameters in a list
:return: A tuple with (command output, return code)
"""
import subprocess
output, re... |
cli_session.py | import sys, time
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty # python 3.x
ON_POSIX = 'posix' in sys.builtin_module_names
class CliSession():
def __init__(self, process):
self.process = process
self.stdout = Queue()
... |
utils.py | #!/usr/bin/env python
# Lint as: python3
"""This file contains various utility classes used by GRR."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import errno
import functools
import getpass
import io
import os
im... |
robot.py | ##=========================================##
##=============PROJECT INFO================##
##=========================================##
##===Auther : SM02 Present=================##
##===Date : 17/03/2022===================##
##===About : attitude stutas on cmatrix===##
##===Version : 1.0 auto===============... |
test_callbacks.py | import os
import multiprocessing
import numpy as np
import pytest
from numpy.testing import assert_allclose
from csv import reader
from csv import Sniffer
import shutil
from keras import optimizers
from keras import initializers
from keras import callbacks
from keras.models import Sequential, Model
from keras.layers i... |
h.py | import os
apikey = os.environ['key']
apisecret = os.environ['secret']
divisor=100
LEV_MAX = 7.5
import requests
import math
from datetime import timedelta
import datetime
import sys
import threading
import linecache
from time import sleep
coinsto = ['BTC', 'ETH', 'XRP', 'BCH', 'LTC', 'EOS', 'L... |
renamed by dhx.py | #!/usr/bin/env python3
#-*- coding: utf-8 -*-
import sys
import socket
import time
import random
import threading
import getpass
import os
import urllib
import json
from time import sleep
nicknm = "Rename By Dhx ->Dhiya-API"
mt = """\033[36mService under \033[0;34mmaintance"""
methods = """
\033[0;3... |
dual_blob_store.py | #!/usr/bin/env python
# Lint as: python3
"""A BlobStore proxy that writes to two BlobStores."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import logging
import queue
import threading
import time
from typing import Callable, Dict, Iterable, Optional,... |
_channel.py | # Copyright 2016 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... |
gui.py | '''
Created on 24.10.2016
@author: simon
'''
import tkSimpleDialog
from threading import Thread
from traceback import print_exc
bufflen=50000
current_bufflen=bufflen
plt_skip=0
plt_skip_count=0
plt_skip_n=0
record_stream=None
step=1
from Tkinter import *
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.b... |
ssl_service_test_cases.py | import unittest
import socket
import ssl
import time
import random
import threading
import uuid
import multiprocessing
import asyncio
from lxml import etree
import test_cot_data
def open_ssl_connection(cert_file, key_file, ip, port, test_client):
"""
this function opens an ssl connection with TLSv1_2 and... |
supervisor.py | # Copyright 2016 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... |
master_list_model.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko
# 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 mus... |
cheat_meal_ae.py | import multiprocessing as mp
import traceback
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
import time
import tempfile
mp = mp.get_context("spawn")
class Net(nn.Module):
def __init__(self, input_dim, latent_dim, forgiveness, gpu_d... |
test_client.py | from __future__ import print_function, division, absolute_import
from operator import add
from collections import deque
from concurrent.futures import CancelledError
import gc
import logging
import os
import pickle
import random
import subprocess
import sys
import threading
from threading import Semaphore
from time i... |
callback.py | from utlis.rank import setrank,isrank,remrank,remsudos,setsudo,GPranks,IDrank
from utlis.send import send_msg, BYusers, Sendto, fwdto,Name,Glang,getAge
from utlis.locks import st,getOR,Clang,st_res
from utlis.tg import Bot
from config import *
from pyrogram import ReplyKeyboardMarkup, InlineKeyboardMarkup, Inlin... |
mutex.py | # -*- coding:utf-8 -*-
import threading
import time
# 定义全局变量
num = 0
# work1
def work1():
# 声明num是一个全局变量
global num
# 上锁
lock1.acquire()
for i in range(1000000):
num += 1
# 解锁
lock1.release()
print("work1--------",num)
# work2
def work2():
# 声明num是一个全局变量
global ... |
run.py | # -*- coding:utf-8 -*-
import json
import os
import re
import sys
import signal
import time
import webbrowser
import threading
from asciimatics.screen import Screen
from asciimatics.effects import Print
from asciimatics.scene import Scene
from asciimatics.renderers import ColourImageFile, SpeechBubble
from .common i... |
main.py | #!/usr/bin/env python
from __future__ import absolute_import, print_function
import argparse
import json
import logging
import os
import signal
import sys
import threading
from time import sleep
from flask import Flask
from mesos.native import MesosSchedulerDriver
from mesos.interface import mesos_pb2
from .change... |
dota_hoster.py | # from https://github.com/ziadoma/dota_hoster
from steam.client import SteamClient
from steam.enums import EResult
from dota2.client import Dota2Client
from dota2.features.chat import ChannelManager
import dota2
import config
import os
import socket
import threading
import shlex
import logging
from dota2.enums import ... |
test_pvc_creation_deletion_scale.py | """
Test to measure pvc scale creation & deletion time. Total pvc count would be 1500
"""
import logging
import csv
import random
import pytest
import threading
from tests import helpers
from ocs_ci.framework.testlib import scale, E2ETest, polarion_id
from ocs_ci.ocs import constants
from ocs_ci.utility.utils import o... |
test_streaming_pull_manager.py | # Copyright 2018, Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
MITM_ICMP.py | import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
import threading
from termcolor import colored
os.system("clear")
print("""
.____________ _____ __________
| \_ ___ \ / ______ )
| / \ \/ / \ / \| ___)
... |
http.py | from __future__ import print_function
import base64
import copy
import json
import logging
import os
import random
import ssl
import string
import sys
import time
from builtins import object
from builtins import str
from typing import List
from flask import Flask, request, make_response, send_from_directory
from pydi... |
hogNode.py | #############################################
## hogNode
#############################################
print('Load hogNode')
from multiprocessing import Process
from dbus.mainloop.glib import DBusGMainLoop
import os, sys, time, json, asyncio, traceback, queue, threading, importlib
path = os.path.join(os... |
multichild.py | """
创建多个子进程
"""
from multiprocessing import Process
from time import sleep
import os, sys
def th1():
sleep(1)
print("吃饭")
print(os.getppid(), "--", os.getpid())
def th2():
sleep(2)
print("睡觉")
print(os.getppid(), "--", os.getpid())
def th3():
sleep(3)
print("打豆豆")
print(os.getp... |
evaluator.py | import os
import cv2
import numpy as np
import time
from tqdm import tqdm
import torch
import torch.multiprocessing as mp
from engine.logger import get_logger
from utils.pyt_utils import load_model, link_file, ensure_dir
from utils.img_utils import pad_image_to_shape, normalize
logger = get_logger()
class Evaluato... |
test_functional.py | try:
from importlib import reload
except ImportError:
pass
import json
import os
import queue
import tempfile
import threading
import pytest
from . import serve
from wptserve import logger
class ServerProcSpy(serve.ServerProc):
instances = None
def start(self, *args, **kwargs):
result = sup... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.