source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
eval.py | from dataloader import EvalDataset, TrainDataset
from dataloader import get_dataset
import argparse
import torch.multiprocessing as mp
import os
import logging
import time
import pickle
import line_profiler
backend = os.environ.get('DGLBACKEND')
if backend.lower() == 'mxnet':
from train_mxnet import load_model_fr... |
Facepager.py | #!/usr/bin/env python
"""Facepager was made for fetching public available data from Facebook, Twitter and other JSON-based API. All data is stored in a SQLite database and may be exported to csv. """
# MIT License
# Copyright (c) 2016 Till Keyling and Jakob Jünger
# Permission is hereby granted, free of charge, to ... |
example2.py | # ch17/example2.py
import sys; sys.setswitchinterval(.000001)
import threading
def foo():
global my_list
my_list.append(1)
my_list = []
threads = []
for i in range(1000):
thread = threading.Thread(target=foo)
threads.append(thread)
for thread in threads:
thread.start()
for thread in threads:
... |
assistant.py | from text_to_speech import *
from speech_to_text import *
from similary import *
import datetime
from test_api import *
from lib import *
from threading import Thread
import csv
# data = my_data()
# # data = shuffle(data)
# train = data
# test = data[:20]
# X_train = np.array([i[0] for i in train]).reshape(-1,50,50,1... |
tcp_echo_client.py | # Copyright 2015 ARM Limited, 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 law or a... |
client.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import socket
import threading
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('127.0.0.1', 8888))
def reader(fd):
for line in fd:
print("Received: ", line)
fd.close()
# 单独开一个reader线程
t = th... |
HorizonMusic.py | import socket
import threading
from src.network import ClientManeger
from src.ui.UIHandler import HorizonMusicApp
from src.utils.Logger import Logger
from src.utils.Constants import Network
class HorizonMusic:
def __init__(self, logger):
self.logger = logger
self.app = HorizonMusicApp(self.logger... |
test_server.py | from itertools import product
import os
import requests
TEST_PORT = 10000
def func_test_thread(return_value: list):
try:
host = f'http://127.0.0.1:{TEST_PORT}'
AGENTS = [] # agents to be created
for table_id, position, ai_type in product(range(2), range(1, 4), ['entangled_endive']):
... |
hkCamera.py | #!/usr/bin/env python
#-*-coding:UTF-8-*-
import rospy
from camConfig import *
import os
import cv2
import gc
from multiprocessing import Process, Manager
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
def ip2Str(usrName,passwd,ip):
return "rtsp://"+str(usrName)+":"+str(passwd)+"@... |
emake.py | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
#======================================================================
#
# emake.py - emake version 3.6.9
#
# history of this file:
# 2009.08.20 skywind create this file
# 2009.11.14 skywind new install() method
# 2009.12.22 skywind implementation execute int... |
reloader.py | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
A file monitor and server restarter.
Use this like:
..code-block:: Python
import reloader
reloader.install()
Then make sure your server... |
python_spider.py | # -*- coding: utf-8 -*-
__author__ = 'PGY'
import timeit
start = timeit.default_timer()
import threading
import requests
import re
import socket
import time
import random, math
from bs4 import BeautifulSoup, SoupStrainer
#socket.setdefaulttimeout(30)
def get_single_item_data(item_url):
'''function to get the roo... |
test_cpp_mmp_client.py | import multiprocessing as mp
from pathlib import Path
import subprocess
import ymmsl
from ymmsl import Port, Reference
from libmuscle.logging import LogLevel, LogMessage, Timestamp
from libmuscle.manager.instance_registry import InstanceRegistry
from libmuscle.manager.logger import Logger
from libmuscle.manager.mmp_s... |
session.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... |
buf.py | import sys
import json
import logging
import os
import multiprocessing
import threading
# from queue import Queue
from collections import defaultdict
# from fours_topo import fourswitch
from time import time
import time
import cPickle as pickle
from ryu.base import app_manager
from ryu.controller import ofp_event
from... |
thread.py | # -*- coding: Utf-8 -*
from threading import Thread
from functools import wraps
def threaded_function(function):
@wraps(function)
def wrapper(*args, **kwargs) -> Thread:
thread = Thread(target=function, args=args, kwargs=kwargs, daemon=True)
thread.start()
return thread
return wr... |
fix_time_retrieved.py | import json
import os
from argparse import ArgumentParser
from datetime import datetime
from multiprocessing.context import Process
from multiprocessing import JoinableQueue
from typing import Generator
from attr import attrs
from bson import ObjectId
from pymongo import UpdateOne
from extraction.utils import get_sit... |
hotword_factory.py | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
tpu_estimator.py | # Copyright 2017 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... |
Luxocator.py | #!/usr/bin/env python
import numpy # Hint to PyInstaller
import cv2
import os
import threading
import wx
from HistogramClassifier import HistogramClassifier
from ImageSearchSession import ImageSearchSession
import PyInstallerUtils
import ResizeUtils
import WxUtils
class Luxocator(wx.Frame):
def __init__(self,... |
pickletester.py | import collections
import copyreg
import dbm
import io
import functools
import os
import math
import pickle
import pickletools
import shutil
import struct
import sys
import threading
import unittest
import weakref
from textwrap import dedent
from http.cookies import SimpleCookie
try:
import _testbuffer
except Impo... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function
import os
import re
import sys
import copy
import time
import errno
import types
import signal
import fnmatch
import hashlib
import logging
import threading
import traceback
import mul... |
mearmlib.py | from logging import getLogger, basicConfig, DEBUG, INFO
from time import time, sleep
import threading
import configparser
logger = getLogger(__name__)
basicConfig(
level=INFO,
format="%(asctime)s %(levelname)s %(name)s %(funcName)s(): %(message)s")
import mearm
""" load config """
config = configparser.Config... |
bot_main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: CryptON
# @Date: 2021-10-07
# @Last Modified by: CryptON
__author__ = "CryptON"
__copyright__ = "Copyright 2021, CryptON"
__license__ = "MIT"
__version__ = "0.0.1 Beta"
__maintainer__ = "CryptON"
__email__ = "CryptON112358@protonmail.com"
import sys
import os
... |
webcore.py | # Copyright 2011,2012,2018 James McCauley
#
# 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 t... |
__init__.py |
"""
BSD 3-Clause License
Copyright (c) 2021, Muhammed Bassiouni
All rights reserved.
"""
import sys
import platform
import os
import shutil
import tkinter as tk
from cefpython3 import cefpython as cef
from threading import Thread
from photongui.util import logger, threaded
from photongui.window imp... |
kb_cmashServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
import os
import json
from threading import Thread
import time
import csv
import decimal
from decimal import Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintError, ThreadJob
# See https://en.wikipedia.org/wiki/ISO_42... |
test_swagger.py | """Unit tests for Annif REST API / Swagger spec"""
from swagger_tester import swagger_test
import time
import threading
import os
import requests
def test_swagger(app):
# run a Flask/Connexion server in a background thread
def run_app():
# We need to set this env var to 'false' because otherwise Fla... |
purpledrop.py | """Low-level driver for communicating with PurpleDrop via serial messages
"""
import inspect
import fnmatch
import logging
import queue
import struct
import serial
import serial.tools.list_ports
import sys
import threading
import time
from typing import Any, AnyStr, Callable, Dict, List, Optional, Sequence
from purple... |
basic_queue.py | from fiber import Process, SimpleQueue
def foo(q, a, b):
q.put(a + b)
if __name__ == '__main__':
q = SimpleQueue()
p = Process(target=foo, args=(q, 42, 21))
p.start()
print(q.get())
p.join()
|
impala_rollout.py | import copy
from multiprocessing import Array
import numpy as np
import torch.multiprocessing as mp
from impala.actor import actor
from impala.learner import learner
from impala.model import Network
NUM_ACTORS = 4
ACTOR_TIMEOUT = 500000
class ImpalaRollout:
def __init__(self, env):
self.env = copy.dee... |
01_store_configs.py | import threading
from netmiko import ConnectHandler
# Declare devices to automate (inventory)
INV = {
"csr1": {
"device_type": "cisco_ios",
"username": "ntc",
"password": "ntc123",
"conf_command": "show run"
},
"csr2": {
"device_type": "cisco_ios",
... |
conftest.py | import pytest
import time
from context import HGECtx, HGECtxError, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient
import threading
import random
from datetime import datetime
import sys
import os
def pytest_addoption(parser):
parser.addoption(
"--hge-urls",
metavar="HGE_URLS",
help="csv li... |
test_html.py | from functools import partial
from importlib import reload
from io import BytesIO, StringIO
import os
from pathlib import Path
import re
import threading
from urllib.error import URLError
import numpy as np
import pytest
from pandas.compat import is_platform_windows
from pandas.errors import ParserError
import pandas... |
demo2.py | """
【Python多任务编程】join阻塞方法 2019/11/01 22:36
"""
# TODO: 1.父进程会等待子进程执行完毕后再退出
"""
如果在父进程中执行完所有代码后,还有子进程在执行,那么父进程会等待子进程执行完所有代码后再退出。
"""
# TODO: 2.Process对象的join方法
"""
使用Process创建了子进程,调用start方法后,父子进程会在各自的进程中不断的执行代码。
有时候如果想等待子进程执行完毕后再执行下面的代码,那么这时候可以调用join方法。
join方法还可以传一个timeout,用来指定等待的最长时间。
"""
from multiprocessing impor... |
db_pool.py | import json
from collections.abc import Iterable
from functools import partial
from platform import system
from threading import Lock, Thread
from time import sleep
from typing import List, Dict, Any, Optional, Callable
from easyconnect.types import pymysql, pypyodbc
SERVERS = {}
class TmpConnection:
def __init... |
multproctest.py | from multiprocessing import Process, Queue
def f(val, pos, queue):
queue.put((val, pos))
if __name__ == '__main__':
alist = [0, 0]
pqueue = Queue()
pone = Process(target=f, args=(1, 1, pqueue))
ptwo = Process(target=f, args=(2, 0, pqueue))
pone.start()
ptwo.start()
pone.join()
pt... |
scan.py | import socket
import threading
import re
class Scanner:
def port_check_thread(file, ip, port):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.04)
rslt = sock.connect((str(ip), port))
if rslt == None:
file.w... |
test_client.py | # coding: utf-8
import struct
from Queue import Empty
from functools import partial
from contextlib import contextmanager
from multiprocessing import Process
from tornado import ioloop
from lantern.app import start_client
from lantern.config import PORT
from lantern.lantern import Lantern
from mock_server import Lant... |
ThreadSafeConnect.py | #! /usr/bin/env python
"""
# ThreadSafeConnect.py : stress thread safeness of
# SCardConnect/SCardDisconnect
# Copyright (C) 2010 Ludovic Rousseau
"""
# 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 S... |
mainwindow.py | """
Main application window for starcheat GUI
"""
import sys
import logging
import json
from PyQt5 import QtWidgets
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QTableWidgetItem
from PyQt5.QtWidgets import QFileDialog
from PyQt5.... |
mnist_cnn_avg_grad.py | import argparse
import os
import sys
import torch
import torch.distributed as dist
import torch.optim as optim
from math import ceil
from torch.multiprocessing import Process
sys.path.append("../")
sys.path.append("../../")
from archived.ec2.trainer import Trainer
from archived.ec2 import partition_mnist
from arch... |
hdp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import getopt
import getpass
import paramiko
import ConfigParser
import subprocess
import threading
cf = ConfigParser.ConfigParser()
def usage():
print "Usage: ....."
def readConfig(filepath='/opt/hdp.ini'):
if not os.path.isfile(filepath):
... |
parallel_loop.py | # Copyright (c) 2016-2017 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
import logging
import multiprocessing
import os
import psutil
impo... |
spider.py | import requests
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import threading
import time
requests.packages.urllib3.disable_warnings() # noqa
class Dict(dict):
def __getattr__(self, item):
pass
class Spider:
def __init__(self, url=None):
self.url = url
self.level_d... |
test_reservation.py | import threading
import unittest
from tensorflowonspark.reservation import Reservations, Server, Client
class ReservationTest(unittest.TestCase):
def test_reservation_class(self):
"""Test core reservation class, expecting 2 reservations"""
r = Reservations(2)
self.assertFalse(r.done())
# add first... |
main_experiment.py | import logging
import os
import sys
import time
import argparse
import multiprocessing as mp
import numpy as np
import torch
from src.utils.args import save_args
from src.utils.args import init_argparser
from src.utils.args import clone_args
from src.utils.utils import set_cuda_device, setup_logging, time_delta_now
f... |
process_helper.py | #!/usr/bin/env python3
import queue
import time
import os
import atexit
import subprocess
import shutil
import threading
import errno
from typing import Any, Dict, List, TextIO, Optional
class Runner:
def __init__(self,
log_dir: str,
model: str,
case: str,
... |
DownloaderController.py | from fastapi import APIRouter
from fastapi.responses import FileResponse
from pydantic.types import confloat
import wget
import threading
import time
import moviepy.editor as mp
from datetime import datetime
from sys import path as pylib
import os
pylib += [os.path.abspath(r'../Repositories')]
from models import Conv... |
_server.py | # Copyright 2016 gRPC 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 applicable law or agreed to in writing... |
concurrency4.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import random
from multiprocessing import Process
def calculatePrimeFactors(n):
primfac = []
d = 2
while d * d <= n:
while (n % d) == 0:
primfac.append(d)
n //= d
d += 1
if n > 1:
primfac.append(... |
directory_search.py | """
Python 3 Object-Oriented Programming
Chapter 14. Concurrency
"""
from __future__ import annotations
from pathlib import Path
from typing import List, Iterator, Optional, Union, TYPE_CHECKING
if TYPE_CHECKING:
Query_Q = Queue[Union[str, None]]
Result_Q = Queue[List[str]]
def search(paths: list[Path], qu... |
tests.py | # -*- coding: utf-8 -*-
"""
Web Console Api Client
"""
import threading
from common import utils
import time
def delete_test1(request):
openstack_client = utils.get_openstack_client(request)
pool_delete = openstack_client.load_balancer.delete_pool(pool_id="bf0b150c-4221-4112-9589-8b3b943db142")
def update_te... |
timeline_view.py | from numpy import disp
from qiskit.converters import dag_to_circuit, circuit_to_dag
from qiskit.dagcircuit import DAGCircuit
from collections import defaultdict
from threading import Thread
from datetime import datetime
import html
import ipywidgets as widgets
from IPython.display import HTML
from .button_... |
test_celery.py | import threading
import pytest
pytest.importorskip("celery")
from sentry_sdk import Hub
from sentry_sdk.integrations.celery import CeleryIntegration
from celery import Celery, VERSION
from celery.bin import worker
@pytest.fixture
def connect_signal(request):
def inner(signal, f):
signal.connect(f)
... |
gui.py | from tkinter import messagebox as tm
from PIL import Image, ImageTk
from tkinter import font
from mss import mss
from queue import Queue
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.filedialog as tf
import os, mouse, keyboard, traceback, webbrowser
import threading, mss.tools, docx, docx.shared
SLST... |
daemon.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import threading
import sys
import os
import time
import atexit
try:
from signal import SIGTERM, SIGKILL
except:
raise "Current OS doesn't support SIGTERM, SIGKILL."
class Daemon(object):
"""
A generic daemon class.
Usage: subclass the Dae... |
conftest.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Copyright 2017-2020 Baidu 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... |
WebApp.py | from flask import Flask, render_template, request
from threading import Thread
from bokeh.embed import server_document
from bokeh.server.server import Server
from tornado.ioloop import IOLoop
import sys
sys.path.append("..")
from Bokeh.Decision_Tree.Plot.plot_decision_tree import create_figure
from Bokeh.K_Means.kmean... |
jupyters3.py | import asyncio
import base64
from collections import namedtuple
import datetime
import hashlib
import hmac
import itertools
import json
import mimetypes
import os
import threading
import re
import time
import urllib
import xml.etree.ElementTree as ET
from tornado import gen
from tornado.httpclient import (
AsyncHT... |
cmdlineframes.py |
from __future__ import absolute_import, division, print_function
# TODO:
# - prompt user for missing symmetry
# - cached scenes
r"""
Load mtz file for viewing reflections in a webbrowser using NGL.
Webbrowser input is a javascript file that together with ngl.js displays reflections
positioned in reciprocal space... |
proxy.py | #!/usr/bin/python
import socket
import threading
import sys
import urlparse
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind(('0.0.0.0', 8081))
server.listen(5)
parsed_url = urlparse.urlparse(sys.argv[1])
def HandleClie... |
ionosphere.py | from __future__ import division
import logging
import os
from os import kill, getpid, listdir
from os.path import join, isfile
from sys import version_info
try:
from Queue import Empty
except:
from queue import Empty
from time import time, sleep
from threading import Thread
from multiprocessing import Process, ... |
utils.py | # Copyright 2020 The Tilt Brush 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 applicable law or agreed to ... |
plot_from_pp_geop_height_and_rain_by_date_range.py | """
Load pp, plot and save
8km difference
"""
import os, sys
#%matplotlib inline
#%pylab inline
import matplotlib
matplotlib.use('Agg')
# Must be before importing matplotlib.pyplot or pylab!
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
from mpl_to... |
main.py | from tkinter import Tk, PhotoImage, Label, Entry, Button, StringVar
from tkinter.filedialog import askdirectory
from tkinter.messagebox import showinfo
from functools import partial
from threading import Thread
from pytube import YouTube
def dldfunc(url1):
global thumburl
url2 = (url1.get())
path = askdir... |
test_runner.py | #
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
test_msra_td500_base.py | # -*- coding:utf-8 -*-
# Author: Xue Yang <yangxue-2019-sjtu@sjtu.edu.cn>, <yangxue0827@126.com>
# License: Apache-2.0 license
# Copyright (c) SJTU. ALL Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import math
import os
f... |
thread_global_variable.py | #导入Thread类, os和time模块
from threading import Thread, get_ident
import os, time
#初始化全局变量
g_num = 100
def child_thread():
global g_num
g_num += 1
print("g_num:%s; thread:%s; pid:%s" % (g_num, get_ident(), os.getpid()))
time.sleep(1)
if __name__ == "__main__":
threads = [Thread(target=child_thread) fo... |
tasks.py | import inspect
import itertools
import os
import sys
import threading
import time
from contextlib import contextmanager
from enum import Enum
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import Optional, List
from invoke import task, Context
DAEMON_DIR: str = "daemon"
DEFAULT_PREFIX: s... |
pull.py | # =========================================================================================
# Copyright 2016 Community Information Online Consortium (CIOC) and KCL Software Solutions
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... |
iterator.py | import multiprocessing
import threading
import Queue
from uuid import uuid4
import numpy as np
import SharedArray
import data
def load_shared(args):
i, array_name, fname, rng, kwargs = args
array = SharedArray.attach(array_name)
array[i] = data.load_augment(fname, rng=rng, **kwargs)
class BatchIterato... |
handlers.py | from tornado import gen, web, locks
import traceback
import urllib.parse
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler
import threading
import json
import os
from queue import Queue, Empty
import jinja2
from .pull import GitPuller
from .version import __version__
class Sy... |
table_tennis_game.py | from collections import deque
import datetime
import random
import cv2, os
from playsound import playsound
import threading, time
from base_camera import BaseCamera
from camera import Camera
root_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
serve_bell = os.path.join(root_dir, "sound", "serve_bel... |
client.py | """
D-Wave API clients handle communications with :term:`solver` resources: problem submittal,
monitoring, samples retrieval, etc.
Examples:
This example creates a client using the local system's default D-Wave Cloud Client
configuration file, which is configured to access a D-Wave 2000Q QPU, submits
a :te... |
misc.py | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
Some hacky functions
'''
import os, sys
import imp
import tempfile
import shutil
import functools
import itertools
import math
import ctypes
import numpy
import h5py
from pyscf.lib import param
c_double_p = ctypes.POINTER(ctypes.c_double)
c_in... |
meterpreter.py | #!/usr/bin/python
import binascii
import code
import os
import platform
import random
import re
import select
import socket
import struct
import subprocess
import sys
import threading
import time
import traceback
try:
import ctypes
except ImportError:
has_windll = False
else:
has_windll = hasattr(ctypes, '... |
managerConn.py | ############################################################################
#
# DIM - A Direct Interaction Manager for SAGE
# Copyright (C) 2007 Electronic Visualization Laboratory,
# University of Illinois at Chicago
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# mo... |
train_sampling_unsupervised.py | import dgl
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.multiprocessing as mp
from torch.utils.data import DataLoader
import dgl.function as fn
import dgl.nn.pytorch as dglnn
import time
import argparse
from _thread import start_new... |
pull.py | #!/usr/bin/env python3
# Copyright 2021 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... |
training.py | # Copyright 2018-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'license' fil... |
test_contextualize.py | import loguru
from loguru import logger
import threading
import asyncio
import importlib
import sys
import pytest
def test_contextualize(writer):
logger.add(writer, format="{message} {extra[foo]} {extra[baz]}")
with logger.contextualize(foo="bar", baz=123):
logger.info("Contextualized")
assert w... |
fuckkkkkkkkk.py | #!/usr/bin/env python3
import threading, queue
import time
import os
import shutil
import numpy as np
import math
import rospy
import tensorflow as tf
from test_obstacle_sac import SAC
from test_obstacle_env import Test
from arm_control.arm_task import ArmTask
from manipulator_h_base_module_msgs.msg import P2PPose
MA... |
notificationsclient.py | import os, sys, json, platform
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
from .. import confutil
from .. import emailutil
from .. import encryption
import threading
import logging
from .. import logutil
logger = logging.getLogger(logutil.MAIN_LOG_NAME)
def resource_path(relative_pat... |
socket_transport.py |
import socket # The socket module is a wrapper around native BSD sockets
from threading import Thread
from random import randint
from . import config
class SocketTransport():
def __init__(self):
self.running = True
# The socket() function returns a socket object whose methods implement the va... |
spyra.py | # -*- coding: utf-8 -*-
"""Main module."""
import os
import sys
import random
import string
import time
import termcolor
import socket
import threading
from datetime import datetime
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
def outputext(message,color):
text = t... |
main.py | import getopt
import logging
import os
import signal
import sys
from time import sleep
from threading import Thread
import colorlog as colorlog
import main_tool
from AyAdb import AyAdb
from table_constant import *
from config import config
import global_info
def signal_handler(sign, _):
if sign == signal.SIGINT o... |
backtester_stock_vj.py | import os
import sys
import sqlite3
import pandas as pd
from matplotlib import pyplot as plt
from multiprocessing import Process, Queue
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from utility.setting import db_backtest, db_stock_tick
from utility.static import now, strf_time, strp_time... |
test_failure.py | import json
import logging
import os
import signal
import sys
import tempfile
import threading
import time
import numpy as np
import pytest
import redis
import ray
import ray.utils
import ray.ray_constants as ray_constants
from ray.exceptions import RayTaskError
from ray.cluster_utils import Cluster
from ray.test_uti... |
server.py | def webserver(encodedmessage):
from multiprocessing import Process
from flask import Flask, render_template
import os
import base64
b64d = base64.b64encode(encodedmessage.encode('ascii'))
hexd = bytes.hex(b64d)
app = Flask(__name__)
@app.route('/')
def index():
return '404 ... |
watcher.py | """
Big Brother Is Watching you
"""
import threading
import time
import ctypes
import os
import fanotify
from misc import get_ppid, parse_tcp_data, get_cmdline
import docker
def IsRootProcess(pid): return os.stat('/proc/{}'.format(pid)).st_uid == 0
class Watcher(object):
def __init__(self, data_dir):
se... |
handler.py | """Functions that manage GitHub repository configuration
This module contains AWS Lambda function handlers.
"""
# Standard library imports
import logging
import multiprocessing
import ast
# Third party library imports
from typing import List
from github import Github, GithubException, PaginatedList
from github.Membe... |
main.py | """
Main experiment execution program.
"""
# Consulted materail
# https://colab.research.google.com/drive/1BTiGjP_FD0PdYfazpn61nWPC0YJuZPOE?usp=sharing#scrollTo=u-WL_FAE1hI0
# https://gist.github.com/karpathy/a4166c7fe253700972fcbc77e4ea32c5
# http://karpathy.github.io/2016/05/31/rl/
# https://jair.org/index.php/jair/a... |
tpu_estimator.py | # Copyright 2017 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... |
data_plane.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... |
downloader3.py | import sys
from PyQt5.QtWidgets import QWidget, QProgressBar , QPushButton , QApplication , QLineEdit , QLabel
from PyQt5.QtCore import QBasicTimer
# from random import randrange
# name = randrange(1,1000)
class TW(QWidget):
def __init__(self):
super().__init__()
self.progressbar = QProgressBar(... |
__init__.py | # -*- coding: utf-8 -*-
__all__ = ('__version__', 'Block', 'Window')
from typing import Optional, Sequence, List, Union, Callable, Tuple
from timeit import default_timer as timer
import abc
import time
import threading
import attr
import blessed
from . import exceptions
Title = Union[str, Callable[[], str]]
Content... |
train.py | # Author: Bichen Wu (bichen@berkeley.edu) 08/25/2016
"""Train"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import os.path
import sys
import time
import math
import numpy as np
from six.moves import xrange
import tensorf... |
__main__.py | """Main process with queue management and remote LRS communication."""
from datetime import datetime
import json
import logging
import os
import signal
import sys
import threading
import time
from pyinotify import WatchManager, Notifier, NotifierError, EventsCodes, ProcessEvent
from tincan import statement_list
fro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.