source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
controller.py | """A pythonic Xbox 360 controller library for Linux.
Partly inspired by the following libraries/codes:
- https://www.freebasic.net/forum/viewtopic.php?t=18068 (libjoyrumble)
- https://gist.github.com/rdb/8864666
"""
import os
import select
import struct
import sys
import time
from array import array
from collections ... |
tinybot.py | # -*- coding: utf-8 -*-
"""
Buddybot by odsum (https://github.com/odsum)
Based off Tinybot by Nortxort (https://github.com/nortxort/tinybot-rtc)
"""
import logging
import threading
import time
import pinylib
from apis import youtube, other, locals_
from modules import register, welcome, spam, tokes, voting
from page ... |
run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
sMRIPrep: Structural MRI PREProcessing workflow
===============================================
"""
def main():
"""Entrypoint"""
opts = get_parser... |
Day12-00-1.py | ## 영상 처리 및 데이터 분석 툴
from tkinter import *; import os.path ;import math
from tkinter.filedialog import *
from tkinter.simpledialog import *
## 함수 선언부
def loadImage(fname) :
global window, canvas, paper, filename, inImage, outImage, inW, inH, outW, outH
fsize = os.path.getsize(fname) # 파일 크기 확인
inH = inW = ... |
robot_controller.py | '''
'''
import sys
import threading
import time
from ..wpilib import _wpilib
from ..wpilib.core import SimpleRobot
from .sim_manager import SimManager
class RobotController(object):
'''
This manages the active state of the robot. At the moment, this
isn't coded as a singleton, but because o... |
__main__.py | """isort:skip_file"""
# first, logging level lower
import os
os.environ["KCFG_KIVY_LOG_LEVEL"] = os.environ.get("KCFG_KIVY_LOG_LEVEL", "warning")
if "KIVY_AUDIO" not in os.environ:
os.environ["KIVY_AUDIO"] = "sdl2" # some backends hard crash / this seems to be most stable
# next, icon
from katrain.core.utils imp... |
runner.py | # Python 3
# Copyright 2019 Mycroft AI Inc.
# Modified 2021 Seeed Studio STU, Dmitry Maslov
#
# 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
#... |
__init__.py | """Library to mux several communication on a single interface
MCOM sends frames of at most 265 bytes.
Each frame is acknownledge by the other side using channel 0.
Acknowledge can validate only part of the packet, this is called a "partial ack".
In case of partial ack:
- The sender discards only the amount of data whi... |
guiCocoaCommon.py | # MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import objc
from AppKit import *
import utils
from collections import deque
try: pools
e... |
rcbenchmark_udp.py | import socket
import time
import json
import threading
UDP_IP = "127.0.0.1"
UDP_PORT_WRITE = 55047
UDP_PORT_READ = 64126
sock_write = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock_read = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # ... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
tasks.py | import requests
from threading import Thread
from django.db import connection
from django.utils import timezone
from .models import Player
class OPENDOTA:
PLAYERS = "https://api.opendota.com/api/players/{account_id}"
def _update_player_mmr(player_id):
try:
player = Player.objects.get(pk=player_id)... |
predict.py | #!/usr/bin/env python
# Use existing model to predict sql from tables and questions.
#
# For example, you can get a pretrained model from https://github.com/naver/sqlova/releases:
# https://github.com/naver/sqlova/releases/download/SQLova-parameters/model_bert_best.pt
# https://github.com/naver/sqlova/releases/d... |
process_queue_3.py | #!/usr/bin/python
import pprint
import requests
import sys
from multiprocessing import Process, Queue
def get_extract(extracts, idx, title, id):
print("RUNNING PROCESS %s" % idx)
print("GETTING PAGE %s EXTRACT" % idx)
content = requests.get('https://en.wikipedia.org/w/api.php?format=json&action=query&prop=... |
main.py | #!/usr/bin/python
from p4app import P4Mininet
from p4app import P4Mininet, P4Program
from mininet.topo import Topo
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.net import Mininet
from mininet.log import lg
from mininet.util import dumpNodeConnections, custom
from mininet.cli imp... |
threading_example.py | from threading import Thread
import requests
def read_page_source(url, thread_id):
html_code = requests.get(url)
print(thread_id)
# print(html_code.text)
if __name__ == "__main__":
url = "https://www.harshadkavathiya.com"
thread_list = []
for i in range(1000):
each_thread = Thread(targ... |
tween_machine.py | """
tween_machine.py
"""
# Built-in
import contextlib
import json
import logging
import logging.config
import os
import sys
import tempfile
import urllib2
import webbrowser
from threading import Thread
import xml.etree.cElementTree as etree
from maya.api import OpenMaya
# Third-party
import maya.cmds as mc
import ma... |
run.py | """Methods that support running tests"""
import time
import collections
import multiprocessing
import warnings
from alarmageddon.config import Config
from alarmageddon.reporter import Reporter
from alarmageddon.publishing import hipchat, pagerduty, graphite, junit
from alarmageddon.validations.validation import Prior... |
camRecorder.py | #!/usr/bin/python3
"""
This module enables videos to be recorded in response to several triggers. It can save video from a few seconds before the trigger
to several seconds after the trigger.
"""
import threading, queue, time, pathlib, shutil
from subprocess import Popen, PIPE
from flask import jsonify
from flaskextras... |
webserver.py | import socket
import webframe
import re
import multiprocessing
class WSGIServer(object):
def __init__(self):
# 创建套接字
self.tcp_server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 避免服务器主动关闭导致的端口占用
self.tcp_server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEA... |
main.py | import threading
import time
from context import screengrid
def foo():
main_grid = screengrid.Grid()
main_grid.overlay(click=True)
time.sleep(5)
main_grid.font_color = 100, 100, 100
def main():
threading.Thread(target=foo, daemon=True).start()
input()
if __name__ == '__main__':
main() |
test_threadpool.py |
import functools
import sys
import threading
import time
import unittest
from common import TestCase
import pyuv
class WorkItem(object):
def __init__(self, func, *args, **kw):
self._cb = functools.partial(func, *args, **kw)
self.result = None
self.exc_info = None
def __call__(self)... |
common.py | """Test the helper method for writing tests."""
import asyncio
import collections
from collections import OrderedDict
from contextlib import contextmanager
from datetime import timedelta
import functools as ft
from io import StringIO
import json
import logging
import os
import sys
import threading
import time
import uu... |
motion_recorder.py | #!/usr/bin/python3
import io
import os
import threading
import picamera
import picamera.array
import queue
import signal
import logging
import time
import numpy as np
from PIL import Image
from motion_vector_reader import MotionVectorReader
current_dir = os.path.dirname(os.path.realpath(__file__))
class MotionRecor... |
threading_utils.py | # Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Classes and functions related to threading."""
import functools
import inspect
import logging
import os
import sys
import threading
import tim... |
test_generator.py | import functools
import os
import threading
import unittest
import numpy
import pytest
import cupy
from cupy import cuda
from cupy.random import _generator
from cupy import testing
from cupy.testing import attr
from cupy.testing import condition
from cupy.testing import hypothesis
def numpy_cupy_equal_continuous_di... |
worker.py | from multiprocessing import Process, Queue
from urllib.parse import urlparse
import requests, sys
import pandas as pd
import sqlalchemy as s
from sqlalchemy.ext.automap import automap_base
from sqlalchemy import MetaData, and_
import statistics, logging, os, json, time
import numpy as np
import scipy.stats
import datet... |
NmakeSubdirs.py | # @file NmakeSubdirs.py
# This script support parallel build for nmake in windows environment.
# It supports Python2.x and Python3.x both.
#
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#
# Import Modules
#
from __future__ import print_function... |
migrator.py | #!/usr/bin/env python
##############################################################################
#
# Small Files Aggregation Migrator.
# Description is in ../../../doc/small_files_hld.pdf
#
##############################################################################
# system import
import sys
import os
import t... |
concurrent_image.py | """ Learning Concurrency in Python - Chapter 01 - concurrent image """
import threading
import urllib.request
import time
def download_image(image_path, file_name):
""" Download image. """
print("Downloading Image from ", image_path)
urllib.request.urlretrieve(image_path, file_name)
print("Completed ... |
cluster.py |
# Copyright IBM Corp, All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
import datetime
import logging
import os
import sys
import time
from uuid import uuid4
from threading import Thread
import socket
import requests
from pymongo.collection import ReturnDocument
sys.path.append(os.path.join(os.path.dir... |
tmule.py | #! /usr/bin/env python
from __future__ import print_function, absolute_import
from libtmux import Server
from yaml import load
from logging import error, warning, info, debug, basicConfig, INFO
from pprint import pformat
from time import sleep
import signal
import os
import sys
from os import path
import argparse
from... |
search.py | #!/usr/bin/python3
import gi
gi.require_version('Gtk', '3.0')
import sys, os, threading, re, gettext
from gi.repository import Gio, Gtk, GLib, GObject, Pango, GdkPixbuf
gettext.install("placesCenter@scollins", os.environ['HOME'] + "/.local/share/locale")
def launch(path):
fileObj = Gio.File.new_for_path(path)
... |
server.py | import os
import signal
import ssl
import threading
from base64 import b64encode
from contextlib import contextmanager
from textwrap import dedent
from types import TracebackType
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Type
from unittest.mock import Mock
from werkzeug.serving import Ba... |
split_model.py | # Copyright 2016-2020 Ivan Alles. See also the LICENSE file.
"""
Current generator has the following structure:
input (512) -> start -> (size, channels) repeated (size * 2, channels / 2) -> to_rgb (size, 3)
where repeated is the following:
(size, channels) -> upsampling (size * 2, channels) -> conv (siz... |
RPP.py | #!/usr/bin/env python
'''module for real time place preference test'''
import os
import sys
import time
import datetime
import copy
import threading
import queue
import argparse
import subprocess
import cv2
import skvideo.io
import numpy as np
from gpiozero import LED
from picamera import PiCamera
from picamera.array ... |
test_threaded_import.py | # This is a variant of the very old (early 90's) file
# Demo/threads/bug.py. It simply provokes a number of threads into
# trying to import the same module "at the same time".
# There are no pleasant failure modes -- most likely is that Python
# complains several times about module random having no attribute
# randran... |
websocket_client.py | # cbpro/WebsocketClient.py
# original author: Daniel Paquin
# mongo "support" added by Drew Rice
#
#
# Template object to receive messages from the Coinbase Websocket Feed
from __future__ import print_function
import json
import base64
import hmac
import hashlib
import time
from threading import Thread
from websocket ... |
test_misc.py | from __future__ import with_statement
import threading, time
from nose.tools import assert_equal # @UnresolvedImport
from whoosh.support.filelock import try_for
from whoosh.util import length_to_byte, byte_to_length
from whoosh.support.testing import TempStorage
def test_filelock_simple():
with TempStorage("si... |
test_lock.py | import os.path
import multiprocessing
import sys
import time
import pytest
from nengo.utils.lock import FileLock, TimeoutError
def acquire_lock(filename):
lock = FileLock(filename, timeout=0.01, poll=0.01)
try:
lock.acquire()
except TimeoutError:
sys.exit(0)
else:
sys.exit(1)... |
service.py | #!/usr/bin/env python
import http.client
import os
import subprocess
import time
from multiprocessing import Process
import threading
from MagicAuto.appium.common.common import common as cm
from MagicAuto.common.operateYaml import getyaml
def poll_url(host, port, path, timeout_ms):
time_started_sec = ... |
Hiwin_RT605_ArmCommand_Socket_20190627183447.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
event.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Process, Event
import time
def order(event):
print('点完菜,等待上菜……')
while not event.is_set():
time.sleep(0.6)
print('菜好了没?') if not event.is_set() else print('真的来了')
# event.wait()
print('开吃!')
def serve(event):
... |
test_agent.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... |
worker_test.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
process_executor.py | ###############################################################################
# Re-implementation of the ProcessPoolExecutor more robust to faults
#
# author: Thomas Moreau and Olivier Grisel
#
# adapted from concurrent/futures/process_pool_executor.py (17/02/2017)
# * Backport for python2.7/3.3,
# * Add an extra m... |
gcp_janitor.py | #!/usr/bin/env python3
# Copyright 2016 The Kubernetes 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 appl... |
tplink_device.py | """TP-Link adapter for WebThings Gateway."""
from gateway_addon import Device
from pyHS100 import SmartDevice, SmartDeviceException
import threading
import time
from .tplink_property import TPLinkBulbProperty, TPLinkPlugProperty
from .util import hsv_to_rgb
_POLL_INTERVAL = 5
class TPLinkDevice(Device):
"""TP... |
PC_Miner.py | #!/usr/bin/env python3
"""
Duino-Coin Official PC Miner 2.75 © MIT licensed
https://duinocoin.com
https://github.com/revoxhere/duino-coin
Duino-Coin Team & Community 2019-2021
"""
from time import time, sleep, strptime, ctime
from hashlib import sha1
from socket import socket
from multiprocessing import L... |
hello.py | import os
from threading import Thread
from flask import Flask, render_template,session, redirect, url_for, flash
from flask.ext.script import Manager, Shell
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from wtf... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau... |
nonlocal_reader.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import socket
import threading
def isset(obj):
if obj == 0: return 0
return 1
def getMethod(header):
if 'CONNECT' in header[0:10]: return 1
return 0
def getHost(header):
rn = '\r\n'
kw = 'Host: '
if no... |
scheduling_manager.py | import os
import time
import logging
import threading
from xml.etree import ElementTree
from galaxy import model
from galaxy.util import plugin_config
import galaxy.workflow.schedulers
log = logging.getLogger( __name__ )
DEFAULT_SCHEDULER_ID = "default" # well actually this should be called DEFAULT_DEFAULT_SCHEDU... |
osa_online_extend.py | #!/usr/bin/python
"""
(C) Copyright 2020 Intel Corporation.
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 ... |
discord.py | # coding: utf-8
# Simple module to send messages through a Discord WebHook
# post a message to discord api via a bot
# bot must be added to the server and have write access to the channel
from __future__ import unicode_literals
import json
from threading import Thread, Event
import time
import requests
import websock... |
engine.py | from ..math.geometry import Ray,Vector
from .objects import Plane,Sphere
from ..image.color import Color
from .light import PointLight,AmbientLight,DirectionalLight
from multiprocessing import Process,Manager
from threading import Thread
import math
class Engine:
BIAS = 0.0000001
def __init__(self,eye,environmen... |
tello.py | # modified from https://tello.oneoffcoder.com/swarm.html
import threading
from threading import Thread
import socket
import time
from turtle import pos
import netifaces
import netaddr
from netaddr import IPNetwork
from collections import defaultdict
import binascii
from datetime import datetime
import itertools
class... |
publisher.py | #! /usr/bin/env python3
import time
import threading
from sensors import pms5003, bme680, scd30
from influxdb import InfluxDBClient
DBG = False
PERIOD = 300
def use_db_dbg(db_client):
db_name = 'sensors_dbg'
if not db_name in [d['name'] for d in db_client.get_list_database()]:
db_client.create_databa... |
test_util_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
datasources.py | """This module holds classes that can be used as data soures. Note that it is
easy to create other data sources: A data source must be iterable and
provide dicts that map from attribute names to attribute values.
"""
# Copyright (c) 2009-2020, Aalborg University (pygrametl@cs.aau.dk)
# All rights reserved.
# Re... |
DLProgress.py |
import time, os
from . import DLProcessor
from .packer import Packer
import gc
import traceback
from . import DLCommon as cv
class TimeStatus(Packer, object):
def __init__(self):
self.go_startTime = None
self.go_endtime = None
self.go_lastTime = 0
self.go_end = False
se... |
interface.py | # Copyright (c) 2016 Ansible by Red Hat, Inc.
#
# 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 Licen... |
main.py | #! /usr/bin/env python3
import sys
from os.path import expanduser
import os
from multiprocessing import Pipe, Process
import markdown2
from PyQt5.QtWidgets import (
QSplitter, QStatusBar, QWidget,
QHBoxLayout,
QApplication,
QMainWindow,
QAction,
QFileDialog,
QPlainTextEdit
)
from PyQt5.QtG... |
manager.py | import pickle
import threading
from room.room import Room
from API import User, UserException
class Manager:
def __init__(self, rooms=None, ship=None):
if rooms is None:
rooms = []
if ship is None:
ship = {}
assert isinstance(rooms, list) and isinstance(ship, dict)... |
conftest.py | import os
import sys
import time
import pytest
import fastwsgi
from enum import Enum
from contextlib import contextmanager
from multiprocessing import Process, set_start_method
from tests.apps_under_test import (
basic_app,
wsgi_app,
flask_app,
validator_app,
start_response_app
)
HOST = "127.0.0.... |
bruter.py | # Date: 12/28/2018
# Author: Mohamed
# Description: Bruter
from time import time, sleep
from lib.browser import Browser
from lib.display import Display
from threading import Thread, RLock
from lib.proxy_manager import ProxyManager
from lib.password_manager import PasswordManager
from lib.const import max_tim... |
rdd.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... |
Easel.py | import threading
from time import sleep
import GLViewer as glv
import PyQt5.QtCore as QtCore
from PyQt5.QtGui import QKeyEvent, QMouseEvent, QWheelEvent
from tk3dv.common import utilities
import math
# Some code to manage the module
class Easel(glv.GLViewer):
def __init__(self, OtherModules=[], argv=None):
... |
api.py | from threading import Thread
import requests
class EdgeNet(object):
def __init__(self, location, registry):
self.location = location
self.registry = registry
self.get_candidate_edge_clusters()
self.pick_edge_cluster()
def set_location(self, location):
self.location = l... |
irc.py | # coding=utf8
"""
irc.py - An Utility IRC Bot
Copyright 2008, Sean B. Palmer, inamidst.com
Copyright 2012, Edward Powell, http://embolalia.net
Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
Licensed under the Eiffel Forum License 2.
Willie: http://willie.dftba.net/
When working on core IRC protocol related ... |
transport_test.py | import unittest
from mock import MagicMock, patch
import simplejson as json
from meniscus import transport
class WhenTestingZeroMqReceiver(unittest.TestCase):
def setUp(self):
self.host = '127.0.0.1'
self.port = '5000'
self.connect_host_tuple = (self.host, self.port)
self.connec... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import (verbose, import_module, cpython_only,
requires_type_collecting)
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thread
import threading
import... |
utils.py | import socket, logging, hashlib, random, sys, zmq, time, pickle, queue
from util.colors import REDB, BLUEB, YELLOWB
from util.params import format, datefmt, BROADCAST_PORT, login, localhost
from socket import socket, AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR, SO_BROADCAST, timeout
from multiprocessing import Proces... |
ellie_brust_monitor.py | # Copyright 2021 by Dong Trung Son, Nueremberg University.
# Email: trungsondo68839@th-nuernberg.de
# All rights reserved.
# This file is part of the Ellie-Project,
# and is released under the "MIT License Agreement". Please see the LICENSE
# file that should have been included as part of this package.
import sys
sys.p... |
object_detection_node.py | #################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"). ... |
test_object_storage_multipart.py | # coding: utf-8
# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
import hashlib
import json
import os
import pytest
import threading
import time
import oraclebmc_cli
from . import util
CONTENT_OUTPUT_FILE = 'tests/resources/content_output.txt'
LARGE_CONTENT_FILE_SIZE_IN_MEBIBYTES = 20
DE... |
draw_grid.py | import pygame, threading, time
from position import Positions_And_Colors, WHITE, RED, BACKGROUND
import searchs
global is_empty
is_empty = False
# Color of the grids
DARK_GREY = (105, 105, 105)
# Create the grids
def create_grid(rows, width):
grid = []
gap = width // rows
for row in range(rows):
... |
mttcpserv.py | import threading
import socket
import time
class TcpTimeServ:
def __init__(self, host='', port=21567):
self.addr = (host, port)
self.serv = socket.socket()
self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.serv.bind(self.addr)
self.serv.listen(1)
def ... |
battery.py | #INCOMPLETE
#this is mostly a proto with a bit of parsing
import socket
from multiprocessing import Process, Value
import TrboDataSvc.util as util
import logging
class BatteryMgmtOpCodes():
RADIO_HELLO = b'\x02'
HELLO_ACK = b'\x03'
BATT_REQUEST = b'\x04'
BATT_RESPONSE = b'\x05'
class BatteryOTA():
... |
simulation.py | '''
Created on Oct 12, 2016
@author: mwittie
'''
import network
import link
import threading
from time import sleep
##configuration parameters
router_queue_size = 0 #0 means unlimited
simulation_time = 1 #give the network sufficient time to transfer all packets before quitting
if __name__ == '__main__'... |
generate_dataset.py | r"""Generates CLEVR-Dialog dataset.
Needs access to the following files:
synonyms: Contains several synonyms for each word in the question/caption.
caption templates: List of caption templates.
question templates: List of question templates.
metainfo: Meta-information related to attributes and values of CLEVR objects.... |
suicidegirls.py | import time, subprocess, os.path, re, multiprocessing, threading
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
class SuicideGirls:
driver = None
dispatcher... |
AVR_Miner.py | #!/usr/bin/env python3
"""
Duino-Coin Official AVR Miner 3.0 © MIT licensed
https://duinocoin.com
https://github.com/revoxhere/duino-coin
Duino-Coin Team & Community 2019-2021
"""
from os import _exit, mkdir
from os import name as osname
from os import path
from os import system as ossystem
from platform import machin... |
smpcrt_gui.py | #!/usr/bin/env python
import smpcrt
import os
import threading
import ScrolledText
import tkFileDialog
import tkMessageBox
import ttk
import sys
import Tkinter
class StdoutRedirector:
def __init__(self, text_area):
self.text_area = text_area
def write(self, str):
self.text_area.configure(st... |
test_rpc_threaded.py | import platform
import socket
import threading
import pytest
import capnp
from kamodo import kamodofy, Kamodo, get_defaults, KamodoClient
import numpy as np
import time
@kamodofy(units='kg')
def remote_f(x=np.linspace(-5, 5, 33)):
print('remote f called')
print(f'remote f defaults: {get_defaults(remote_f)}... |
test_util.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
test_mpi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""MPI Master and Worker tests."""
import unittest
from threading import Thread
from hivemind.util import json_to_tasks, read_csv, tags, join
from hivemind.mpi import Master, Worker
from hivemind.pipeline import rank_by_successors
from fake_mpi import FakeMPIWorld
def... |
process-pipe.py | ###
# Multiprocessing pipe test.
#
# License - MIT.
###
import os
from multiprocessing import Process, Pipe
# process_function - Process test function.
def process_function(pipe_connect):
# {
pipe_connect.send('Hello')
recv_data = pipe_connect.recv()
print('Child process received: %s' % recv_data)
# }
... |
remote-commands-servers.py | #!/usr/bin/python
##-------------------------------------------------------------------
## @copyright 2017 DennyZhang.com
## Licensed under MIT
## https://www.dennyzhang.com/wp-content/mit_license.txt
##
## File : remote-commands-servers.py
## Author : Denny <contact@dennyzhang.com>
## Description :
## --
## Created ... |
server.py | #!/usr/bin/env python
######################################################
# Author: Andrea Fioraldi <andreafioraldi@gmail.com> #
# License: BSD 2-Clause #
######################################################
"""
classic rpyc server running a SlaveService + angrdbg + IPython shell
usa... |
timeout.py | #!/usr/bin/python
# coding=utf-8
import time
from threading import Thread
import signal
import errno
from functools import wraps
from logni import log
import os
class TimeoutError(Exception):
pass
def timeout(seconds=30, error_message=os.strerror(errno.ETIME)):
def decorator(func):
def handleTimeout(signum, f... |
multi_threading.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time, threading
# 新线程执行的代码:
def loop():
print('thread %s is running...' % threading.current_thread().name)
n = 0
while n < 5:
n = n + 1
print('thread %s >>> %s' % (threading.current_thread().name, n))
time.sleep(1)
print('th... |
worker.py | import zmq
import logging
import multiprocessing
IP = '192.168.30.26'
PORT = 31001
WORKERS = 4
XFRAMES = 1 # print every nth frame to stdout
logging.basicConfig(format='%(asctime)s | %(levelname)s: %(message)s', level=logging.NOTSET)
def worker(id, ip, port):
context = zmq.Context()
receiver = context.socket... |
zktransaction.py | #!/usr/bin/python
"""
Distributed id and lock service for transaction support.
"""
import cassandra_env.cassandra_interface
import logging
import os
import re
import sys
import threading
import time
import urllib
import kazoo.client
import kazoo.exceptions
from google.appengine.datastore import entity_pb
from kazoo.e... |
managers.py | ###############################################################################
# compat for UNIX 2.7 and 3.3
# Manager with LokyContext server.
# This avoids having a Manager using fork and breaks the fd.
#
# author: Thomas Moreau and Olivier Grisel
#
# based on multiprocessing/managers.py (17/02/2017)
# * Ov... |
person.py | from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.ext.mutable import MutableDict
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import deferred
from sqlalchemy import orm
from sqlalchemy import text
from sqlalchemy import func
from app import db
from models import product # needed for s... |
cozmomock.py | import cozmo
from cozmo.util import degrees, radians, distance_mm, speed_mmps, Position, Pose, Rotation, pose_z_angle, rotation_z_angle
import time
import threading
import math
import quaternion
import json
class CozmoBot:
def __init__(self, aruco):
self._wsClient = None
self._dataPubThread = None
# Empty objec... |
gj_gateway.py | # 国金交易客户端 + easytrader 接口
# 华富资产 李来佳 28888502
import os
import sys
import copy
import csv
import dbf
import traceback
import pandas as pd
from typing import Any, Dict, List
from datetime import datetime, timedelta
from time import sleep
from functools import lru_cache
from collections import OrderedDict
from multiproc... |
parserdata.py | # Copyright (c) 2010-2013, Regents of the University of California.
# All rights reserved.
#
# Released under the BSD 3-Clause license as published at the link below.
# https://openwsn.atlassian.net/wiki/display/OW/License
import json
import logging
import struct
import threading
import paho.mqtt.client as mqtt
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.