source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
midi_hub.py | """A module for interfacing with the MIDI environment."""
import abc
from collections import defaultdict
from collections import deque
import Queue
import re
import threading
import time
# internal imports
import mido
import tensorflow as tf
# TODO(adarob): Use flattened imports.
from magenta.common import concurren... |
webserver.py | #!/usr/bin/env python3
from api.http_server import HttpServer
from database import LoginDatabase
from functools import partial
from forum import Forum
from html import escape
import base64
import hashlib
import json
import os
import socket
import threading
import time
import utils
CONFIG_KEYS = ("host", "port", "root... |
test_worker.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import shutil
import signal
import subprocess
import sys
import time
import zlib
from datetime import datetime, timedelta
from multiprocessing import Process
from time import ... |
deadlock.py |
import threading
import time
resource1 = threading.RLock()
resource2 = threading.RLock()
def t1():
resource1.acquire()
time.sleep(1)
print('Deadlock')
resource2.acquire()
resource1.release()
resource2.release()
def t2():
resource2.acquire()
time.sleep(2)
print("deadlock")
r... |
gk_ia_simulator.py | import pika
import yaml
import threading
import sys
# The topic to which service instantiation requests
# of the GK are published
SERVICE_CREATE_TOPIC = 'service.instances.create'
# The topic to which available vims are published
INFRA_ADAPTOR_AVAILABLE_VIMS = 'infrastructure.management.compute.list'
# The topic to wh... |
compreface_webcam_detection_demo.py | """
Copyright(c) 2021 the original author or 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
https: // www.apache.org/licenses/LICENSE-2.0
Unless required by ap... |
concurrent.py | # Cook book: Chapter 12: Concurrency
# recepe 12.1: Starting Threads
import time
from threading import Thread
class CountDownTask:
def __init__(self):
self._running = True
def terminate(self):
self._running = False
def countdown(self, n):
while n > 0 and self._running:
... |
RotationWatcher.py | # -*- coding: utf-8 -*-
import os
try:
import Queue
except ImportError:
import queue as Queue
import subprocess
import threading
import time
import traceback
import tempfile
from APIDefine import *
import logging
__dir__ = os.path.dirname(os.path.abspath(__file__))
# self.__logger = logging.getLogger('deviceapi'... |
test_replication.py | """TestCases for distributed transactions.
"""
import os
import time
import unittest
import weakref
from test_all import db, test_support, have_threads, verbose, \
get_new_environment_path, get_new_database_path
#----------------------------------------------------------------------
class DBR... |
manager.py | #!/usr/bin/env python3
import os
import time
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import datetime
import textwrap
from typing import Dict, List
from selfdrive.swaglog import cloudlog, add_logentries_handler
from common.basedir import BASEDIR, PARAMS
from common.android impo... |
GUI.py | #created by Dmitrey
#from numpy import ndarray
#from time import strftime
from threading import Thread
from openopt import __version__ as ooversion
from setDefaultIterFuncs import BUTTON_ENOUGH_HAS_BEEN_PRESSED, USER_DEMAND_EXIT
from ooMisc import killThread
import platform#, pylab
TkinterIsInstalled = True# sometime... |
chatbot.py | import requests
import json
import re
import threading
import time
import string
API_KEY = "tTwOPEfNOXmB"
PROJECT_TOKEN = "ts9X3T1m_aCb"
RUN_TOKEN = "tgNTTV9TKzkz" # "toi8Txr1XDon"
startTime = time.time()
auto_update = False
class Data:
def __init__(self, api_key, project_token):
self.api_key = api_key
... |
kb_BwaServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
preprocess.py | import os, sys, tempfile, glob, argparse
sys.path.insert(0, '.')
import shutil
import numpy as np
from skimage import io as sio
from pyutils.iolib.video import getFFprobeMeta
from utils import gen_eac2eqr_maps, save_pgm
from pyutils.iolib.audio import save_wav, AudioReader
from pyutils.iolib.video import VideoR... |
spider.py | import inspect
import os
import time
from enum import Enum
from functools import partial
from queue import Queue
from threading import Thread, Lock
from typing import Optional, Generator, Any, Union, \
MutableSequence, Sequence, Tuple, List, Callable, Iterable
from urllib.parse import urljoin, urlparse
import requ... |
test_spark_dataset_converter.py | # Copyright (c) 2020 Databricks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import unittest.mock
import queue as pyqueue
import time
import io
import itertools
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import subprocess
import struct
import operator
import p... |
tasks.py | """
Tasks will be fired when executing specific actions such as a policy
upload, refresh, or making backups.
This module provides that ability to access task specific attributes
and optionally poll for status of an operation.
An example of using a task poller when uploading an engine policy
(use `wait_for_finish=True... |
__init__.py | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
5.py | # -*- coding: utf-8 -*-
import KRIS
from KRIS.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 import BeautifulSoup
from urllib import urlopen
import r... |
gobgp.py | # Copyright (C) 2015 Nippon Telegraph and Telephone 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 appli... |
main.py | #! /usr/bin/python3
# -*- coding: utf-8 -*-
from logging.handlers import RotatingFileHandler
import RPi.GPIO as GPIO
import time
import logging
import threading
from FlowMeter import FlowMeter
from Logger import logger
from TemperatureSensor import TemperatureSensor
from Valve import Valve
GPIO_VALVE = 23
def flo... |
xmlrpc.py | # -*- coding: utf-8 -*-
"""XML RPC proxy server and client."""
import logging
import SimpleXMLRPCServer
import SocketServer
import threading
import xmlrpclib
from xml.parsers import expat
from plaso.multi_processing import rpc
class XMLRPCClient(rpc.RPCClient):
"""Class that defines the XML RPC client."""
_RP... |
queue_runner.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... |
bark_react.py | from __future__ import annotations
import logging
import queue
import random
import smtplib
from socket import gethostname
import threading
import time
from typing import Sequence
from .BaseSystem import BaseSystem
from pydub import AudioSegment
from simpleaudio import play_buffer
from simpleaudio.shiny import PlayOb... |
train_abstractive.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import os.path as path
import torch
import torch.nn as nn
from pytorch_transformers import BertTokenizer
import distributed
from models import data_loa... |
local_proxy.py |
from datetime import datetime
import io
import requests
import sys
import threading
from modulate import modulate as mod
from parse_modulated import parse as dem
from bots import *
from models import *
from player import *
from space_viz import SpaceUI
KONTUR_URL = "https://icfpc2020-api.testkontur.ru"
API_KEY = "... |
global.py | import json
import multiprocessing as mp
import socket
import time
import psutil
from asynch.common import encode_bytes, decode_bytes, MAX_SIZE
from multiprocess.socket.src.asynch.worker import Worker, thread as worker_thread
class GlobalState():
BEGINNING = 1
class GlobalProcess():
def __init__(self):
... |
Server_Main_ChatRoom_20200517184615.py | import os
import sys
import threading
import time
import socket
import select
import errno
import queue
import json
from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QFile
from logzero import logger as log
from Options_Server import Ui_Dia... |
parallelEnv.py | # From [OpenAI](https://github.com/openai/baselines/baselines/common/vec_env/subproc_vec_env.py)
import numpy as np
import gym
from multiprocessing import Process, Pipe
from abc import ABC, abstractmethod
class CloudpickleWrapper(object):
"""
Uses cloudpickle to serialize contents (otherwise multiprocessing t... |
face_streamer.py | import imutils
from imutils.video import VideoStream, FileVideoStream
from imutils import face_utils
import cv2
from time import time, sleep, perf_counter, process_time
import numpy as np
import dlib
from collections import OrderedDict
from utils import *
import queue
import threading
import matplotlib.pyplot as plt
fr... |
omsagent_mc.py | #!/usr/bin/env python
#
# OmsAgentForLinux Extension
#
# Copyright 2015 Microsoft 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.... |
substances.py | # -*- coding: utf-8 -*-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
### Alias : PosServer.substances & Last Modded : 2021.11.07. ###
Coded with Python 3.10 Grammar by IRACK000
Description : ?
Reference : [자동 시작] https://blog.naver.com/PostView.nhn?blogId=hunee726&logNo=220976778583&par... |
moviemeta.py | """Movie-meta
Meta movie allows one to generate movie meta based on contents of directory.
Generates movie params from available IMDB API and helps you sort movie based
on ratings, genere, title etc.
@TODO:
1. Automated duplicacy detection.
2. Path watch module. Generate meta whenever new content in existing ... |
generate_FV3LAM_wflow.py | #!/usr/bin/env python3
import os
import sys
import platform
import subprocess
from multiprocessing import Process
from textwrap import dedent
from datetime import datetime,timedelta
from python_utils import print_info_msg, print_err_msg_exit, import_vars, cp_vrfy, cd_vrfy,\
rm_vrfy, ln_vrfy, ... |
comparator.py | #
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appl... |
test.py | import csv
import os
import subprocess
import threading
# Gather the packages to test.
PREFIX = './packages/node_modules/'
CISCOSPARK = os.path.join(PREFIX, '@ciscospark')
WEBEX = os.path.join(PREFIX, '@webex')
PROD_ENV_VARS = {
# 'ACL_SERVICE_URL': 'https://acl-a.wbx2.com/acl/api/v1', ?
'ATLAS_SERVICE_URL': 'ht... |
tests.py | import os
import shutil
import sys
import tempfile
import threading
import time
import unittest
from datetime import datetime, timedelta
from io import StringIO
from pathlib import Path
from urllib.request import urlopen
from django.core.cache import cache
from django.core.exceptions import SuspiciousFileOperation
fro... |
cluster_coordinator_test.py | # Copyright 2020 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 applicable ... |
Plugwise-2-web.py | #!/usr/bin/env python
# Copyright (C) 2014, 2015 Seven Watt <info@sevenwatt.com>
# <http://www.sevenwatt.com>
#
# This file is part of Plugwise-2.
#
# Plugwise-2 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation... |
wsb.py | import praw, time, pandas as pd, json, threading
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from praw.models import Submission
from typing import Dict, List, Tuple
from timeit import default_timer as timer
from dotenv import load_dotenv, dotenv_values
from config.symbols import us, blacklist
from conf... |
configure_and_test_integration_instances.py | from __future__ import print_function
import argparse
import os
import uuid
import json
import ast
import subprocess
import sys
import zipfile
from datetime import datetime
from enum import IntEnum
from pprint import pformat
from time import sleep
from threading import Thread
from distutils.version import LooseVersion... |
app.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
import re
import time
import urllib
import lxml
import threading
import time
import requests
import base64
import json
import ast
import http.cookiejar as cookielib
from bs4 import BeautifulSoup
from selenium... |
popen_spawn.py | """Provides an interface like pexpect.spawn interface using subprocess.Popen
"""
import os
import threading
import subprocess
import sys
import time
import signal
import shlex
try:
from queue import Queue, Empty # Python 3
except ImportError:
from Queue import Queue, Empty # Python 2
from .spawnbase import ... |
star_truth.py | """
Module to write truth catalogs for stars using the star parameters db as input.
"""
import os
import sqlite3
from multiprocessing import Process, Lock
import numpy as np
import pandas as pd
from .write_sqlite import write_sqlite
from .synthetic_photometry import SyntheticPhotometry, find_sed_file
__all__ = ['Sta... |
devserver.py | """Development Server.
This module provides functionality for blag's development server. It
automatically detects changes in certain directories and rebuilds the
site if necessary.
"""
import os
import logging
import time
import multiprocessing
from http.server import SimpleHTTPRequestHandler, HTTPServer
from functo... |
identification.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import *
import tkinter.messagebox
import pymysql
from PIL import Image, ImageTk, ImageGrab
from hyperlpr import *
import cv2
import threading
from threading import Thread
import lib.img_function as predict... |
main.py | import pygame, sys, random, json, time, os, button
from cryptography.fernet import Fernet
from threading import Thread
from time import sleep
key = "FuGxRMgLoA_lW62jYKpWoW0ieYUBMaryvlAOqp-aQpY="
f = Fernet(key)
def crypt_file():
with open("score.txt", "rb") as original_file:
original = original_file.read(... |
controller.py | import calendar
import logging
from setproctitle import setproctitle
from threading import Thread
import time
import datetime
import uuid
from motorway.decorators import batch_process
from motorway.messages import Message
from motorway.intersection import Intersection
from motorway.utils import percentile_from_dict, se... |
child_process_executor.py | """Facilities for running arbitrary commands in child processes."""
import os
import queue
import sys
from abc import ABCMeta, abstractmethod
from collections import namedtuple
import six
from dagster import check
from dagster.seven import multiprocessing
from dagster.utils import delay_interrupts
from dagster.utils... |
test_cache_tile.py | # This file is part of the MapProxy project.
# Copyright (C) 2011-2013 Omniscale <http://omniscale.de>
#
# 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/LI... |
jaxpr_effects_test.py | # Copyright 2022 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
__init__.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
service.py | # -*- coding: utf-8 -*-
from resources.lib import proxy
from codequick import Script
from codequick.script import Settings
from socketserver import ThreadingTCPServer
import threading
from xbmc import Monitor, executebuiltin
from kodi_six import xbmcgui
def serveForever(handler):
try:
handler.serve_forev... |
test_libcluon_wrappers.py | import time
import gc
import sys
import threading
from datetime import datetime
import pytest
from pycluon._pycluon import (
Envelope,
OD4Session,
UDPSender,
UDPReceiver,
TCPConnection,
TCPServer,
SharedMemory,
)
def test_envelope_setters_getters():
e = Envelope()
assert e.data_... |
long-short.py | import alpaca_trade_api as tradeapi
import threading
import time
import datetime
API_KEY = "YOUR_API_KEY_HERE"
API_SECRET = "YOUR_API_SECRET_HERE"
APCA_API_BASE_URL = "https://paper-api.alpaca.markets"
class LongShort:
def __init__(self):
self.alpaca = tradeapi.REST(API_KEY, API_SECRET, APCA_API_BASE_URL, 'v2'... |
Automate_S63.py | # -*- coding: utf-8 -*-
# import os
import Queue
from threading import Thread, Timer
import signal
import sys
import RPi.GPIO as GPIO
import Constantes
# from threading import Timer
from modules.Cadran import Cadran
from modules.Combine import Combine
from modules.Tonalite import Tonalite
from modules.Telephonie import... |
qt-client.py | #!/usr/bin/python3
import websocket, sys, threading, time
LOCAL_WS = None
REMOTE_WS = None
HTTP_PROXY = None
def get_ws_args():
# Get args for the websocket creation
global HTTP_PROXY
args = {"on_message": on_message, "on_error": on_error, "on_close": on_close}
if HTTP_PROXY is not None:
args... |
core.py | import base64
import functools
import hashlib
import httplib
import math
import pickle
import threading
import time
import urllib
import urllib2
import urlparse
import uuid
from lxml import etree
import rdflib
import redis
from django.conf import settings
from django.core.cache import cache
from django.core.exception... |
p2p_keyval_server.py | import time
import socket
import ssl
import base64
import msgpack
import OpenSSL
def get_private_key(private_key_path):
with open(private_key_path, 'r') as f:
private_key = OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM, f.read())
return private_key
class DistKeyValServer:
def __init... |
test.py | from multiprocessing import RawArray, Array # type: ignore
import threading
import unittest
import ctypes
from disruptor.factory import EventFactory
from disruptor.disruptor import Disruptor, DisruptorClosed, PublisherAlreadyRegistered
from disruptor.sequence import Sequence
from time import sleep
import numpy as np... |
test_client.py | """Tests for parallel client.py"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import division
from concurrent.futures import Future
from datetime import datetime
import os
import sys
from threading import Thread
import time
import pytest
from... |
zodbload.py | #!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this di... |
__init__.py | import yaml
import logging
import threading
import time
from pyferm.steps import step_status
from pyferm.utils import class_loader
class singleton(object):
def __new__(cls, *args, **kw):
if not hasattr(cls, "_instance"):
orig = super(singleton, cls)
cls._instance = orig.__new__(cls... |
sync.py | #
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... |
CLOCQAlgorithm.py | import json
import threading
import time
import spacy
import stanza
from networkx import json_graph
from rank_bm25 import BM25Okapi
from clocq.CoherenceGraph import CoherenceGraph, CoherenceScoreProcessor
from clocq.ConnectivityGraph import ConnectivityGraph, ConnectivityScoreProcessor
from clocq.StringLibrary import... |
freetests.py | #!/usr/bin/env python3
# coding: utf-8
# Copyright 2013 Abram Hindle
#
# 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 ... |
server.py | import asyncio
import binascii
import os
import os.path
import string
import sys
import threading
from queue import Queue, Empty
from flask import Flask, request, jsonify, abort
from flask_sockets import Sockets
import db
import loc
if not os.path.exists('.data/systems'):
# restore the data
os.system('unzip -LL ... |
promotion.py | import asyncio
import logging
import random
import threading
from typing import Callable, Optional
import discord
from system import database, spigotmc
color_error = 0xfa5858
color_processing = 0x12a498
color_success = 0xdaa520
class Message:
def __init__(self, message: discord.Message, has_premium: bool, load... |
TTLOps.py | import re
import sys
import platform
import inspect
from pathlib import Path
from time import sleep
import os
from time import sleep
import unicodedata as uc
from multiprocessing import Process, freeze_support
from filelock import FileLock
from socket import socket, AF_INET, IPPROTO_TCP, SOCK_STREAM, SHUT_RD
from PipAp... |
data_ingester.py | # Copyright 2020 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... |
_testing.py | import bz2
from collections import Counter
from contextlib import contextmanager
from datetime import datetime
from functools import wraps
import gzip
import os
from shutil import rmtree
import string
import tempfile
from typing import Any, List, Optional, Union, cast
import warnings
import zipfile
import numpy as np
... |
compare_WchainCNOT_qng.py | import qiskit
import numpy as np
import sys
sys.path.insert(1, '../')
import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding
import importlib
import multiprocessing
def run_wchain(num_layers, num_qubits):
thetas = np.ones(num_layers*num_qubits*3)
psi = 2*np.random.rand(2**num_qubits)-1
... |
utils.py | import threading
def spawn(f, *args, **kwargs):
t = threading.Thread(target=f, args=args, kwargs=kwargs)
t.start()
return t
|
preview.py | from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.label import Label
from kivy.graphics import Fbo, Color, Rectangle, Scale
from kivy.properties import ColorProperty, StringProperty, ObjectProperty
from kivy.utils import platform
from threading import Thread, Event
if platform == 'android':
from .previ... |
core.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import itertools
import tempfile
import os
import random
import collections
import warnings
import functools
import multiprocessing
import multiprocessing.dummy
import queue
from typing import (Iterator,
Tuple,
Mapping,
... |
tests.py | import re
import threading
import unittest
from django.db import connection, transaction
from django.db.models import Avg, StdDev, Sum, Variance
from django.db.models.fields import CharField
from django.db.utils import NotSupportedError
from django.test import TestCase, TransactionTestCase, override_settings
from djan... |
__init__.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Implements context management so that nested/scoped contexts and threaded
contexts work properly and as expected.
"""
from __future__ import absolute_import
from __future__ import division
import collections
import functools
import logging
import os
import platform
im... |
demo.py | import os
import time
import threading
import requests
import pyaudio
import numpy as np
import anal
from core import config
from core import message
from core import preprocessing
from core import record
class AudioStateInfo:
def __init__(self):
self.n_up_edge: int = 0
self.n_down_edge: int = 0
... |
main.py | import os
import comm
import datetime
import time
import threading
import json
from Queue import Queue
import snoreclassifier as sc
import sleepstageclssifier as ssclassifier
alarmTime = 0 # 0 means disabled
# compare current time with alarm time
def isTimeToWakeUp():
if (alarmTime == 0): # alarm is disabled
retur... |
jobManager.py | #
# JobManager - Thread that assigns jobs to worker threads
#
# The job manager thread wakes up every so often, scans the job list
# for new unassigned jobs, and tries to assign them.
#
# Assigning a job will try to get a preallocated VM that is ready,
# otherwise will pass 'None' as the preallocated vm. A worker thre... |
paralell.py | """
This is a script that runs all possible simulations in batches of N processses determined by the user.
A time window T is also defined for running the full batch of processess.
The idea is to run N processess in paralell once the full batch is finished start a new one.
Custom functions def... |
client3.py | import socket
import threading
PORT = 7000
HOST = '127.0.0.1'
clientSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientSock.connect((HOST, PORT))
name = input("Choose your name: ")
def receive():
while True:
try:
message = clientSock.recv(1024).decode('utf-8')
if messa... |
sniffer.py | #!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
session_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... |
exporter.py | #!/usr/bin/env python3
import argparse
import distutils.util as util
import hid
import serial
import time
import gpsd
import os
import logging
import statistics
import threading
import Adafruit_BMP.BMP085 as BMP085
import prometheus_client
from collections import deque
from prometheus_client.core import (
InfoMe... |
base.py | """Server class for visualizing images and datasets.
"""
# MIT License
#
# Copyright (c) 2018 Yichun Shi
#
# 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, inclu... |
streamer.py | # Copyright 2021 Max Beinlich
# 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, so... |
table.py | import time
import random
import threading as thread
import uuid
from typing import List, Dict
import libs.game as lgame
import bots.game as bgame
from slackapi.payload import get_mentioned_string, build_payload, build_info_str, card_to_emoji, build_prompt_payload
from .poker_bot import PokerBot
from .player import Pla... |
client.py | #-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
# pylint: d... |
cus.pyw | import pyautogui as ui
import time
import os
import keyboard
import threading
from win10toast import ToastNotifier
toaster = ToastNotifier()
#Import stuff
#Function for starting a notification thread
def d():
x = threading.Thread(target=rec, args=(1,))
x.start()
#Function for the most stuff ... |
vdGNSSTime.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: Florian Timm
@version: 2017.12.10
"""
import os
import socket
from datetime import datetime
from threading import Thread
import time
import serial
from vdInterface import VdInterface
class VdGNSSTime(Thread):
""" system time by gnss data """
def ... |
test_crud.py | # Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
LineFollowing.py | # Copied from: http://einsteiniumstudios.com/beaglebone-opencv-line-following-robot.html
# Working draft
import numpy as np
import cv2
from time import time
from threading import Thread
from pca9685 import PCA9685
from time import sleep
class LineFollower:
def __init__(self, left_margin=40, right_margin=120, sho... |
retinabot.py | from . import omnibot
import numpy as np
import threading
import time
class RetinaBot(omnibot.OmniBot):
def initialize(self):
super(RetinaBot, self).initialize()
self.retina(False)
self.retina_packet_size = None
self.image = None
self.count_spike_regions = None
self.... |
N1qlBase.py | import Queue
import copy
import json
import random
import string
import testconstants
from threading import Thread
from bucket_collections.collections_base import CollectionBase
from bucket_utils.bucket_ready_functions import BucketUtils, DocLoaderUtils
from n1ql_exceptions import N1qlException
from couchbase_helper.r... |
docker_base.py | import json
import logging
import os
import threading
from multiprocessing import Process, Queue
from queue import Empty
from typing import Tuple, Union
from docker import DockerClient
from docker.models.containers import Container
from casperlabs_local_net.errors import CommandTimeoutError, NonZeroExitCodeError
from ... |
malware.py | # This is a simple game coded to show a black screen, if you know how to use pygame, you can add your extension.
# dependency installer (remove DepInstall and DepCheck if you have any trouble with it)
# >nul >2>&1 hides the output, so that it doesnt look sussy while installing dependencies like socket or subprocess l... |
120322_sony_2.py | # #############################################################################################################################
# for lint check use flake8 : I havent bothered with some asthetic issues hopefully all syntax or errors are flushed
# install :: pip install flake8 flake8-import-order
# pip in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.