source
stringlengths
3
86
python
stringlengths
75
1.04M
worker.py
import pika import time from DAO.connection import Connection import os import multiprocessing import json import logging import ast from asr.client2 import main import threading import functools LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) ' '-35s %(lineno) -5d: %(message)s') LO...
vlc_discord_server.py
import socket # For hosting a server that communicates w/ OBS script import asyncio # For handling multiple connections import discord # Requires "pip install discord.py" module for interacting with discord from dotenv import load_dotenv # Loading environment variables import os # Getting environment variables imp...
gym_reach7dof_train_1a.py
#### Training agent in Pusher7Dof gym env using a single real-world env ## 1a,1b : Trying threading for running rendering in parallel while taking actions ## Wrtitten by : leopauly | cnlp@leeds.ac.uk ## Courtesy for DDPG implementation : Steven Spielberg Pon Kumar (github.com/stevenpjg) #### ##Imports import gym from ...
JoyHIDOutput.py
''' Created on Nov 22, 2021 @author: Japi42 ''' import threading from struct import pack from Outputs.Output import Output condition = threading.Condition() inited = False x_axis = 0 y_axis = 0 my_buttons = 0 dirty = False devhandle = None # Need a thread for working # Need a condition for thread safety # Need an...
tcc-teste.py
#!/usr/bin/python2.7 import time from threading import Thread import threading, Queue class cabeca(object): def __init__(self): self.nome = None def check_infos(user_id, queue): result = user_id+5*2+4*20 queue.put(result) def soma(i): return i+5*2+4*20 queued_request = Queue.Queue() lista...
Network.py
import Device from scapy.all import * import threading from pylab import * import matplotlib.pyplot as plt import time import os class Network: num_devices = 0 device_list = {} bwUsageHistory = {} def Join_device(self, mac_addr, ip_addr=None): dev = Device.device(mac_addr, ip_addr) sel...
mmc_positioner.py
""" Mock MMC support in ophyd/Bluesky """ from ophyd import Component from ophyd import Signal from ophyd.mixins import SignalPositionerMixin from ophyd.status import MoveStatus from sim_mmc_controller import SimMMC import threading import time import warnings class SoftMMCPositioner(SignalPositionerMixin, Signal): ...
concurrency.py
# -*- coding: utf-8 -*- # # Copyright (C) 2010 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software c...
static_url_store.py
# # (C) Copyright 2012 Enthought, Inc., Austin, TX # All right reserved. # # This file is open source software distributed according to the terms in LICENSE.txt # """ Static URL Store ================ This module contains the :py:class:`~StaticURLStore` store that communicates with a remote HTTP server which provides ...
ModuleArpPosion.py
#The MIT License (MIT) #Copyright (c) 2015-2016 mh4x0f P0cL4bs Team #Permission is hereby granted, free of charge, to any person obtaining a copy of #this software and associated documentation files (the "Software"), to deal in #the Software without restriction, including without limitation the rights to #use, copy, mo...
arrow_dataset_ops.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...
pir-api.py
from flask import Flask, jsonify, g from flask_cors import CORS import RPi.GPIO as GPIO import sys, ctypes, os, logging from time import gmtime, localtime, strftime, sleep from datetime import datetime, timedelta import sqlite3 from multiprocessing import Process, Queue from dotenv import load_dotenv import smtplib fro...
registry.py
import logging import threading import time from typing import List from brownie import Contract, chain, web3 from joblib import Parallel, delayed from web3._utils.abi import filter_by_name from web3._utils.events import construct_event_topic_set from yearn.events import create_filter, decode_logs, get_logs_asap from ...
engine.py
import sys import importlib import traceback from typing import Optional, Sequence, Any, List from pathlib import Path from datetime import datetime from threading import Thread from pandas import DataFrame from vnpy.event import Event, EventEngine from vnpy.trader.engine import BaseEngine, MainEngine from vnpy.trade...
exchange_rate.py
from datetime import datetime import inspect import requests import sys from threading import Thread import time import csv import decimal from decimal import Decimal from .bitcoin import COIN from .i18n import _ from .util import PrintError, ThreadJob # See https://en.wikipedia.org/wiki/ISO_4217 CCY_PRECISIONS = {'...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # 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 ...
cli.py
# encoding: utf-8 from __future__ import print_function import collections import csv import multiprocessing as mp import os import datetime import sys from pprint import pprint import re import itertools import json import logging from optparse import OptionConflictError import traceback from six import text_type f...
frython.py
#!/usr/bin/env python # a simple script to set up a GPU-enabled Jupyter notebook on Fry/Fry2 # assumes you have an account on there already import argparse import signal import subprocess import threading import time import webbrowser # TODO: have some kinda config file for this def launch_tab(port): time.sle...
parameter_dialog.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...
pipe_adder_20_3_2.py
#!/usr/bin/env python3 # -*- coding:UTF-8 # 管道双向通信 import multiprocessing #服务器端 def adder(pipe): server_p, client_p = pipe client_p.close() while True: try: x, y = server_p.recv() except EOFError: break result = x + y server_p.send(result) #也可以...
resquiggle.py
import os, sys import re import h5py import Queue import numpy as np np.seterr(all='raise') import multiprocessing as mp from glob import glob from time import sleep, time from subprocess import call, STDOUT from tempfile import NamedTemporaryFile from distutils.version import LooseVersion from itertools import grou...
models.py
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import pre_save, post_save, post_delete from django.dispatch import receiver from django.utils import timezone from tethys_compute import TETHYSCLUSTER_CFG_FILE, TETHYSCLUSTER_CFG_TEMPLATE import os, re from multipro...
clientAudio.py
from array import array from socket import socket, AF_INET, SOCK_STREAM, SOCK_DGRAM, SOL_SOCKET, SO_BROADCAST, SO_REUSEPORT, gethostname, gethostbyname from threading import Thread import pyaudio HOST = '127.0.0.1' PORT = 4000 BufferSize = 4096 FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44100 CHUNK = 256 class C...
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...
vnokex.py
# encoding: UTF-8 from __future__ import print_function import ssl import hashlib import json import traceback from threading import Thread from time import sleep import websocket from func import * # 常量定义 OKEX_SPOT_HOST = 'wss://real.okex.com:10441/websocket' OKEX_FUTURE_HOST = 'wss://real.okex.com:10440/webso...
LogWatcher.py
import sys import time import errno import os import signal import threading class LogWatcher: def __init__(self, logPath, logFunc): self.thread = threading.Thread(target=self.update) # Setting daemon to true will kill the thread if the main # thread aborts (eg. user hitting ctrl+c) ...
1.4.1.4.py
#Queue进程间通信 from multiprocessing import Process, Queue import os, time, random # 写数据进程执行的代码: def proc_write(q,urls): print('Process(%s) is writing...' % os.getpid()) for url in urls: q.put(url) print('Put %s to queue...' % url) time.sleep(random.random()) # 读数据进程执行的代码: def proc_read(q...
threading.py
# Copyright (C) 2015-2021 Regents of the University of California # # 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...
multiChatServer.py
""" Script for TCP chat server - relays messages to all clients """ from socket import AF_INET, socket, SOCK_STREAM from threading import Thread clients = {} addresses = {} HOST = "0.0.0.0" PORT = 2333 BUFSIZ = 1000000 ADDR = (HOST, PORT) SOCK = socket(AF_INET, SOCK_STREAM) SOCK.bind(ADDR) def accept_incoming_conn...
test.py
from contextlib import contextmanager ## sudo -H pip install PyMySQL import pymysql.cursors import pytest import time import threading from helpers.cluster import ClickHouseCluster from helpers.client import QueryRuntimeException cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance('node1', main_config...
exercise7.py
#!/usr/bin/env python """ Exercise 7. Repeat exercise #6 except use processes. """ import time from multiprocessing import Process, current_process from netmiko import ConnectHandler from net_system.models import NetworkDevice import django def show_version(device): """ Function to get output of 'show version'...
State.py
""" State.py ======== Perform actions of the rocket and manage state. `hooks` is a dictionary mapping a hook string to a list of functions to thread when the hook occurs. """ import datetime from os import system from threading import Thread class State: def __init__(self, conf, data, hooks={}): self.ho...
AlertEvent.py
import pika import json import os import logging import time from threading import Thread def emit_alert_event(type, data): def emitter(): try: time.sleep(2) rabbit_credentials = pika.PlainCredentials(os.environ.get("RABBITMQ_DEFAULT_USER"), os.environ.get("RABBITMQ_DEFAULT_PASS"...
mcp23017server.py
#!/usr/bin/env python """ MCP23017 Control Service. A service that acts as an interface between (e.g. Home Assistant) clients and the I2C bus on a Raspberry Pi. Author: find me on codeproject.com --> JurgenVanGorp """ import traceback import os import sys import time import logging import redis from logging.handlers i...
flickrexplorer.py
# -*- coding: utf-8 -*- # Python3-Kompatibilität: from __future__ import absolute_import # sucht erst top-level statt im akt. Verz. from __future__ import division # // -> int, / -> float from __future__ import print_function # PYTHON2-Statement -> Funktion from kodi_six import xbmc, xbmcaddon, xbmcplugin, xbmcg...
main.py
#!/usr/bin/env python3 ## SMBus-SSD1306 by portasynthinca3, 2021 ## SSD1306 driver based on thom_tl's C++ code ## Licensed under WTFPL ## ## Read README.md for instructions! from smbus import SMBus from PIL import Image, ImageDraw from threading import Thread from time import time import dbus from pynput import keybo...
InstanceCounter.py
from .SparqlInterface.src.ClientFactory import make_client from .SparqlInterface.src.Interfaces.AbstractClient import AbstractClient from .SQLiteStore.InstanceCountStore import InstanceCountStore from .PickleStore.PickleStore import PickleStore from .FileStore.FileStore import FileStore from .Utilities.Logger import lo...
idle_shutdown.py
""" Copyright 2019, Institute for Systems Biology 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...
autoreload.py
# -*- coding: utf-8 -*- ''' # ============================================================================= # FileName: autoreload.py # Desc: get some referance from django # Author: ifkite # Email: holahello@163.com # HomePage: http://github.com/ifkite # python version: 2.7.10 # ...
qt.py
#!/usr/bin/env python3 # # Cash Shuffle - CoinJoin for Bitcoin Cash # Copyright (C) 2018-2019 Electron Cash LLC # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # includ...
example_test.py
import http.server import os import random import re import socket import ssl import struct import subprocess from threading import Thread import ttfw_idf from tiny_test_fw import DUT server_cert = '-----BEGIN CERTIFICATE-----\n' \ 'MIIDWDCCAkACCQCbF4+gVh/MLjANBgkqhkiG9w0BAQsFADBuMQswCQYDVQQGEwJJ\n'\ ...
test_generator.py
import functools import os import threading import unittest import numpy import pytest import cupy from cupy import cuda from cupy.cuda import runtime from cupy.random import _generator from cupy import testing from cupy.testing import _attr from cupy.testing import _condition from cupy.testing import _hypothesis fr...
webserver.py
from ozone import create_app from ozone.config import ProdConfigLinux, DevConfigLinux, ProdConfigWindows, DevConfigWindows, logger from tornado.wsgi import WSGIContainer from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop from ozone.utils.music_util import query_loop import threading import argp...
train_test.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Trains and tests a DenseNet on CIFAR-10. For usage information, call with --help. Author: Jan Schlüter """ import os from argparse import ArgumentParser def opts_parser(): usage = "Trains and tests a DenseNet on CIFAR-10." parser = ArgumentParser(descripti...
TWCManager.py
#! /usr/bin/python3 ################################################################################ # Code and TWC protocol reverse engineering by Chris Dragon. # # Additional logs and hints provided by Teslamotorsclub.com users: # TheNoOne, IanAmber, and twc. # Thank you! # # For support and information, please re...
windows.py
# Diverter for Windows implemented using WinDivert library import logging from pydivert.windivert import * import socket import os import dpkt from . import fnpacket import time import threading import platform from winutil import * from diverterbase import * import subprocess class Windo...
ARTIwrapper.py
# ############################################################################### # Original Author: A.J. Rubio-Montero (http://orcid.org/0000-0001-6497-753X), # # CIEMAT - Sci-Track Group (http://rdgroups.ciemat.es/web/sci-track),# # for the EOSC-Synergy project (EU H2020 RI Grant No 857647). ...
test_sockets.py
# Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. import multiprocessing import os import socket import shutil import s...
funcs.py
import telebot, requests, threading, asyncio, json, io, aiohttp, traceback, lang from vk.exceptions import * from vk import Session, API from PIL import Image from settings import SETTINGS from sql import SQL #Database ialise db = SQL(SETTINGS().DB_NAME) tg = telebot.TeleBot(SETTINGS().TOKEN) loop = asyncio.get_even...
agent.py
from __future__ import absolute_import from builtins import object import logging import numpy as np import threading import six.moves.queue as queue from relaax.common import profiling from relaax.server.common import session from relaax.common.algorithms.lib import utils from relaax.common.algorithms.lib import obs...
quack.py
#!/usr/bin/python3 import os import sys import time import json from pprint import pprint from threading import Thread from colorama import Fore, Back, Style RESET_CHARS = Fore.RESET + Back.RESET + Style.RESET_ALL PATH = os.path.dirname(os.path.realpath(__file__)) SPINNER_JSON = os.path.join(PATH, "data", "spinners.js...
run.py
from __future__ import print_function import os, sys, signal # adding import path for the directory above this sctip (for deeplab modules) myPath = os.path.dirname(sys.argv[0]) rootPath = os.path.join(myPath,'..') uploadPath = os.path.join(rootPath, "upload") resultsPath = os.path.join(rootPath, "results") weightsMod...
debug.py
import code import gc import logging import os import signal import socket import threading import traceback import tracemalloc from types import FrameType from django.conf import settings from django.utils.timezone import now as timezone_now from typing import Optional logger = logging.getLogger('zulip.debug') # In...
db.py
import asyncio from contextvars import ContextVar import logging import os import pickle import re import sqlite3 import sys import threading import time from typing import Any, Callable, List, Mapping, Optional, Union from urllib.parse import quote import aiohttp.web import aiosqlite import asyncpg import morcilla.co...
runner.py
#!/usr/bin/env python3 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
game.py
import logging import pygame as pg from datetime import datetime import g_var from keyboard import Keyboard from frame import Frame from record import Record from utils import rm, upload_ig, get_layout_imgs, load_all_imgs, load_all_walls from constant import game_settings from stage import ( WelcomeStage, Scan...
test_healthcheck.py
# Copyright (c) 2013 NEC Corporation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
lisp-core.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2020 The Ludirium Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test multiwallet. Verify that a ludiriumd node can load multiple wallet files """ from decimal import...
mixed_datasets.py
import glob import hashlib import logging import math import os import random import shutil from itertools import repeat from multiprocessing.dummy import Pool as ThreadPool from pathlib import Path from typing import List, Tuple import cv2 import numpy as np import torch import torch.nn.functional as F import torch.u...
epic_battle_royale.py
import argparse import sys import os from pong_testbench import PongTestbench from multiprocessing import Process, Queue from matplotlib import font_manager from time import sleep import importlib import traceback import numpy as np import pickle parser = argparse.ArgumentParser() parser.add_argument("dir", type=str, ...
resize_images.py
import argparse import cv2 import os import numpy as np import multiprocessing parser = argparse.ArgumentParser() parser.add_argument('--w', help='Target image width') parser.add_argument('--h', help='Target image height') parser.add_argument('--source', help='Directory containing images') parser.add_argument('--targe...
postprocess.py
"""Postprocesses data across dates and simulation runs before aggregating at geographic levels (ADM0, ADM1, or ADM2).""" import argparse import gc import glob import importlib import logging import os import queue import sys import threading import warnings from pathlib import Path import numpy as np import pandas as ...
sdk_worker_main.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
player.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: omi # @Date: 2014-07-15 15:48:27 # @Last Modified by: omi # @Last Modified time: 2015-01-30 18:05:08 ''' 网易云音乐 Player ''' from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import abso...
test_http.py
#!/usr/bin/env python3 # Allow direct execution import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import ssl import threading from test.helper import http_server_port from yt_dlp import YoutubeDL from yt_dlp.compat import compat_http_server, compat_u...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
test_filewatch.py
import os import time import threading import pytest from doit.filewatch import FileModifyWatcher class TestFileWatcher(object): def testInit(self, restore_cwd, tmpdir): dir1 = 'data3' files = ('data/w1.txt', 'data/w2.txt') tmpdir.mkdir('data') for fname in files: tm...
test_drop_collection.py
import pdb import pytest import logging import itertools from time import sleep import threading from multiprocessing import Process from utils import * from constants import * uid = "drop_collection" class TestDropCollection: """ ****************************************************************** The f...
distributed_tf_keras_to_estimator.py
"""Synchronous SGD """ # from __future__ import print_function import os import tensorflow as tf import argparse import time import sys import logging import gzip from StringIO import StringIO import random import numpy as np from tensorflow.python.platform import gfile from tensorflow.python.framework import ops from...
test_url.py
# vim: sw=4:ts=4:et import datetime import http.server import logging import socketserver import threading import unittest import saq, saq.test from saq.constants import * from saq.test import * LOCAL_PORT = 43124 web_server = None class TestCase(ACEModuleTestCase): @classmethod def setUpClass(cls): ...
JoyServerLeftStick.py
#!/python3 # joystick based on: https://www.kernel.org/doc/Documentation/input/joystick-api.txt import socket, sys, os, struct, array, threading from time import * from fcntl import ioctl from can2RNET import * debug = False #host = '192.168.43.47' # FOR COOLPAD hotspot #host = '192.168.43.83' # FOR LG hotspot #ho...
DataController.py
# Use this import to avoid cyclic imports with type checking (requires Python >= 3.7) from __future__ import annotations # Imports import sys import time import math import threading import atexit import carla from bridge.carla.sensor.IMUSensor import IMUSensor from bridge.carla.sensor.GNSSSensor import GNSSSensor f...
test_issue_631.py
import asyncio import collections import logging import os import threading import time import traceback import unittest import pytest from integration_tests.env_variable_names import \ SLACK_SDK_TEST_CLASSIC_APP_BOT_TOKEN, \ SLACK_SDK_TEST_RTM_TEST_CHANNEL_ID from integration_tests.helpers import async_test,...
live_audio_streaming.py
import time, logging import os, sys, argparse from datetime import datetime import threading, collections, queue, os, os.path import deepspeech import numpy as np import pyaudio import wave import webrtcvad from halo import Halo from scipy import signal import cpuinfo import paho.mqtt.client as mqtt import json import...
training.py
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import import warnings import copy import time import numpy as np import multiprocessing import threading import six try: import queue except ImportError: import Queue as queue from .topology import Container from ....
cli.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import argparse import logging import traceback # TODO feel free to PR if you know how to log tracebacks in more elegant way # atm it for some reason doubles traceback string class MyLogger(logging.getLoggerClass()): user = None def makeRecord(self, n...
__version__.py
# pylint: disable=C0415,C0413 # type: ignore __version__ = "7.9" def check_version(): def _check_version(): import sys from distutils.version import LooseVersion as V from xml.etree import ElementTree import httpx try: latest_version = V( Eleme...
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...
node_manager.py
#!/usr/bin/env python3 from os import path from multiprocessing.managers import BaseManager from multiprocessing import Process, Queue import time from url_manager import UrlManager from data_output import DataOutput __author__ = 'Aollio Hou' __email__ = 'aollio@outlook.com' class NodeManager: def start_manag...
test_runtime_rpc.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
__init__.py
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
interface.py
""" Gerbil - Copyright (c) 2015 Michael Franzl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, di...
app.py
from tkinter import * from PIL import Image import tkinter.messagebox from PIL import ImageTk from PIL import * from tkinter import filedialog import threading from tkinter.ttk import Combobox from PIL import ImageFilter import cv2 import numpy as np class Img_filter: def __init__(self,root): self.root...
tests.py
from __future__ import unicode_literals import sys import threading import time from unittest import skipIf, skipUnless from django.db import (connection, transaction, DatabaseError, Error, IntegrityError, OperationalError) from django.test import TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature from dja...
test_paddle_multiprocessing.py
# Copyright (c) 2022 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...
ActionQueue.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 "License")...
websocket_server.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # IkaLog # ====== # Copyright (C) 2015 Takeshi HASEGAWA # # 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/l...
hogwild_trainer.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Any, Tuple import torch import torch.multiprocessing as mp from pytext.common.constants import Stage from pytext.config import PyTextConfig from pytext.config.pytext_config import ConfigBase from pytext.met...
6-3.py
import sys, threading sys.setrecursionlimit(10**7) # max depth of recursion threading.stack_size(2**27) # new thread will get stack of such size def IsBinarySearchTree(j, mn, mx): if not j in tree: return True if tree[j][0] < mn or tree[j][0] > mx: return False return IsBinarySearchTree(tree[j][1], mn, tre...
relay_integration.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
nc.py
from socket import AF_INET6, AF_INET, SOCK_STREAM, SOCK_DGRAM, socket from argparse import ArgumentParser from logging import basicConfig, info, INFO, CRITICAL from threading import Thread ## Options for implement ## Tunnel # -P tunneling port # -S tunneling address # Recieve function (recieve any size buffer) def...
test_socket.py
import time import unittest import six if six.PY3: from unittest import mock else: import mock from engineio import packet from engineio import payload from engineio import socket class TestSocket(unittest.TestCase): def _get_mock_server(self): mock_server = mock.Mock() mock_server.ping_...
radar.py
""" Martin O'Hanlon www.stuffaboutcode.com Pygame radar Attribution: Some radar code - http://simpson.edu/computer-science/ Circle on line equation - http://codereview.stackexchange.com/questions/86421/line-segment-to-circle-collision-algorithm """ import pygame import math import threading BLACK = (0, 0, 0) GREE...
pydoc.py
#! /usr/bin/python3.2 """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online help. Calling help(thing) on a Python object documents the object. Or, at the shell command line outside of Python: Run "pydoc <name>" to show document...
dashboard.py
from json import load from multiprocessing import Manager, Process from os import path import wx from util.led import DashLEDController from util.telemetry import Telemetry from util.ui import UIElements from workers.dashboard_background import worker class DashboardFrame(wx.Frame): def __init__(self, *args, **kw...
diff.py
#!/usr/bin/env python3 # PYTHON_ARGCOMPLETE_OK import argparse import sys from typing import ( Any, Callable, Dict, Iterator, List, Match, NoReturn, Optional, Pattern, Set, Tuple, Type, Union, ) def fail(msg: str) -> NoReturn: print(msg, file=sys.stderr) sys...
rtu_slave.py
#!/usr/bin/env python ''' Pymodbus Asynchronous Server Example -------------------------------------------------------------------------- The asynchronous server is a high performance implementation using the twisted library as its backend. This allows it to scale to many thousands of nodes which can be helpful for ...
cvcapture.py
import numpy as np import threading import cv2 from PyQt5 import QtCore, QtGui, QtQml gray_color_table = [QtGui.qRgb(i, i, i) for i in range(256)] class CVAbstractFilter(QtCore.QObject): def process_image(self, src): dst = src return dst class CVCapture(QtCore.QObject): started = QtCore.p...
log_server_test.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...