repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
player1537-forks/spack
var/spack/repos/builtin/packages/dpcpp/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os from spack import * class Dpcpp(CMakePackage): """Data Parallel C++ compiler: Intel's implementation of ...
player1537-forks/spack
var/spack/repos/builtin/packages/butter/package.py
<reponame>player1537-forks/spack # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Butter(Package): """butter: Bowtie UTilizing iTerative pl...
player1537-forks/spack
var/spack/repos/builtin/packages/xsdk/package.py
<reponame>player1537-forks/spack # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import sys from copy import deepcopy from spack import * def xsdk_depends_on_accl(acc...
player1537-forks/spack
var/spack/repos/builtin/packages/py-pmw-patched/package.py
<gh_stars>10-100 # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyPmwPatched(PythonPackage): """Schrodinger's Fork of Python megawidgets with essential patche...
player1537-forks/spack
var/spack/repos/builtin/packages/r-cli/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RCli(RPackage): """Helpers for Developing Command Line Interfaces. A suite of tools t...
player1537-forks/spack
var/spack/repos/builtin/packages/r-vipor/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RVipor(RPackage): """Plot Categorical Data Using Quasirandom Noise and Density Estimates. ...
player1537-forks/spack
var/spack/repos/builtin/packages/r-geonames/package.py
<gh_stars>10-100 # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RGeonames(RPackage): """Interface to the "Geonames" Spatial Query Web Ser...
player1537-forks/spack
var/spack/repos/builtin/packages/r-rgexf/package.py
<filename>var/spack/repos/builtin/packages/r-rgexf/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RRgexf(RPackage): """Build, ...
player1537-forks/spack
var/spack/repos/builtin/packages/mpilander/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Mpilander(CMakePackage): """There can only be one (MPI process)!""" homepage = "https...
player1537-forks/spack
var/spack/repos/builtin/packages/dysco/package.py
<filename>var/spack/repos/builtin/packages/dysco/package.py<gh_stars>1-10 # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Dysco(CMakePackage):...
player1537-forks/spack
var/spack/repos/builtin/packages/cppad/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Cppad(CMakePackage): """A Package for Differentiation of C++ Algorithms.""" homepage ...
player1537-forks/spack
var/spack/repos/builtin/packages/distcc/package.py
<reponame>player1537-forks/spack # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Distcc(AutotoolsPackage): """distcc is a program to distr...
player1537-forks/spack
var/spack/repos/builtin/packages/py-pyface/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyPyface(PythonPackage): """The pyface project contains a toolkit-independent GUI abstraction layer, which ...
player1537-forks/spack
var/spack/repos/builtin/packages/openipmi/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Openipmi(AutotoolsPackage): """The Open IPMI project aims to develop an open code base ...
player1537-forks/spack
var/spack/repos/builtin/packages/r-reticulate/package.py
<reponame>player1537-forks/spack # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RReticulate(RPackage): """Interface to 'Python'. Int...
player1537-forks/spack
var/spack/repos/builtin/packages/py-meldmd/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyMeldmd(PythonPackage, CudaPackage): """MELD is a tool for inferring the structure of ...
player1537-forks/spack
var/spack/repos/builtin/packages/hpcx-mpi/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os class HpcxMpi(Package): """The HPC-X MPI implementation from NVIDIA/Mellanox based on OpenMPI. This pa...
player1537-forks/spack
var/spack/repos/builtin/packages/ppopen-math-vis/package.py
<gh_stars>10-100 # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PpopenMathVis(MakefilePackage): """ ppOpen-MATH/VIS is a set of libr...
player1537-forks/spack
var/spack/repos/builtin/packages/batctl/package.py
<reponame>player1537-forks/spack<gh_stars>10-100 # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Batctl(MakefilePackage): """B.A.T.M.A.N. ...
player1537-forks/spack
var/spack/repos/builtin/packages/r-affyrnadegradation/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RAffyrnadegradation(RPackage): """Analyze and correct probe positional bias in microarray ...
player1537-forks/spack
lib/spack/spack/build_systems/perl.py
<gh_stars>10-100 # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import inspect import os from llnl.util.filesystem import filter_file from spack.directives import ext...
player1537-forks/spack
var/spack/repos/builtin/packages/libp11/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Libp11(AutotoolsPackage): """The PKCS#11 API is an abstract API to perform operations on ...
player1537-forks/spack
var/spack/repos/builtin/packages/py-pygpu/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyPygpu(PythonPackage): """Python packge for the libgpuarray C library.""" homepage =...
player1537-forks/spack
var/spack/repos/builtin/packages/mscgen/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Mscgen(AutotoolsPackage): """Mscgen is a small program that parses Message Sequence Chart...
player1537-forks/spack
var/spack/repos/builtin/packages/r-mco/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RMco(RPackage): """Multiple Criteria Optimization Algorithms and Related Functions. A...
player1537-forks/spack
var/spack/repos/builtin/packages/py-nvidia-ml-py/package.py
<gh_stars>10-100 # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyNvidiaMlPy(PythonPackage): """Python Bindings for the NVIDIA Management Library.""" hom...
player1537-forks/spack
var/spack/repos/builtin/packages/r3d/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class R3d(CMakePackage): """Fast, robust polyhedral intersections, analytic integration, and ...
player1537-forks/spack
var/spack/repos/builtin/packages/opencv/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class Opencv(CMakePackage, CudaPackage): """OpenCV (Open Source Computer Vision Library) is an open source computer ...
player1537-forks/spack
var/spack/repos/builtin/packages/py-lazyarray/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyLazyarray(PythonPackage): """a Python package that provides a lazily-evaluated numerical...
player1537-forks/spack
var/spack/repos/builtin/packages/r-matrix/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RMatrix(RPackage): """Sparse and Dense Matrix Classes and Methods. A rich hierarchy o...
player1537-forks/spack
var/spack/repos/builtin/packages/julia/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os from spack import * from spack.version import ver def get_best_target(microarch, compiler_name, compiler_vers...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/scheduler.py
<reponame>Brain-in-Vat/Aletheia """to be down """ from mesa.time import BaseScheduler class Scheduler(object): def __init__(self): self.agents = {} def setp(self): for agent in self.agents.values(): agent.step() def add(self, agent): # self.agents.add(agent) s...
Brain-in-Vat/Aletheia
aletheia/scenario_search/ga.py
<filename>aletheia/scenario_search/ga.py from operator import itemgetter from random import randint # from runlocal import evaluate as run_evaluate import random from aletheia.settings import BASE_DIR import json import os import shutil import math class Gene: def __init__(self, **data): self.__dict__.upd...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/predict_markets/fpmm.py
<reponame>Brain-in-Vat/Aletheia from . import PredictMarket import math from enum import Enum class TokenType(Enum): yes_token = 'yes_token' no_token = 'no_token' class FPMM(PredictMarket): def __init__(self, fee=0.02, constant=100) -> None: super().__init__() self.proposal_map = {} ...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/predict_markets/__init__.py
class PredictMarket(object): def __init__(self) -> None: super().__init__() self.proposals = [] def buy(self, agent): pass def sell(self, agent): pass def observe(self, agent): pass
Brain-in-Vat/Aletheia
setup.py
<reponame>Brain-in-Vat/Aletheia import pathlib from setuptools import setup HERE = pathlib.Path(__file__).parent README = (HERE / "README.md").read_text() setup(name='aletheia', version='0.1', description='A compute governance tools', author='<NAME>', long_description=README, long_description_content_typ...
Brain-in-Vat/Aletheia
aletheia/scenario_search/losspool.py
<gh_stars>0 import numpy as np from aletheia.scenario_search.loss import belief_loss, donate_loss, token_loss def futarchy_loss(expect, actual, origin, after, truth_index, false_index, alpha=0.05): return belief_loss(expect, actual) + alpha * token_loss(origin, after, truth_index, false_index) def qf_loss(exp...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/qf_futarchy/__init__.py
''' predict project in futarchy next round come out ''' from aletheia.mechanism_engine.predict_markets.lmsr import LMSRMarket from aletheia.mechanism_engine.qf import QuadraticFunding class QFFutarchy: def __init__(self, pass_ratio=0.8, projects=[0, 1]): self.projects = projects self.lmsr = LMSRMa...
Brain-in-Vat/Aletheia
aletheia/algorithm_analyze/futarchyqa.py
import dash import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc import plotly.express as px import pandas as pd from aletheia.settings import BASE_DIR import json import os import statistics import re app = dash.Dash(__name__, external_stylesheets=[dbc.themes....
Brain-in-Vat/Aletheia
aletheia/examples/simpleqf.py
<reponame>Brain-in-Vat/Aletheia from mesa import Model from aletheia.mechanism_engine.scheduler import RandomActivation from mesa.datacollection import DataCollector from mesa.space import Grid from aletheia.mechanism_engine.predict_markets.lmsr import LMSRMarket from aletheia.mechanism_engine.qf import QuadraticFundi...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/futarchy/__init__.py
<reponame>Brain-in-Vat/Aletheia from enum import Enum class BaseSystem(object): def __init__(self, states, governance): self.states = states self.governance = governance def update(self): pass class FutarchySystem(BaseSystem): """the origin futarchy system """ def __init...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/qf/__init__.py
<filename>aletheia/mechanism_engine/qf/__init__.py from aletheia.mechanism_engine.qf.clr import run_clr_calcs class QuadraticFunding(object): def __init__(self, threshold=25, total_pot=5000): self.grants = { } self.threshold = threshold self.total_pot = total_pot def ...
Brain-in-Vat/Aletheia
aletheia/resources/zlagent.py
''' This is the python code part of zero intelligence agent. pre require: owlready2 mesa ''' from mesa.agent import Agent from owlready2 import set_datatype_iri, World, sync_reasoner_pellet agent_base = 'zlagent.owl' set_datatype_iri(float, 'http://www.w3.org/2001/XMLSchema#float') class ZLAgent(Agent): ...
Brain-in-Vat/Aletheia
aletheia/examples/futarchyqf.py
<filename>aletheia/examples/futarchyqf.py<gh_stars>0 from aletheia.scenario_search.loss import belief_loss, token_loss from mesa import Model from aletheia.mechanism_engine.scheduler import RandomActivation from mesa.datacollection import DataCollector from mesa.space import Grid from aletheia.mechanism_engine.predict_...
Brain-in-Vat/Aletheia
aletheia/settings.py
<filename>aletheia/settings.py import os BASE_DIR = os.path.dirname(__file__) # DOWNLOAD_URL = 'https://github.com/Brain-in-Vat/Aletheia/blob/main/resources' # DOWNLOAD_URL = 'https://raw.githubusercontent.com/Brain-in-Vat/Aletheia/blob/main/resources' # DOWNLOAD_URL = 'https://raw.githubusercontent.com/Brain-in-Vat...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/futarchy/proposal.py
from enum import Enum import math class State(Enum): Init = 1 Pass = 2 Failed = 3 pass class Proposal(object): def __init__(self, _meta, _id, pos): self._meta = _meta self.state = 1 self._id = _id self.time = 0 self.passed = -1 self.pos = pos ...
Brain-in-Vat/Aletheia
aletheia/scenario_search/loss.py
<filename>aletheia/scenario_search/loss.py import numpy as np def belief_loss(expect, actual): expect = set(expect) actual = set(actual) inter_set = expect & actual or_set = expect | actual return float(len(inter_set)/len(or_set)) def donate_loss(expect, actual): dist = np.sqrt(np.sum(np...
Brain-in-Vat/Aletheia
aletheia/agents/ontoagent.py
from owlready2 import get_ontology, default_world, sync_reasoner_pellet, World, set_datatype_iri import os from aletheia.settings import BASE_DIR from mesa import Agent, Model import random agent_base = os.path.join(BASE_DIR, 'resource', 'zlagent.owl') set_datatype_iri(float, "http://www.w3.org/2001/XMLSchema#float") ...
Brain-in-Vat/Aletheia
aletheia/examples/simplefutarchy.py
from mesa import Model from aletheia.mechanism_engine.scheduler import RandomActivation from mesa.datacollection import DataCollector from mesa.space import Grid from aletheia.mechanism_engine.predict_markets.lmsr import LMSR from aletheia.mechanism_engine.predict_markets.fpmm import FPMM from aletheia.mechanism_engine...
Brain-in-Vat/Aletheia
aletheia/aletheiacli.py
<filename>aletheia/aletheiacli.py import argparse from aletheia.agents import create_agent def process(args): if args.subparser == 'agent': if args.create: create_agent(args.agent_name, args.target_path) pass pass if __name__ == '__main__': parser = argparse.ArgumentP...
Brain-in-Vat/Aletheia
aletheia/agents/__init__.py
import os import sys from aletheia.settings import DOWNLOAD_URL import hashlib __all__ = ['download', 'ZLAGENT'] def _python2_env(): """function to check python version for compatibility handling""" if sys.version_info[0] < 3: return True else: return False def _python3_env(): """f...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/predict_markets/lmsr.py
<gh_stars>0 from . import PredictMarket import math from enum import Enum class TokenType(Enum): yes_token = 'yes_token' no_token = '<PASSWORD>token' class LMSRMarket(PredictMarket): def __init__(self, choices, b=300): self.choices = choices self.amounts = {choice: 0 for choice in choic...
Brain-in-Vat/Aletheia
aletheia/agents/simpleagent.py
import math from mesa import Agent, Model import random # class Agent(object): # def __init__(self, _id, position, states): # self._id = _id # self.position = position # self.states = states class SpatialAgent(Agent): """ A Spatial Vote agent agent with x,y represents it's op...
Brain-in-Vat/Aletheia
aletheia/tests/test_download.py
<filename>aletheia/tests/test_download.py<gh_stars>0 import os from agents import download, ZLAGENT, gen_md5 from settings import DOWNLOAD_URL, BASE_DIR zlagent_owl = os.path.join(BASE_DIR, 'resources', 'zlagent.owl') zlagent_py = os.path.join(BASE_DIR, 'resources', 'zlagent.py') a = gen_md5(zlagent_owl) print(a) b = ...
Brain-in-Vat/Aletheia
aletheia/examples/agents/randomagent.py
<filename>aletheia/examples/agents/randomagent.py from mesa import Agent, Model import random class RandomAgent(Agent): def __init__(self, unique_id, model, token): super().__init__(unique_id, model) self.token = token self.model = model def donate(self): projects = se...
Brain-in-Vat/Aletheia
aletheia/algorithm_analyze/__init__.py
''' 1. 系统哪些状态需要展示给用户 a 地址相关的代币分布 b 治理损失函数的变化 c 治理相关的数据 可视化工具 https://altair-viz.github.io/gallery/scatter_tooltips.html https://seaborn.pydata.org/tutorial/relational.html mesa dash ''' ''' 共有的格式 私有的格式 ''' import dash import dash_core_components as dcc import dash_html_components as html from dash.depen...
Brain-in-Vat/Aletheia
aletheia/mechanism_engine/__init__.py
<filename>aletheia/mechanism_engine/__init__.py from mesa import Model
JacOng17/serviceinnovationlab.github.io
.circleci/make-yaml.py
<gh_stars>1-10 #!/usr/bin/env python # Might need to run `python3 -m pip install pyyaml` if you get a ModuleNotFoundError: No module named 'yaml' import os import csv import yaml import collections csv_filename = os.environ['GS_CSV_FILE'] yaml_filename = os.environ['GS_YAML_FILE'] data = [] def represent_orderedd...
anorth/shadow-wall
InterviewPrepScripts/videoCapture_Serial.py
import numpy as np import cv2 import time import serial #ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1) ser = serial.Serial('/dev/ttyACM0', 115200, timeout=1) cap = cv2.VideoCapture(0) while(True): # Capture frame-by-frame ret, frame = cap.read() if frame == None: continue b,g,r = cv2....
anorth/shadow-wall
Processing2Python/showMovie/recordVideo.py
import cv2 INTERNAL_CAMERA = 1 EXTERNAL_CAMERA = 0 PREVIEW_SIZE = (1920/2, 1080/2) filename = 'testRecordVideo_MakerSpace_withoutFilters_lightsOff.mp4' cap = cv2.VideoCapture(EXTERNAL_CAMERA) cap.set(cv2.cv.CV_CAP_PROP_FPS, 30) cap.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, 1920) cap.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, 1...
anorth/shadow-wall
InterviewPrepScripts/serialOLD.py
import serial ser = serial.Serial(0) # open first serial port print ser.portstr # check which port was really used ser.write("hello") # write a string ser.close()
anorth/shadow-wall
Processing2Python/showMovie/imgproc.py
#!/usr/bin/env python import itertools import random from collections import Counter from showMovie.defish import create_fisher import cv2 import numpy as np from showMovie.helperFunctions import make_gamma_table from perspective_transform import four_point_transform THRESHOLD = int(255 * 0.7) MIN_CONTOUR_DIMENSION =...
anorth/shadow-wall
Processing2Python_old/showMovie/panel.py
from helperFunctions import percentage # def send_frame_to_led_panels(frame, num_ports, led_area, led_image, led_data, led_layout): # #Write the frame to panels # for i in range(0, num_ports): # #copy a portion of the movie's image to the LED image # xoffset = percentage(frame.width, led_area[i].x) # ...
anorth/shadow-wall
Processing2Python_old/showMovie/helperFunctions.py
import numpy as np import cv2 gamma = 1.7 gamma_table = [] def initialise_gamma_table(): for i in range(0, 256): gamma_table.append(int(np.power(i / 255.0, gamma) * 255.0 + 0.5)) # convert an integer from 0 to 100 to a float percentage # from 0.0 to 1.0. Special cases for 1/3, 1/6, 1/7, etc # are hand...
anorth/shadow-wall
Processing2Python/showMovie/helperFunctions.py
import time import cv2 import numpy as np from bitarray import bitarray def make_gamma_table(g): return [int(((i / 255.0) ** g) * 255.0 + 0.5) for i in range(256)] def reverse_bits(x): result = 0 for i in xrange(8): if (x >> i) & 1: result |= 1 << (8 - 1 - i) return result led_gamma = 2.8#...
anorth/shadow-wall
Processing2Python/showMovie/check_panel_time.py
import datetime START_TIME_HOUR = 18 MINUTES_PAST_HOUR = 50 END_TIME_HOUR = 23 #11pm def good_time_to_play(): now = datetime.datetime.now() # if now.day == 4: # return False if now.hour >= START_TIME_HOUR and now.hour < END_TIME_HOUR: return True else: return False
anorth/shadow-wall
Processing2Python/showMovie/movie2serial.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import numpy as np import cv2 import serial import glob import time from MyRectangle import MyRectangle import helperFunctions as hp from concurrent.futures import ThreadPoolExecutor from showMovie.imgproc import Pipeline, BackgroundRejecterMog, BackgroundReject...
anorth/shadow-wall
InterviewPrepScripts/byteSerial.py
<filename>InterviewPrepScripts/byteSerial.py<gh_stars>1-10 import numpy as np import cv2 from time import sleep import serial #ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1) ser = serial.Serial('/dev/ttyACM1', 115200, timeout=1) byteR = (255,0,0) byteG = (0,255,0) byteB = (0,0,255) NUM_LEDS = 100 j = 0; whi...
anorth/shadow-wall
Processing2Python_old/showMovie/MyRectangle.py
<gh_stars>0 class MyRectangle(object): def __init__(self, top_corner, width, height): self.x = top_corner[0] self.y = top_corner[1] self.width = width self.height = height def get_bottom_right(self): d = self.x + self.width t = self.y + self.height retur...
anorth/shadow-wall
PythonHelperScripts/genGammaCorrection.py
#!/usr/local/bin/python #Date created: 18-JAN-2016 #Author: NG #code pilfered from LadyAda! #https://learn.adafruit.com/led-tricks-gamma-correction/the-longer-fix #Purpose: This table remaps linear input values (the numbers we’d like to use; e.g. 127 = half brightness) to nonlinear gamma-corrected output values (numbe...
anorth/shadow-wall
Processing2Python/showMovie/defish.py
#!/usr/bin/env python import cv2 import numpy as np FISH_FOV = 180.0 class Defisher(object): def __init__(self, src_size, dst_size, xmap, ymap): self.src_size = src_size self.dst_size = dst_size self.xmap = xmap self.ymap = ymap def unwarp(self, img): assert img.shap...
anorth/shadow-wall
Processing2Python_old/showMovie/movie2serial.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import cv2 import serial import glob import time from MyRectangle import MyRectangle import helperFunctions as hp cv2.namedWindow("preview") vc = cv2.VideoCapture() MaximumNumberOfPorts = 24 target_frame_rate = 30 led_serial = [] led_image = [] led_are...
anorth/shadow-wall
InterviewPrepScripts/videoCapture.py
import numpy as np import cv2 import time start = time.time() end = start + 3 #show video for three seconds - I do this to make sure your stream doesn't get stuffed up by a bad exit. Remove in future. cap = cv2.VideoCapture(0) #while time.time() < end: # while(True): # Capture frame-by-frame ret, frame = cap...
anorth/shadow-wall
InterviewPrepScripts/byteSerialVideo.py
<reponame>anorth/shadow-wall import numpy as np import cv2 from time import sleep import serial #ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1) ser = serial.Serial('/dev/ttyACM0', 115200, timeout=1) cap = cv2.VideoCapture(0) NUM_LEDS = 100 SEND_SERIAL = True while 1: ret,frame = cap.read() if frame ...
EdilsonTarcio/funcao_maior_numero
maior_valor.py
<reponame>EdilsonTarcio/funcao_maior_numero def maior_valor(valores): return max(valores) def capturar_numeros(): lista_numeros = [] while True: numero = int(input("Informe um número inteiro ou zero para sair: ")) if numero == 0: break lista_numeros.append(numero) re...
wellcomecollection/aws_utils
tests/test_s3_utils.py
<filename>tests/test_s3_utils.py # -*- encoding: utf-8 -*- import boto3 from botocore.exceptions import ClientError import dateutil.parser from moto import mock_s3 import pytest from wellcome_aws_utils import s3_utils def s3_event(): return { "Records": [ { "eventVersion": "2...
wellcomecollection/aws_utils
src/wellcome_aws_utils/dynamo_utils.py
<filename>src/wellcome_aws_utils/dynamo_utils.py # -*- encoding: utf-8 -*- def _is_capacity_different(x, desired_capacity): read_capacity_units = x['ProvisionedThroughput']['ReadCapacityUnits'] write_capacity_units = x['ProvisionedThroughput']['WriteCapacityUnits'] return ( read_capacity_units != ...
wellcomecollection/aws_utils
tests/test_dynamo_event.py
<filename>tests/test_dynamo_event.py<gh_stars>0 # -*- encoding: utf-8 -*- from wellcome_aws_utils import dynamo_event event_source_arn = ( "arn:aws:dynamodb:us-east-1:123456789012:" "table/BarkTable/stream/2016-11-16T20:42:48.104" ) def create_insert_record(message): return { "ApproximateCreatio...
wellcomecollection/aws_utils
tests/test_sqs_utils.py
# -*- encoding: utf-8 -*- import logging import boto3 import daiquiri from moto import mock_sqs import pytest from wellcome_aws_utils import sqs_utils daiquiri.setup(level=logging.INFO) logger = daiquiri.getLogger(__name__) @pytest.fixture def queue_url(): with mock_sqs(): client = boto3.client('sqs...
wellcomecollection/aws_utils
src/wellcome_aws_utils/ecs_utils.py
<gh_stars>0 # -*- encoding: utf-8 -*- import operator from botocore.exceptions import ClientError class EcsThrottleException(Exception): pass def identify_cluster_by_app_name(client, app_name): """ Given the name of one of our applications (e.g. api, calm_adapter), return the ARN of the cluster th...
wellcomecollection/aws_utils
src/wellcome_aws_utils/__init__.py
# -*- encoding: utf-8 -*- from wellcome_aws_utils import ( deployment_utils, dynamo_utils, ecs_utils, s3_utils, sns_utils, sqs_utils, ) from wellcome_aws_utils.version import __version_info__, __version__ __all__ = [ '__version_info__', '__version__', 'deployment_utils', 'dyna...
wellcomecollection/aws_utils
scripts/deploy.py
#!/usr/bin/env python # coding=utf-8 # # This file is part of Hypothesis, which may be found at # https://github.com/HypothesisWorks/hypothesis-python # # Most of this work is copyright (C) 2013-2017 <NAME> # (<EMAIL>), but it contains contributions by others. See # CONTRIBUTING.rst for a full list of people who may h...
wellcomecollection/aws_utils
src/wellcome_aws_utils/reporting_utils.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ get records from VHS, apply the transformation to them, and shove them into an elasticsearch index """ import json import boto3 import certifi from attr import attrs, attrib from elasticsearch import Elasticsearch from wellcome_aws_utils.lambda_utils import log_on_err...
wellcomecollection/aws_utils
src/wellcome_aws_utils/sqs_utils.py
<gh_stars>0 # -*- encoding: utf-8 -*- import boto3 import daiquiri logger = daiquiri.getLogger(__name__) def get_messages(queue_url, delete=False, batch_size=10): """ Gets messages from an SQS queue. If ``delete`` is True, the messages are also deleted after they've been read. """ client = bot...
wellcomecollection/aws_utils
src/wellcome_aws_utils/deployment_utils.py
<filename>src/wellcome_aws_utils/deployment_utils.py #!/usr/bin/env python # -*- encoding: utf-8 -*- """ Shared library to help surface ECS deployment information. """ import collections import datetime from wellcome_aws_utils.ecs_utils import ( get_cluster_arns, get_service_arns, describe_service ) Deployment =...
wellcomecollection/aws_utils
src/wellcome_aws_utils/lambda_utils.py
# -*- encoding: utf-8 import functools import sys def log_on_error(fn): @functools.wraps(fn) def wrapper(*args, **kwargs): try: return fn(*args, **kwargs) except Exception: print(f'args = {args!r}', file=sys.stderr) print(f'kwargs = {kwargs!r}', file=sys....
wellcomecollection/aws_utils
src/wellcome_aws_utils/dynamo_event.py
<gh_stars>0 from enum import Enum from boto3.dynamodb.types import TypeDeserializer from wellcome_aws_utils.exceptions import UnWellcomeException def create_dynamo_events(event): for record in event['Records']: yield DynamoEvent(record) class DynamoEventType(Enum): REMOVE, INSERT, MODIFY = range(3...
wellcomecollection/aws_utils
scripts/hypothesistooling.py
<filename>scripts/hypothesistooling.py # coding=utf-8 # # This file is part of Hypothesis, which may be found at # https://github.com/HypothesisWorks/hypothesis-python # # Most of this work is copyright (C) 2013-2017 <NAME> # (<EMAIL>), but it contains contributions by others. See # CONTRIBUTING.rst for a full list of ...
wellcomecollection/aws_utils
docs/build_api_reference.py
<filename>docs/build_api_reference.py #!/usr/bin/env python # -*- encoding: utf-8 -*- import os import subprocess import tempfile import textwrap from bs4 import BeautifulSoup working_dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(working_dir) tmp_dir = tempfile.mkdtemp() subprocess.check_call(['sphinx...
wellcomecollection/aws_utils
src/wellcome_aws_utils/sns_utils.py
# -*- encoding: utf-8 -*- import collections import datetime import decimal import json import logging import warnings from wellcome_aws_utils.exceptions import UnWellcomeException SNSEvent = collections.namedtuple('SNSEvent', 'subject message') logger = logging.getLogger(__name__) class EnhancedJSONEncoder(json...
wellcomecollection/aws_utils
tests/conftest.py
<reponame>wellcomecollection/aws_utils<gh_stars>0 # -*- encoding: utf-8 -*- import boto3 from moto import mock_sns, mock_sqs import pytest def pytest_runtest_setup(item): set_region() @pytest.fixture() def set_region(): # Without this, boto3 is complaining about not having a region defined # in tests (...
wellcomecollection/aws_utils
src/wellcome_aws_utils/s3_utils.py
<filename>src/wellcome_aws_utils/s3_utils.py # -*- encoding: utf-8 -*- import json from urllib.parse import unquote import boto3 from botocore.exceptions import ClientError import dateutil.parser def is_object(bucket, key): """ Checks if an object exists in S3. Returns True/False. :param bucket: Bucke...
wellcomecollection/aws_utils
tests/test_sns_utils.py
<gh_stars>0 # -*- encoding: utf-8 -*- from datetime import datetime import json import boto3 from wellcome_aws_utils import sns_utils def test_publish_sns_message(sns_sqs): sns_client = boto3.client('sns') sqs_client = boto3.client('sqs') topic_arn, queue_url = sns_sqs test_message = { 'st...
wellcomecollection/aws_utils
tests/test_reporting_utils.py
import json import boto3 from moto import mock_s3, mock_dynamodb2 from unittest.mock import patch from wellcome_aws_utils.reporting_utils import process_messages def create_sns_message(id): return { "Records": [ { "Sns": { "Message": (f'{{"id":"{id}","versio...
wellcomecollection/aws_utils
setup.py
# -*- encoding: utf-8 -*- import os from setuptools import find_packages, setup def local_file(name): return os.path.relpath(os.path.join(os.path.dirname(__file__), name)) SOURCE = local_file('src') README = local_file('README.rst') # Assignment to placate pyflakes. The actual version is from the exec that ...
wellcomecollection/aws_utils
src/wellcome_aws_utils/exceptions.py
<filename>src/wellcome_aws_utils/exceptions.py # -*- encoding: utf-8 -*- class UnWellcomeException(Exception): """ Base exception for all exceptions raised by this library. """ pass
wellcomecollection/aws_utils
tests/test_ecs_utils.py
<reponame>wellcomecollection/aws_utils<filename>tests/test_ecs_utils.py<gh_stars>0 # -*- encoding: utf-8 -*- import json import boto3 from botocore.exceptions import ClientError from mock import Mock from moto import mock_ecs, mock_ec2 from moto.ec2 import utils as moto_ec2_utils import pytest from wellcome_aws_util...
wellcomecollection/aws_utils
tests/test_lambda_utils.py
<gh_stars>0 # -*- encoding: utf-8 from wellcome_aws_utils import lambda_utils as lu @lu.log_on_error def return_2(): return 2 def test_log_on_error_preserves_return_value(): assert return_2() == 2
oleorhagen/mender-configure-module
tests/integration/install-mender-configure.py
<reponame>oleorhagen/mender-configure-module #!/usr/bin/env python3 # Copyright 2021 Northern.tech AS # # 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...
oleorhagen/mender-configure-module
tests/integration/tests/conftest.py
# Copyright 2021 Northern.tech AS # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...