source
stringlengths
3
86
python
stringlengths
75
1.04M
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...
mul_threading.py
#!/usr/bin/env python3 # -*- coding utf-8 -*- __Author__='eamon' 'threading multithreading ' import time,threading def loop(): print('thread %s is running ...' % threading.current_thread().name) n=0 while n <5: n+=1 print('thread %s >> %s ' %(threading.current_thread().name,n)) time.sleep(1) print('threa...
test_dota_r3det_efficientnet.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process sys.path.append("....
jobs.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 #...
util.py
# # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try: import ssl ...
traj_py.py
import numpy as np from collections import ChainMap from ophyd import DeviceStatus from ophyd import EpicsSignal, EpicsMotor, EpicsSignalRO, Device, Component import epics import bluesky.preprocessors as bpp import bluesky.plan_stubs as bps from collections import OrderedDict from threading import Thread import uuid ...
test_reusable_executor.py
import os import sys import gc import ctypes import psutil import pytest import warnings import threading from time import sleep from multiprocessing import util, current_process from pickle import PicklingError, UnpicklingError from distutils.version import LooseVersion import loky from loky import cpu_count from lok...
docnado.py
""" docnado.py A rapid documentation tool that will blow you away. """ import os import re import sys import csv import glob import time import signal import shutil import urllib import base64 import hashlib import argparse import tempfile import datetime import threading import traceback import subprocess import pl...
common.py
import inspect import json import os import random import subprocess import ssl import time import requests import ast import paramiko import rancher import pytest from urllib.parse import urlparse from rancher import ApiError from lib.aws import AmazonWebServices from copy import deepcopy from threading import Lock fr...
game-server.py
import socket import sys import threading class Server: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connections = [] conn_addresses = [] max_conns = 2; stop_server = False host = "" port = 5000 server_address = (host, port) def __init__(self): try: self.s.bind(self.server_address) self.s.l...
bokeh.py
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
datasets.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Dataloaders and dataset utils """ import glob import hashlib import json import logging import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool, Pool from pathlib import Path from threading import Thread ...
bucketcapture.py
# -*- coding: utf-8 -*- """ Created on Tue Jan 24 20:46:25 2017 @author: mtkes """ ## NOTE: OpenCV interface to camera controls is sketchy ## use v4l2-ctl directly for explicit control ## example for dark picture: v4l2-ctl -c exposure_auto=1 -c exposure_absolute=10 # import the necessary packages import cv2 from cs...
ActionQueue.py
#!/usr/bin/env python ''' 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")...
exports.py
# Copyright 2004-2021 Tom Rothamel <pytom@bishoujo.us> # # 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...
websocket_client.py
import websocket import json import logging import threading from typing import Text, Callable from .util import LogLevel from .coinbase_auth import CoinbaseAuth # Special channels are sometimes sent by Coinbase, but cannot be subscribed to directly. SPECIAL_CHANNELS = ['error', # Do an action wh...
test_util.py
import os import sys import threading import time from pathlib import Path, PurePath, PurePosixPath from typing import Tuple import pytest from . import util def test_reroot_path() -> None: relative, absolute = util.reroot_path( PurePosixPath("/test_data/bar/baz.rst"), PurePath("/test_data/dir/t...
webcam_demo_ros.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import time from collections import deque from queue import Queue from threading import Event, Lock, Thread import cv2 import numpy as np from mmpose.apis import (get_track_id, inference_top_down_pose_model, init_pose_model, vis_...
image.py
import logging, json from threading import Thread from django.conf import settings from docker import Client from docker.errors import APIError from backend.models import Image from backend.utils import (fetch_digest_from_response, get_optimal_docker_host, remove_file_from_disk) from backend.schedule import Docke...
_threading_local.py
"""Thread-local objects. (Note that this module provides a Python version of the threading.local class. Depending on the version of Python you're using, there may be a faster one available. You should always import the `local` class from `threading`.) Thread-local objects support the management of thread-local d...
heartbeat_handler.py
# Copyright 2016 deepsense.ai (CodiLime, 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 agree...
utils.py
from tempfile import mkstemp import os import inspect import socket from subprocess import Popen, PIPE, STDOUT import shlex import sys from time import sleep from threading import Thread try: from Queue import Queue, Empty except ImportError: from queue import Queue, Empty # python 3.x from ModestMaps.Core ...
registry.py
from xmlrpc.server import SimpleXMLRPCServer from threading import Thread from rsystem import rsys class Registry(object): """ Register services and service listeners under a registry object and push/receive updates. """ def __init__(self): self.services = dict() # dictionary of (String name, ...
views.py
import datetime import logging from threading import Thread import pytz from core.authentication import VKAuthentication from core.models import ( Activity, Brigade, Competition, CompetitionParticipant, Event, EventQuota, Nomination, Participant, Position, Season, Ticket, ...
http_echo.py
from http.server import BaseHTTPRequestHandler, HTTPServer from socketserver import ThreadingMixIn import requests, sys, logging, threading, time, os from base64 import b64decode logger = logging.getLogger() logLevel = logging.INFO # Load settings (adding one directory up to the path) BASE_DIR = os.path.dirname(os.pa...
TServer.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...
ipython.py
""" Start an IPython Qt console connected to the python session running in Excel. This doesn't work with an IPython notebook as it's not possible to connect a notebook to an existing kernel, the notebook app always creates its own. This version is intended to work with IPython 0.13 only. """ from pyxll import xl_menu...
detect_service.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Tencent is pleased to support the open source community by making Metis available. Copyright (C) 2018 THL 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 th...
ipfs_explorer.py
#!/usr/bin/python3 import os import re import sys import json import time import requests import traceback import subprocess from pathlib import Path from threading import Thread from datetime import datetime, timedelta # XXX TODO - Add mutex around data shared by main and "ipfs add" threads # XXX TODO - Forks class...
email.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from . import mail import sys def send_async_email(app, msg): with app.app_context(): try: mail.send(msg) sys.stderr.write('Sahkoposti lahetetty\n') except Exception as...
server.py
from contextlib import closing from threading import Thread from time import sleep import capybara from capybara.compat import URLError, urlopen from capybara.helpers import Timer from capybara.utils import ( Counter, cached_property, decode_bytes, encode_string, find_available_port) class Server...
test_zyklus.py
from zyklus import Zyklus import unittest import time class HelperObj(object): def __init__(self, initial): self.curr = initial def add(self, what): self.curr += what def multiply(self, what): self.curr = self.curr * what def result(self): return self.curr import th...
helper.py
import asyncio import functools import inspect import json import math import os import random import re import sys import threading import time import uuid import warnings from argparse import ArgumentParser, Namespace from collections.abc import MutableMapping from datetime import datetime from itertools import islic...
test_classic_connection.py
#! /usr/bin/python # -*- coding: utf-8 -*- """Test the classic PyGreSQL interface. Sub-tests for the low-level connection object. Contributed by Christoph Zwerschke. These tests need a database to test against. """ try: import unittest2 as unittest # for Python < 2.7 except ImportError: import unittest im...
dagger.py
"""Author: Brandon Trabucco, Copyright 2019, MIT License""" import multiprocessing from cs285.baselines.imitate.dagger import Dagger from gym.envs.mujoco.half_cheetah import HalfCheetahEnv def run_experiment(experiment_id): Dagger( HalfCheetahEnv, logging_dir="./half_cheetah/dagger/{}".format(ex...
krisself.py
# -*- coding: utf-8 -*- import KRIS from KRIS.lib.curve.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile from bs4 import BeautifulSoup from urllib import urlopen import r...
convert_imagenet.py
# 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 applicable law or a...
mk_hbonds.py
# IO options for loading pathway data. # Zilin Song, 20 AUG 2021 # import iomisc, numpy, multiprocessing, dist_compute def launcher_find_hbonds(): '''Simply a parallel launcher for the nested def. ''' def find_hbonds(sysname, pathname, direction, nrep=50, ): '''Detect all possible Hbonds, output...
websocketconnection.py
import threading import websocket import gzip import ssl import logging from urllib import parse import urllib.parse from binance_d.base.printtime import PrintDate from binance_d.impl.utils.timeservice import get_current_timestamp from binance_d.impl.utils.urlparamsbuilder import UrlParamsBuilder from binan...
test_fusion.py
import mock import numpy import six import threading import unittest import cupy from cupy import testing def fusion_default_array_equal(): def deco(func): def wrapper(self_x, name, xp, dtype): @cupy.fuse() def f(*args): return getattr(xp, name)(*args) ...
unsafe_bank.py
import datetime import random import time from threading import Thread from typing import List class Account: def __init__(self, balance=0): self.balance = balance def main(): accounts = create_accounts() total = sum(a.balance for a in accounts) validate_bank(accounts, total) print("Sta...
input.py
from pytermfx.adaptors.base import BaseAdaptor from functools import partial from threading import Thread, Event from multiprocessing import Queue from time import process_time import queue class InputDaemon: def __init__(self, read_ch_func): self.read_ch = read_ch_func self.input_event = Event() ...
__init__.py
# Copyright (c) 2018 SONATA-NFV, 5GTANGO 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 # # ...
scdlbot.py
# -*- coding: utf-8 -*- """Main module.""" import gc import pathlib import random import shelve import shutil from datetime import datetime from multiprocessing import Process, Queue from queue import Empty from subprocess import PIPE, TimeoutExpired # skipcq: BAN-B404 from urllib.parse import urljoin, urlparse from...
threadedclient.py
# -*- coding: utf-8 -*- import os from urlparse import urlsplit import socket import threading import traceback from sys import exc_info from ws4py.client import WebSocketBaseClient from ws4py.exc import HandshakeError __all__ = ['WebSocketClient'] class WebSocketClient(WebSocketBaseClient): def __init__(self, u...
netmain.py
import util def test(): pass # create instance of the server # server = Server(49000) # server.start() # start the server on a different thread # t = Thread(target=server.start, args=()) # t.start() # create client instance # client1 = Client("Client1", 49000) # send files t...
__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...
definitionwindow.py
import functools import logging import os import time from threading import Thread from PyQt5 import uic, QtCore, QtWidgets, QtGui from PyQt5.QtCore import QTimer, QItemSelectionModel, Qt, QItemSelection from PyQt5.QtGui import QPixmap, QMouseEvent, QDrag from PyQt5.QtWidgets import QWidget, QHBoxLayout, QListView, QF...
helper.py
"""Module with some helpers for tests.""" import os import sys import threading import time from socket import socket from pyof.v0x01.common.header import Header from pyof.v0x01.symmetric.hello import Hello from kytos.core import Controller from kytos.core.config import KytosConfig __all__ = ('do_handshake', 'new_co...
gui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'gui.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui import socket import whois import nmap import threading import sys from selenium import webdrive...
api.py
# ================================================================= # imports # ================================================================= import threading import time import json import yaml import numpy as np import serial import math import sys from serial.tools import list_ports from subprocess i...
app.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
androiddevice.py
# -*- coding: utf-8 -*- ''' @author: look @copyright: 1999-2020 Alibaba.com. All rights reserved. @license: Apache Software License 2.0 @contact: 390125133@qq.com ''' ''' 封装adb基本操作 ''' import re import os import time import threading import subprocess import sys import platform import traceback BaseDir...
piksi_multi.py
#!/usr/bin/env python # # Title: piksi_multi.py # Description: ROS Driver for Piksi Multi RTK GPS module # Dependencies: libsbp (https://github.com/swift-nav/libsbp), tested with version = see LIB_SBP_VERSION_MULTI # Based on original work of https://bitbucket.org/Daniel-Eckert/piksi_node # import rospy i...
client2.py
# -*- coding: UTF-8 -*- import socket; import threading; import struct; import os; import time; import sys; import numpy import cv2import re class webCamConnect: def __init__(self, resolution = [640,480], remoteAddress = ("115.216.215.130", 7999), windowName = "video"): self.remoteAdd...
run.py
#! /usr/bin/env python import io import codecs import base64 import argparse import collections import logging import json import os import stat import signal import sys import threading import time import pexpect import psutil logger = logging.getLogger('cyborgbackup.main.utils.expect') def args2cmdline(*args): ...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_ltc.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum_ltc.bip32 import BIP32Node from electrum_ltc import constants...
BasicStorage.py
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
test_xmlrpc.py
import base64 import datetime import sys import time import unittest from unittest import mock import xmlrpc.client as xmlrpclib import xmlrpc.server import http.client import socket import os import re import io import contextlib from test import support try: import gzip except ImportError: gzip = None try: ...
scripts.py
# -*- coding: utf-8 -*- """ This module contains the function calls to execute command line scripts """ # Import python libs from __future__ import absolute_import, print_function, unicode_literals import functools import logging import os import signal import sys import threading import time import traceback from ra...
spin_cnvrt_rslts2TDXY.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Jul 9 17:00:01 2018 @author: mali """ #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sat Jun 2 13:17:02 2018 @author: mali """ import multiprocessing import time import pickle import pyNN.utility.plotting as plot import matplotlib.pyp...
port_scanning.py
import socket import time import Queue import threading from lib.core.settings import LOGGER from lib.core.settings import RESERVED_PORTS class PortScanner(object): connection_made = "" # Connection made in list form def __init__(self, host): self.host = host self.ports = RESERVED_PORTS ...
gui_interface.py
from __future__ import print_function, division import math import ui import messages_from_ui class GtkUI(object): """Gtk+ UI class.""" def __init__(self, font): """Initialize the UI instance.""" pass def start(self, bridge): """Start the UI event loop.""" bridge.attach...
BroadcastManager.py
import socket import threading import time class BroadcastManager: def __init__(self, configurationData, continuousBroadcast): port = configurationData.GetPort() self._message = configurationData.GetMessage() self._continuousBroadcast = continuousBroadcast self._delay = configura...
eng_display.py
#!/usr/bin/env python3 import math import time import tkinter as tk from tkinter import font from tkinter import * from multiprocessing import Process, Pipe from eng_colors import EngColors from main import Main import config class EngDisplay: def __init__(self, src=None, use_light_theme=False, repeat_log=Fals...
env_utils.py
"""Utility functions for CARLAEnvironment organized by subject: - PyGame-related, - CARLA-related, - various (graphics, file, ...) - math-related. @author: Luca Anzalone """ import os import cv2 import math import random import numpy as np import carla import pygame import threading import datetime...
backgroundserial.py
from __future__ import print_function import threading try: # Python 2 import Queue except: # Python 3 import queue as Queue import sys import time from . import BrewPiUtil from . import expandLogMessage from serial import SerialException class BackGroundSerial(): def __init__(self, serial_port)...
interpreterconfigruation.py
# -*- coding: utf-8 -*- from noval import NewId,_,GetApp import tkinter as tk from tkinter import ttk from tkinter import messagebox,filedialog import noval.python.interpreter.interpreter as pythoninterpreter import intellisence import noval.util.apputils as sysutils import os import noval.python.interpreter.p...
SubprocessGenerator.py
import multiprocessing import queue as Queue import threading import time class SubprocessGenerator(object): @staticmethod def launch_thread(generator): generator._start() @staticmethod def start_in_parallel( generator_list ): """ Start list of generators in para...
test_parser.py
import socket import threading from time import sleep import pytest import iofree from iofree import schema from iofree.contrib.common import Addr @iofree.parser def example(): parser = yield from iofree.get_parser() repr(parser) yield from Addr while True: n = yield from schema.uint8 ...
rmcpp.py
# # Copyright (c) 2020, Hyve Design Solutions 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: # # 1. Redistributions of source code must retain the above copyright # notice, th...
camera_pi.py
import time import io import threading import picamera class Camera(object): thread = None # background thread that reads frames from camera frame = None # current frame is stored here by background thread last_access = 0 # time of last client access to the camera def initialize(self): if ...
test_sys_jy.py
from __future__ import with_statement import os import re import sys import tempfile import unittest from test import test_support class SysTest(unittest.TestCase): def test_platform(self): self.assertEquals(sys.platform[:4], "java", "sys.platform is not java") def test_exit...
test_pickle.py
import sys import types import unittest import gc import inspect import copy import contextlib import threading import stackless from stackless import schedule, tasklet from support import test_main # @UnusedImport from support import StacklessTestCase, StacklessPickleTestCase, get_reduce_frame # because test runn...
masterslave.py
# Software License Agreement (BSD License) # # Copyright (c) 2008, Willow Garage, 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: # # * Redistributions of source code must retain the above...
openolt_device.py
# # Copyright 2018 the original author or 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 agre...
mongo_communicator.py
from datetime import datetime, timedelta import time import threading from multiprocessing import Process import logging from pymongo import MongoClient, ReturnDocument logger = logging.getLogger(__name__) STARTTIME_KEY = 'startTime' ENDTIME_KEY = 'endTime' REFRESH_KEY = 'last_refreshed' TIME_WORKED_KEY = 'totalTime...
misc.py
from fnmatch import fnmatch import multiprocessing import subprocess from time import sleep import itertools __copyright__ = "Copyright 2016-2018, Netflix, Inc." __license__ = "Apache, Version 2.0" import sys import os import re from vmaf.tools.scanf import sscanf, IncompleteCaptureError, FormatError def get_stdout...
build_imagenet_data.py
# 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 applicable law or a...
GUI_human.py
from tkinter import * import tkinter as tk import tkinter.messagebox from Record_and_GameTree import StepRecordChessBoard import threading from tcp_connect import TCPConnect import time # 用正则表达式判断字符串是否是合法的IP地址 def isIP(str): p = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$') ...
night_feature.py
""" @author: Sze "Ron" Chau @e-mail: chaus3@wit.edu @source: https://github.com/wodiesan/sweet-skoomabot @desc Night sensor-->RPi for Senior Design 1 """ import logging import os import RPi.GPIO as GPIO import serial import subprocess import sys import time import traceback # GPIO pins. Uses the BC...
_v5_proc_controld.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # COPYRIGHT (C) 2014-2020 Mitsuo KONDOU. # This software is released under the MIT License. # https://github.com/konsan1101 # Thank you for keeping the rules. import sys import os import time import datetime import codecs import glob import queue impo...
CanvasItem.py
""" CanvasItem module contains classes related to canvas items. """ # standard libraries import collections import contextlib import copy import enum import functools import logging import operator import sys import threading import time import typing import warnings import weakref # third party libraries # None ...
train.py
"""Training code for the detector model""" import argparse import os import subprocess import sys from itertools import count from multiprocessing import Process import torch import torch.distributed as dist from torch import nn from torch.nn.parallel import DistributedDataParallel from torch.optim import Adam from t...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
jd_OpenCard.py
#!/bin/env python3 # -*- coding: utf-8 -* ''' 项目名称: JD_OpenCard Author: Curtin 功能:JD入会开卡领取京豆 CreateDate: 2021/5/4 下午1:47 UpdateTime: 2021/6/19 ''' version = 'v1.2.2' readmes = """ # JD入会领豆小程序 ![JD入会领豆小程序](https://raw.githubusercontent.com/curtinlv/JD-Script/main/OpenCrad/resultCount.png) ## 使用方法 #### [手机用户(参考) https:/...
firmware_updater.py
import json import sys import threading as th import time from base64 import b64encode, b64decode from io import open from os import path from importlib import import_module as im import serial from modi.module.module import Module from modi.util.msgutil import unpack_data, decode_message from modi.util.conn_util imp...
langserver.py
"""Langserver support for autocompletions.""" # TODO: CompletionProvider # TODO: error reporting in gui somehow from __future__ import annotations import dataclasses import errno import itertools import logging import os import pprint import queue import re import select import signal import socket import subprocess i...
conv_net_sentence.py
""" Sample code for Convolutional Neural Networks for Sentence Classification http://arxiv.org/pdf/1408.5882v2.pdf Much of the code is modified from - deeplearning.net (for ConvNet classes) - https://github.com/mdenil/dropout (for dropout) - https://groups.google.com/forum/#!topic/pylearn-dev/3QbKtCumAW4 (for Adadelta...
device_manager.py
""" This module is adapted from https://github.com/Mause/rpc The task process can only get access to a wrapper over the real device object. The wrapper will redirect all the method calls to the real device object via RabbitMQ. The real device object is in DeviceManager class, which will handle all the request to run c...
gsmHat.py
#!/usr/bin/python3 # Filename: gsmHat.py import logging import serial import threading import time import math import re from datetime import datetime import RPi.GPIO as GPIO class SMS: def __init__(self): self.Message = '' self.Sender = '' self.Receiver = '' self.Da...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING 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 import...
batchupdate.py
#! /user/bin/python3 import os import threading def isContainGit(path): if not os.path.isdir(path): return subDir=os.listdir(path) for line in subDir: if line == ".git" and os.path.isdir(path+"/"+line): return True def update(dir): print("start pull "+dir) os.system("g...
webserver2.py
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import cgi import os import urllib2 import hashlib import collections import threading class webServerHandler(BaseHTTPRequestHandler): def compare(self,x,y) : return collections.Counter(x) == collections.Counter(y) def validate_cach...
put.py
# Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 from __future__ import division from future.utils import listitems, listvalues from builtins import str from builtins import object import argparse import arvados import arvados.collection import base64 import ciso8601 im...
multiprocess.py
#!/usr/bin/env python # -*- coding:utf-8 -*- ''' 一次进程(process)至少有一个线程(thread);线程是最小的执行单元 多进程、多线程需要着重处理数据同步和共享问题。 ''' # multiprocessing 多进程 # fork() in unix os import os import time import random import subprocess from multiprocessing import Process, Pool, Queue if hasattr(os, 'fork'): print('unix fork()>>>>>>>>...
multithread.py
""" Created by Colleen Kimball October, 2014 This program creates a socket connection and uses threading to receive all of the documents included in the HTML page. """ import socket import sys import threading def multiThread(serverSocket, connectionSocket, Host, Port): try: message =connectionSocket.re...
p7x4m5.py
## p7.py - parallel processing microframework ## (c) 2017 by mobarski (at) gmail (dot) com ## licence: MIT ## version: ex4 (simple fan-in of subprocess outputs) ## mod2 (cmd line options) ## mod3 (2.6 compatibility) ## mod4 (no fan-in) ## mod5 (output pipe command for partitions) from _...
local_run_state.py
from collections import namedtuple import logging import os import threading import time import traceback import docker import codalab.worker.docker_utils as docker_utils from codalab.lib.formatting import size_str, duration_str from codalab.worker.file_util import remove_path, get_path_size from codalab.worker.bundl...
openCV_saveVideoFramesAsImages_MultiProcessing.py
#! /usr/bin/env python ############################################################################### # openCV_videoStream.py # # This script finds all of the .mp4 # # NOTE: Any plotting is set up for output, not viewing on screen. # So, it will likely be ugly on screen. The saved PDFs should look # bette...