source
stringlengths
3
86
python
stringlengths
75
1.04M
managers.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import multiprocessing.managers from multiprocessing.managers import SyncManager as _SyncManager import threading __author__ = 'yasu' class ManagerServer(multiprocessing.managers.Server): manager = multiprocessing.managers.SyncManager @property...
role_maker.py
# Copyright (c) 2020 PaddlePaddle 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 app...
game.py
import math import os import re import threading from datetime import datetime from typing import Dict, List, Optional, Union from katrain.core.constants import HOMEPAGE, OUTPUT_DEBUG, OUTPUT_INFO from katrain.core.engine import KataGoEngine from katrain.core.game_node import GameNode from katrain.core.lang import i18...
PLANT IT ALLL.py
from random import * from turtle import * from tkinter import * #from multiprocessing import Process #processes = [] SEE = False dismod = (2/3,3/4,3/5,7/8) ; c = 2 ; d = 5 a = 15 ; b = 40 ; minpix = 10 ; wmod = 3/5 ground = - 225 seeds = 0 rightmost = 0 leftmost = 0 listen() w = Screen() w.t...
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...
client.py
from tkinter import * import requests import threading import time root = Tk() root.title("DSS Chat System") name_label = Label(text="Name : ") usr_name_entry = Entry() message_field = Text() message_input = Entry() def threadStart(): thread1 = threading.Thread(target=getMessages) thread1.start() def ge...
Connector.py
""" Created on Okt 29 13:15 2019 @author: nishit """ import json import threading import time from connector.apiConnectorFactory import ApiConnectorFactory from connector.equationConnector import EquationConnector from connector.equationParser import EquationParser from connector.parserConnector import ParserConnect...
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,...
ct.py
#!/usr/bin/env python # coding=utf-8 import time import threading import tornado.ioloop from tornado.concurrent import Future ioloop = tornado.ioloop.IOLoop.current() def long_task(future, sec=5): print("long task start") time.sleep(sec) print("after sleep") future.set_result("long task done in %s se...
v2.5.1.py
#!/usr/bin/env python #version: 2.5.1 beta import threading import argparse import random import atexit import socket import socks import time import ssl import sys import os start_time = 0 active_connections = 0 connection_limit = 0 active_threads = 0 max_threads = 100 delay = 1 ups = 0 total_ups = 0 dps = 0 total_d...
policy_server_input.py
from http.server import HTTPServer, SimpleHTTPRequestHandler import logging import queue from socketserver import ThreadingMixIn import threading import time import traceback from typing import List import ray.cloudpickle as pickle from ray.rllib.env.policy_client import ( _create_embedded_rollout_worker, Comm...
remote_completion.py
# Copyright 2014 Google Inc. All Rights Reserved. """Remote resource completion and caching.""" import logging import os import threading import time import argcomplete from googlecloudsdk.core import config from googlecloudsdk.core import properties class CompletionProgressTracker(object): """A context manager f...
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...
test_base_events.py
"""Tests for base_events.py""" import errno import logging import math import os 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 asyncio import test_utils try: from test import support...
common.py
"""Test the helper method for writing tests.""" import asyncio import collections from collections import OrderedDict from contextlib import contextmanager from datetime import timedelta import functools as ft from io import StringIO import json import logging import os import pathlib import threading import time impor...
app_thread.py
# Local/Own Server Port Scanner # Thread but quick import threading import socket import sys from queue import Queue # first in first out import os from pathlib import Path import json os.chdir(Path(__file__).parent ) with open("./portscanner.json", mode="r", encoding="UTF-8") as file: content = file.re...
start_n.py
import threading from client.agent import Agent from time import sleep if __name__ == '__main__': N = 12 for i in range(N): a = Agent(figure='queen') thread = threading.Thread(target=a.run) thread.start() sleep(0.3)
app.py
from flask import Flask, jsonify, request, redirect, Response, send_file from database import SessionLocal, engine from getData import * from database import * from getDB import * import models from security import * from werkzeug.utils import secure_filename from flask_cors import CORS, cross_origin import csv import ...
MicrosoftTeams.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import requests from distutils.util import strtobool from flask import Flask, request, Response from gevent.pywsgi import WSGIServer import jwt import time from threading import Thread from typing import...
llh_server.py
#!/usr/bin/env python """ Server(s) for handling llh requests from a client: client passes free param values, server sets these on its DistributionMaker, generates outputs, and compares the resulting distributions against a reference template, returning the llh value. Code adapted from Dan Krause https://gist.githu...
bjoern_wrapper.py
#!/usr/bin/env python import argparse import sys import bjoern import importlib import signal import datetime import time import os import threading import mflog import mfutil LOGGER = mflog.get_logger("bjoern_wrapper") def get_wsgi_application(path): if len(path.split(':')) != 2: LOGGER.warning("main_...
app.py
import os import re import math import sys import shutil import json import traceback import PIL.Image as PilImage import threading import tkinter as tk from tkinter import messagebox from tkinter import ttk from tkinter import filedialog from constants import * from config import ModelConfig, OUTPUT_SHAPE1_MAP, NETWOR...
spy.py
import os from socket import socket, AF_INET, SOCK_STREAM from threading import Thread from .exceptions import ParserError import logging import warnings from uuid import uuid4 from .proto import spy_pb2 from .command import * from ctypes import cdll, c_char_p class WeChatSpy: def __init__(self, parser=None, key:...
tribe_of_savages.py
#!/usr/bin/env python """tribe_of_savages.py: A tribe eats dinners from a pot that holds M shares. When a savage wants to eat he helps himself, if the pot is empty he wakes the cook the savages wait until the cook completely fills the pot. The cook refills only when the pot is empty. There is only one cook and an arbi...
Platform.py
import json from sys import platform import threading from typing import Any, Optional import paho.mqtt.client as mqtt from pydantic.class_validators import validator from modules.base.Configuration import * from modules.base.Instances import * class MqttAvailabilityConfiguration(Configuration): '''Availability t...
sdca_ops_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...
preferences.py
"""Addon preferences that are saved inbetween sesions.""" import bpy import os.path import subprocess import threading from os import path def preference_save(self, context): bpy.ops.wm.save_userpref() class WreckfestPanelContext(bpy.types.PropertyGroup): """Properties that can be changed in panel""" pa...
us_run.py
# -*- coding: utf-8 -*- import os import pandas as pd import re import smtplib from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.utils import COMMASPACE, formatdate import csv from datetime import datetime import time import...
pio_bridge.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals import os from glob import glob from ..libraries import paths from ..libraries.file import File from ..libraries.tools imp...
Item53.py
""" Item 53: Use Threads for Blocking I/O, Avoid for Parallelism """ """ Python threads cannot run in parallel on multiple cores because of the GIL. Python threads can be useful since the code will appear as if multiple things are executing at the same time. System calls will excecute in parallel when using Python th...
run_bk3.py
from mylib import config, thread from mylib.yolo import YOLO #from mylib.mailer import Mailer from mylib.detection import detect_people from imutils.video import VideoStream, FPS from scipy.spatial import distance as dist import numpy as np import argparse, cv2, os, time , imutils import matplotlib.pyplot as plt from ...
thread.py
#!/usr/bin/python import threading import time import glob import os l = glob.glob("*.txt") def loop(x): f = file(x, 'r+') print '%s' % ''.join(map(str,f.readlines())) f.close() for i in range(len(l)): t = threading.Thread(target=loop, args = (l[i],)) t.start()
controller_base.py
################################################################################ # controller_base.py #------------------------------------------------------------------------------- # Base class for a controller to interact with the LED display application # framework. # # By Malcolm Stagg # # Copyright (c) 2021 SOD...
scanning_proxy.py
"""Philips hue proxy code.""" import abc import logging import sys import threading from pi import proxy class ScanningProxy(proxy.Proxy): """A proxy object with a background scan thread.""" __metaclass__ = abc.ABCMeta def __init__(self, refresh_period): self._refresh_period = refresh_period self._...
monte_carlo.py
"""! @file @date 07 Jun 2015 @license Copyright 2015 Brett Tully 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 o...
ContigFilter_mleeServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
test_dp_correctness.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...
lambda_executors.py
import os import re import glob import json import time import logging import threading import subprocess import six from multiprocessing import Process, Queue try: from shlex import quote as cmd_quote except ImportError: from pipes import quote as cmd_quote # for Python 2.7 from localstack import config from ...
test_measuring_from_threads.py
import threading import random import time from eqsn import EQSN def test_measure_from_threads(): q_sim = EQSN() def measure_or_hadamard(_id): n = random.randrange(10, 20, 1) for _ in range(n): time.sleep(0.1) q_sim.H_gate(_id) nr_threads = 10 ids = [str(x) f...
threading_endTime.py
import threading import time def thread(): time.sleep(2) print('---子线程结束---') def main(): t1 = threading.Thread(target=thread) t1.setDaemon(True) t1.start() t1.join(timeout=1) # 1、线程同步,主线程堵塞1s然后主线程结束,子线程继续执行 # 2、如果不设置timeout参数就等子线程结束主线程再结束 # 3、如...
server.py
from socket import * import threading as th from time import sleep ''' Server functionality: 1) Main server listens to a port 2) When a connection is established it starts a new thread to host this client (the client gets unique id 3) Thread function executes until connection is done 4) Thread function first checks fo...
scrape.py
import pytumblr from threading import Thread import requests import logging import json from boto.s3.connection import S3Connection import time import sys class Scrape(): def __init__(self, aws_access_key, aws_secret_key, s3_bucket, tumblr_api_key, tag, refresh_period=1.0): self.tumblr_client = pytumblr....
tutorial_A3C.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 ---------- Original Paper: https://arxiv.or...
hyperopt.py
# Copyright 2019 IBM 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 to in writing, ...
fetch-map.py
# Copyright © 2018 Po Huit # [This program is licensed under the "MIT License"] # Please see the file LICENSE in the source # distribution of this software for license terms. # Fetch EVE systems and stargates using ESI from time import sleep import http.client as client import json from sys import stdout, stderr impo...
devilscall.py
#!/usr/bin/python3 # This Python file uses the following encoding: utf-8 import getpass import base64 import multiprocessing import gettext import sys #import ssl import re import json import subprocess import ctypes import random import datetime from time import sleep from os import system, environ, path, getuid from ...
test_weather_ledger.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
serve.py
# Copyright (c) 2020 PaddlePaddle 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 appli...
test_system.py
# Copyright 2016 Google LLC 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 ag...
log.py
#!/usr/bin/env python2 """ Copyright (c) 2014-2019 Maltrail developers (https://github.com/stamparm/maltrail/) See the file 'LICENSE' for copying permission """ import os import re import signal import socket import SocketServer import sys import threading import time import traceback from core.common import check_w...
trial3.py
#!/usr/bin/python # -*- coding: UTF-8 -*- from os import system, name import itertools import threading import time import sys import datetime from base64 import b64decode,b64encode from datetime import date expirydate = datetime.date(2021, 9, 24) #expirydate = datetime.date(2021, 8, 30) today=date.today() green="\0...
a3c.py
# -*- coding: utf-8 -*- import tensorflow as tf import threading import numpy as np import signal import random import math import os import time from game_ac_network import GameACFFNetwork, GameACLSTMNetwork from a3c_training_thread import A3CTrainingThread from rmsprop_applier import RMSPropApplier from constants ...
installwizard.py
import os import shutil import threading from PyQt5.QtCore import Qt, pyqtSignal, QEventLoop, QRect from PyQt5.QtGui import QPalette, QPen, QPainter from PyQt5.QtWidgets import ( QWidget, QDialog, QLabel, QPushButton, QScrollArea, QHBoxLayout, QVBoxLayout, QListWidget, QAbstractItemView, QListWidgetItem, QLine...
test_visual_regression.py
from http import server import pathlib import threading import percy from selenium import webdriver from selenium.webdriver.firefox import options as firefox_options BASE_DIR = pathlib.Path(__file__).parent.parent.resolve() DOCS_BUILD_DIR = BASE_DIR / "docs/_build/html/" class DocsHTTPRequestHandler(server.SimpleH...
work.py
import threading import time class MyWork: def __init__(self, maxvalue, setprogress, setresult): '''maxvalue is given by the GUI setprogress/ setresult is a function. calling these functions will add an event to the main loop, and update the value. ''' self.maxvalue = maxvalue ...
run.py
# flake8: noqa import os import sys import multiprocessing from time import sleep from datetime import datetime, time from logging import INFO # 将repostory的目录i,作为根目录,添加到系统环境中。 ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')) sys.path.append(ROOT_PATH) print(f'append {ROOT_PATH} ...
follow-editor.py
import gdb from threading import Thread from traceback import print_exc from datetime import datetime from os.path import isfile import subprocess class FollowEditor(gdb.Command): @staticmethod def printf(msg): print("follow-editor: %s" % (msg,)) def __init__(self): self.editor_command = "...
Network.py
import argparse import socket import threading from time import sleep import random import RDT ## Provides an abstraction for the network layer class NetworkLayer: # configuration parameters prob_pkt_loss = 0 prob_byte_corr = 0.2 prob_pkt_reorder = 0 # class variables sock = None conn = None buffer_S = '...
duce.py
import json import os import random import re import sys import threading import time import traceback from decimal import Decimal from urllib.parse import parse_qs, unquote, urlsplit from webbrowser import open as web import browser_cookie3 import cloudscraper import PySimpleGUI as sg import requests from bs4 import ...
test_PROTON_2111_container_ssl_ssldomain_object_leak.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...
TestPooledPg.py
"""Test the PooledPg module. Note: We don't test performance here, so the test does not predicate whether PooledPg actually will help in improving performance or not. We also assume that the underlying SteadyPg connections are tested. Copyright and credit info: * This test was contributed by Christoph Zwerschke """...
photos.py
# -*- coding: UTF-8 -*- from .core import * class Photos(object): def __init__(self, ProxyDictionary, keywords=[], *args): self.keywords = keywords self.ProxyDictionary = ProxyDictionary self.photos_queue = Queue() def _loadAlbumsPage(self, page_num): # url example: ...
tests.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import errno import os import shutil import sys import tempfile import time import unittest from datetime import datetime, timedelta try: import threading except ImportError: import dummy_threading as threading from django.core.cache import cach...
test_websocket.py
from uvicorn.protocols.http.h11_impl import H11Protocol from uvicorn.protocols.websockets.websockets_impl import WebSocketProtocol from uvicorn.protocols.websockets.wsproto_impl import WSProtocol import asyncio import functools import time import threading import requests import pytest import websockets from contextlib...
test_urllib.py
"""Regresssion tests for urllib""" import urllib import httplib import unittest from test import test_support import os import mimetools import tempfile import StringIO def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))[2:].upper() if len(hex_repr) == 1: hex_rep...
view.py
# Copyright 2018-2019 Jetperch 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
videoManager.py
from flask import Response, request, abort from _thread import get_ident from .setting import serverConfig, streamConfig from .tokenManager import Auth from camera_dev import CameraDevice import cv2, threading, time class LiveVideo: placeholder = cv2.imencode('.jpg', cv2.resize(cv2.i...
main-state-example.py
from message_board import MSGBoard from node import Actor def determin_method(get_actor, get_info): if get_info == 'quick': if get_actor.create_message(request='get_quick_info') == def foo(bar, baz, nay): return bar + baz + nay def bar(): return 3 def baz(): return 30 def kay(): ...
tracker.py
""" Tracker script for DMLC Implements the tracker control protocol - start dmlc jobs - start ps scheduler and rabit tracker - help nodes to establish links with each other Tianqi Chen """ # pylint: disable=invalid-name, missing-docstring, too-many-arguments, too-many-locals # pylint: disable=too-many-branches, too...
OID2TFRecords.py
# Copyright 2016 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...
main.py
import websocket as _websocket from fastapi import FastAPI from fastapi import WebSocket as fWebSocket from starlette.endpoints import WebSocketEndpoint from starlette.requests import Request from starlette.responses import Response, StreamingResponse from httpx import AsyncClient from io import BytesIO import sys impo...
Controls.py
# This Program Is Created Only For Practise and Educational Purpose Only # This Program Is Created By S.S.B # This Program Is Completely Free And Open Source __author__=''' S.S.B surajsinghbisht054@gmail.com https://bitforestinfo.blogspot.com ''' # # ################################################## ######## Please D...
main.py
from difflib import SequenceMatcher from discord.ext import commands from lxml import html import subprocess import threading import discord import asyncio import aiohttp import random import ctypes import re import os import keep_alive token = 'OTA0OTM1ODMzMjUyMDA3OTk4.YYCxKw.eD-5O7QBXiNPl5w1CrhCwMHLW24' prefix = '/...
capture_pupil.py
from pylsl import StreamInlet, resolve_byprop, local_clock, TimeoutError import zmq from zmq.utils.monitor import recv_monitor_message import msgpack as serializer import pupil.pupil_src.capture as pupil_capture from multiprocessing import Process, Queue import signal, sys, os, time, csv import serial import threadin...
comms.py
################################################################################### # @file comms.py ################################################################################### # _ _____ ____ ____ _____ # | |/ /_ _/ ___|| _ \| ____| # | ' / | |\___ \| |_) | _| # | . \ | |___ ) | __/| |___ # |_|\_\__...
test_partition_20.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 common.common_type import CaseLabel, CheckTasks from common.code_mapping import PartitionErrorMessage prefix = ...
auto_test.py
"""Tests for letsencrypt-auto""" from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler from contextlib import contextmanager from functools import partial from json import dumps from os import chmod, environ from os.path import abspath, dirname, exists, join import re from shutil import copy, rmtree import soc...
example_test.py
import http.server import multiprocessing import os import random import re import socket import ssl import struct import subprocess import ttfw_idf from tiny_test_fw import DUT server_cert = '-----BEGIN CERTIFICATE-----\n' \ 'MIIDWDCCAkACCQCbF4+gVh/MLjANBgkqhkiG9w0BAQsFADBuMQswCQYDVQQGEwJJ\n'\ ...
run_designs.py
# Copyright 2020 Efabless 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 to in...
douyustatus.py
from mail import send_mail import os,time,sys from threading import Thread password = input("pass:") filepath = "/root/b/d/d" filepath2 = "/root/b/d/huya" filepath3 = '/root/b/d' subject = "斗鱼没文件" subject2 = "虎牙没文件" subject3 = 'bilibili没文件' contents = "没有录制文件了,可能出错了,请检查" retry = 0 def running(filepath,subject,contents,...
replay.py
#!/usr/bin/env python # Author: # Rudiger Birkner (ETH Zurich) import argparse import logging import time import redis import math from collections import namedtuple, defaultdict from threading import Thread def pretty(d, indent=0): for key, value in d.iteritems(): print '\t' * indent + str(key) if ...
autologin2.py
import time import pythoncom from manuallogin import * from PyQt5 import QtWidgets from PyQt5.QtCore import QTimer from multiprocessing import Process from PyQt5.QAxContainer import QAxWidget sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from utility.setting import OPENAPI_PATH class Wi...
SentenceTransformer.py
import json import logging import os import shutil import stat from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional import requests import numpy as np from numpy import ndarray import transformers from huggingface_hub import HfApi, HfFolder, Repository, hf_...
_head_scroll.py
import threading import time from collections import deque class ScrollState: NOT_SCROLLING = 1 SCROLLING_DOWN = 2 SCROLLING_UP = 3 class Scroller(object): def __init__(self, eye_tracker, mouse, coefs=[-0.17, -0.082, -0.0025, 0.00072], ...
game.py
import numpy as np import matplotlib.pyplot as plt import pygame as pg import os import threading from rlgw.model import WORLD, ENV pg.init() # load pygame modules #~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~# # Game Module for Grid-World # Implements graphics and most of pygame relat...
utils.py
import csv import json import gym import numpy as np import tensorflow as tf import os.path as osp from gym.core import Wrapper from multiprocessing import Process, Pipe def sf01(arr): """ swap and then flatten axes 0 and 1 """ s = arr.shape return arr.swapaxes(0, 1).reshape(s[0] * s[1], *s[2:]) ...
scan_parallel.py
from __future__ import print_function # Python 2/3 compatibility import time, sys, boto3, threading from botocore.exceptions import ClientError # Create Client session = boto3.session.Session(region_name="eu-west-1") dynamoDbClient = session.client('dynamodb') def scan_table(segment, total_segments): # Print t...
fix_threading_shutdown.py
""" threading._shutdown changed. It used to call "join" on every non-daemon Thread. This kind of kills the purpose for this library. This library was created to automatically join and safely clean up long running threads. This module changes "_shutdown" to "join" all non-daemon Threads again. """ import threading __a...
option.py
#!/usr/bin/env python """ Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import binascii import cookielib import glob import inspect import logging import httplib import os import random import re import socket import string import sys import tempf...
progressbar.py
""" Reference: tkinter_progress.py https://gist.github.com/MattWoodhead/c7c51cd2beaea33e1b8f5057f7a7d78a """ import threading import tkinter as tk from tkinter import ttk class ProgressBar(): """ threaded progress bar for tkinter gui""" def __init__(self, parent, row, column, columnspan): self.maxi...
seismograph.py
#!/usr/bin/env python3 import os import time import sys try: from PIL import Image from PIL import ImageFont from PIL import ImageDraw except ImportError: print("""This example requires PIL. Install with: sudo apt install python{v}-pil """.format(v="" if sys.version_info.major == 2 else sys.version_in...
model_workers.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Start workers to create model for all categories.""" import time import argparse import threading from subprocess import call from unidecode import unidecode from caterpy.url_lists import return_url_lists def return_args(): """Get some args to start update class...
supernode.py
# broadcasting port number : 44444 # livestatus port number : 12121 # handleFile() sharing port : 9005 # supernode to supernode communication PORT : 9999 # showFile : 9001 # findFile : 9002, 9003 # reqHandler : 9090 # add superNode broadcast req : 11000 # superNode file update info : 11001 # ACK to supernode for assign...
contextutil.py
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import logging import os import shutil import sys import tempfile import termios import threading import zipfile from contextlib import contextmanager from pathlib import Path from queue i...
juicer.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # ffmpeg -i an.mp4 -i vn.mp4 -map_metadata 0 -c copy map.mp4 # ffmpeg -i "E:\TV\美国\看见 See.S01.HDR.2160p.WEB.h265-NiXON[rartv]\see.s01e01.hdr.2160p.web.h265-nixon.mkv" -c copy D:\va.mp4 # ffmpeg -i "E:\TV\美国\看见 See.S01.HDR.2160p.WEB.h265-NiXON[rartv]\see.s01e01.hdr.2160p.web....
test_asyncprocess.py
from __future__ import print_function, division, absolute_import from datetime import timedelta import gc import os import signal import sys import threading from time import sleep import weakref import pytest from tornado import gen from tornado.locks import Event from distributed.metrics import time from distribut...
desc_cem_classic_CartPoleV0.py
# -*- coding:utf8 -*- # File : desc_cem_classic_CartPoleV0.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 10/08/2017 # # This file is part of TensorArtist. import os import threading import numpy as np from tartist.app import rl from tartist.core import get_env, get_logger from tartist.core....
worker.py
import time import datetime import json import redis import threading import sys from logger.Logger import Logger, LOG_LEVEL # Base Worker Class # A worker is responsible for handling its set of operations and running on a thread class Worker(): def __init__(self, config, main_thread_running, system_ready): ...
deep_query.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2016 - Present, Tianwei Shen, HKUST. # Copyright 2017 - Present, Zixin Luo, HKUST. """ query images and get rank lists. evaluate oxford5k (paris6k) benchmark datasets. """ from __future__ import print_function import os import sys import time from random imp...
wsdump.py
#!/Users/justin.bassett/code/exchange-bot/exchangebot/bin/python2.7 import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = getatt...