repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
Jayich-Lab/jax
util/devices.py
__all__ = ["Devices"] class Devices: """Sinara device manager. It gets lists of device names from device_db.py. It saves the devices requested by an experiment in lists. These lists can be used to reset used devices at the end of the experiment. Device types that are saved include urukuls, ad991...
Jayich-Lab/jax
base/environments/sinara_environment.py
<filename>base/environments/sinara_environment.py<gh_stars>1-10 import numpy as _np from sipyco import pyon from artiq.experiment import * from jax import JaxEnvironment from jax.util.devices import Devices class SinaraEnvironment(JaxEnvironment): """Environment for Jayich lab experiments that use sinara hardware...
Jayich-Lab/jax
util/tree_dict.py
__all__ = ["TreeDict"] class TreeDict: """Converts a nested dict to an object. Items in the dict are set to object attributes. ARTIQ python does not support dict type. Inherit this class to convert the dict to an object. self.value_parser() can be inherited to parse non-dict values. Args: ...
Jayich-Lab/jax
base/experiments/scan.py
<gh_stars>1-10 from artiq.experiment import * from jax import JaxExperiment __all__ = ["Scan"] class Scan(JaxExperiment): """Base class for all scan experiments. self.scanned_values is the list of values that are scanned. It must be defined in self.prepare() or in self.host_startup(). If CHECK_STO...
Jayich-Lab/jax
base/applets/real_time_plot_applet.py
import asyncio import numpy as _np import pyqtgraph as _pg from PyQt5 import QtCore, QtGui, QtWidgets from jax import JaxApplet from jax.util.ui.fast_plot_trace import FastPlotTrace __all__ = ["RealTimePlotApplet"] class RealTimePlotApplet(QtWidgets.QWidget, JaxApplet): """Base applet for making a real-time upd...
Jayich-Lab/jax
util/parameter_group.py
<reponame>Jayich-Lab/jax<gh_stars>1-10 from jax.util.tree_dict import TreeDict __all__ = ["ParameterGroup"] class ParameterGroup(TreeDict): """Holds parameters for an experiment in an ARTIQ python compatible class. Args: parameters_dict: A nested dict representing the parameters. Example: ...
Jayich-Lab/jax
tools/applets/dds.py
<reponame>Jayich-Lab/jax import time from sipyco import pyon from PyQt5 import QtGui, QtWidgets, QtCore from artiq.applets.simple import SimpleApplet from jax import JaxApplet from jax.tools.applets.dds_channel import DDSChannel, DDSParameters from jax.util.ui.custom_list_widget import CustomListWidget class DDS(QtWi...
spasche/aiohue
aiohue/sensors.py
from datetime import datetime from .api import APIItems TYPE_DAYLIGHT = "Daylight" TYPE_CLIP_GENERICFLAG = "CLIPGenericFlag" TYPE_CLIP_GENERICSTATUS = "CLIPGenericStatus" TYPE_CLIP_HUMIDITY = "CLIPHumidity" TYPE_CLIP_LIGHTLEVEL = "CLIPLightLevel" TYPE_CLIP_OPENCLOSE = "CLIPOpenClose" TYPE_CLIP_PRESENCE = "CLIPPresenc...
spasche/aiohue
aiohue/bridge.py
<reponame>spasche/aiohue<filename>aiohue/bridge.py from __future__ import annotations import asyncio from contextlib import asynccontextmanager import logging import aiohttp from aiohttp import client_exceptions from .clip import Clip from .config import Config from .errors import raise_error from .groups import Gro...
spasche/aiohue
aiohue/__init__.py
from .bridge import Bridge # noqa from .errors import * # noqa
spasche/aiohue
aiohue/clip.py
<reponame>spasche/aiohue import json import logging class Clip: """Represent Hue clip.""" def __init__(self, request_2): self._request_2 = request_2 async def stream_events(self, last_event_id=None): """Async iterate over the incoming events. https://nchan.io/#eventsource ...
spasche/aiohue
aiohue/lights.py
from collections import namedtuple from .api import APIItems # Represents a CIE 1931 XY coordinate pair. XYPoint = namedtuple("XYPoint", ["x", "y"]) # Represents the Gamut of a light. GamutType = namedtuple("GamutType", ["red", "green", "blue"]) class Lights(APIItems): """Represents Hue Lights. https://d...
rishabhiitbhu/deep-learning-from-scratch
utils/lr_utils.py
import _pickle as cPickle import gzip import numpy as np from matplotlib import pyplot as plt def get_relevant_data(data): X, Y = [], [] for idx, num in enumerate(data[1]): if num==0 or num==1: X.append(data[0][idx]) Y.append(num) X = np.asarray(X) Y = np.asarray(Y) ...
rishabhiitbhu/deep-learning-from-scratch
utils/sc_utils.py
import _pickle as cPickle import gzip import numpy as np from matplotlib import pyplot as plt def load_data(): ''' MNIST dataset contains 28*28 pixel images of 0-9 digits Loads the .pkl.gz file, returns train and validation set for 0 and 1 images only. ''' # Download dataset from https://github.com...
BestSonny/open-vot-1
lib/trackers/kcf.py
from __future__ import absolute_import, division import numpy as np import cv2 from . import Tracker from ..utils import dict2tuple from ..utils.complex import real, fft2, ifft2, complex_add, complex_mul, complex_div, fftshift from ..descriptors.fhog import fast_hog class TrackerKCF(Tracker): def __init__(self...
BestSonny/open-vot-1
lib/utils/complex.py
from __future__ import absolute_import import cv2 import numpy as np import torch import numbers import torch def real(img): return img[..., 0] def imag(img): return img[..., 1] def conj(img): img = img.copy() img[..., 1] = -img[..., 1] return img def fft2(img): img = np.float32(img) ...
BestSonny/open-vot-1
tests/models/test_alexnet.py
from __future__ import absolute_import, print_function import unittest import torch import random import time from lib.models import AlexNetV1, AlexNetV2 class TestAlexNet(unittest.TestCase): def setUp(self): self.x = torch.randn((2, 3, 224, 224)) def tearDown(self): pass def test_ale...
BestSonny/open-vot-1
lib/datasets/pairwise.py
from __future__ import absolute_import import numpy as np from torch.utils.data import Dataset from PIL import Image class Pairwise(Dataset): def __init__(self, base_dataset, transform=None, pairs_per_video=25, frame_range=100, causal=False, return_index=False, rand_choice=True...
BestSonny/open-vot-1
tests/trackers/test_mosse.py
from __future__ import absolute_import, print_function import unittest import random from lib.trackers import TrackerMOSSE from lib.datasets import OTB class TestTrackerMOSSE(unittest.TestCase): def setUp(self): self.otb_dir = 'data/OTB' def tearDown(self): pass def test_mosse(self): ...
BestSonny/open-vot-1
lib/trackers/dcf.py
from __future__ import absolute_import, division import numpy as np import cv2 from . import Tracker from ..utils import dict2tuple from ..utils.complex import real, conj, fft2, ifft2, complex_add, complex_mul, complex_div from ..descriptors.fhog import fast_hog class TrackerDCF(Tracker): def __init__(self, **...
BestSonny/open-vot-1
tests/trackers/test_goturn.py
from __future__ import absolute_import, print_function import unittest import random from torch.utils.data import DataLoader from lib.trackers import TrackerGOTURN from lib.datasets import VOT, Pairwise from lib.transforms import TransformGOTURN class TestTrackerGOTURN(unittest.TestCase): def setUp(self): ...
BestSonny/open-vot-1
tests/utils/test_warp.py
<filename>tests/utils/test_warp.py from __future__ import absolute_import, print_function, division import unittest import random import cv2 import torch import numpy as np from PIL import Image from lib.utils.warp import pad_pil, crop_pil, pad_array, crop_array, crop_tensor, resize_tensor from lib.utils.viz import s...
BestSonny/open-vot-1
lib/datasets/__init__.py
<reponame>BestSonny/open-vot-1<filename>lib/datasets/__init__.py from __future__ import absolute_import from .vot import VOT from .otb import OTB from .imagenet import ImageNetVID, ImageNetObject from .pairwise import Pairwise
BestSonny/open-vot-1
lib/datasets/vot.py
<filename>lib/datasets/vot.py from __future__ import absolute_import, print_function, division import os import glob import numpy as np import six from ..utils.ioutil import download, extract class VOT(object): def __init__(self, root_dir, return_rect=False, download=False, version=2017): ...
BestSonny/open-vot-1
lib/trackers/csk.py
<reponame>BestSonny/open-vot-1 from __future__ import absolute_import, division import numpy as np import cv2 from . import Tracker from ..utils import dict2tuple from ..utils.complex import real, fft2, ifft2, complex_add, complex_mul, complex_div, fftshift class TrackerCSK(Tracker): def __init__(self, **kargs...
BestSonny/open-vot-1
lib/transforms/transform_siamfc.py
from __future__ import absolute_import, division import numpy as np import torchvision.transforms.functional as F import torch from ..utils import dict2tuple from ..utils.ioutil import load_siamfc_stats from ..utils.warp import crop_pil class TransformSiamFC(object): def __init__(self, stats_path=None, **kargs...
BestSonny/open-vot-1
lib/trackers/dsst.py
from __future__ import absolute_import, division import numpy as np import cv2 from . import Tracker from ..utils import dict2tuple from ..utils.complex import real, conj, fft2, ifft2, fft1, ifft1, complex_add, complex_mul, complex_div from ..descriptors.fhog import fast_hog class TrackerDSST(Tracker): def __i...
BestSonny/open-vot-1
examples/run_tracking.py
<reponame>BestSonny/open-vot-1 from __future__ import absolute_import import argparse from lib.trackers import * from lib.experiments import * tracker_factory = { 'mosse': TrackerMOSSE, 'csk': TrackerCSK, 'kcf': TrackerKCF, 'dcf': TrackerDCF, 'dsst': TrackerDSST, 'goturn': TrackerGOTURN, ...
BestSonny/open-vot-1
tests/models/test_goturn.py
from __future__ import absolute_import import unittest import torch import time from lib.models import GOTURN class TestGOTURN(unittest.TestCase): def setUp(self): self.z = torch.randn((2, 3, 227, 227)) self.x = torch.randn((2, 3, 227, 227)) self.net = GOTURN() def tearDown(self): ...
BestSonny/open-vot-1
lib/transforms/transform_goturn.py
from __future__ import absolute_import import torchvision.transforms.functional as F import torch import numpy as np import math from ..utils import dict2tuple from ..utils.warp import crop_pil class TransformGOTURN(object): def __init__(self, **kargs): self.parse_args(**kargs) def parse_args(self...
BestSonny/open-vot-1
lib/experiments/__init__.py
from __future__ import absolute_import from .otb import ExperimentOTB
BestSonny/open-vot-1
lib/utils/__init__.py
<gh_stars>10-100 from __future__ import absolute_import import torch.nn as nn import math from collections import namedtuple def initialize_weights(model): for m in model.modules(): if isinstance(m, nn.Conv2d): n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels m.weight.data...
BestSonny/open-vot-1
lib/trainers/__init__.py
from __future__ import absolute_import from .trainer_siamfc import TrainerSiamFC from .trainer_goturn import TrainerGOTURN from .trainer_dcfnet import TrainerDCFNet
BestSonny/open-vot-1
lib/trackers/siamfc.py
from __future__ import absolute_import, division import torch import os import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np import cv2 from torch.optim.lr_scheduler import StepLR from . import Tracker from ..utils import dict2tuple from ..models import SiameseNet, Alex...
BestSonny/open-vot-1
lib/models/submodules.py
<gh_stars>10-100 from __future__ import absolute_import, division import torch.nn as nn import torch import torch.nn.functional as F class XCorr(nn.Module): def __init__(self): super(XCorr, self).__init__() def forward(self, z, x): out = [] for i in range(z.size(0)): out...
BestSonny/open-vot-1
tests/utils/test_logger.py
<reponame>BestSonny/open-vot-1 from __future__ import absolute_import import unittest import numpy as np import torch.nn as nn from lib.utils.logger import Logger class TestLogger(unittest.TestCase): def setUp(self): self.logger = Logger(log_dir='logs/unittest') self.model = nn.Conv2d(3, 32, 3,...
BestSonny/open-vot-1
tests/models/test_siamese.py
<reponame>BestSonny/open-vot-1<filename>tests/models/test_siamese.py from __future__ import absolute_import, print_function import unittest import torch import random import time from lib.models import SiameseNet, AlexNetV2 class TestSiameseNet(unittest.TestCase): def setUp(self): self.z = torch.randn(...
BestSonny/open-vot-1
lib/transforms/__init__.py
from __future__ import absolute_import from .transform_siamfc import TransformSiamFC from .transform_goturn import TransformGOTURN from .transform_dcfnet import TransformDCFNet
BestSonny/open-vot-1
lib/models/caffenet.py
from __future__ import absolute_import import torch.nn as nn from ..utils import initialize_weights class CaffeNet(nn.Module): def __init__(self): super(CaffeNet, self).__init__() self.conv1 = nn.Sequential( nn.Conv2d(3, 96, 11, 4), nn.ReLU(inplace=True), nn....
BestSonny/open-vot-1
tests/trackers/test_kcf.py
from __future__ import absolute_import, print_function import unittest import random from lib.trackers import TrackerKCF, TrackerDCF from lib.datasets import OTB class TestTrackerKCF(unittest.TestCase): def setUp(self): self.otb_dir = 'data/OTB' def tearDown(self): pass def test_kcf(s...
BestSonny/open-vot-1
lib/datasets/imagenet.py
<filename>lib/datasets/imagenet.py<gh_stars>10-100 from __future__ import absolute_import, division import os import glob import xml.etree.ElementTree as ET import numpy as np import six import random from torch.utils.data import Dataset from PIL import Image class ImageNetVID(object): def __init__(self, root_d...
BestSonny/open-vot-1
examples/quick_example.py
<reponame>BestSonny/open-vot-1 from __future__ import absolute_import from lib.trackers import TrackerCSK from lib.experiments import ExperimentOTB otb_dir = 'data/OTB' experiment = ExperimentOTB(otb_dir, version=2013) tracker = TrackerCSK() experiment.run(tracker, visualize=True) experiment.report([tracker.name])...
BestSonny/open-vot-1
lib/metrics/metrics.py
from __future__ import absolute_import, division import numpy as np def center_error(rects1, rects2): r"""Center error. """ centers1 = rects1[:, :2] + (rects1[:, 2:] - 1) / 2 centers2 = rects2[:, :2] + (rects2[:, 2:] - 1) / 2 ces = np.sqrt(np.sum(np.power(centers1 - centers2, 2), axis=1)) re...
BestSonny/open-vot-1
tests/datasets/test_pairwise.py
<reponame>BestSonny/open-vot-1<gh_stars>10-100 from __future__ import absolute_import, print_function import unittest import random from lib.datasets import Pairwise, OTB from lib.utils.viz import show_frame class TestPairwise(unittest.TestCase): def setUp(self): self.otb_dir = 'data/OTB' self....
BestSonny/open-vot-1
lib/trackers/goturn.py
from __future__ import absolute_import, division import torch import os import torch.nn as nn import torch.optim as optim from torch.optim.lr_scheduler import StepLR from . import Tracker from ..utils import dict2tuple from ..models import GOTURN from ..utils.ioutil import load_goturn_from_caffe from ..utils.warp imp...
BestSonny/open-vot-1
tests/transforms/test_transform_siamfc.py
from __future__ import absolute_import, division import unittest import random import torchvision.transforms.functional as F import numpy as np from lib.transforms import TransformSiamFC from lib.datasets import VOT, Pairwise from lib.utils.viz import show_frame class TestTransformSiamFC(unittest.TestCase): de...
BestSonny/open-vot-1
tests/trainers/test_trainer_goturn.py
from __future__ import absolute_import import unittest import random from lib.trainers import TrainerGOTURN class TestTrainerGOTURN(unittest.TestCase): def setUp(self): self.cfg_file = 'config/goturn.json' self.vot_dir = 'data/vot2017' self.vid_dir = 'data/ILSVRC' self.det_dir =...
BestSonny/open-vot-1
tests/datasets/test_imagenet.py
from __future__ import absolute_import import unittest import random import os from PIL import Image from lib.datasets import ImageNetVID, ImageNetObject from lib.utils.viz import show_frame class TestImageNet(unittest.TestCase): def setUp(self): self.vid_dir = 'data/ILSVRC' self.obj_dir = 'dat...
BestSonny/open-vot-1
lib/transforms/transform_dcfnet.py
from __future__ import absolute_import, division import numpy as np import torchvision.transforms.functional as F import torch from ..utils import dict2tuple from ..utils.ioutil import load_siamfc_stats from ..utils.warp import crop_pil from lib.utils.viz import show_frame class TransformDCFNet(object): def __i...
BestSonny/open-vot-1
lib/utils/logger.py
from __future__ import absolute_import, print_function import os import platform import json import numpy as np import torch from tensorboardX import SummaryWriter from datetime import datetime class Logger(SummaryWriter): def __init__(self, log_dir=None, comment='', verbose=True): super(Logger, self)._...
BestSonny/open-vot-1
lib/models/dcfnet.py
<filename>lib/models/dcfnet.py from __future__ import absolute_import import torch import torch.nn as nn from ..utils.complex import * class DCFNetFeature(nn.Module): def __init__(self): super(DCFNetFeature, self).__init__() self.feature = nn.Sequential( nn.Conv2d(3, 32, 3), ...
BestSonny/open-vot-1
lib/trackers/dcfnet.py
from __future__ import absolute_import, division import torch import os import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np import cv2 from torch.optim.lr_scheduler import LambdaLR from . import Tracker from ..utils import dict2tuple from ..models import DCFNet, DCFNet...
BestSonny/open-vot-1
lib/models/goturn.py
from __future__ import absolute_import import torch.nn as nn import torch from .caffenet import CaffeNet from ..utils import initialize_weights class GOTURN(nn.Module): def __init__(self): super(GOTURN, self).__init__() self.branch_z = CaffeNet() self.branch_x = CaffeNet() self...
BestSonny/open-vot-1
lib/models/siamese.py
from __future__ import absolute_import import torch.nn as nn from .submodules import Adjust2d, XCorr class SiameseNet(nn.Module): def __init__(self, branch, norm='bn'): super(SiameseNet, self).__init__() self.branch = branch self.norm = Adjust2d(norm=norm) self.xcorr = XCorr() ...
BestSonny/open-vot-1
lib/utils/ioutil.py
from __future__ import absolute_import, print_function, division import time import sys import os import zipfile import torch import scipy.io import h5py import numpy as np from urllib.request import urlretrieve from collections import namedtuple from ..models import AlexNetV1, AlexNetV2 def download(url, filename)...
BestSonny/open-vot-1
lib/utils/warp.py
from __future__ import absolute_import, division import numbers import numpy as np import cv2 import torch import torch.nn.functional as F from PIL import Image, ImageStat, ImageOps def pad_pil(image, npad, padding='avg'): if npad == 0: return image if padding == 'avg': avg_chan = ImageStat....
BestSonny/open-vot-1
tests/models/test_caffenet.py
from __future__ import absolute_import, print_function import unittest import torch import random import time from lib.models import CaffeNet class TestCaffeNet(unittest.TestCase): def setUp(self): self.x = torch.randn((2, 3, 256, 256)) self.net = CaffeNet() def tearDown(self): pas...
BestSonny/open-vot-1
tests/transforms/test_transform_goturn.py
<reponame>BestSonny/open-vot-1<gh_stars>10-100 from __future__ import absolute_import, division import unittest import random import torch import torchvision.transforms.functional as F import numpy as np from lib.transforms import TransformGOTURN from lib.datasets import VOT, Pairwise from lib.utils.viz import show_f...
BestSonny/open-vot-1
tests/datasets/test_otb.py
from __future__ import absolute_import import unittest import random from PIL import Image from lib.datasets import OTB from lib.utils.viz import show_frame class TestOTB(unittest.TestCase): def setUp(self): self.otb_dir = 'data/OTB' self.visualize = True def tearDown(self): pass ...
BestSonny/open-vot-1
lib/metrics/__init__.py
from __future__ import absolute_import from .metrics import iou, center_error
BestSonny/open-vot-1
lib/models/__init__.py
from __future__ import absolute_import from .alexnet import AlexNetV1, AlexNetV2 from .siamese import SiameseNet from .caffenet import CaffeNet from .goturn import GOTURN from .dcfnet import DCFNet, DCFNetOnline
BestSonny/open-vot-1
tests/trackers/test_siamfc.py
from __future__ import absolute_import, print_function import unittest import random from torch.utils.data import DataLoader from lib.trackers import TrackerSiamFC from lib.datasets import VOT, Pairwise from lib.transforms import TransformSiamFC class TestTrackerSiamFC(unittest.TestCase): def setUp(self): ...
BestSonny/open-vot-1
lib/trackers/__init__.py
from __future__ import absolute_import, division import cv2 import numpy as np import time from ..utils.viz import show_frame class Tracker(object): def __init__(self, name): self.name = name def init(self, image, init_rect): raise NotImplementedError() def update(self, image): ...
matthewfeickert/pyhf-funcX-CHEP-2021-proposal
build_table.py
<gh_stars>1-10 from pathlib import Path import numpy as np import pandas as pd def convert_to_seconds(time_str): minutes, seconds = time_str.split("m") total = 60 * int(minutes) + int(seconds.split(".")[0]) return total def main(): mean_wall_time = [] best_wall_time = [] file_list = ["1Lbb"...
matthewfeickert/pyhf-funcX-CHEP-2021-proposal
figures/timing_barplot.py
<reponame>matthewfeickert/pyhf-funcX-CHEP-2021-proposal import numpy as np from matplotlib.figure import Figure import matplotlib from matplotlib import rcParams from pathlib import Path rcParams.update({"font.size": 14}) def plot_times( analyses, mean_times, mean_uncertainties, single_node_times, ...
ursinus-cs371-s2022/Week5_EditBacktracing
stack.py
class Node: def __init__(self, value): self.value = value self.next = None # Python's version of "null" is "None" class LinkedList: def __init__(self): self.head = None self.N = 0 def add_first(self, value): """ Parameters ---------- va...
ursinus-cs371-s2022/Week5_EditBacktracing
edit.py
<reponame>ursinus-cs371-s2022/Week5_EditBacktracing import numpy as np LEFT = 0 UP = 1 DIAG = 2 def edit(s1, s2): """ An iterative, dynamic programming version of the string edit distance Parameters ---------- s1: string of length M The first string to match s2: string of length N...
Yuehan-Wang/carplet-pygame
event.py
<gh_stars>0 from typing import List from card import Card class Event: def __init__(self, title: str, desc: str, cards: List[Card]) -> None: self._title = title self._desc = desc self._cards = cards @property def title(self) -> str: return self._title @property de...
Yuehan-Wang/carplet-pygame
engine.py
<gh_stars>0 import pygame import time import sys from context import Context class Engine: # pygame init WIN_WIDTH, WIN_HEIGHT = 900, 600 context = None w = None clock = None logo = None # fonts screen_font = None i_name_font = None i_number_font = None e_title_font = Non...
Yuehan-Wang/carplet-pygame
card.py
from typing import List class Card: def __init__(self, title: str, desc: str, effects: List[int], cons: str) -> None: if title == "": raise ValueError("Card title cannot be empty string") if desc == "": raise ValueError("Card description cannot be empty string") if ...
Yuehan-Wang/carplet-pygame
context.py
<filename>context.py import json import os from typing import List from index import Index from event import Event from card import Card class Context: def __init__(self, file: str) -> None: if not os.path.isfile(file): raise FileNotFoundError("Expected a file but found none") if os....
Yuehan-Wang/carplet-pygame
main.py
from engine import Engine from context import Context if __name__ == "__main__": file = "plot.json" Engine.register_context(Context(file)) Engine.init() Engine.play()
Yuehan-Wang/carplet-pygame
index.py
import os.path class Index: def __init__(self, name: str, start: int, icon: str, end_str: str) -> None: if name == "": raise ValueError("Index name cannot be empty string") self._name = name if start <= 0: raise ValueError("Index start value cannot be negative or z...
pkauppin/finer-utilities
lemmatize-matches.py
<reponame>pkauppin/finer-utilities #! /usr/bin/env python3 # List all matched entities in a given category in their base forms and output them in order of appearance. # The lemmatization requires that lemma forms and morphological tags be found in the input file. from sys import stdin, stdout, stderr, argv import re ...
weeb-poly/syncplay-proxy
syncplay/ep_proxy.py
<reponame>weeb-poly/syncplay-proxy<filename>syncplay/ep_proxy.py import os import logging from twisted.internet.endpoints import TCP4ServerEndpoint, SSL4ServerEndpoint from syncplay.server import SyncplayProxyWSFactory from syncplay.server import SyncplayProxyTCPFactory from twisted.internet import reactor # from a...
weeb-poly/syncplay-proxy
syncplay/__main__.py
#!/usr/bin/env python3 import logging from . import ep_proxy def main(): logging.basicConfig(level=logging.INFO) ep_proxy.main() if __name__ == '__main__': main()
weeb-poly/syncplay-proxy
syncplay/__init__.py
<reponame>weeb-poly/syncplay-proxy<gh_stars>1-10 projectURL = 'https://github.com/weeb-poly/syncplay-proxy'
weeb-poly/syncplay-proxy
syncplay/protocols.py
import json import logging from twisted.protocols.basic import LineReceiver from twisted.internet.protocol import ClientFactory from twisted.internet import reactor from autobahn.twisted.websocket import WebSocketServerProtocol class JSONCommandProtocol(LineReceiver): def lineReceived(self, line: bytes) -> None...
weeb-poly/syncplay-proxy
syncplay/server.py
<gh_stars>1-10 import os import logging import pem from twisted.internet.protocol import ServerFactory from OpenSSL import SSL from twisted.internet import ssl from syncplay import constants from syncplay.protocols import SyncplayTCPServerProtocol, SyncplayWSServerProtocol from autobahn.twisted.websocket import W...
yongzx/Truth-table
logic.py
from collections import OrderedDict def split_into_list(s): """ Input: String Output: A list of variables and the connectives (in English) 1. Remove the punctuations from the sentence such as "if A, then B", but not parentheses. 2. Split the sentence into a list of words composing the sentence. 3. Remove the ...
CallumAlexander/Tic-Tac-Toe-Artificial-Intelligence
main.py
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Mon May 13 16:56:50 2019 @author: Callum """ import numpy as np from random import randint as rnd from random import uniform aiValue = np.ones(shape=(3,3), dtype=float) scoreBoard = np.zeros(shape=(3,3), dtype=int) board = np.full((3,3), ' ') ...
wanderleyjrs/Python-Baseball
stats/data.py
import os import glob import pandas as pd #3 - Python File Management #game_files = glob.glob(os.path.join(os.getcwd(), 'games','*.EVE')) os.getcwd() -> return the current working directory of a process. game_files = glob.glob('/home/wanderley/Python-Baseball/games/*.EVE') #4 - Sorting File Names game_files.sort() #5...
Goooyi/svgd-tf2
svgd/kernels.py
import tensorflow as tf import tensorflow_probability as tfp @tf.function def euclideanPairwiseDistance(x): distance = tf.expand_dims(x, 1) - tf.expand_dims(tf.stop_gradient(x), 0) return tf.einsum('ijk,kji->ij', distance, tf.transpose(distance)) class RbfKernel: @tf.function def __call__(self, x): ...
Goooyi/svgd-tf2
svgd/__init__.py
from svgd.main import SVGD
Goooyi/svgd-tf2
svgd/main.py
import tensorflow as tf class SVGD: def __init__(self, kernel, targetDistribution, learningRate): self.kernel = kernel self.targetDistribution = targetDistribution self.optimizer = tf.keras.optimizers.Adam(learningRate) def update(self, x, nIterations): for _ in range(nIteratio...
Crupette/modit-micro
util/retrievesymbols.py
<gh_stars>1-10 """ Script originally created by klange (https://github.com/klange/toaruos/blob/master/util/generate_symbols.py") I am using it because GCC is fighting with me This may be replaced later or improved or modified I honestly don't know """ import sys ignored = ["kernel_symbols_start...
bindungszustandsamplitude/dysonutils
libraries/libInterpolate/scripts/util/update-sources.py
#! /usr/bin/env python from pyparsing import * import argparse import os import glob import re import shutil import pprint import fnmatch arg_parser = argparse.ArgumentParser(description="Replaces source files in a CMakeLitst.txt file.") arg_parser.add_argument("cmake_files", metavar="CMAKELISTS-FILE", nargs="*", de...
Dark-Bob/mro
paging_test.py
<reponame>Dark-Bob/mro<filename>paging_test.py # reminder to add tests for this and implement
Dark-Bob/mro
update_test.py
<gh_stars>1-10 import os import pytest import mro import mro.foreign_keys import connection as con @pytest.fixture(scope="module") def connection(request): connection = con.connect() request.addfinalizer(mro.disconnect) cursor = connection.cursor() con.drop_tables() cursor.execute("""create tab...
Dark-Bob/mro
mro/sqlite.py
<reponame>Dark-Bob/mro import mro.data_types as data_types def _load_sqllite_db(connection): cursor = connection.cursor() tables = {} # Get tables cursor.execute("select * from sqlite_master;") connection.commit() for table in cursor: # Get columns definition = table[4] ...
Dark-Bob/mro
view_test.py
<gh_stars>1-10 import os import pytest import mro import mro.foreign_keys import connection as con xfail = pytest.mark.xfail @pytest.fixture(scope="module") def connection(request): connection = con.connect() request.addfinalizer(mro.disconnect) cursor = connection.cursor() con.drop_tables() cur...
Dark-Bob/mro
mro/custom_types.py
import mro import datetime import csv import psycopg2.extensions, psycopg2.extras from operator import attrgetter def _get_custom_type_names(connection): cursor = connection.cursor() # Get custom types # 'lo' is a type that comes from the lo extension cursor.execute("""SELECT t.typname as type ...
Dark-Bob/mro
mro/__init__.py
<reponame>Dark-Bob/mro<filename>mro/__init__.py import mro.connection import mro.data_types import mro.table import mro.sqlite import mro.custom_types import mro.routine def disconnect(): mro.connection.disconnect() def load_database(connection_function, hooks=None): print("***********INITIALISING DATABASE...
Dark-Bob/mro
table_test.py
<gh_stars>1-10 import pytest import mro import connection as con from datetime import datetime, date from threading import Thread, Event class table1(mro.table.table): column1 = mro.data_types.integer('column1', 0, not_null=False, is_updateable=True, get_value_on_insert = False, is_primary_key = False) colu...
Dark-Bob/mro
mro_test.py
<filename>mro_test.py import os import pytest import psycopg2 import mro import connection as con @pytest.fixture(scope="module") def connection(request): connection = con.connect() request.addfinalizer(mro.disconnect) cursor = connection.cursor() con.drop_tables() cursor.execute("create table ...
Dark-Bob/mro
mro/table.py
from contextlib import contextmanager import logging import threading import time import psycopg2 from tenacity import before_sleep_log, retry, stop_after_attempt, wait_random_exponential import mro.connection as con import mro.data_types import mro.foreign_keys logger = logging.getLogger(__name__) # TODO replace...
Dark-Bob/mro
connection.py
<gh_stars>1-10  import os import psycopg2 import mro.helpers global get_connection if os.path.isfile('my_connection.py'): import my_connection get_connection = my_connection.get_connection else: get_connection = lambda: psycopg2.connect(database='circle_test', user='ubuntu', password="<PASSWORD>") def c...
Dark-Bob/mro
data_types_test.py
import pytest import mro import connection as con import psycopg2 from datetime import datetime, date, time import uuid xfail = pytest.mark.xfail class test_type(object): varchar = mro.data_types.varchar('varchar', 0, 15, not_null=False, is_updateable=True, get_value_on_insert=False, is_primary_key=False) ...
Dark-Bob/mro
mro/helpers.py
<reponame>Dark-Bob/mro<filename>mro/helpers.py def create_column_name_index_map(cursor): description = cursor.description return {column.name: index for column, index in zip(description, range(len(description)))}
Dark-Bob/mro
mro/foreign_keys.py
 import mro import json class foreign_key_data_type(object): def __init__(self, name, data_type, reference_class, reference_column_name): self.name = name + '_foreign_key' self.data_type = data_type self.reference_class = reference_class self.reference_column_name = reference_colu...