source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
miniterm.py | #!/usr/bin/python
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
import threading
import serial
from serial.tools.list_ports import c... |
test_discovery.py | import asyncio
from http.server import HTTPServer, SimpleHTTPRequestHandler
import logging
import os
import shutil
import threading
from datamart_core import Discoverer
from datamart_core.common import setup_logging
logger = logging.getLogger(__name__)
class TestDiscoverer(Discoverer):
"""Discovery plugin for ... |
monitoring-report.py | #!/usr/bin/python3
from multiprocessing import Process
import subprocess as sp
import socket
import sys
import argparse
import os
import pwd
import grp
nscaConfig = ""
sendNscaPath = "/usr/sbin/send_nsca"
def dropPivileges(uid_name, gid_name=None):
if not gid_name:
gid_name = "nogroup"
target_ui... |
callbacks.py | """Camera callbacks module."""
import logging
from threading import Thread
from telegram.ext import run_async
from hikcamerabot.constants import Detections, Streams, Alarms, Events
from hikcamerabot.decorators import authorization_check, camera_selection
from hikcamerabot.utils import (build_commands_presentation, m... |
open_url.py | # Open URL opens selected URLs, files, folders, or looks up text in web searcher
import sublime
import sublime_plugin
import webbrowser
import threading
import os
import subprocess
import platform
from urllib.parse import urlparse
from urllib.parse import quote
from .url import is_url
def prepend_scheme(s):
o = ur... |
extension_manager.py | # Copyright 2011 OpenStack Foundation.
# 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 req... |
server.py | import sys
import os
import socket
import time
import base64
import tabulate
import signal
import subprocess
import argparse
import shutil
import threading
import platform
import PyInstaller.__main__
from datetime import datetime
__LOGO__ = """
▒█░░▒█ ░▀░ █▀▀▄ ▒█▀▀█ ░█▀▀█ ▀▀█▀▀
▒█▒█▒█ ▀█▀ █░░█ ▒█▄▄▀ ▒█▄▄█ ░▒█░░
▒█▄... |
__init__.py | from __future__ import print_function
import argparse
import itertools
import os
import random
import re
import shlex
import string
import sys
import traceback
import warnings
from collections import OrderedDict
from fnmatch import fnmatchcase
from subprocess import list2cmdline
from threading import Thread
import pl... |
usb4vc_uart.py | import os
import sys
import time
import serial
import subprocess
import base64
import threading
import usb4vc_shared
# import usb4vc_usb_scan
# import usb4vc_ui
ser = None
try:
ser = serial.Serial('/dev/serial0', 115200)
except Exception as e:
print("SERIAL OPEN EXCEPTION:", e)
def uart_worker():
if ser ... |
views.py | from flask import request
from flask_cors import CORS, cross_origin
from datetime import datetime, timezone
from functools import wraps
import threading, json, time
from googletrans import Translator
from AuthModule.authhandler import authProvider
from SearchModule import app
from SearchModule.TextSearchModule import ... |
app.py | import os
import yaml
import time
import requests
import queue
import errno
import threading
import multiprocessing as mp
from flask import Flask
from flask import request, jsonify
import tensorflow as tf
import tensorflow_datasets as tfds
CLSAPP = "app:18080"
running = True
MAX_CONCURRENT = 4
app = Flask(__name__... |
server.py | # The MIT License (MIT)
# Copyright (c) 2019 Shubhadeep Banerjee
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... |
threadhandler.py | from time import sleep
import read_mindwave_mobile
from threading import Thread
class data :
Delta = []
Theta = []
LowAlpha = []
HighAlpha = []
LowBeta = []
HighBeta = []
LowGamma = []
MedGamma = []
AttentionLevel = []
MeditationLevel = []
def startallfunc() :
... |
interface_statistics_monitor.py | from common_tasks import Grab_device_interfaces_snmp, get_data, set_data_mysql, device_config_info_lookup, print_error
from SNMPPoll import SnmpPoll as snmppoll
from datetime import datetime
from int_down import process_down
from threading import Thread
from deprefer_automation import add_cost_workflow
import time
impo... |
test_lock.py | from unittest import TestCase
import time
import threading
from dogpile import Lock, NeedRegenerationException
from dogpile.util import ReadWriteMutex
import contextlib
import math
import logging
import mock
log = logging.getLogger(__name__)
class ConcurrencyTest(TestCase):
# expiretime, time to create, num usage... |
test_backfill_job.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... |
test_s3boto3.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gzip
import threading
from datetime import datetime
from unittest import skipIf
from botocore.exceptions import ClientError
from django.conf import settings
from django.core.files.base import ContentFile
from django.test import TestCase
from djang... |
algorithm_bayesopt.py | from .problem import Problem
from .algorithm import Algorithm
from .config import artap_root
import time
import numpy as np
import os
import sys
sys.path.append(artap_root + os.sep + "lib" + os.sep)
import bayesopt
from multiprocessing import Process, Pipe, Queue, Manager
# from multiprocessing.managers import Base... |
oz_cs_gui.py | """
GUI Version of Oz_comic_search
SCRIPT TO SEARCH ALL AUSTRALIAN COMIC BOOK SHOPS with online stores
Simply input search terms and get Title | Price | Link for all shops
"""
from tkinter import * # FOR GUI
from tkinter import ttk
from PIL import ImageTk,Image
#MULTITHREADING
from threading import Thread
#ALL SEA... |
test_build_alignments.py | #!/usr/bin/env python
"""Test trainModels.py"""
########################################################################
# File: test_trainModels.py
# executable: test_trainModels.py
#
# Author: Andrew Bailey
# History: 5/21/18 Created
########################################################################
import u... |
main.py | #!/usr/bin/env python3
import logging,os,asyncio,cv2,aiojobs,aiofiles,json, threading,dotenv,argparse,aiohttp,aiohttp_session ,time,serial,serial_asyncio,binascii
from aiohttp import web, MultipartWriter
from queue import Queue
from aiohttp.web import middleware
#from objbrowser ... |
demo_cli.py | import argparse
import logging
import os
import threading
import time
import http.client
script_version = '0.11'
try:
import support_functions
import vm_functions
except ModuleNotFoundError:
print('Unable to import support_functions and/or vm_functions. Exiting.')
exit(1)
# Parse command line argumen... |
email.py | from app import mail
from flask import current_app
from flask_mail import Message
from threading import Thread
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, recipients=recipients)
msg.body = text_body
msg.html = html_body
Thread(targ... |
test_concurrent_futures.py | from test import support
# Skip tests if _multiprocessing wasn't built.
support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
support.import_module('multiprocessing.synchronize')
from test.support.script_helper import assert_python_ok
import contextlib
import itertools
import l... |
backend.py | import psutil
import threading
import subprocess
from subprocess import Popen, PIPE
def gpustats():
try:
out = subprocess.check_output(['nvidia-smi', '--display=MEMORY', '-q']).decode('utf-8').split('\n')[8:]
except Exception as e:
raise Exception('nvidia-smi command not found.')
total = in... |
vehicle.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 10:44:24 2017
@author: wroscoe
"""
import time
from threading import Thread
from .memory import Memory
class Vehicle():
def __init__(self, mem=None):
if not mem:
mem = Memory()
self.mem = mem
self.parts... |
runtime_test.py | #!/usr/bin/python
import sys
import os
import threading
from threading import Thread
import time
import signal
import subprocess
airsimprocess = subprocess.Popen(["/home/nvagent/Blocks/Blocks.sh"])
exit_flag = False
def exit_properly_runtime_test():
global exit_flag
print("CREATING SUCCESS RESULT FILE... |
deccheck.py | #
# Copyright (c) 2008-2012 Stefan Krah. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions ... |
protocol_tcp.py | #!/usr/bin/env python3
#-*- coding: iso-8859-1 -*-
################################################################################
#
# This module contains an implementation of a generic TCP-based request-response
# interface, it is used internally as a base for the specific application-level
# protocol interfaces, su... |
remote_access.py | """
* Implementation of remote access
Use https://github.com/wang0618/localshare service by running a ssh subprocess in PyWebIO application.
The stdout of ssh process is the connection info.
"""
import json
import logging
import os
import threading
import time
import shlex
from subprocess import Popen, PIPE
import sh... |
server1.py | import socket
import threading
import random
HEADER = 64
PORT = 65432
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = '!DISCONNECT'
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server.bind(ADDR)
def handle_client(conn, add... |
mcapi.py | # /bin/python
# -*- coding: utf-8 -*-
# from __future__ import absolute_import, division, print_function, unicode_literals
# Doesn't work with Jython, with not much hope of improving
# See https://bugs.jython.org/issue2007
print ('MCAPI activating')
# Set default encoding to utf-8
if os.name == 'java':
from org.p... |
tello.py | """Library for interacting with DJI Ryze Tello drones.
"""
# coding=utf-8
import logging
import socket
import time
from threading import Lock, Thread
from typing import Optional, Union, Type, Dict
from cv2 import add
from rospy import sleep
from .enforce_types import enforce_types
import av
import cv2 as cv
import... |
kiosk.py | """
Project: SSITH CyberPhysical Demonstrator
director.py
Author: Ethan Lew <elew@galois.com>
Date: 06/09/2021
Python 3.8.3
O/S: Windows 10
Kiosk State Machine
Hacker Kiosk backend
Exchange format:
{
func: "name-of-the-function-to-be-called",
args: {"dictionary of arguments}
resp: {"dictionary of return v... |
app_support_funcs.py | import bisect
import contextlib
import csv
from datetime import datetime
import functools
import json
import logging
import random
import threading
import time
import unittest
import uuid
import redis
def to_bytes(x):
return x.encode() if isinstance(x, str) else x
def to_str(x):
return x.decode() if isinst... |
monitor.py | #!/usr/bin/env python
import datetime
import dateutil.parser
import http.server
import json
import logging
import os
import threading
import time
import urllib.parse
import pika
import psycopg2
import requests
# parameters to connect to RabbitMQ
rabbitmq_uri = os.getenv('RABBITMQ_URI', 'amqp://guest:guest@localhost/... |
train_ac_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
im... |
download.py | """
TODO: handle parallel downloads
"""
import os
import urlparse
import threading
from Queue import Queue, Empty
import subprocess
from malleefowl import config
from malleefowl.utils import esgf_archive_path
from malleefowl.exceptions import ProcessFailed
import logging
LOGGER = logging.getLogger("PYWPS")
def dow... |
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 - ... |
views.py | from django.http import Http404, JsonResponse
from django.shortcuts import render
from chatbot.chatbot import create_chatbot
import threading
import pickle
import collections
from io import BytesIO
import numpy as np
import urllib.request
import json
import wave
import librosa
import pandas as pd
from homepage.models i... |
drumMachineWithSequences.py | #!/usr/bin/env python
# -o--
"""
drumMachineWithSequences.py
Demo how OSC can manage sound objects defined by RTcmix.
Event loop manages threads for sending MIDI sequences and other data
via OSC paths. One thread to track the others and post state to
stdout.
"""
vers... |
controller.py | """
Fall 2017 CSc 690
File: controller.py
Author: Steve Pedersen & Andrew Lesondak
System: OS X
Date: 12/13/2017
Usage: python3 spotify_infosuite.py
Dependencies: model, musikki, playback, reviews, view, requests, urllib, unidecode, pyqt5
Description: Controller class. Used to generate window frames and handle events,... |
walk_to_dfxml.py | #!/usr/bin/env python3
# This software was developed at the National Institute of Standards
# and Technology in whole or in part by employees of the Federal
# Government in the course of their official duties. Pursuant to
# title 17 Section 105 of the United States Code portions of this
# software authored by NIST emp... |
onstart.py | """
plugin_loaded: Run own operations on Sublime Load.
"""
import sublime
import threading
def my_func():
"""Can run any function on Sublime start and make any initial actions"""
sublime.status_message('Sublime started...')
def plugin_loaded():
t = threading.Thread(target=my_func)
t.daemon = True
... |
tools.py | import json
import socket
import threading
from itertools import chain
try: # Python 3
from queue import Queue
except: # Python 2
from Queue import Queue
class Scanner(object):
q = Queue()
storage = []
def __init__(self, target, threads, known, rang, inp, out):
self.target = target... |
ranger.py | #!/usr/bin/env python
'''
Libraries
'''
import base64, sys, argparse, re, subprocess, os, time, logging, signal, urllib2, cmd, ntpath, string, random, ConfigParser, hashlib, traceback, tempfile, collections
import xml.etree.ElementTree as etree
from threading import Thread, Lock, Event
from Queue import Queue
from stru... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
|
exo2.py | #!/usr/bin/env python3
"""
An exemple of shared memory between processes
"""
from multiprocessing import Process, Manager
from sys import argv
def producer(number, fib_list):
"""
Returns the #num fibonacci number using recursion
:param number: current number
:param fib_list: pointer to shared list o... |
server.py | import rpyc
import os
import time
from threading import Thread
class FileMonitorService(rpyc.Service):
class exposed_FileMonitor(object):
def __init__(self, filename, callback, interval = 1):
self.filename = filename
self.interval = interval
self.last_stat = None
... |
bridge.py | #
# Copyright 2013 CarbonBlack, Inc
#
import os
import sys
import time
from time import gmtime, strftime
import logging
from logging.handlers import RotatingFileHandler
import threading
import version
import cbint.utils.json
import cbint.utils.feed
import cbint.utils.flaskfeed
import cbint.utils.cbserver
import cbint... |
app_utils.py | # App Utils
import struct
import six
import collections
import cv2
import datetime
from threading import Thread
from matplotlib import colors
class FPS:
def __init__(self):
# Armazena a hora de início, o tempo de término e o número total de frames que foram examinados entre os intervalos de início e fina... |
sendalerts.py | from datetime import timedelta as td
import time
import requests
from django.db.models import F, Max
from threading import Thread
from django.core.management.base import BaseCommand
from django.utils import timezone
from hc.api.models import Check, Flip
from statsd.defaults.env import statsd
SENDING_TMPL = "Sending a... |
feature_shutdown.py | #!/usr/bin/env python3
# Copyright (c) 2018-2020 The Askalcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test askalcoind shutdown."""
from test_framework.test_framework import AskalcoinTestFramework
from t... |
utils.py | """NDG OAuth Paste utilities for example code
"""
__author__ = "P J Kershaw"
__date__ = "19/10/12"
__copyright__ = "(C) 2009 Science and Technology Facilities Council"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revision__ = "$Id:$"
from os import path
from threading import Thread
import optparse
from OpenSSL import ... |
netw.py | import json
import socket as st
import threading as thr
import tkinter as tk
from datetime import datetime
from dataclasses import dataclass
class MessengerSocket(st.socket):
def __init__(self, family=st.AF_INET, type=st.SOCK_DGRAM):
super(MessengerSocket, self).__init__(family, type)
def startlistening... |
Pushover.py | """
Notification Pushover Node
TODO:
- Make sure pushover name is get_valid_node_name, and Length
- Clean out profile directory?
- Make list of sounds
- Allow groups of devices in configuration
"""
from udi_interface import Node,LOGGER
from threading import Thread,Event
import time
impo... |
gui.py | import tomo
import numpy as np
from threading import Thread
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk)
from matplotlib.backend_bases import key_press_handler
import matplotlib.animation as animation
from matplotlib import style
from mpl_tool... |
main.py | from flask import Flask, jsonify
from flask_restful import Resource, Api
from driver_to_db import *
import json
import schedule
from threading import Thread
app = Flask(__name__)
api = Api(app)
class Verses(Resource):
def get(self):
result = get_verse_of_today()
return result
class Longest(Reso... |
executor.py | from concurrent.futures import _base
from multiprocessing import connection
import cPickle as pickle
import os
import select
import subprocess
import threading
import time
from .utils import debug
from . import utils
from .future import Future
class HostShutdown(RuntimeError):
pass
class DependencyFailed(Runtim... |
client.py | #!/usr/bin/env python3
# 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 json
import websocket
import threading
from parlai.core.params import ParlaiParser
from parlai.scripts.... |
installwizard.py | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import os
import sys
import threading
import traceback
from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CHECKING
from ... |
test_multiprocessing.py | #!/usr/bin/env python
#
# Unit tests for the multiprocessing package
#
import unittest
import threading
import Queue
import time
import sys
import os
import gc
import signal
import array
import copy
import socket
import random
import logging
# Work around broken sem_open implementations
try:
import multiprocess... |
simulation1.py | """
Simulate large amount of games with hunt/target and random AI, multithreaded.
"""
from core import player, hunt_ai, random_ai, field_utils
from multiprocessing import Queue, Process
import sys
def hunt_child(name, q, samples, parameters):
"""
thread for running target/hunt AI simulations
"""
prin... |
test_misc.py | import unittest
import os, os.path, threading, time
from whoosh.filedb.filestore import FileStorage
from whoosh.support.filelock import try_for
class TestMisc(unittest.TestCase):
def make_dir(self, name):
if not os.path.exists(name):
os.mkdir(name)
def destroy_dir(self, name):
... |
__main__.py | from src.config.config import QUEUE_HUMIDITY_NAME, QUEUE_LIGHT_NAME, QUEUE_TEMPERATURE_NAME
from src.measures.humidity import Humidity
from src.measures.light import Light
from src.measures.temperature import Temperature
from src.queue.queue import Queue
from threading import Thread
controllers = [
Humidity(QUEUE_... |
shcommon.py | # -*- coding: utf-8 -*-
"""
The Control, Escape and Graphics are taken from pyte (https://github.com/selectel/pyte)
"""
import os
import sys
import platform
import functools
import threading
import ctypes
from itertools import chain
import six
IN_PYTHONISTA = sys.executable.find('Pythonista') >= 0
if IN_PYTHONISTA:... |
gextension.py | import socket
import sys
import threading
from enum import Enum
from .hpacket import HPacket
from .hmessage import HMessage, Direction
import json
MINIMUM_GEARTH_VERSION = "1.4.1"
class INCOMING_MESSAGES(Enum):
ON_DOUBLE_CLICK = 1
INFO_REQUEST = 2
PACKET_INTERCEPT = 3
FLAGS_CHECK = 4
CONNECTION_S... |
node_registry_test.py | # Copyright 2021 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 required by applicable law or a... |
VLAN Changer Git.py | #!/usr/bin/python3.6
from __future__ import print_function
from googleapiclient.discovery import build
from googleapiclient import errors
from httplib2 import Http
from oauth2client import file, client, tools
from pytz import timezone
from datetime import datetime
from re import match
from netmiko import ConnectHandler... |
bcontrol.py | #!/usr/bin/python
# MIT License
# Copyright (c) 2018 Martin Klingensmith
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to u... |
tpu_estimator.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
test_redundant_router.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... |
random_job3_saves.py | import task_submit
from task_submit import VGGTask,RESTask,RETask,DENTask,XCETask
import random
import kubernetes
import influxdb
import kubernetes
import yaml
import requests
from multiprocessing import Process
import multiprocessing
import urllib
import urllib3
import time
import numpy as np
np.set_printoptions(suppr... |
semiActiveServer.py | from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import subprocess
from time import sleep
import smbus
import time
# for RPI version 1, use "bus = smbus.SMBus(0)"
bus = smbus.SMBus(1)
def acceptConnections():
while True:
client, client_address = SERVER.accept()
print(... |
threading_daemon_join_timeout.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s')
def daemon():
logging.debug('Starting')
time.sleep(2)
logging.debug('Exiting')
def non_daemon():
logging.... |
cli.py | # -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: 2010 Pallets
:license: BSD-3-Clause
"""
from __future__ import print_function
import ast
import inspect
import os
import platform
import re
import sys
import traceback
from functools i... |
ram_usage.py | ################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... |
camera_2.py | #!/usr/bin/env python3
from flask import Flask, send_file
from PIL import Image
import RPi.GPIO as GPIO
from time import sleep
from picamera import PiCamera
from queue import Queue
from threading import Thread
import requests
from time import time
from io import BytesIO
LED_PIN = 16 # Broadcom pin 23 (P1 pin 16)
qu... |
LogAnalyzeLogs.py | import threading
import re
import datetime
import LogAnalyzeDBOps as db
import Messages as MSG
import datetime
logonID = '0x785E60E' # Admin actions
linkedLogonID = '0x78B8C4B' # Other actions
# logonID = '0x78B8C68' # Admin actions
# linkedLogonID = '0x78B8C4B' # Other actions
# logonID = '0x1E6C1F95' # Admin actio... |
byteps-tmplauncher.py | #!/usr/bin/python
from __future__ import print_function
import os
import subprocess
import threading
import sys
import time
COMMON_REQUIRED_ENVS = ["DMLC_ROLE", "DMLC_NUM_WORKER", "DMLC_NUM_SERVER",
"DMLC_PS_ROOT_URI", "DMLC_PS_ROOT_PORT"]
WORKER_REQUIRED_ENVS = ["DMLC_WORKER_ID"]
def check_e... |
sandhyakal.py | '''
Description : Multithreading
Function Date : 14 Mar 2021
Function Author : Prasad Dangare
Input : Int
Output : Int
'''
import os
import threading
from time import sleep
def Thread1(no):
print("Thread1 is created")
print("PID of Thread1 is : ",os.getpid())... |
partial_dataset.py | """
Tool for using a dataset which will not fit in memory with neural networks
"""
import math
import queue
import threading
import torch
import time
from torch.utils import data as torch_data
from typing import Callable, List, Iterator, Union
from ...core.communication import MPICommunication
from ...core.communica... |
Video.py | # -*- coding: utf-8 -*-
# Copyright 2018-2019 oscillo
#
# Permission is hereby granted, free of charge,
# to any person obtaining a copy of this software
# and associated documentation files (the "Software"),
# to deal in the Software without restriction,
# including without limitation the rights to use,
# copy, mo... |
corrector_batch.py | import multiprocessing
import queue
import time
import traceback
from . import database_manager
from . import document_manager
from .corrector_worker import CorrectorWorker
from .logger_manager import LoggerManager
class CorrectorBatch:
def __init__(self, settings):
self.settings = settings
def run(... |
vegaops2n9e.py | # -*- coding: UTF-8 -*-
import json
import logging
import os
import re
import requests
import schedule
import sys
import threading
import time
import yaml
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('VegaOps2N9e')
reload(sys)
sys.setdefaultencoding('utf8')
def _push_metrics(cfg, metrics):
... |
demo6.py | """
【多线程】Queue线程安全队列讲解 2019/11/05 22:17
"""
# TODO: Queue线程安全队列
"""
在线程中,访问一些全局变量,加锁是一个经常的过程。如果你是想把一些数据存储到某个队列中,
那么Python内置了一个线程安全的模块叫做queue模块。Python中的queue模块中提供了同步的、
线程安全的队列类,包括FIFO(先进先出)队列Queue,LIFO(后入先出)队列LifoQueue。
这些队列都实现了锁原语(可以理解为原子操作,即要么不做,要么都做完),能够在多线程中直接使用。
可以使用队列来实现线程间的同步。
相关函数如下:
1.初始化Queue(num):创建一个先进先出num... |
test_orm_symbols_facts.py | #------------------------------------------------------------------------------
# Unit tests for Clorm ORM SymbolPredicateUnifer and unify function.
#
# Note: I'm trying to clearly separate tests of the official Clorm API from
# tests of the internal implementation. Tests for the API have names
# "test_api_XXX" while n... |
test_runtime_rpc.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... |
main.py | from threading import Thread
from uvicorn import run
from web.app import app
from view.App import App
from ws.ws import Client
t = Thread(target=run, args=(app,), kwargs={
"port": 3000
}).start()
App().run()
# Client(lambda x: print(f"Token: {x}")).run_sync()
|
compound.py | #!/usr/bin/env python3
"""Cyberjunky's 3Commas bot helpers."""
import argparse
import configparser
import json
import logging
import os
import queue
import sqlite3
import sys
import threading
import time
from logging.handlers import TimedRotatingFileHandler as _TimedRotatingFileHandler
from pathlib import Path
import ... |
proxy.py | # -*- coding: utf-8 -*-
#
# Proxy minion metaproxy modules
#
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import os
import signal
import sys
import types
import logging
import threading
import traceback
# Import Salt Libs
# pylint: disable=3rd-party-module-not-gated
import s... |
test_kill_rgw_process.py | import os
import sys
import threading
sys.path.append(os.path.abspath(os.path.join(__file__, "../../../..")))
import argparse
import v1.lib.s3.rgw as rgw
from .initialize import PrepNFSGanesha
import time
import v1.utils.log as log
from v1.lib.s3.rgw import ObjectOps, Authenticate
from v1.utils.test_desc import AddTes... |
send.py | from ast import arg
import twilio_mod.env as my_environ
from twilio.rest import Client
from twilio_mod.Threat import Threat
import twilio_mod.upload_file as my_uploader
import threading
class send:
def __init__(self):
self.account_sid = my_environ.env_keys['TWILIO_ACCOUNT_SID']
self.auth_token =... |
intellisence.py | # -*- coding: utf-8 -*-
from noval import _,GetApp
import noval.util.appdirs as appdirs
import noval.python.interpreter.interpreter as pythoninterpreter
import noval.python.interpreter.interpretermanager as interpretermanager
import subprocess
import noval.util.apputils as apputils
from noval.util import singlet... |
threadpool.py | """
threadpool.py
Copyright 2006 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of the License.
w3af is distributed in the hope that ... |
materialize_with_ddl.py | import time
import pymysql.cursors
import pytest
from helpers.network import PartitionManager
import logging
from helpers.client import QueryRuntimeException
from helpers.cluster import get_docker_compose_path, run_and_check
import random
import threading
from multiprocessing.dummy import Pool
from helpers.test_tools... |
checker.py | import re
import googlesearch
import threading
import time
from PlagiarismChecker.similarity import bagOfWordsSim, substringMatching
def createQueries(text, n_grams=False):
"""Processes the input text and generates queries that will be Googled.
Parameters
----------
text: str
The input text t... |
client.py | #!/usr/bin/env python
'''
Machine tracker client. Connects to server and sends
coordinates
'''
import networking as nt
import socket
import threading
import time
import logging
def get_new_data():
return nt.get_ip_address(nt.interface) + ' time is ' + str(time.time())
def discover_server(client_port, g... |
test_s3.py | import multiprocessing as mp
import os
import pickle
import tempfile
import pytest
from moto import mock_s3
from pfio.v2 import S3, from_url, open_url
from pfio.v2.fs import ForkedError
@mock_s3
def test_s3():
bucket = "test-dummy-bucket"
key = "it's me!deadbeef"
secret = "asedf;lkjdf;a'lksjd"
with ... |
make.py | import os
import glob
import time
import shutil
import bpy
import json
import stat
from bpy.props import *
import subprocess
import threading
import webbrowser
import arm.utils
import arm.write_data as write_data
import arm.make_logic as make_logic
import arm.make_renderpath as make_renderpath
import arm.make_world as ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.