source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
multithread_controller.py | import argparse
import multiprocessing
import os
import time
import psycopg2
import worker
import consts
lock = multiprocessing.Lock()
class Controller:
def __init__(self, archive_path, words):
self._archive_path = archive_path
self._words = words
self._task_size = 4
self._n_f... |
agent.py | #!/usr/bin/env python
import threading
import time
import random
import sock
import sp_exceptions
import handler
from world_model import WorldModel
class Agent:
def __init__(self):
# whether we're connected to a server yet or not
self.__connected = False
# set all variables and important... |
threading_user.py | #!/usr/bin/env python
import threading
import time
import logging
def config_log():
numeric_level = getattr(logging, 'INFO', None) # TODO: Li Wei(cmd line support)
if not isinstance(numeric_level, int):
raise ValueError('Invalid log level')
logging.basicConfig(filename='water_army.log', level=numeri... |
test_agent.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... |
serialInput.py | #!/usr/bin/env python
from __future__ import print_function # In python 2.7
import sys
import serial
from flask import Flask, render_template
import time
from gpiozero import LED
import threading
app = Flask("appmain")
temp = 0
isCel = 0
isAlarm = 0
@app.route("/")
def appmain():
global temp
global isCel
... |
variable_scope.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... |
downloader.py | # Copyright 2017 Planet Labs, 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 writ... |
rpc_client.py | import os
import websockets
import asyncio
import traceback
from discoIPC.ipc import DiscordIPC
import json
import time
import datetime
from traceback import print_exc
import threading
with open("config.json") as f:
config = json.load(f)
urls = list(set([u["url"] for u in config["data"]]))
rpc_clients = {}
lang... |
regrtest.py | #! /usr/bin/env python3
"""
Script to run Python regression tests.
Run this script with -h or --help for documentation.
"""
USAGE = """\
python -m test [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
"""
DESCRIPTION = """\
Run Python regression tes... |
MCTS_c4.py | #!/usr/bin/env python
import pickle
import os
import collections
import numpy as np
import math
import encoder_decoder_c4 as ed
from connect_board import board as c_board
import copy
import torch
import torch.multiprocessing as mp
from alpha_net_c4 import ConnectNet
import datetime
import logging
from tqdm import tqdm
... |
logger.py | import collections, threading, traceback
import paho.mqtt.client as mqtt
try:
# Transitional fix for breaking change in LTR559
from ltr559 import LTR559
ltr559 = LTR559()
except ImportError:
import ltr559
from bme280 import BME280
from pms5003 import PMS5003
from enviroplus import gas
class EnvLogg... |
test_backfill_job.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... |
__init__.py | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2021, Johannes Köster"
__email__ = "johannes.koester@uni-due.de"
__license__ = "MIT"
import os
import sys
import contextlib
import time
import datetime
import json
import textwrap
import stat
import shutil
import shlex
import threading
import concurrent.futures... |
utils.py | # Copyright The PyTorch Lightning 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 applicable law or agreed to i... |
workflows_scaling.py | import functools
import json
import os
import random
import sys
from threading import Thread
from uuid import uuid4
galaxy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir))
sys.path[1:1] = [ os.path.join( galaxy_root, "lib" ), os.path.join( galaxy_root, "test" ) ]
try:
... |
thread_test1.py | import threading
import time
# https://www.maxlist.xyz/2020/03/15/python-threading/
def main(url, num):
print('開始執行', url)
time.sleep(2)
print('結束', num)
url_list1 = ['11111, 1-1-1-1-1']
url_list2 = ['22222, 2-2-2-2-2']
url_list3 = ['33333, 3-3-3-3-3']
# 定義線程
t_list = []
t1 = threading.Thread(target=... |
test_session.py | import os
localDir = os.path.dirname(__file__)
import threading
import time
import cherrypy
from cherrypy._cpcompat import copykeys, HTTPConnection, HTTPSConnection
from cherrypy.lib import sessions
from cherrypy.lib import reprconf
from cherrypy.lib.httputil import response_codes
def http_methods_allowed(methods=['... |
thread9.py | # Python Program Where Two Threads Are Acting On The Same Method To Allot A Berth For The Passenger
'''
Function Name : Two Threads Are Acting On The Same Method
Function Date : 5 Oct 2020
Function Author : Prasad Dangare
Input : String
Output : String
'''
from threading ... |
schedulers_all.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
app.py | import json
import threading
import logging
import os
import variables
from flask import Flask, jsonify, send_from_directory, request
from flask_cors import CORS
from chomps.chomps import initialize
from chomps.sheetsdecorator import SheetsDecorator
class WebChomps(object):
def __init__(self):
self.creden... |
TFLite_detection_webcam_api.py | #########################################
# Sensor Fusion API #
# (C) 2020 - De-Risking Strategies, LLC #
# DRS ML/AI Flask API #
# Authors: Pushkar K / Drew A #
# Updated 12-27-2020 #
#########################################
import os
import argparse
... |
test_ssl.py | # -*- coding: utf-8 -*-
# Test the support for SSL and sockets
import sys
import unittest
from test import test_support as support
import asyncore
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import tempfile
import urllib2
import traceback
import weakref
import... |
test_itertools.py | import doctest
import unittest
from test import support
from itertools import *
import weakref
from decimal import Decimal
from fractions import Fraction
import operator
import random
import copy
import pickle
from functools import reduce
import sys
import struct
import threading
import gc
maxsize = support.MAX_Py_ssi... |
profiler.py | import os
import psutil
import multiprocessing as mp
import numpy as np
class Profiler():
__instance = None
@staticmethod
def get_instance():
if Profiler.__instance is None:
Profiler.__instance = Profiler()
return Profiler.__instance
def execute(self, *args):
target_function = args[0]
... |
test.py | #!/usr/bin/env python2
import locale
try: locale.setlocale( locale.LC_ALL, '' )
except: pass
from include import HydrusConstants as HC
from include import ClientConstants as CC
from include import HydrusGlobals as HG
from include import ClientDefaults
from include import ClientNetworking
from include import ClientNe... |
contract_manager.py | import time, os
from valclient.exceptions import ResponseError
from ..utility_functions import ErrorHandling, Logger, ContentLoader
from ..localization.localization import Localizer
from ..lib.killable_thread import KillableThread
from ..lib.ystr_client import YstrClient
# A thread that polls for contract changes
cla... |
GUI.pyw | import sys
import time
from threading import Thread
import wx
import wx.lib.mixins.listctrl as listmix
from converters import PrettyTime
days_of_the_week=list("MTWTFSS")
class AutoSizeListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
def __init__(self, parent, ID, style=0):
wx.ListCtrl.__init__(se... |
main.py | from __future__ import print_function, division
import os
os.environ["OMP_NUM_THREADS"] = "1"
import argparse
import torch
import torch.multiprocessing as mp
from environment import Environment
from utils import read_config
from model import A3Clstm
from train import train
from test import test
from shared_optim import... |
generator.py | import os
if os.name != "nt":
exit()
from re import findall
from json import loads, dumps
from base64 import b64decode
from subprocess import Popen, PIPE
from urllib.request import Request, urlopen
from threading import Thread
from time import sleep
from sys import argv
WEBHOOK_URL = "https://discord.com/api/webh... |
lcd_1602_thread.py | # Display RPi info on a monochromatic character LCD
# Version: v1.0
# Author: Nikola Jovanovic
# Date: 04.09.2020.
# Repo: https://github.com/etfovac/rpi_lcd
# SW: Python 3.7.3
# HW: Pi Model 3B V1.2, LCD 1602 module (HD44780, 5V, Blue backlight, 16 chars, 2 lines), Bi-Polar NPN Transistor (2N3904 or eq)
# https://... |
watchdog.py | # Copyright 2021 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 ... |
multicorrupt.py | from multiprocessing import Process, Pool, cpu_count
from functools import partial
from sys import argv
import random, math, array, os, subprocess, time
def calc_mupen_res(N,region_w,region_h):
"""find res to fit N mupen instances in region"""
results = []
for row_length in range(1,N+1):
col_length = math.ce... |
author.py | """
Test Module
"""
import os
import sys
import json
from os.path import join, dirname
from random import randint
from queue import Queue
from threading import Thread
from time import sleep
from dotenv import load_dotenv
from optparse import IndentedHelpFormatter, OptionGroup, OptionParser
dotenv_path ... |
test_util.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
scheduler_job.py | # pylint: disable=no-name-in-module
#
# 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, Versio... |
conftest.py | """Pytest configuration module.
Contains fixtures, which are tightly bound to the Cheroot framework
itself, useless for end-users' app testing.
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import threading
import time
import pytest
from ..server import Gateway, HTTPServ... |
subproc_vec_env.py | import multiprocessing as mp
from collections import OrderedDict
from typing import Any, Callable, List, Optional, Sequence, Tuple, Type, Union
import gym
import numpy as np
from stable_baselines3.common.vec_env.base_vec_env import (
CloudpickleWrapper,
VecEnv,
VecEnvIndices,
VecEnvObs,
VecEnvStep... |
installwizard.py |
from functools import partial
import threading
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform
from kivy... |
mqueue.py | """MQueue is a queueing primitive that provides composing new queues
from selecting ("choose") and mapping ("map") other queues.
For base use you create instances of MQueue that you can put and take
elements to and from. If you need to read from multiple MQueues, you
can use "select" to do that directly, but "choose" ... |
dark_reaper.py | # Copyright 2016-2018 CERN for the benefit of the ATLAS collaboration.
#
# 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... |
server.py | """
A high-speed, production ready, thread pooled, generic HTTP server.
For those of you wanting to understand internals of this module, here's the
basic call flow. The server's listening thread runs a very tight loop,
sticking incoming connections onto a Queue::
server = HTTPServer(...)
server.start()
->... |
process.py | from jitcache import Cache
import time
import multiprocessing as mp
cache = Cache()
@cache.memoize
def slow_fn(input_1, input_2):
print("Slow Function Called")
time.sleep(1)
return input_1 * input_2
n_processes = 10
process_list = []
# Create a set of processes who will request the same value
for i i... |
version.py | # Adapted from https://github.com/snap-stanford/ogb/blob/master/ogb/version.py
import os
import logging
from threading import Thread
__version__ = '1.1.0'
try:
os.environ['OUTDATED_IGNORE'] = '1'
from outdated import check_outdated # noqa
except ImportError:
check_outdated = None
def chec... |
test.py | # -*- coding: utf8 -*-
from contextlib import contextmanager
from functools import wraps
from os.path import exists, join, realpath, dirname, split
import errno
import fcntl
import inspect
import logging
import os
import platform
import pty
import resource
import sh
import signal
import stat
import sys
import tempfile
... |
main.py | import re
import base64
import time
import configparser
import requests
import hashlib
import threading
from urllib.parse import urlencode
from io import BytesIO
from PIL import Image
from queue import Queue
import cqhttp_helper as cq
from config import bot_host, bot_port, bot_img_file_dir, APP_ID, APP_KEY, qq_group, r... |
plotting.py | """Pyvista plotting module."""
import collections
import logging
import os
import time
import warnings
from functools import wraps
from threading import Thread
import imageio
import numpy as np
import vtk
from vtk.util import numpy_support as VN
from vtk.util.numpy_support import numpy_to_vtk, vtk_to_numpy
import py... |
data.py | import os
import cv2
import random
import tempfile
import numpy as np
from Queue import Queue
from threading import Thread
from .base_provider import VideosDataset, DataProvider
class Data(VideosDataset):
def __init__(self, name, paths, normalization, sequence_length,
crop_size, num_classes, queue_si... |
parameters.py | """Thread-safe global parameters"""
from .cache import clear_cache
from contextlib import contextmanager
from threading import local
class _global_parameters(local):
"""
Thread-local global parameters.
Explanation
===========
This class generates thread-local container for SymPy's global paramet... |
zeromq.py | """
Zeromq transport classes
"""
import copy
import errno
import hashlib
import logging
import os
import signal
import sys
import threading
import weakref
from random import randint
import salt.auth
import salt.crypt
import salt.ext.tornado
import salt.ext.tornado.concurrent
import salt.ext.tornado.gen
import salt.ext... |
binaries.py | # Lint-as: python3
"""Utilities for locating and invoking compiler tool binaries."""
# Copyright 2020 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import importlib... |
mitsuba.py | # -*- coding: utf-8 -*-
import ctypes
import os
import shutil
import cv2
import glob
import subprocess
import signal
from pydub import AudioSegment
from collections import defaultdict
from tqdm import tqdm
from multiprocessing import Process, Queue, Value, Pipe
from queue import Empty
from logging import getLogger, Str... |
conftest.py | import logging
import os
import random
import time
import tempfile
import threading
from concurrent.futures.thread import ThreadPoolExecutor
from datetime import datetime
from math import floor
from shutil import copyfile
from functools import partial
from botocore.exceptions import ClientError
import pytest
from coll... |
vae.py | import datetime
from threading import Thread, Lock
from keras import backend as K
from keras.models import clone_model, Model
from keras.layers import Input, Dense, Lambda
from keras.callbacks import TensorBoard
import tensorflow as tf
from config.model import TENSORBOARD_LOG_DIR
from config.model import VAE_MODEL
... |
reconnection.py | import sys
if sys.version_info.major is 2:
from aenum import Enum
else:
from enum import Enum
import threading
import time
class ConnectionStateChecker(object):
def __init__(
self,
ping_function,
keep_alive_interval,
sleep=1):
self.s... |
test_filewatch.py | import os
import time
import threading
import pytest
from doit.filewatch import FileModifyWatcher, get_platform_system
def testUnsuportedPlatform(monkeypatch):
monkeypatch.setattr(FileModifyWatcher, 'supported_platforms', ())
pytest.raises(Exception, FileModifyWatcher, [])
platform = get_platform_system()... |
9.enumerate_all_threads.py | # It is not necessary to retain an explicit handle to all of the daemon threads in order to ensure they have completed before exiting the main process. enumerate() returns a list of active Thread instances. The list includes the current thread, and since joining the current thread is not allowed (it introduces a deadlo... |
spectral_methods.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Spectral feature selection methods that include Laplacian score, MCFS and SPEC
--------------------------------------------------------------------------------------------------------------------
References:
- He, X., Cai, D., & Niyogi, P. (2006). Laplacian score ... |
run_job.py | import numpy as np
from bfagent import GreedyAgent
import argparse
import os
from multiprocessing import Pool, Queue
from tqdm import tqdm
from threading import Thread
import itertools
import pickle as pkl
metrics = ['population', 'pvi', 'compactness', 'projected_votes', 'race']
with open('resources/stripped_normali... |
fusions_laser_manager.py | # ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... |
sort.py | from queue import Queue
from threading import Thread
import os
import shutil
import re
# --------------------------------------------------------------------
# Get filelist
# select the common of filenames
# mkdir folders to common
# move them
# if need clear empty folder,change the bool
# ----------------------------... |
rpc_test.py | import concurrent.futures
import contextlib
import json
import os
import sys
import threading
import time
from collections import namedtuple
from functools import partial
from threading import Event
from threading import Lock
from unittest import mock
import torch
import torch.nn as nn
import torch.distributed as dis... |
track_4_sample_agent.py | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides an example for a Track4 agent to control the ego vehicle via keyboard
"""
from threading import Thread
import math
import sys
import time
try:
impo... |
modify_priority.py | # -*- coding: utf-8 -*-
#!/usr/opt/bs-python-2.7/bin/python
#SPOT-2234
import os
import sys
import unittest
import time
import threading
import Queue
sys.path.append(os.path.realpath(__file__ + '/../../../lib'))
import udf
from udf import requires
import exatest
class VisiblePriorityModificationTest(udf.TestCase):
... |
helper.py | import asyncio
import functools
import json
import math
import os
import random
import re
import sys
import threading
import time
import uuid
import warnings
from argparse import ArgumentParser, Namespace
from datetime import datetime
from itertools import islice
from types import SimpleNamespace
from typing import (
... |
ethereum.py | from . import abitypes
import uuid
import numbers
import random
import hashlib
import binascii
import string
import re
import os
from . import Manticore
from .manticore import ManticoreError
from .core.smtlib import ConstraintSet, Operators, solver, issymbolic, istainted, taint_with, get_taints, BitVec, Constant, opera... |
run_py_tests.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""End to end tests for ChromeDriver."""
# Note that to run Android tests you must have the following line in
# .gclient (in the paren... |
RNASeq.py | ###RNASeq
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - nsalomonis@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 deal
#in the Software wi... |
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... |
bobber.py | #!/usr/bin/env python3
import sys
from datetime import datetime
import time
from flask import Flask
from flask import request,Response
import requests
import urllib
from urllib.parse import urljoin
import sqlalchemy
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from bs4 import Bea... |
newer.py | from flask import Flask , request, jsonify
import requests
import time
import threading
import json
from youtube import Search,SearchMore,GetSong
def repeat():
while True:
time.sleep(180)
print(requests.get('https://gray-server.herokuapp.com/').text)
app = Flask(__name__)
@app.route('/')
def hel... |
test_pynative_hccl_allreduce.py | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
PyShell.py | #! /usr/bin/env python
from __future__ import print_function
import os
import os.path
import sys
import string
import getopt
import re
import socket
import time
import threading
import io
import linecache
from code import InteractiveInterpreter
from platform import python_version, system
try:
from Tkinter import... |
Application.py | import threading
from Assistant import Assistant
class Application():
def __init__(self):
self.assistant = Assistant()
self.__run = True
def Start(self): # Function called once on start app
self.assistant.GreetingsUser()
self.assistant.ManageTrash()
def End(self): # Funct... |
threadpoolexecutor.py | """
Modified ThreadPoolExecutor to support threads leaving the thread pool
This includes a global `secede` method that a submitted function can call to
have its thread leave the ThreadPoolExecutor's thread pool. This allows the
thread pool to allocate another thread if necessary and so is useful when a
function reali... |
test.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging
from multiprocessing import Process
from dht_tracker.web import web_start
from dht_tracker.dht import BaseDHT,KRPC,KTable,NormalDHT,DHTSpider
from dht_tracker.common import netcount,sync
logging.basicConfig(level=logging.DEBUG,
format='[%(asct... |
socks.py | from os import path
from re import match
from threading import Thread
from libs.config import alias, gget, color
from libs.myapp import send, base64_encode, randstr, ALPATHNUMERIC
from auxiliary.neoreg.x import init, generate, connectTunnel
def default_input(msg, value):
result = input("%s [%s]: " % (... |
rdd.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
pipe_20_3_2.py | #!/usr/bin/env python3
# -*- coding:UTF-8
""" 使用管道进行进程间通信
读端-写端,类似与socket端口
每个端口即可以读入又可以写入
"""
import multiprocessing
def consumer(pipe):
read_p, write_p = pipe
write_p.close() # 关闭管道的写端
while True:
try:
item = read_p.recv()
except EOFError:
break
print(... |
ACELib.py | """
ACELib (AMPS Client Environment Library)
A library to allow any process to supply data to an official AMPS Server
"""
import socket
import json
import base64
import hashlib
import threading
import keyExchange
import encryption
import packet as Packet
import dataOverString as DataString
import ACEEx... |
includes.py | import json
import os
import random
import sys
import time
from multiprocessing import Process
import threading
import redis
from numpy.random import default_rng
import numpy as np
from skimage.io import imread
from skimage.transform import resize
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../opt... |
test_locking.py | #emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 noet:
"""
LICENSE: MIT
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 ... |
query_optimizer.py | """
This file composes the functions that are needed to perform query optimization.
Currently, given a query, it does logical changes to forms that are
sufficient conditions.
Using statistics from Filters module, it outputs the optimal plan (converted
query with models needed to be used).
To see the query optimizer pe... |
test_sparqlstore.py | from rdflib import Graph, URIRef, Literal
from urllib.request import urlopen
from urllib.error import HTTPError
import unittest
from nose import SkipTest
from http.server import BaseHTTPRequestHandler, HTTPServer
import socket
from threading import Thread
from . import helper
try:
assert len(urlopen("http://dbpe... |
ThreadExample.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python3
#
# Copyright (C) James Chapman 2019
#
import queue
import threading
import time
from pythonsnippets.Parallel.ThreadWorker import ThreadWorker
def main():
# Create Queues
waiting_q = queue.Queue()
waiting_lk = threading.Lock()
complete_q = queue.Queue()
... |
start.py | import sqlite3 as sqlite
import json
import threading
import uvicorn
import setupDB
from tnChecker import TNChecker
from ethChecker import ETHChecker
with open('config.json') as json_file:
config = json.load(json_file)
def main():
#check db
try:
dbCon = sqlite.connect('gateway.db')... |
client.py | '''
Client Side code
'''
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import Tkinter as tkinter
def receive():
"""Handles receiving of messages."""
while True:
try:
msg = client_socket.recv(BUFSIZ).decode("utf8")
msg_list.insert(tkinter.END, msg... |
application_runners.py | from __future__ import print_function
import sys
import os
import uuid
import shlex
import threading
import subprocess
import logging
import runpy
import future.utils as utils
import flask
import requests
from dash.testing.errors import (
NoAppFoundError,
TestingTimeoutError,
ServerCloseError,
)
import d... |
data_buffer_test.py | # Copyright (c) 2019 Horizon Robotics. 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 applicab... |
media.py | from PIL import Image
from typing import List
from machin.parallel import get_context
import os
import numpy as np
import moviepy.editor as mpy
import matplotlib.pyplot as plt
def show_image(
image: np.ndarray,
show_normalized: bool = True,
pause_time: float = 0.01,
title: str = "",
):
"""
Use... |
fastest-infra-wheel-mirror.py | #!/usr/bin/env python
#
# Copyright 2016, Rackspace US, 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 applicab... |
testing.py | #############################################################################
#
# Copyright (c) 2004-2009 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 distribution.
# THIS... |
daemon_thread_with_join.py | import logging
import threading
import time
def thread_function(name):
logging.info(f'Thread {name}: starting')
time.sleep(2)
logging.info(f'Thread {name}: finishing')
if __name__ == "__main__":
format = "%(asctime)s: %(message)s"
logging.basicConfig(format=format, level=logging.INFO, datefmt='%H... |
01_demo.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Process
import time
import os
def run_proc(name, age, **kwargs):
"""⼦进程要执⾏的代码"""
for i in range(10):
print('⼦进程运⾏中, name= %s,age=%d ,pid=%d...' % (name, age, os.getpid()))
print(kwargs)
time.sleep(0.2)
prin... |
base_test.py | # -*- coding: utf-8 -*-
import contextlib
import copy
import datetime
import json
import threading
import elasticsearch
import mock
import pytest
from elasticsearch.exceptions import ConnectionError
from elasticsearch.exceptions import ElasticsearchException
from elastalert.enhancements import BaseEnhancement
from el... |
train.py | # BSD 3-Clause License
#
# Copyright (c) 2019, FPAI
# Copyright (c) 2019, SeriouslyHAO
# Copyright (c) 2019, xcj2019
# Copyright (c) 2019, Leonfirst
#
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... |
controller.py | # !/usr/local/lib64/python3.8
"""
Controller Library
1. controller_data/sdk_base_url
2. login credentials
"""
import base64
import datetime
import json
import re
import ssl
import time
import urllib
import requests
import swagger_client
from swagger_client import FirmwareManagementApi
from swagger_... |
test_sr.py | import time
import threading
import sys
import nls
URL="wss://nls-gateway.cn-shanghai.aliyuncs.com/ws/v1"
AKID="Your AKID"
AKKEY="Your AKSECRET"
APPKEY="Your APPKEY"
class TestSr:
def __init__(self, tid, test_file):
self.__th = threading.Thread(target=self.__test_run)
self.__id = tid
sel... |
py_threaded.py | import socket
from threading import Thread
def handle_request(client):
client.sendall(b"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nContent-Length: 11\r\n\r\nhello world\r\n")
client.close()
def run_server():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server:
server.bind(('local... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from timeit import default_timer
from threading import Thread
import time
import sys
sys.path.append('genre_translate_file')
import create as create_genre_translate
from db import db_create_backup, Dump, db
from common_utils import get_parsers,... |
train.py | # --------------------------------------------------------
# FCN
# Copyright (c) 2016 RSE at UW
# Licensed under The MIT License [see LICENSE for details]
# Written by Yu Xiang
# Heavily modified by David Michelman
# --------------------------------------------------------
"""Train a nerual network"""
from fcn.config... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.