source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_callbacks.py | import os
import multiprocessing
import numpy as np
import pytest
from csv import reader
from csv import Sniffer
import shutil
from keras import optimizers
from keras import initializers
from keras import callbacks
from keras.models import Sequential, Model
from keras.layers import Input, Dense, Dropout, add
from kera... |
sanitylib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import threading
import concurrent.fu... |
02_hisdata.py | import os
import struct
import pandas as pd
import numpy as np
import time, datetime
import multiprocessing
def readTdxLdayFile(fname="data/sh000001.day"):
dataSet=[]
with open(fname,'rb') as fl:
buffer=fl.read() #读取数据到缓存
size=len(buffer)
rowSize=32 #通信达day数据,每32个字节一组数据
code=os.path.basename(fname... |
model_parallel_thread.py | import torch
import torch.nn as nn
import torch.optim as optim
import threading
import torch.multiprocessing as mp
import concurrent.futures
def conv1x1(in_planes, out_planes, stride=1):
"""1x1 convolution"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
def conv3x3(in_pl... |
primes_queue_less_work.py | import math
import time
import multiprocessing
from multiprocessing import Pool
FLAG_ALL_DONE = b"WORK_FINISHED"
FLAG_WORKER_FINISHED_PROCESSING = b"WORKER_FINISHED_PROCESSING"
def check_prime(possible_primes_queue, definite_primes_queue):
while True:
n = possible_primes_queue.get()
if n == FLAG... |
test_postgresql.py | import mock # for the mock.call method, importing it without a namespace breaks python3
import os
import psycopg2
import re
import subprocess
import time
from mock import Mock, MagicMock, PropertyMock, patch, mock_open
from patroni.async_executor import CriticalTask
from patroni.dcs import Cluster, ClusterConfig, Mem... |
PyV8.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement
from __future__ import print_function
import sys, os, re
import logging
import collections
is_py3k = sys.version_info[0] > 2
if is_py3k:
import _thread as thread
from io import StringIO
unicode = str
raw_input = inp... |
serial_actuator.py | """Control the car using serial port."""
import logging
import threading
import time
import serial
from ..utils import memory, settings, utils
class SerialActuator:
"""This classs send through serial port commands to an Arduino to pilot a motors and a servo motor using PWM."""
def __init__(
self,
... |
echo_server_integrated.py | import threading
import unittest
import sys
import os
try:
import thread
except ImportError:
import _thread as thread
proj_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
socket_folder = os.path.join(proj_folder, 'websocket')
sys.path.insert(0, socket_folder)
from websock import WebSo... |
gateway.py | # Copyright 2019 Novartis Institutes for BioMedical Research 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... |
cleaner.py | # Copyright 2013-2018 CERN for the benefit of the ATLAS collaboration.
#
# 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... |
EventLoopTest.py | ##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2012, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... |
app_test.py | from __future__ import print_function
from __future__ import unicode_literals
import re
import socket
import subprocess
import ttfw_idf
import time
import netifaces
from threading import Thread, Event
def run_server(server_stop, port, server_ip, client_ip):
print("Starting PPP server on port: {}".format(port))
... |
learn.py | #!/usr/bin/python3
import json
import csv
from random import shuffle
import warnings
import pickle
import zlib
import gzip
import operator
import time
# import logging
import math
from io import StringIO
from threading import Thread
import functools
import base64
import redis
import multiprocessing
... |
client.py | import socket
import threading
import random
clientA = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientA.connect(("129.236.142.190", 1234))
clientB = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
stop_thread = False
methods = ['E91','BB84']
nickname = input("Choose a nickname: ")
if nickname == "admi... |
8.flask_multiple_session_impliment.py | import subprocess
from selenium.webdriver import Chrome
import pywebio
import template
import time
import util
from pywebio.input import *
from pywebio.output import *
from pywebio.utils import to_coroutine, run_as_function
def target():
template.basic_output()
template.background_output()
run_as_funct... |
TServer.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... |
tcp_forward.py | # -*- coding: utf-8 -*-
# 2020/7/10
# create by: snower
import time
import struct
import random
import traceback
import logging
import argparse
from collections import deque
import threading
import signal
import socket
import sevent
BYTES_MAP = {"B": 1, "K": 1024, "M": 1024*1024, "G": 1024*1024*1024, ... |
scheduler.py | # coding=utf-8
"""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:
* repea... |
unit.py | import unittest
import sys
import os
import re
import time
import shutil
import tempfile
import threading
import errno
sys.path.append(os.path.join("..", "src", "bin"))
from web_ping import URLField, DurationField, WebPing, NTLMAuthenticationValueException
from modular_input import Field, FieldValidationException
fro... |
multithreads4.py | import threading, time
"""
线程安全问题,list不是线程安全的
"""
m = [1, 2, 3, 4, 5]
print(m[-1])
def remove_last():
a = m[-1]
time.sleep(1)
m.remove(a)
t1 = threading.Thread(target=remove_last)
t1.start()
t2 = threading.Thread(target=remove_last)
t2.start()
|
__init__.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
controller.py | from constants import mode_map
from osc4py3.as_eventloop import *
from osc4py3 import oscmethod as osm
from osc4py3 import oscbuildparse
import curses
import os
import threading
import time
class Controller():
def __init__(self, snd_port=31636, rcv_port=31637 ):
self.log = []
osc_startup()
... |
mod_print.py | #!/usr/bin/env python
#
# mod_print.py
# send a file to a printer device
#
# Neil Gershenfeld
# (c) Massachusetts Institute of Technology 2015
#
# This work may be reproduced, modified, distributed,
# performed, and displayed for any purpose, but must
# acknowledge the fab modules project. Copyright is
# retained an... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
PANDA_OUTPUT_VOLTAGE = 5.28
CAR_VOLTAGE_LOW_PASS_K =... |
window.py | # _*_coding:utf8_*_
# Project: lin_mass_tools
# File: window.py
# Author: ClassmateLin
# Email: 406728295@qq.com
# Time: 2020/2/23 7:53 上午
# DESC:
import os
import sys
import random
import time
from PyQt5.QtWidgets import QLineEdit, QLabel, QPushButton, QVBoxLayout, QHBoxLayout, QComboBox, QFileDialog
from PyQt5.QtWidg... |
utils.py | # Copyright 2012-present 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 wri... |
dpflow.py | import zmq
import multiprocessing as mp
from .serialize import loads, dumps
def data_sender(id, name, func_iter, *args):
context = zmq.Context()
sender = context.socket(zmq.PUSH)
sender.connect('ipc://@{}'.format(name))
print('start data provider {}-{}'.format(name, id))
while True:
data_i... |
loop.py | import time
import os
from multiprocessing import Process, Queue
from cache import set_cache, string_cache, set_global_root
from Queue import Empty
import secondary_functions
from json_socket import make_socket, send_json, get_socket
session = {}
socket = None
procs = None
def main():
init_thread... |
task.py | import os
import time
import shlex
import threading
import webbrowser
from datetime import datetime
from datmo.core.controller.base import BaseController
from datmo.core.controller.snapshot import SnapshotController
from datmo.core.controller.environment.environment import EnvironmentController
from datmo.core.entity.... |
mainwindow.py | from __future__ import print_function
from __future__ import unicode_literals
from gi.repository import Gtk, Gdk, GLib, Pango
from pkg_resources import resource_filename # @UnresolvedImport
import logging
from . import cli
from kalite_gtk import validators
from kalite_gtk.exceptions import ValidationError
logger =... |
Combined_Client.py | import threading
from threading import Thread
import io
import socket
import struct
import time
import picamera
import serial
from time import sleep
# Set server IP address & Port
host = "192.168.0.100"
port = 8000
# Thread to handle steering commands
def steer():
global command_client
global ArduinoPort
... |
train.py | from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.callbacks import ReduceLROnPlateau, ModelCheckpoint, TensorBoard
from multiprocessing import Process
from PIL import ImageFile
import tensorflow as tf
import tensorflow_addons as ... |
osxui_poco.py | # -*- coding: utf-8 -*-
import threading
from poco.drivers.std import StdPoco
from poco.utils.device import VirtualDevice
from poco.drivers.std import DEFAULT_ADDR, DEFAULT_PORT
from poco.utils.simplerpc.utils import sync_wrapper
class OSXPoco(StdPoco):
def __init__(self, selector=None, addr=DEFAULT_ADDR, **opt... |
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... |
bot.py | # coding=utf-8
"""
bot.py - Sopel IRC Bot
Copyright 2008, Sean B. Palmer, inamidst.com
Copyright 2012, Edward Powell, http://embolalia.net
Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
Licensed under the Eiffel Forum License 2.
http://sopel.dftba.net/
"""
import time
import imp
import os
import re
import soc... |
all_bots.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: josem
Bot de Telegram que devuelve la IP del servidor
Adaptado de los bots de Alberto disponibles en umucv
"""
# Libreria Telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
# OpenCV
import cv2 as cv
# Enviar bytes
f... |
test_state.py | import logging
import os
import textwrap
import threading
import time
import pytest
import salt.loader
import salt.utils.atomicfile
import salt.utils.files
import salt.utils.path
import salt.utils.platform
import salt.utils.stringutils
log = logging.getLogger(__name__)
pytestmark = [
pytest.mark.windows_whiteli... |
minimizer.py | # Copyright 2019 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, ... |
DSF_podtk_ctrl.py |
"""DSF_podtk_ctrl.py - controller for the POD Toolkit
Chris R. Coughlin, David S. Forsyth (TRI/Austin, Inc.)
"""
__author__ = 'Chris R. Coughlin'
from models.DSF_podtk_model import DSF_PODData
from models import workerthread
from controllers import pathfinder
from views import dialogs
import wx
import ... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
example_stream_buffer_extended.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_stream_buffer_extended.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api
# Documentation: https://lucit-systems-and-development.github.io/unicorn-binance-websoc... |
example6.py | import threading
import time
from timeit import default_timer as timer
def thread_a():
print('Thread A is starting...')
print('Thread A waiting to acquire lock A.')
lock_a.acquire()
print('Thread A has acquired lock A, performing some calculation...')
time.sleep(2)
print('Thread A waiting to ... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
__init__.py | """
Enable ptvsd debugger to attach to HA.
Attach ptvsd debugger by default to port 5678.
"""
import logging
from threading import Thread
from asyncio import Event
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT
import homeassistant.helpers.config_validation as cv
from homeassistant.he... |
udp_handler.py | import datetime
import sys
import signal
import threading
from elasticsearch_raven import transport
from elasticsearch_raven import utils
class Handler(object):
def __init__(self, sock, pending_logs, exception_handler, debug=False):
self.sock = sock
self.pending_logs = pending_logs
self.e... |
__init__.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2020, Nigel Small
#
# 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
#
# Unle... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from ..utils.utils import xyxy2xywh, xywh2xyxy
help_url... |
test_MMTransE_lan_mapping_cn.py | import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '../../src/MMTransE'))
from MMTransE import MMTransE
import time
import multiprocessing
from multiprocessing import Process, Value, Lock, Manager, Array
import numpy as np
from numpy import linalg as LA
fmap = os.path.join(os.path... |
dispatcher.py | """GRPC client.
Implements loading and execution of Python workers.
"""
import asyncio
import concurrent.futures
import logging
import queue
import threading
import traceback
import grpc
from . import functions
from . import loader
from . import protos
from . import rpc_types
class DispatcherMeta(type):
__cu... |
workflows_scaling.py | #!/usr/bin/env python
"""A small script to drive workflow performance testing.
% ./test/manual/launch_and_run.sh workflows_scaling --collection_size 500 --workflow_depth 4
$ .venv/bin/python scripts/summarize_timings.py --file /tmp/<work_dir>/handler1.log --pattern 'Workflow step'
$ .venv/bin/python scripts/summarize_... |
syncMove.py | #!/usr/bin/python3
import os
import sys
import argparse
import pathlib
import shutil
import time
import datetime
import threading
for c in range((shutil.get_terminal_size().columns-1)):
print('-', end='')
print('')
parser = argparse.ArgumentParser(
prog=os.path.base... |
app.py | # https://stackoverflow.com/questions/25149493/how-to-call-another-webservice-api-from-flask
# https://thispointer.com/python-three-ways-to-check-if-a-file-is-empty/
# https://www.geeksforgeeks.org/how-to-create-a-pop-up-message-when-a-button-is-pressed-in-python-tkinter/
# https://stackoverflow.com/questions/231123... |
pykms_Misc.py | #!/usr/bin/env python3
from __future__ import print_function
import sys
import logging
import os
import argparse
from logging.handlers import RotatingFileHandler
from pykms_Format import ColorExtraMap, ShellMessage, pretty_printer
#--------------------------------------------------------------------------------------... |
main.py | import requests
import random
from typing import Dict
from typing import List
from typing import Optional
from typing import Set
from typing import Tuple
import psycopg2
import queue
import json
import threading
from multiprocessing.dummy import Pool
seen = queue.Queue()
cores: int = 4
pool = Pool(cores)
limit: int =... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
TScanAPIDemo_pyqt5.py | from ctypes import *
from PyQt5.QtWidgets import *
from TSMsater_32 import TScanAPI
import sys
import threading
from threading import Lock, Thread
canfd = TScanAPI.TLIBCANFD()
obj1 = c_size_t(0)
def OnPreRxCANEvent(ACAN):
print("回调事件发送接受can.FIdentifier = ", ACAN.contents.FIdentifier)
OnRxCANEvent = TScanAPI.O... |
A3C.py | """
Environment is a Robot Arm. The arm tries to get to the blue point.
The environment will return a geographic (distance) information for the arm to learn.
The far away from blue point the less reward; touch blue r+=1; stop at blue for a while then get r=+10.
You can train this RL by using LOAD = False, after trai... |
__init__.py | # -*- coding: utf-8 -*-
"""Miscellaneous helper functions (not wiki-dependent)."""
#
# (C) Pywikibot team, 2008-2019
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
import collections
import gzip
import hashlib
from importlib import import_module... |
android_hooks.py | # -*- coding: utf-8 -*-
# An android event hook via getevent.
# Only ABS_MT_POSITION_X(Y) events are handled.
#
# Basic input: TouchDown(D), TouchUp(U), TouchMove(M)
# Basic timeouts: TouchPressTimeout(P), TouchFollowTimeout(F), TouchMoveStopTimeout(S)
# guestures are defined as follows:
# Tap/Touch/Click: DM?UF
# ... |
start.py | import time
import main
from multiprocessing import Process
x = []
for i in range(10):
p1 = Process(target=main.main, args=(i,))
p1.start()
x.append(p1)
for i in x:
i.join()
|
proxyonly.py | import os
import sys
import time
import json
import codecs
import shutil
import threading
from datetime import datetime, date
if getattr(sys, 'frozen', False):
rootdir = os.path.dirname(sys.executable)
else:
rootdir = os.path.dirname(os.path.realpath(__file__))
# make all filenames based on rootdir being unico... |
fatigue_concurrent_client.py | import base64
import os
import time
from concurrent import futures
import threading
import argparse
import sys
import datetime
import requests, json, numpy as np
from multiprocessing import Process, Queue, Lock
from google.protobuf.timestamp_pb2 import Timestamp
import grpc
#from clipper_admin.grpcclient import ... |
test.py | import argparse
import logging
import subprocess
import threading
import time
import uuid
import yaml
from collections import Counter
import ovirtsdk4 as sdk
import ovirtsdk4.types as types
log = logging.getLogger("test")
class Timeout(Exception):
pass
class JobError(Exception):
pass
class Runner:
... |
win_low_level_hook.py | class WinLowLevelHook:
def __init__(self, keyboard_callback, mouse_callback):
import collections
self.keyboard_callback = keyboard_callback
self.mouse_callback = mouse_callback
self.KeyboardEvent = collections.namedtuple('KeyboardEvent', ['event_type', 'key_code',
... |
interaction.py | from typing import Optional, Any
import asyncio
import contextlib
import enum
import pathlib
import queue
import shlex
import threading
from wcpan.drive.core.types import Node
from wcpan.drive.core.drive import DriveFactory, Drive
from .util import print_as_yaml
class TokenType(enum.Enum):
Global = enum.auto()
... |
CompMolNWChem_ThermoServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
solve.py | #!/usr/bin/env python3
import os,sys
from threading import Thread
from queue import Queue, Empty
import time
import socket, errno
import re
ON_POSIX = 'posix' in sys.builtin_module_names
done=False
tstart = time.time()
print('\n*** SOLVING: hts_bus_challenge -')
# as we get chunks of output bytes from the challeng... |
backend.py | """
Backend Implementation.
Where the back end is implemented.
"""
from os.path import exists, isfile
from threading import Thread
from time import time_ns, sleep
from typing import Optional
from secrets import token_bytes
from _sha256 import sha256
from exceptions import InvalidCredentials
from exceptions import Inva... |
multiprocess_vector_env.py | from multiprocessing import Pipe
from multiprocessing import Process
import signal
import warnings
from cached_property import cached_property
import numpy as np
import chainerrl
def worker(remote, env_fn):
# Ignore CTRL+C in the worker process
signal.signal(signal.SIGINT, signal.SIG_IGN)
env = env_fn()... |
train.py | # Author: Bichen Wu (bichen@berkeley.edu) 08/25/2016
"""Train"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
from datetime import datetime
import os.path
import sys
import time
import numpy as np
from six.moves import xrange
import tensorfl... |
test_mix.py | import pdb
import copy
import pytest
import threading
import datetime
import logging
from time import sleep
from multiprocessing import Process
import sklearn.preprocessing
from utils.utils import *
from common.common_type import CaseLabel
index_file_size = 10
vectors = gen_vectors(10000, default_dim)
vectors = sklear... |
loader.py | """
The Salt loader is the core to Salt's plugin system, the loader scans
directories for python loadable code and organizes the code into the
plugin interfaces used by Salt.
"""
import contextvars
import copy
import functools
import importlib.machinery # pylint: disable=no-name-in-module,import-error
import importli... |
client_server_test.py | #!/usr/bin/env python3
import os
import unittest
from unittest.mock import patch
import securedrop.client as client
from securedrop.client import LIST_CONTACTS_TEST_FILENAME
from securedrop.server import ServerDriver, Server, DEFAULT_filename, AESWrapper
import json
import time
import contextlib
from multiprocessing... |
fsfreezer.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
server.py | import os
import json
import hmac
import binascii
import threading
import time
import itertools
import smtplib
from email.mime.text import MIMEText
from http.server import HTTPServer, BaseHTTPRequestHandler
# TODO: Tests, Logging, Configuration, Packaging, Deployment
class Handler(BaseHTTPRequestHandler):
encod... |
threading_barrier_abort.py | # Copyright (c) 2016 Doug Hellmann. All rights reserved.
"""
"""
# end_pymotw_header
import threading
import time
def worker(barrier):
print(
threading.current_thread().name,
"waiting for barrier with {} others".format(barrier.n_waiting),
)
try:
worker_id = barrier.wait()
exc... |
__init__.py | # Copyright 2011 James McCauley
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POX is distri... |
output_processor.py |
# Copyright Jamie Allsop 2011-2019
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#-------------------------------------------------------------------------------
# Output Processor
#------... |
exchange.py | #
# Copyright 2017-2018 Government of Canada
# Public Services and Procurement Canada - buyandsell.gc.ca
#
# 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/LIC... |
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... |
chatbox_nodb.py | import sys
import time
import telepot
from telepot.loop import MessageLoop
from telepot.delegate import (
per_chat_id_in, per_application, call, create_open, pave_event_space)
"""
$ python3.5 chatbox_nodb.py <token> <owner_id>
Chatbox - a mailbox for chats
1. People send messages to your bot.
2. Your bot remembe... |
log.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2022 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import datetime
import json
import os
import re
import signal
import socket
import sys
import threading
import time
impo... |
ldapcheck.py | #!/usr/bin/env python
"""
ldap check service
Author: George Mihalcea
Created: 22.03.2017
"""
import yaml
import ldap
import socket
import sys
import os
import signal
import multiprocessing
from threading import Thread
from time import sleep
CONFIG_FILE = '../config/config.yml'
def sig_term(mysignal, frame):
... |
channel_mapper.py | #! /usr/bin/python
#
# Qt example for VLC Python bindings
# Copyright (C) 2009-2010 the VideoLAN team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at... |
c.py | import os
import time
import threading
cmd = "sudo iw dev wlan0 station dump | awk '($1 ~ /Station$/) {s = $2;print s;}' >> num.txt"
def clock():
on='ifconfig wlan0 up'
off='ifconfig wlan0 down'
while 1:
os.system(off)
os.system(on)
time.sleep(60)
def ap2():
free_sfr = True
while 1:
... |
socketserver_forking.py | import os
import socketserver
class ForkingEchoRequestHandler(socketserver.BaseRequestHandler):
def handle(self):
# Echo the back to the client
data = self.request.recv(1024)
cur_pid = os.getpid()
response = b'%d: %s' % (cur_pid, data)
self.request.send(response)
r... |
fts_throttler.py | # Copyright 2019 CERN for the benefit of the ATLAS collaboration.
#
# 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 appl... |
test_router.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import time
import threading
from nose.tools import assert_equals, assert_raises
from ..backends.base import BackendBase
from ..apps.base import AppBase
from ..router import Router
def test_router_finds_apps():
router = Router()
router.add_app("rapidsms.con... |
main.py | # -*- coding:utf-8 -*-
import multiprocessing
import random
from datetime import datetime, time
from time import sleep
from time import time as times
import os
from urllib import parse
import json
import requests
# !!!请填写下面的参数
# 填写用户名和密码,以便登录
username = ''
password = ''
# uid为用户id
uid = ''
# 此三项为签到参数,经纬度和真实姓名
latitud... |
test_interrupt.py | #!/usr/bin/env python3
import rclpy
import time
import json
from rclpy.executors import SingleThreadedExecutor
from rclpy.node import Node
import rmf_adapter as adpt
import rmf_adapter.vehicletraits as traits
import rmf_adapter.geometry as geometry
import rmf_adapter.graph as graph
import rmf_adapter.battery as batte... |
i_to_r.py |
"""Defines blocking function inditoredis:
Receives XML data from indiserver on port 7624 and stores in redis.
Reads data published via redis, and outputs to port 7624 and indiserver.
"""
import os, sys, collections, threading, asyncio, pathlib
from time import sleep
from datetime import dateti... |
test_smtplib.py | import asyncore
import base64
import email.mime.text
from email.message import EmailMessage
from email.base64mime import body_encode as encode_base64
import email.utils
import hmac
import socket
import smtpd
import smtplib
import io
import re
import sys
import time
import select
import errno
import textwrap
import thre... |
mossbackScaner.py | # -*- coding: utf-8 -*-
# version: 0.5
# date: 2020.09.22
import json
import socket
import time
import threading
import socket
from subprocess import PIPE
from color_print import *
from utils import format_save
global glo_conf
global glo_pkg_list
global glo_lock
global glo_scanner
glo_pkg_list = ... |
executor.py | # -*- coding: utf-8 -*-
#
# Robonomics liability execution node.
#
from robonomics_liability.msg import Liability
from robonomics_liability.srv import FinishLiability, FinishLiabilityResponse, StartLiability, StartLiabilityResponse, PersistenceLiabilityTimestamp
from robonomics_msgs.msg import Result
from urllib.parse... |
archive.py | import os
import zstandard
import orjson as json
import time
import tarfile
import codecs
from functools import reduce
import jsonlines
import io
from zipfile import ZipFile
import gzip
from math import ceil
import mmap
import multiprocessing as mp
from pathlib import Path
VALID_EXTENSIONS = [
"openwebtext.tar.xz"... |
streaming_utils.py | import threading
import time
import os
on_rtd = os.environ.get('READTHEDOCS') == 'True'
if not on_rtd:
import cv2
class VideoCaptureWithoutBuffer():
def __init__(self, cap):
self.cap = cap
self.frame = None
self.streaming = True
t = threading.Thread(target=self._reader, args=[... |
main.py | from flask import Flask, make_response, jsonify, send_from_directory, redirect
import camera
from PIL import Image, ImageFont, ImageDraw
import io
import os
from threading import Thread
from datetime import datetime, timedelta
DIR = "photos"
app = Flask(__name__)
def find_image(label, offset):
global DIR
b... |
view_tester.py | # Copyright 2017-2020 TensorHub, 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 writ... |
start.py | #!/usr/bin/python3
import jinja2
import os
import socket
import glob
import multiprocessing
import tenacity
import logging as log
import sys
from tenacity import retry
from podop import run_server
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
def start_podop():
os.setuid(8)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.