source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
http_activities.py | # -*- coding: utf-8 -*-
# (c) 2020-2021 Martin Wendt and contributors; see https://github.com/mar10/stressor
# Licensed under the MIT license: https://www.opensource.org/licenses/mit-license.php
"""
"""
import re
import threading
from pprint import pformat
from queue import Empty, Queue
from urllib.parse import urlenco... |
test_upload_url_concurrency.py | ######################################################################
#
# File: b2sdk/account_info/test_upload_url_concurrency.py
#
# Copyright 2019 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
imp... |
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... |
submission_tester.py | from enum import Enum
from logging import getLogger, basicConfig, INFO, WARNING
from datetime import datetime
from drivebuildclient import static_vars
from drivebuildclient.AIExchangeService import AIExchangeService
from drivebuildclient.db_handler import DBConnection
from pathlib import Path
from typing import List, ... |
main.py | import pdb
import time
import os
import subprocess
import re
import random
import json
import numpy as np
import glob
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
import socket
import argparse
import threading
import _thread
import signal
from datetime import datetime
from sklearn... |
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... |
main.py | from tkinter import *
from tkinter.filedialog import askopenfilename
from tkinter import messagebox
import parser
from scipy import interpolate
import numpy as np
import os
import subprocess
import threading
import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt
from math import sin, asin, sinh,... |
serialTest.py | import time
import serial
import threading
class Threads():
def __init__(self):
self.kill = 1
self.ser = serial.Serial(
port='/dev/ttyS0',
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
def SendData(self):
counter=0
while self... |
patator.py | #!/usr/bin/env python2
# Copyright (C) 2012 Sebastien MACKE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2, as published by the
# Free Software Foundation
#
# This program is distributed in the hope that it will be useful, but W... |
S2-045_n_S2-052_rce.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Author (m4ud)
# Apache Struts-045
# CVE : 2017-5638
from base64 import b64encode
import sys
import requests
from optparse import OptionParser
import os
import subprocess
import http.server
import threading
import time
def serverShutdown(server):
server = struts(options)
... |
test_standard.py | import time
from unittest import TestCase
from optimize_later import config
from optimize_later.core import optimize_later, OptimizeReport, OptimizeBlock
from optimize_later.config import optimize_context
class OptimizeContextTest(TestCase):
def test_optimize_context(self):
old_global, config._global_cal... |
operations.py | # -*- coding: utf_8 -*-
"""Dynamic Analyzer Operations."""
import json
import logging
import os
import random
import re
import subprocess
import threading
from pathlib import Path
from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.http import require_http_methods
from m... |
match.py | import json
import multiprocessing as mp
import random
import threading
import time
import numpy as np
from threading import Thread, Lock
from common.constants import *
from common.enums.climb_state import ClimbState
from common.enums.collision_control_methods import CCMethods
from common.enums.direction import Directi... |
sql_db.py | import os
import concurrent
import queue
import threading
import asyncio
import sqlite3
from .logging import Logger
def sql(func):
"""wrapper for sql methods"""
def wrapper(self, *args, **kwargs):
assert threading.currentThread() != self.sql_thread
f = asyncio.Future()
... |
master.py | import json
import socket
import time
import sys
import random
import numpy as np
import threading
import os
from datetime import datetime
random.seed(42)
class master:
''' Shared Data Structures
jobs : list of all the job requests, along with the number of map and reduce tasks
workers: list of the dictionaries ... |
ArmWebServer.py | #!/usr/bin/python3
# encoding: utf-8
# web 远程控制
import asyncio
import threading
import time
import ArmController as controller # 舵机转动
import ArmCmd as cmd
import random
import json
import websockets
import requests
POS = {"claw": 1500, "head": 1500, "middle": 1500, "bottom": 1500, "base": 500}
VIEWERS = set()
message... |
main.py | #!/usr/bin/python
import psutil
import signal
import sys
import time
from threading import Thread
def interruptHandler(signal, frame):
sys.exit(0)
def dataNetwork():
netdata = psutil.net_io_counters()
return netdata.packets_sent + netdata.packets_recv
def dataNetworkHandler():
idDevice = "IoT101Dev... |
n1ql_aggregate_pushdown_recovery.py | import itertools
import logging
import threading
from couchbase_helper.tuq_helper import N1QLHelper
from membase.api.rest_client import RestConnection
from remote.remote_util import RemoteMachineShellConnection
from .tuq import QueryTests
log = logging.getLogger(__name__)
AGGREGATE_FUNCTIONS = ["SUM", "MIN", "MAX",... |
main_widget.py | # -*- coding: utf-8 -*-
import sys
import os
import time
import torch
if hasattr(sys, 'frozen'):
os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH']
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import *
from PyQt5 import QtCore, QtGui, uic
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5... |
plan_party.py | #uses python3
import sys
import threading
# This code is used to avoid stack overflow issues
sys.setrecursionlimit(10**6) # max depth of recursion
threading.stack_size(2**26) # new thread will get stack of such size
class Vertex:
def __init__(self, weight):
self.weight = weight
self.children = ... |
keyboard-pygame.py | import pygame
from pygame.locals import *
import cv2 # pip3 install opencv-python
import os
import threading
import json
from common import *
import argparse
s_socket = ServerSocket()
white = (255, 255, 255)
black = (0, 0, 0)
blue = (0, 0, 128)
red = (200, 0, 0)
class CommandHandler:
def __init__(self):
... |
parallel_support.py | import logging
from multiprocessing import Process, Queue
from lib.pipeline import Pipeline
# from tests.mock_pipeline import Pipeline
class Work:
def __init__(self, uuid, input_data, steps=None):
self.uuid = uuid
self.data = input_data
if steps is None:
self.steps = ["string_t... |
sequence.py | # -*- 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 Apache License, Version 2.0
# (the "Li... |
host_state.py | """
Global shared state about the host.
"""
import sys
import threading
import time
import utils
CLIENT_VERSION = '1.0.3'
class HostState(object):
def __init__(self):
self.host_ip = None
self.host_mac = None
self.gateway_ip = None
########################
self.gatewa... |
message_queue.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#
# Documents
#
"""
Documents
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import time
import threading
from . import sys_info
from . import i18n
if sys_info.get... |
cnn_util_test.py | # Copyright 2018 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... |
traybar.py | import os
from .win32_adapter import *
import threading
import uuid
class SysTrayIcon(object):
"""
menu_options: tuple of tuples (menu text, menu icon path or None, function name)
menu text and tray hover text should be Unicode
hover_text length is limited to 128; longer text will be truncated
Ca... |
conftest.py | import ssl
import threading
import pytest
from SimpleWebSocketServer import SimpleSSLWebSocketServer
from .mock_rt_server import MockRealtimeLogbook, MockRealtimeServer
from .utils import path_to_test_resource
def server_ssl_context():
"""
Returns an SSL context for the mock RT server to use, with a self si... |
resource_usage_monitor.py | # ------------------------------------------------------------------------------
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements; and to You under the Apache License,
# Version 2.0. "
#
... |
zeromq.py | # -*- coding: utf-8 -*-
'''
Zeromq transport classes
'''
# Import Python Libs
from __future__ import absolute_import
import os
import sys
import copy
import errno
import signal
import hashlib
import logging
import weakref
from random import randint
# Import Salt Libs
import salt.auth
import salt.crypt
import salt.uti... |
LR2RivalRanking.py | #coding: utf-8
from PyQt4 import QtGui,QtCore
import sys
import threading
import os
from tools import GlobalTools
from tools import MainWindow
from tools import Server
version='v2.1'
if __name__ == '__main__':
sys.stderr=sys.stdout
app=QtGui.QApplication(sys.argv)
GlobalTools.init(version)
# modify hosts to red... |
_testing.py | import bz2
from collections import Counter
from contextlib import contextmanager
from datetime import datetime
from functools import wraps
import gzip
import operator
import os
import re
from shutil import rmtree
import string
import tempfile
from typing import Any, Callable, ContextManager, List, Optional,... |
conftest.py | """Fixtures and setup / teardown functions
Tasks:
1. setup test database before starting the tests
2. delete test database after running the tests
"""
import os
import copy
import random
from collections import namedtuple
from logging import getLogger
from logging.config import dictConfig
import pytest
from pymongo ... |
ThreadManager.py | import threading
class ThreadManager:
AllThreads = []
MusicThreads = []
VideoThreads = []
FaceTrackingThreads = []
PorcupineThreads = []
@staticmethod
def completeAllThreads():
ThreadManager.AllThreads = [].append(ThreadManager.MusicThreads)
@staticmethod
def AddThrea... |
training.py | from model import *
import numpy as np
from PIL import Image
from matplotlib import pyplot as plt
import random as rd
import os
from threading import Thread
import tensorflow as tf
# PATHS
DATA_DIR = "data/"
MODE_DIR = "model/"
IMAGE_DIR = "ims/"
# HYPERPARAMETTERS
BATCH_SIZE = 8
IMG_SIZE = 128
TRAINING_STEP = 100_0... |
main.py | import json, os, sys, webbrowser, ctypes
from threading import Thread
from urllib.request import build_opener, install_opener
current_dir = os.path.abspath(os.path.dirname(__file__))
try:
import requests
from PyQt6 import QtWidgets
from UI import Ui_MainWindow
from pypresence import Presence
from flask impor... |
test_httplib.py | import errno
from http import client, HTTPStatus
import io
import itertools
import os
import array
import re
import socket
import threading
import warnings
import unittest
from unittest import mock
TestCase = unittest.TestCase
from test import support
from test.support import os_helper
from test.support import socket... |
cli.py | # -*- coding: utf-8 -*-
import click
import sys
import os
import webbrowser
try:
import SimpleHTTPServer
except:
import http.server as SimpleHTTPServer
try:
import SocketServer
except:
import socketserver as SocketServer
import threading
import time
# from jinja2 import FileSystemLoader
# from jinja2.e... |
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... |
Lending.py | # coding=utf-8
from decimal import Decimal
import sched
import time
import threading
Config = None
api = None
log = None
Data = None
MaxToLend = None
Analysis = None
SATOSHI = Decimal(10) ** -8
sleep_time_active = 0
sleep_time_inactive = 0
sleep_time = 0
min_daily_rate = 0
max_daily_rate = 0
spread_lend = 0
gap_botto... |
13-threadLocal.py | import threading
# 创建全局ThreadLocal对象:
local_school = threading.local()
def process_student():
# 获取当前线程关联的student:
std = local_school.student
print('Hello, %s (in %s)' % (std, threading.current_thread().name))
def process_thread(name):
# 绑定ThreadLocal的student:
local_school.student = name
proce... |
agent.py | import time
import threading
import pymongo
import docker
from lib.config import Config
from slugify import slugify
def check_status():
client = docker.from_env()
db_client = pymongo.MongoClient("mongodb://{}/ardegra".format(Config.DATABASE_ADDRESS))
try:
db = db_client["ardegra"]
while True:
... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
evaluation.py | import multiprocessing
import subprocess
import os
import time
import json
import argparse
import logging
capture_folder = "evaluation/captures/"
capture_files = {}
capture_files["benign"] = [capture_folder + "normal/" + c for c in os.listdir(capture_folder+"normal/") if c[-5:] == ".pcap"]
capture_files["mali... |
test_queues.py | import os
import threading
import time
from contextlib import contextmanager
import pytest
from click.testing import CliRunner
from dagster_celery import celery_executor
from dagster_celery.cli import main
from dagster import ModeDefinition, default_executors, execute_pipeline, pipeline, seven, solid
from dagster.cor... |
vnhuobi.py | # encoding: utf-8
import urllib
import hashlib
import traceback
import json
import requests
from time import time, sleep
from Queue import Queue, Empty
from threading import Thread
# 常量定义
COINTYPE_BTC = 1
COINTYPE_LTC = 2
ACCOUNTTYPE_CNY = 1
ACCOUNTTYPE_USD = 2
LOANTYPE_CNY = 1
LOANTYPE_BTC = 2
LOANTYPE_LTC = 3
L... |
batcher.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modifications Copyright 2017 Abigail See
#
# 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... |
train_parallel.py | import os
import threading
algos = [' ppo ',' ppo2 ','sac','trpo']
api = '/home/michal/code/myGym/myGym'
configfile = 'configs/train.conf'
script_path = api + '/train.py'
def train(algo):
os.system('cd {api};python {script_path} --config {configfile} --algo {algos}'.format(script_path=script_path, api=api, config... |
flask_app.py | __author__ = 'Tamir'
import random
import os
from flask import Flask
from flask import send_file, render_template, request, Response, redirect, session, send_from_directory, g, url_for
from flask_login import LoginManager, login_required, login_user, logout_user
from DataBaseUsers import *
from DataBaseFiles import *
... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import print_function
import copy
import errno
import fnmatch
import hashlib
import logging
import multiprocessing
import os
import re
import salt
import signal
import sys
import threading
import time
import traceback
impo... |
broadcaster.py | import Queue
import threading
import logging
import requests
import re
import time
import base64
from status import Status
class HTTPBasicThenDigestAuth(requests.auth.HTTPDigestAuth):
"""Try HTTPBasicAuth, then HTTPDigestAuth."""
def __init__(self):
super(HTTPBasicThenDigestAuth,... |
eventtest.py | #!/usr/bin/env python
# file: eventtest.py
# vim:fileencoding=utf-8:fdm=marker:ft=python
#
# Copyright © 2016 R.F. Smith <rsmith@xs4all.nl>
# SPDX-License-Identifier: MIT
# Created: 2016-05-04 23:52:36 +0200
# Last modified: 2022-02-05T23:58:33+0100
"""
Shows usate of multiprocessing.Event.
Edited from my answer to htt... |
add_main.py | import random
import sys
import time
import datetime
import multiprocessing
import traceback
from pandacommon.pandalogger.PandaLogger import PandaLogger
from pandacommon.pandalogger.LogWrapper import LogWrapper
from pandacommon.pandautils.thread_utils import GenericThread, WeightedLists
from pandaserver.config import ... |
mem.py | """
# ===========================================================================
# Defines proxies to ION's SDR and PSM so that you can monitor them.
#
# Author: Marc Sanchez Net
# Date: 08/12/2019
# Copyright (c) 2019, California Institute of Technology ("Caltech").
# U.S. Government sponsorship acknowledged.
# ... |
optimization.py | import hashlib
import json
from copy import copy
from datetime import datetime
from itertools import product
from logging import getLogger
from threading import Thread, Event
from time import time
from typing import Union, Any, Sequence, Optional, Mapping, Callable
from .job import TrainsJob
from .parameters import Pa... |
opencv_usb_camera.py | import traitlets
import atexit
import cv2
import threading
import numpy as np
from .camera_base import CameraBase
class OpenCvUsbCamera(CameraBase):
value = traitlets.Any()
# config
width = traitlets.Integer(default_value=224).tag(config=True)
height = traitlets.Integer(default_value=224).ta... |
AutoReloadingAppServer.py | #!/usr/bin/env python2
"""AutoReloadingAppServer
This module defines `AutoReloadingAppServer`, a replacement for `AppServer`
that adds a file-monitoring and restarting to the AppServer. Used mostly like:
from AutoReloadingAppServer import AutoReloadingAppServer as AppServer
If `UseImportSpy` is set to False in ... |
agent.py | import os
import sys
import settings
import pickle
import time
import numpy as np
from sources import CarlaEnv, STOP, models, ACTIONS_NAMES
from collections import deque
from contextlib import redirect_stderr, redirect_stdout
from threading import Thread
from dataclasses import dataclass
import cv2
# Suppress excessiv... |
parallel.py | # -*- encoding: utf-8 -*-
try:
import thread
_python2 = True
except ImportError:
import threading as thread
from threading import Thread
_python2 = False
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
def threaded(function):
def _decorator(*args):
... |
server.py | import socket
import threading
HEADER = 64
PORT = 5050
#SERVER = socket.gethostbyname(socket.gethostname()) #this also works in EC2, when all the traffic is allowed
# EC2 public ip
SERVER = socket.gethostbyaddr('3.104.1.113')[0]
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = '!DISCONNECT'
server = soc... |
neighborhood_scanner.py | import socket
import threading
import sys
import time
import logging
import os.path
import random
from . import ip_range
from ..p2p_cogs import outgoing_link
from . import get_ip
try:
from . import broadcast_get
except Exception as e:
logging.warning("broadcast_get could not be imported", exc_info=True)
possibl... |
test_plot.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import csv
import time
import os
import threading
from threading import Thread
#sample min: -2.24e-12
#sample max: 2.75e-10
v_array = np.zeros((1,1))
def get_data():
global v_array
print 'start getting'
values = list()
w... |
camera.py | import cv2
from threading import Thread
class Camera(object):
def __init__(self, index):
self.cap = cv2.VideoCapture(index, cv2.CAP_V4L2)
if not self.cap.isOpened():
print('Failed to open camera {0}'.format(index))
exit(-1)
self.thread = Thread(target=self.update, ... |
test_annfiles.py | #!/usr/bin/env python
# annfiles unit tests
# JAB 8/18/12
import multiprocessing
import os
import Queue
import random
import shutil
import stat
import struct
from subprocess import call
import sys
import tempfile
import threading
import time
import traceback
import numpy as num
import annfiles_pre4 as oldann
import... |
utils.py | # XXX should consolidate this with lib
import logging
from os import path
import subprocess
import StringIO
import hashlib
import json
import sys
import os
import stat
import time
import threading
import Queue
import urlparse
import ast
from xml.etree import ElementTree
import lib
from genshi.template import NewText... |
twitch_chat_stream.py | import socket
import threading
import time
class Stream:
""" Scrapes incoming chat messages from a twitch.tv stream using IRC. """
SERVER = "irc.chat.twitch.tv"
PORT = 6667
NICKNAME = "justinfan808655" # Anonymous user, doesn't require oauth
class Message:
""" Object to store a chat messa... |
UDPServer.py | import socket
# import threading
bind_ip = "127.0.0.1"
bind_port = 9999
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind((bind_ip, bind_port))
print ("[*] Listening from %s:%d" % (bind_ip, bind_port))
def handle_client():
recv_data, addr = server.recvfrom(1024)
print ("[*] Reveived: %... |
context.py | #!/usr/bin/env python3
from http import HTTPStatus
from urllib.parse import urlparse
from ruamel.yaml.comments import CommentedMap as OrderedDict # to avoid '!!omap' in yaml
# from collections import OrderedDict
# import socketserver
import threading
import http.server
import json
import queue
import socket
import su... |
Leyva_Davis_op3.py | from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import StringProperty, ObjectProperty, ListProperty
from kivy.uix.button import Button
from Agregar import insert_inventario
import serial
from serial.tools import list_... |
shared_test.py | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
test_local_apigw_service.py | from unittest import TestCase
import threading
import os
import shutil
import json
import time
import requests
import random
from mock import Mock
from samcli.local.apigw.local_apigw_service import Route, LocalApigwService
from tests.functional.function_code import (
nodejs_lambda,
API_GATEWAY_ECHO_EVENT,
... |
materialize_with_ddl.py | import time
import pymysql.cursors
import subprocess
import pytest
from helpers.client import QueryRuntimeException
from helpers.network import PartitionManager
import pytest
from helpers.client import QueryRuntimeException
from helpers.cluster import get_docker_compose_path
import random
import threading
from multip... |
remote_sim.py | import math
import time
import keyboard
import numpy as np
import threading
import basis.robot_math as rm
import visualization.panda.world as wd
import modeling.geometric_model as gm
import robot_sim.robots.xarm7_shuidi_mobile.xarm7_shuidi_mobile as rbs
# import robot_con.xarm_shuidi.xarm_shuidi_client as rbx
from dir... |
magma_crash_recovery.py | '''
Created on Dec 12, 2019
@author: riteshagarwal
'''
import copy
import threading
from Cb_constants.CBServer import CbServer
from TestInput import TestInputSingleton
from couchbase_helper.documentgenerator import doc_generator
import json as Json
from magma_base import MagmaBaseTest
from remote.remote_util import ... |
email.py | from libs.get_data import get_alarminfo, check_alarm
import smtplib
from email.header import Header
from email.mime.text import MIMEText
from web import secure
from multiprocessing import Process
MAIL_SERVER = secure.MAIL_SERVER
MAIL_PORT = secure.MAIL_PORT
MAIL_USERNAME = secure.MAIL_USERNAME
MAIL_PASSWORD = secure.M... |
trex_subscriber.py | #!/router/bin/python
import json
import threading
import time
import datetime
import zmq
import re
import random
import os
import signal
import traceback
import sys
from .trex_types import RC_OK, RC_ERR
#from .trex_stats import *
from ..utils.text_opts import format_num
from ..utils.zipmsg import ZippedMsg
# basic... |
app.py | import os, gridfs
from pymongo import MongoClient
from threading import Thread
from flask import Flask, render_template, redirect, url_for, send_from_directory, request, session, flash
from flask_mail import Mail, Message
from werkzeug.utils import secure_filename
from utils import secrets, manipulation, recognition
fr... |
try.py | # -*- coding: utf-8 -*-
# @Author: TD21forever
# @Date: 2019-12-07 14:57:58
# @Last Modified by: TD21forever
# @Last Modified time: 2019-12-07 15:00:35
import threading
def print_word(count):
for i in range(count):
print("It's counging ",i)
def main():
t = threading.Thread(target=print_word,args=(10,)... |
Logger.py | import datetime
import glob
import inspect
import ntpath
import os
import shutil
import threading
import traceback
from enum import Enum
import time
import sys
from Shared.Settings import Settings
from Shared.Util import Singleton, current_time
class Logger(metaclass=Singleton):
def __init__(self):
sel... |
train_1.py | # Working code - updated version of carla_rl_test_1.py
# Dont use carla_rl_test_1.py
# Fixed the starting point
# Good observation and improvement
# Seen environment - (X, Y) = (143.5, 207.0)
# Unseen envioronment - (X, Y) =
import glob
import os
import sys
import random
import time
import numpy as np
import cv2
... |
util.py | """Test utilities.
.. warning:: This module is not part of the public API.
"""
import multiprocessing
import os
import pkg_resources
import shutil
import tempfile
import unittest
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
import mock
import OpenS... |
test_base_events.py | """Tests for base_events.py"""
import concurrent.futures
import errno
import math
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from test.test_asyncio import utils as test_utils
from test imp... |
client.py | import pyxel
from pyxel_server import pyxel_server
from threading import Thread
class App:
def __init__(self):
#Configure host & port
self.client = pyxel_server.client(Host="127.0.0.1", Port="5000")
#Same as pyxel.init() but will sync to server's client defaults
pyxel.init(width=sel... |
server.py | #!/usr/bin/python2.6
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
spotify_auth.py | from http.server import SimpleHTTPRequestHandler, HTTPServer
from multiprocessing import Process
from os import devnull, fdopen, pipe
from select import select
import signal
import sys
from spotipy.util import prompt_for_user_token
class CustomHTTPServer(HTTPServer):
def __init__(self, uri_pipe_write_fd, *args, ... |
test_export.py | # Copyright The OpenTelemetry 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 ... |
peer1_ks.py |
import os
import platform
import shlex
import time
import re
import socket
import threading
OS = platform.system()
HOST = socket.gethostbyname(socket.gethostname())
RFC_Server_Port = 40004
RFC_Fetching_List = []
FilePath = ''
cookieNumval = None
SERVER_NAME = '10.154.0.185'
SERVER_PORT = 65423
cl... |
utils.py | #================================================================
#
# File name : utils.py
# Author : PyLessons, Editted by Ryan Werth
# Created date: 2020-09-27 / 2020-12-09
# Website : https://pylessons.com/
# GitHub : https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3
# Description : ... |
solution1.py | #!/usr/bin/env python
"""
Solution to day 13 part 1
Robot painting time
"""
from collections import defaultdict
import inspect
import logging
import threading
from typing import List, Callable
from queue import SimpleQueue
from defaultlist import defaultlist
import numpy as np
OpCodes = List[int]
logging.basicCon... |
tests.py | import threading
from raven.utils.testutils import TestCase
from raven.base import Client
from raven.context import Context
class ContextTest(TestCase):
def test_simple(self):
context = Context()
context.merge({'foo': 'bar'})
context.merge({'biz': 'baz'})
context.merge({'biz': 'bo... |
main.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import sys
from collections import defaultdict
from multiprocessing import Process
from os import makedirs
from os.path import dirname, join, realpath
from maro.rl import (
Actor, ActorProxy, DQN, DQNConfig, FullyConnectedBl... |
threading practice.py | import threading
from time import sleep
def function1():
a = 1
while a < 1000:
print(a)
a += 2
sleep(0.3)
def function2():
sleep(0.1)
b = 2
while b < 1000:
print(b)
b += 2
sleep(0.3)
x = threading.Thread(target=function1)
y = threading.Thread(tar... |
tutorial_bipedalwalker_a3c_continuous_action.py | """
Asynchronous Advantage Actor Critic (A3C) with Continuous Action Space.
Actor Critic History
----------------------
A3C > DDPG (for continuous action space) > AC
Advantage
----------
Train faster and more stable than AC.
Disadvantage
-------------
Have bias.
Reference
----------
MorvanZhou's tutorial: https://m... |
inference_api.py | import numpy as np
import base64
import json
from werkzeug.wrappers import Request, Response
import params as yamnet_params
import yamnet as yamnet_model
DEFAULT_TOP_N = 5
def decode_audio(audio_bytes):
return np.frombuffer(base64.b64decode(audio_bytes), dtype="float32")
def make_app(make_predict_func):
... |
yosun.py | import logging
from inspect import isroutine
from socket import timeout
from collections import defaultdict
from time import sleep
from threading import Thread, Event
from kombu import Queue, Consumer
from kombu.pools import producers, connections
from kombu.exceptions import MessageStateError
logger = logging.getLog... |
structured-streaming.py | # Databricks notebook source
# MAGIC %md
# MAGIC ## Part 1: Set up the environment
# MAGIC
# MAGIC Run the cells below up to part 2 to setup files used for this exercise.
# COMMAND ----------
setup_responses = dbutils.notebook.run("../../../includes/Setup-Streaming-GDrive", 0).split()
checkpoint_stream1_path = se... |
SAC_run.py | #!/usr/bin/env python3
import threading, queue
import time
import os
import shutil
import numpy as np
import math
import rospy
from sac_v6 import SAC
from env_v7 import Test
MAX_EPISODES = 100000
MAX_EP_STEPS = 800
MEMORY_CAPACITY = 10000
BATTH_SIZE = 256
SIDE = ['right_', 'left_']
GOAL_REWARD = 800
LOAD = False
de... |
_nixcommon.py | # -*- coding: utf-8 -*-
import struct
import os
import atexit
from time import time as now
from threading import Thread
from glob import glob
try:
from queue import Queue
except ImportError:
from Queue import Queue
event_bin_format = 'llHHI'
# Taken from include/linux/input.h
# https://www.kernel.org/doc/Docu... |
sharded_nuke_and_pave.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Issues sharded slavekill, delete build directory, and reboot commands."""
import multiprocessing
import optparse
import os
impo... |
exporter.py | from aiohttp import web
import threading
import os
import glob
import time
import logging
import asyncio
import time
import importlib
from functools import partial
from prometheus_client import Histogram, Counter, generate_latest
plugin_dir = "plugins"
runtime = Histogram("exporter_runtime_seconds", "", ["name"], buc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.