source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import next
from builtins import rang... |
language_apis.py | import re
from json import dumps
from multiprocessing import Process, Queue
import black
import requests
from flask import jsonify, request
from lark import Lark, LarkError, Token, Tree, UnexpectedEOF
from IGNORE_scheme_debug import (
Buffer,
SchemeError,
debug_eval,
scheme_read,
tokenize_lines,
)... |
Matrix.py | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 24 12:26:19 2019
@author: VAI
"""
import paho.mqtt.client as mqtt
import json
import boto3
import cv2
## Set Initial Variables ##
import os # Miscellaneous operating system interface
import zmq # Asynchronous messaging framework
import time # Time access and conversions
... |
multidownloadXkcd.py | #! python3
# multidownloadXkcd.py - Downloads XKCD comics using multiple threads.
import requests, os, bs4, threading
os.makedirs('xkcd', exist_ok=True) # store comics in ./xkcd
def downloadXkcd(startComic, endComic):
for urlNumber in range(startComic, endComic):
# Download the page.
print('Downlo... |
run_silent_if_successful.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import pty
import signal
import subprocess
import sys
import threading
master_pty_fd, slave_pty_fd = pty.op... |
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
from common.hardware import HA... |
decorators.py | import logging, functools, time, os
from functools import wraps
from functools import partial
from ratelimit.decorators import ratelimit
from django.conf import settings
from django.http import Http404
from django.shortcuts import redirect
from django.contrib import messages
import sys
logger = logging.getLogger('engi... |
collect_telemetry_events.py | # Microsoft Azure Linux Agent
#
# Copyright 2020 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.0
#
# Unless required b... |
sync.py | # -*- coding:utf-8 -*-
#
# 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 re... |
video_ffpyplayer.py | '''
FFmpeg based video abstraction
==============================
To use, you need to install ffpyplayer and have a compiled ffmpeg shared
library.
https://github.com/matham/ffpyplayer
The docs there describe how to set this up. But briefly, first you need to
compile ffmpeg using the shared flags while disabling... |
designTaggedPrimersForIsoforms.py | #!/usr/bin/env python
import sys
from numpy import ceil, log2
from operator import itemgetter
from classMFE import MFE, MFEOptions
from IsoformSignatureClasses import Signature, IsoformSignatureGenerator
from commonCGDB import associateIsoformsToTargetGenesPlusOldID, buildTargetIsoformPartsList, annotateAndOrderTarget... |
face-mask-iot.py |
from utils.centroidtracker import CentroidTracker
from utils.trackableobject import TrackableObject
from utils.tracking import track_objects, draw_bounding_boxes
from imutils.video import VideoStream
from imutils.video import FPS
from flask import Flask, render_template, Response
from edgetpu.detection.engine import ... |
process_crawler.py | # -*- encoding:utf8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import multiprocessing
from threaded_crawler import threaded_crawler
def process_crawler(args, **kwargs):
num_cpus = multiprocessing.cpu_count()
print 'Starting {} processes'.format(num_cpus-1)
processes = []
for i in range... |
train_summary_loop_add_faith.py | from torch.utils.data import DataLoader, RandomSampler
import torch, os, sys, time, argparse, numpy as np
from utils_dataset import SQLDataset, HDF5Dataset
from transformers.optimization import AdamW
from model_generator import GeneTransformer
from datetime import datetime, timedelta
from utils_logplot import LogPlot
... |
TTSAlertsAndChat_StreamlabsSystem.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
""" Text-To-Speech for Alerts and Chat Messages
1.1.4
Fixed bug adding unicode characters to banned words list
Added setting for ban messages
Added ability to ban users for a time
1.1.3
Fixed bug where banned words showed on overlay
1.1.2
Support ascii characte... |
test_client.py | import asyncio
import gc
import logging
import os
import pickle
import random
import subprocess
import sys
import threading
import traceback
import warnings
import weakref
import zipfile
from collections import deque
from contextlib import suppress
from functools import partial
from operator import add
from threading i... |
example_publisher.py | import proccom
from threading import Thread
import time
def break_cmd():
stop = False
while not stop:
a = input()
if a == 'q':
stop = True
def main():
break_thread = Thread(target=break_cmd, daemon=False)
break_thread.start()
publisher = proccom.Publisher('test_topic'... |
main.py | import os, sys
from threading import Thread, Timer
from bokeh.layouts import column, row
from bokeh.models import Button
from bokeh.plotting import curdoc, figure
from bokeh.models.widgets import Div
from functools import partial
try:
import datashader
except ImportError:
datashader = None
print("\n\nThe d... |
event_stream_generator.py | __author__ = 'Bohdan Mushkevych'
import datetime
import random
import time
import math
from threading import Thread
from amqp import AMQPError
from db.model.raw_data import RawData
from synergy.mq.flopsy import Publisher
from synergy.system.performance_tracker import SimpleTracker
from synergy.system.synergy_process... |
deployment_connector.py | #
# deployment_connector.py
#
# Copyright 2009 Hewlett-Packard Development Company, L.P.
#
# Hewlett-Packard and the Hewlett-Packard logo are trademarks of
# Hewlett-Packard Development Company, L.P. in the U.S. and/or other countries.
#
# Confidential computer software. Valid license from Hewlett-Packard required
# fo... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import verbose, import_module, cpython_only
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thread
import threading
import time
import unittest
import weakref
import os
import ... |
server.py | import signal
import sys
import logging
from socket import socket, AF_INET, SOCK_STREAM, SOCK_DGRAM
from threading import Thread
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
class Server:
def __init__(self, host='', port=4000, buffer_size=4096):
... |
testserver.py | # Python 3
# coding: utf-8
import sys
from socket import *
import threading
import time
import datetime as dt
# Read port number and number of failed attempt from sys argv
serverPort = sys.argv[1]
nb_failed = sys.argv[2]
serverPort = int(serverPort)
nb_failed = int(nb_failed)
# The nb of failed attempt ... |
ps5.py | # 6.0001/6.00 Problem Set 5 - RSS Feed Filter
# Name: Alon Parag
# Collaborators:
# Time:From 04.01.2021 19:31 to 06.01.2021 13:18
# NOTE: TEST_3_BEFORE_AND_AFTER_TRIGGER FAILS AS THERE IS NOT TZINFO PASSED, TEST_3_ALT_BEFORE_AND_AFTER_TRIGGER PASSES
import feedparser
import string
import time
import threading
from pr... |
preparer.py | # -*- coding: utf-8 -*-
# Copyright 2020-2022 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... |
starpi_control_app.py | import cv2
import numpy as np
import math
import serial
from socket import *
import time
import threading
import sys
#se indica la direccion y puerto del servidor que recibe todo los datos
#el puerto por defecto es el 3001
socketInfo = ["localhost", 3001]
#funcion que estima el numero de dedos abiertos y cerrados en... |
camerastreamer.py | # Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers
# 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 notice, ... |
test_sync_clients.py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... |
client.py | import socket
import threading
import threading
from time import sleep
import datetime as dt
HOST = '127.0.0.1' # Use Server IP
PORT = 8000 # Use Server Port
HEADERLEN = 10
name = input("Enter nickname: ")
print(f'Connecting to {HOST}:{PORT}...\n')
# Connecting To Server
def connect():
clnt = socket.socket(socket.... |
email.py | """
-------------------------------------------------
Project Name: LearnFlask
File Name: email
Author: cjiang
Date: 2020/5/21 6:59 PM
-------------------------------------------------
"""
from threading import Thread
from flask import current_app, render_template
from flask_mail import... |
test_writer.py | import os
import socket
import tempfile
import threading
import time
import mock
import msgpack
import pytest
from six.moves import BaseHTTPServer
from six.moves import socketserver
from ddtrace.constants import KEEP_SPANS_RATE_KEY
from ddtrace.internal.compat import PY3
from ddtrace.internal.compat import get_connec... |
env_wrappers.py | """
Modified from OpenAI Baselines code to work with multi-agent envs
"""
import numpy as np
from multiprocessing import Process, Pipe
from baselines.common.vec_env import VecEnv, CloudpickleWrapper
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while Tru... |
log_test16.py | #!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright n... |
run_yolov5_train.py | import argparse
import logging
import math
import os
import random
import time
from copy import deepcopy
from pathlib import Path
from threading import Thread
import numpy as np
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.optim.lr_sche... |
mtsleepD.py | #!/usr/bin/env python
import threading
from time import sleep, ctime
loops = [4,2]
class ThreadFunc(object):
def __init__(self, func, args, name=''):
self.name = name
self.func = func
self.args = args
def __call__(self):
self.func(*self.args)
def loop(nloop, nsec):
print 'start loop', nloop, 'at:', ... |
networkEAGPD.py | #!/usr/bin/env python3.7
"""
Router class is part of a dissertation work about WSNs
"""
__author__ = "Bruno Chianca Ferreira"
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Bruno Chianca Ferreira"
__email__ = "brunobcf@gmail.com"
import socket, os, math, struct, sys, json, traceback, zlib, fcntl, threadi... |
test_robot.py | import threading
import unittest
from unittest import mock
from opentrons.robot.robot import Robot
from opentrons.containers.placeable import Deck
from opentrons import instruments, containers
from opentrons.util.vector import Vector
class RobotTest(unittest.TestCase):
def setUp(self):
Robot.reset_for_te... |
Spider_Lv3.py | # -*- coding: utf-8 -*-
# Spider Lv3
# Author: Yue H.W. Luo
# Mail: yue.rimoe@gmail.com
# License : http://www.apache.org/licenses/LICENSE-2.0
# More detial: https://blog.rimoe.xyz/2017/11/12/post01/
"""
## NOTE
Created on Thu Oct 26 15:30:04 2017
This programme is used to get data from cnik-database.
`threa... |
test_interrupt.py | import os
import time
from threading import Thread
import pytest
from dagster import (
DagsterEventType,
DagsterSubprocessError,
Field,
ModeDefinition,
String,
execute_pipeline_iterator,
pipeline,
reconstructable,
resource,
seven,
solid,
)
from dagster.core.instance import ... |
main.py | from math import floor
from multiprocessing import Process
import time
import psutil
import test_group
import random
from dotenv import dotenv_values
PARALLEL = True
test_processes = []
def try_seed_random():
config = dotenv_values('.env')
if 'SEED' in config:
random.seed(config['SEED'])
def is_cp... |
serial_port.py | # -*- coding: utf-8 -*-
"""
Created on Tues Aug 3 17:06:02 2021
@author: wmy and wjx
"""
import four_dof_ik
import serial
import serial.tools.list_ports
import threading
import tkinter as tk
from tkinter import messagebox
from tkinter import ttk
import time
ifwork = True
def write_coordinates(fil... |
controller.py | import glob
import locale
import os
import re
import shutil
import subprocess
import traceback
from math import floor
from pathlib import Path
from threading import Thread
from typing import List, Type, Set, Tuple
import requests
import yaml
from colorama import Fore
from requests import exceptions
from bauh.api.abst... |
HiwinRA605_socket_ros_20190614133908.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
app.py | #!/bin/python
import logging
import os
from multiprocessing import Process
from controller.translatorcontroller import translatorapp
from kafkawrapper.translatorconsumer import consume
from kafkawrapper.transnmtconsumer import consume_nmt
from anuvaad_auditor.loghandler import log_exception
log = logging.getLogger('f... |
algo_phase.py | import logging
import queue
import threading
import typing
class AlgoPhase(object):
"""Simple training/testing/evaluation class"""
def __init__(self, model, listeners, phase=None, event_processor=None):
self._phase = phase
self._model = model
self._iteration = 0
self.listener... |
tunnel.py | """Basic ssh tunnel utilities, and convenience functions for tunneling
zeromq connections.
Authors
-------
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full... |
evaluation_server_test.py | from io import StringIO
from threading import Thread
from unittest import TestCase
import requests
from deduplication.classifier_evaluator import ClassifierEvaluator
from deduplication.evaluation_server import EvaluationServer
class EvaluationServerTest(TestCase):
def setUp(self):
self.server = Evaluati... |
test_search_20.py | import pytest
from time import sleep
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
from utils.utils import *
from common.constants import *
prefix = "se... |
TcpServer.py | from socketserver import ThreadingTCPServer
from .message import TcpMessage
from .message import TcpRequest
from ._RequestHandler import _RequestHandler
from threading import Thread, Lock
from typing import Callable, List
class TcpServer(ThreadingTCPServer):
"""
A threaded TCP server that listens for :class... |
example3.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Han Xiao <artex.xh@gmail.com> <https://hanxiao.github.io>
# NOTE: First install bert-as-service via
# $
# $ pip install bert-serving-server
# $ pip install bert-serving-client
# $
# using BertClient in multicast way
import sys
import threading
from model_serving.clien... |
vsanmetrics.py | #!/usr/bin/env python
# Erwan Quelin - erwan.quelin@gmail.com
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import VmomiSupport, SoapStubAdapter, vim, vmodl
import threading
import argparse
import atexit
import getpass
from datetime import datetime, timedelta
import time
import ssl
import pickle
i... |
DDOS.py | import socket
import threading
target = 'target ip'
fake_ip = '182.21.20.32'
port = 80
'''
def attack():
while True:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((target, port))
s.sendto(("GET /" + target + " HTTP/1.1\r\n").encode('ascii'), (target, port))
... |
log_processor.py | try:
import argparse
import configparser
import datetime
import json
import kerberos
import logging
import os
import pymongo
import re
import signal
import socket
import sys
import sys
import time
import threading
from pymongo.errors import DuplicateKeyError, OperationFailure, InvalidDoc... |
EmergencyStopButton.py | """
Zachary Cook
Class representing the hardware emergency stop button.
"""
# Channel of the Emergency Stop button (Pin 11).
EMERGENCY_STOP_CHANNEL = 17
import threading
import time
from Controller import Observer
# RPi is only on the Raspberry Pi.
from RPi import GPIO
"""
Class representing an emergency stop... |
remote_benchmark.py | # Copyright (c) The Libra Core Contributors
# SPDX-License-Identifier: Apache-2.0
from ..business import VASPInfo, BusinessContext
from ..protocol import OffChainVASP
from ..libra_address import LibraAddress
from ..payment_logic import PaymentCommand, PaymentProcessor
from ..status_logic import Status
from ..storage i... |
settings_window.py | from tkinter import *
from tkinter import ttk, filedialog, messagebox
import threading
import json
import os
def reset_settings_window(win, download_btn, done_btn, _stabalize, apply_btn):
_stabalize[0] = 1
_stabalize[1] = 1
_stabalize[2] = 1
_stabalize[3] = 1
state = str(done_btn['state'])
if ... |
gui.py | import tkinter as tk
from tkinter import END
from tkinter import ttk
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import (
FigureCanvasTkAgg,
)
from gnt import *
from matplotlib.ticker import MaxNLocator
import threading
class MainWindow:
def __init__(self, root, color):
sel... |
app.py | # OVERALL IMPORTS
from flask import Flask, request
from threading import Thread
import schedule
import time
import os
import pdb
import json
# PODCAST IMPORTS
from podcasts.series_driver import SeriesDriver
from podcasts.episodes_driver import EpisodesDriver
from podcasts.site_crawler import SiteCrawler
from utils.cou... |
mnist1n2g.py | import os
import torch
import torch.distributed as dist
from torch.multiprocessing import Process
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.utils.data
import torch.utils.data.distributed
import torch.optim as optim
from torchvision import dataset... |
test_tracer.py | import time
import mock
import opentracing
from opentracing import Format
from opentracing import InvalidCarrierException
from opentracing import SpanContextCorruptedException
from opentracing import UnsupportedFormatException
from opentracing import child_of
import pytest
import ddtrace
from ddtrace.ext.priority imp... |
popen.py | #!/usr/bin/env python
# ~ Copyright 2014 Sjoerd Cranen, Wieger Wesselink
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
import time
import psutil
import threading
import subprocess
class TimeExceededError(Exception):
... |
core.py | # Copyright 2019 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 to in writin... |
test_ptds.py | import multiprocessing as mp
import logging
import traceback
from numba.cuda.testing import unittest, CUDATestCase
from numba.cuda.testing import skip_on_cudasim, xfail_with_cuda_python
def child_test():
from numba import cuda, int32, void
from numba.core import config
import io
import numpy as np
... |
spot_decoder.py | #!/usr/bin/env python
#
# Author: Alexander Sholohov <ra9yer@yahoo.com>
#
# License: MIT
#
import sys
import os
import re
import subprocess
import signal
import time
import datetime
import wave
import StringIO
import threading
import httplib, urllib
import urlparse
from inspect import isfunction
#------------------... |
app.py | # encoding: utf-8
'''
A REST API for Salt
===================
.. versionadded:: 2014.7.0
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
:depends: - CherryPy Python module
:optdepends: - ws4py Python module for websockets support.
:configuration: All authentication is done through Salt's :ref:`external auth... |
mesh.py | import os
import stat
import math
import time
import yaml
import json
import random
import urllib
import shutil
import logging
import argparse
import threading
from urllib.error import HTTPError
from http.client import InvalidURL
from graphqlclient import GraphQLClient
from kafka import KafkaProducer, KafkaConsumer
fro... |
spinner_thread.py | """
Des:python asyncio_18 线程实现
Date: 2021.05.17
"""
# 线程实现
import os
import sys
import time
import threading
from itertools import cycle
class Singal:
done = False
def thinking():
time.sleep(3)
return 42
def print_think(msg, singal):
for i in cycle('- \ | / '):
status = i + " " + m... |
utils.py | #----------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#------------------------------------------------------------------... |
train_policy.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
Adapted for use in CS294-112 Fall 2018 HW5 by Kate Rakelly and Michael Chang
"""
import numpy ... |
email.py | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg = Me... |
server.py | import socket
import threading
from random import randint
from map_generation.spread_players import spread_across_the_map
from server_utils.player import Player
FORMAT = 'utf-8'
HEADER = 200
def print_color(text):
print("\u001b[36m" + text + "\u001b[0m")
class Server:
def __init__(self, terrain_map):
... |
es.py | """
Setup (once only)
$ python app/es.py
Docker network
$ sudo docker network create twint-wikilink
$ sudo docker network connect twint-wikilink <wikilink-app-container-id>
$ sudo docker network connect twint-wikilink <twint-es-container-id>
$ ping -c 2 twintdevcontainer_es_1 -p 9200
Elasticsdump
$ multielasticdump -... |
opennebula_util.py |
"""
Copyright 2019 Atos
Contact: Javier Melián <javimelian@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 a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless req... |
tree-height.py | # python3
import sys, threading
sys.setrecursionlimit(10**7) # max depth of recursion
threading.stack_size(2**27) # new thread will get stack of such size
class TreeHeight:
def read(self):
self.n = int(sys.stdin.readline())
self.parent = list(map(int, sys.stdin.readline().spli... |
trainer.py | from collections import deque
import tensorflow as tf
import numpy as np
import copy
import time
import threading
import copy
class AgentInterface:
def act(self, state, reward, training):
raise NotImplementedError()
def stop_episode(state, reward, training):
raise NotImplementedError()
class... |
scheduler.py | #!/usr/bin/env python
# coding=utf-8
import time
from multiprocessing import Process
from async_proxy_pool.config import SERVER_HOST, SERVER_PORT, SERVER_ACCESS_LOG
from async_proxy_pool.webapi_sanic import app
from async_proxy_pool.logger import logger
from .config import CRAWLER_RUN_CYCLE, VALIDATOR_RUN_CYCLE
from ... |
compare_Walltoall_sgd.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
importlib.reload(qtm.base)
importlib.reload(qtm.constant)
importlib.reload(qtm.ansatz)
importlib.reload(qtm.fubini_study)
def run_wall... |
csclient.py | """
NCOS communication module for SDK applications.
Copyright (c) 2018 Cradlepoint, Inc. <www.cradlepoint.com>. All rights reserved.
This file contains confidential information of CradlePoint, Inc. and your use of
this file is subject to the CradlePoint Software License Agreement distributed with
this file. Unauthor... |
segment.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import json
import logging
import math
import os
import shutil
import sys
import threading
import time
from os.path import exists, join, split
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from PIL import Image
from torch import nn
f... |
winpdb.py | #! /usr/bin/env python
"""
winpdb.py
A GUI for rpdb2.py
Copyright (C) 2005-2009 Nir Aides
This program 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 2 of the License,... |
indexer.py | # Python packages
from __future__ import division
from __future__ import with_statement
import os
import multiprocessing
import threading
import Queue
import logging
import collections
import operator
import codecs
import string
import math
from wiki_dump_reader import page_generator, plain_page_generator
... |
mq_server_base.py | import os
import pika
from multiprocessing.pool import ThreadPool
import threading
import pickle
from functools import partial
from typing import Tuple
from queue import Queue
import time
from abc import ABCMeta,abstractmethod
import sys
sys.setrecursionlimit(100000)
import functools
import termcolor
import datetim... |
cnn_util.py | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
server.py | import os, struct, time, json
import socket, shutil
import psutil
from threading import Thread, Lock
with open('/etc/system_monitor.json', 'r') as f:
config = json.loads(f.read())
# ===============================================
# Utility functions to enumerate disks,
# mounted file systems etc
# ============... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
im... |
scheduler.py | import logging
import os
import signal
import time
import traceback
from datetime import datetime
from multiprocessing import Process
from redis import Redis, SSLConnection
from .defaults import DEFAULT_LOGGING_DATE_FORMAT, DEFAULT_LOGGING_FORMAT
from .job import Job
from .logutils import setup_loghandlers
from .queu... |
PythonExecutor.py | #!/usr/bin/env python
'''
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")... |
flippergui.py | import tkinter as tk
from tkinter import filedialog
import sys
import os
import flipper
import threading
from queue import Queue
from deckconverter import queue
from PIL import ImageTk, Image
import json
class FlipperGui(tk.Frame):
def __init__(self, master=None):
super().__init__(master, padx=12, pady=3)
... |
cloudformation.py | from .client import *
class cloudformation(client):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.client = self._get_client('cloudformation')
if 'ignore_drift' not in kwargs.keys() or (
kwargs['ignore_drift'] not in [True, False]
):
check_igno... |
test_eventhandler.py | # Copyright 2015 Cisco Systems, 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 writing... |
matrix.py | from typing import *
import asyncio
import concurrent.futures
import contextlib
import logging
import threading
import nio
from .config import Config
logger = logging.getLogger('synapse_anti_ping.Matrix')
class Matrix:
def __init__(self, config: Config) -> None:
self._loop = asyncio.get_event_loop()
... |
test_cuda.py | from itertools import repeat, chain, product
from typing import NamedTuple
import collections
import gc
import io
import os
import pickle
import queue
import sys
import tempfile
import threading
import unittest
import torch
import torch.cuda
import torch.cuda.comm as comm
from torch import multiprocessing as mp
from t... |
11_race_condition_problem.py | from logging_utils import info, THREAD_FORMAT
import logging
import threading
logging.basicConfig(level=logging.DEBUG, format=THREAD_FORMAT)
BALANCE = 0
def deposit() -> None:
global BALANCE
for _ in range(0, 1000000):
BALANCE += 10
def withdrawal() -> None:
global BALANCE
for _ in range(0, ... |
detector_utils.py | # Utilities for object detector.
import sys
import cv2
import os
import numpy as np
import tensorflow as tf
from threading import Thread
from datetime import datetime
from utils import label_map_util
from collections import defaultdict
from utils import circlemanager
detection_graph = tf.Graph()
sys.path.append("..")... |
swr_cached.py | from threading import Thread
from typing import Any, Optional
from .base import Api
from .cached import CachedApi
class SwrCachedApi(CachedApi):
"""SWR Cached API - Wraps an API to provide stale-while-revalidate caching.
Caches the response for `cache_time_in_seconds` seconds. After which,
subsequent ca... |
process.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import tempfile
import subprocess
import tensorflow as tf
import numpy as np
import tfimage as im
import threading
import time
import multiprocessing
edge_pool = None
parser = argp... |
AmqpLink.py | # Copyright (c) 2019 Iotic Labs Ltd. 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
#
# https://github.com/Iotic-Labs/py-IoticAgent/blob/master/LICENSE
#
# Unless re... |
SetInterval.py | import logging
import threading
import time
from typing import Any
class SetInterval:
def __init__(self, interval: float, action: Any) -> None:
"""コンストラクタ
Args:
interval (float): 呼び出し間隔
action (Any): 呼ぶ出す関数
"""
logging.info("init")
self.interval = i... |
store.py | from os import unlink, path, mkdir
import json
import uuid as uuid_builder
from threading import Lock
from copy import deepcopy
import logging
import time
import threading
# Is there an existing library to ensure some data store (JSON etc) is in sync with CRUD methods?
# Open a github issue if you know something :)
... |
ringbuffer.py | # ----------------------------------------------------------------------------
# Copyright (c) 2017 Massachusetts Institute of Technology (MIT)
# All rights reserved.
#
# Distributed under the terms of the BSD 3-clause license.
#
# The full license is in the LICENSE file, distributed with this software.
# -------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.