source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
simulator.py | import multiprocessing.dummy as mp
import time
import numpy as np
import pandas as pd
from datetime import datetime, date
import sys
import json
import copy
import ast
import os
from simulation.client import send_transaction, replica_ack_primary, recv_inform
from simulation.replica import send_view_change, send_new_vie... |
stress_test.py | import argparse
import os
import random
import string
import subprocess
import sys
import time
from multiprocessing import cpu_count, Pool
from threading import Thread
from scripts.test_util import cleanup, run_command
"""
Script to stress test CodaLab's backend. The following is a list of what's being tested:
- Lar... |
auto_test.py | """Tests for letsencrypt-auto"""
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from contextlib import contextmanager
from functools import partial
from json import dumps
from os import chmod, environ, makedirs, stat
from os.path import abspath, dirname, exists, join
import re
from shutil import copy, r... |
RadioListener.py | # RadioListener.py
# Listens for network connections from radio flowgraph and handles received data
import socket
import struct
import threading
from pprint import pprint
class RadioListener():
def __init__(self, port=8888):
if port < 1024:
print("Error: Ports 0-1023 are reserved by the syst... |
PYCHATV.0.2.py | import socket
import threading
import sys
import pickle
import tkinter
from tkinter import *
class Cliente():
my_msj='error'
caja_salida='?'
"""docstring for Cliente"""
def __init__(self, host="localhost", port=4000):
#conexion al puerto
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.s... |
main.py | import config
import removefollow
import applyjdtry
from log import logger
import threading
def main():
logger.info('----------------------------开始搬砖--------------------------------')
users = config.getUsers()
tasks=[]
for user in users:
user["headers"] = {}
token = user["token"]
... |
write_to_file_res.py | from threading import Thread
import time
def start_test(heat_inst):
print("Start HEAT process")
thread_data = Thread(target=heat_inst.threaded_function_data)
thread_data.start()
max_size = 100
counter = 0
while counter < max_size:
#title = 'Results of heating test\n'
path = '/h... |
thread_check_connection.py | #!/usr/bin/python
"""
This file contains a sample to check a server connection
within a thread.
"""
import sys
import threading
from time import sleep
__authors__ = 'Marco Espinosa'
__license__ = 'MIT License'
__version__ = '1.0'
__maintainer__ = 'Marco Espinosa'
__email__ = 'hi@marcoespinosa.es'
__status__ = 'Dev... |
session.py | # This file is part of the litprog project
# https://github.com/litprog/litprog
#
# Copyright (c) 2018-2021 Manuel Barkhau (mbarkhau@gmail.com) - MIT License
# SPDX-License-Identifier: MIT
# pylint: disable=consider-using-with; due to long-lived Popen objects
import os
import json
import time
import shlex
import typi... |
poller.py | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
__init__.py | """ XiaomiRouter
http://www.xiaomi.com
"""
import logging
import threading
import time
import requests
from xiaomirouter.client import Client, create_client_from_json
from xiaomirouter.status import create_status_from_json
ROUTER_ADMINISTRATOR = 'admin'
TIMEOUT = 5
RECONNECT_TIME = 5
_LOGGER = logging.getLogger(_... |
test_socketserver.py | """
Test suite for socketserver.
"""
import contextlib
import io
import os
import select
import signal
import socket
import tempfile
import threading
import unittest
import socketserver
import test.support
from test.support import reap_children, reap_threads, verbose
test.support.requires("network")
TEST_STR = b"h... |
main.py | import json
import time
import threading
import base64
import cv2
import numpy as np
import onnxruntime
from flask import Flask, request, Response
import requests
from azure.iot.device import IoTHubModuleClient
from object_detection import ObjectDetection
from utility import get_file_zip
MODEL_DIR = 'model'
UPLOAD_... |
test_basic.py | # -*- coding: utf-8 -*-
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from email.message import Message
import email.message
import tempfile
import shutil
import socket
import threading
import ssl
import select
import time
import ... |
lcarsde-app-menu.py | #!/usr/bin/env python3
import gi
from threading import Thread
from posix_ipc import MessageQueue, BusyError
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GdkX11, GLib
css = b'''
.select_button {
font-family: 'Ubuntu Condensed', sans-serif;
font-weight: 600;
font-size: 15px;
color: #... |
nfc_plus_speaker.py | # Copyright (c) 2017 Ned Hoy <nedhoy@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 without restriction, including without limitation the rights
# to use, copy, modify, merge, p... |
sauce.py | import csv
import os
import subprocess
import threading
# Gather the packages to test.
PREFIX = './packages/node_modules/'
CISCOSPARK = os.path.join(PREFIX, '@ciscospark')
WEBEX = os.path.join(PREFIX, '@webex')
PROD_ENV_VARS = {
# 'ACL_SERVICE_URL': 'https://acl-a.wbx2.com/acl/api/v1', ?
'ATLAS_SERVICE_URL': 'ht... |
parallelizer.py | import os, sys, time, multiprocessing, re
from .processes import ForkedProcess
from .remoteproxy import ClosedError
from ..python2_3 import basestring, xrange
class CanceledError(Exception):
"""Raised when the progress dialog is canceled during a processing operation."""
pass
class Parallelize(object):
"... |
example_pose_goal.py | #!/usr/bin/env python3
from moveit2 import MoveIt2Interface
import rclpy
import threading
def main(args=None):
rclpy.init(args=args)
# Initialise MoveIt2
moveit2 = MoveIt2Interface()
# Spin MoveIt2 node in the background
executor = rclpy.executors.MultiThreadedExecutor(1)
executor.add_node(... |
fault_tolerance_test.py | # Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
dssdr_rxtx_nav.py | #!/usr/bin/env python
#
# Copyright 2015 Benjamin Kempke
#
# 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 ap... |
monte_carlo.py | """Monte Carlo receding horizon control."""
from abc import ABC, abstractmethod
from multiprocessing import Pipe, Process
import gym
from stable_baselines.common.vec_env import CloudpickleWrapper
from aprl.common.mujoco import MujocoState, ResettableEnv
class MujocoResettableWrapper(ResettableEnv, gym.Wrapper):
... |
Inventory.py | # coding=utf-8
import os
import Constants
import subprocess
from multiprocessing.process import Process
from JobOrderInventoryReader import JobOrderInventoryReader
class Inventory(object):
"""
Inventory
"""
def __init__(self, logfile, errfile):
# init logger
self._logfilename = lo... |
serialUITest.py | import pygame
from pygame.locals import *
import serial
from time import sleep
import time
import threading
COM_PORT = "COM12"
BAUD_RATES = 115200
ser = serial.Serial(COM_PORT, BAUD_RATES)
done = False
#init pygame window
pygame.init()
screen = pygame.display.set_mode( (640,480) )
pygame.display.set_caption("Serial U... |
testcase.py | # -*- coding: utf-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may not use this
# file except in compliance with the License. You may ... |
main.py | import os
import re
import random
import telebot
import datetime
import schedule
import matplotlib
import pandas as pd
import seaborn as sns
from time import sleep
from threading import Thread
import matplotlib.pyplot as plt
from models import Chat, Event, Sport, new_session, User
from orm import remove_chat, get_cha... |
server.py | #!/usr/bin/env python
import time
import json
import colorsys
import os
import threading
import math
import colorsys
from time import sleep
from datetime import datetime
from gpiozero import CPUTemperature
import blinkt
from flask import Flask, jsonify, make_response, request, send_from_directory
from flask_cors import... |
Chess_v0_11.py | import multiprocessing
import threading
import pygame
from pygame.locals import *
import os
import os.path
import random
import time
from tkinter import Tk
import math
from copy import deepcopy
import numpy
class Board():
def __init__(self):
self.dark_square = pygame.image.load(os.path.j... |
schwaebische_nuclei.py | import os
import sys
import math
import datetime
import logging
from logging.config import fileConfig
import argparse
from keras import backend as K
import multiprocessing as mp
import threading as thr
"""Import our own modules"""
sys.path.append("modules")
from modules.augment import *
from modules.mean_IoU import *
... |
server_test.py |
import pytest
from threading import Thread
from time import sleep
from src.server import PalantirServer
class TestServer:
@staticmethod
def test_basic_initialization():
server = PalantirServer()
assert isinstance(server, PalantirServer)
@staticmethod
def test_run_server():
se... |
starter.py | '''
This singleton module is the central starter for the led strip to have it display a variety of modes.
It will start the interceptor class which exposes an external port for interacting with the strip
at runtime and interacts with starter module to change modus at runtime.
Let yourself be dragged into the fas... |
threads.py | #!/usr/bin/env python
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import difflib
import random
import threading
import time
import traceback
from lib.core.data import conf
from lib.core.data import kb
from... |
light.py | #!/usr/bin/env python3
# Built from direct port of the Arduino NeoPixel library strandtest example. Showcases
# various animations on a strip of NeoPixels.
from neopixel import *
from .message import SceneMessage, AdministrativeMessage
import animations
import argparse
import logging
import threading
import time
imp... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including witho... |
test_with_dummy_instance.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import itertools as it, operator as op, functools as ft
import unittest, contextlib, hashlib, atexit, signal, threading, select, errno
import os, sys, io, time, subprocess, tempfile, shutil, socket
if sys.version_inf... |
test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import asyncore
import asynchat
import socket
import StringIO
import errno
import os
try:
import ssl
except ImportError:
ssl = None
from unittest import TestCase, SkipTest, skipUnl... |
lock_objects_03.py | import threading
from tqdm import trange
from time import sleep
lock = threading.Lock()
resource: list = []
def target_function():
current_thread: threading.Thread = threading.current_thread()
thread_name: str = current_thread.name
print(f'\n{thread_name} -> is_alive: {current_thread.is_alive()}')
if lock.... |
46_why_need_ThreadLocal.py | """
多线程操作共享的全局变量是不安全的,多线程操作局部 只归某个线程私有,其他线程是不能访问的
"""
import threading
def do_sth(arg1, arg2, arg3):
local_var1 = arg1
local_var2 = arg2
local_var3 = arg3
fun1(local_var1, local_var2, local_var3)
fun2(local_var1, local_var2, local_var3)
fun3(local_var1, local_var2, local_var3)
def fun1(loca... |
multiprocess.py | import os
import torch
import torch.distributed as dist
from torch.multiprocessing import Process
class Multiprocess():
def __init__(self, fn, args):
self.fn = fn
self.args = args
self.world_size = args.world_size
if os.path.isfile(args.dist_sync_file):
os.remove(args... |
codetime.py | # https://stackoverflow.com/questions/2846653/how-can-i-use-threading-in-python
import time
from threading import Thread
def just_func():
pass
def threaded_func():
pass
Thread(target=threaded_func)
start = time.time()
threaded_func()
end = time.time()
print(end - start)
start = time.time()
just_func()
end... |
upgrade_through_versions_test.py | import operator
import os
import pprint
import random
import signal
import time
import uuid
import logging
import pytest
import psutil
from collections import defaultdict, namedtuple
from multiprocessing import Process, Queue
from queue import Empty, Full
from cassandra import ConsistencyLevel, WriteTimeout
from cass... |
eve.py | #!/usr/bin/python3
"""The basic idea is this: the bugs grow for a certain period of time, dt. After this time, if their optical density,
OD, (as read by a photodetector) is above a threshhold, OD_thr, and they have grown since the last time point, drug is
administered through a pump, P_drug. If OD is less than OD_thr,... |
joystick_and_video.py | """
tellopy sample using joystick and video palyer
- you can use PS3/PS4/XONE joystick to controll DJI Tello with tellopy module
- you must install mplayer to replay the video
- Xbox One Controllers were only tested on Mac OS with the 360Controller Driver.
get it here -> https://github.com/360Controller/360Cont... |
spreadsheet_logger.py | import threading
import time
from datetime import datetime
import spreadsheet_connector
class SpreadsheetLogger:
def __init__(self, sensor, controller, fridge):
self.thread = threading.Thread(target=self._log)
self.sensor = sensor
self.controller = controller
self.fridge = fridge
... |
app.py | #!/usr/bin/env python3
import configparser
import time
import threading
import mastodonTool
import os
import datetime
import markovify
import exportModel
import re
# 環境変数の読み込み
config_ini = configparser.ConfigParser()
config_ini.read('config.ini', encoding='utf-8')
def worker():
# 学習
domain = config_ini['read... |
application_ui.py | import threading
from tkinter import Frame, Tk, N, LabelFrame, S, Button, RIGHT
from tkinter.constants import X, BOTH, TOP, INSERT, END
from tkinter.scrolledtext import ScrolledText
import sys
from reportlab.lib.units import inch
from app.packages import gerber2pdf
from app.ui import BUTTON_PADDING
from app.ui.browse... |
rsyslog-s3-omprog.py | #!/usr/bin/python -u
import Queue as queuelib
import argparse
import os
import socket
import sys
import threading
import time
from boto.s3.connection import S3Connection
from boto.s3.key import Key
default_delay = 10 * 60
default_lines = 10000
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--... |
search_engine_spider.py | import requests
from lxml import etree
from .search_engine_settings import search_engine_dict, proxies, google_mirrors
import re
import random
import threading
class SearchEngineSpider(object):
"""
This is a spider of all search engines.
This spider can get search results including titls and de... |
test_ipc.py | # -*- coding: utf-8 -*-
'''
:codeauthor: Mike Place <mp@saltstack.com>
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import errno
import socket
import threading
import logging
import tornado.gen
import tornado.ioloop
import tornado.testing
import salt... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from helper.general import xyxy2xywh, xywh2xyxy, torch_d... |
master.py | # -*- coding: utf-8 -*-
'''
This module contains all of the routines needed to set up a master server, this
involves preparing the three listeners and the workers needed by the master.
'''
# Import python libs
from __future__ import absolute_import, with_statement, print_function, unicode_literals
import copy
import c... |
applications_test.py | import pytest
import random
import os
from multiprocessing import Process, Queue
from keras import applications
from keras import backend as K
MODEL_LIST = [
(applications.ResNet50, 2048),
(applications.VGG16, 512),
(applications.VGG19, 512),
(applications.Xception, 2048),
(applicatio... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
Interface.py | '''
Copyright (c) <2012> Tarek Galal <tare2.galal@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
without restriction, including without limitation the rights to use, copy, modify,
m... |
app-Crickit_Adafruit-TYJ.py | #!/usr/bin/env python3
##jwc o #!/usr/bin/env python
from importlib import import_module
import os
import sys
import signal
import threading
import time
import json
from flask import Flask, render_template, request, Response
# jwc n from gevent.wsgi import WSGIServer
# jwc from gevent.pywsgi import WSGIServer
import ... |
windows.py | import json
import time
from threading import Thread
from enum import Enum
import pygame
from objects import TextObject, MainHero, FlashingTextObject
from window_events import ChangeWindowEvent
from bonuses import Bonus, BotNetBonus, AdvertisingBonus
from youtube_api import get_tseries_subs_count, get_pewds_subs_count
... |
bbox_regression.py | """
This file has functions about generating bounding box regression targets
"""
from ..pycocotools.mask import encode
import numpy as np
from ..logger import logger
from .bbox_transform import bbox_overlaps, bbox_transform
from .rcnn.config import config
import math
import cv2
import PIL.Image as Image
import thread... |
ChipDeviceCtrl.py | #
# Copyright (c) 2020 Project CHIP Authors
# Copyright (c) 2019-2020 Google, LLC.
# Copyright (c) 2013-2018 Nest Labs, Inc.
# 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... |
uploader.py | import codecs
import io
import logging
import mimetypes
import os
import random
import socket
import string
import sys
import time
import urllib2
import uuid
import threading
import pickle
try:
from typing import List
except:
pass
from threading import Thread
TOKEN_LEN = 30
MAX_TOKEN_LEN = 150
DEBUG_LOGBOOK_UR... |
eeg.py | """ Abstraction for the various supported EEG devices.
1. Determine which backend to use for the board.
2.
"""
import os, sys
import time
from time import sleep
from multiprocessing import Process
import numpy as np
import pandas as pd
from brainflow import BoardShim, BoardIds, BrainFlowInputParams
from m... |
executorselenium.py | import json
import os
import socket
import threading
import time
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
st... |
websockets.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without... |
thread_basis.py | #!/usr/bin/python
# encoding: utf-8
"""
@author: rainsty
@file: thread_basis.py
@time: 2019-09-07 17:47:27
@description:
"""
import time
import threading
balance = 0
lock = threading.Lock()
local_school = threading.local()
def run_loop():
print('thread %s is running...' % threading.current_thread().name)
... |
core.py | # -*- coding: utf-8 -*-
#
# 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
#... |
movielens.py | import logging
import os
import random
import threading
from datetime import datetime
import numpy as np
from scipy import sparse
from utils import Indexer, create_sparse, timestamp_delta_generator
rating_threshold = 4
actor_threshold = 3
censoring_ratio = 0.5 # fraction of censored samples to all samples
def gen... |
Server.py | import socket, ssl, threading
from Device import Device
from DataFormatter import Protocol_Send, Protocol_Receive
from Commands import CLI_Command_Handler
import Config
### Each client will have their own Deal_With_Client Thread ##@
def Deal_With_Client(connstream):
device_setup_message = Protocol_Receive(con... |
compare_Walternating_adam_1layers.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_walt... |
winsniffer_frame.py | import os
import time
import threading
import wx
import wx.py
import winsniffer
import winsniffer.gui.ids as ids
import winsniffer.gui.icons as icons
from winsniffer.gui.content_provider import ContentProvider
from winsniffer.gui.list_control import ListControl
from winsniffer.gui.status_bar import StatusBar
from win... |
main_OpenBCI_demo.py | import multiprocessing
from pyneuromodulation import nm_RealTimeClientStream
from pynput.keyboard import Key, Listener
import time
from mne_realtime import LSLClient
import numpy as np
import pandas as pd
import sys
import os
import signal
# Check HOST_Name by calling in OpenBCI_LSL:
# python openbci_lsl.py --stream
... |
lsl-viewer.py | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter, lfilter_zi
from time import sleep
from pylsl import StreamInlet, resolve_byprop
from optparse import OptionParser
import seaborn as sns
from threading import Thread
sns.set(style="whitegrid")
parser = Op... |
ioloop_test.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import contextlib
import datetime
import functools
import socket
import sys
import threading
import time
from tornado import gen
from tornado.ioloop import IOLoop, TimeoutError, PollIOLoop, PeriodicCallback
from to... |
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... |
laundry_scheduler.py | __author__ = "Jerry Overton"
__copyright__ = "Copyright (C) 2022 appliedAIstudio LLC"
__version__ = "0.0.1"
# the Highcliff ai_actions we are going to implement
from highcliff_sdk.laundry import LaundryScheduler
# needed to access host and port environment variables
import os
# needed to randomly select laundry days... |
02-conn_lifecycle_as_server.py | #!/usr/bin/env python3
# Copyright (C) 2018 Simon Brummer <simon.brummer@posteo.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import sys
import socket
import threading
from test... |
connect_manager.py | #!/usr/bin/env python
# coding:utf-8
"""
This file manage the ssl connection pool.
For faster access the target host,
ssl link will save to pool after use.
and need keep alive every 60 seconds.
We create multi-thread to try-connect google cloud ip.
we also keep host connect for direct connect.
every ssl connect ca... |
__init__.py | from __future__ import annotations
import collections
from datetime import datetime
from decimal import Decimal
from functools import wraps
import operator
import os
import re
import string
from typing import (
TYPE_CHECKING,
Callable,
ContextManager,
Counter,
Iterable,
)
import warnings
import nu... |
A3C_continuous_action.py | """
Asynchronous Advantage Actor Critic (A3C) with continuous action space, Reinforcement Learning.
The Pendulum example.
View more on my tutorial page: https://morvanzhou.github.io/tutorials/
Using:
tensorflow 1.0
gym 0.8.0
"""
import multiprocessing
import threading
import tensorflow as tf
import numpy as np
impo... |
emails.py | # -*- coding: utf-8 -*-
__author__ = 'yf'
__date__ = '2019/9/7 9:25'
from threading import Thread
from flask import url_for, current_app
from flask_mail import Message
from bluelog.extensions import mail
def _send_async_mail(app, message):
with app.app_context():
mail.send(message)
def send_mail(subj... |
sdk_worker.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... |
log_client.py | #!/usr/bin/env python
"""
#########################################################################
# #
# Log client. #
# This is a simple log client. It sends log messages to the log server ... |
__init__.py | #import base64
import linecache
import shutil
import tarfile
import time
import uuid
from os.path import abspath, dirname, expanduser, os, sys
from shutil import rmtree
## from presice trainer
import wave
import platform
from os.path import join
import posixpath
from os import makedirs
from functools import partial
fro... |
scrape.py | import os
import re
import json
import tqdm
import parse
import requests
import warnings
import threading
from tqdm import tqdm
from parse import parse
from threading import Thread
from bs4 import BeautifulSoup as bs
warnings.filterwarnings("ignore")
NUM_THREADS=8
def get_episodes(base_url):
page = requests.get(... |
net_utils_unittest.py | #!/usr/bin/env python3
#
# Copyright 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Networking-related utilities."""
import socket
import threading
import time
import unittest
from unittest import mock
import ... |
urlscrape.mt2.py | #!/usr/bin/env python3
# SPDX-License-Identifier: CC0-1.0
##
# Scrape the actual PDF url from
# https://wikileaks.org/clinton-emails/emailid/{id}
#
# Stored results in clintonurls.json. This is idempotent, just
# restart it if it fails.
#
# At the end, it will spit out an aria2 input file to download
# everything.
##
... |
interface_rpc.py | #!/usr/bin/env python3
# Copyright (c) 2018-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests some generic aspects of the RPC interface."""
import os
from test_framework.authproxy import JSO... |
Data_Collector.py | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 6 16:30:21 2019
@author: kennedy
"""
class Path(object):
def __init__(self, path):
self.path = path
self.loadPath()
def loadPath(self):
import os
try:
if os.path.exists(self.path):
try:
FOLDERS =... |
run_purge_dups.py | #!/usr/bin/env python3
from runner.manager import manager
from runner.hpc import hpc
from multiprocessing import Process, Pool
import sys, os, json
import argparse
# utilities
def checkf(p):
return os.path.isfile(p)
def checkd(p):
return os.path.isdir(p)
def mkdir(d):
if not checkd(d):
os.makedi... |
clientUI.py | from PyQt5 import QtCore, QtGui, QtWidgets, uic
from PyQt5 import QtWidgets
from PyQt5.QtCore import *
from PyQt5 import QtGui
from pymediainfo import MediaInfo
from PyQt5.QtGui import QIcon
#import scriptwrapper
import cv2
from PyQt5.QtMultimedia import QMediaPlayer, QMediaPlaylist, QMediaContent
from PyQt5... |
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... |
utility.py | import os
import math
import time
import datetime
from multiprocessing import Process
from multiprocessing import Queue
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import imageio
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lrs
class time... |
test_concurrent_transaction.py | from tests.integration.base import DBTIntegrationTest, use_profile
import threading
from dbt.adapters.factory import FACTORY
def get_adapter_standalone(config):
plugin = FACTORY.plugins[config.credentials.type]
cls = plugin.adapter
return cls(config)
class BaseTestConcurrentTransaction(DBTIntegrationTes... |
exposition.py | #!/usr/bin/python
from __future__ import unicode_literals
import base64
from contextlib import closing
import os
import socket
import sys
import threading
from wsgiref.simple_server import make_server, WSGIRequestHandler
from .openmetrics import exposition as openmetrics
from .registry import REGISTRY
from .utils im... |
http_com.py | from __future__ import print_function
from builtins import str
from builtins import object
import logging
import base64
import random
import os
import ssl
import time
import copy
import json
import sys
import threading
from pydispatch import dispatcher
from flask import Flask, request, make_response, send_from_director... |
import_logs.py | #!/usr/bin/python3
# vim: et sw=4 ts=4:
# -*- coding: utf-8 -*-
#
# Matomo - free/libre analytics platform
#
# @link https://matomo.org
# @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
# @version $Id$
#
# For more info see: https://matomo.org/log-analytics/ and https://matomo.org/docs/log-analytics-... |
main.py | import asyncio
import os
import threading
from typing import List, Any
import discord
import nest_asyncio # this makes the discord client useable together with pyshark.
from discord.ext import tasks
from commands.ingame_commands.highscores import get_clancommands, getplayer, mapcontrol, getclan, get_top10commands
fr... |
client3.py | import socket
import threading
s = socket.socket()
host = "127.0.0.1"
port = 5556
s.connect((host, port))
user = input("Your username? ")
def recieving_message():
while True:
message = s.recv(16384).decode("utf-8")
if message == "username?":
s.send(user.encode("utf-8"))
else:
... |
task4_2.py | import timer
import random as rn
import threading
response = None
score = [0, 0]
x = 0
def tick(t=5):
t -= 1
print(t)
def is_prime(n):
if n <= 1:
return False
elif n <= 3:
return True
elif n % 2 == 0 or n % 3 == 0:
return False
i = 5
while (i * i) <= n:
i... |
global_lib.py | import rollbar
import pprint
import yaml
import os, os.path
import sys
import time
import signal
from shutil import copy
from distutils.sysconfig import get_python_lib
from tabulate import tabulate
from pg_chameleon import pg_engine, mysql_source, pgsql_source
import logging
from logging.handlers import TimedRotatingF... |
asyncexec.py | import asyncio
import random
import time
import sys
import threading
from QUANTAXIS.QAEngine.asyncschedule import create_scheduler
from QUANTAXIS.QAEngine.QAThreadEngine import QA_Thread
from QUANTAXIS.QAEngine.QAEvent import QA_Event
from QUANTAXIS.QAEngine.QAAsyncThread import QA_AsyncThread, QAAsyncEMS
import async... |
pipe.py | import os
from multiprocessing import Process, Pipe
def sender(pipe):
"""
Manda o objeto para pai por meio de um pipe anônimo
"""
pipe.send(['spam'] + [42, 'ovos'])
pipe.close()
def comunicador(pipe):
"""
Manda e recebe objetos por um pipe
"""
pipe.send(dict(nome='João', spam=42))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.