source
stringlengths
3
86
python
stringlengths
75
1.04M
utils.py
import json import sys import re import os import stat import fcntl import shutil import hashlib import tempfile import subprocess import base64 import threading import pipes import uuid import codecs import zipfile try: from collections.abc import Iterable, Mapping except ImportError: from collections import...
test_gc.py
import unittest import unittest.mock from test.support import (verbose, refcount_test, run_unittest, cpython_only, start_threads, temp_dir, TESTFN, unlink, import_module) from test.support.script_helper import assert_python_ok, make_script i...
util.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2011 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 limitation the rights t...
test_http.py
import glob import os import pytest from http.server import BaseHTTPRequestHandler, HTTPServer import threading import fsspec requests = pytest.importorskip('requests') port = 9898 data = b'\n'.join([b'some test data'] * 1000) realfile = "http://localhost:%i/index/realfile" % port index = b'<a href="%s">Link</a>' % re...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "I am alive!" def run(): app.run(host='0.0.0.0', port=8080) def keep_alive(): t = Thread(target=run) t.start()
monitored_session_test.py
# pylint: disable=g-bad-file-header # Copyright 2016 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/LICENS...
main.py
#!/usr/bin/python3 import re import socket import sqlite3 import asyncore import os from os.path import isfile from json import load, dump from time import sleep, time from threading import Thread, Timer #external libraries from lib.switch_controller import * TWITCH_HOST = "irc.chat.twitch.tv" TWITCH_PORT = 6667 SE...
command_handlers.py
#!/usr/bin/env python3 # # Copyright (c) 2020, 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 # ...
gorun.py
#!/usr/bin/env python # # Wrapper on pyinotify for running commands # (c) 2009 Peter Bengtsson, peter@fry-it.com # # TODO: Ok, now it does not start a command while another is runnnig # But! then what if you actually wanted to test a modification you # saved while running another test # Yes, we...
scheduler.py
# # Copyright 2021 Splunk Inc. # # 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, so...
pickletester.py
import collections import copyreg import dbm import io import functools import os import math import pickle import pickletools import shutil import struct import sys import threading import unittest import weakref from textwrap import dedent from http.cookies import SimpleCookie try: import _testbuffer except Impo...
parallel.py
import multiprocessing as mp import rsa.prime import rsa.randnum def _find_prime(nbits: int, pipe) -> None: while True: integer = rsa.randnum.read_random_odd_int(nbits) if rsa.prime.is_prime(integer): pipe.send(integer) return def getprime(nbits: int, poolsize: int) -> ...
run_hat.py
import os from hive_attention_tokens.config import Config from hive_attention_tokens.chain.base.blockchain import Blockchain, BlockchainState from hive_attention_tokens.chain.base.witness import BlockSchedule from hive_attention_tokens.chain.base.auth import HiveAccounts from hive_attention_tokens.chain.database.setup...
test_ufuncs.py
import functools import itertools import re import sys import warnings import threading import operator import numpy as np import unittest from numba import typeof, njit from numba.core import types, typing, utils from numba.core.compiler import compile_isolated, Flags, DEFAULT_FLAGS from numba.np.numpy_support impor...
compareReads.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "Lars Andersen <larsmew@gmail.com>" __date__ = "19/05/2015" __version__ = "$Revision: 2.5" from optparse import OptionParser from operator import itemgetter from collections import Counter, deque from itertools import chain from multiprocessing import Pool, Q...
mesh.py
#!/usr/bin/env python3 """Meshtastic Telegram Gateway""" # import configparser import logging import sys import time # from datetime import datetime, timedelta from threading import Thread from typing import ( AnyStr, Dict, List, ) from urllib.parse import parse_qs # import aprslib import flask import have...
main.py
"""An of multithreading vs multiprocessing. Adapted from https://code.tutsplus.com/articles/introduction-to-parallel-and-concurrent-programming-in-python--cms-28612 """ import os import time import threading from multiprocessing import Pool NUM_WORKERS = 4 def non_blocking_fct(_): """Execute a non-blocking act...
argos3_env.py
import threading import socket import subprocess import os import json import sys import platform import shutil import resource import psutil import sh from time import sleep import numpy as np import gym from gym import error, spaces, utils from gym.utils import seeding import logging logger = logging.getLogger('A...
ops_test.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Pluto_Port_Scan.py
# #Python 3 File # # BSD 3-Clause License # Copyright (c) 2019, Dominik Lothmann 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,...
__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Han Xiao <artex.xh@gmail.com> <https://hanxiao.github.io> import sys import threading import time import uuid import warnings from collections import namedtuple from functools import wraps import numpy as np import zmq from zmq.utils import jsonapi __all__ = ['__versio...
tube.py
# -*- coding: utf-8 -*- import logging import re import string import subprocess import sys import threading import time from .. import atexit from .. import term from ..context import context from ..log import Logger from ..timeout import Timeout from ..util import fiddling from ..util import misc from ..util import ...
test_io.py
from __future__ import division, absolute_import, print_function import sys import gzip import os import threading from tempfile import mkstemp, mktemp, NamedTemporaryFile import time import warnings import gc from io import BytesIO from datetime import datetime import numpy as np import numpy.ma as ma from numpy.lib...
asyncweb.py
"""Async web request example with tornado. Requests to localhost:8888 will be relayed via 0MQ to a slow responder, who will take 1-5 seconds to respond. The tornado app will remain responsive duriung this time, and when the worker replies, the web request will finish. A '.' is printed every 100ms to demonstrate that...
train_model.py
# coding: utf-8 # MultiPerceptron # queueを使った学習 # 学習step数を記録 # 学習データはCSVの代わりにジェネレータを搭載 # 3x11x4のNNモデルに変更 # scoreを追加 import os _FILE_DIR=os.path.abspath(os.path.dirname(__file__)) import time import tensorflow as tf import threading from sklearn.utils import shuffle import sys sys.path.append(_FILE_DIR+'/..') from gene...
scoreboard.py
from oauth2client.service_account import ServiceAccountCredentials import gspread from tba import * import draft import settings import threading """scoreboard.py: Automatically updates the scoreboard. Thanks TBA""" TITLE = settings.SCOREBOARD_TITLE def auth(creds_file): scope = [ 'https://spreadsheets.g...
darknet_video.py
from ctypes import * import math import random import os import cv2 import numpy as np import time import darknet import pytesseract from skimage import measure import threading from scipy.spatial import distance as dist from collections import OrderedDict from multiprocessing import Process, Lock lic_pl = cv2.imread(...
checkpoint.py
import re import time import uuid import logger from threading import Thread from tasks.future import TimeoutError from couchbase_helper.cluster import Cluster from couchbase_helper.stats_tools import StatsCommon from membase.api.rest_client import RestConnection from membase.helper.cluster_helper import ClusterOperat...
sms_bot.py
import time from datetime import datetime from threading import Thread from Bot.sms_handler import SmsHandler from trade_backend.trader import CustomTimeZone class SmsBot: KARIMS_PHONE_NUMBER = "+" TWILIO_ACCOUNT_SID_PAID = '' TWILIO_AUTH_TOKEN_PAID = '' TWILIO_NUMBER_PAID = "+" TWILIO_ACCOUNT_S...
dolwin.py
# Main script to start the emulator import os import sys import time import threading import msvcrt from jdi import JdiClient dolwin = None exitDebugThread = False autorunScript = None ''' Entry point. Сreate an instance for communicating with JDI, load the specified file, starts the polling thread for deb...
test.py
from multiprocessing import Process def test_segment(): from app import segmentation segmentation.main("..\\UBIRIS_200_150\\CLASSES_400_300_Part1") def test_sr(): from app import upscale upscale.main("test\\upscale\\hr") def test_classifier(): from app import classifier classifier.main("test\...
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...
core.py
# -*- coding: utf-8 -*- # # 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 #...
OutputRedirectionTest.py
########################################################################## # # Copyright (c) 2013, Image Engine Design 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: # # * Redistrib...
debug_data_multiplexer.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...
test_oplog_manager_sharded.py
# Copyright 2013-2014 MongoDB, Inc. # # 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 writin...
approvals_test.py
#!/usr/bin/env python """Tests for API client and approvals-related API calls.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import threading import time from absl import app from grr_response_core.lib.util import compatibility from grr_response_ser...
test_proxy_scale.py
import multiprocessing import pytest from customize.milvus_operator import MilvusOperator from common import common_func as cf from common.common_type import CaseLabel from scale import scale_common as sc, constants from utils.util_log import test_log as log from utils.util_k8s import wait_pods_ready, export_pod_logs ...
functional_tests.py
#!/usr/bin/env python import os import re import shutil import sys import tempfile from ConfigParser import SafeConfigParser # Assume we are run from the galaxy root directory, add lib to the python path cwd = os.getcwd() new_path = [ os.path.join( cwd, "lib" ), os.path.join( cwd, "test" ) ] new_path.extend( sys.path...
bot.py
import asyncio import base64 import concurrent.futures import datetime import glob import json import math import os import pathlib import random import sys import time from json import dumps, loads from random import randint import re from re import findall import requests import urllib3 from Crypto....
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...
Server_COMPort.py
################### SCRIPT DO SERVIDOR DE ENVIO DE SMS #################################################### # Sintaxe de execucao via cmd: python Server_COMPort.py # Resumo do funcionamento: # 1º-Para enviar mensagens de SMS usando um modem SMS, é necessario pluga-lo no computador e inicializa-lo adequadamente. # ...
fl.py
import multiprocessing import shutil import pymongo from os import path, mkdir from time import time, sleep import tensorflow as tf from tensorflow.keras.models import load_model from tensorflow.keras.datasets import mnist from dFL.Peer.client import Client from dFL.Peer.node import Node from dFL.Utils.config impor...
world.py
from tkinter import * from Simulator.Lyric.lyric import * from Simulator.Me import * # from Simulator.Render import * from Simulator.Sound.sound import * from Simulator.ui_logger import UiLogger # from Simulator.PPT3D.PPT import * from Simulator.PPT3D.ppt3d import Page, Frame as mFrame, PPT, PPT3D import random from PI...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading from electrum.bitcoin import TYPE_ADDRESS from electrum.storage import WalletStorage from electrum.wallet import Wallet, InternalAddressCorruption from electrum.paymentrequest import InvoiceStore fr...
impala.py
# # https://github.com/facebookresearch/torchbeast/blob/master/torchbeast/core/environment.py import numpy as np from collections import deque import gym from gym import spaces import cv2 cv2.ocl.setUseOpenCL(False) class NoopResetEnv(gym.Wrapper): def __init__(self, env, noop_max=30): """Sample initial s...
download.py
"""Holds logic for downloading data dump files, with hooks for download progress and completion.""" import bz2 import functools import gzip import hashlib import io import re from tempfile import NamedTemporaryFile import threading from types import TracebackType from typing import Optional, Callable import requests ...
example2.py
from queue import Queue from threading import Thread N = 1_000_000 N_THREADS = 10 q = Queue() a = list(range(N)) b = list(range(N)) def work(sub_a, sub_b): sub_c = [x + y for x, y in zip(sub_a, sub_b)] sub_c = sum(sub_c) q.put(sub_c) threads = [] for i in range(N_THREADS): s = i * (N // N_THREADS...
test_profile.py
import sys import time from toolz import first from threading import Thread from distributed.profile import (process, merge, create, call_stack, identifier) from distributed.compatibility import get_thread_identity def test_basic(): def test_g(): time.sleep(0.01) def test_h(): time.s...
mockserver.py
"""SSE mock server.""" import json from collections import namedtuple import queue import threading from http.server import HTTPServer, BaseHTTPRequestHandler Request = namedtuple('Request', ['method', 'path', 'headers', 'body']) class SSEMockServer(object): """SSE server for testing purposes.""" protocol...
adbcore.py
#!/usr/bin/env python2 import struct import threading from time import sleep from typing import Optional from future import standard_library import datetime import socket import queue as queue2k import random from ppadb.device import Device from ppadb.connection import Connection from ppadb.client import Client as A...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum_btcc.wallet import Wallet from electrum_btcc.storage import WalletStorage from electrum_btcc.util import UserCancelled, InvalidPassword from electrum_btcc.base_wizar...
sf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sf # Purpose: Main wrapper for calling all SpiderFoot modules # # Author: Steve Micallef <steve@binarypool.com> # # Created: 03/04/2012 # Copyright: (c) Steve ...
test_distributed_sampling.py
import dgl import unittest import os from dgl.data import CitationGraphDataset from dgl.data import WN18Dataset from dgl.distributed import sample_neighbors, sample_etype_neighbors from dgl.distributed import partition_graph, load_partition, load_partition_book import sys import multiprocessing as mp import numpy as np...
watchdog_timer.py
from threading import Thread, Event from datetime import datetime, timezone from time import sleep import logging logger = logging.getLogger() class WDT: def __init__(self, logger, callback, check_interval_sec: float = 0.01, trigger_delta_sec: float = 1, identifier=None): self.check_interval_sec = check...
threads.py
#thread import threading import time #taking advantage og threading.currentThread().getName() function to debug the state of your threads def worker(): print(threading.currentThread().getName(),"Starting") time.sleep(2) print(threading.currentThread().getName(),"Exiting") w = threading.Thread(na...
ts_mon_config.py
# -*- coding: utf-8 -*- # Copyright 2014 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Wrapper for inframon's command-line flag based configuration.""" from __future__ import print_function import argparse import...
client.py
""" This file takes care of the client side of the peer to peer network This file takes care of the file being downloaded on to the machine """ from server_client.constants import * import pickle class Client: def __init__(self, addr, hashlist): try: # set up the socket ...
command_agent.py
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
test_general.py
"""Collection of tests for unified general functions.""" # global import time import einops import jax.numpy as jnp import pytest from hypothesis import given, strategies as st import numpy as np from numbers import Number from collections.abc import Sequence import torch.multiprocessing as multiprocessing # local im...
utils.py
from __future__ import print_function import sys import threading import socket import select import logging LOGGER = logging.getLogger("modbus_tk") PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 def threadsafe_function(fcn): """decorator making sure that the decorated function is thread safe""" ...
email.py
# -*- coding:utf-8 -*- # @author: lw_guo # @time: 2020/12/7 from threading import Thread from flask import current_app, render_template from freefree.app import mail from flask_mail import Message def send_async_email(app, msg): with app.app_context(): try: mail.send(msg) except Except...
Coverage_CalculatorServer.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...
distributed.py
'''Builders for distributed training.''' import multiprocessing import numpy as np class Sequential: '''A group of environments used in sequence.''' def __init__(self, environment_builder, max_episode_steps, workers): self.environments = [environment_builder() for _ in range(workers)] self....
bacnet_connector.py
# Copyright 2022. 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 ...
registry.py
import logging import threading import time from typing import List from brownie import Contract, chain, web3 from joblib import Parallel, delayed from web3._utils.abi import filter_by_name from web3._utils.events import construct_event_topic_set from yearn.events import create_filter, decode_logs, get_logs_asap from ...
SerialClient.py
#!/usr/bin/env python ##################################################################### # Software License Agreement (BSD License) # # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that th...
coco.py
import json import logging import os import threading from time import sleep from typing import Callable import paho.mqtt.client as mqtt from .coco_device_class import CoCoDeviceClass from .coco_fan import CoCoFan from .coco_light import CoCoLight from .coco_switch import CoCoSwitch from .coco_switched_fan import CoC...
evdev_utils.py
# Copyright 2014 The Chromium OS 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 asyncore from cros.factory.utils import process_utils from cros.factory.external import evdev def GetDevices(): """Gets all the input devices...
readStream.py
import pytchat # most recent thing in the core is the updated stuff import time import json import os import sys import copy import requests import threading from winreg import * import vdf import json from shutil import copyfile import shutil # import smObjects ## This automatically finds the scrap mec...
kronos.py
#!/usr/bin/python """Module that provides a cron-like task scheduler. This task scheduler is designed to be used from inside your own program. You can schedule Python functions to be called at specific intervals or days. It uses the standard 'sched' module for the actual task scheduling, but provides much more: * rep...
labels.py
import hashlib import requests import threading import json import sys import traceback import base64 import electrum_smart as electrum from electrum_smart.plugins import BasePlugin, hook from electrum_smart.i18n import _ class LabelsPlugin(BasePlugin): def __init__(self, parent, config, name): BasePlu...
wiki_dump_download.py
#from dotenv import load_dotenv #load_dotenv() import argparse import glob import hashlib import json import io import logging import os import threading import urllib.request from datetime import datetime #from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient def get_dump_task(dump_status_fi...
checker.py
import asyncio import json from time import time from typing import Dict from pymongo import MongoClient from multiprocessing import Process from os import getenv import pika import argparse from monitor.config import Env class CheckerService(): _monitors = [] _rest_config = {} _start_time: int _fo...
stream.py
# import the necessary packages import numpy as np import time from threading import Thread import requests import cv2 class WebcamVideoStream: def __init__(self, src=0): # initialize the video camera stream and read the first frame # from the stream self.stream = cv2.VideoCapture(src) ...
test_mysql.py
import pymysql import pymysql.cursors from multiprocessing import Process import time def get_connection(): con = pymysql.connect( host='localhost', user='root', password='example', db='l8_1_db', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor ) c...
runner.py
#!/usr/bin/env python3 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
aula_sd.py
# -*- coding: utf-8 -*- """ Spyder Editor Este é um arquivo de script temporário. """ #aula sistemas distribuidos 24/09/2018 import threading import time ''' def seu_coracao(): print ('<3') return threads = [] for i in range(5): t = threading.Thread(target=seu_coracao) thread...
handler.py
""" Handlers that handle data streams from a UDP/TCP socket or RS485 port. The main use for these are with the simulator but the TCPHandler for example can also be used to forward data to a Display initialised with RS485 clients - providing the same functionality as a Ethernet/RS485 device. """ import threading import...
files.py
# Copyright 2017 Google Inc. # # 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, ...
move_ptu_myo.py
#!/usr/bin/env python PKG = 'usma_ptu' import roslib; roslib.load_manifest(PKG) import time from math import pi from threading import Thread import rospy from std_msgs.msg import UInt8 from std_msgs.msg import Float64 from sensor_msgs.msg import Imu from geometry_msgs.msg import Quaternion from dynamixel_controller...
main.py
#!/usr/bin/env python3 import socket import sys import threading import time import re from functions.worker import worker from env_variables import SERVER_IP from env_variables import SERVER_PORT from env_variables import cisco_username from env_variables import cisco_password from functions.logging import myLogger ...
test_socket.py
import unittest from test import support from test.support import os_helper from test.support import socket_helper from test.support import threading_helper import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform...
test_add_event.py
# From https://stackoverflow.com/questions/25827160/importing-correctly-with-pytest # Change current working directory so test case can find the source files import sys, os import asyncio import discord import discord.ext.commands as commands import discord.ext.test as test import threading import time sys.path.append...
campaign.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/client/tabs/campaign.py # # 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...
application.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-unsafe import argparse import json import logging import os import subprocess import tempfile import threading from pathlib import P...
xml_reporter_test.py
# Copyright 2017 The Abseil 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 ...
038_server.py
#!/usr/bin/python # -*- coding: utf-8 -*- ''' 网络编程 - TCP 请求 - 服务端 功能:接受客户端请求带过来的字符串,加上 hello 后返回给客户端 ''' import socket, threading, time # 创建 socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 监听客户端 ip 和端口: s.bind(('127.0.0.1', 9999)) s.listen(5) print('Waiting for connection...') def tcplink(sock, a...
ndpspoof.py
from threading import Thread from scapy.all import * import netifaces as ni stop = 1 def NDP_poison(target_ipv6, gateway_ipv6, target_mac, gateway_mac, host_mac): print("[*] NDP poisoning...") try: global stop while stop: ether = (Ether(dst='33:33:00:00:00:01', src=host_mac)) ...
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...
batch_read_excel.py
#!/usr/local/Cellar/python/3.7.4_1/bin/python3 python3 # -*- coding:utf-8 -*- import sys, os, datetime, openpyxl, json, threading from multiprocessing import Pool data_dict = { '0': { # 酒店 'hotelType': { '经济型': 1, '主题': 2, '商务型': 3, '公寓': 4, '客栈...
cron-event-watcher.py
#!/usr/bin/env python # vim: expandtab:tabstop=4:shiftwidth=4 ''' Process OpenShift event stream ''' # # Copyright 2016 Red Hat Inc. # # 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 ...
run.py
import torch.multiprocessing as mp mp.set_start_method('spawn', force=True) def run_actor(Actor, **kwargs): actor = Actor(**kwargs) actor.run() def run_learner(Learner, **kwargs): learner = Learner(**kwargs) learner.run() def run_distributed(create_env_fn, log_dir, Actor, Learner, num_actors, ...
utils.py
# -*- coding: utf-8 -*- # Copyright 2012-2022 CERN # # 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...
Colab_Launcher.py
from helium._impl import selenium_wrappers from pyautogui import KEYBOARD_KEYS import pyinspect as pi from rich import pretty import os, sys, threading, time, traceback, platform, subprocess, sqlite3, requests pi.install_traceback(hide_locals=True,relevant_only=True,enable_prompt=True) pretty.install() cf_icon_file_p...
mjc_env.py
import matplotlib.pyplot as plt import numpy as np import os import random from threading import Thread import time import traceback import sys import xml.etree.ElementTree as xml from dm_control.mujoco import Physics, TextOverlay from dm_control.mujoco.wrapper.mjbindings import enums from dm_control.rl.control import...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
tcp_server_3.py
import socket import threading # 处理客户端的请求操作 def handle_client_request(service_client_socket, ip_port): # 循环接收客户端发送的数据 while True: # 接收客户端发送的数据 recv_data = service_client_socket.recv(1024) # 容器类型判断是否有数据可以直接使用if语句进行判断,如果容器类型里面有数据表示条件成立,否则条件失败 # 容器类型: 列表、字典、元组、字符串、set、range、二进制数据 ...
server.py
# Copyright (c) 2018 ISP RAS (http://www.ispras.ru) # Ivannikov Institute for System Programming of the Russian Academy of Sciences # # 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 # # htt...
car_helpers.py
import os import threading import requests from common.params import Params, put_nonblocking from common.basedir import BASEDIR from selfdrive.version import comma_remote, tested_branch from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_known_cars from selfdrive.car.vin import get_vin, VIN_UNKNOWN ...