source
stringlengths
3
86
python
stringlengths
75
1.04M
lan.py
import socket import threading import time from abc import abstractmethod class Lan: def __init__(self): self.connection = None self.lock = threading.Lock() self.input_data = "" self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.data_to_send = list() de...
container.py
""" Representation of a generic Docker container """ import os import logging import tarfile import tempfile import threading import socket import time import docker import requests from docker.errors import NotFound as DockerNetworkNotFound from samcli.lib.utils.retry import retry from .exceptions import ContainerNo...
execution.py
""" Contains functions and decorators for execution performance checkers and special execution function wrappers """ # ======================================================================= # # Copyright (C) 2020 Hoverset Group. # # ================================================...
client.py
import socket import threading ENCODING = "utf-8" LOCAL_ENDPOINT = "127.0.0.1" def listen(): while 1: data = sock.recv(4096) if data: print("Server: " + data.decode(ENCODING)) def listen_to_keypress(): while 1: message = input("Enter text (or Enter to quit): \n") i...
vlc.py
import os import random import re import socket import subprocess import sys import threading import time import urllib.error import urllib.parse import urllib.request from twisted.internet.protocol import ReconnectingClientFactory from twisted.protocols.basic import LineReceiver from syncplay import constants, util...
test_backend.py
import base64 import copy import datetime import threading import time import unittest from datetime import timedelta from unittest.mock import Mock, patch from django.conf import settings from django.contrib.sessions.backends.cache import SessionStore as CacheSession from django.core.cache import DEFAULT_CACHE_ALIAS,...
__init__.py
# -*- coding: utf-8 -*- """ Created on Wed Mar 25 15:07:19 2020 """ import os import threading from time import sleep from typing import Optional from subprocess import Popen, PIPE, STDOUT from platform import system from lzma import decompress from base64 import b64decode, b64encode from .pseudo_ffprobe import FFpro...
advanced-reboot.py
# # ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";...
pack.py
#!/usr/bin/python3 import argparse from multiprocessing import Process, Lock import platform import os import sys import shutil import subprocess import string import re import zipfile ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') project_dir = os.getcwd() is_windows = platform.system() == "Windo...
scheduler_job.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 #...
utils.py
from contextlib import contextmanager from multiprocessing import Process from time import sleep import requests def get(*args, **kwargs): if not 'timeout' in kwargs: # Fix issue where requests.get() hangs on local resolved host name kwargs['timeout'] = 0.1 return requests.get(*args, **kwargs...
as_metadata_manager.py
# 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, software # d...
messageHandler.py
import pickle import multiprocessing from Mastermind._mm_client import * from Mastermind import * from settings import * import threading from queue import Queue class messageHandler(): def __init__(self, ip, port): self.client = MastermindClientTCP(clientTimeoutConnect, clinetTimeoutRecieve) ...
test.py
import json import os.path as p import random import subprocess import threading import time from random import randrange import pika import pytest from google.protobuf.internal.encoder import _VarintBytes from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster from helpers.test_...
ticker.py
# -*- coding: utf-8 -*- """ ticker.py Websocket implementation for kite ticker :copyright: (c) 2017 by Zerodha Technology. :license: see LICENSE for details. """ import six import sys import time import json import struct import logging import threading from datetime import datetime from twisted.inter...
h2.py
''' 2.使用多进程模型实现,父进程将命令行所跟的文件发送给子进程,子进程将收到的文件打印出来 python hw2.py “/etc/passwd” ''' import sys from multiprocessing import Pipe,Process def myread(out,inn): inn.close() with open(out.recv(),'r') as f: while True: if f.readline() == '': break else: ...
test_engine.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 use ...
BaseStompServerTestCase.py
#!/usr/bin/env python ''' Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License")...
get_vids.py
# -*- coding: utf-8 -*- """ Created on Mon Jul 13 13:25:10 2020 @author: Nikki, Derek Gloudemans """ import torch import torchvision.transforms.functional as F import importlib import multiprocessing as mp import ip_streamer import cv2 import sys import numpy as np import time from ctypes import c_bool import scipy.s...
bot.py
#!/usr/bin/env python3 """Connects the bot.""" import os import os.path import random import re import sys import threading import time import hclib import pymongo from commands import currency from commands import dictionary from commands import jokes from commands import katex from commands import password from c...
threaded.py
# by ARTRoyale (A. Lebedev) for ZapRoyale import socket import threading import struct import os import uuid import random def randomBytes(n): return bytes(random.getrandbits(8) for i in range(n)) # создаем подключения class ThreadedServer(object): def __init__(self, host, port): self.host = host ...
listen.py
import queue import threading import time import pyaudio import numpy as np import quietnet import options import sys import psk FORMAT = pyaudio.paInt16 frame_length = options.frame_length chunk = options.chunk search_freq = options.freq rate = options.rate sigil = [int(x) for x in options.sigil] frames_per_buffer = ...
exchange_rate.py
from datetime import datetime import inspect import requests import sys import os import json from threading import Thread import time import csv import decimal from decimal import Decimal from .bitcoin import COIN from .i18n import _ from .util import PrintError, ThreadJob, make_dir # See https://en.wikipedia.org/w...
test_common.py
from __future__ import absolute_import, unicode_literals import pytest import socket from amqp import RecoverableConnectionError from case import ContextMock, Mock, patch from kombu import common from kombu.common import ( Broadcast, maybe_declare, send_reply, collect_replies, declaration_cached, ignore_...
pusher.py
import collections import itertools import os import queue import threading import time from dataclasses import dataclass from typing import Dict, Optional, TYPE_CHECKING import pandas as pd import manta_lab as ml if TYPE_CHECKING: from manta_lab.base.packet import ArtifactRequestPacket Item = collections.named...
speech_recognition.py
from pepper.framework import AbstractComponent from pepper.framework.sensor import VAD, StreamedGoogleASR, UtteranceHypothesis from pepper import config from threading import Thread import numpy as np from typing import * class SpeechRecognitionComponent(AbstractComponent): def __init__(self, backend): ...
simple_program_gevent.py
from gevent import monkey monkey.patch_all() import threading from ddtrace.profiling import bootstrap # do not use ddtrace-run; the monkey-patching would be done too late import ddtrace.profiling.auto from ddtrace.profiling.collector import stack def fibonacci(n): if n == 0: return 0 elif n == 1: ...
HaptogramService.py
import time import threading import queue class HaptogramService: def __init__(self, vibration_pattern_player, clip_interval = 0, delta_time = 0.01): self._queue = queue.Queue() self._should_run = False self._delta_time = delta_time self._clip_interval = clip_interval self._...
run.py
#!/usr/bin/env python import sys, os, logging, socket from threading import Thread from user import HonUser import appcom HOST = '' PORT = 11091 def main(): logging.basicConfig(level=logging.DEBUG) logging.info('Running HoNotify') srv_sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) srv_sock.set...
views.py
""" Stream views """ import datetime import io import logging import sys import threading import time from django.core.exceptions import ObjectDoesNotExist from django.core.files.images import ImageFile from django.http import HttpResponse, JsonResponse, StreamingHttpResponse from rest_framework.decorators import api...
web.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys,os import subprocess import json from threading import Thread from colorama import Fore,Back,Style from core import api def loadwebserver(): print Fore.YELLOW + '* For commercial/enterprise use please send email to graniet75@gmail.com' + Style.RESET_ALL ...
engine.py
# ibus-hiragana - Hiragana IME for IBus # # Using source code derived from # ibus-tmpl - The Input Bus template project # # Copyright (c) 2017-2021 Esrille 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 cop...
tests.py
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
macronium.py
from helper import helper_string from qr import makeQRCode import socket from pynput.keyboard import Controller, Key import threading from kivy.config import Config from update import get_latest, isInternet import webbrowser from version import version url = "https://github.com/supersu-man/Macronium-PC/releases/lates...
util.py
import multiprocessing import threading import datetime import time import os from multiprocessing import Process import numpy as np import pynvml from pycode.tinyflow import Scheduler as mp from pycode.tinyflow import ndarray class GPURecord(threading.Thread): def __init__(self, log_path, suffix=""): ...
test_dota_base_sota.py
# -*- coding:utf-8 -*- # Author: Xue Yang <yangxue-2019-sjtu@sjtu.edu.cn> # # License: Apache-2.0 license from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import...
main.py
import os import sys import time import json import requests from functools import partial from threading import Thread from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.QtCore import pyqtSignal from core import Utils, Command import main_gui ''' 【主窗口类】 主窗口类继承自QMainWindow类。 图形程序绝大部分交互都在这里。 ''' class M...
host.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 University Of Minho # (c) Copyright 2013 Hewlett-Pa...
servidor.py
from socket import AF_INET, socket, SOCK_STREAM from threading import Thread clientes= {} address = {} HOST = '' PORT = 3000 BUFSIZE = 1024 ADDR = (HOST, PORT) SERVER = socket(AF_INET, SOCK_STREAM) SERVER.bind(ADDR) def aceitar_clientes(): while True: client , client_addr = SERVER...
main.py
import threading from queue import Queue from spider import Spider from domain import * from general import * import time PROJECT_NAME = 'moneycontrol' HOMEPAGE = 'https://www.moneycontrol.com/' DOMAIN_NAME = get_domain_name(HOMEPAGE) QUEUE_FILE = PROJECT_NAME + '/queue.txt' CRAWLED_FILE = PROJECT_NAME + '/...
mplogging.py
import atexit import time from logging import NOTSET, INFO, DEBUG, WARN, ERROR, CRITICAL from logging import addLevelName, getLevelName from multiprocessing import Process, current_process from multiprocessing.managers import BaseManager, BaseProxy from pyrus import AbstractQueueConsumer DFAULT_LOG_LEVEL = INFO class...
PreDebugWatchDev.py
import os import platform import subprocess from threading import Thread import time import sys import random import socket print("SqBuild: Python ver: " + platform.python_version() + " (" + platform.architecture()[0] + "), CWD:'" + os. getcwd() + "'") if (os.getcwd().endswith("SqCore")) : # VsCode's context menu 'Run...
naturalneighbor.py
import numpy as np class NaturalNeighborInterpolation: def __init__( self, k=None, r=None, min_dist=0, min_neighbor=0, invdistpower=2, verbose=0, audit=False ): """ The NaturalNeighborInterpolation class supports Vornonoi Neighbor Averaging with inverse distance weighti...
webtrader.py
# -*- coding: utf-8 -*- import logging import os import re import time from threading import Thread import requests from . import exceptions from . import helpers from .log import log # noinspection PyIncorrectDocstring class WebTrader(object): global_config_path = os.path.dirname(__file__) + "/config/global.js...
download.py
# Copyright European Organization for Nuclear Research (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 # # Authors: # - Muhammad Aditya Hilmy...
basic_gpu_test.py
# 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/LICENSE-2.0 # # Unless required by applica...
pod.py
#!/usr/bin/env python3 import random import time from scapy.all import IP, ICMP, sendp, send, fragment, conf from threading import Thread # Import modules for POD flood import tools.randomData as randomData def POD_ATTACK(threads, attack_time, target): # Finish global FINISH FINISH = False target_ip = target p...
blapse.py
import bcam from bcam.utils import bgr8_to_jpeg import ipywidgets.widgets as widgets import traitlets import cv2 import os import time import threading from ipywidgets import Button, HBox, VBox class BLapse(): def __init__(self, width_dp=544, height_dp=306): self.image_widget = widgets.Image(format='jpeg...
wsdump.py
#!d:\transf~1\other\eventb~1\event2~1\scripts\python.exe import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encodin...
__main__.py
from sys import path path.append(".") from shared.utils import * from shared.byte_coders import * from shared.serial_setup import * from threading import Event, Thread from signal import signal, SIGINT from gateway import Gateway from cli import CLI print(""" __ ___ _ _ /\ /\/ / / __\ |__...
overcast-uploader.py
#!/usr/bin/env python3 import requests import bs4 as bs import argparse import glob, os import threading import datetime def send_file_to_overcast(filepath, login, password, clean=False): if not filepath.endswith("mp3"): raise Exception("Only mp3 files can be uploaded.") with open(filepath, 'rb') as f...
__init__.py
# Copyright 2019 Atalaya Tech, 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,...
01.multi_thread_craw.py
import threading import blog_spider import time from test_API.testing.Logfile import LogFile log = LogFile() # 普通的单线程爬虫 def single_thread(): log.echolog("single_thread begin") for url in blog_spider.urls: blog_spider.craw(url) log.echolog("single_thread end") # 多线程爬虫 def multi_thread(): thr...
agent.py
# Copyright 2021 The Flax Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
graphyte.py
"""Send data to Graphite metrics server (synchronously or on a background thread). For example usage, see README.rst. This code is licensed under a permissive MIT license -- see LICENSE.txt. The graphyte project lives on GitHub here: https://github.com/benhoyt/graphyte """ import atexit import logging try: impo...
backend.py
from __future__ import unicode_literals import logging import os import threading from mopidy import backend, httpclient import pykka import spotify from mopidy_spotify import Extension, library, playback, playlists, web logger = logging.getLogger(__name__) BITRATES = { 96: spotify.Bitrate.BITRATE_96k, ...
async_client.py
import json import base64 import aiohttp import asyncio import threading from uuid import uuid4 from time import timezone, sleep from typing import BinaryIO, Union from time import time as timestamp from locale import getdefaultlocale as locale from .lib.util import exceptions, headers, device, objects, helpers from ...
__init__.py
import os import csv import sys import logging from threading import RLock, Thread def pick_projects(directory): """ Finds all subdirectories in directory containing a .json file :param directory: string containing directory of subdirectories to search :return: list projects found under the given direc...
__init__.py
##################################################################### # # # /plugins/progress_bar/__init__.py # # # # Copyright 2018, Christopher Billington...
kaleb_mistyPy.py
# /********************************************************************** # Original Copyright 2020 Misty Robotics # 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 # ...
global_index_consistent_check_cstore.py
#!/usr/bin/python # -*- coding: UTF-8 -*- import MySQLdb import multiprocessing import time import sys HOST=sys.argv[1] USER="root" PASSWORD="****" DATABASE="Baikaltest" PORT=eval(sys.argv[2]) resource_tag='' namespace="FENGCHAO" def worker3(start1, end): start = time.time() print(int(start1), int(end)) ...
test_tensorflow2_autolog.py
# pep8: disable=E501 import collections import pytest import sys from packaging.version import Version import numpy as np import pandas as pd import tensorflow as tf from tensorflow.keras import layers import mlflow import mlflow.tensorflow import mlflow.keras from mlflow.utils.autologging_utils import BatchMetricsL...
uhdtodrf.py
#!python # ---------------------------------------------------------------------------- # Copyright (c) 2020 Massachusetts Institute of Technology (MIT) # All rights reserved. # # Distributed under the terms of the BSD 3-clause license. # # The full license is in the LICENSE file, distributed with this software. # ----...
p2p-nfc.py
#!/usr/bin/python # # Example nfcpy to wpa_supplicant wrapper for P2P NFC operations # Copyright (c) 2012-2013, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. import os import sys import time import random import threading import argparse...
collect.py
from multiprocessing import Process from tweepy import OAuthHandler, API, AppAuthHandler from collection.accounts_post_2013 import start_streamer, start_lookup from collection.accounts_pre_2013 import fetch_accounts, DEFAULT_MAX_ID, DEFAULT_MIN_ID from collection.accounts_from_file import fetch_accounts_from_file from...
notes_db.py
# nvPY: cross-platform note-taking app with simplenote syncing # copyright 2012 by Charl P. Botha <cpbotha@vxlabs.com> # new BSD license import sys import codecs import copy import glob import os import json import logging from queue import Queue, Empty from http.client import HTTPException from .p3port import unicode ...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2019 The Bitcoin Core Developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test perbugd shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_fra...
multithread_crawler.py
import asyncio from concurrent.futures import ThreadPoolExecutor from datetime import datetime from functools import partial from datetime import datetime from time import sleep import multiprocessing as mp import requests import importlib queue = asyncio.Queue() scraper = importlib.import_module("scraper") """ Pro...
eregs_cache.py
from BeautifulSoup import BeautifulSoup import requests from urlparse import urlparse import threading import sys import time class EregsCache(): @staticmethod def write(msg): sys.stdout.write(msg + "\n") @staticmethod def write_error(msg): sys.stderr.write(msg + "\n") def acces...
client.py
# -*- coding:utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Client widget for the IPython Console This is the widget used on all its tabs """ # Standard library imports from __future__ import absolute_import ...
lyrics.py
# Copyright 2005 Eduardo Gonzalez, Joe Wreschnig # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation # FIXME: # - Too many buttons -- saving should be automatic? # - Make purpose of 'Add...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test multiwallet. Verify that a bitcoind node can load multiple wallet files """ from decimal import D...
callbacks_test.py
# 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/LICENSE-2.0 # # Unless required by applica...
scrimmage.py
from werkzeug.wrappers import Request, Response import psycopg2 import json import os import battlecode_cli as cli import threading import boto3 from time import sleep ##### SCRIMMAGE SERVER 2K18 ####### ## ## We put a JSON post request to the scrimmage server. ## {"password":"secret","red_key":"redawskey"...
codegen_driver.py
################################################################################ # # MIT License # # Copyright (c) 2020-2021 Advanced Micro Devices, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to dea...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The WeyCoin 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...
exercise01.py
""" 练习1:大文件拆分 编写程序完成 将一个文件平均拆分为两个部分,分别为 上半部分和下半部分,要求拆分过程同步执行 """ from multiprocessing import Process import os filename = "./timg.jfif" size = os.path.getsize(filename) # 如果在父进程打开,子进程直接使用 # 那么父子进程公用一个文件偏移量 # fr = open(filename, 'rb') # 复制文件上半部分 def top(): fr = open(filename,'rb') fw = open("top.jpg",'wb') ...
test_downloader_http.py
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals # Allow direct execution import os import re import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import threading from test.helper import http_server_port, try_rm from nextdl import n...
daemon.py
# Standard library import asyncio from collections import deque from threading import Thread from typing import ( Any, Deque, Dict, Tuple, ) # Third party libraries import aiohttp import aiogqlc from more_itertools import iter_except # Local libraries from tracers.config import ( CONFIG, ) from tr...
ResNet18_train_2_lps_with_gradient_quantization.py
#### Shervin Minaee #### March 2020 #### Training code for covid detection by finetuning ResNet18 from __future__ import print_function, division import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import numpy as np import torchvision from torchvision import datasets, m...
AirsimTelloClient.py
from __future__ import print_function import msgpackrpc # install as admin: pip install msgpack-rpc-python import numpy as np # pip install numpy import msgpack import time import math import logging import socket import threading import time from airsimdroneracingvae import DrivetrainType, YawMode, RCData, Multiro...
run_pro.py
#!/usr/bin/env python """ Created on Mon Aug 29 2016 Modified from the similar program by Nick @author: Adrian Utama Modified from the works from authors above to work in Windows in Python3. Optical Powermeter (tkinter) Version 1.02 (last modified on Mar 23 2017) v1.01: There was a bug as worker thread 1 run endless...
run_Atrazine_simulations.py
#!/usr/bin/python3 # Script PHASE 2 of simulation with atrazine consortium. # 1. SIMULATION of 5h, with 4 possible perturbations, in particular, adding phosphate to the medium, or incrementing the biomass of H.stevensii and/or Halobacillus sp. # Command: 'python3 run_Atrazine_simulations.py num_processors num_simul...
rosbag_cli_recording_3.py
#!/usr/bin/env python import roslib import rospy import smach import smach_ros from geometry_msgs.msg import Point from geometry_msgs.msg import Point32 from geometry_msgs.msg import PointStamped from geometry_msgs.msg import Pose from geometry_msgs.msg import PoseStamped from geometry_msgs.msg import Quaternion from ...
thread6_lock.py
# View more 3_python 1_tensorflow_new tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial import threading def job1(): global A, lock lock.acquire() for i in range(10): ...
player.py
""" The MIT License (MIT) Copyright (c) 2015-present Rapptz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merg...
core.py
from deluge.plugins.pluginbase import CorePluginBase import deluge.component as component import deluge.configmanager from deluge.core.rpcserver import export import logging from pathlib import Path from subprocess import CalledProcessError, run, PIPE from threading import Thread from time import sleep log = logging.g...
thread.py
from threading import Thread def hello(name): print("Hello,", name) t = Thread(target=hello, args=("Andrey",)) t.start() t.join()
17-TCP_Server_MT.py
from threading import Thread import socket def client_handler(client_socket): while True: data = client_socket.recv(1024) if data: print(data.decode()) client_socket.send("数据处理中.....".encode()) else: print("连接已断开!") client_socket.close() ...
run_job.py
#!/usr/bin/env python3 # Copyright (C) 2019 The Android Open Source Project # # 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 requ...
subproc_vec_env.py
import multiprocessing from collections import OrderedDict from typing import Sequence import gym import numpy as np from lightning_baselines3.common.vec_env.base_vec_env import CloudpickleWrapper, VecEnv def _worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.var() ...
camera.py
''' Module camera provides the VideoStream class which offers a threaded interface to multiple types of cameras. ''' from threading import Thread import os import platform import cv2 # pylint: disable=import-error class VideoStream: ''' Instantiate the VideStream class and call the start() method to be abl...
Engine.py
# coding: utf-8 # Author: Lyderic LEFEBVRE # Twitter: @lydericlefebvre # Mail: lylefebvre.infosec@gmail.com # LinkedIn: https://www.linkedin.com/in/lydericlefebvre # Imports import logging, queue from core.User import * from core.Resources import * from core.Targets import * from core.SprayLove import * from core.C...
queue.py
# # queue.py # # This source file is part of the FoundationDB open source project # # Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 ...
ubxcfgval.py
""" Example implementation of UBX Gen 9 Configuration Interface using CFG-VALSET, CFG-VALDEL and CFG-VALGET messages. Connects to the receiver's serial port and sets up a threaded UBXReader process. With the reader process running in the background, it sends CFG-VALSET and CFG-VALDEL configuration messages to set the ...
loramote.py
from binascii import hexlify from database.db15 import db15, ConstDB15 from database.db2 import db2, ConstDB2 from utils.log import Logger import threading class LoRaMote: def __init__(self, dev_eui): self.dev_eui = hexlify(dev_eui).decode() # def uplinks(self, g_id=None, start_ts=0, end_ts=-1): ...
benchmarks.py
from multiprocessing import Process from threading import Thread from time import time from gevent import spawn, wait COUNT = 100_000_000 def countdown(number): start_time = time() while number > 0: number -= 1 print(time() - start_time) # Single process / single thread: ~8s countdown(COUNT) ...
jgi_rqc_readqcServer.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...
hilos.py
import logging import threading import time def thread_function(name): logging.info("Thread %s: starting", name) time.sleep(2) logging.info("Thread %s: finishing", name) if __name__ == "__main__": format = "%(asctime)s: %(message)s" logging.basicConfig(format=format, level=logging.INFO, ...
testExtParser.py
from wtpy import BaseExtParser, BaseExtExecuter from wtpy import WTSTickStruct from ctypes import byref import threading import time from wtpy import WtEngine,EngineType class MyExecuter(BaseExtExecuter): def __init__(self, id: str, scale: float): super().__init__(id, scale) def init(...