source
stringlengths
3
86
python
stringlengths
75
1.04M
_channel.py
# Copyright 2016 gRPC 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...
dlapi.py
import json import sys import os import logging import asyncio from threading import Thread from time import sleep from flask import Flask, abort, request, Response, send_from_directory from flask_restful import Resource, Api from flask_jsonpify import jsonify from flask_cors import CORS import youtube_dl as...
deadlock.py
import threading import time def main(): lock1 = threading.Lock() lock2 = threading.Lock() t1 = threading.Thread(target=foo, args=(lock1, lock2)) t2 = threading.Thread(target=foo, args=(lock2, lock1)) t1.start() t2.start() def foo(lock1, lock2): lock1.acquire() time.sleep(1) lock...
run.py
# coding=utf-8 # author: Lan_zhijiang # description: 启动ALR_Cloud的脚本 import sys import threading import argparse import json import socket from main_system.log import AlrCloudLog from network_communicator.connection_manager.websocket_server import AlrCloudWebsocketServer sys.path.append("./network_communicator/connecti...
tasks_plugin.py
# =============================================================================== # Copyright 2013 Jake Ross # # 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...
notify.py
#!/usr/bin/env python3 # _*_ coding:utf-8 _*_ import base64 import hashlib import hmac import json import os import re import threading import time import urllib.parse import requests # 原先的 print 函数和主线程的锁 _print = print mutex = threading.Lock() # 定义新的 print 函数 def print(text, *args, **kw): """ 使输出有序进行,不出现多线...
middleware.py
import socket import os import multiprocessing as mp import time import json print(os.getpid()) def listToString(s): str1 = " " return (str1.join(s)) def node_status_check(node_id): if node_id>=4: IP = '3.16.164.181' else: IP= '0.0.0.0' port = (10000) + node_id...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 witho...
flask_wrapper.py
from flask import Flask, jsonify, request from threading import Thread from .server import Server from .errors import HoistExistsError from .error import Error #from .proxy.proxy import Proxy from typing import Callable from .version import __version__ HTML: str = ''' <!DOCTYPE html> <html lang="en"> <head> <title>...
gridmodule.py
#!/usr/bin/env python3 # The MIT License (MIT) # # Copyright (c) 2018 École Polytechnique Fédérale de Lausanne (EPFL) # Author: Jagdish P. Achara # # 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 Sof...
functions.py
from docker.errors import APIError, NotFound from requests import ConnectionError import docker, threading, os, logging def create_client(use_local_socket=False): _config = DockerConfig(use_local_socket) return docker.DockerClient( base_url = _config.base_url(), version = _config.version(), ...
wifireconnect.py
# wificontrol code is placed under the GPL license. # Written by Denis Chagin (denis.chagin@emlid.com) # Copyright (c) 2016, Emlid Limited # All rights reserved. # If you are interested in using wificontrol code as a part of a # closed source project, please contact Emlid Limited (info@emlid.com). # This file is part...
test_tls.py
import datetime as dt import multiprocessing as mp import os import random import socket import struct import sys import time from functools import partial try: from contextlib import suppress except ImportError: # Python 2.7 from contextlib2 import suppress import pytest import mbedtls.hash as hashlib f...
generic_websocket.py
""" Module used as a interfeace to describe a generick websocket client """ import asyncio import concurrent.futures import websockets import socket import json import time from threading import Thread, Lock from pyee import EventEmitter from ..utils.custom_logger import CustomLogger # websocket exceptions from webs...
agent_state_manager.py
#! /usr/bin/env python3 # _*_ coding:utf-8 _*_ import threading import time import logging from app.server import STATE_UPDATE_INTERVAL, AgentState from app.server import * from app.lib import msg_bus, common_msg logger = logging.getLogger("Server") def singleton(cls): _instance = {} def _singleton(*args, **k...
torrent_downloader.py
#!/usr/bin/python3 import bencode import sys import signal import itertools import argparse import dns.resolver from socket import * import hashlib import urllib import random import struct import binascii from collections import namedtuple from collections import OrderedDict import urllib.request import traceback impo...
atrace_agent.py
# Copyright 2015 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. import optparse import py_utils import re import sys import threading import zlib from devil.android import device_utils from devil.android.sdk import versi...
scraper.py
# -*- coding: utf-8 -*- """ 小米论坛爬虫 @author Jia Tan """ import io import requests import re import threading from datetime import datetime sub_list = [('266', u'相册')] reply_type = [u'已收录', u'已答复', u'请补充', u'待讨论', u'确认解决'] # regex to remove whitespaces` white_re = re.compile(r'\s+', re.U) # regex to get page count p...
interactive.py
# Copyright (C) 2011 Jeff Forcier <jeff@bitprophet.org> # # This file is part of ssh. # # 'ssh' is free software; you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 2.1 of the License, or (at your option) # ...
sum.py
# Ultradesu 2017 # Because of GIL which doesn't allow to implement simultaneous computing # i had to use forks instead on threads for full utilization system resources. # This version much slower rather C. import multiprocessing import time # calculating summ between start and end. def sumumatoru_kun(start, end, nu...
test_partition_20.py
import threading import pytest from base.partition_wrapper import ApiPartitionWrapper from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from common.code_mapping import PartitionErrorMessage prefix = ...
PyV8.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import with_statement import sys, os try: from cStringIO import StringIO except ImportError: from StringIO import StringIO try: import json except ImportError: import simplejson as json import _PyV8 __author__ = 'Flier Lu <flier.lu@gmail...
test_concurrency.py
import re import time import pytest import subprocess from multiprocessing import Process from server import run_server @pytest.fixture def redis_server(): p = Process(target=run_server, args=["redis"]) p.start() yield p.terminate() time.sleep(2) @pytest.fixture def memcached_server(): p =...
chatroom_server.py
#! /usr/bin/python3 import socket import threading import sys import chat_message as msg import chat_command as cmd # Constant Variable HOST = '0.0.0.0' PORT = int(sys.argv[1]) if len(sys.argv) > 1 else 5000 PAR = 10 SIZE = 1024 SERVER = socket.socket(socket.AF_INET, socket.SOCK_STREAM) SERVER.bind((HOST, PORT)) # ...
runtime_manager_dialog.py
#!/usr/bin/env python """ Copyright (c) 2015, Nagoya University 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 must retain the above copyright notice, this ...
app.py
""" Slack chat-bot Lambda handler. Modified from: https://github.com/Beartime234/sam-python-slackapp-template """ # Module Imports import os import logging import json import time import hmac import hashlib import json import urllib.parse import base64 import threading # import multiprocessing # import requests from s...
test_plc_route.py
import unittest import threading import socket import struct from contextlib import closing from pyads import add_route_to_plc from pyads.utils import platform_is_linux class PLCRouteTestCase(unittest.TestCase): SENDER_AMS = "1.2.3.4.1.1" PLC_IP = "127.0.0.1" USERNAME = "user" PASSWORD = "password" ...
KarmaBoi.py
#!/usr/bin/env python ''' Main application - sets and receives environment variables, initial logger configuration. In order to work with Cloud Foundry healthcheck, threadding is imported to create a simple flask instance. The slack client is persistent, and all exceptions will be logged but the slack client will rest...
run.py
import multiprocessing as mp import os, sys, re, time, copy import configparser import textwrap import mentionbot.mentionbot as botentry ini_file_name = "config.ini" # These two regexes must both be used to verify a folder name. re_dirname_fullmatch = re.compile("[a-z0-9_-]+") # This must be full-matched. re_dirname_...
check_system.py
import threading from tkinter import * from tkinter import messagebox from tkinter.ttk import * from tkinter import ttk import time import json from PIL import ImageTk, Image import requests lista_opciones = list() lista_opciones.append(("1_morjarse_manos")) lista_opciones.append(("2_aplique_jabon")) lista_opciones....
client.py
import grpc import logging import queue import threading import uuid from clients.reference.app.battleships_pb2 import Attack, Request, Response, Status from clients.reference.app.battleships_pb2_grpc import BattleshipsStub logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) class Battleship: # T...
tests.py
# -*- coding: utf-8 -*- import multiprocessing import os import re import threading import time import unittest from lua_sandbox.executor import LuaException from lua_sandbox.executor import LuaInvariantException from lua_sandbox.executor import LuaOutOfMemoryException from lua_sandbox.executor import LuaSyntaxError ...
Wallet.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Tkinter GUI Wallet (v2.52) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## import sys from base64 import b64decode, b64encode fr...
test_certificates.py
from __future__ import unicode_literals # at top of module import datetime import json import ssl import threading from http.server import HTTPServer, SimpleHTTPRequestHandler from tempfile import NamedTemporaryFile import arrow import pytest from cryptography import x509 from cryptography.hazmat.backends import def...
customDNSv1.py
""" BSD 3-Clause License Copyright (c) 2019, Antti Koskimäki, Aalto University, Finland 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 must retain the above copyright not...
test_ai.py
__author__ = "Jerry Overton" __copyright__ = "Copyright (C) 2022 appliedAIstudio LLC" __version__ = "0.0.1" import os import time import unittest # needed to start up the remote ai server import rpyc from ai_framework.ai_server import start_ai_server # needed to create test actions from ai_framework.ai_actions impor...
test_sys.py
# -*- coding: iso-8859-1 -*- import unittest, test.test_support import sys, cStringIO class SysModuleTest(unittest.TestCase): def test_original_displayhook(self): import __builtin__ savestdout = sys.stdout out = cStringIO.StringIO() sys.stdout = out dh = sys.__displayhook_...
ml_model.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
train.py
#!/usr/bin/env python from worker import * from network import * import threading from time import sleep flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_boolean('is_approaching_policy', False, 'If learning approaching policy.') flags.DEFINE_integer('max_episodes', 100000, 'Maximum episodes.') flags.DEFINE_inte...
run.py
import sys import threading def log(*args): print(*args, file=sys.stderr, flush=True) def read_message(): sender = "" while len(sender) < 4: sender += sys.stdin.read(1) sys.stdin.read(1) # newline data = "" while True: ch = sys.stdin.read(1) if ch == "\n": b...
main.py
import requests, json import matplotlib.pyplot as plt import pandas as pd import time import os import numpy as np from argparse import ArgumentParser from sklearn.linear_model import LogisticRegression from sklearn.externals import joblib from threading import Thread from sklearn.ensemble import BaggingClassifier from...
test_csv.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...
multi_threads.py
from threading import Thread class MultiThreads: threads = None max_threads = 4 to_run = None def __init__(self): self.threads = [] self.to_run = [] def add(self, target: callable, args: tuple): self.threads.append(Thread(target=target, args=args, daemon=True)) def _...
main.py
import threading from typing import Dict from commands import COMMANDS from loggers import logger from pika import BlockingConnection, ConnectionParameters from pika.exceptions import ( AMQPChannelError, AMQPConnectionError, ConnectionClosedByBroker, ) from pydantic import ValidationError from schemas impo...
shell2restapi.py
#!/usr/bin/env python ########################################################################## # # Name: Shell to REST API __version__ = '1.5' __author__ = 'Grigol Sirbiladze' # E-mail: grigoli@gmail.com # Date: 10/2019 # License: MIT # #######################################################################...
WeaveBluezMgr.py
# # Copyright (c) 2015-2017 Nest Labs, Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
test_submit_multithreaded.py
import cv2 import numpy as np import pandas as pd import threading import Queue import io import tensorflow as tf from tensorflow.python.lib.io import file_io from tqdm import tqdm import params rles = [] def test(output_dir, weights_dir, test_dir): """ Tests the given model and generates a csv containing segmentatio...
thread_unsafe.py
# author: leisurexi # date: 2021/1/24 # file name: thread_unsafe.py # Python 线程不安全示例 import threading n = 0 def foo(): global n for i in range(50000): n += 1 if __name__ == '__main__': thread1 = threading.Thread(target=foo) thread2 = threading.Thread(target=foo) thread1.start() th...
ProxyRefreshSchedule.py
# -*- coding: utf-8 -*- # !/usr/bin/env python """ ------------------------------------------------- File Name: ProxyRefreshSchedule.py Description : 代理定时刷新 Author : JHao date: 2016/12/4 ------------------------------------------------- Change Activity: 2016/12/4: 代...
clang_format.py
#!/usr/bin/env python """ A script that provides: 1. Ability to grab binaries where possible from LLVM. 2. Ability to download binaries from MongoDB cache for clang-format. 3. Validates clang-format is the right version. 4. Has support for checking which files are to be checked. 5. Supports validating and updating a se...
engine.py
""" """ import logging from logging import Logger import smtplib import os from abc import ABC from datetime import datetime from email.message import EmailMessage from queue import Empty, Queue from threading import Thread from typing import Any, Sequence, Type, Dict, List, Optional from vnpy.event import Event, Eve...
runDataRecording.py
# encoding: UTF-8 from __future__ import print_function import multiprocessing from time import sleep from datetime import datetime, time from negociant.event import EventEngine2 from negociant.trader.vtEvent import EVENT_LOG, EVENT_ERROR from negociant.trader.vtEngine import MainEngine, LogEngine from negociant.trad...
detection_input.py
from __future__ import division from __future__ import print_function import cv2 import numpy as np import mxnet as mx from six.moves.queue import Queue from threading import Thread from operator_py.cython.bbox import bbox_overlaps_cython from operator_py.bbox_transform import nonlinear_transform as bbox_transform ...
transactions.py
#! /usr/bin/env python # # =============================================================== # Description: Testing Weaver serializability and transaction # correctness. # # Created: 2014-01-24 16:18:27 # # Author: Ayush Dubey, dubey@cs.cornell.edu # # Copyright (C) 2013, Cornell...
data_upload.py
""" Anonymizes and uploads DNS and flow data to cloud. """ import time import datetime import threading import utils import requests import json import server_config from host_state import HostState import traceback UPLOAD_INTERVAL = 5 class DataUploader(object): def __init__(self, host_state): asser...
app.py
import json import logging import multiprocessing as mp import os from logging.handlers import QueueHandler from typing import Dict, List import sys import signal import yaml from gevent import pywsgi from geventwebsocket.handler import WebSocketHandler from peewee_migrate import Router from playhouse.sqlite_ext impor...
test_sockets.py
import os, multiprocessing, subprocess from runner import BrowserCore, path_from_root from tools.shared import * def clean_pids(pids): import signal, errno def pid_exists(pid): try: # NOTE: may just kill the process in Windows os.kill(pid, 0) except OSError, e: return e.errno == errno.EPE...
pipeline_ops_test.py
# Copyright 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
connection_pool.py
import redis import threading import time import unittest class ConnectionPoolTestCase(unittest.TestCase): def test_multiple_connections(self): # 2 clients to the same host/port/db/pool should use the same connection pool = redis.ConnectionPool() r1 = redis.Redis(host='localhost', port=6379...
delete_all_infection_entities.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
postprocesssgns.py
import numpy as np import os, sys from multiprocessing import Queue, Process from argparse import ArgumentParser tpath = os.path.dirname(os.path.realpath(__file__)) VIZ_DIR=os.path.join(tpath, "web") ROOT_DIR=tpath tpath = os.path.abspath(os.path.join(tpath, "../")) sys.path.append(tpath) os.chdir(tpath) from iouti...
API_checkusernames.py
from bs4 import BeautifulSoup import requests from threading import Thread def thread_search(service, username, results, i): while True: try: req = requests.get('http://checkusernames.com/usercheckv2.php?target=' + service + '&username=' + username, headers={'X-Requested-With': 'XMLHttpRequest'...
utils.py
# coding=utf-8 """Shared utility functions""" import argparse import collections import functools import glob import inspect import itertools import os import re import subprocess import sys import threading import unicodedata from enum import ( Enum, ) from typing import ( TYPE_CHECKING, Any, Callable,...
paramikoe.py
# # Paramiko Expect # # Written by Fotis Gimian # http://github.com/fgimian # # This library works with a Paramiko SSH channel to provide native SSH # expect-like handling for servers. The library may be used to interact # with commands like 'configure' or Cisco IOS devices or with interactive # Unix scripts ...
x10.py
# X10 is so slow... # I ran a web server to let me control X10 lights through a CM11A gateway. # there's nearly a second of latency per command! on top of that, it just # wasn't very reliable (some commands would go, some wouldn't). # I'm not using this code anymore, but left it here if it's helpful to you import logg...
conftest.py
import logging from itertools import chain import os from random import randrange import tempfile import textwrap from time import sleep import yaml import pytest from botocore.exceptions import ClientError import threading from datetime import datetime import random from math import floor from ocs_ci.utility.utils i...
test-preview-inference-overlay-iter-vam_ref.py
# Copyright (c) 2019, The Linux Foundation. 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 must retain the above copyright # notice, this list of condit...
inference_standard_yolov3.py
""" Inference script for the yolov3.yolov3_aleatoric class. Produces detection files for each input image conforming to the ECP .json format. The output of this script can be directly used by the ECP evaluation code. """ import json import logging import os import threading import time import numpy as np import tens...
queue_consumer.py
from threading import Thread import pika class ConsumerQueue(object): def __init__(self, name, event, host, port): super(ConsumerQueue, self).__init__() self._name = name self._event = event self._received_values = [] self._connection = pika.BlockingConnection( ...
chunk.py
import logging import threading import warnings import requests logger = logging.getLogger(__name__) class Chunk(object): INIT = 0 DOWNLOADING = 1 PAUSED = 2 FINISHED = 3 STOPPED = 4 def __init__(self, downloader, url, file, start_byte=-1, end_byte=-1, number=-1, high_speed...
test_tcp.py
import asyncio import asyncio.sslproto import gc import os import select import socket import unittest.mock import ssl import sys import threading import time import weakref from OpenSSL import SSL as openssl_ssl from uvloop import _testbase as tb SSL_HANDSHAKE_TIMEOUT = 15.0 class MyBaseProto(asyncio.Protocol): ...
opencvhelper.py
#!/usr/bin/env python """ Copyright 2018, Zixin Luo, HKUST. OpenCV helper. """ from __future__ import print_function from threading import Thread from queue import Queue import numpy as np import cv2 class SiftWrapper(object): """"OpenCV SIFT wrapper.""" def __init__(self, nfeatures=0, n_octave_layers=3,...
MK14ProgramedBy7Bot.py
# Program to program a Science of Cambridge MK14 with a 7Bot # An MK14 is a very old micro-computer from what became Sinclair Research # A 7Bot is a 7 degrees of freedom robot arm which orignated here: # More information on this project is here: http://robdobson.com/2016/10/mk14-meets-7bot/ from __future__ import prin...
dijkstra_cpu.py
from time import time import numpy as np from queue import PriorityQueue from multiprocessing import Process, cpu_count, Manager from multiprocessing.sharedctypes import RawArray from classes.result import Result from utils.debugger import Logger from utils.settings import INF from method.sssp.dijkstra_cp...
McScrpGui.py
#بسم الله الرحمان الرحيم # -*- coding: utf-8 -*- # 110 DESKTOP # 159 SCRAPING # 8 DJANGO from threading import Thread from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QThread from PyQt5.QtWidgets import QApplication, QWidget, QTableWidgetItem, QFileDialog, QStyleFactory, QDialog, QMessageBox, QPushBu...
test_slow_close.py
# Copyright 2013, Google Inc. # 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 must retain the above copyright # notice, this list of conditions and the f...
ClientWindow.py
from PyQt5.QtWidgets import QApplication, QTableWidgetItem,QLineEdit, QTableWidget, QTextEdit,QWidget,QVBoxLayout,QHBoxLayout, QLabel,QPushButton from PyQt5.QtGui import QFont, QIcon, QTextCursor,QCloseEvent from PyQt5.QtCore import QRect, QSize, Qt import threading import os import socket as sk import time import rsa ...
static_object_detector_node.py
#!/usr/bin/env python import cv2 import numpy as np import rospy from sensor_msgs.msg import Image from std_msgs.msg import Float32 from cv_bridge import CvBridge, CvBridgeError from duckietown_msgs.msg import ObstacleImageDetection, ObstacleImageDetectionList, ObstacleType, Rect, BoolStamped import sys import threadin...
agent.py
from keras import backend as K from keras import models from keras import layers from keras import optimizers import tensorflow as tf import numpy as np from threading import Thread from threading import Lock import queue import pickle import copy import os config = tf.ConfigProto() config.gpu_options.al...
test_tracer.py
import time import mock import opentracing from opentracing import Format from opentracing import InvalidCarrierException from opentracing import SpanContextCorruptedException from opentracing import UnsupportedFormatException from opentracing import child_of import pytest import ddtrace from ddtrace import Tracer as...
test_s3.py
import boto3 import botocore.session from botocore.exceptions import ClientError from botocore.exceptions import ParamValidationError from nose.tools import eq_ as eq from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest import isodate import email.utils import datetime import threading import re ...
test_state.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import import os import shutil import tempfile import textwrap import threading import time # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.unit import skipIf from tests.support.paths import TMP, FILES...
api_handler.py
import cgi import json import logging from functools import partial from http.server import BaseHTTPRequestHandler from typing import Optional from src.notifier.notify_manager import NotifyManager from src.notifier import Event, EventType, EventPriority, EventService import http.server import socketserver import thr...
fifo_queue_test.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...
spideronlinecheck.py
""" 精简代码 check账号是否在线 create by judy 2019/01/24 """ import threading import traceback from datacontract import Task, ETokenType, ECommandStatus from datacontract.apps.appbase import AppConfig from idownclient.spidermanagent.spidermanagebase import SpiderManagebase from idownclient.spider.spiderbase import SpiderBase ...
new_base.py
# Core import time import logging import threading from abc import ABC # External frameworks import websocket from blinker import Signal # Our repo from utilities import json from deribit.messages import session from utilities.id import generate_id # ##################################################################...
test_functools.py
import abc import cosmo import builtins import collections import copy from itertools import permutations import pickle from random import choice import sys from test import support import time import unittest from weakref import proxy import contextlib try: import _thread import threading except ImportError: ...
utils.py
# Copyright (c) 2021. Universidad de Pinar del Rio # This file is part of SCEIBA (sceiba.cu). # SCEIBA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # from __future__ import absolute_import, print_function import enum import jso...
log_plotter.py
""" Plotting class to be used by Log. """ import time import numpy as nm from sfepy.base.base import Output, Struct def draw_data(ax, xdata, ydata, label, plot_kwargs, swap_axes=False): """ Draw log data to a given axes, obeying `swap_axes`. """ def _update_plot_kwargs(lines): plot_kwargs['co...
flood.py
from threading import Thread, Event from _bots import * from sys import argv from contextlib import suppress import queue q = queue.Queue() e = Event() e.set() def check_code(pin): epoch = int(datetime.datetime.now().timestamp()) r = requests.get(f'https://kahoot.it/reserve/session/{pin}/?{epoch}') if r.s...
federated_learning_keras_PS_MNIST_crossentropy.py
from DataSets import MnistData from DataSets_task import MnistData_task from consensus.consensus_v2 import CFA_process from consensus.parameter_server import Parameter_Server # best use with PS active # from ReplayMemory import ReplayMemory import numpy as np import os import tensorflow as tf from tensorflow import ke...
pod.py
""" Pod related functionalities and context info Each pod in the openshift cluster will have a corresponding pod object """ import logging import os import re import yaml import tempfile import time import calendar from threading import Thread import base64 from ocs_ci.ocs.bucket_utils import craft_s3_command from oc...
__init__.py
""" Python Geographic Visualizer (GeoVis) **Version: 0.2.0** **Date: April 15, 2014** **Author: [Karim Bahgat](https://uit.academia.edu/KarimBahgat)** **Contact: karim.bahgat.norway@gmail.com** **Homepage: https://github.com/karimbahgat/geovis** ## Table of Contents - [About](#about) - [System Compatibility](#...
word2vec.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...
demo_neptusinterface.py
# Copyright (c) 2018, CNRS-LAAS # 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 must retain the above copyright notice, this # list of conditions and the f...
radio_session.py
import time import datetime from datetime import datetime import serial import threading import json import traceback import queue import requests import subprocess import glob import os import pty from multiprocessing import Process, Queue from elasticsearch import Elasticsearch from .data_consumers import Datastore,...
main_vec.py
import sys import json # local # sys.path.append('/Users/zixianma/Desktop/Sophomore/Summer/CURIS/PIC/multiagent-particle-envs') # server sys.path.append('/sailhome/zixianma/PIC/multiagent-particle-envs') import argparse import math from collections import namedtuple from itertools import count import numpy as np from ...
ProXPN.py
#!/usr/bin/env python2 import os, sys, subprocess, time, datetime import multiprocessing as mp CONFIG='' ACCOUNT='' CONFDIR='<your/home/directory/>' AUTHFILE=CONFDIR + 'auth.txt' COMMAND='sudo /usr/sbin/openvpn --config %s' % (CONFDIR) LOCKDIR='<your/home/directory/>/.log/' LOCKFILE=LOCKDIR + 'openvpn.lock' LINE=(os.s...
worker.py
""" Background job workers """ import logging import traceback from datetime import timedelta from multiprocessing import Process from sched import scheduler from time import monotonic, sleep import sentry_sdk from google.protobuf import empty_pb2 from couchers.db import get_engine, session_scope from couchers.jobs....
main.py
import re from flask import Flask, render_template, request, redirect, url_for, session from flask_mysqldb import MySQL import MySQLdb.cursors from prometheus_flask_exporter import PrometheusMetrics from pager import Pager import os import pymongo import sys import yaml import logging import pickle from PIL import Im...