source
stringlengths
3
86
python
stringlengths
75
1.04M
mitm.py
#!/usr/bin/env python2 from __future__ import print_function import traceback import random import socket import argparse import threading import signal import json import requests import sys import time from Queue import Queue from contextlib import contextmanager running = True verbose = True c2s = 0 s2c = 0 CLIEN...
CommandsHandler.py
# Other from threading import Thread # Commands Interfaces from source.commands.interfaces.BalanceInterface import BalanceInterface from source.commands.interfaces.DoubleHelpInterface import DoubleHelpInterface from source.commands.interfaces.GlobalTopInterface import GlobalTopInterface from source.commands.interfaces...
ordercontroller.py
#!/usr/bin/env python3 # encoding: utf-8 # # Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. # # This file is part of ewm-cloud-robotics # (see https://github.com/SAP/ewm-cloud-robotics). # # This file is licensed under the Apache Software License, v. 2 except as noted # otherwise in the LIC...
analyzer.py
# # Licensed to Dagda under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Dagda licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance...
subproc_vec_env.py
import numpy as np from multiprocessing import Process, Pipe from . import VecEnv from pysc2.env import environment from pysc2.env import sc2_env from pysc2.lib import features, actions _PLAYER_RELATIVE = features.SCREEN_FEATURES.player_relative.index _SELECTED = features.SCREEN_FEATURES.selected.index from common im...
test_fft.py
import functools import unittest import pytest import numpy as np import cupy from cupy import testing from cupy.fft import config from cupy.fft.fft import _default_fft_func, _fft, _fftn import six def nd_planning_states(states=[True, False], name='enable_nd'): """Decorator for parameterized tests with and wih...
lisp.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...
__init__.py
import faulthandler import logging import os import random import socket import string import threading import time import requests import aria2p import telegram.ext as tg from dotenv import load_dotenv from pyrogram import Client import psycopg2 from psycopg2 import Error faulthandler.enable() import subprocess fro...
server-practice.py
# -*- coding: utf-8 -*- import socket, threading, time #TCP socket based on ipv4 #server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #listening on port s.bind(('127.0.0.1', 9999)) s.listen(5) print("Waiting for connection...") def tcplink(sock, addr): print('Accept new connection from %s:%s...' % addr...
_a4c_pre_configure_source.py
from cloudify import ctx from cloudify.exceptions import NonRecoverableError from cloudify.state import ctx_parameters as inputs import subprocess import os import re import sys import time import threading import platform from StringIO import StringIO from cloudify_rest_client import CloudifyClient from cloudify im...
job_concurrency1_test.py
# -*- coding: utf-8 -*- u"""Concurrency testing This test does not always fail when there is a problem (false positive), because it depends on a specific sequence of events that can't be controlled by the test. :copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/license...
videowriter.py
# video writer # * writes frames at a fixed rate even if camera's rate varies or is imprecise, # possibly dropping or repeating frames in the process # (note: for LifeCam, the frame rate depends on the exposure) # * also writes trajectories (which need to be in sync with frames written) # * stop() needs to be called ...
api_test.py
import datetime import json import io import os import re import shutil import socket import tempfile import threading import time import unittest import docker from docker.api import APIClient import requests from requests.packages import urllib3 import six from . import fake_api import pytest try: from unitte...
train_rl_room.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import h5py import time import argparse import numpy as np import os, sys, json import os.path as osp import tor...
tests.py
import threading import time from unittest import mock from multiple_database.routers import TestRouter from django.core.exceptions import FieldError from django.db import ( DatabaseError, NotSupportedError, connection, connections, router, transaction, ) from django.test import ( TransactionTestCase, ove...
download_data_demo2.py
""" 我们使用币安原生的api进行数据爬取. """ import pandas as pd import time from datetime import datetime import requests import pytz from jiamtrader.trader.database import database_manager pd.set_option('expand_frame_repr', False) # from jiamtrader.trader.object import BarData, Interval, Exchange BINANCE_SPOT_LIMIT = 1000 BI...
common.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...
hipchat.py
from datetime import datetime import json import logging from multiprocessing.queues import Empty from multiprocessing import Process, Queue import random import re import requests import pickle import sys import time import threading import traceback from sleekxmpp import ClientXMPP from sleekxmpp.exceptions import I...
__main__.py
#!/usr/bin/env python # # Copyright (c) 2011, The University of York # All rights reserved. # Author(s): # Tai Chi Minh Ralph Eastwood <tcmreastwood@gmail.com> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * R...
friends_manager.py
#!/bin/python3 import add_friends from threading import Thread import interaction_with_db def main(table_name='accounts_bot'): """ Запускает add_friends.add_all_new_friends() для каждого бота в отдельном потоке :param table_name: Имя таблицы с ботами в БД :type table_name: str """ cur = inter...
LineBot.py
import tweepy from flask import Flask, redirect, url_for, render_template,request,flash import Data_analy #### from multiprocessing import Process from flask import Flask, request, abort from linebot import ( LineBotApi, WebhookHandler ) from linebot.exceptions import ( InvalidSignatureError ) from linebot....
infolog.py
import atexit from datetime import datetime import json from threading import Thread from urllib.request import Request, urlopen _format = '%Y-%m-%d %H:%M:%S.%f' _file = None _run_name = None _slack_url = None def init(filename, run_name, slack_url=None): global _file, _run_name, _slack_url _close_logfile() _...
workbench.py
# -*- coding: utf-8 -*- import ast import collections import importlib import logging import os.path import pkgutil import platform import queue import re import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback import webbrowser import gettext from threading import Thread from tki...
Pose.py
# op class,调用openpose用于分析每一帧图像,获得图像身体节点坐标 import sys import cv2 import os from sys import platform import argparse #from tello import * from UI import FPS, RollingGraph from math import atan2, degrees, sqrt, pi import numpy as np import time import gc from multiprocessing import Process, Manager #import profile import...
shopify-sites.py
''' NERYS a universal product monitor Current Module: Shopify Sites Usage: NERYS will monitor specified sites for keywords and sends a Discord alert when a page has a specified keyword. This can be used to monitor any site on a product release date to automatically detect when a product has been uploaded. U...
logic_batch.py
"""Analytic """ import multiprocessing as mp import logic_generator as lg from tqdm import tqdm def get_totalCores(): """Get the total numbers of cores.""" print("Number of Cores:", mp.cpu_count()) def generator_func(items=1): """Reference function for multiprocessing. Parameters ---------- ...
keep_alive.py
from threading import Thread from flask import Flask app = Flask('') @app.route('/') def home(): return "I'm keeping alive" def run(): app.run(host='0.0.0.0', port=8080) def keep_alive(): t = Thread(target=run) t.start()
context.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...
app.py
import os import re import sys import shutil import json import traceback import numpy.core._dtype_ctypes 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 from m...
image_benchmarker.py
#!/usr/bin/env python from argparse import ArgumentParser from msgpackrpc.error import RPCError import airsim import time import threading import numpy as np import cv2 class ImageBenchmarker(): def __init__(self, img_benchmark_type = 'simGetImage', viz_image_cv2 = False): self.a...
video_transformer.py
import os import cv2 import numpy as np import argparse import shutil import multiprocessing from tqdm import tqdm # command line parser parser = argparse.ArgumentParser() parser.add_argument('--videos_folder', type=str, required=True, help='the path to video dataset folder.') parser.add_argument('--out...
mtsleepC.py
#!/usr/bin/env python import threading from time import sleep, ctime loops = [4,2] def loop(nloop, nsec): print('start loop', nloop, 'at:', ctime()) sleep(nsec) print('loop', nloop, 'done at:', ctime()) def main(): print('starting at:', ctime()) threads = [] nloops = range(len(loops)) f...
diskover.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """diskover - Elasticsearch file system crawler diskover is a file system crawler that index's your file metadata into Elasticsearch. See README.md or https://github.com/shirosaidev/diskover for more information. Copyright (C) Chris Park 2017-2019 diskover is released unde...
Simon.py
import RPi.GPIO as GPIO #import GPIOmock as GPIO import threading import time import random import os from subprocess import call # green, red, blue, yellow LIGHTS = [33, 37, 35, 31] BUTTONS = [11, 15, 13, 7] NOTES = ["E3", "A4", "E4", "Cs4"] # values you can change that affect game play speed = 0.25 use_sounds = Tru...
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...
WeaveDeviceMgr.py
# # Copyright (c) 2013-2018 Nest Labs, Inc. # Copyright (c) 2019-2020 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://w...
can_bridge.py
#!/usr/bin/env python3 #pylint: skip-file import os import time #import math #import atexit #import numpy as np #import threading #import random import cereal.messaging as messaging #import argparse from common.params import Params from common.realtime import Ratekeeper from selfdrive.golden.can import can_function, se...
SystemMonitor.py
# List available serial ports import sys import glob import threading import time import serial from Parsing import Data import numpy as np # NumPy (multidimensional arrays, linear algebra, ...) import matplotlib as mpl # Matplotlib (2D/3D plotting library) #import matplotlib.pyplot as plt #...
exp_cameraman.py
import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) import os import time import threading import numpy as np from picamera import PiCamera from lib_utils import * from lib_depthsensor import DepthSensor from lib_fin import Fin os.makedirs('./data/{}/'.format(U_FILENAME)) class Video(): pi...
views.py
from flask import Flask, render_template, Response, request, redirect, url_for, send_file # from ..url_for2 import url_for2 from flask_login import login_required, current_user import cv2 import datetime, time import os, sys import numpy as np from threading import Thread from . import cam from itertools import count ...
__main__.py
#!/usr/bin/env python3 """ The MIT License Copyright (c) 2019 Kyle Christensen 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,...
video_stream.py
# Based on code from the excellent: PyImageSearch.com from threading import Thread, Lock import cv2 from loguru import logger @logger.catch class VideoStream: """Create a thread and read frames from video source. If we can't find video on the hardware camera, try streamlink. Keyword arguments: ...
log_server.py
""" Log Server ========== """ import logging import threading import attr import msgpack import pytest import zmq from saltfactories.utils import platform from saltfactories.utils import ports from saltfactories.utils import time log = logging.getLogger(__name__) @attr.s(kw_only=True, slots=True, hash=True) class ...
log_handler.py
"""Handler for log messages, both from the logging library and from Snakemake.""" import datetime import logging import logging.handlers import os import pickle import re import socketserver import struct import threading import time from collections import defaultdict from datetime import timedelta from pathlib import...
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 signal import sys import tempfile import threading import time import uuid import zipfile from contextlib import closing, contextmanager from ...
handler.py
import logging import time from abc import ABCMeta from collections import defaultdict from queue import Queue from threading import Lock, Thread from __main__ import config from ..types import ActiveHunter, Hunter from ...core.events.types import HuntFinished import threading global queue_lock queue_lock = Lock() ...
listener.py
import SocketServer import threading import socket import re from PIL import Image import kirk import ImageTk import Tkinter from showTk import showTk File = kirk.File width = kirk.width height = kirk.height box_size = kirk.box_size window = [] class ThreadedUDPServer(SocketServer.ThreadingMixIn, SocketServer.UDPSer...
server.py
import os import logging import socket import time import pickle import psutil from argparse import ArgumentParser from threading import Thread, Lock from nesta.server.define import define from nesta.server import schedule from nesta.external.daemon import Daemon from nesta.tasks.tasks import get_worker from nesta.task...
conc.py
""" Helpers for concurrency and threading stuff. """ import threading def simple_thread(func, daemon=True): """ Start function in another thread, discarding return value. """ thread = threading.Thread(target=func) thread.daemon = daemon thread.start() return thread
command.py
""" Copyright (c) 2019-2020 Intel 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 w...
conftest.py
import pytest import server from multiprocessing import Process @pytest.fixture(scope='session', autouse=True) def server_setup(): instance = server.create_server() process = Process(target=instance.serve_forever) process = Process(target=instance.serve_forever) process.daemon = True process.sta...
docserver.py
from __future__ import print_function import flask import os import sys import threading import time import webbrowser import tornado from tornado.wsgi import WSGIContainer from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop _basedir = os.path.join("..", os.path.dirname(__file__)) app = flas...
test_socketserver.py
""" Test suite for socketserver. """ import contextlib import io import os import select import signal import socket import tempfile import threading import unittest import socketserver import test.support from test.support import reap_children, verbose from test.support import os_helper from test.support import sock...
main.py
import sys, pygame, math,time,numpy,re from hashlib import sha1 import xml.etree.ElementTree as ET pygame.init() pygame.font.init() def cthread(func,args): t = Process(target = func, args = args) t.start() def calculate_circle_points(x, y, r): points = [] for i in range(-r, r + 1): s = math.sq...
Transport.py
import os import RNS import time import math import struct import threading import traceback from time import sleep from .vendor import umsgpack as umsgpack class Transport: """ Through static methods of this class you can interact with Reticulums Transport system. """ # Constants BROADCAST ...
test_uwsgi_daemon.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # The MIT License (MIT) # Copyright (c) 2020 SBofGaySchoolBuPaAnything # # 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, in...
test_grpc_host_server.py
#!/usr/bin/env python from concurrent import futures import grpc import sys from time import sleep from threading import Thread sys.path.append('../../src/tira') from proto import tira_host_pb2, tira_host_pb2_grpc from test_grpc_host_client import TestGrpcHostClient STATE = {"status": 'stopped'} class TiraHostServ...
requester.py
import socket import sys import time import threading import errno from termcolor import colored, cprint try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setblocking(0) except socket.error: print 'Failed to create socket' sys.exit() host = 'localhost'; port = 8888; msg = '__client__' s.s...
project.py
import sublime import sublime_plugin from queue import Queue import queue from threading import Thread from zipfile import ZipFile import os from FSharp.lib import const from FSharp.lib.fsac import get_server from FSharp.lib import fs tasks = Queue() task_results = Queue() SIG_QUIT = '<<QUIT>>' def plugin_loade...
Marauders.py
# -*- coding: utf-8 -*- from math import sqrt, floor, ceil import os, time, sys, yaml, kirk import Tkconstants as C #import tkinter.constants as C from Tkinter import Tk, Frame, LEFT, Button, Label, PhotoImage, TOP, \ FLAT, BOTH, Image from PIL import Image, ImageTk, ImageDraw import threading import thread impo...
buffer.py
from databuffer.data import buffered_urls, timeout from threading import Thread import time import requests def cleaningTask(): while True: for c, item in enumerate(buffered_urls): if (time.time() - item["time"]) > timeout: buffered_urls.pop(c) time.sleep(timeout / 2) d...
train_detector.py
import os import json import torch import numpy as np import queue import pprint import random import argparse import importlib import threading import traceback import torch.distributed as dist import torch.multiprocessing as mp from tqdm import tqdm from torch.multiprocessing import Process, Queue, Pool from core....
Interpark + telegram.py
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.alert import Alert from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.common.excep...
ntlmrelayx.py
#!/usr/bin/env python # Impacket - Collection of Python classes for working with network protocols. # # SECUREAUTH LABS. Copyright (C) 2022 SecureAuth Corporation. All rights reserved. # # This software is provided under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # f...
adatgyujtes.py
#!/usr/bin/env python import datetime import json import math import operator import optparse import os import re import shutil import sys import threading import time import webbrowser from collections import namedtuple, OrderedDict from functools import wraps from getpass import getpass import pdb # Py3k compat. i...
Deep_Learning_CatxDog.py
# -*- coding: utf-8 -*- """ Spyder Editor Este é um arquivo de script temporário. """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: demetrios """ #%% [1] Import necessarios import numpy as np import pandas as pd from os import listdir from os.path import join, basename from PIL import Image #%% [2] C...
pkb.py
# Copyright 2019 PerfKitBenchmarker 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...
pisocket.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # pisocket # Telnet for sharing texts on LED banner # # see ../LICENSE file for licence # see README.md for more info # see CHANGELOG.md for detailed changes in each version # # (c) 2017 kj/P1X # import socket import struct import threading import config cfg = config....
meteor_shower.py
#!/usr/bin/env python # Learn Meteor parameters quickly with up to 42 Meteors # Run as many as requeted in parallel # Meteors use 1 cpu / 2gb each import collections, os, subprocess, sys, threading def main(argv): if len(argv[1:]) < 7: print >> sys.stderr, 'Learn Meteor parameters efficiently with p...
celeste_timer.py
#!/usr/bin/env python3 import os import struct import threading import time import collections import random # 00 string Level; # 08 int Chapter; # 0c int Mode; # 10 bool TimerActive; # 11 bool ChapterStarted; # 12 bool ChapterComplete; # 18 long ChapterTime; # 20 int ChapterStrawberries; # 24 bool ChapterCassette; #...
__init__.py
from threading import Thread import trollius from trollius import From import pygazebo from pygazebo.msg import poses_stamped_pb2 from pyquaternion import Quaternion from math import pi loop = trollius.get_event_loop() EXIT = False def exit(): EXIT = True loop.stop() print("exiting... motion captrue") de...
client-chat.py
import socket import sys import argparse import threading address = "127.0.0.1" port = 4444 username = "Me" servername = "Received" def recv_data(s): while True: try: data=s.recv(1024) print(f"\n{servername}: {data.decode()}\n{username}: ", end="") except Con...
server.py
#!/usr/bin/python ''' Andrei Dorin 06/10/2018 Server interface for WISP server implementation ''' import argparse import logging import sys import signal import socket as so import threading import wisp_common as wcom from wisp_common import WispRequest from wisp_server import WispServer # Database for user accounts...
trustedcoin.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 Thomas Voegtlin # # 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...
server.py
####################################################### # # TAKFreeServer.py # Original author: naman108 # This code is Open Source, made available under the EPL 2.0 license. # https://www.eclipse.org/legal/eplfaq.php # credit to Harshini73 for base code # ####################################################### import...
gobackn.py
import threading import random import time import socket LOCK = threading.Lock() TIMEOUT = 1000 TIMEUP = False NETWORK_LAYER_READY = True BASE_TIME = int(round(time.time() * 1000)) current_milli_time = lambda: int(round(time.time() * 1000) - BASE_TIME) TIMER = current_milli_time() def add_zeroes(string, size): z...
zhihu_login.py
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: zhihu_login.py Description : Forked from https://github.com/zkqiang/zhihu-login,并增加了推荐内容的爬取 Author : LSQ date: 2020/10/16 ------------------------------------------------- Change Activity: ...
internals.py
import asyncio import atexit import sys from logging import disable, CRITICAL from threading import Thread def __run_loop(loop: asyncio.AbstractEventLoop): asyncio.set_event_loop(loop) loop.run_forever() def __stop_loop(loop: asyncio.AbstractEventLoop, thread: Thread): # pragma: no cover disable(CRITI...
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...
Startup.py
import sys import os sys.path.insert(-1, os.path.expanduser("~/Documents")) sys.path.insert(-1, os.path.expanduser("~/Documents/site-packages")) import io import console import code import pyto from importlib.machinery import SourceFileLoader import importlib import threading from time import sleep from outputredirec...
trees.py
from Queue import Queue from threading import Thread, Lock from time import sleep from ml.feature_extraction import BTree from utils import parse_timespan class BuildWorker(Thread): def __init__(self, par): super(BuildWorker,self).__init__() self.daemon = True self.par = par ...
base.py
import os import re import logging import threading import ujson as json from abc import ABC, abstractmethod from datetime import datetime, timedelta from shutil import copy2 from flask_wtf import FlaskForm from wtforms import StringField, BooleanField from wtforms.validators import InputRequired, Optional, Validatio...
AutoSpreader.py
from distutils.log import debug from urllib.request import Request, urlopen from json import loads, dumps from time import sleep from threading import Thread from flask import Flask from waitress import serve import requests from discord_webhook import DiscordWebhook, DiscordEmbed app = Flask(__name__) de...
send.py
from PyQt5.QtWidgets import QApplication, QMainWindow, QSizePolicy import xtd_ui import rospy from geometry_msgs.msg import Twist, PoseStamped, TwistStamped from std_msgs.msg import String from multiprocessing import Process,Queue from PyQt5.QtCore import * from receive import Ros2Gui from PIL import Image import rando...
miniterm.py
#!/Users/tomasero/Library/Mobile Documents/com~apple~CloudDocs/Documents/MIT/Spring19/byte.it/Adafruit_Python_BluefruitLE/examples/env/bin/python3 # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Iden...
utils.py
# Adapted from: https://github.com/ArrowLuo/CLIP4Clip/blob/master/util.py import torch import torch.nn as nn import threading from torch._utils import ExceptionWrapper import logging def get_a_var(obj): if isinstance(obj, torch.Tensor): return obj if isinstance(obj, list) or isinstance(obj, tuple): ...
process.py
'''Video Processing ===================== Provides a class that manipulates files en-masse using FFmpeg. It can compress/uncompress/merge/concatenate or perform other tasks on video files. In order to use this module, the ffmpeg binaries need to be installed in the parent directory of this module, or in $(FFMP...
gatecoin.py
from befh.restful_api_socket import RESTfulApiSocket from befh.exchanges.gateway import ExchangeGateway from befh.market_data import L2Depth, Trade from befh.util import Logger from befh.instrument import Instrument from befh.clients.sql_template import SqlClientTemplate import time import threading from functools impo...
server.py
import sys import os from datetime import timedelta import threading curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(os.path.split(rootPath)[0]) from src.web.web_util.web_util import judge_pool, get_redis_conn, begin_check_redis from flask import Flask, render_t...
ArmoryQt.py
#! /usr/bin/python # -*- coding: UTF-8 -*- ################################################################################ # # # Copyright (C) 2011-2015, Armory Technologies, Inc. # # Distributed under the GNU Affero...
archiver.py
""" Code to facilitate delayed archiving of FITS files in the images directory """ import os import time import queue import atexit import shutil from contextlib import suppress from threading import Thread from astropy import units as u from panoptes.utils.utils import get_quantity_value from panoptes.utils.time impo...
ortc_extensibility.py
import httplib import re import random import string import time import websocket import json import threading REST_TIMEOUT = 5 class OrtcError(Exception): def __init__(self, message): self.message = message def __str__(self): return self.message class Channel(object): @property d...
test_mail.py
from multiprocessing import Process from email.header import Header from email.mime.text import MIMEText import smtplib class MailSender(object): def __init__(self): self.mail_server = 'smtp.qq.com' self.mail_ssl_port = 465 self.mail_form_user = '996846239@qq.com' self.mail_passwd ...
app.py
# encoding: utf-8 """ A REST API for Salt =================== .. py:currentmodule:: salt.netapi.rest_cherrypy.app :depends: - CherryPy Python module. Note: there is a `known SSL traceback for CherryPy versions 3.2.5 through 3.7.x <https://github.com/cherrypy/cherrypy/issues/1298>`_. Please use ...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import, print_function import os import re import sys import copy import time import types import signal import fnmatch import logging import threading import traceback import multiprocessing from random imp...
paralel_ams_new0.py
import numpy as np import scipy.sparse as sp from scipy.sparse import linalg from .ams_tpfa_new0 import AMSTpfa from .....common_files.common_infos import CommonInfos import multiprocessing as mp import collections import time def run_thing(local_operator_obj): local_operator_obj.run() class SubDomain(CommonInfos):...
run_car_ai.py
# coding: utf-8 # ラジコン自走コード import time import logging import threading import numpy as np from lib import Kerberos from lib import Car from lib import SPI from lib import AI from generator import SensorGenerator import copy import sys PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 if PY2: import Q...
run.py
from multiprocessing import Process import os from getpass import getpass def func1(usrn,passw): string = 'node bin/cloudcmd.js -u '+usrn+' -p '+ passw + ' --root ../files' os.system(string) def func2(): os.system('node ./lib/index.js -d ../files/upload') if __name__ == '__main__': os.chdir('admin') os.s...
vehicle.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 25 10:44:24 2017 @author: wroscoe """ from builtins import bool from threading import Thread import time from .log import get_logger from .memory import Memory logger = get_logger(__name__) class Vehicle: def __init__(self, mem=None): ...
server.py
import socket import threading import select import time from message import Message from instructions import Instruction from cards import Deck class Server: MAX_CONCURRENT_REQUESTS = 4 UPDATE_FREQUENCY = 1000 SEND_RATE = 50 class Flags: SHUTDOWN_SERVER = 1 def __init__(self, address, v...