source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
display.py | # -*- coding: utf-8 -*-
import tkinter as tk
import sound
import socket
import threading
class ConnClient():
'''
ソケット通信によりラズベリーパイから画像情報を受け取る。
'''
def __init__(self,conn, addr):
self.conn_socket = conn
self.addr = addr
self.recvdata = 0
self.recvdata1 = 0
self.re... |
tiny-chatting-server.py | #! /usr/bin/python
# coding: utf-8
import os
import sys
import copy
import time
import select
import socket
import signal
import argparse
import threading
from loger import Loger
# server class
class Chatting_server:
'''A server for chat online service'''
User_Info_Dict_Template = {'IP':'', 'PORT':0, 'NICK':'... |
connection.py | import re
import time
import threading
from .utils import is_windows, encode_attr
from .event import Event
from .control import Control
class Connection:
def __init__(self, conn_id):
self.conn_id = conn_id
self.lock = threading.Lock()
self.win_command_pipe = None
self.win_event_pip... |
test_runtime_profiler.py | # -*- coding: utf-8 -*-
# test_runtime_profiler.py
#
# Author: Daniel Clark, 2016
"""
Module to unit test the runtime_profiler in nipype
"""
from __future__ import print_function, division, unicode_literals, absolute_import
from builtins import open, str
# Import packages
import unittest
from nipype.interfaces.base ... |
server.py | import socket, threading
host = socket.gethostname()
port = 4000
clients = {}
addresses = {}
print(host)
print("Server is ready...")
serverRunning = True
'''
def handle_client(conn):
try:
data = conn.recv(1024).decode('utf8')
welcome = 'Welcome %s! If you ever want to quit, type {quit} to exit.' % ... |
MainScanner.py | #Local modules
from logging import exception
from ipaddress import ip_address
from loguru import logger
from datetime import datetime
from queue import Queue
import sys
import threading
from Connect import elastic
from Screenshot import take_screenshot
from Elastic import create_document
from PortScanner import Port_... |
idf_monitor.py | #!/usr/bin/env python
#
# esp-idf serial output monitor tool. Does some helpful things:
# - Looks up hex addresses in ELF file with addr2line
# - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R)
# - Run flash build target to rebuild and flash entire project (Ctrl-T Ctrl-F)
# - Run app-flash build target to rebuild and f... |
sentry_new.py | #!/usr/bin/env python3.6
import sys
from serial import Serial
from time import sleep
from math import tan, atan, radians, degrees
from threading import Thread, Lock
from copy import deepcopy
import cv2
hello = b'''\r\nGrbl 1.1f ['$' for help]\r\n'''
ok = b'''ok\r\nok\r\n'''
class Sentry(object):
def __init__(... |
mcedit.py | # !/usr/bin/env python2.7
# -*- coding: utf_8 -*-
# import resource_packs # not the right place, moving it a bit further
#-# Modified by D.C.-G. for translation purpose
#.# Marks the layout modifications. -- D.C.-G.
"""
mcedit.py
Startup, main menu, keyboard configuration, automatic updating.
"""
import splash
impor... |
server.py | import asyncio
import socket
import threading
import json
import logging
from webcandy import util
from typing import NewType, Optional, Tuple, List, Dict
from flask import Flask
from .models import User
# define Address to be 2-tuple of (host, port)
Address = NewType('Address', Tuple[str, int])
class ClientManager... |
manager.py | # Copyright 2017 Cloudbase Solutions, SRL.
#
# 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 ... |
server.py | import socket
import threading
from datetime import datetime
from python_version.parser.parser import ParseError, Parser
from python_version.server.accounts import Accounts
class Server:
encoding = 'utf-8'
def __init__(self, config: tuple):
self.ip, self.port = config
self.sock = socket.socke... |
test_poplib.py | """Test script dla poplib module."""
# Modified by Giampaolo Rodola' to give poplib.POP3 oraz poplib.POP3_SSL
# a real test suite
zaimportuj poplib
zaimportuj asyncore
zaimportuj asynchat
zaimportuj socket
zaimportuj os
zaimportuj time
zaimportuj errno
z unittest zaimportuj TestCase, skipUnless
z test zaimportuj sup... |
WebsocketClient.py | # encoding: UTF-8
########################################################################
import json
import logging
import ssl
import sys
import time
import traceback
from datetime import datetime
from threading import Lock, Thread, Event
import websocket
class WebsocketClient(object):
"""
Websocket API
... |
updaterthread.py | #!/usr/bin/env python
import threading
import time
import datetime
import socket
import requests
class Updater(object):
""" Threading class
Taken from: http://sebastiandahlgren.se/2014/06/27/running-a-method-as-a-background-thread-in-python/
"""
def __init__(self, interval, target, mongodb, username... |
test_httplib.py | import errno
from http import client
import io
import itertools
import os
import array
import socket
import unittest
TestCase = unittest.TestCase
from test import support
here = os.path.dirname(__file__)
# Self-signed cert file for 'localhost'
CERT_localhost = os.path.join(here, 'keycert.pem')
# Self-signed cert fil... |
ledDriver.py | # Mainly copied from NeoPixel strandtest example. Author: Tony DiCola (tony@tonydicola.com)
# See: https://github.com/jgarff/rpi_ws281x
import threading
import time
from neopixel import *
# Led Driver for Pawn Shy to animate / set the Pawn LED states.
class LedDriver():
def __init__(self):
# LED strip configurat... |
server.py | #!/usr/bin/env python3
from __future__ import print_function
import base64
import copy
import hashlib
import json
import logging
import os
import pkgutil
import random
import signal
import ssl
import string
import subprocess
import sys
import time
from datetime import datetime, timezone
from time import sleep
from ty... |
secureshell.py | import sys
if sys.version_info.major == 2:
from warnings import filterwarnings
filterwarnings("ignore", module=".*paramiko.*")
from paramiko import SSHClient, AutoAddPolicy
from .abstractshell import AbstractShell
from .abstractremoteshell import AbstractRemoteShell
from .shellresult import ShellResult
from .q... |
batched_minecraft_mix.py | import os
import logging
import glob
import re
import math
import time
import csv
import multiprocessing
from queue import Empty
from collections import defaultdict
import pickle
import numpy as np
import random
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class BatchedTrainer(object):
de... |
snkrs-aio.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import time
import random
from datetime import datetime
import requests
import threading
from proxymanager import ProxyManager
from discord_webhook import DiscordEmbed, DiscordWebhook
headers= {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) A... |
computer-stats.py | import tkinter as tk
import time
import threading
import uuid
import datetime
import sys
import configparser
import_success = True
import_needed = ""
# Try blocks for checking if the user has all the needed libraries installed
try:
import psutil
except ImportError:
import_success = False
import_needed += ... |
risk_table.py | import threading
import Queue
from games.risk_dice import risk_dice
def risk_table(args):
'''
Simple table for gamblers
'''
pool = []
queue = Queue.Queue()
player_results = []
players_at_table = args[0]
attackers = [1, 2, 3]
defenders = [1, 2]
i = 0
while i < players_at_ta... |
Touchscreendisp.py | from tkinter import *
from tkinter import messagebox, _setit, ttk
from PIL import Image, ImageTk
from ttkthemes import ThemedStyle
from Keyboard import create_keyboard, keyboard_on, function_maker
import Wifi_file as wf
import VideoSetting as vs
import pickle
import os
import threading
import cv2
import Stre... |
node.py | ###############################
# python imports
###############################
import socket
from time import sleep, time
from threading import Thread
from typing import Tuple
import traceback
from pyacyclicnet.core.types.request import Request
###############################
# global imports
#####################... |
test_user_agent.py | """
Tests for the pandas custom headers in http(s) requests
"""
import gzip
import http.server
from io import BytesIO
import threading
import pytest
import pandas as pd
import pandas._testing as tm
class BaseUserAgentResponder(http.server.BaseHTTPRequestHandler):
"""
Base class for setting up a server that ... |
test_concurrency.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for concurrency libraries."""
import os
import random
import sys
import threading
import time
from flaky import flaky
import coverage
from coverage impo... |
PDRandom.py | #!/usr/bin/env python
import math
import random
import sys
import multiprocessing
import os
import os.path
#Generate Random Numbers according to a probability density function
# Distributed under the MIT License.
# see the LICENSE.txt
# 1.0.2
#By Ken Leung
# the probility density need to return value >=0
class PDR... |
keyinput.py | import sys
import threading
import queue
import tty
import termios
import signal
import atexit
# We change the TTY settings to emit single characters (not by line) and
# ensure the settings are reversed at shutdown
old_tty_settings = termios.tcgetattr(sys.stdin)
tty.setcbreak(sys.stdin.fileno())
def reset_tty():
pri... |
webhook.py | """
This module implements a modular input consisting of a web-server that handles incoming Webhooks.
"""
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import sys
import ssl
import time
import re
import json
import urlparse
import errno
import collections
from threading import Thread
from cgi import p... |
cc.py | #!/usr/bin/python3
#Coded by L330n123
#########################################
# I removed the mixed proxies flood #
# because in my perspective, it doesn't #
# give more performance when flooding. #
# -- L330n123 #
#########################################
'''
Still working on multiproc... |
server.py | <<<<<<< HEAD
from mqtt import MQTT
import socket
import ast
import os
import threading
import datetime
import time
server = socket.socket()
user = socket.socket()
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
user.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind(('', 33333))
user.bind((... |
diskolight.py | import pyaudio
import numpy as np
import pigpio
import threading
import time
import ledstrip
import filters
class Diskolight:
def __init__(self, chunk=2**10, rate=44100):
self.CHUNK = chunk
self.RATE = rate
self.running = False
# coloring
self.bass_r = 0.8
self.... |
dark.py | # -*- coding: utf-8 -*-
import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize
from multiprocessing.pool import ThreadPool
try:
import mechanize
except ImportError:
os.system('pip2 install mechanize')
else:
try:
import requests
except ImportEr... |
eval.py | import os
import requests
import cgi
import shutil
import docker
import json
import threading
import pandas as pd
import argparse
import subprocess
from sqlalchemy import create_engine
from io import StringIO
from func_timeout import func_timeout, FunctionTimedOut
from app.headless_raas import headless_raas
def doi... |
base_crash_reporter.py | # Electrum - lightweight Bitcoin client
#
# 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, modify, merge,
# publish... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Megacoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 with... |
ui_main.py | ####################################################################################
# BLACKMAMBA BY: LOSEYS (https://github.com/loseys)
#
# QT GUI INTERFACE BY: WANDERSON M.PIMENTA (https://github.com/Wanderson-Magalhaes)
# ORIGINAL QT GUI: https://github.com/Wanderson-Magalhaes/Simple_PySide_Base
####################... |
bot.py | import logging
import os
import time
import re
from commands.team import set_default_team
from commands.standup import today, yesterday, problem
from commands.vacation import vacation
from commands.unsubscribe import unsubscribe
from flask import Flask
from slackclient import SlackClient
from threading import Thread
fr... |
instance.py | import pickle
from threading import Thread
from Queue import Queue
import ana
from angr import StateHierarchy
from .jobs import PGStepJob, PGExploreJob
from .jobs import CFGGenerationJob
from ..logic import GlobalInfo
from ..logic.threads import gui_thread_schedule_async
from .states import StateManager
from ..utils.... |
application.py |
import threading
import logging
from . import backend
from orion_core.frontend.base_frontend import frontend_run
logger = logging.getLogger(__name__)
def init():
logger.info("initializing backend . . .")
base_backend = threading.Thread(target=backend.test, daemon=True)
base_backend.start()
logger.i... |
daemon.py | # Copyright 2015 Rackspace 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 agr... |
speedtest_cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015 Matt Martz
# 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.or... |
org.py | from util.util import *
from flask import Blueprint
org_bp = Blueprint('org_bp', __name__)
@org_bp.route('/home')
def home():
return getUUID()
@org_bp.route('/listing', methods=["POST"])
def org_listing():
cur().execute("select * from organization")
res = cur().fetchall()
resp = {}
for i in res... |
test_index_remote.py | import multiprocessing as mp
import os
import time
import unittest
import numpy as np
from jina.drivers.helper import array2pb
from jina.enums import FlowOptimizeLevel
from jina.executors.indexers.vector.numpy import NumpyIndexer
from jina.flow import Flow
from jina.main.parser import set_gateway_parser
from jina.pea... |
test_intermediary_to_dot.py | # -*- coding: utf-8 -*-
import sys
import re
from multiprocessing import Process
from pygraphviz import AGraph
from tests.common import parent_id, parent_name, child_id, child_parent_id, relation, child, parent
from eralchemy.main import _intermediary_to_dot
from eralchemy.cst import GRAPH_BEGINNING
GRAPH_LAYOUT = GRA... |
connection.py | import binascii
import logging
import os
import sys #DEBUG2**************
import ipaddress #DEBUG2**************
import time #PERF EV TIME INFO*
from coapthon.client.helperclient import HelperClient #PERF EV AUTOMATION V2*
from threading import Thread #PERF EV AUTOMATION V2*
from collections import deque
from datacla... |
gdbclientutils.py | import os
import os.path
import threading
import socket
import lldb
import binascii
import traceback
from lldbsuite.support import seven
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbtest_config
def checksum(message):
"""
Calculate the GDB server protocol checksum of the message.
T... |
processify.py | # from https://gist.github.com/schlamar/2311116
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
'''Decorator to run a function as a process.
Be sure that every argument and the return value
is *pickable*.
The created pr... |
accountHandler.py | import re
import time
import requests
import xmltodict
from threading import Thread
from dateutil.parser import parse
from flask import session as flaskSession
from dataactbroker.handlers.aws.sesEmail import sesEmail
from dataactbroker.handlers.aws.session import LoginSession
from dataactbroker.handlers.userHandler ... |
caching.py | import json
import threading
import time
from collections import OrderedDict
from typing import Callable, Dict, List, Optional
from hexbytes import HexBytes
from web3 import Web3
from brownie._config import CONFIG, _get_data_folder
from brownie.network.middlewares import BrownieMiddlewareABC
from brownie.utils.sql im... |
test_base.py | import unittest
import subprocess as sp
import threading
import os
import time
import taish
TAI_TEST_MODULE_LOCATION = os.environ.get('TAI_TEST_MODULE_LOCATION', '')
if not TAI_TEST_MODULE_LOCATION:
TAI_TEST_MODULE_LOCATION = '0'
TAI_TEST_TAISH_SERVER_ADDRESS = os.environ.get('TAI_TEST_TAISH_SERVER_ADDRESS', '')
... |
populate_test_data.py | from contextlib import contextmanager, closing
import os
import re
import sys
from tempfile import NamedTemporaryFile
import getpass
import random
import subprocess
import threading
import time
import omero
import omero.cli
from omero.gateway import BlitzGateway
from omero import sys as om_sys
from omero import rtypes... |
server.py | from __future__ import annotations
import typing
import psutil # type: ignore
if typing.TYPE_CHECKING:
from asyncio import Future
from typing import Tuple, Optional, Type, Union
from pypbbot.driver import Drivable
from pypbbot.typing import ProtobufBotAPI
import asyncio
import os
import threading
i... |
run_health_checker.py | import logging
import multiprocessing
import signal
import sys
import time
from types import FrameType
from src.health_checker.manager import HealthCheckerManager
from src.utils import env
from src.utils.constants.names import HEALTH_CHECKER_MANAGER_NAME
from src.utils.constants.starters import (RE_INITIALISE_SLEEPING... |
MyServer.py | # coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee kongyeeku@163.com #
# #
# version 1.0 ... |
sql_db.py | import os
import concurrent
import queue
import threading
import asyncio
import sqlite3
from .logging import Logger
from .util import test_read_write_permissions
def sql(func):
"""wrapper for sql methods"""
def wrapper(self: 'SqlDB', *args, **kwargs):
assert threading.currentThread() != self.sql_thre... |
NatNetClient.py | import socket
import struct
from threading import Thread
def trace( *args ):
pass # print( "".join(map(str,args)) )
# Create structs for reading various object types to speed up parsing.
Vector3 = struct.Struct( '<fff' )
Quaternion = struct.Struct( '<ffff' )
FloatValue = struct.Struct( '<f' )
DoubleVa... |
collect_types.py | """
This module enables runtime type collection.
Collected information can be used to automatically generate
mypy annotation for the executed code paths.
It uses python profiler callback to examine frames and record
type info about arguments and return type.
For the module consumer, the workflow looks like that:
1) c... |
build_mscoco_data.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
bridge_server.py | #!/usr/bin/env python
"""
Copyright 2013 Southwest Research Institute
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 requ... |
watcher.py | import logging
import os.path
import threading
import time
try:
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
can_watch = True
except ImportError:
Observer = None
FileSystemEventHandler = object
... |
installwizard.py |
from functools import partial
import threading
import os
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform... |
tests.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... |
flaskwebgui.py | from http.server import BaseHTTPRequestHandler, HTTPServer
import os, time, signal
import sys, subprocess as sps
from threading import Thread
from datetime import datetime
class S(BaseHTTPRequestHandler):
def _set_response(self):
self.send_response(200)
self.send_header('Content-type... |
filesystemio_test.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... |
log.py | #!/usr/bin/env python2
"""
Copyright (c) 2014-2019 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
import os
import signal
import socket
import SocketServer
import sys
import threading
import time
import traceback
from core.common import check_whitelisted... |
tests.py | """
Unit tests for reverse URL lookups.
"""
import sys
import threading
from admin_scripts.tests import AdminScriptTestCase
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
from django.http import (
HttpRequest, ... |
core.py | #!/usr/bin/env python3
import itertools
from socket import socket, gaierror, AF_INET, SOCK_STREAM
from ssl import wrap_socket, SSLError, PROTOCOL_TLSv1_2
from time import time
from datetime import datetime
from sys import exit
from os.path import exists
from multiprocessing import cpu_count, Process
PROCESSES_COUNT =... |
shadow.py | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
import argparse
from awscrt import auth, io, mqtt, http
from awsiot import iotshadow
from awsiot import mqtt_connection_builder
from concurrent.futures import Future
import sys
import threading
import traceback
... |
sugar_pi_app.py | #!/usr/bin/env python3
import http.client
import json
import logging
import os
import platform
import signal
import sys
import threading
import time
from datetime import datetime, timedelta, timezone
from enum import Enum
from logging.handlers import RotatingFileHandler
from pathlib import Path
from .config_utils impo... |
commands.py | from freatures import admin
from freatures import autoban
from freatures import music
from freatures import social
from freatures import translation
from freatures import blacklist
import threading
import toml
import requests
class BotCommands(object):
"""Commands for bot"""
def __init__(self):
self.se... |
singleMachine.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... |
auto_mode.py |
#!/usr/bin/python
import socket
import struct
import logging
import ipaddress
import sys
import socket
import time
import os
import time
import threading
import Queue
from impacket import smb, smbconnection, nt_errors
from smb_module import MYSMB
from struct import pack, unpack, unpack_from
from impacket.uuid import ... |
drEngine.py | # encoding: UTF-8
'''
本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。
使用DR_setting.json来配置需要收集的合约,以及主力合约代码。
'''
import json
import csv
import os
import copy
import traceback
from collections import OrderedDict
from datetime import datetime, timedelta
from queue import Queue, Empty
from threading import Thread
from pymongo.er... |
yolomot.py | import glob
from io import DEFAULT_BUFFER_SIZE
import math
import os
import json
import random
import shutil
import copy
import time
import warnings
from collections import defaultdict, OrderedDict
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, E... |
file_clearing_daemon.py | #!/usr/bin/env python3
"""
The problem -- we are trying to load a new Ubuntu image onto a naked server machine by PXE-booting an install script
onto that machine . . . but, after the new Operating System is successfully installed, we do not want to be stuck
in a loop when it reboots, continually re-installing it.
T... |
serialtube.py | import sys
import time
import serial
from . import tube
from .. import context
from .. import term
class serialtube(tube.tube):
def __init__(
self, port='/dev/ttyUSB0', baudrate=115200,
convert_newlines=True,
bytesize=8, parity='N', stopbits=1, xonxoff=False,
rts... |
chicken_blaster.py | # Standard library
import threading
# Third-party
import numpy as np
# Our stuff from https://github.com/AndrewGYork/tools
import pco
import ni
# Name-to-channel; what is our analog-out card plugged into?
n2c = {'camera': 0,
'488': 1,
'405': 2,}
class ChickenBlaster:
def __init__(self)... |
test_api.py | """
HappyBase tests.
"""
import collections
import os
import random
import threading
import six
from six.moves import range
from happybase import Connection, ConnectionPool, NoConnectionsAvailable
HAPPYBASE_HOST = os.environ.get('HAPPYBASE_HOST')
HAPPYBASE_PORT = os.environ.get('HAPPYBASE_PORT')
HAPPYBASE_COMPAT = ... |
host.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... |
server.py | import socketserver
import threading
import socket, time
class TTCPRH(socketserver.BaseRequestHandler):
"""
The request handler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client.
"""
#l... |
example5.py | import threading
import time
from timeit import default_timer as timer
def thread_a():
print('Thread A is starting...')
print('Thread A waiting to acquire lock A.')
lock_a.acquire()
print('Thread A has acquired lock A, performing some calculation...')
time.sleep(2)
print('Thread A waiting to ... |
web.py | import os
import ujson
from flask import Flask, request
from multiprocessing import Process
from conf import Cfg
from datasets import Datasets
from storage.lmdbStorage import LmdbStorage
app = Flask(__name__)
cfg = Cfg()
db = LmdbStorage(cfg)
db.load()
d = Datasets(cfg, db)
@app.route("/")
def main():
data = {... |
read.py | from stompy.simple import Client
import time
from timeit import default_timer as timer
import sys
import json
import threading
queue_name = "/queue/test4"
def process_frame(frame):
j = json.loads(frame.body)
t = j['type']
alter_amount = float(j['amount'])
print("Got message: " + t)
# read the amount
f = open(... |
smtclient.py | # Copyright 2017,2020 IBM Corp.
#
# 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 agr... |
ros_graph.py | # Copyright 2021 Open Source Robotics Foundation, 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... |
static_web_server.py | '''
A HTTP server
1. create a socket
2. bind & reuse addr
3. listen
4. while True:
4.1 accept
4.2 new client comes=> create a new process to handle it
'''
import socket
import multiprocessing
import os
STATIC_DIR='static'
def handle_client(client_socket,client_addr):
'''
... |
bytemail.py | #!/usr/bin/python
import socket
import db
import checkin
import message
import read
import check
import json
import threading
import os
import uuid
import cmd
import thread
import unsent
import delet... |
test_sys.py | import builtins
import codecs
import gc
import locale
import operator
import os
import struct
import subprocess
import sys
import sysconfig
import test.support
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, assert_python_failure
from test.support imp... |
rfc2217.py | '''
'' PyIRCIoT (PyLayerCOM class)
''
'' Copyright (c) 2019-2020 Alexey Y. Woronov
''
'' By using this file, you agree to the terms and conditions set
'' forth in the LICENSE file which can be found at the top level
'' of this package
''
'' Authors:
'' Alexey Y. Woronov <alexey@woronov.ru>
'''
# Those Global options ... |
donkey_sim.py | # Original author: Tawn Kramer
import asyncore
import base64
import math
import time
from io import BytesIO
from threading import Thread
import numpy as np
from PIL import Image
from config import INPUT_DIM, ROI, THROTTLE_REWARD_WEIGHT, MAX_THROTTLE, MIN_THROTTLE, \
REWARD_CRASH, CRASH_SPEED_WEIGHT
... |
build.py | # Copyright 2014 The Oppia 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 applicable ... |
advanced-reboot.py | #
#ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";d... |
numpy_weights_silent.py | #Contiguity using apply_async
import pysal as ps
from collections import defaultdict
import multiprocessing as mp
import time
import sys
import ctypes
import numpy as np
from numpy.random import randint
def check_contiguity(checks,lock,weight_type='ROOK'):
geoms = np.frombuffer(sgeoms)
geoms.shape = (2,geom... |
tasks.py | import os
import signal
import traceback
from time import sleep
from multiprocessing import Process
import asyncio
from asyncio.subprocess import PIPE, create_subprocess_shell
from django.conf import settings
from core import consts
from core import models
import core.datatools.ansible
class TaskManager:
def ru... |
Server.py | import cherrypy
import FritzDect
import jinja2
import json
from threading import Thread
class FritzServer(object):
def __init__(self):
self.fritz = FritzDect.FritzDect()
self.env = jinja2.Environment(loader=jinja2.PackageLoader("FritzDect","templates"))
self.update_device_list()
c... |
swapper.py | import threading
import os
import cv2
class Swapper():
def __init__(self, buffer, path=""):
super().__init__()
self.buffer = buffer
self.thread = None
self.path = path
print("New swapper created...")
def swap_and_save(self):
old_buffer = self.buffer.pothole_de... |
driver.py | import serial
from serial.tools import list_ports
from pylsl import StreamInfo, StreamOutlet
from datetime import datetime
import threading
import numpy as np
import argparse
def byb_byte_to_float(high: np.uint8, low: np.uint8) -> np.float32:
return np.float32(np.uint16(np.uint8(low) + (np.uint8(high & 127) << 7)... |
trt_yolo_mysql_thread.py | """trt_yolo.py
This script demonstrates how to do real-time object detection with
TensorRT optimized YOLO engine.
"""
import os
import time
import argparse
from datetime import date
from threading import Thread, Lock
import mysql.connector
import cv2
import pycuda.autoinit # This is needed for initializing CUDA d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.