source
stringlengths
3
86
python
stringlengths
75
1.04M
build.py
# Copyright (c) 2016 Niklas Rosenstein # # 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, ...
ChatServer.py
import socket import threading import queue import json import time import sys PORT = 6666 msgque = queue.Queue() # 消息队列:用于存储转发所有客户端发来的消息至其它已连接的客户端 lock = threading.RLock() # 可重入锁:保证线程安全,多线程操作数据修改不会混乱 users = [] # 在线用户信息列表:包括 (conn, user, addr) ''' 当前在线用户列表,需要在每个客户端实时更新 ''' def onlines(): online_list = [] ...
pgscout.py
# coding=utf-8 import codecs import logging import signal import sys import time from Queue import PriorityQueue from threading import Thread import math from flask import Flask, request, jsonify, url_for from pgscout.ScoutGuard import ScoutGuard from pgscout.ScoutJob import ScoutJob from pgscout.cache import get_cac...
p030.py
from multiprocessing import Process, Queue def work(s,e,q): q.put(sum([a for a,b in [(x,sum([int(i)**5 for i in str(x)])) for x in xrange(s,e)] if a==b])) t = 10000000 q = Queue() Process(target=work, args=(2,t/4,q)).start() Process(target=work, args=(t/4,t/2,q)).start() Process(target=work, args=(t/2,3*t/4,q))....
grpc_util_test.py
# Copyright 2019 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
import logging try: import queue except ImportError: # pragma: no cover import Queue as queue import signal import threading import time import six from six.moves import urllib try: import requests except ImportError: # pragma: no cover requests = None try: import websocket except ImportError: #...
pavi.py
from __future__ import print_function import logging import os import os.path as osp import time from datetime import datetime from threading import Thread import requests from six.moves.queue import Empty, Queue from ...utils import get_host_info, master_only from .base import LoggerHook class PaviClient(object): ...
client_test.py
import sys import unittest import tornado.httpclient import tornado.concurrent import tornado.testing import tornado.gen import tornado.ioloop import tornado.iostream import tornado.tcpserver import subprocess import threading import tempfile import time import json import socket import ssl import os from datetime im...
cam0_Linux.py
import cv2 from facereco_linux import face_reco import datetime import serial import time import threading import queue import os import face_recognition from flask import Flask,request,make_response,Response from flask_cors import CORS import json import numpy as np import socket imgqueue = queue.Queue() lastopentime...
writer.py
# # Copyright (c) 2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
minion.py
''' Routines to set up a minion ''' # Import python libs import logging import multiprocessing import fnmatch import os import re import threading import time import traceback # Import third party libs import zmq # Import salt libs from salt.exceptions import AuthenticationError, \ CommandExecutionError, Comma...
main.py
import threading from queue import Queue from spider import Spider from domain import * from start import * PROJECT_NAME= 'Project_site' HOMEPAGE = 'http://mldag.charusat.ac.in' #Enter your url here DOMAIN_NAME = get_domain_name(HOMEPAGE) QUEUE_FILE = PROJECT_NAME + '/queue.txt' #list of urls to be crawled C...
inter_process_ping_pong.py
import asyncio import logging import multiprocessing from lahja import BaseEvent, AsyncioEndpoint, ConnectionConfig class BaseExampleEvent(BaseEvent): def __init__(self, payload): super().__init__() self.payload = payload # Define two different events class FirstThingHappened(BaseExampleEvent):...
main.py
# Maze Maker and Solver by Jackson Elia import ctypes import math import random import sys from PyQt5.QtCore import QRect, Qt from PyQt5.QtGui import QBrush, QFont, QIcon, QPainter, QPen, QIntValidator from PyQt5.QtWidgets import QApplication, QLabel, QLineEdit, QMainWindow, QPushButton # Gets time, threading, and copy...
build.py
# Copyright 2014 The Oppia 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 applicable ...
server.py
#!/usr/bin/env python # Copyright (c) 2003-2006 ActiveState Software Inc. # # The MIT License # # 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 limita...
test_acs_speech.py
############################################################################# # NOTICE # # # # This software (or technical data) was produced for the U.S. Government # # under ...
main.py
#!/usr/bin/python import argparse import os from multiprocessing import Process from scapy.all import * from time import sleep def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--iface', dest='iface', required=True, help="Interface to sniff on") parser.add_argument('-m', '--ma...
test_urllib.py
"""Regression tests for what was in Python 2's "urllib" module""" import urllib.parse import urllib.request import urllib.error import http.client import email.message import io import unittest from unittest.mock import patch from test import support import os try: import ssl except ImportError: ssl = None imp...
weather.py
# !/usr/bin/env python3 import threading import time import urllib.request import json from .. import modulebase weather_check_interval = 60 # check every minute city = 'Kanata,ON' cur_weather_url = ('http://api.openweathermap.org/data/2.5/weather?q=%s&units=metric') % (city) forecast_url = ('http://api.openweath...
nanny.py
# -*- coding: utf-8 -*- """A "nanny" process that manages individual server processes.""" # Part of Clockwork MUD Server (https://github.com/whutch/cwmud) # :copyright: (c) 2008 - 2017 Will Hutcheson # :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt) from multiprocessing import Process, Value fr...
test_logging.py
# Copyright 2001-2017 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
app.py
# Copyright 2014 OpenStack Foundation # Copyright 2014 Hewlett-Packard Development Company, L.P. # # 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/LICENS...
test_worker.py
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import os from datetime import timedelta from time import sleep import signal import time from multiprocessing import Process from tests import RQTestCase, slow from tests.fixtures impo...
reduce.py
import string from copy import deepcopy import os.path from time import gmtime, strftime from multiprocessing import Queue from threading import Thread import time import numpy as np import pandas as pd import h5py from refnx.reduce.platypusnexus import ( PlatypusNexus, ReflectNexus, number_datafile, ...
portable_runner.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...
RL.py
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import math import numpy as np from numba import njit import layers from optimizer import LaProp from multiprocessing.sharedctypes import Value, RawValue, RawArray import multiprocessing as mp import time, random from termcol...
Command.py
from Actions.Action import Action import re from threading import Thread class Command(object): _name: str = "" _regex = None _actions: list[Action] = [] _last_match = None def __init__(self, name:str, regex_pattern:str, actions: list[Action]) -> None: self._name = name self._reg...
views.py
import logging import threading import os from rest_framework.views import APIView from rest_framework.response import Response import json import pika import time from channels.layers import get_channel_layer from asgiref.sync import async_to_sync from EOSS.data.problem_specific import assignation_problems, partiti...
server.py
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # 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 us...
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...
remote_access.py
""" * Implementation of remote access Use https://github.com/wang0618/localshare service by running a ssh subprocess in PyWebIO application. The stdout of ssh process is the connection info. """ import json import logging import os import threading import time import shlex from subprocess import Popen, PIPE import sh...
lambda_executors.py
import base64 import contextlib import dataclasses import glob import json import logging import os import re import shlex import subprocess import sys import tempfile import threading import time import traceback import uuid from multiprocessing import Process, Queue from typing import Any, Callable, Dict, List, Optio...
client.py
import threading import numpy as np from pyarrow.flight import FlightClient, FlightDescriptor import pyarrow from .common import gen_names def _in_memory_read(reader, sink): table = reader.read_all() writer = pyarrow.ipc.new_stream(sink, table.schema) writer.write_table(table) writer.close() def s...
val.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640 """ import argparse import json import os import sys from pathlib import Path from threading import Thread import numpy as...
record_video_mb.py
import glob import os import cv2 import time import face_detection import numpy as np import threading def draw_faces(im, bboxes): for bbox in bboxes: x0, y0, x1, y1 = [int(_) for _ in bbox] cv2.rectangle(im, (x0, y0), (x1, y1), (0, 0, 255), 2) def blur_faces(im, bboxes,vwriter): #print(bbox...
logging.py
import os import sys import json import warnings import logging import logging.config from logging import LogRecord import datetime import multiprocessing import time import inspect import functools import tqdm from MCQ.base import DecoratorContextManager from .io import RotateItems class WaitingBar(DecoratorConte...
test_scheduler.py
from datetime import datetime, timedelta import os import signal import time from threading import Thread from rq import Queue from rq.compat import as_text from rq.job import Job from rq_scheduler import Scheduler from rq_scheduler.utils import to_unix, from_unix, get_next_scheduled_time, get_utc_timezone from tests...
client.py
# -*- coding: utf-8-*- from Imgood.linepy import * from Imgood.akad import * from Imgood.linepy.style import * from justgood import imjustgood from time import sleep from gtts import gTTS from datetime import datetime from bs4 import BeautifulSoup from threading import Thread, active_count import os,traceback...
friend_window.py
''' @author: misterlihao This is supposed to be main window ''' import mailHandle from synchronizationRole import updataIfNeed import friend_list_item as FLI import win32gui, win32api, win32con import struct from FriendList import FriendList import threading import online_check as oc import message_transaction as mt im...
tb_device_mqtt.py
# Copyright 2020. ThingsBoard # # 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 ...
shellv2.py
# Arachnoid Client Shell - Version 2 : Usage ''' This version of the client brings enormous speed optimization (in comparaison with Arachnoid Shell Version 1 <- see interpreter.py) The thing about Shell 2 (shot for Arachnoid Client Shell - Version 2), is that the shell function, which is found in interpreter.py,...
webserver.py
# Copyright 2013 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. from __future__ import absolute_import import six.moves.BaseHTTPServer import os import six.moves.socketserver import threading import ssl import sys class...
leadgen.py
#!/usr/bin/env python3 import re, math, time, csv, os, requests, logging, argparse, threading from urllib import parse from bs4 import BeautifulSoup class WebPage(): """Webpage scraper class. Scrapes yellowpages.com for business information based on a keyword and location. Attributes: uri:...
sniffer.py
#!/usr/bin/env python # # Copyright (c) 2016, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # ...
plexus.py
import random import math import threading import time class Neuron(): def __init__(self, network): self.network = network self.subscriptions = {} self.publications = {} self.potential = random.uniform(0.0, 1.0) self.desired_potential = None self.loss = None ...
app.py
#! /usr/bin/env python3 # ---------------------------------------------------------------------------- # # app.py # # # # By - jacksonwb ...
nn_test.py
# Copyright 2020 The Flax 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 wri...
test_server_compression.py
# The MIT License (MIT) # Copyright © 2021 Yuma Rao # 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...
__init__.py
# coding: utf-8 # from __future__ import absolute_import, print_function import threading import re import time import datetime import csv import sys import atexit from collections import namedtuple _MEM_PATTERN = re.compile(r'TOTAL[:\s]+(\d+)') # acct_tag_hex is a socket tag # cnt_set==0 are for background data # c...
kb_kaijuServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
notebookapp.py
# coding: utf-8 """A tornado based IPython notebook server. Authors: * Brian Granger """ from __future__ import print_function #----------------------------------------------------------------------------- # Copyright (C) 2013 The IPython Development Team # # Distributed under the terms of the BSD License. The fu...
test_sys.py
import builtins import codecs import gc import locale import operator import os import struct import subprocess import sys import sysconfig import test.support from test import support from test.support import os_helper from test.support.script_helper import assert_python_ok, assert_python_failure from test.support imp...
helper.py
import os import platform import subprocess import time from collections import OrderedDict, defaultdict from functools import wraps from itertools import chain, combinations from re import ASCII, match from threading import Thread from typing import ( Any, Callable, DefaultDict, Dict, FrozenSet, Iterable, List, Se...
socketio-video.py
import datetime from threading import Thread import base64 import time import socketio import glob sio = socketio.Client(logger=True) class WebCamVideoStream: def __init__(self, sio, src='/home/hcwinsemius/temp/phone/*.jpg'): # initialize the video camera stream and read the first frame # from the...
tasks.py
from __future__ import absolute_import import json import logging from datetime import datetime from threading import Thread from tornado import web from tornado import gen from tornado.escape import json_decode from tornado.web import HTTPError from celery import states from celery.result import AsyncResult from c...
two_service.py
""" 定义 url 的时候,其实就是定义函数的时候 定义 url,其实就是定义路由 定义 views,其实就是定义方法 可以继承一个新的类,来生成 views 所需要的参数。 """ # Parser should be applied to create name ... from micro.service import BaseService # Use core_app ... to make debug avaliable. from micro.web import app class ServiceA(BaseService): """ evert time a service was d...
train_rgb.py
#!/usr/bin/env python """Example code of learning a RGB dataset by the stage1 of Multimodal Deep Learning model. Prerequisite: To run this example, crop the center of ILSVRC2012 training and validation images and scale them to 256x256, and make two lists of space- separated CSV whose first column is full path to image...
bar.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import threading from time import ctime, sleep def music(func): for i in range(2): print("I was listening to %s. %s" % (func, ctime())) sleep(1) def move(func): for i in range(2): print("I was at the %s! %s" % (func, ctime())) sleep(5...
crawler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import calendar import datetime import json import logging import math import re import ssl import threading import urllib.parse import urllib.request from queue import Queue from time import sleep, time import requests from geopy import Point from geopy.distance import g...
12.robot_servo_face.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ * @par Copyright (C): 2010-2020, Hunan CLB Tech * @file robot_sevo_face * @version V1.0 * @details * @par History @author: zhulin """ from __future__ import division import cv2 import time import numpy as np #from LOBOROBOT import ...
pantsd_integration_test.py
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import glob import os import shutil import signal import sys import threading import time import unittest from pathlib import Path from textwrap import ...
mp_reader.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...
twitch_module.py
#twitch beholder video module import requests import json import time import subprocess import sys import argparse import logging import sqlite3 import threading import streamlink import os LOCATION_REC = "./" version = "0.1.2" CHECK_FREQUENCY = 1 * 20 # in seconds #запрос переменной из файла oauth_tok...
Cl0neMast3r.py
# coding: utf-8 # Coded with love and bugs by Abdulraheem Khaled @abdulrah33mk import os from re import search from requests import get from threading import Thread from bs4 import BeautifulSoup from datetime import datetime # Adding some colors to the script end = '\033[1;m' red = '\033[1;31m' white = '\033[1;37m' ...
feeder.py
import os import threading import time import numpy as np import tensorflow as tf from utils.infolog import log from sklearn.model_selection import train_test_split class Feeder: """ Feeds batches of data into queue on a background thread. """ def __init__(self, coordinator, input_path, hparams)...
vclipboard.py
import os import time import shutil import src.info.computerinfo as ci from src.files import TEMP_FLOW from src.hardware.clipboard import ClipboardListener, Clipboard from src.ui.qtthread import flowThread class VirtualClipboard: """ Simulates a virtual clipboard between machines. TCP communication ...
main.pyw
from time import sleep, time from utility.grabscreen import grab_screen,window_movetop from pathlib import Path import win32gui import cv2 from easyocr import Reader import subprocess import time import mouse import threading import PySimpleGUI as sg import yaml import sys import requests #fix from PIL import ImageFile...
chat_client.py
import socket import threading nickname = input("Choose your nickname: ") # Connecting To Server client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(('127.0.0.1', 55555)) # Listening to Server and Sending Nickname def receive(): while True: try: # Receive Message From Serv...
Time_transmit.py
# # Created on Sat Oct 09 2021 # Author: Owen Yip # Mail: me@owenyip.com # import os,sys pwd = os.path.abspath(os.path.abspath(__file__)) father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..") sys.path.append(father_path) import time from datetime import datetime import threading from Communication....
thread_gps.py
import threading import time from gps3 import gps3 latitude=0 longitude=0 gps_socket = gps3.GPSDSocket() data_stream = gps3.DataStream() gps_socket.connect() gps_socket.watch() class GPS(object): def __init__(self): thread = threading.Thread(target=self.run, args=()) thread.daemon = True ...
target_selector.py
# pylint:disable=unused-argument import typing from typing import List, Optional, TYPE_CHECKING import threading import asyncio from tornado.platform.asyncio import AnyThreadEventLoopPolicy import PySide2 from PySide2.QtWidgets import QDialog, QPushButton, QHBoxLayout, QVBoxLayout, QMessageBox, QTableView, \ QAbs...
watchtower.py
#!/usr/bin/env python3 import os import plyvel from queue import Queue from pyln.client import Plugin from threading import Thread, Lock import common.receipts as receipts from common.tools import compute_locator from common.appointment import Appointment from common.config_loader import ConfigLoader from common.crypt...
autoredirect.py
import regex import argparse import requests import os import threading currentPath = os.path.dirname(__file__) CANARY_TEXT = 'CANARY049' CANARY_DOMAIN = 'canaryredirect.fr' FUZZ_PLACE_HOLDER = '??????' TIMEOUT_DELAY = 1.75 LOCK = threading.Lock() parser = argparse.ArgumentParser() parser.add_argument("--file", "-f...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
fast_stream_server.py
import socketserver import cv2 import threading import sys import numpy as np import time # get distance data sensor_data = None # Distance Data from Arduino Sensor class SensorDataHandler(socketserver.BaseRequestHandler): data = " " def handle(self): global sensor_data while self.data: ...
sessions.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import os import sys import json from multiprocessing import Process, Queue, cpu_count from contextlib import contextmanager import traceback from threading import Thread try: from StringIO imp...
transfer_manager.py
""" Manage transfers from arbitrary URLs to temporary files. Socket interface for IPC with multiple process configurations. """ import json import logging import os import socket import subprocess import threading from six.moves import shlex_quote from galaxy.util import ( listify, sleeper, unicodify, ) ...
poly_SlaveServer.py
from SimpleXMLRPCServer import SimpleXMLRPCServer from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler import xmlrpclib import socket import fcntl import struct import multiprocessing import numpy as np import sys import json import time import os configs = json.load(open('/home/zhifeng/apps/s2c2/config/config.js...
client.py
import socket, sys, threading, time import test_pygame class ThreadReception(threading.Thread): """object thread gérant la réception des messages""" def __init__(self, HOST, PORT): threading.Thread.__init__(self) self.SC_W = 0 self.SC_C = 0 self.connexion = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
cronjobs.py
#!/usr/bin/env python """Cron management classes.""" import random import threading import time import logging from grr import config from grr.lib import access_control from grr.lib import aff4 from grr.lib import flow from grr.lib import master from grr.lib import queue_manager from grr.lib import rdfvalue from gr...
datasets.py
# Dataset utils and dataloaders import glob import logging import math import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image, Exif...
runLSC.py
#!/usr/bin/python import sys import struct import os from numpy import * import datetime from re import * from copy import * import threading import string import commands def log_print(print_str): os.system("echo '" + str(print_str) + "'") def log_command(print_str): os.system("echo " + str(print_str)) ...
updater.py
import subprocess import logging from threading import Event, Thread from time import sleep from typing import Iterator, Optional from . import UpdateException from .git import Git from .helm_repo import HelmRepo from .manifest import Manifest log = logging.getLogger("chart-updater") class Updater: def __init__...
mp.py
import os import pickle import struct import sys from functools import partial from multiprocessing import Lock, Event as ProcessEvent from threading import Thread, Event as TrEvent from time import sleep, time from typing import List, Dict, Optional from multiprocessing import Process import psutil from six.moves.que...
process.py
import youtube_dl import os, subprocess import threading, queue import logging import json, time from multiprocessing import Value logger = logging.getLogger("RaspberryCast") volume = 0 status = Value("u","0") omx_cmd = queue.Queue() video_queue = queue.Queue() def launchvideo(url, config, sub=False): setState("2...
watchAlerts.py
#!/usr/bin/env python # coding: utf-8 import aprslib import bz2 from datetime import datetime, timedelta from dateutil.parser import parse import gc import shelve import logging import objgraph import pickle import pyproj import pytz import re import requests import sqlite3 import schedule import sys import telnetlib f...
comm_general.py
from threading import Thread, Lock from mpi4py import MPI import sys from time import sleep import commutils from enums import CsState, REQUEST, NOT_USED class BaseCommAdapter(object): def __init__(self, comm, logging=False): self.logging = logging self._comm = comm def __getattr__(self, name...
test_functools.py
import abc import collections import copy from itertools import permutations import pickle from random import choice import sys from test import support import unittest from weakref import proxy try: import threading except ImportError: threading = None import functools py_functools = support.import_fresh_mod...
server.py
import importlib import threading import subprocess import socket import logging import time import redis import exceptions from client import Client from inventory import Inventory from parser import Parser modules = ["client_error", "house", "outside", "user_rating", "mail", "avatar", "location_game", "re...
SECURITY.py
from tkinter import * from tkinter import ttk from PIL import Image, ImageTk import cv2 import numpy as np import os from os.path import isfile, join from threading import Thread from userHandler import UserData import FACE_UNLOCKER as FU background, textColor = 'black', '#F6FAFB' background, textColor = t...
webhookupdater.py
import hashlib import hmac import json import logging from threading import Thread from typing import Dict from telegram import Update from telegram.ext import Updater from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop from tornado.web import Application, RequestHandler, HTTPError from bot.co...
robot.py
# Copyright 2019 Hanson Robotics 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
vvsearch4web.py
from threading import Thread from time import sleep from DBcm import UseDatabase, ConnectionError, CredentialsError, SQLError from flask import Flask, render_template, request, session, copy_current_request_context from vvsearch import search4letters from head_first_python.decorator.checker import check_logged_in ap...
Keeping_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Jaaag is online! All systems operational and Cogs are loaded." def run(): app.run(host='0.0.0.0', port=8080) def keep_alive(): t = Thread(target=run) t.start()
pipe.py
from lithops.multiprocessing import Process, Pipe def f(conn): conn.send([42, None, 'hello']) conn.close() if __name__ == '__main__': parent_conn, child_conn = Pipe() p = Process(target=f, args=(child_conn,)) p.start() print(parent_conn.recv()) # prints "[42, None, 'hello']" p.join()
proto_receiver.py
import queue from threading import Thread import software.thunderscope.constants as constants from software.networking.threaded_unix_listener import ThreadedUnixListener class ProtoReceiver: def __init__(self): self.proto_map = dict() self.proto_receiver = ThreadedUnixListener( consta...
server.py
""" Utilities for creating bokeh Server instances. """ from __future__ import absolute_import, division, unicode_literals import os import signal import sys import threading import uuid from contextlib import contextmanager from functools import partial from types import FunctionType, MethodType from bokeh.document....
example6.py
import threading import time from timeit import default_timer as timer def thread_a(): print("Thread A is starting...") print("Thread A waiting to acquire lock A.") lock_a.acquire() print("Thread A has acquired lock A, performing some calculation...") time.sleep(2) print("Thread A waiting to...
possibleMoves.py
from __future__ import print_function from __future__ import print_function import asyncio import time import concurrent.futures import concurrent.futures from copy import deepcopy import random import multiprocessing class Pos: #the restof the code is built on this class def __init__(self, x, y): ...