source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
vehicle.py | from .agent import *
from .record import Record
from time import time
from datetime import datetime
import os
PAR = True
#Output
base_dir = './output'
#Storage Memory Parameter, forget vehicle if not seen > STORAGE_MEMORY
STORAGE_MEMORY = 8
#Car x1y1 Distance Parameter
DISTANCE_THRESHOLD = 10
#Feature Matching Pa... |
soldat.py | import struct
import sys
import signal
import subprocess
import SocketServer
import ConfigParser
from threading import Thread
from StringIO import StringIO
def read_gamestat():
with open('logs/gamestat.txt') as fp:
log = fp.read().splitlines()
logdata = {}
logdata['numplayers'] = int(log[1]... |
locators.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
import threading
import zlib
from . ... |
util.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# 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 t... |
feeder.py | import json
import math
import os.path
import sys
import threading
import time
import RPi.GPIO as GPIO
from gpiozero import MCP3008
from enum import Enum
# Constants
PWM_FREQUENCY = 50
FLIPS = 6
ANTI_FLIP_MAX = 0.88
ANTI_FLIP_TIME = 0.33
CLOCK_FLIP_MAX = 0.8
CLOCK_FLIP_TIME = 0.3
WIGGLES = 6
ANTI_WIGGLE_TIME = 0.3 #... |
benchmark_send_get_multiprocess_test.py | # stdlib
import socket
import time
from typing import Any
from typing import List
# syft absolute
from syft.lib.python import List as SyList
from syft.lib.python.string import String
# relative
from ...syft.grid.duet.process_test import SyftTestProcess
def do_send(data: Any, port: int) -> None:
# syft absolute
... |
modi2_firmware_updater.py | import io
import os
import pathlib
import sys
import threading as th
import time
import traceback as tb
from PyQt5 import QtGui, QtWidgets, uic
from PyQt5.QtCore import QObject, Qt, pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import QDialog, QMessageBox
from modi2_firmware_updater.core.esp32_updater import ESP32Firmwar... |
parallel_runner.py | from envs import REGISTRY as env_REGISTRY
from functools import partial
from components.episode_buffer import EpisodeBatch
from multiprocessing import Pipe, Process
import numpy as np
import torch as th
# Based (very) heavily on SubprocVecEnv from OpenAI Baselines
# https://github.com/openai/baselines/blob/master/bas... |
sdk_worker_main.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 us... |
utils_test.py | import asyncio
import collections
import copy
import functools
import gc
import inspect
import io
import itertools
import logging
import logging.config
import os
import queue
import re
import shutil
import signal
import socket
import subprocess
import sys
import tempfile
import threading
import uuid
import warnings
imp... |
client.py | import socket,threading
# Choosing Nickname
nickname = input("Choose your nickname: ")
# Connecting To Server
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 55555))
# Listening to Server and Sending Nickname
def receive():
while True:
try:
... |
npp_dragonfly.py | import subprocess;
import threading;
from threading import Thread;
import time;
import sys;
import os;
import re;
import jellyfish;
import lxml;
from lxml import etree;
import sqlite3;
import traceback;
import socket
from fuzzy_string_comparison import get_closest_match;
import win32clipboard;
... |
fctthread.py | """Control methods in separate threads."""
import logging
import os
import queue
import subprocess as _subp
import sys
import threading
__version__ = '0.2.10'
logger = logging.getLogger(__name__)
#-------------------------------------------------------
def _popen_ext(cmd, shell=False):
_subp.Popen(cmd, shell=shel... |
carisapi.py | import os
import sys
import time
import re
import subprocess
import datetime
import tempfile
from queue import Queue, Empty
import threading
import xml.etree.ElementTree as ET
import json
from math import cos, sin, asin, sqrt, degrees
from collections import defaultdict
import glob
from winreg import ConnectRegistry, H... |
Server.py | # Copyright (c) 2019 Grzegorz Raczek
# https://github.com/grzracz
# Files available under MIT license
from queue import Queue
import pygame
import socket
import threading
import time
import random
import sys
import winsound
host = "192.168.137.1"
port = 10000
class Server:
def __init__(self, host_addr, po... |
test_logging.py | # Copyright 2001-2014 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, oraz distribute this software oraz its
# documentation dla any purpose oraz without fee jest hereby granted,
# provided that the above copyright notice appear w all copies oraz that
# both that copyright notice oraz this per... |
apps.py | import os
from datetime import timedelta, datetime
from threading import Thread
import akshare as ak
from django.apps import AppConfig
from timeloop import Timeloop
from analysis.conf.yconfig import YConfig
from analysis.core.service.fund import fetch_fund_data, init_data
from analysis.core.service.pattern import ge... |
parallelize.py | import multiprocessing
def fun(f, q_in, q_out):
"""
A helper function for the parmap function.
Parameters
----------
f : function
Function to be evaluated using arguments in the queue q_in.
q_in : multiprocessing Queue object
A queue for the input arguments.
q_out : multipr... |
init.py | # -*- coding: utf-8 -*-
# Written by: SantaSpeen
# (c) SantaSpeen 2022
import os
import sys
from threading import Thread
from .Console import Console
from .Store import Store
from . import tools
c: Console = None
s: Store = None
def start_console():
global c, s
c.builtins_hook()
c.logger_hook()
th ... |
kernel.py | from __future__ import print_function
from ipykernel.kernelbase import Kernel
from ipykernel.comm import CommManager
from ipykernel.zmqshell import ZMQInteractiveShell
from IPython.core.display_trap import DisplayTrap
from subprocess import check_output
from traitlets import Instance, Type
import pkg_resources
impo... |
master.py | #
# Copyright Cloudlab URV 2020
#
# 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 writin... |
scanner.py | import struct
import socket
import threading
import queue
import logging
from enum import Enum, auto
logger = logging.getLogger(__name__)
class PortState(Enum):
OPEN = auto()
CLOSED = auto()
FILTERED = auto()
class TCPScanner:
def __init__(self, host, ports, timeout=5):
self.host = host
... |
hello_world.py | #!/usr/bin/python
# This is Hello World with Python multithreading.
# A user defined function is created and
# the function is called when a thread is initialized.
import threading
def MyFunction():
"""This is a user defined function"""
print "Hello World"
fp = open("file.abc")
return
def Main():
"""This... |
dataloader3.py | #import ROOT,sys,time,os,signal
from larcv import larcv
import ROOT as rt
import sys,time,os,signal
import numpy as np
import threading
def threadio_func(storage, proc):
storage._threaded = True
while storage._threaded:
time.sleep(0.000005)
if storage._filled: continue
storage._read_start_time ... |
gui_main.py | import cv2
import numpy as np
import threading
import json
import random
import math
import time
import types
#import Tkinter
from Tkinter import *
import tkFileDialog
import ttk
import tkMessageBox
import tkFont
import ScrolledText
import Pmw
from PIL import Image
from PIL import ImageTk
from os import listdir, path, ... |
email.py | # -*- coding: utf-8 -*-
# @Author: chiranjeevi E
# @File Name: sendmail.py
from threading import Thread
from flask import current_app, render_template
from flask_mail import Mail, Message
def send_async_email(app, msg):
with app.app_context():
mail = Mail(app)
mail.init_app(app)
mail.send... |
ota.py | #!/usr/bin/env python
try:
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
except ImportError:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
import argparse
import json
import os
import paho.mqtt.client a... |
test_rpc.py | import os
import time
import socket
import dgl
import backend as F
import unittest, pytest
import multiprocessing as mp
from numpy.testing import assert_array_equal
from utils import reset_envs, generate_ip_config
if os.name != 'nt':
import fcntl
import struct
INTEGER = 2
STR = 'hello world!'
HELLO_SERVICE_I... |
Postings.py | from keras.preprocessing.text import Tokenizer
import ujson
import os
import time
from tqdm import tqdm
import cProfile
import copy
import gc
from multiprocessing import Pool, Manager
from threading import Thread
gc.enable()
dir = "/home/zjq/WSM/"
read_root = dir + "trials/"
write_root = dir + "postingss/"
words_path... |
Server.py | from multiprocessing import Process, Manager
import socket, logging
import typing
# This function gets executed when you run
# python Server.py and its use is to test the code
# so it will usually be empty
def main():
logging.error("Run run_server instead")
"""
The Server class is the main bu... |
imaplib2.py | #!/usr/bin/env python
"""Threaded IMAP4 client.
Based on RFC 2060 and original imaplib module.
Public classes: IMAP4
IMAP4_SSL
IMAP4_stream
Public functions: Internaldate2Time
ParseFlags
Time2Internaldate
"""
__all__ = ("IMAP4", "IMAP4_SSL"... |
test_serial_writer.py | #!/usr/bin/env python3
import logging
import os
import subprocess
import sys
import tempfile
import time
import threading
import unittest
import warnings
from os.path import dirname, realpath
sys.path.append(dirname(dirname(dirname(realpath(__file__)))))
from logger.readers.serial_reader import SerialReader # noqa: ... |
rnodeconf.py | #!python3
# MIT License
#
# Copyright (c) 2018 Mark Qvist - unsigned.io
#
# 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 us... |
tcp_server.py | ###
# TCP server use multi thread example.
#
# License - MIT.
###
import os
import time
import socket
from threading import Thread
# Thread.
def thread_function(sock, addr):
# {
sock.send(b'Connected')
while True:
data = sock.recv(1024)
if not data or 'exit' == data.decode('utf-8'):
... |
test_server.py | # -*- coding: utf-8 -*-
import pytest
import requests
import os
from rasa_nlu.server import RasaNLUServer
from rasa_nlu.config import RasaNLUConfig
from multiprocessing import Process
import time
import json
import codecs
class ResponseTest():
def __init__(self, endpoint, expected_response, payload=None):
... |
template.py | import base64
import random
# Empire imports
from lib.common import helpers
from lib.common import agents
from lib.common import encryption
from lib.common import packets
from lib.common import messages
class Listener:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Template... |
kvPeekTCP_reconn.py | # === Start Python 2/3 compatibility
from __future__ import absolute_import, division, print_function, unicode_literals
from future.builtins import * # noqa pylint: disable=W0401, W0614
from future.builtins.disabled import * # noqa pylint: disable=W0401, W0614
# === End Python 2/3 compatibility
from future import... |
test_enum.py | import enum
import inspect
import pydoc
import unittest
from collections import OrderedDict
from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
from test import support
try:
import threading
except ImportError... |
mercury.py | # coding: utf-8
import redis
import pickle
import logging
# 设置屏幕输出句柄
logger = logging.getLogger("mercury")
logger.setLevel(logging.DEBUG)
class RedisNotConnected(BaseException):
def __init__(self, host, port):
err = "Error connecting to redis {}:{}".format(host, port)
super().__init__(err)
class ... |
server.py | #Import pymodbus components
from pymodbus.server.sync import StartTcpServer, StartSerialServer
from pymodbus.device import ModbusDeviceIdentification
from pymodbus.datastore import ModbusSequentialDataBlock, ModbusSparseDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
from pymodbus.trans... |
rabbit.py | # -*- coding: utf-8 -*-
"""
Created on 21 August 2017
@author: dgrossman
"""
import logging
import threading
import time
from functools import partial
import pika
class Rabbit:
'''
Base Class for RabbitMQ
'''
def __init__(self):
self.logger = logging.getLogger('rabbit')
self.connecti... |
dashboard.py | try:
import bokeh.command.bootstrap
import bokeh.document # NOQA
import bokeh.layouts
import bokeh.models
import bokeh.models.widgets
import bokeh.plotting
import bokeh.themes
import tornado.gen
_available = True
except ImportError as e:
_available = False
_import_error = e... |
conftest.py | import pytest
import torch
from multiprocessing import Process
import os
import sys
import syft
from syft.grid.clients.dynamic_fl_client import DynamicFLClient
from syft.grid.public_grid import PublicGridNetwork
import gridnode
from . import IDS, PORTS
import time
import requests
import json
from gevent import pywsgi... |
server.py | import asyncio
import uvloop
from module.devices import ServerVirtualDevice
import threading
import json
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
from autobahn.asyncio.websocket import WebSocketServerProtocol, \
WebSocketServerFactory
class MyServerFactory(WebSocketServerFactory):
def __init_... |
test_streams.py | """Tests for streams.py."""
import gc
import os
import queue
import socket
import sys
import threading
import unittest
from unittest import mock
try:
import ssl
except ImportError:
ssl = None
import asyncio
from asyncio import test_utils
class StreamReaderTests(test_utils.TestCase):
DATA = b'line1\nlin... |
dte_main.py | # -*- coding: utf-8 -*-
import sys
import threading
#PYQT5 PyQt4’s QtGui module has been split into PyQt5’s QtGui, QtPrintSupport and QtWidgets modules
from check_connectivity import is_connected
from event_updater import *
from dte_encryption import *
from bs4 import BeautifulSoup
from PyQt5 import QtWidgets
#PYQT5 ... |
riaps_testing.py | """RIAPS testing helper methods
"""
import os
import sys
import yaml
import paramiko
import zmq
import time
import threading
import datetime
stream = open('riaps_testing_config.yml', 'r')
config = yaml.load(stream, Loader=yaml.SafeLoader)
stream.close()
for key in {"hosts", "username", "password", "logPath", "logPrefi... |
osr_basic.py | #!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Basic tests of OGRSpatialReference (OSR) operation, not including
# support for actual reprojection or use of EPSG tables.
# Author... |
test_ssl.py | # -*- coding: utf-8 -*-
# Test the support for SSL and sockets
import sys
import unittest
from test import test_support as support
import asyncore
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import tempfile
import urllib2
import traceback
import weakref
import... |
_channel_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... |
igra_nedelujoca.py | import tkinter as tk
import threading
import time
##################################################################################
## Igra
#
# V igra.py je implementirano vse, kar je potrebno za igro in uporabniški vmesnik.
#
##################################################################################
# Defi... |
process_file_queue.py | import json
import os
from queue import Queue
import threading
class ProcessFileQueue:
q = Queue()
@staticmethod
def start():
print('WORKER STARTED')
threading.Thread(target=ProcessFileQueue.worker, daemon=True).start()
@staticmethod
def worker():
while True:
... |
generate_csv_dataset.py | import csv
import numpy
from threading import Thread
from datetime import datetime
MAX_VALUE = 1000000
def get_random_array(amount):
return numpy.random.randint(0, MAX_VALUE, amount)
def save_to_csv(count, file_name: str):
array = get_random_array(count//10)
with open(file_name + ".csv", "a", newline="... |
test_extending.py | import math
import operator
import sys
import pickle
import multiprocessing
import ctypes
import warnings
from distutils.version import LooseVersion
import re
import numpy as np
from numba import njit, jit, vectorize, guvectorize, objmode
from numba.core import types, errors, typing, compiler, cgutils
from numba.core... |
cross_device_ops_test.py | # Copyright 2018 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... |
utils.py | # -*- coding: utf-8 -*-
from __future__ import division
import os
import sys
import socket
import signal
import functools
import atexit
import tempfile
from subprocess import Popen, PIPE, STDOUT
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty
f... |
f3290e217fbb989a3843f8659f6af3d704f81a01174d5c8e6e7a4e0acfed2401.py | import unittest
from test import test_support
import subprocess
import sys
import signal
import os
import errno
import tempfile
import time
import re
import sysconfig
try:
import resource
except ImportError:
resource = None
try:
import threading
except ImportError:
threading = None
mswindows = (sys.pl... |
usb_session.py | import datetime
import serial
import threading
import json
import traceback
import queue
import os
import pty
import subprocess
import glob
from elasticsearch import Elasticsearch
import email
import imaplib
from .data_consumers import Datastore, Logger
from . import get_pio_asset
from .cases.utils import str_to_val
i... |
executor.py | # Lint as: python3
# Copyright 2020 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 ... |
file_stream.py | import base64
import binascii
import collections
import itertools
import logging
import os
import sys
import random
import requests
import threading
import time
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Tuple
import wandb
from wandb import util
from wandb import env... |
engine.py | import sys
from threading import Thread
from queue import Queue, Empty
from copy import copy
from collections import defaultdict
from typing import Any, Dict, List
from vnpy.event import Event, EventEngine
from vnpy.trader.engine import BaseEngine, MainEngine
from vnpy.trader.constant import Exchange
from vnpy.trader.... |
taskqueue_stub.py | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
test_concurrent_query.py | import os
import sys
import threading
from RLTest import Env
from redisgraph import Graph, Node, Edge
from redis import ResponseError
from base import FlowTestsBase
GRAPH_ID = "G" # Graph identifier.
CLIENT_COUNT = 16 # Number of concurrent connections.
graphs = None ... |
azurecli.py | import json
import os
import signal
import subprocess
import sys
from io import StringIO
from threading import Thread, Timer
from azure.cli.core import get_default_cli
from fstrings import f
from six.moves.queue import Empty, Queue
from . import telemetry
from .compat import PY2
if PY2:
from .compat import FileN... |
ipip.py | #!/usr/bin/python3
"""
/. . . . ./. . . . . . . . . . . . /. . . . . . . . . .\
. . . . . . . . . . . . . . . . . . . . /. . . │. . . . . . \
.′. . . ./ . . . . . . . . . . . . . . |. . . . .| . . . . . . . . . .
. . . . / . . . . . . . . . . . . . . . |. . . . .|. . . . |. . . . . .|
i ... |
netflow_2_osc.py | #!/usr/bin/env python3
import threading
import time
import argparse
import socketserver
from collector_v9 import ExportPacket
import client_multi_traffic as cmt
'''
A handler for netflow data collector. Handles the collected netflow data and passes it to the Aggregator
'''
class Handler(socketserver.BaseRequestHandle... |
threaded_iterator.py | import queue
import threading
from typing import Any, NamedTuple
class ThreadedIterator(object):
"""An iterator that computes its elements in a parallel thread to be ready to
be consumed.
Exceptions raised by the threaded iterator are propagated to consumer.
"""
def __init__(
self,
... |
utils.py | import os
import time
import signal
import platform
import multiprocessing
import pymysql
import pytest
from mycli.main import special
PASSWORD = os.getenv('PYTEST_PASSWORD')
USER = os.getenv('PYTEST_USER', 'root')
HOST = os.getenv('PYTEST_HOST', 'localhost')
PORT = int(os.getenv('PYTEST_PORT', 3306))
CHARSET = os.g... |
main.py | import argparse
import threading
import time
import webbrowser
from gunicorn.app.base import BaseApplication
from keepsake_ui.app import setup_app
class Application(BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__... |
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... |
threading_actor.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
使用actor模式
- 一种古老但是简单的并行和分布式计算解决方案
- 一个actor就是一个计算任务. 简单的执行发送的消息任务
- actor之间的通信是单向和异步的
"""
from queue import Queue
from threading import Thread, Event
# 用来关闭actor的 '哨兵'
class ActorExit(Exception):
pass
class Actor:
def __init__(self... |
codesearcher.py | from __future__ import print_function
import os
import sys
import random
import traceback
import pickle
from keras.optimizers import RMSprop, Adam
from scipy.stats import rankdata
import math
from math import log
from models import *
import argparse
from datashape.coretypes import real
random.seed(42)
import threading... |
record_video.py | import time, cv2
from threading import Thread
from djitellopy import Tello
FPS = 30
tello = Tello()
tello.connect()
print("Battery level:", tello.get_battery())
keepRecording = True
tello.streamon()
frame_read = tello.get_frame_read()
def video_recorder():
height, width, _ = frame_read.frame.shape
video = c... |
bomber.py | import requests, random
from requests import get
from bs4 import BeautifulSoup as bs
import colorama
from termcolor import colored
from tkinter import filedialog as fd
from tkinter import *
from tkinter import messagebox
from tkinter import Label
from random import randint
import threading, os, sys, time
col... |
client.py | #!/bin/python
#DEVELOPED BY DEVILMASTER
import sys, time, socket, threading, os
os.system('clear')
class colors:
blue = '\033[94m'
cyan = '\033[96m'
green = '\033[92m'
red = '\033[31m'
pink = '\033[35m'
banner = colors.cyan + """
_______ _____ ______ ___ ____ ____ __ ___
/ ___/ // / _... |
kivy_pulsesensor_viewer_demo.py | '''
This example uses a Kivy Garden Graph package to draw Arduino pulse sensor data on a PC/phone screen. We use PySerial(PC) or usbserial4a(Android) to receive pulse sensor data from an Arduino board.
To read more about this demo, visit: https://github.com/EveryWhereLab/kivy-pulsesensor-viewer-demo/.
'''
import kivy
... |
thread_name_and_process.py |
Consider the python program given below in which we print thread name and corresponding process for each task:
# Python program to illustrate the concept
# of threading
import threading
import os
def task1():
print("Task 1 assigned to thread: {}".format(threading.current_thread().name))
print("ID of proces... |
stockprice.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""stockprice.py - get stock price from News sources and add to
Elasticsearch.
See README.md or https://github.com/shirosaidev/stocksight
for more information.
Copyright (C) Chris Park 2018-2019
Copyright (C) Allen (Jian Feng) Xie 2019
stocksight is released under the Apac... |
http_generator.py | """
Tensor generator that yields images and labels for the image.
Accepts HTTP POSTs which will enqueue data to the process queue.
"""
import threading
import time
try:
# Python 3
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
except:
# Python 2
... |
standalone.py | """Standalone Authenticator."""
import argparse
import collections
import logging
import socket
import threading
import OpenSSL
import six
import zope.interface
from acme import challenges
from acme import standalone as acme_standalone
from letsencrypt import errors
from letsencrypt import interfaces
from letsencry... |
25_multiprocess_sharememory_unsafe.py | """
进程间通信之共享内存
"""
from multiprocessing import Process
from multiprocessing import Value
num = Value('i', 0)
def do_sth():
global num
for i in range(1000000):
"""
相当于:num.value = num.value + 1
首先计算 num.value + 1 存入临时变量中
然后将临时变量的赋值给Num
"""
num.value += 1
t1 = ... |
input_reader.py | # coding=utf-8
# Copyright 2020 The Mesh TensorFlow 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... |
executor.py | # Copyright (C) 2015-2016 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... |
main.py | #!/usr/bin/env pipenv run python
"""
Nonsense plurk bot
Distributed under terms of the WTFPL license.
"""
from poaurk import PlurkAPI
from multiprocessing import Process, Value
import typing
import requests
import json
import re
import loguru
import datetime
import time
import random
import schedule
import sqlite3
... |
pyflow.py | #!/usr/bin/env python
#
# pyFlow - a lightweight parallel task engine
#
# Copyright (c) 2012-2017 Illumina, Inc.
# 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 ... |
schedules.py | """schedules: schedules all scheduled tasks, maintenace and time based requests
Provides a variety of classes to hold scheduled taks, update them and answer
queries about them.
Copyright (c) 2020 by Jeff Bass.
License: MIT, see LICENSE for more details.
"""
import sys
import pprint
import logging
import schedule
imp... |
crashreporter.py | #
# This file is:
# Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com>
#
# MIT License
from . import utils
from . import gui
from electroncash.i18n import _
from .uikit_bindings import *
from .custom_objc import *
import json, traceback, requests, sys
from electroncash import PACKAGE_VERSION
issue_templ... |
R4.py | import socket
import threading
import time
import sys
# Define constant parameters
ALL_CONN = [8080,8181,8282,8383]
SERVER_PORT = 8383
IP_ADDR = "127.0.40.1"
ADDR = (IP_ADDR,SERVER_PORT)
CLIENT_ADDR = list(IP_ADDR)
CLIENT_ADDR[-1] = str(int(CLIENT_ADDR[-1]) + 1)
CLIENT_ADDR = "".join(CLIENT_ADDR)
CONFIG_PATH = "con... |
dataloader_iter.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 appli... |
main.py | import logging
import os
import sys
import threading
from appmetrics import metrics
from socutils import get_settings
from modules.app_metrics import register_app_metrics
from modules.logging import prepare_logging
logger = logging.getLogger('thehive_incidents_pusher')
def main(settings_file_path: str = 'data/sett... |
gui.py | import cairo
import gi
import threading
import time
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository.GdkPixbuf import Pixbuf, InterpType
from sand.gui_module import GUIComponent
from sand.modules.network.sensor import Net... |
dk.py |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 7 13:07:34 2020
@author: somar
"""
import zmq
import os
import time
from multiprocessing import Process
connectionPort="tcp://192.168.195.156:"
masterport="tcp://127.0.0.1:"
class DataKeeper:
i_Am_Alive_port="5400"
replicationPort="5200"
context = zmq.Conte... |
hub.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import os
import select
import socket
import threading
import time
import uuid
import warnings
import queue
import xmlrpc.client as xmlrpc
from urllib.parse import urlunparse
from astropy import log
from .constants import SAMP_STATUS_OK
fro... |
tasks.py | # encoding=utf-8
__author__ = 'wdx'
import os
print os.path.dirname(__file__)
from celery import Celery
from msg_handler import MsgHandler
from core.processor_watcher import ProcessorWatcher
from watchdog.observers import Observer
from threading import Thread
app = Celery('tasks',backend='amqp', broker='amqp://')
ms... |
main.py | # Content from http://www.eveandersson.com/pi/poetry/
from os import path
from random import choice
from vulnerable_flask.website import start_app
from multiprocessing import Process
# Declare paths to the files
PATH = path.normpath(path.dirname(__file__))
FLAG_PATH = path.join(PATH, "secrets", "flag.txt")
# Get the... |
single.py | __author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '8/20/2020 8:13 PM'
import threading
class Singleton(object):
_lock = threading.Lock()
_instances = None
def __call__(cls, *args, **kwargs):
with cls._lock:
if not cls :
instance = super().__call__(*... |
totem.py | import cv2
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
from datetime import datetime
import numpy as np
import threading
import serial
import time
import os
cv2.namedWindow('TotemUFS... |
__init__.py | #!/usr/bin/python3
"""
dispy: Distribute computations among CPUs/cores on a single machine or machines
in cluster(s), grid, cloud etc. for parallel execution. See
http://dispy.sourceforge.net or https://pgiri.github.com/dispy for details.
"""
import os
import sys
import time
import socket
import inspect
import stat
... |
dromaeo.py | #!python
# Copyright 2013 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... |
evaluate_service.py | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.