source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
fetcher.py | import multiprocessing
import os
import queue
import signal
import threading
import time
from rohmu import get_transfer
from rohmu.rohmufile import create_sink_pipeline
from pghoard.common import get_object_storage_config
from pghoard.config import key_lookup_for_site
class FileFetchManager:
"""Manages (potenti... |
supernpp.py | #!/usr/bin/python3
import os
import re
from subprocess import Popen
from os.path import normpath, basename
from threading import Thread
import time
from pathlib import Path
import sys
import threading
sys.path.insert(1, '../logInspector')
sys.path.insert(1, '..')
from logReader import Log
class SuperNPP():
def __i... |
harness.py | # Copyright (C) 2/9/20 RW Bunney
# 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 3 of the License, or
# (at your option) any later version.
# This program is distributed in the ... |
vt.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2019 DoomedRaven.
# This file is part of VirusTotalApi - https://github.com/doomedraven/VirusTotalApi
# See the file 'LICENSE.md' for copying permission.
from __future__ import print_function
# Full VT APIv3 functions added by Andriy Brukhovetskyy
# doom... |
devmode.py | from less.utils import compile_less, logger
from less.settings import LESS_DEVMODE_WATCH_DIRS, LESS_OUTPUT_DIR, LESS_DEVMODE_EXCLUDE
from django.conf import settings
import os
import re
import sys
import time
import threading
try:
STATIC_ROOT = settings.STATIC_ROOT
except AttributeError:
STATIC_ROOT = setting... |
ResizingImageCanvas.py | import hashlib
import logging
import os
import threading
import time
from tkinter import *
import cv2
import numpy as np
from PIL import Image, ImageTk
from src.ImageProcessing.contouring import cnt_from_img, save_contour, save_image
class ResizingImageCanvas(Canvas):
"""
Customized Canvas that can handle d... |
inputs.py | # coding=utf-8
# Copyright 2021 The Trax 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 a... |
model.py | import copy
import datetime
import glob
import logging
import os
import pickle
import random
import warnings
from functools import lru_cache
from pprint import pformat # TODO set some defaults for width/etc with partial?
import networkx as nx
import numpy as np
import pandas as pd
import tqdm
from .arg_parser_model ... |
main.py | from multiprocessing import Process, Queue
import getIP,clientTest,serverTest,options
def main():
if options.debugMode:
ip='127.0.0.1'
else:
ip=getIP.main()
print('ip='+ip)
serverTestProcess=Process(target=serverTest.main,args=())
returnData=Queue()
clientTestProcess=Proces... |
e091.py | # 26/11/2019
import argparse
import asyncio
import multiprocessing
import sys
import threading
import time
def sleep_print(x):
time.sleep(x)
print(x)
return None
async def asleep_print(x):
await asyncio.sleep(x)
print(x)
return None
async def sleep_sort(numbers):
await asyncio.gather(*... |
smb_hashes.py | from src.platform.weblogic.authenticate import checkAuth
from src.platform.weblogic.interfaces import WINTERFACES
from src.lib.cifstrap import Handler
from auxiliary import Auxiliary
from threading import Thread
from log import LOG
from re import findall
from time import sleep
from os import getuid
import socket
import... |
mock_track.py | # -*- coding: UTF-8 -*-
import requests
import random
import json
import time
import threading
from geopy.distance import geodesic
# 需要mock哪个key的设备
API_KEY = 'AAAAA-AAAAA-AAAAA-AAAAA-AAAAA-AAAAZ'
# 需要mock哪个service下的设备
SERVICE_ID = 'd41ef73b7e3d4fc2b23f24709ca2c77e'
# 指定哪些设备行驶,未指定则选取所有离线设备(不超过MAX_DEVICE_COUNT规定个数)
#... |
lambda_executors.py | import os
import re
import json
import time
import logging
import threading
import subprocess
# from datetime import datetime
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
# for Python 2.7
from pipes import quote as cmd_quote
from localstack import ... |
__init__.py | # -*- coding: utf-8 -*-
"""
Implements context management so that nested/scoped contexts and threaded
contexts work properly and as expected.
"""
from __future__ import absolute_import
from __future__ import division
import collections
import functools
import logging
import os
import platform
import six
import socket
... |
subscriber.py | #!/usr/bin/env python
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
apiCall.py | import os, sys
sys.path.append('.\libraries')
#from pabuehle_utilities_CV_v1 import *
from pabuehle_utilities_general_v0 import *
import requests, json, base64, datetime, time, threading
from flask import Flask, jsonify
####################################
# Parameters
####################################
#imgDir =... |
server.py | import logging
import threading
import zmq
logging.basicConfig(
format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
level=logging.INFO
)
session_file = 'server_session.json'
class Server:
def __init__(self, name, interface, port, num_workers):
self.name = name
self.interface ... |
ssh.py | # -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
astropi_buttons.py | import time
import board
import digitalio
from adafruit_debouncer import Debouncer
from functools import wraps
from collections import namedtuple
from threading import Thread, Event
import inspect
AstroPiButtonEvent = namedtuple('AstroPiButtonEvent', ('timestamp', 'button', 'action'))
# If you have the buttons wired... |
utils.py | import os
import sys
import time
import pathlib
import json
import threading
import random
from YeetsMenu.menu import Menu
from YeetsMenu.option import Option
from colorama import Style, Fore
from stdiomask import getpass
from pw_manager.utils import constants
def clear_screen():
if sys.platform.startswith("win... |
test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试所有时段同时处理平均分布情况下最多容纳多少行数据同时在内存
import numpy as np
from multiprocessing import Process
import json
def processTask():
MATRIX = [['j, 3.33, 3.33, 3.33, 3.33, 3.33, 3.33' for j in xrange(1000)] for x in xrange(0, 2088)]
eachNum = 1000
for t in xrange(0, 100000):
for... |
run_acserver.py | #!/usr/bin/env python3
import multiprocessing
import os.path
import signal
import subprocess
import sys
RUNTIME_PATH = os.path.dirname(os.path.abspath(__file__))
PROJECT_PATH = os.path.dirname(RUNTIME_PATH)
sys.path.append(PROJECT_PATH)
sys.path.append(RUNTIME_PATH)
for p in os.listdir(os.path.join(PROJECT_PATH, "e... |
app.py | # WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`
import signal, os, time, json, queue, socket, click, cv2, pandas as pd
import multiprocessing as mp
import threading as td
import logging
logger = logging.getLogger()
stream_handler = logging.Stream... |
SettingsView.py | import ui
import console
import threading
import time
from objc_util import ObjCClass, NSURL, ns
class SettingsView (object):
def __init__(self, show_docset_management_view, show_cheatsheet_management_view, show_usercontributed_management_view):
self.data = ['Standard Docsets', 'Cheat Sheets', 'User Contributed Do... |
neuro_training.py | '''
Gathering data and training labels
Data is saved in foo.csv in working directory
'''
import pygame
import multiprocessing
import numpy as np
import time
import common as c
from paddle import Paddle
from pyomyo import Myo, emg_mode
# ------------ Myo Setup ---------------
q = multiprocessing.Queue()
def worker(q... |
testclient.py | import asyncio
import http
import io
import json
import queue
import threading
import types
import typing
from urllib.parse import unquote, urljoin, urlparse
import requests
from starlette.types import ASGIApp, Message, Scope
from starlette.websockets import WebSocketDisconnect
# Annotations for `Session.request()`
... |
image.py | # ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... |
tsUserv3.py | from socket import *
from time import ctime
import threading
HOST = ''
PORT = 21567
BUFSIZ = 1024
ADDR = (HOST, PORT)
udpSerSock = socket(AF_INET, SOCK_DGRAM)
udpSerSock.bind(ADDR)
def recv_handle(udpSerSock, BUFSIZ,addr):
while True:
data, addr = udpSerSock.recvfrom(BUFSIZ)
if data:
da... |
test_lib.py | import sys
import threading
from twiggy import lib
from . import when
if sys.version_info >= (2, 7):
import unittest
else:
try:
import unittest2 as unittest
except ImportError:
raise RuntimeError("unittest2 is required for Python < 2.7")
class ThreadNameTest(unittest.TestCase):
def... |
get_malware_bazaar.py | import shutil
import os
import threading
import zipfile
import requests
from contextlib import closing
import lxml.etree as le
# 输出文件夹
out_dir = './output'
# 线程数
thread_num = 20
# http请求超时设置
timeout = 5
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chro... |
simple.py | import aiozmq
import aiozmq.rpc
import argparse
import asyncio
import gc
import multiprocessing
import random
import sys
import threading
import time
import zmq
import uvloop
from scipy.stats import norm, tmean, tvar, tstd
from numpy import array, arange
import matplotlib.pyplot as plt
from matplotlib import cm
def ... |
mbed_greentea_cli.py |
"""
mbed SDK
Copyright (c) 2011-2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
test_visuals.py | import sys
sys.path.append('build')
import numpy as np
import numpy.random as rnd
import zmq
import random
import sys
import time
import pickle
from pyversor_ import ega, cga
from pyversor_.cga.round import null
import datetime
from vispy import io
from vispy import scene, visuals
from vispy.gloo.util import _sc... |
exe_test.py | # Copyright 2015 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... |
athenad.py | #!/usr/bin/env python3
import base64
import hashlib
import io
import json
import os
import sys
import queue
import random
import select
import socket
import threading
import time
from collections import namedtuple
from functools import partial
from typing import Any
import requests
from jsonrpc import JSONRPCResponseM... |
server.py | #!/usr/bin/env python
import socket
import errno
import logging
import platform
import signal
import sys
import threading
import time
from threading import Thread
import fcntl
import struct
from netifaces import AF_INET, AF_INET6, AF_LINK
IFACE = 'eth0'
TCP_PORT = 4301
MESSAGE = 'pong-{:05d}'
BUFFER_SIZE = len('pong-0... |
deploy_ovf.py | #!/usr/bin/env python
"""
Written by Tony Allen
Github: https://github.com/stormbeard
Blog: https://stormbeard.net/
This code has been released under the terms of the Apache 2 licenses
http://www.apache.org/licenses/LICENSE-2.0.html
Script to deploy VM via a single .ovf and a single .vmdk file.
"""
from os impor... |
util.py | """
Application utility module
"""
# Copyright 2021 Silicon Laboratories Inc. www.silabs.com
#
# SPDX-License-Identifier: Zlib
#
# The licensor of this software is Silicon Laboratories Inc.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for... |
monitoring.py | import os
import socket
import pickle
import logging
import time
import datetime
import zmq
import queue
from multiprocessing import Process, Queue
from parsl.utils import RepresentationMixin
from parsl.monitoring.message_type import MessageType
from typing import Optional
try:
from parsl.monitoring.db_manager ... |
client.py | import threading
from datetime import datetime
from tkinter import *
import grpc
import resources.chat_pb2 as chat
import resources.chat_pb2_grpc as rpc
class Client:
"""Representation of user interface."""
def __init__(self, u: str, window, address, port):
"""Creates a window in a separate thread... |
multi_threaded_augmenter.py | # Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#... |
util.py | import asyncio
import io
import logging
import os
import random
import re
import socket
import subprocess
import tarfile
import threading
import time
from contextlib import contextmanager
from functools import partial as p
from io import BytesIO
from typing import Any, Dict, List, TypeVar, cast
import docker
import ne... |
video_queue.py | import sys
import time
import hn_tv
import threading
import subprocess
import library
from config import CONTROL
def method_to_type(method):
return {"file": "local", "youtube": "direct"}.get(method, "unknown")
class Video:
def __init__(self, title, thumbnail, duration, method, index):
self.title = ... |
brainslug.py | from abc import ABCMeta, abstractmethod
from functools import partial
import asyncio
import json
import threading
import uuid
import weakref
from aiohttp import web
# ✂ - brainslug/__init__.py ------------------------------------- ✂
# XXX: Cada mochuelo a su olivo
APPS = dict()
RUNNING = dict()
SESSIONS = weakref.We... |
test_jobs.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
#... |
AutoReloadingAppServer.py | #!/usr/bin/env python
"""AutoReloadingAppServer
This module defines `AutoReloadingAppServer`, a replacement for `AppServer`
that adds a file-monitoring and restarting to the AppServer. Used mostly like:
from AutoReloadingAppServer import AutoReloadingAppServer as AppServer
If `UseImportSpy` is set to False in A... |
BBScan.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# A tiny Batch weB vulnerability Scanner
# my[at]lijiejie.com http://www.lijiejie.com
import Queue
import logging
import re
import threading
from bs4 import BeautifulSoup
import multiprocessing
import time
from string import Template
import glob
import ipaddress
impo... |
dot.py | # -*- coding: UTF-8 -*-
import os
import sys
from subprocess import Popen, PIPE
from multiprocessing import Process, Pipe
import argparse
import json
from datetime import datetime
from enum import Enum
if sys.version_info > (3, 0):
from configparser import ConfigParser
else:
from ConfigParser import ConfigParser
c... |
hmb.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 r... |
bridge.py | #!/usr/bin/env python
#
# Copyright (c) 2018-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
"""
Rosbridge class:
Class that handle communication between CARLA and ROS
"""
try:
import queue
except ImportError:
impor... |
server.py | """
This is a simple server implementation, which looks for clients through Bonjour protocol,
and communicates with clients / Pd patch via OSC protocol.
"""
import socket
import threading
from netifaces import interfaces, ifaddresses, AF_INET
from zeroconf import raw_input, ServiceBrowser, Zeroconf
from pythonosc imp... |
A3C.py | import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Categorical
import torch.multiprocessing as mp
import time
# Hyperparameters
n_train_processes = 3
learning_rate = 0.0002
update_interval = 5
gamma = 0.98
max_train_ep = 300
max_tes... |
basic_threading_function.py | ###################################
# File Name : basic_threading_function.py
###################################
#!/usr/bin/python3
import threading
def worker(count):
print ("name : %s, argument : %s" % (threading.currentThread().getName(), count))
def main():
for i in range(5):
t = threading.Threa... |
filemanager.py | # -*- coding: utf-8 -*-
'''
filemanager.py
A simple manager for selecting directories and files.
Copyright © 2010-2018 HeaTTheatR
For suggestions and questions:
<kivydevelopment@gmail.com>
This file is distributed under the terms of the same license,
as the Kivy framework.
EXAMPLE:
from kivy.app import App
from k... |
setup.py | import copy, random, json, os, threading, shutil
from flask import (
Flask,
Blueprint,
render_template,
request,
redirect,
url_for,
jsonify,
flash,
)
from flask_login import login_required, current_user
from flask import current_app as app
from mnemonic import Mnemonic
from ..helpers im... |
duodecimer.py | from abots.events import Every, ThreadMarshal
from abots.helpers import cast, utc_now
from queue import Queue, Empty
from collections import defaultdict
from threading import Thread, Event
"""
TODO:
* Add way to export tasks to pickle file on stop?
Duodecimer: "duodec-" meaning twelve and the "-imer" for timer, or ... |
test_zrobot_api.py | import os
import shutil
import tempfile
import time
import unittest
import uuid
from multiprocessing import Process
from gevent import monkey
from js9 import j
from zerorobot import service_collection as scol
from zerorobot import template_collection as tcol
from zerorobot.dsl.ZeroRobotAPI import TemplateNotFoundErro... |
scheduler_job.py | # pylint: disable=no-name-in-module
#
# 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, Versio... |
test_partition.py | from functools import reduce
from os import name
import threading
import pytest
from base.partition_wrapper import ApiPartitionWrapper
from base.client_base import TestcaseBase
from common import common_func as cf
from common import common_type as ct
from utils.util_log import test_log as log
from common.common_type i... |
mpdservermock.py | import os, socket, sys, threading, time
from __init__ import Armando
sys.path = [Armando.get_lib_dir()] + sys.path
from config import Config
class MpdServerMock(threading.Thread):
"""
Mocks an MPD server for the predefined calls performed by unit tests
@author: Fabio "BlackLight" Manganiello <blacklight8... |
server.py | # Some code written by prasanna
# Basic code written by a youtube channel guy i forgot but credits goes to him :)
import socket
import sys
import os
import threading
import time
from queue import Queue
import modules.socket_connection as sc
normal_clients = sc.socket_tools("0.0.0.0",1025,"data.DAT")
sudo_user = sc.soc... |
test_bmuf.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from multiprocessing import Manager
import random
import unittest
import torch
import torch.nn as nn
from fairseq_mod import... |
divideAndConquer.py | #python
import pyodbc #for mssql connection with python
from threading import Thread #for thread
import time
#connect db
conn = pyodbc.connect('Driver={SQL Server};'
'Server=USBLRVDEEPAK1;'
'Database=dbTemp;'
'Trusted_Connection=yes;')
#get table names
d... |
rfid_manager.py | import logging
import traceback_mail
import threading
import json
import requests
from collections import namedtuple
from global_xraid import xraid
import os
import re
logger = logging.getLogger("xraid.rfid_manager")
class RfIDManager:
def __init__(self):
self.rfid_list = {}
def insert_or_update(sel... |
santaiPaw.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#Hecho por Benda Paola Lara Moreno
#Sistop-2019-1|FI-UNAM|iPaw
#Ejercicio: Santa Claus
#Lenguaje: Python
#Este trabajo se desarrollo en la version 2.7.10
#Para ejecutarlo requiere de Python, y ejecutarlo desde la terminal posisionandose en
#el directorio donde se encuentre gua... |
HelperFunctions_NonClassFunctions_ReubenPython2and3.py | # -*- coding: utf-8 -*-
'''
Reuben Brewer, Ph.D.
reuben.brewer@gmail.com
www.reubotics.com
Apache 2 License
Software Revision E, 03/13/2022
Verified working on: Python 2.7, 3.8 for Windows 8.1, 10 64-bit and Raspberry Pi Buster (no Mac testing yet).
'''
###############
import os, sys, platform
import... |
03.py | import threading
import requests
import time
def ping(url):
res = requests.get(url)
print(f'{url} : {res.text}')
urls = [
'http://httpstat.us/200',
'http://httpstat.us/400',
'http://httpstat.us/404',
'http://httpstat.us/408',
'http://httpstat.us/500',
'http://httpstat.us/524'
]
if ... |
test_storage.py | # Copyright 2019 The KRules 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 writing,... |
plugin_event_multiplexer.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... |
aggregator.py | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
An aggregator of sensors values
Created on 10 juil. 2012
:author: Thomas Calmant
"""
# ------------------------------------------------------------------------------
from pelix.ipopo import constants
from pelix.ipopo.decorators import ComponentFactory, Prov... |
train.py | # Copyright (c) 2021 PaddlePaddle 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 app... |
utils.py | import json
import logging
import threading
import time
from datetime import date as dt_date
from typing import List
from typing import Tuple
class InlineKeyboard:
def __init__(self, rows: int):
self._buttons = list([] for i in range(rows))
def add_button(self, row: int, text: str, callback_data: str... |
worker.py | from contextlib import contextmanager
import atexit
import faulthandler
import hashlib
import inspect
import io
import json
import logging
import os
import redis
import sys
import threading
import time
import traceback
from typing import Any, Dict, List, Iterator
# Ray modules
from ray.autoscaler._private.constants im... |
test_execution.py | # Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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... |
test_autograd.py | import contextlib
import gc
import sys
import io
import math
import random
import tempfile
import time
import threading
import unittest
import warnings
from copy import deepcopy
from collections import OrderedDict
from itertools import product, permutations
from operator import mul
from functools import reduce, partial... |
printer_join.py | from threading import Thread
from time import sleep
def printer():
for i in range(3):
print(i, end=" ")
sleep(0.1)
thr = Thread(target=printer, daemon=True)
thr.start()
thr.join()
print() # Add newline
|
f.py | import threading
def job1():
global A, lock
lock.acquire()
for i in range(10):
A += 1
print("job1", A)
lock.release()
def job2():
global A, lock
lock.acquire()
for i in range(10):
A += 10
print("job2", A)
lock.release()
if __name__ == "__main__":
... |
test_operator.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... |
core.py | # <HTTPretty - HTTP client mock for Python>
# Copyright (C) <2011-2020> Gabriel Falcão <gabriel@nacaolivre.org>
#
# 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, includ... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
datasets.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import annotations
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 ExifTags
from PIL import Image
from torc... |
test_index.py | import pytest
from base.client_base import TestcaseBase
from base.index_wrapper import ApiIndexWrapper
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
from common.code_mapping import CollectionErro... |
test_multicore37.py | from multiprocessing import Process, Value, Array
import unittest
class test_multicore37(unittest.TestCase):
def f(self, n, a, b):
n.value = 3.1415927
for i in range(len(a)):
a[i] = -a[i]
for i in range(len(b)):
b[i] = 2*b[i]
def g(self, n, l):
A, B = l... |
theBMS.py | #!/usr/bin/env python3
"""theBMS ~ Safe, Easy and Affordable
Copyright © 2019 pro3E - Team4
"""
from multiprocessing import Process
from classes.BMS import BMS
from time import time
import _mysql
def renew_balancing(bms):
if bms.balancing:
bms.start_balancing()
def push_to_db(query):
host = "hostname"
port = 3... |
config.py | # -*- coding: utf-8 -*-
'''
config
======
logging
-------
logging verwenden::
import logging
logger = logging.getLogger( "MQTT" )
debug Meldungen ausgeben::
logger.setLevel( logging.DEBUG )
logging level:
* CRITICAL - 50
* ERROR - 40
* WARNING - 30
* INFO - 20
* DEBUG - 10
* NOTSET - 0
CHANGELOG... |
test_thread.py | import time, threading
# 新线程执行的代码:
def loop():
print('thread %s is running...' % threading.current_thread().name)
n = 0
while n < 5:
n = n + 1
print('thread %s >>> %s' % (threading.current_thread().name, n))
time.sleep(1)
print('thread %s ended.' % threading.current_thread().nam... |
test_utils_test.py | from __future__ import print_function, division, absolute_import
from contextlib import contextmanager
import socket
import sys
import threading
from time import sleep
import pytest
from tornado import gen
from distributed import Scheduler, Worker, Client, config, default_client
from distributed.core import rpc
from... |
saml.py | import json
import logging
import os
import ssl
import urllib
import webbrowser
from http.server import HTTPServer, BaseHTTPRequestHandler
from queue import Queue
from threading import Thread
from typing import Any, Optional
from peek.connection import EsClient, RefreshingEsClient
from peek.errors import PeekError
_l... |
sms.py | '''send sms message via bmob.'''
import json
import requests
import threading
class SMS_sender:
def __init__(self,appid,appkey):
self.headers={"X-Bmob-Application-ID":appid,
"X-Bmob-REST-API-Key":appkey,
"Content-Type":"application/json"}
def send_sms(self,co... |
http_list.py | ##############################################################################
# This is the inital shell to build a listener that uses covert utils for C2 #
##############################################################################
# Disclaimer!
# This code is not an optimal HTTP reverse shell!
# It is create... |
__init__.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
__all__ = ['ToastNotifier']
# #############################################################################
# ########## Libraries #############
# ##################################
# standard library
... |
test_profile.py | import tarfile
import time
from pathlib import Path
from threading import Thread
from typing import Any
import pytest
from openwpm.command_sequence import CommandSequence
from openwpm.commands.profile_commands import load_profile
from openwpm.commands.types import BaseCommand
from openwpm.config import BrowserParamsI... |
__init__.py | # Copyright (c) 2015 SONATA-NFV and Paderborn University
# 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 re... |
sparkles.py | import random
import pyaudio
from clear_osc import SineOsc
import multiprocessing as mp
import time
sine_osc = SineOsc()
p = pyaudio.PyAudio()
p2 = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paFloat32,
channels=1,
rate=44100,
output=1,
)
stream2 =... |
HiwinRA605_socket_ros_20190604111144.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
test_scoped_proxy.py | import random
import threading
import unittest
from yadi import context_impl, decorators, types, context
from yadi.bean_factories import _ScopedProxy
class TestScopedProxy(unittest.TestCase):
def test_custom_scope(self):
class ThreadLocalScope(context.Scope):
def __init__(self):
... |
mosaic_image.py | import numpy as np
import cv2
from imutils import resize
import threading
from mosaic_maker.basic_processing.image_processor import ImageProcessor
from mosaic_maker.patch.patch import Patch
class MosaicImage:
def __init__(self, image, patch_size, patch_picker):
self.original_image = image
self.... |
thingsboard-to-gtfsrt-mqtt.py | import os, sys, datetime, json, time, threading
from threading import Event, Thread
import ssl
import paho.mqtt.client as mqtt
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from google.protobuf.json_format import MessageToJson
import gtfs_realtime_pb2... |
subprocess_check_output_interactive.py | from robocorp_ls_core.robotframework_log import get_logger
import threading
from typing import Optional, List
log = get_logger(__name__)
def check_output_interactive(*popenargs, timeout=None, **kwargs) -> bytes:
"""
This has the same API as subprocess.check_output, but allows us to work with
the contents... |
loader.py | import csv
import logging
import re
from threading import Thread
from datetime import datetime
import yaml
from .nanocube import NanoCube
from .serializer import load as nano_load
def create_nanocube(config_path):
stream = file(config_path, 'r')
config = yaml.load(stream)
name = config['Name']
dimen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.