source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
seg_data_loader_onfly.py | from __future__ import print_function, division
import blosc
import torch
from torch.utils.data import Dataset
from data_pre.seg_data_utils import *
from data_pre.transform import Transform
import SimpleITK as sitk
from multiprocessing import *
blosc.set_nthreads(1)
import progressbar as pb
from copy import deepcopy
im... |
index.py | #!/usr/bin/pypy3
#!/usr/bin/python3
from http.client import HTTPSConnection
from base64 import b64encode
import json
import mysql.connector
from datetime import datetime, timedelta
from threading import Thread
import cgi
class ukcompanieshouse:
URL = 'api.companieshouse.gov.uk'
KEY = ''
def __init__... |
app.py | #!/usr/bin/env python
# This work is based on original code developed and copyrighted by TNO 2020.
# Subsequent contributions are licensed to you by the developers of such code and are
# made available to the Project under one or several contributor license agreements.
#
# This work is licensed to you under ... |
alpaca.py | #
# Copyright 2018 Alpaca
#
# 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, sof... |
ex2_lock.py | import multiprocessing
# python -m timeit -s "import ex2_lock" "ex2_lock.run_workers()"
# 19ms using lock.acquire
# 21ms using with.lock
def work(value, max_count, lock):
for n in range(max_count):
with lock:
value.value += 1
#lock.acquire()
#value.value += 1
#lock.rele... |
webcam.py | import numpy as np
import cv2
import time
from multiprocessing import Process, Queue, Value
class Webcam(object):
def __init__(self, camera_num=0):
self.cap = cv2.VideoCapture(camera_num)
self.current_frame = None
self.ret = None
self.is_running = Value('i',1)
... |
docxtractor_threads.py | import os
import docxtractor as dxtr
import Models.ImportModel as IM
import threading
import math
import sys
import subprocess
import datetime
def call_exe(start_index, end_index):
command = "python " + os.getcwd() + "\docxtractor_thread_exe.py " + str(start_index) + " " + str(end_index)
print([command])
... |
server.py | import socket
from threading import Thread
#server's ip address
SERVER_HOST = "0.0.0.0"
SERVER_PORT = 5002 #port we want to use
separator_token = "<SEP>" #we will use this to seperate client name &message
#initialize set/list of all connected client's sockets
client_sockets = set()
#create a TCP socket
s =... |
SXRendererTest.py | ##########################################################################
#
# Copyright (c) 2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... |
client.test.py | import unittest
import asyncore
import socket
import sys
import time
from gym_donkeycar.core.sim_client import SDClient
import logging
import sys
from threading import Thread
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatte... |
build.py | import os, subprocess, threading;
gsWDExpressPath = r"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WDExpress.exe";
assert os.path.isfile(gsWDExpressPath), "Cannot find WDExpress.exe";
giErrorCount = 0;
def build(sFolderPath, sFileName, sPlatform, sConfig):
global giErrorCount;
oOutputLo... |
botserver.py | # coding: utf-8
from __future__ import absolute_import, with_statement, print_function, unicode_literals
__version__ = '21.021.1735' # _fg_time
#__version__ = '21.020.1950' # default _system_list_methods (.__class__.__name__[-3:] == 'Api')
#__version__ = '20.324.1230' # http post body ungzip
#__version__ = '20.310.... |
constructionList.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import time
import json
import math
import random
import gettext
import traceback
import threading
from decimal import *
from ikabot.config import *
from ikabot.helpers.gui import *
from ikabot.helpers.varios import *
from ikabot.helpers.botComm import *
from i... |
load_dense_fully_connected_1.py | """Use an ANN to find the probability of occurrence of diseases"""
import tflearn
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score, recall_score, f1_score, precision_score, \
confusion_matrix, roc_curve, a... |
test_socket.py | #!/usr/bin/env python3
import unittest
from test import support
from unittest.case import _ExpectedFailure
import errno
import io
import socket
import select
import tempfile
import _testcapi
import time
import traceback
import queue
import sys
import os
import array
import platform
import contextli... |
run_batch.py | import threading, subprocess, os, random, time, json
import pygetwindow as gw
N = 8
root = "C:\\ProgramData\\FAForever\\"
cwd = os.getcwd()
logDir = cwd+"\\output\\"
resultPath = cwd+"\\results.txt"
print(cwd)
if not os.path.isdir(logDir):
os.mkdir(logDir)
if not os.path.isdir(root):
print("Unable to find FA... |
online.py | '''
Online tests
'''
import unittest
from unittest import TestCase
from mock import MagicMock
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from rest_service import RestService
import time
import requests
from threading import Thread
class TestRestService(TestCas... |
thread_test.py | #!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test Python threading
# Author: Even Rouault <even dot rouault at spatialys.com>
#
########################################################... |
dash_buffer.py |
import queue
import threading
import time
import csv
import os
import config_dash
from stop_watch import StopWatch
# Durations in seconds
PLAYER_STATES = ['INITIALIZED', 'INITIAL_BUFFERING', 'PLAY',
'PAUSE', 'BUFFERING', 'STOP', 'END']
EXIT_STATES = ['STOP', 'END']
class DashPlayer:
""" DASH bu... |
Import.py | #!/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""Import Assets to Carla"""
from __future__ import print_function
import e... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import traceback
import asyncore
import weakref
import platform
import functools
impor... |
arp_spoof.py | #!/usr/bin/env python3
from scapy.all import *
import sys
import threading
def arp_flood(packet1,packet2):
print('Spamming ARP packets...')
while True:
send(packet1,verbose = 0)
send(packet2,verbose = 0)
def get_mac(ip):
#Scapy has a similar method called getmacfromip() but often randomly ... |
example.py | #!/usr/bin/env python3
import os
import torch
import torch.distributed as dist
import numpy as np
from torch.multiprocessing import Process
import adaps
from signal import signal, SIGINT
from sys import exit
import threading
num_nodes = 4 # number of nodes
num_workers_per_node = 2 # number of worker threads per nod... |
main.py | import sys
if sys.version_info <= (3, 5):
print("Error: Please run with python3")
sys.exit(1)
import logging
import os
import threading
import time
from PIL import Image
import debug
from data import Data
from data.config import Config
from renderers.main import MainRenderer
from utils import args, led_matr... |
dx_environment.py | #!/usr/bin/env python
#Corey Brune 08 2016
#This script creates an environment
#requirements
#pip install docopt delphixpy
#The below doc follows the POSIX compliant standards and allows us to use
#this doc to also define our arguments for the script.
"""Create Host Environment
Usage:
dx_environment.py (--type <na... |
rpc.py | #
# Copyright 2021 Logical Clocks AB
#
# 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 ag... |
event_based_scheduler_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 u... |
Web.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import PyQt5
from PyQt5 import QtCore
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView
import PyQt5.QtWidgets
import sys
import os
import urllib.request
#import threading
class Downloader(PyQt5.QtWidgets.QWidget):
def __init__(sel... |
__init__.py | import json
import os
import copy
import threading
import time
import pkg_resources
from sqlalchemy.exc import IntegrityError
# anchore modules
import anchore_engine.common.helpers
import anchore_engine.common.images
from anchore_engine.clients.services import internal_client_for
from anchore_engine.clients.services ... |
utils.py | # -*- coding: utf-8 -*-
# Copyright 2012-2022 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
server.py | '''
Basestation recieves photos captured by propertycam camera units.
'''
import socket
import datetime
import socketserver
import http.server
import threading
from basestation.datastore import DataStore
from basestation.snap import Snap
from basestation.snappipeline import SnapPipeline
# Serve snap images via an HT... |
synchronized_lights.py | #!/usr/bin/env python
#
# Licensed under the BSD license. See full license in LICENSE file.
# http://www.lightshowpi.org/
#
# Author: Todd Giles (todd@lightshowpi.org)
# Author: Chris Usey (chris.usey@gmail.com)
# Author: Ryan Jennings
# Author: Paul Dunn (dunnsept@gmail.com)
# Author: Tom Enos (tomslick.ca@gmail.com)... |
main.py | ## -- IMPORTING -- ##
# MODULE
import multiprocessing
import os
import datetime
import certifi
import disnake
import json
import time
import logging
from disnake.ext import commands
from pymongo import MongoClient
from dotenv import load_dotenv
from threading import Thread
# FILES
from extra import functions
from e... |
example_ctypes.py | #!/usr/bin/env python3
"""Simple example with ctypes.Structures."""
import ctypes
import multiprocessing
import os
import random
import time
from context import ringbuffer
class Record(ctypes.Structure):
_fields_ = [
('write_number', ctypes.c_uint),
('timestamp_microseconds', ctypes.c_ulonglong... |
trustedcoin.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... |
prox.py | #!/bin/env python
##
# Copyright(c) 2010-2015 Intel Corporation.
# Copyright(c) 2016-2018 Viosoft Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source ... |
sync.py | #
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
poloniex.py | from autobahn.asyncio.wamp import ApplicationSession
from autobahn.asyncio.wamp import ApplicationRunner
from asyncio import coroutine
from time import sleep
import threading
def start_poloniex_runner(delegate):
runner = ApplicationRunner("wss://api.poloniex.com:443", "realm1", extra={'poloniex': delegate})
ru... |
chatbox_nodb.py | import sys
import time
import amanobot
from amanobot.loop import MessageLoop
from amanobot.delegate import (
per_chat_id_in, per_application, call, create_open, pave_event_space)
"""
$ python3 chatbox_nodb.py <token> <owner_id>
Chatbox - a mailbox for chats
1. People send messages to your bot.
2. Your bot rememb... |
livestream.py | # _____ ______ _____
# / ____/ /\ | ____ | __ \
# | | / \ | |__ | |__) | Caer - Modern Computer Vision
# | | / /\ \ | __| | _ / Languages: Python, C, C++
# | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer
# \_____\/_/ \_ \______ |_| \_\
# Licensed ... |
jack.py | # HiQ version 1.0.
#
# Copyright (c) 2022, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
#
import os
from multiprocessing import Process, Queue, Lock
import itree
from hiq.tree import Tree
from hiq.utils import _check_overhead, g... |
perf.py | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Basic pyauto performance tests.
For tests that need to be run for multiple iterations (e.g., so that average
and standard devia... |
Pillage.py | #!/usr/bin/python
import argparse, time, sys, os
import subprocess, multiprocessing
class Pillage(object):
def __init__(self, directoryName="pillageResults", userList="wordlists/users.txt", passList="wordlists/mutatedMega.txt"):
self.banner()
self.parseArgs()
self.userList=userList
... |
android_collection.py | import multiprocessing
import os
from time import sleep
import re
from invoke import task
from invoke_collections import kivy_collection
from invoke_collections.utils import tprint, fprint, iprint
@task
def check_genymotion(ctx):
"""
Checks if genymotion was installed properly
"""
genymotion_path = ... |
generate_env_map.py | import multiprocessing
from utils.img_utils import crop_map_image
from utils.utils import log, AttrDict
def _generate_env_map_worker(make_env_func, return_dict):
map_img = coord_limits = None
env = make_env_func()
try:
if env.unwrapped.coord_limits and hasattr(env.unwrapped, 'get_automap_buffer'... |
main.py | import argparse
import json
import random
import time
import traceback
from threading import Thread
import aiohttp
import requests
import vk_api
from vkbottle.api import UserApi
from vkbottle.user import User
from idm_lp import const
from idm_lp.commands import commands_bp
from idm_lp.database import Database, Databa... |
positions.py | from threading import Thread
import time
from src.config import CONFIG
from src.events import POSITION, fire_event
class PositionsWorker:
def start(self, executions):
t = Thread(target=self._run, args=(executions,))
t.start()
def _run(self, executions):
while True:
... |
computing_node.py | from dataclasses import dataclass
from logs import get_logger
from typing import NoReturn, Union
from settings_loader.settings_loader import SettingsLoader
from message_putter.computing_node_putter import PingPutter, DoneTaskPutter
from message_accepters.computing_node_accepter import StatisticTaskAccepter, BalancedTas... |
__init__.py |
""" Don't load any Java stuff at global scope, needs to be importable by CPython also """
import storytext.guishared, os, types
from threading import Thread
class ScriptEngine(storytext.guishared.ScriptEngine):
eventTypes = [] # Can't set them up until the Eclipse class loader is available
signalDescs = {}
... |
backupmanager.py |
import json
import time
import os
import subprocess
import threading
import uuid
from assemblyline.al.common import forge, queue, remote_datatypes
from assemblyline.al.common.error_template import ERROR_MAP
TYPE_BACKUP = 0
TYPE_RESTORE = 1
DATABASE_NUM = 3
RETRY_PRINT_THRESHOLD = 1000
COUNT_INCREMENT = 1000
LOW_THR... |
FlashCoucou.pyw | import sys
import time
import winsound
import threading
from tkinter import *
global fen
flash_path = sys.argv[1]
event = sys.argv[2]
fen = Tk()
def quitter():
global fen
fen.focus_set()
fen.focus_force()
fen.attributes("-topmost", True)
fen.attributes("-topmost", False)
winsound.PlaySound(fla... |
bot.py | import logging
import threading
import asyncio
import unicodedata
from decouple import config
import discord
from discord.utils import get
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
from .utils import send_verify_mail
intents = discord.Intents.all()
intents.pr... |
hls_runner.py | import json
import m3u8
from multiprocessing import Process, Manager, Lock
import pdb
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from requests.packages.urllib3.exceptions import InsecurePlatformWarning
import time
from urlparse import urlparse
def average_list(list... |
installwizard.py |
from functools import partial
import threading
import os
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... |
packet_capture.py | """
Thread that continuously captures and processes packets.
"""
import scapy.all as sc
import threading
import utils
from host_state import HostState
import time
class PacketCapture(object):
def __init__(self, host_state):
assert isinstance(host_state, HostState)
self._host_state = host_state
... |
multiThreading.py | import threading, time
print('Start of program.')
def takeANap():
time.sleep(5)
print('Wake up!')
threadObj = threading.Thread(target=takeANap)
threadObj.start()
print('End of Program.')
print('-' * 40)
threadObj2 = threading.Thread(target=print, args=['Cats', 'Dogs', 'Frogs'], kwargs={'sep': ' & '})
t... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement
import os
import re
import sys
import copy
import time
import types
import signal
import fnmatch
import logging
import threading
import traceback
import contextlib
impo... |
SatadishaModule_final_trie.py |
# coding: utf-8
# In[298]:
import sys
import re
import string
import csv
import random
import time
#import binascii
#import shlex
import numpy as np
import pandas as pd
from itertools import groupby
from operator import itemgetter
from collections import Iterable, OrderedDict
from nltk.tokenize import sent_tokenize... |
swarming_load_test_bot.py | #!/usr/bin/env python
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Triggers a ton of fake jobs to test its handling under high load.
Generates an histogram with the latencies to process t... |
test_sockets.py | # Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import multiprocessing
import os
import socket
import shutil
import s... |
statuserver.py | # Provides scan status information via a TCP socket service.
# Currently only works for signature scans.
import time
import errno
import threading
import binwalk.core.compat
# Python 2/3 compatibility
try:
import SocketServer
except ImportError:
import socketserver as SocketServer
class StatusRequestHandler... |
sqlds.py | #! /usr/bin/env python
"""Binds the OData API to the Python DB API."""
import decimal
import hashlib
import io
import itertools
import logging
import math
import os.path
import sqlite3
import sys
import threading
import time
import traceback
import warnings
from .. import blockstore
from .. import iso8601 as iso
fro... |
start.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
l7 = ["CFB", "BYPASS", "GET", "POST", "OVH", "STRESS", "OSTRESS", "DYN", "SLOW", "HEAD", "HIT", "NULL", "COOKIE", "BRUST", "PPS", "EVEN", "GSB", "DGB", "AVB"]
l4 = ["TCP", "UDP", "SYN", "VSE", "MEM", "NTP"]
l3 = ["POD", "ICMP"]
to = ["CFIP", "DNS", "PING", "CHECK", "DSTAT... |
server.py | #!/usr/bin/python
import socket, ssl
import json
import sys
import requests
import ConfigParser
import argparse
import threading
from avbmsg import AVBMessage
"""
This is the underlying data format that AVBMessage wraps in a header
and optionally encrypts. The various fields are as follows:
id: The numeric device id ... |
logger.py | import time, datetime, pytz
import threading
class Logger(object):
@staticmethod
def log(text: str):
threading.Thread(target=Logger._logtask,args=(text,)).start()
@staticmethod
def _logtask(text: str):
t = '[ '+ datetime.datetime.now(pytz.timezone('Europe/Warsaw')).strftime("%Y-%m-%d ... |
webprobe.py | import threading
import requests
import argparse
from time import sleep
"""ArgParse for CLI input"""
parser=argparse.ArgumentParser(description='WebProbe V0.1')
parser.add_argument('-f','--filename',type=str,required=True,help="Specify filename.")
parser.add_argument('-t','--threads',type=int,const=5,nargs='?',help="... |
hickey.py | import os
import platform
from multiprocessing import Process
from datetime import datetime
from inspect import isfunction
from time import sleep
now = datetime.now()
def auth_time(current):
if (current - now).seconds < 10:
return True
elif 10 <= (current - now).seconds <= 20:
return False
... |
Main.py | #!/usr/bin/env python3
print("Inicializando...", end=' \r')
import time
# from ev3dev.ev3 import *
print("ev3dev.ev3", end=' \r')
from ev3dev2.motor import OUTPUT_A, OUTPUT_B, MoveTank, SpeedPercent
print("motores importados", end=' \r')
from ev3dev2.sensor... |
Client.py | #!/usr/bin/env python
import os
import socket
import colorama
from threading import Thread
from AESCipher import AESCipher
from Cryptodome.PublicKey import RSA
from Cryptodome.Cipher import PKCS1_OAEP
import ast
import urllib.request
import shutil
import configparser
import argparse
def parse_config():
global public... |
My_Data_Coll_collect.py | """
get image from camera:/dev/video2 424*240
rocker:/dev/input/jso
save the data ../data/img ../data/data.npy
"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import v4l2capture
import select
from ctypes import *
import struct, array
from fcntl import ioctl
import cv2
import numpy as... |
database_server.py | from __future__ import print_function, absolute_import, division, unicode_literals
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it will be useful.
# This program and the accomp... |
EndpointTP_testbed.py | #!/usr/bin/python3
from mininet.net import Mininet
from mininet.node import Controller, OVSSwitch, RemoteController, OVSKernelSwitch, IVSSwitch, UserSwitch
from mininet.link import Link, TCLink
from mininet.cli import CLI
from mininet.log import setLogLevel
import time
import threading
from util.setup import SetupUtil
... |
testcase.py | import numpy as np
import subprocess as sp
from threading import Thread
n_samples = 44100
proc = sp.Popen(['cat'], stdin=sp.PIPE, stdout=sp.PIPE)
out_arr = np.ones(n_samples, dtype=np.int16)
def reader():
in_arr = np.fromfile(proc.stdout, np.int16, n_samples)
assert np.all(np.equal(in_arr, out_arr))
reader_... |
utils.py | # -*- coding: utf-8 -*-
"""
Various function that can be usefull
"""
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
import multiprocessing
from functools import reduce
import time
import numpy as np
from scipy.spatial.distance import cdist
import sys
import warnings
__time_tic_toc = time.t... |
tweet_stream.py | #!/usr/bin/env python3
# this is based on http://adilmoujahid.com/posts/2014/07/twitter-analytics/
import collections
import json
import html
import os
import re
import sys
import queue
import threading
import tweepy
import tweepy.api
import tweepy.streaming
conf = json.load(open(os.environ['TWITTER_CONFIG']))
acces... |
assignment.py | from threading import *
class EvenNumbers:
def even(self):
self.c = Condition()
self.c.acquire()
for i in range(1,101):
if i%2==0:
print(i)
self.c.notify()
self.c.release()
class OddNumbers:
def odd(self):
self.c = Condition()
... |
conversation.py | from queue import Queue, Empty
from threading import Thread
from time import sleep
from random import uniform
from personalities.sheldon import Sheldon
from personalities.generic import Generic
class ConversationStateMachine:
def __init__(self, partner_name, reply_sink, finish_hook=None, default_persona="generi... |
main.py | #!/usr/bin/python
from bottle import get,request, route, run, static_file,template
import time, threading
from neopixel import *
# LED strip configuration:
LED_COUNT = 32 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
LED_FREQ_HZ = 800000 # LED ... |
bmv2stf.py | #!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
py_utils.py | # Lint as: python2, python3
# -*- coding: utf-8 -*-
# Copyright 2018 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... |
settings_20210906114827.py | """
Django settings for First_Wish project.
Generated by 'django-admin startproject' using Django 3.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathli... |
serve.py | # Most of this code is:
# (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
# The server command includes the additional header:
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/C... |
admin_worker.py | #!/usr/bin/env python
# -*- enconding: utf-8 -*-
from docker_client import DockerAPIClient
from pika import BlockingConnection, URLParameters
from pika.exceptions import AMQPConnectionError
from time import sleep
from threading import Thread
from functools import partial
from os import environ
from os.path import join... |
main.py | import subprocess, threading, time, os
try:
import requests
from termcolor import cprint
except:
try:
import pip
except ImportError:
os.system("")
print("[", end="")
print('\033[31m'+" ERROR ", "red", end="")
print("] " , end="")
print('\033[31m'+"Pip not installed. Installing ... |
__init__.py | # Copyright 2011,2013 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 to in ... |
nuage_gluon_shim.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016, Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list... |
kvm_executor.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A script that starts a vm, reverts it to a known snapshot, tests a
submission bundle (submission + tests), and closes the vm"""
from __future__ import with_statement
# Use simplejson or Python 2.6 json, prefer simplejson.
try:
import simplejson as json
except Imp... |
worker.py | import logging
import threading
import time
from persistence import pop_from_queue
class ProcessingWorker(object):
current_workflow = None
current_step = None
_exit_event = threading.Event()
_worker_thread = None
def __init__(self):
self.logger = logging.getLogger('spreadsplug.web.worke... |
tcp_server_gui.py | #!/usr/bin/env python
"""
Copyright (c) 2012, Bruce A. Corliss
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, t... |
034 - digit factorials.py | #!python3
# coding: utf-8
# 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
# Find the sum of all numbers which are equal to the sum of the factorial of their digits.
# Note: As 1! = 1 and 2! = 2 are not sums they are not included.
#https://projecteuler.net/problem=34
from time import perf_counter
from ... |
notebookapp.py | """A tornado based Jupyter notebook server."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import notebook
import asyncio
import binascii
import datetime
import errno
import functools
import gettext
import hashlib
import hmac
import importlib
import inspect
imp... |
1.2.py | '''
多线程
'''
import datetime
import threading
def fbnq(n):
summ=0
if n==0:
summ=0
elif n==1:
summ=1
elif n>=2:
summ=summ+fbnq(n-1)+fbnq(n-2)
return summ
def jiecheng(n):
if n==1:
return 1
else:
return n*jiecheng(n-1)
def sumn(n):
summ=0
for i ... |
dns_validator.py | #!/usr/bin/python3
import subprocess
import ipaddress
import socket
import threading
import logging
def valid_ip(address):
try:
ipaddress.ip_address(address)
return True
except:
return False
def get_ipresolver_output(ip,IP_STATUS,HOSTNAME):
try:
STATUS=valid_ip(ip)... |
test_unix_events.py | """Tests for unix_events.py."""
import collections
import contextlib
import errno
import io
import os
import pathlib
import signal
import socket
import stat
import sys
import tempfile
import threading
import unittest
from unittest import mock
from test import support
if sys.platform == 'win32':
... |
rebound.py | ##########
## GLOBALS
##########
import urwid
import re
import sys
import os
from bs4 import BeautifulSoup
import requests
from queue import Queue
from subprocess import PIPE, Popen
from threading import Thread
import webbrowser
import time
from urwid.widget import (BOX, FLOW, FIXED)
import random
SO_URL = "https://... |
devtools_browser.py | # Copyright 2019 WebPageTest LLC.
# Copyright 2017 Google Inc.
# Use of this source code is governed by the Apache 2.0 license that can be
# found in the LICENSE file.
"""Base class support for browsers that speak the dev tools protocol"""
import glob
import gzip
import io
import logging
import os
import re
import shut... |
DataQueue.py | #
# Convenience class for using the DAF's notifications feature. This is a
# collection that, once connected to EDEX by calling start(), fills with
# data as notifications come in. Runs on a separate thread to allow
# non-blocking data retrieval.
#
#
#
# SOFTWARE HISTORY
#
# Date Ticket# ... |
collection.py | # Copyright 2009-present MongoDB, 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 wri... |
utils.py | try:
from Crypto import Random
from Crypto.Cipher import AES
except:
from Cryptodome import Random
from Cryptodome.Cipher import AES
from colorama import init, Fore, Back, Style
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selen... |
bolt.py | """Base Bolt classes."""
from __future__ import absolute_import, print_function, unicode_literals
from collections import defaultdict
import os
import signal
import sys
import threading
import time
import warnings
import logging
from six import iteritems, reraise, PY3
from .base import Component
from .ipc import (re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.