source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
Json.py | # import json
# d = dict(name='Bob', age=20, score=88)
# jstr=json.dumps(d)
# print(jstr)
# d1=json.loads(jstr)
# print(d1)
import json
class Student(object):
def __init__(self, name, age, score):
self.name = name
self.age = age
self.score = score
s = Student('Bob', 20, 88)
print(json.dum... |
threads.py | # Copyright 2019 Uber Technologies, 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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
spawning_processes_sk.py | #Spawn a Process – Chapter 3: Process Based Parallelism
import multiprocessing
def CustomFunction(i):
print ('Menjalankan fungsi dengan process no : %s' %i)
for j in range (0,i):
print('Hasil looping fungsi dengan no : %s' %j)
return
if __name__ == '__main__':
for i in range(6):
proces... |
s3.py | import json
import errno
import os
import tempfile
import sys
import subprocess
import time
import re
from collections import defaultdict
from urllib.parse import urlparse
#
# This creates an S3 file that supports seeking and caching.
# We keep this file at Python2.7 for legacy reasons
global debug
_LastModified =... |
test_radius.py | # RADIUS tests
# Copyright (c) 2013-2016, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
from remotehost import remote_compatible
import binascii
import hashlib
import hmac
import logging
logger = logging.getLogger()
import os
import sele... |
tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import errno
import os
import shutil
import sys
import tempfile
import time
import zlib
from datetime import datetime, timedelta
from io import BytesIO
try:
import threading
except ImportError:
import dummy_threading as threading... |
__init__.py | """PTGray based player
======================
This player can play Point Gray ethernet cameras using :mod:`pyflycap2`.
"""
from threading import Thread
from time import perf_counter as clock
from functools import partial
import time
from queue import Queue
from os.path import splitext, join, exists, isdir, abspath, d... |
test_storage_pool.py | import time
import threading
import unittest
from pyramid import testing
from kinto.core.testing import skip_if_no_postgresql
@skip_if_no_postgresql
class QueuePoolWithMaxBacklogTest(unittest.TestCase):
def setUp(self):
from kinto.core.storage.postgresql.client import create_from_config
self.co... |
log.py | from logging import Handler
from queue import Queue
from threading import Thread
import logging.config
import logging
import asyncio
import datetime
import yaml
import sys
import os
from git import Repo
from functools import partial, wraps
from pythonjsonlogger import jsonlogger
RED = '\033[91m'
BLUE = '\033[94m'
BO... |
s3booster-restore-version.py | #!/bin/env python3
'''
** Chaveat: not suitable for millions of files, it shows slow performance to get object list
ChangeLogs
- 2021.07.24:
- 2021.07.23: applying multiprocessing.queue + process instead of pool
- 2021.07.21: modified getObject function
- for parallel processing, multiprocessing.Pool used
- used b... |
__init__.py | import time
import socket
import paramiko
import logging
from src.s3_sftp_si import S3SFTPServerInterface
from src.sftp_si import S3ServerInterface
from src.config import AppConfig
from paramiko.ssh_exception import SSHException
import threading
BACKLOG = 10
def client_connection(server_socket, conn, addr, config)... |
bot.py | #!/usr/bin/env python
import sys
import os
import math
import traceback
from multiprocessing import Process
# local modules
import forvo
import api
from models import Term, File, TermWithData
# data sources
# import cambridge
import unsplash
import multitran
import merriamwebster
import howjsay
import macmillan
# her... |
20-thread.py | def sync_consume():
while True:
print(q.get())
q.task_done()
def sync_produce():
consumer = Thread(target=sync_consume, daemon=True)
consumer.start()
for i in range(10):
q.put(i)
q.join()
sync_produce() |
picam_video_input_stream.py | from queue import Empty, Queue
from threading import Thread
from picamera import PiCamera
from picamera.array import PiRGBArray
from visutils.video import VideoInputStream
class PicamVideoInputStream(VideoInputStream):
def __init__(self, src: int, is_live=False, buffer_size=128,
resolution=(320... |
__main__.py | from threading import Thread
from src.gui import GUI_MainThread
from src.simulator import Sim_MainThread
#g_thr = Thread(target=GUI_MainThread)
s_thr = Thread(target=Sim_MainThread)
s_thr.start()
GUI_MainThread()
#g_thr.start()
|
client.py | # Anthony Tiongson (ast119) with assistance from Nicolas Gundersen (neg62)
# Client side DNS
#
# resources:
# https://www.pythonforbeginners.com/files/reading-and-writing-files-in-python
# https://www.pythonforbeginners.com/system/python-sys-argv
# https://www.w3schools.com/python/ref_string_split.asp
# https:/... |
console_io.py | # Copyright 2013 Google Inc. All Rights Reserved.
"""General console printing utilities used by the Cloud SDK."""
import logging
import string
import sys
import textwrap
import threading
import time
from googlecloudsdk.core import exceptions
from googlecloudsdk.core import log
from googlecloudsdk.core import propert... |
index.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
UI - a simple web search engine.
The goal is to index an infinite list of URLs (web pages),
and then be able to quickly search relevant URLs against a query.
See https://github.com/AnthonySigogne/web-search-engine for more information.
"""
__author__ = "Anthony Sigog... |
run_PDGD_batch_update.py | # experiments run for PDGD updating in batch (single client)
import os
import sys
sys.path.append('../')
from data.LetorDataset import LetorDataset
from ranker.PDGDLinearRanker import PDGDLinearRanker
from clickModel.SDBN import SDBN
from clickModel.PBM import PBM
from utils import evl_tool
import numpy as np
import m... |
thread_caching.py | import typing as t
from itertools import count
from threading import Lock, Thread
import outcome
IDLE_TIMEOUT = 10
name_counter = count()
class WorkerThread:
def __init__(self, thread_cache: t.Any) -> None:
self._job = None
self._thread_cache = thread_cache
self._worker_lock = Lock()
... |
cleanup.py | """
sentry.runner.commands.cleanup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import os
from datetime import timedelta
from uuid import uuid4
import click... |
fit_switch.py |
import threading
import tensorflow_probability as tfp
import numpy as np
import tensorflow as tf
import time
import pickle
import pandas as pd
np.set_printoptions(suppress=True,precision=3)
import sys
from tensorflow_probability import distributions as tfd
from move_ns import moveNS
def setup_and_run_hmc(threa... |
server_ingester_test.py | # 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 required by applica... |
use_case_one.py | from distrilockper import Config
from distrilockper.lock_helper import DistributerLockHelper
config = Config()
config.use_single_server().set_config(host='0.0.0.0', port=6379)
helper = DistributerLockHelper()
helper.create(config)
class ticketSalse():
def __init__(self):
self.ticket_count = 1
def buy(self)... |
main_whit_async.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from multiprocessing import Event,JoinableQueue,Pool,Process,Value,Queue
import io,os,sys,time,threading,queue,asyncio,socket,argparse
import pgbar,tracemalloc,ports_g,iprange_g
def eq_put_y(task,workers,procs):
if task == 0:
yield 0
if procs == 1:
for i in range(procs)... |
plot_from_pp_geop_height_pot_temp_and_wind_diff_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_t... |
test_ITransE_lan_mapping_cn.py | import sys
import os
new_path = os.path.join(os.path.dirname(__file__), '../../src/ITransE')
sys.path.append(new_path)
from ITransE import ITransE
import time
import multiprocessing
from multiprocessing import Process, Value, Lock, Manager, Array
import numpy as np
from numpy import linalg as LA
fmap = os... |
_core.py | """ Multicast DNS Service Discovery for Python, v0.14-wmcbrine
Copyright 2003 Paul Scott-Murphy, 2014 William McBrine
This module provides a framework for the use of DNS Service Discovery
using IP multicast.
This library is free software; you can redistribute it and/or
modify it under the t... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
__init__.py | import requests
import datetime
import logging
import boto3
import gzip
import io
import csv
import time
import os
import sys
import json
import hashlib
import hmac
import base64
from threading import Thread
from io import StringIO
import azure.functions as func
TIME_INTERVAL_MINUTES = 10
DIVIDE_TO_MULTIPLE_TABLES ... |
cameraclient.py | from leginon import leginondata
import threading
import time
# Change this to False to avoid automated screen lifting
AUTO_SCREEN_UP = True
AUTO_COLUMN_VALVE_OPEN = True
default_settings = leginondata.CameraSettingsData()
default_settings['dimension'] = {'x': 1024, 'y': 1024}
default_settings['offset'] = {'x': 0, 'y'... |
test_bson.py | # -*- coding: utf-8 -*-
#
# 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 applicab... |
hetmet_view_run.py | from json import JSONDecoder
import cv2
import time
import threading
import sys
import dialog
from dialog_1 import Ui_Dialog
from PyQt5.QtWidgets import QApplication,QDialog,QLabel
from PyQt5.QtGui import QImage,QPixmap
from PyQt5.QtCore import Qt, pyqtSlot
from PyQt5.QtMultimedia import (QCameraInfo,QCameraImageCaptur... |
MultithreadedTernaryProjectiveRelations.py | import itertools
from collections import defaultdict
from Model.Relations import *
from Model.Relations import _Operations
import time
import threading
'''
def Constraints(re1, re2):
comp = set()
for r1 in re1:
for r2 in re2:
comp = comp.union(_Operations.composition(r1,r2))
return comp
... |
smtclient.py | # Copyright 2017,2021 IBM Corp.
#
# 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 agr... |
rest_api_endpoint.py | # Copyright (c) 2015 SONATA-NFV and Paderborn University
# 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 re... |
mtrelay.py | """
Multithreaded relay
Author: Guillaume Aubert (gaubert) <guillaume(dot)aubert(at)gmail(dot)com>
"""
import threading
import zmq
def step1(context):
""" step1 """
# Signal downstream to step 2
sender = context.socket(zmq.PAIR)
sender.connect("inproc://step2")
sender.send(""... |
console_coorelate.py | import time
import threading
import logging
import data as d
from analysis.correlate import Correlate
from data import store as store
from utils import ui
_logger = ui.get_logger(logging.WARNING, logfile='')
class Interface:
def __init__(self, coor: str = ''):
self.list = coor.upper()
self.coor... |
test__threadsafety.py | from __future__ import division, print_function, absolute_import
import threading
import time
import traceback
from numpy.testing import assert_
from pytest import raises as assert_raises
from scipy._lib._threadsafety import ReentrancyLock, non_reentrant, ReentrancyError
def test_parallel_threads():
# Check th... |
thermostat_with_json_rpc_server.py | #pylint: disable=wrong-import-position, invalid-name
import threading
import asyncio
import sys
import os
from pathlib import PurePath
sys.path.append(os.getcwd())
from chili_pad_with_thermostat.thermostat import Thermostat
from chili_pad_with_thermostat.temp_program import TempProgram
from chili_pad_with_thermostat.j... |
rest_crawler.py | # -*- coding=utf-8 -*-
# author: Chi-zhan Zhang
# date:2019/7/27
# func: twitter spider demo
import json
import os
import shutil
import requests
import time
import threading
import datetime
from id_collection import create_api, create_user_agent
class TwitterCrawler(object):
def __init__(self, since_id=None, cl... |
base.py | import argparse
import base64
import copy
import itertools
import json
import multiprocessing
import os
import re
import sys
import threading
import time
import uuid
import warnings
from collections import OrderedDict
from contextlib import ExitStack
from typing import Optional, Union, Tuple, List, Set, Dict, overload,... |
datagen.py | """
Batch-generate data
"""
import os
import numpy as np
import multiprocessing as mp
from subprocess import call
from utils import printout
import time
class DataGen(object):
def __init__(self, num_processes, flog=None):
self.num_processes = num_processes
self.flog = flog
s... |
Project3 Image Processing Raw.py | #Project
## 영상 처리 및 데이터 분석 툴
from tkinter import *; import os.path ;import math
from tkinter.filedialog import *
from tkinter.simpledialog import *
import operator
import threading
import random
## 함수 선언부
def loadImage(fname) :
global window, canvas, paper, filename, inImage, outImage, inW, inH, outW, outH
... |
fuzzer.py | # -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope... |
socket.py | # ============================================================================
# FILE: socket.py
# AUTHOR: Rafael Bodill <justRafi at gmail.com>
# License: MIT license
# ============================================================================
import socket
from threading import Thread
from queue import Queue
from ... |
stress_.py | #!/usr/bin/env python3
import argparse
import os, atexit
import textwrap
import time
import threading, subprocess
import signal
import random
import time
from enum import Enum
from collections import defaultdict, OrderedDict
PROCESSES_BASE_IP = 11000
class ProcessState(Enum):
RUNNING = 1
STOPPED = 2
T... |
thermald.py | #!/usr/bin/env python3
import datetime
import os
import queue
import threading
import time
from collections import OrderedDict, namedtuple
from pathlib import Path
from typing import Dict, Optional, Tuple
import psutil
from smbus2 import SMBus
import cereal.messaging as messaging
from cereal import log
from common.di... |
program.py | import argparse
import os
import signal
import sys
import threading
from tensorboard import program
from gr_tensorboard.version import VERSION
from tensorboard.backend.event_processing import event_file_inspector as efi
from tensorboard.plugins import base_plugin
from .application import gr_tensorboard_wsgi
from .log... |
test_bert_thor.py | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
render_observation.py | import gym
import cv2
import multiprocessing as mp
import os
import numpy as np
def _render(img):
img = cv2.cvtColor(np.asarray(img), cv2.COLOR_BGR2RGB)
cv2.imshow(str(os.getpid()) + "_render", img)
cv2.waitKey(1)
def _async_callback(q: mp.Queue):
while True:
img = q.get()
_render(im... |
miniterm.py | #!C:\Python27\pythonw.exe
# Very simple serial terminal
# (C)2002-2011 Chris Liechti <cliechti@gmx.net>
# Input characters are sent directly (only LF -> CR/LF/CRLF translation is
# done), received characters are displayed as is (or escaped trough pythons
# repr, useful for debug purposes)
import sys, os, ... |
fast_api_test_server.py | import logging
import threading
import time
from typing import Optional
from fastapi import FastAPI
from starlette.requests import Request
from starlette.responses import Response
from uvicorn.config import Config
from pyctuator.pyctuator import Pyctuator
from tests.conftest import PyctuatorServer, CustomServer
cla... |
validate.py | # -*- coding:utf-8 -*-
import threading
from app.mongo_model.ip import ip
from app.validate.request_web import request_web
class validate(object):
def run(self):
while(True):
_lists = ip().lists(10)
_threads = []
for _i in _lists:
_http_type = 'http' if... |
sent_segmentation_multiProcessing.py | import multiprocessing
import spacy
from spacy.lang.en import English
import pickle
def worker(i, return_dict):
"""worker function"""
with open("../data/processed/Ensemble_splits/Ensemble_split{}.txt".format(i),"r") as file:
trunk=file.read()
return_dict[i] =[str(sent)+"\n" for sent in list(nlp(tru... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... |
utils.py | #!/usr/bin/env python
import sys
import array
import numpy as np
from skimage.color import rgb2gray
from skimage.transform import resize
from skimage.io import imread
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from tqdm import tqdm
from inputs import get_gamepad
import math
import threading
... |
Rabbit_Base.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 In-Q-Tel, 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 a copy of the License at
#
# http://www.apache.or... |
__init__.py | # Copyright The OpenTelemetry 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 ... |
__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Han Xiao <artex.xh@gmail.com> <https://hanxiao.github.io>
import sys
import threading
import time
import uuid
from collections import namedtuple
from functools import wraps
import numpy as np
import zmq
from zmq.utils import jsonapi
__all__ = ['__version__', 'BaseClien... |
multiple_variables_with_threads.py | import threading
import queue
def print_cube(num):
"""
function to print cube of given num
"""
print("Cube: {}".format(num * num * num))
def print_square(count,row,q1):
"""
function to print square of given num
"""
count +=1
row +=1
q1.put(count)
#q1.put(row)
# print("... |
runtime.py | import subprocess, multiprocessing, time
import memcache, ansible, hibike
from grizzly import *
import usb
import os
# Useful motor mappings
name_to_grizzly, name_to_values, name_to_ids = {}, {}, {}
student_proc, console_proc = None, None
robot_status = 0 # a boolean for whether or not the robot is executing code
if ... |
plugin_manager.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/windows/plugin_manager.py
#
# 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... |
ServiceManager.py | import threading
from time import sleep
# ------------------------------------------------------------------
class ServiceManager():
"""keep track of all threads spawned in this proccess, and enable interruption
"""
threads = []
def __init__(self, service_name, *args, **kwargs):
# if service... |
checkerpoint_correspondence_generator.py | import numpy as np
import pickle
import cv2
import glob
import os
import argparse
from multiprocessing import Process, Manager
def parallization_function(args, i, filename, global_objpts, global_imgpts, global_mark):
ncols = args.nsquare_x - 1
nrows = args.nsquare_y - 1
# termination criteria
criter... |
server.py | import os
import logging
import json
import uvicorn
from fastapi import FastAPI
from pydantic import BaseModel
import grpc
from google.protobuf import any_pb2
import sys
import time
from threading import Thread
import redis
import cache
import service_pb2
import service_pb2_grpc
class ProcessItem(BaseModel):
use... |
message.py | from time import sleep
from marrow.mailer import Mailer
from sqlalchemy import Column, Unicode, UnicodeText, Integer
from config import admin_mail
import secret
from models.base_model import SQLMixin, db
from models.user import User
def configured_mailer():
config = {
# 'manager.use': 'futures',
... |
simulate_test.py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify 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... |
readCoils.py | from System.Core.Global import *
from System.Core.Colors import *
from System.Core.Modbus import *
import ipcalc
class Module:
info = {
'Name': 'Read Coils Function',
'Author': ['@enddo'],
'Description': ("Fuzzing Read Coils Function"),
}
options = {
'RHOSTS' :['' ,True ,'The target address range ... |
threadpool.py | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Cached thread pool, inspired from Pelix/iPOPO Thread Pool
:author: Thomas Calmant
:copyright: Copyright 2015, isandlaTech
:license: Apache License 2.0
:version: 0.2.4
..
Copyright 2015 isandlaTech
Licensed under the Apache License, Version 2.0 (the "... |
evals.py | import numpy
import scipy.sparse as sp
import logging
from six.moves import xrange
from collections import OrderedDict
import sys
import pdb
from sklearn import metrics
from threading import Lock
from threading import Thread
import torch
import math
from pdb import set_trace as stop
import os
import pandas as pd
# impo... |
userInterface.py | from __future__ import print_function
from Tkinter import *
import Tkinter, Tkconstants, tkFileDialog
import ttk
import tkMessageBox
import pcapReader
import plotLanNetwork
import communicationDetailsFetch
import reportGen
import time
import threading
import Queue
from PIL import Image,ImageTk
import os, sys
class pca... |
launch_ipykernel.py | import argparse
import base64
import json
import logging
import os
import socket
import tempfile
import uuid
from future.utils import raise_from
from multiprocessing import Process
from random import random
from threading import Thread
from Cryptodome.Cipher import AES
from ipython_genutils.py3compat import str_to_byt... |
app.py | #############################################################################
# Copyright (c) 2018, Voilà Contributors #
# Copyright (c) 2018, QuantStack #
# #
# Distri... |
scanport1.py | import sys
import subprocess
import socket
import threading
import time
class PortScanner:
# default ports to be scanned
# or put any ports you want to scan here!
__port_list = [1,3,6,9,13,17,19,20,21,22,23,24,25,30,32,37,42,49,53,70,79,80,81,82,83,84,88,89,99,106,109,110,113,119,125,135,139,143,146,161,1... |
test_sys.py | # -*- coding: iso-8859-1 -*-
import unittest, test.test_support
import sys, cStringIO, os
import struct
class SysModuleTest(unittest.TestCase):
def test_original_displayhook(self):
import __builtin__
savestdout = sys.stdout
out = cStringIO.StringIO()
sys.stdout = out
dh = ... |
test_discord_listener.py | import asyncio
import logging
import re
from unittest.mock import MagicMock
import time
import threading
import pytest
from discord.ext.commands.bot import Bot
from bot.drivers.discord_listener import _EventListenerCog
from bot.drivers import DiscordListener
logger = logging.getLogger(__name__).parent
# Testing list... |
lineRobotClient.py | import io
import socket
import struct
import time
import picamera
from gpiozero import Robot
import sys
from threading import Thread
robot = Robot(left=(27,24), right=(16,23))
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientSocket.connect(('192.168.1.67', 8000))
connectionStream = clientSocket.... |
optimization_checks.py | # Copyright 2017 Google Inc. All rights reserved.
# Use of this source code is governed by the Apache 2.0 license that can be
# found in the LICENSE file.
"""Run the various optimization checks"""
import binascii
import gzip
import logging
import multiprocessing
import os
import re
import shutil
import struct
import su... |
datasets.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Dataloaders and dataset utils
"""
import glob
import hashlib
import json
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import Pool, ThreadPool
from pathlib import Path
from threading i... |
main.py | #!~/bike-computer/.venv/bin python
import serial
import serial.tools.list_ports
from multiprocessing import Process
import subprocess
import tkinter as tk
import dashboard
import interpreter
def runScript(script_name):
subprocess.run(["python",script_name])
if __name__ == '__main__':
p = Process(target=runScript, ... |
run_covidnet_ct_2_lps.py | """
Training/testing/inference script for COVID-Net CT models for COVID-19 detection in CT images.
"""
import os
import sys
import time
import cv2
import json
import shutil
import numpy as np
from math import ceil
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix, Co... |
brainless.py | """
Brainless launcher
"""
from flask import render_template
from configuration import app, db
from datetime import datetime
import continuous_threading
from daemons.sync import sync_accounts
# Create a URL route in our application for "/"
@app.route('/')
def brainless():
print('BBRRRAAAIIIINNNNSSSS')
# backgro... |
test_pipeline_threaded.py | import unittest
import threading
import nanomsg as nn
class ThreadedPipelineTest(unittest.TestCase):
def test_pipeline(self):
result = []
def ping(url, ack):
with nn.Socket(protocol=nn.NN_PUSH) as sock, sock.connect(url):
sock.send(b'Hello, world!')
... |
test.py | # coding=utf-8
import requests
import json
from time import time
import threading
import csv
data = {
"coin_type": "BSV",
"flat_amount": "99900",
"totp_captcha": {"validate_code": "111111", "sequence": ""}
}
# 定义需要进行发送的数据
# 定义一些文件头
headers = {
'User-Agent':... |
build_image_data.py | #!/usr/bin/python
# Copyright 2016 Google 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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
client.py | #!/usr/bin/env python3
"""Script for Tkinter GUI chat client."""
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import random
import tkinter
import webbrowser
import tkinter.messagebox
messages_sent_count = 0
connected = False
def display(text):
global chat_display
if not t... |
test_node.py | import os
import sys
import logging
import requests
import time
import traceback
import random
import pytest
import ray
import threading
from datetime import datetime, timedelta
from ray.cluster_utils import Cluster
from ray.dashboard.modules.node.node_consts import (LOG_PRUNE_THREASHOLD,
... |
vad_test.py | #!/usr/bin/env python3
###################################################################################################
##
## Project: Embedded Learning Library (ELL)
## File: vad_test.py
## Authors: Chris Lovett
##
## Requires: Python 3.x, numpy, tkinter, matplotlib
##
###################################... |
test_shell_util.py | # -*- coding: utf-8 -*-
# Copyright 2018 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
app.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
ui_utils.py | # -*- coding: utf-8 -*-
from logging import getLogger
import os
import platform
import re
import subprocess
import sys
import textwrap
import threading
import time
import tkinter as tk
import tkinter.font
import traceback
from tkinter import filedialog, messagebox, ttk
from typing import Callable, List, Optional, Tuple... |
server.py | import socket
import queue
import threading
import logging
import collections
import time
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
# Container for an HTTP Request
Request = collections.namedtuple('Request', [
'method',
'path',
'http_version',
'sock',
])
class Ht... |
comm_autobahn.py | from __future__ import print_function
import logging
import threading
from autobahn.twisted.websocket import WebSocketClientFactory
from autobahn.twisted.websocket import WebSocketClientProtocol
from autobahn.twisted.websocket import connectWS
from autobahn.websocket.util import create_url
from twisted.internet impor... |
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... |
FinalProject_Controller.py | """
This is the controller file for our Ball Drop Game. It provides the
functions that read user input (in our case, from the webcam feed) to control
the gameplay mechanics.
"""
import pygame
from threading import Thread
import time
import sys
# sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') # in ord... |
dark-vpro.py | # -*- coding: utf-8 -*-
import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize
from multiprocessing.pool import ThreadPool
from requests.exceptions import ConnectionError
from mechanize import Browser
reload(sys)
sys.setdefaultencoding('utf8')
br = mechanize.Browser... |
periodical_local_shell.py | import logging
import threading
from time import time, sleep
from planteye_vision.shell.shell import Shell
from planteye_vision.configuration.shell_configuration import PeriodicalLocalShellConfiguration
class PeriodicalLocalShell(Shell):
"""
This class describes a local shell that requests data periodically
... |
montysolrupdate.py | #!/usr/bin/env python
"""An assistant for updating MontySolr releases.
This script will update the codebase of MontySolr ON the machine(s)
that run it. This script is to be executed unattended and very often.
Here are the assumptions under which we work:
- PATH contains correct versions of ant, java, javac, git
... |
base_crash_reporter.py | # Electrum - lightweight Bitcoin client
#
# 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,
# publish... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.