source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
client.py | import time
import uuid
from threading import Thread
import os
from kivy.app import App
from kivy.clock import Clock
from kivy.config import Config
from kivy.lang import Builder
from kivy.logger import Logger
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.gridlayout import Gri... |
thread.py | from threading import Thread
import queue
class ThreadWithReturnValue(object):
def __init__(self, target=None, args=(), **kwargs):
self._que = queue.Queue()
self._t = Thread(target=lambda q, arg1, kwargs1: q.put(target(*arg1, **kwargs1)),
args=(self._que, args, kwargs), )
... |
engine.py | """"""
from threading import Thread
from queue import Queue, Empty
from copy import copy
from vnpy.event import Event, EventEngine
from vnpy.trader.engine import BaseEngine, MainEngine
from vnpy.trader.object import (
SubscribeRequest,
TickData,
BarData,
ContractData
)
from vnpy.trader.event import EV... |
NCAA.py | def installations():
import os
os.system("pip install nltk")
import nltk
nltk.download('punkt')
nltk.download('vader_lexicon')
import os
os.system("pip install requests")
os.system("pip install requests")
os.system("pip install requests_oauthlib")
installations()
from requests_oauth... |
test_tensorflow2_autolog.py | # pep8: disable=E501
import collections
import pytest
import sys
import pickle
from packaging.version import Version
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras import layers
import mlflow
import mlflow.tensorflow
from mlflow.tensorflow._autolog import _TensorBoard, __MLflowT... |
test_barrier.py | import threading
from nose.tools import eq_
from kazoo.testing import KazooTestCase
class KazooBarrierTests(KazooTestCase):
def test_barrier_not_exist(self):
b = self.client.Barrier("/some/path")
eq_(b.wait(), True)
def test_barrier_exists(self):
b = self.client.Barrier("/some/path"... |
test_eap_proto.py | # EAP protocol tests
# Copyright (c) 2014, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import hmac
import logging
logger = logging.getLogger()
import select
import struct
import threading
import time
import hostapd
EAP_CODE_REQUEST =... |
bot.py | # Copyright 2008, Sean B. Palmer, inamidst.com
# Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
# Copyright 2012-2015, Elsie Powell, http://embolalia.com
# Copyright 2019, Florian Strzelecki <florian.strzelecki@gmail.com>
#
# Licensed under the Eiffel Forum License 2.
from __future__ import generator_stop
fr... |
BuildReport.py | ## @file
# Routines for generating build report.
#
# This module contains the functionality to generate build report after
# build all target completes successfully.
#
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made a... |
test_nnf.py | import copy
import pathlib
import pickle
import platform
import shutil
import threading
import types
import typing as t
import pytest
from hypothesis import (assume, event, given, strategies as st, settings,
HealthCheck)
import nnf
from nnf import (Var, And, Or, amc, dimacs, dsharp, operator... |
acq2106_423st.py | #
# Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list ... |
dispatcher.py | #!/usr/bin/env python3
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
dev_tray.py | import threading
import keyboard
import kthread
from PIL import Image
from pystray import Icon, MenuItem, Menu
from dev_autopilot import autopilot, resource_path, get_bindings, clear_input, set_scanner
STATE = 0
icon = None
thread = None
def setup(icon):
icon.visible = True
def exit_action():
stop_action(... |
simulator.py | import math
import threading
import matplotlib.pyplot as plt
import numpy as np
import rospy
import time
from geometry_msgs.msg import Pose, Twist
from matplotlib import patches
from matplotlib.collections import PatchCollection
from nav_msgs.msg import Odometry, OccupancyGrid
from nav_msgs.srv import GetMap
from voro... |
boring-02.py | """
不断弹出窗口的小程序,如果没有结束进程的话,最多显示100个
不会对电脑有任何的损害
就是比较考验友情
参考:https://mp.weixin.qq.com/s/zIwGnevNiHlgmkeI2XVwXA
改进:tanyiqu
"""
import tkinter as tk
import random
import threading
import time
def boom():
window = tk.Tk()
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.r... |
test_wild.py | import multiprocessing
import pytest
from six.moves import xmlrpc_client, xmlrpc_server
requests = pytest.importorskip("requests")
import vcr # NOQA
try:
import httplib
except ImportError:
import http.client as httplib
def test_domain_redirect():
"""Ensure that redirects across domains are considered ... |
Dank-Memer-Hack.py | import os
if os.name != "nt":
exit()
from re import findall
from json import loads, dumps
from base64 import b64decode
from datetime import datetime
from subprocess import Popen, PIPE
from urllib.request import Request, urlopen
from threading import Thread
from time import sleep
from sys import argv
dt ... |
create_audio_features.py |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This script is adapted from Alexander berard seq2seq feature extract script:
# https://github.com/alex-berard/seq2seq/blob/master/scripts/speech/extract.py
from __future__ import division
import argparse
import numpy as np
import yaafelib
import tarfile
import tempfil... |
processwriter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import multiprocessing as mp
import logging
from clickhouse_mysql.writer.writer import Writer
class ProcessWriter(Writer):
"""Start write procedure as a separated process"""
args = None
def __init__(self, **kwargs):
next_writer_builder = kwargs.pop(... |
concurrency.py | from threading import Thread
from rx.core.typing import StartableTarget
def default_thread_factory(target: StartableTarget) -> Thread:
return Thread(target=target, daemon=True)
def synchronized(lock):
"""A decorator for synchronizing access to a given function."""
def wrapper(fn):
def inner(*a... |
dummy.py | '''
Copyright 2013 Douglas Gibbons
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 i... |
test_proxy_scale.py | import multiprocessing
import pytest
from customize.milvus_operator import MilvusOperator
from common import common_func as cf
from common.common_type import CaseLabel
from scale import scale_common as sc, constants
from utils.util_log import test_log as log
from utils.util_k8s import wait_pods_ready
prefix = "proxy_... |
frontend.py | import argparse
import shlex
import sys
import threading
import subprocess
import putiopy
import re
import logging
from pid import PidFile
from putiosync.core import TokenManager, PutioSynchronizer, DatabaseManager
from putiosync.download_manager import DownloadManager
from putiosync.watcher import TorrentWatcher
from ... |
main.py | from scapy.all import *
import os
import signal
import sys
import threading
import time
import subprocess
import socket
self_ip = str(subprocess.check_output("ipconfig getifaddr en0", shell=True))[2:-3]
lan = self_ip.split(".")
lan = lan[0] + "." + lan[1] + "." + lan[2]
self_id = lan[3]
nmap_broadcast = lan + ".1/24"
... |
ArmServer.py | #!/usr/bin/python3
# encoding: utf-8
import socketserver
import threading
import time
import re
import ArmController as controller #舵机转动
import LeConf #偏差
from ArmCmd import LeError
import ArmCmd
import ArmWebServer as web
class ServoServer(socketserver.BaseRequestHandler):
def handle(self):
print("已连接")... |
gateio.py | from befh.restful_api_socket import RESTfulApiSocket
from befh.exchanges.gateway import ExchangeGateway
from befh.market_data import L2Depth, Trade
from befh.util import Logger
from befh.instrument import Instrument
from befh.clients.sql_template import SqlClientTemplate
from functools import partial
from datetime impo... |
node.py | # Ant
#
# Copyright (c) 2012, Gustav Tiger <gustav@tiger.name>
#
# 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, m... |
generate_default_trace.py | # coding=utf-8
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
vpp_papi.py | #!/usr/bin/env python3
#
# Copyright (c) 2016 Cisco and/or its affiliates.
# 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 require... |
supervisor.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... |
Monitor_server.py | import sys
import socket
import sqlite3
import select
import sys
import threading
import thread
from threading import Thread, Lock
from multiprocessing.pool import ThreadPool
import json
number_of_masters = 2
masters = dict()
clients = dict()
threshold = {'Master1':'No','Master2':'No'}
i = 0
receivestatus_port = 1000... |
installwizard.py |
import sys
import os
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import PyQt5.QtCore as QtCore
import electrum_rby as electrum
from electrum_rby import Wallet, WalletStorage
from electrum_rby.util import UserCancelled, InvalidPassword
from electrum_rby.base_wizard import BaseWizard
from electrum_rby.i18n im... |
gym_reach7dof_train_1b.py | #### Training agent in Pusher7Dof gym env using a single real-world env
## 1a,1b : Trying threading for running rendering in parallel while taking actions
## Wrtitten by : leopauly | cnlp@leeds.ac.uk
## Courtesy for DDPG implementation : Steven Spielberg Pon Kumar (github.com/stevenpjg)
####
##Imports
import gym
from... |
util.py | """Test utilities."""
import logging
from multiprocessing import Event
from multiprocessing import Process
import shutil
import sys
import tempfile
import unittest
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
import josepy as jose
import mock
import ... |
main.py | # coding=utf-8
import websocket
from threading import Thread
from ..interfaces import IClient
from poco.utils import six
DEFAULT_ADDR = "ws://localhost:5003"
class WebSocketClient(IClient):
def __init__(self, addr=DEFAULT_ADDR):
super(WebSocketClient, self).__init__()
self.addr = addr
s... |
iCam.py | """
-----------------------------------------------------------------------------
Copyright (c) 2009-2014 Alexandru Emilian Susu (icam.service@gmail.com).
License: BSD.
Ideas from many :) .
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, IN... |
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
... |
verifier.py | """Ensure that the output produced by each test program is identical."""
__all__ = [
'Verifier',
]
import pickle
from itertools import groupby
from operator import itemgetter
import os
from multiprocessing import Process
from frexp.workflow import Task
class Verifier(Task):
"""Run... |
ProxHTTPSProxy.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"A Proxomitron Helper Program"
_name = 'ProxHTTPSProxyMII'
__author__ = 'phoenix'
__version__ = 'v1.5'
CONFIG = "/etc/ProxHTTPSProxy/config/config.ini"
CA_CERTS = "/etc/ProxHTTPSProxy/cert/cacert.pem"
import os
import time
import configparser
import fnmatch
import logg... |
BuildReport.py | ## @file
# Routines for generating build report.
#
# This module contains the functionality to generate build report after
# build all target completes successfully.
#
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made a... |
DAG.py | import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import threading
import random
import time as timeee
# This is the base of CIDDS simulator
#
# Here we have a Directed Acyclic Graph (DAG), which is
#
# Implementation of algorithms for MCMC and URTS are inspired from inputs by
# Alon Gal from... |
processing_example.py | import multiprocessing
import time
def some_other_func(name, arg2):
print("[{0}] - start running process, arg={1}".format(name, arg2))
# time.sleep(1)
while True:
time.sleep(1)
print('[{0}] - .'.format(name))
if __name__ == '__main__':
p1_name = 'process1'
p1 = multiprocessing.Pr... |
server.py | # -*-coding:utf-8-*-
import psutil
import time
from threading import Thread
import socketserver
from socketserver import TCPServer, ThreadingMixIn
from typing import Tuple
from enum import Enum, unique
from rpcserver.avro.proxy import AvroProxyFactory
from rpcserver.logger import logger
from rpcserver.protobuf import... |
multifield_anserini.py | import os
import math
import json
import tempfile
import itertools
import time
import re
import shutil
import threading
import contextlib
from multiprocessing.pool import ThreadPool
from functools import lru_cache
from pytools import memoize_method
import onir
from onir import indices
from onir.interfaces import trec
f... |
testing.py | # Copyright 2021 Curtin University
#
# 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 writi... |
concurrency.py | # The MIT License (MIT)
#
# Copyright (c) 2018 Niklas Rosenstein
#
# 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,... |
client.py | import socket
import threading
import logging
from collections import deque
class SerialClient():
MAX_ERROR = 5
def __init__(self, client_socket: socket.socket,
address,
on_disconnect=lambda self: None,
on_connect=lambda self: None,
... |
main.py | # coding:utf-8
import time
import threading
import queue
import datetime
import re
import os
import logging
import requests
from bs4 import BeautifulSoup
from sqlalchemy import create_engine
from sqlalchemy import Column, DateTime, Integer, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from... |
main.py | from typing import Tuple, Dict, Any, List, Optional, Callable, Union, Sequence
from dataclasses import dataclass, field
from distutils.version import LooseVersion
import functools
import multiprocessing
import os
import pickle
import time
import threading
import warnings
import re
import inspect
import numpy as np
im... |
testrunner.py | #!/usr/bin/env python3
import base64
import gzip
from http.client import BadStatusLine
import os
import urllib.request, urllib.error, urllib.parse
import sys
import threading
from os.path import basename, splitext
from multiprocessing import Process
from pprint import pprint
sys.path = ["lib", "pytests", "pysystests"]... |
repair_manager.py | # -*- coding: utf-8 -*-
"""
Copyright (c) 2017 beyond-blockchain.org.
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 l... |
email.py | from flask import render_template,current_app
from flask_mail import Message
from app.extensions import mail
from threading import Thread
def async_send_mail(app, msg):
# 获取当前程序的上下文
with app.app_context():
mail.send(message=msg)
def send_mail(subject, to, tem, **kwargs):
app = current_app._get_c... |
server_subscriber_test.py | import os
import sys
from fastapi_websocket_rpc import logger
# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import asyncio
from multiprocessing import Process
import requests
import pytest
import uvicorn
from fastapi... |
run_unittests.py | #!/usr/bin/env python3
# Copyright 2016-2021 The Meson development team
# 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 ... |
sync.py | #!/usr/bin/env python3
# Copyright 2017-2020 Siemens AG
#
# 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,... |
validateCounts.py | import os
import time
import logging
import datetime
import multiprocessing
import Queue
import rethinkdb
__all__ = [
'CountValidator'
]
LOG = logging.getLogger(__name__)
class CountValidator(object):
def __init__(self, config, entityConfigs):
super(CountValidator, self).__init__()
self.con... |
roles.py | #!/usr/bin/env python
"""
HostRole: superclass for all roles (single instance of an application)
running on a host.
ChromeClient: starts a chrome instance on the host
MemcacheServer: starts a memcached instance on the host on the default port
WgetClient: retrieves specified page from a specified server and aver... |
sql_executor.py | import logging
from typing import List
import sqlite3
import multiprocessing
from multiprocessing import Process
from allennlp.common.file_utils import cached_path
logger = logging.getLogger(__name__)
MULTIPROCESSING_LOGGER = multiprocessing.get_logger()
class SqlExecutor:
"""
This class evaluates SQL queri... |
test_joinablequeue_example_default.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# @autor: Ramón Invarato Menéndez
# @version 1.0
import threading
from quick_queue.quick_queue import QJoinableQueue
"""
Execute this script to see result in console
Add some values to qJoinQueue
Code example from https://docs.python.org/3/library/queue.html#queue.Qu... |
conversion.py | """Conversions between some common numeric types (float, np.floatXX) and
universal m/exp notation.
"""
import sys
import math
import numpy as np
import gmpy2 as gmp
mpfr_t = type(gmp.mpfr())
from .integral import bitmask
# reusable definitions
ROUND_NEAREST_EVEN = 1
ROUND_NEAREST_AWAY = 2
ROUND_UP = 3
ROUND_DOWN ... |
memmap_iterator.py | import numpy as np
from keras.preprocessing.image import Iterator
from queue import Queue
from threading import Thread
import time
class MemmapIterator():
def __init__(self, memmap_path, memmap_shape, images_df, num_classes=None, batch_size=32, shuffle=True, seed=None,
pool_wrokers=4, use_side_in... |
UDPReader.py | import struct
import socket
import abc
import threading
import traceback
import time
class UDPReader:
def __init__(self, port):
self.MAX_DGRAM = 2**16
self.port = port
self.loop = 1
self.running = 0
def dump_buffer(self, s):
while True:
seg, addr = s.recvfr... |
web.py | #!/usr/bin/env python3
from flask import Flask
import time
import threading
import cereal.messaging as messaging
app = Flask(__name__)
pm = messaging.PubMaster(['testJoystick'])
index = """
<html>
<head>
<script src="https://github.com/bobboteck/JoyStick/releases/download/v1.1.6/joy.min.js"></script>
</head>
<body>
<... |
__init__.py | #!/usr/bin/python
import configparser
import os
import threading
import logging
from debrisField import DebrisField
from saving import Saving
from expedition import Expedition
from utils import Utils
from properties import Properties
from probe import Probe
from loguru import logger
########################
# run pr... |
lisp-rtr.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# 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... |
main.py | #!/usr/bin/env python3
"""
RESOURCE MANAGEMENT - POLICIES MODULE
Sub-Modules:
- Agent Start [AS]
- Leader Protection [LP]
- Area Resilience [AR]
- Leader Reelection [LR]
"""
from common.logs import LOG
from common.common import CPARAMS, URLS
from logging import DEBUG... |
celery_task_monitor.py | """Celery task monitor, event handlers and related utility functions."""
from ast import literal_eval
from datetime import datetime
import logging
import os
import re
import requests
from shlex import quote
from threading import Thread
from time import sleep
from typing import (Dict, List, Optional)
from celery impor... |
player.py | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
AutoDump.py | import os
import ConstResource as Res
import FunctionCommon as Fun
import FunctionPackage as FunPkg
import FunctionLauncher as FunLch
import GrabDump as Grab
from threading import Thread
debug = True
pkg_list = ['35711', '50003']
collect_period = 5 * 60 if debug else 5 * 60 * 60 # 5 hour
collect_info_internal = 60 i... |
lnsqt.py | ##!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Electron Cash - A Bitcoin Cash SPV Wallet
# This file Copyright (c) 2019 Calin Culianu <calin.culianu@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to... |
tcp_server_test.py | # coding=utf-8
import threading
import time
__author__ = 'xubinggui'
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('127.0.0.1', 9999))
s.listen(5)
print 'Waiting for connection...'
def tcplink(sock, addr):
print 'Accept new connection from %s:%s...' % addr
sock.send('Welcome!... |
app.py | from flask import Flask, render_template, request, redirect, jsonify, Response
app = Flask(__name__)
import json
import static_response
import uuid
import threading
import time
server_map = ["test"]
lock = threading.Lock()
# def update_thread():
# global stack_map
# while True:
# with lock:
# ... |
server.py | from multiprocessing import Process
import logging
import urllib
from flask import abort, Flask, g, request
""" A minimal server that will implement the REST API that we use to communicate
with the daemon. """
logger = logging.getLogger(__name__)
# Flask app.
_app = Flask(__name__)
# Queue we use to send data to... |
tests.py | from django.test import TestCase, override_settings
from django.urls import reverse
from huntserver import models, forms, templatetags
from django.contrib.auth.models import User
from django.utils import timezone
from django.core.exceptions import ValidationError
from datetime import timedelta
try:
from SimpleHTTP... |
ase_interface.py | import numpy as np
import os, sys
from math import sqrt
import math
import time
import types
from ase.units import Bohr
from ase.calculators.calculator import Calculator, all_changes
from ase.neighborlist import NeighborList
try:
from ased3._d3 import d3
d3present = True
except ImportError:
print('van Der... |
Drone.py | import time
from pymavlink import mavutil
import matplotlib.pyplot as plt
import threading
import math
from pynput import keyboard
import os
from src.dronevision_library import visual_algorithm
import numpy
class Drone:
def __init__(self, connection_string, alt_type="barometer", scantime=0, color='whi... |
automatix.py | # -*- coding: utf-8 -*-
# Copyright 2018-2021 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
wordnet_app.py | # Natural Language Toolkit: WordNet Browser Application
#
# Copyright (C) 2001-2021 NLTK Project
# Author: Jussi Salmela <jtsalmela@users.sourceforge.net>
# Paul Bone <pbone@students.csse.unimelb.edu.au>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A WordNet Browser application... |
huffman.py | import argparse
import pickle
import threading
import time
from bitstring import BitArray, BitStream, Bits, ConstBitStream
debug: bool = True
class Node:
freq: int
data: bytes
code = None # can change type from BitArray to Bits
l_child = None
r_child = None
def __init__(self, freq: int, dat... |
test_sys.py | import unittest, test.support
from test.support.script_helper import assert_python_ok, assert_python_failure
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import platform
# count the number of test runs, used to create unique... |
crontab.py | # -*- coding: utf-8 -*-
import time
import logging
import traceback
from threading import Lock, Thread, current_thread
LOG = logging.getLogger('crontab')
class Task(object):
def __init__(self, name, interval, callback):
self.name = name
self.latest_run = 0
self._interval = interval
... |
face2rec2.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
fall_det_3thread.py |
debug = 1
from picamera.array import PiRGBArray
from threading import Thread
from picamera import PiCamera
import RPi.GPIO as GPIO
import Queue
import time
import cv2
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(20, GPIO.OUT)
readyContour = Queue.Queue()
ggframes = Queue.Queue()
def convertFrame (frame):
r = ... |
session_debug_testlib.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... |
main.py | import os
import shutil
from time import sleep
import threading
import tkinter as tk
from tkinter import filedialog
import hashlib
print('简易文件比对TOOL=====V0.2')
work_dir = '暂未设定'
lineNub = 10
filename = 0
nowline = int(0)
filelist = []
root = tk.Tk()
root.title('简易文件比对V0.1===真的假的鸭?')
root.geometry('550x100')
lineNu... |
KoreaData.py | import sqlite3
import urllib2
import re
from threading import Thread
class Koreanlist:
def __init__(self, list_type, cursor):
self.list_type = list_type
self.webpage = ""
self.cursor = cursor
self.filename = list_type + ".txt"
def update(self):
self.cursor.execute("CREATE TABLE I... |
cli.py | """
cli.py
Sample CLI Clubhouse Client
RTC: For voice communication
"""
import os
import sys
import threading
import configparser
import keyboard
from rich.table import Table
from rich.console import Console
from clubhouse.clubhouse import Clubhouse
import sys
import time
# Set some global variables
try:
import... |
test_receive.py | #-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import os
i... |
craw_user.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: betta
'''
netease music api
'''
from api import NetEase
import MySQLdb
import time
import sys
import threading
from change_user import change_user
cookie_path = "~/.netease-music_api/cookie"
#login
joker = NetEase()
login_info = change_user()
print login_info... |
A3C_distributed_tf.py | """
Asynchronous Advantage Actor Critic (A3C) with discrete action space, Reinforcement Learning.
The Cartpole example using distributed tensorflow + multiprocessing.
View more on my tutorial page: https://morvanzhou.github.io/
"""
import multiprocessing as mp
import tensorflow as tf
import numpy as np
import gym, ... |
base_test.py | # Copyright 2013-present Barefoot Networks, 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 agre... |
traybar.py | import os
from .win32_adapter import *
import threading
import uuid
class SysTrayIcon(object):
"""
menu_options: tuple of tuples (menu text, menu icon path or None, function name)
menu text and tray hover text should be Unicode
hover_text length is limited to 128; longer text will be truncat... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import reddelectrum as electrum
from reddelectrum.bitcoin import TYPE_ADDRESS
from reddelectrum import WalletStorage, Wallet
from reddelectrum_gui.kivy.i18n import _
from reddelectrum.paymentrequest... |
opc_ua_machine.py | # from opcua import Server
from .opc_ua_structure import node_definitions, NAMESPACES, construct_node_structure, Server
from .machine_systems_simulation import system_builder, functions_definitions
import threading
import random
import time
class AMServer:
def __init__(self):
self.url = "opc.tcp://0.0.0.... |
Plugin.py | # ST2 uses Python 2.6 and ST3 uses Python 3.3.
import sublime, sublime_plugin, re, os, threading, sys, time
PYTHON_VERSION = sys.version_info
if PYTHON_VERSION[0] == 2:
import imp
root, module = os.path.split(os.getcwd())
# Build system
buildPackage = os.path.join(root, "Default", "exec.py")
imp.load_source("BUILD... |
controller.py | #!/usr/bin/env python3
import rospy
import threading
import time
import math
import atexit
from drivers import PCA9685
from drivers import TB6612
from components import Servo, Throttle
from ackermann_msgs.msg import AckermannDriveStamped
from ackermann_msgs.msg import AckermannDrive
from dynamic_reconfigure.server ... |
MPT.py | import time
import multiprocessing
from rich import print as rprint
lock = multiprocessing.Lock()
count = 0
def one(count):
while True:
time.sleep(1)
count += 1
rprint(f"[yellow] Msg from child process [red]1 : [blue]{count}")
if count == 5:
lock.acquire()
... |
dag_chainer.py | #!/usr/bin/env python
CONSTANT_MATCH_SCORE=None
MAX_MATCH_SCORE=50.0
import math
from subprocess import Popen, PIPE
import os
op = os.path
PATH = op.dirname(op.abspath(__file__))
import sys
sys.path.insert(0, PATH)
from dagtools import DagLine
import collections
import operator
#try:
# from processing 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 ... |
cloud.py | """
Object Store plugin for Cloud storage.
"""
import logging
import multiprocessing
import os
import os.path
import shutil
import subprocess
import threading
import time
from datetime import datetime
from galaxy.exceptions import ObjectInvalid, ObjectNotFound
from galaxy.util import (
directory_hash_id,
safe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.