source
stringlengths
3
86
python
stringlengths
75
1.04M
sparkJobProgressMonitor.py
# ------------------------------------------------------------------------------- # Copyright IBM Corp. 2017 # # 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/licens...
train.py
import os os.environ['OMP_NUM_THREADS'] = '1' import argparse import torch from src.env import MultipleEnvironments from src.model import PPO from src.utils import eval import torch.multiprocessing as _mp from torch.distributions import Categorical import torch.nn.functional as F import numpy as np def get_args(): ...
extract_geoip.py
#!/usr/bin/env python3 import argparse import multiprocessing from geoip2 import database from pymongo import MongoClient from pymongo.errors import DuplicateKeyError from pymongo.errors import CursorNotFound from geoip2.errors import AddressNotFoundError def connect(host): return MongoClient('mongodb://{}:27...
multitester.py
""" Certbot Integration Test Tool - Configures (canned) boulder server - Launches EC2 instances with a given list of AMIs for different distros - Copies certbot repo and puts it on the instances - Runs certbot tests (bash scripts) on all of these - Logs execution and success/fail for debugging Notes: - Some AWS ima...
TapClient.py
from tkinter import messagebox import socket,asyncore from CStructures import * from init import * from Constants import * import threading,time from CQueue import * from threading import * from CStructures import * import MainWindow from tkinter import ttk import asyncio import MainWindowGUI from array import * from p...
29.asyncEventThreadsafe.py
import asyncio from threading import Thread class Event_ts(asyncio.Event): # TODO: clear() method def set(self): self._loop.call_soon_threadsafe(super().set) def start_loop(loop): asyncio.set_event_loop(loop) loop.run_forever() async def producer(event): while True: print('prod...
aprs2_graphite.py
import Queue import thread import threading import graphitesend # don't hold a massive backlog, just momentary spikes max_queue_size = 500 g_thread = None class GraphiteThread(object): def __init__(self, log): self.log = log self.graphite = None self.thr = None self.queue = Qu...
bazel_build.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2016 The Tulsi 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/LICE...
run_background.py
#!/usr/bin/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 ...
MenuBar.py
from retrieval.Document import Document from gui.window.AboutWindow import AboutWindow from gui.window.WarningPopup import WarningPopup import os import threading import pickle import webbrowser import tkinter as tk from tkinter import filedialog class MenuBar: def __init__(self, gui): """ T...
app.py
#! /usr/bin/env python3 """ Title: Hoomaluo - Cool Project: Alternative Cooling Controller Author: Hoomaluo Labs Version: 1.0 Date: 08-27-2018 Overview: * Communicate with a server over MQTT: - report temperature and energy * store locally if disconnected * report local data once back online ...
misc.py
""" Misc module contains stateless functions that could be used during pytest execution, or outside during setup/teardown of the integration tests environment. """ import contextlib import errno import multiprocessing import os import shutil import stat import subprocess import sys import tempfile import time from dist...
test_datautils_align.py
# Copyright (c) 2020 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...
api_test.py
import datetime import json import io import os import re import shutil import socket import tempfile import threading import time import unittest import docker from docker.api import APIClient import requests from requests.packages import urllib3 import six from . import fake_api import pytest try: from unitte...
opencv_multiprocessing.py
import multiprocessing import cv2 queue_from_cam = multiprocessing.Queue() def cam_loop(queue_from_cam): print('initializing cam') cap = cv2.VideoCapture(0) while True: print('querying frame') hello, img = cap.read() print('queueing image') queue_from_cam.put(img) p...
Golestan_Crawler.py
from pydoc import text from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.common.utils import Keys from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import WebDriverWait from selenium.w...
test_state.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import shutil import sys import tempfile import textwrap import threading import time # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.h...
test__monkey_queue.py
# Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. from gevent import monkey monkey.patch_all() from gevent import queue as Queue import threading import time import unittest QUEUE_SIZE = 5 # A thread to run a function that unclogs a blocked Queue. class _Trigg...
ProjE_sigmoid.py
import argparse import math import os.path import timeit from multiprocessing import JoinableQueue, Queue, Process import numpy as np import tensorflow as tf class ProjE: @property def n_entity(self): return self.__n_entity @property def n_train(self): return self.__train_triple.shap...
lichessbot.py
import argparse import chess from chess import engine from chess import variant import chess.polyglot import model import json import lichess import logging import multiprocessing from multiprocessing import Process import signal import backoff from config import load_config from conversation import Conversation, ChatL...
start_pipelined.py
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
test_logging.py
# Copyright 2001-2019 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
LocalAuthService.py
# Copyright (c) 2020. # ThingiBrowser plugin is released under the terms of the LGPLv3 or higher. import threading from http.server import HTTPServer from typing import Optional from PyQt5.QtCore import QUrl from PyQt5.QtGui import QDesktopServices from UM.Signal import Signal # type: ignore class LocalAuthService...
main.py
#! /usr/bin/env python3 import argparse import threading import logging from scapy.all import sniff, Ether, IP from .database import create_tables, Entity, create_session, drop_tables from queue import Queue packet_queue = Queue() def on_packet(p): if Ether not in p or IP not in p: return packet_que...
MeteorReval.py
import sublime import functools import sublime_plugin import urllib.request import re PROJECT_NAME = 'meteor_reval' settings = None RUN_COMMAND = PROJECT_NAME PROJECT_SETTINGS_KEY = PROJECT_NAME def plugin_loaded(): global settings settings = sublime.load_settings("MeteorReval.sublime-settings") """ Patte...
zmq02.py
""" ZeroMQ (PyZMQ) の PUB-SUB パターンのサンプルです。 REFERENCES:: http://zguide.zeromq.org/page:all#Getting-the-Message-Out """ import datetime as dt import multiprocessing as mp import time import zmq from trypython.common.commoncls import SampleBase class Sample(SampleBase): """ZeroMQ の PUB-SUB パターンのサンプルです。""" _SER...
zeromq.py
# -*- coding: utf-8 -*- ''' Zeromq transport classes ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import os import sys import copy import errno import signal import socket import hashlib import logging import weakref import threading from random import randint # Im...
test_wrapper.py
from __future__ import division, absolute_import, print_function __copyright__ = "Copyright (C) 2009 Andreas Kloeckner" __license__ = """ 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 r...
queuemp.py
# queuemp.py # # An example of using queues with multiprocessing def consumer(input_q): while True: # Get an item from the queue item = input_q.get() # Process item print item # Signal completion input_q.task_done() def producer(sequence,output_q): for item in s...
test_lock.py
# coding=utf-8 # Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import os import shutil import tempfile import unittest from builtins import open, str fr...
getproxy.py
# -*- coding: utf-8 -*- # @Author: gunjianpan # @Date: 2018-10-18 23:10:19 # @Last Modified by: gunjianpan # @Last Modified time: 2020-06-01 13:50:44 import argparse import codecs import functools import http.cookiejar as cj import os import random import re import sys import threading import time from concurrent...
scd_coletor_thread.py
#!/bin/python2.7 from __builtin__ import id import os import commands from netaddr import IPNetwork from scd_new_analisador_conflitos import analise_Conflito import time from threading import Thread import threading, Queue os.environ.setdefault("DJANGO_SETTINGS_MODULE", "scd.settings") from django.core.management imp...
DialogPluginManager.py
''' Created on March 1, 2012 @author: Mark V Systems Limited (c) Copyright 2011 Mark V Systems Limited, All rights reserved. based on pull request 4 ''' from tkinter import Toplevel, font, messagebox, VERTICAL, HORIZONTAL, N, S, E, W from tkinter.constants import DISABLED, ACTIVE try: from tkinter.ttk import Tre...
task.py
from dataclasses import dataclass from threading import Thread from queue import Queue @dataclass class ProgressUpdate: progress: float message: str fail: bool = False class Task: thread: Thread output: Queue def __init__(self, target, prompt): def thread_run(msg, out): ...
ssr_check.py
#!/usr/bin/env python3 import requests import time import threading from ssshare.ss import ss_local import random def test_connection( url='http://cip.cc', headers={'User-Agent': 'ShadowSocksShare/web/crawler libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18'}, proxies=None, port=1080, ti...
VasoTracker.py
################################################## ## VasoTracker Pressure Myograph Software ## ## This software provides diameter measurements (inner and outer) of pressurised blood vessels ## Designed to work with Thorlabs DCC1545M ## For additional info see www.vasostracker.com and https://github.com/VasoTracker/Va...
neural_gpu_trainer.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 ...
loading_screen.py
import itertools import threading import time import sys class LoadingScreen(): def __init__(self): self.done = False self.t = None def __animate(self, data_type): for c in itertools.cycle(['|', '/', '-', '\\']): if self.done: break sys.stdout....
pesa2.py
# -*- coding: utf-8 -*- #""" #Created on Sun Jun 28 18:21:05 2020 # #@author: Majdi Radaideh #""" from neorl.hybrid.pesacore.er import ExperienceReplay from neorl.hybrid.pesacore.gwo import GWOmod from neorl.hybrid.pesacore.de import DEmod from neorl.hybrid.pesacore.woa import WOAmod from neorl.hybrid.pesac...
__init__.py
"""Miscellaneous helper functions (not wiki-dependent).""" # # (C) Pywikibot team, 2008-2021 # # Distributed under the terms of the MIT license. # import collections import gzip import hashlib import inspect import itertools import os import queue import re import stat import subprocess import sys import threading impo...
gpu_helper.py
import config import xml.etree.ElementTree as ET import pwd import logging from datetime import datetime, timedelta import threading import pickle import os import traceback from multiprocessing.dummy import Pool as ThreadPool import paramiko import socket logger = logging.getLogger() # init cache cache = { 'use...
executor.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #################################################################### # Cyclic grid strategy based on martingale ################################################################## __author__ = "Jerry Fedorenko" __copyright__ = "Copyright © 2021 Jerry Fedorenko aka VM" __lic...
test_insert.py
import time import pdb import threading import logging import threading from multiprocessing import Pool, Process import pytest from milvus import IndexType, MetricType from utils import * dim = 128 index_file_size = 10 collection_id = "test_add" ADD_TIMEOUT = 60 tag = "1970-01-01" add_interval_time = 5 nb = 6000 c...
ssd_model.py
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
process.py
import shlex from subprocess import Popen, PIPE, TimeoutExpired from queue import Queue, Empty from threading import Thread import psutil import time from utils import Map class Process: """Allows to run processes with limits Attributes: cmd (str): Command to execute input (Optional[str]): I...
main.py
# Python 3 server example from http.server import BaseHTTPRequestHandler, HTTPServer from playsound import playsound import threading hostName = "0.0.0.0" serverPort = 8080 def sound(): playsound("sound.mp3") class MyServer(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) s...
index.py
"""Routines related to PyPI, indexes""" import sys import os import re import gzip import mimetypes import posixpath import pkg_resources import random import socket import ssl import string import zlib try: import threading except ImportError: import dummy_threading as threading from pip.log import logger f...
_cancel_many_calls_test.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
grab_shixin.py
import requests import json import redis from threading import Thread import time import os def grab_info(name, id_num): url = 'http://192.168.30.248:8081/courtshixin' data = { "serialNum": "abc", "pName": name, "CID": id_num } response = requests.post(url, json.dumps(data)).c...
keep_alive.py
#creating a web server for our bot and continuously ping this web server using uptime Robot from flask import Flask from threading import Thread #the server will run on a separate thread from our bot app = Flask('') #creating a flask app @app.route('/') def home(): return "Hello . I am alive ehehe" #displays this...
tests.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import errno import os import shutil import sys import tempfile import threading import time import unittest import warnings from datetime import datetime, timedelta from django.core.cache import cache from django.core.exceptions import SuspiciousFileOpe...
test_serialization.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...
blast_24cores.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from threading import Thread, Event import time # import threading import psutil import datetime import os import subprocess from subprocess import PIPE,Popen # sizes = [0.015625, 0.03125, 0.0625, 0.125, 0.25, 0.5] size = 0.015625 n_cores = 24 # command = "blastn -db nt ...
database_tests.py
import psycopg2 from threading import Thread def get_conn(): return psycopg2.connect( "dbname='dingo' user='postgres' host='0.0.0.0' password='rrferl' ") class Kon: def __init__(self): self.conn = get_conn() self.cur = self.conn.cursor() def __enter__(self): return self....
test_dummyaccount_demo.py
import asyncio from threading import Thread import pytest from tests.utils import ( cleanup, connect, ) from .dummy_account_node import DummyAccountNode # pylint: disable=too-many-locals def create_setup_in_new_thread_func(dummy_node): def setup_in_new_thread(): asyncio.ensure_future(dummy_nod...
automated_driving_with_fusion2_2.py
"""Defines SimpleSensorFusionControl class ---------------------------------------------------------------------------------------------------------- This file is part of Sim-ATAV project and licensed under MIT license. Copyright (c) 2018 Cumhur Erkan Tuncali, Georgios Fainekos, Danil Prokhorov, Hisahiro Ito, James Kap...
base.py
# web/ws/base.py --- Base websocket handling # # Copyright (C) 2018 Stefano Sartor - stefano.sartor@inaf.it import asyncio from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner from threading import Thread class WampBase(object): """Base class for websocket streaming""" def __init__(self, c...
__init__old.py
#!/usr/bin/env python # Han Xiao <artex.xh@gmail.com> <https://hanxiao.github.io> import sys import threading import time import uuid import warnings from collections import namedtuple from functools import wraps import numpy as np import zmq from zmq.utils import jsonapi from .protocol import * from .decentralized...
main.py
import zmq import syslog import os import io import argparse import pdb import multiprocessing as mp from multiprocessing import Queue from multiprocessing import Process, Pool from event_handler import EventHandler from config import Config from logger import MEHLogger from plugin_provider import PluginProvider cla...
server.py
# coding: utf-8 from socket import * import json import selectors import queue import threading sel = selectors.DefaultSelector() # create a selector clientsDB = {} # clients' data base msgQ = queue.Queue() # This function gets a message from the queue, decodes ...
main.py
from __future__ import print_function, division import os os.environ["OMP_NUM_THREADS"] = "1" import argparse import torch import torch.multiprocessing as mp from environment import create_env from model import A3C_MLP, A3C_CONV from train import train from test import test from shared_optim import SharedRMSprop, Share...
main.py
""" ------------------------------------------------- File Name: main.py Description : 爬虫主程序 Author : Cai Yufan date: 2019/10/14 ------------------------------------------------- Change Activity: add IP proxy module change to abuyun 每次到下一页都会改一次IP:IP更改太乱了 或者可以每隔10分钟改...
CreateAudio.py
import math import os import subprocess import time from copy import deepcopy from multiprocessing import Process from osr2mp4.Exceptions import AudioNotFound from osr2mp4.osrparse.enums import Mod from recordclass import recordclass from scipy.io.wavfile import write import numpy as np from pydub import AudioSegment f...
serviceManager.py
# Copyright (C) 2015-2021 Regents of the University of California # # 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...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # 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 ...
rpc_methods.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Defines the task RPC methods.""" import logging import os import sys import threading #pylint: disable=relative-import import common_lib import process ...
routes.py
# Copyright (c) 2020 The Blocknet developers # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. import json import logging import os import threading import requests from flask import Blueprint, Response, g, jsonify, request from re...
interactive.py
# Copyright (C) 2003-2007 Robey Pointer <robey@lag.net> # # This file is part of paramiko. # # Paramiko is free software; you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 2.1 of the License, or (at y...
test_state_context.py
"""Tests the substate_context Written by Peter Duerr """ from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import import unittest import threading import multiprocessing from six import StringIO from pyexperiment import state...
dispatch.py
""" File : dispatch.py Author : ian Created : 04-21-2017 Last Modified By : ian Last Modified On : 04-21-2017 *********************************************************************** The MIT License (MIT) Copyright © 2017 Ian Cooper <ian_hammond_cooper@yahoo.co.uk> Permission is hereby g...
hdvMissingItems.py
print('Importing sources ...') from .pricesListing import kamasToString, craftPrice from pyasn1.type.univ import Boolean from sniffer import protocol import time, datetime from colorama import Fore import gspread from oauth2client.service_account import ServiceAccountCredentials from sources.item import gameI...
callback.py
from utlis.rank import setrank,isrank,remrank,remsudos,setsudo,GPranks,IDrank from utlis.send import send_msg, BYusers, Sendto, fwdto,Name,Glang,getAge from utlis.locks import st,getOR,Clang,st_res from utlis.tg import Bot from config import * from pyrogram import ReplyKeyboardMarkup, InlineKeyboardMarkup, Inlin...
sentry.py
from multiprocessing import Process from threading import Thread import subprocess, shlex import yaml, json import sys, time, os, datetime LOGFILE = 'status.csv' class StatusNode(object): def __init__(self, node): if isinstance(node, HostNode): self.id = node.hostname+':' + node.ip self.name = node.hostname ...
example3.py
# ch05/example3.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://httpsta...
process_wrapper.py
import time from multiprocessing import Process, Queue, Event from sensors.sensor import Sensor def _inner_read(inner, read_queue, stop_event): inner.__enter__() while not stop_event.is_set(): buffer = inner.read() read_queue.put_nowait(buffer) time.sleep(0.1) inner.__exit__(None,...
Servidor.py
# coding: utf-8 # In[ ]: # -*- coding: utf-8 -*- import socket import os import datetime as dt import threading as th import sys def requestMessage (con,cliente,extensionDict,shareFolder): print ("aguardando mensagem") mensagem = con.recv(1048576).decode('utf-8') msg = mensagem.split("\n"...
nbsp.py
# _*_ coding:UTF-8 _*_ import time from threading import Thread, Event from six.moves import queue from .logger import get_logger LOGGING = get_logger(__name__) class NonBlockingStreamReader: def __init__(self, stream, raise_EOF=False, print_output=True, print_new_line=True, name=None): ''' strea...
diffido.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Diffido - because the F5 key is a terrible thing to waste. Copyright 2018 Davide Alberani <da@erlug.linux.it> 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 ...
jabberChat.py
#!/usr/bin/python """ __version__ = "$Revision: 1.34 $" __date__ = "$Date: 2005/12/13 11:13:23 $" """ from PythonCard import configuration, model, sound, timer import threading import Queue import ConfigParser import wx import os import jabber import time import shutil from chatWindow import ChatWindow from groupC...
influence.py
import networkx as nx import numpy as np from icm import sample_live_icm, indicator, make_multilinear_objective_samples from utils import greedy from multiprocessing import Process, Manager PROP_PROBAB = 0.1 BUDGET = 10 PROCESSORS = 8 SAMPLES = 100 def multi_to_set(f,g): ''' Takes as input a function defined ...
object_detections_EAM.py
import cv2 import socket import struct import threading import json import time #import netifaces as ni import numpy as np import os from utils.eucl_tracker import EuclideanDistTracker from modules.detector.predictor import COCODemo from kafka import KafkaProducer from utils.objects import Person from utils.functions...
jetson_infer_op.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 appli...
__init__.py
""" Create ssh executor system """ import base64 import binascii import copy import datetime import getpass import hashlib import logging import multiprocessing import os import queue import re import subprocess import sys import tarfile import tempfile import time import uuid import salt.client.ssh.shell import salt...
thunk.py
# py->binary (.so/.dylib/.dll) thunk # # this is separate from __init__.py to allow testing without Binary Ninja import os import binascii import platform import threading import ctypes def doit_worker(dll, shellcode): dynamic_type = {'Darwin':'dylib', 'Windows':'dll', 'Linux':'so'}[platform.system()] ccp = ctypes...
mb2mqtt.py
from pyModbusTCP.client import ModbusClient import paho.mqtt.client as mqtt from time import sleep from threading import Thread import sys class ClienteMODBUS(): """ Classe Cliente MODBUS """ def __init__(self,server_addr,porta,device_id,broker_addr,broker_port,scan_time=0.2): """ Con...
etcd_rendezvous.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import json import logging import sys import threading import tim...
different.py
import numpy as np from scipy.special import gamma, digamma import numpy.linalg as la from scipy import stats import multiprocessing as mp from multiprocessing.managers import BaseManager, SyncManager import itertools import signal def entropy(X, method='auto', **kwargs): if method == 'auto': d = X.shap...
test_host_connection_pool.py
# Copyright DataStax, 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, softwa...
curses_menu.py
import curses import os import platform import threading class CursesMenu(object): """ A class that displays a menu and allows the user to select an option :cvar CursesMenu cls.currently_active_menu: Class variable that holds the currently active menu or None if no menu\ is currently active (E.G. whe...
process_replay.py
#!/usr/bin/env python3 import importlib import os import sys import threading import time import signal from collections import namedtuple import capnp from tqdm import tqdm import cereal.messaging as messaging from cereal import car, log from cereal.services import service_list from common.params import Params from ...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from collections import OrderedDict import os import pickle import random import re import subprocess import sys import textwrap import threading import time import unitt...
simulator.py
# # Copyright 2016 Mirantis, 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,...
offline.py
import os import eel from pygame import mixer from mutagen.mp3 import MP3 import threading os.system('cls') print('') print(r'example:- C:\Users\Admin\Desktop\music') dir = input('ENTER YOUR MUSIC DIRECTORY (leave empty to load default directory) \n\n=>') print('') if dir == '': with open('config.txt')...
conftest.py
from __future__ import absolute_import import os import signal import pytest import time import django_rq from celery.signals import worker_ready from django.core.cache import cache from .celery import celery CELERY_WORKER_READY = list() @worker_ready.connect def on_worker_ready(**kwargs): """Called when the...
test_process.py
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
app.py
import tkinter from tkinter import ttk import tkinter.scrolledtext as tst import json import re import time from new_product import new_product_alarm as Alarm import threading import queue import smtplib from email.mime.text import MIMEText from email.utils import formataddr from contextlib import contextmanager notice...
prefork.py
import multiprocessing import select from typing import Dict from qactuar import ASGIApp, Config from qactuar.processes.prefork import make_child from qactuar.servers.base import BaseQactuarServer class PreForkServer(BaseQactuarServer): def __init__( self, host: str = None, port: int = No...
manager.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 clowwindy # # 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 b...
learn_shared_memory.py
import logging import multiprocessing import time logging.basicConfig( level=logging.DEBUG, format='%(processName)s: %(message)s' ) def f(num, arr): logging.debug(num) num.value += 1.0 for i in range(len(arr)): arr[i] *= 2 if __name__ == "__main__": num = multiprocessing.Value('f',...