repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
Cytomine-ULiege/pims
pims/utils/color.py
# * Copyright (c) 2020-2021. Authors: see NOTICE file. # * # * 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 ...
kholysa/PathPlanning
PathPlanning/__init__.py
<gh_stars>0 name = "PathPlanning"
kholysa/PathPlanning
PathPlanning/AStarRosetta.py
from __future__ import print_function from decimal import Decimal from numpy import round, subtract import matplotlib.pyplot as plt class AStarGraph(object): # Define a class board like grid with two barriers def __init__(self, walls): self.barriers = [] for wall in walls: self.b...
klaymond/kiki-box
app.py
from flask import Flask, request, jsonify, render_template, redirect, url_for import qbittorrentapi from decouple import config from tpblite import TPB app = Flask(__name__) @app.route("/download", methods=['GET']) def download(): magnet = request.args.get("magnet") print("magnet") print(magnet) qbt ...
Hakan-Kocer/Lane-Detection
Lane_Detection.py
<filename>Lane_Detection.py from cv2 import cv2 import numpy as np from math import sqrt image=cv2.imread("test.jpg") h=image.shape[0] w=image.shape[1] if w%2==1: whalf=(w-1)/2 else: whalf=w/2 if h%2==1: hhalf=(h-1)/2 else: hhalf=h/2 hhalf=int(hhalf) whalf=int(whalf) beyaz = [] j=0 for x in range(0,h...
navytux/virtualenv
src/virtualenv/seed/embed/via_app_data/via_app_data.py
"""Bootstrap""" from __future__ import absolute_import, unicode_literals import logging import sys import traceback from contextlib import contextmanager from subprocess import CalledProcessError from threading import Lock, Thread from virtualenv.info import fs_supports_symlink from virtualenv.seed.embed.base_embed i...
navytux/virtualenv
tests/unit/config/test_env_var.py
<filename>tests/unit/config/test_env_var.py from __future__ import absolute_import, unicode_literals import os import pytest from virtualenv.config.ini import IniConfig from virtualenv.run import session_via_cli from virtualenv.util.path import Path @pytest.fixture() def empty_conf(tmp_path, monkeypatch): conf...
navytux/virtualenv
src/virtualenv/util/path/_sync.py
<filename>src/virtualenv/util/path/_sync.py from __future__ import absolute_import, unicode_literals import logging import os import shutil from stat import S_IWUSR from six import PY2 from virtualenv.info import IS_CPYTHON, IS_WIN from virtualenv.util.six import ensure_text if PY2 and IS_CPYTHON and IS_WIN: # CPy...
wknowles/thanks-arthur
tweet.py
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- import tweepy import os # import auth from heroku CONSUMER_KEY = os.environ['CONSUMER_KEY'] CONSUMER_SECRET = os.environ['CONSUMER_SECRET'] ACCESS_TOKEN = os.environ['ACCESS_TOKEN'] ACCESS_TOKEN_SECRET = os.environ['ACCESS_TOKEN_SECRET'] # twitter auth aut...
RyanLassigBanks/sawtooth-seth
docs/source/conf.py
<gh_stars>10-100 # -*- coding: utf-8 -*- # # Sawtooth documentation build configuration file, created by # sphinx-quickstart on Wed Dec 2 11:03:19 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogen...
inverse/Hue-remotes-HASS
tests/test_integration.py
<reponame>inverse/Hue-remotes-HASS """The hueremotes tests.""" import logging from datetime import timedelta from homeassistant.components.hue import DOMAIN as HUE_DOMAIN from custom_components.hueremote import DOMAIN from custom_components.hueremote.data_manager import HueSensorData from custom_components.hueremote....
inverse/Hue-remotes-HASS
custom_components/hueremote/remote.py
<reponame>inverse/Hue-remotes-HASS<filename>custom_components/hueremote/remote.py """Hue remotes.""" import logging from homeassistant.const import CONF_SCAN_INTERVAL from homeassistant.components.remote import ( # noqa: F401 PLATFORM_SCHEMA, RemoteDevice, ) from . import DOMAIN from .data_manager import ( ...
inverse/Hue-remotes-HASS
tests/api_samples.py
"""Examples of raw and parsed data for known remotes.""" # Remotes MOCK_ZGP = { "state": {"buttonevent": 17, "lastupdated": "2019-06-22T14:43:50"}, "swupdate": {"state": "notupdatable", "lastinstall": None}, "config": {"on": True}, "name": "Hue Tap", "type": "ZGPSwitch", "modelid": "ZGPSWITCH",...
inverse/Hue-remotes-HASS
tests/conftest.py
"""Pytest fixtures for huesensors tests.""" from copy import deepcopy from unittest.mock import MagicMock, patch from aiohue import Bridge from aiohue.sensors import GenericSensor from homeassistant.core import HomeAssistant from homeassistant.components.hue import DOMAIN as HUE_DOMAIN, HueBridge from homeassistant.co...
inverse/Hue-remotes-HASS
custom_components/hueremote/hue_api_response.py
"""Hue API data parsing for sensors.""" import logging from typing import Any, Callable, Iterable, Dict, Optional, Tuple from homeassistant.const import STATE_OFF, STATE_ON REMOTE_MODELS = ("RWL", "ROM", "FOH", "ZGP", "Z3-") ENTITY_ATTRS = { "RWL": ["last_updated", "last_button_event", "battery", "on", "reachable...
inverse/Hue-remotes-HASS
tests/test_remote.py
"""Tests for remote.py.""" import logging from datetime import timedelta import pytest from custom_components.hueremote import DOMAIN from custom_components.hueremote.data_manager import HueSensorData from custom_components.hueremote.hue_api_response import ( parse_hue_api_response, parse_rwl, parse_zgp, ...
Mosibi/Home-Assistant-Sensor-Afvalbeheer
custom_components/afvalbeheer/__init__.py
__version__ = '4.2.8'
aviasd/Mockingjay-Speech-Representation
observe/observe_input.py
# -*- coding: utf-8 -*- # """*********************************************************************************************""" # FileName [ observe_input.py ] # Synopsis [ generates visualizations of the model's input ] # Author [ <NAME> (Andi611) ] # Copyright [ Copyleft(c), NTUEE, NTU, Taiwan ...
aviasd/Mockingjay-Speech-Representation
example_extract_finetune.py
# -*- coding: utf-8 -*- # """*********************************************************************************************""" # FileName [ example_extract_finetune.py ] # Synopsis [ an example code of using the wrapper class for downstream feature extraction or finetune ] # Author [ <NAME> (Andi611)...
haruharuru16/air-quality-prediction-deployment
helper.py
import pickle import pandas as pd import numpy as np def load_model(model_name): # function for load the model and scaler model_in = open(model_name, 'rb') model = pickle.load(model_in) return model def to_dataframe(pm10, so2, co, o3, no2): # convert data input into a dataframe # convert to pa...
haruharuru16/air-quality-prediction-deployment
main.py
<filename>main.py import streamlit as st from helper import load_model, to_dataframe, get_summary, data_preprocessing, get_prediction st.set_page_config(layout='wide') def main(): st.title('Air Quality Prediction Using Random Forest') # load the trained model classifier = load_model('rf_final_model.pkl'...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/9-Use-MxNET.py
<filename>5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/9-Use-MxNET.py # Databricks notebook source # MAGIC %md To install MXNet on a single node using the following script (for the community edition because the driver and the worker are on the same node). # MAGIC * Run the script below. # MAGIC # MAGIC **N...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/12-Streaming.py
# Databricks notebook source # MAGIC %md # Structured Streaming # MAGIC # MAGIC * Use DataFrame API to build Structured Streaming applications. # MAGIC * Compute real-time metrics like running counts and windowed counts on a stream of timestamped actions (e.g. Open, Close, etc). # MAGIC * Use cluster version "Spark 2...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/4-TransformationActions.py
# Databricks notebook source # MAGIC %md In our notebook we have access to sqlContext # COMMAND ---------- sqlContext # COMMAND ---------- # MAGIC %md Spark Context # COMMAND ---------- sc # COMMAND ---------- # MAGIC %md And SparkSession # COMMAND ---------- spark # COMMAND ---------- # MAGIC %md We can us...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/8-SparkML.py
# Databricks notebook source # MAGIC %md ## Apache Spark MLLib # MAGIC Let's return to the farmer's market dataset and use Spark to explore the hypothesis: # MAGIC * The number of farmer's markets in a given zip code can be predicted from the income and taxes paid in a given area. # MAGIC # MAGIC There are serveral st...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/3-WordCount.py
# Databricks notebook source # MAGIC %md This notebook uses Python and is a sample - be sure to update the text file name for your data # COMMAND ---------- def printfunc(x): print 'Word "%s" occurs %d times' % (x[0], x[1]) infile = sc.textFile('/hone/spark/<myTextFile.txt>', 4) rdd1 = infile.flatMap(lambda x: x...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/5-Caching.py
<reponame>jayshilj/learning-hadoop-and-spark # Databricks notebook source # MAGIC %md ## A Worked Example of Transformations and Actions # MAGIC # MAGIC To illustrate all of these architectural and most relevantly **transformations** and **actions** - let's go through a more thorough example, this time using `DataFram...
jayshilj/learning-hadoop-and-spark
0a-Setup-Hadoop/AWS-EMR/0b_run_CalcPi.py
# run on AWS EMR Jupyter Notebook # set runtime to PySpark import random NUM_SAMPLES = 1000 def sample(p): x,y = random.random(),random.random() return 1 if x*x + y*y < 1 else 0 count = sc.parallelize(range(0, NUM_SAMPLES)).map(sample).reduce(lambda a, b: a + b) print ("Pi is roughly %f" % (4.0 * count / N...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/1-CalcPi.py
<filename>5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/1-CalcPi.py # Databricks notebook source # MAGIC %md This notebook uses Python # COMMAND ---------- from random import random def sample(p): x, y = random(), random() return 1 if x*x + y*y < 1 else 0 NUM_SAMPLES = 10 # Increment by 10x coun...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/Jupyter-Notebooks/aws_databricks_notebooks/6-SparkSQL.py
# Databricks notebook source # MAGIC %md # MAGIC In this exercise we will use Spark to explore the hypothesis stated below: # MAGIC # MAGIC **The number of farmer's markets in a given zip code can be predicted from the income and taxes paid in a given area.** # MAGIC # MAGIC We explore the process for discovering whe...
jayshilj/learning-hadoop-and-spark
5-Use-Spark/PySpark/calculatePi.py
import pyspark import random if not 'sc' in globals(): sc = pyspark.SparkContext() NUM_SAMPLES = 1000 def sample(p): x,y = random.random(),random.random() return 1 if x*x + y*y < 1 else 0 count = sc.parallelize(range(0, NUM_SAMPLES)).map(sample).reduce(lambda a, b: a + b) print ("Pi is roughly %f" % (4...
Spstolar/BMachine
PythonCode/drawing_image.py
<gh_stars>0 import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np length = 28 dog = np.load('stabilization_small.npy') num_plot = 0 if num_plot == 1: for j in range(10): img = dog[j,:].reshape((length, length)) # for printing numbers # img = np.random.randint(0,2,s...
Spstolar/BMachine
PythonCode/create_PCA_plots.py
<filename>PythonCode/create_PCA_plots.py import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from mpl_toolkits.mplot3d import Axes3D import matplotlib.colors as colors length_of_vecs = 100 histData = np.load('hidden_activations.npy') my_data = histData # Replace with data to be us...
Spstolar/BMachine
PythonCode/debugging_example.py
<gh_stars>0 def double_it(num): return num*2 start = 3 for i in range(6): start = double_it(start)
Spstolar/BMachine
PythonCode/labelExtract.py
import numpy as np header_length = 64 num_examples = 60000 pixels_per_pic = 784 bits_per_label = 8 bits_per_pixel = 8 pic_length = pixels_per_pic * bits_per_pixel test_label_binary = np.zeros((num_examples, bits_per_label)) test_label_classes = np.zeros((num_examples, 10)) def bits(f): bytes = (ord(b) for b in ...
Spstolar/BMachine
PythonCode/toy_data.py
import numpy as np num_examples = 10000 num_type = num_examples / 4 ones_vec = np.ones(5) neg_ones_vec = -np.ones(5) vec_1 = np.hstack((ones_vec, neg_ones_vec)) vec_2 = np.hstack((ones_vec, ones_vec)) vec_3 = np.hstack((neg_ones_vec, ones_vec)) vec_4 = np.hstack((neg_ones_vec, neg_ones_vec)) first = np.vstack((vec_...
Spstolar/BMachine
PythonCode/fast_RBM.py
import numpy as np import time ''' Parameters to modulate: Learning rate = how much to change the weights by for each batch Batch size = how many examples to use for weight change Coactivity sweeps = how many sweeps to compute coactivity for given weights Readout sweeps = how many sweeps to run before ...
Spstolar/BMachine
PythonCode/dataExtract.py
<filename>PythonCode/dataExtract.py<gh_stars>0 import numpy as np num_test_examples = 60000 pixels_per_pic = 784 bits_per_pixel = 8 pic_length = pixels_per_pic * bits_per_pixel test_set = np.zeros((num_test_examples, pic_length)) def bits(f): bytes = (ord(b) for b in f.read()) for b in bytes: for i ...
Spstolar/BMachine
PythonCode/boltzmachine.py
import numpy as np class BoltzmannMachine(object): def __init__(self, input_size, hidden_size, output_size): self.total_nodes = input_size + hidden_size + output_size self.state = np.random.randint(0, 2, self.total_nodes, dtype=int) # Begin with a random 0-1 draw. self.state = (self.state ...
Spstolar/BMachine
PythonCode/genericBM_hw_part_1.py
<reponame>Spstolar/BMachine import numpy as np import time def sigmoid(input): return 1.0 / (1 + np.exp(-input)) class BoltzmannMachine(object): def __init__(self, input_size, hidden_size, output_size): self.total_nodes = input_size + hidden_size + output_size self.state = np.random.randint(...
Spstolar/BMachine
PythonCode/hist_maker.py
<reponame>Spstolar/BMachine import numpy as np import matplotlib.pyplot as plt x = np.load('energy_small_p1.npy') n, bins, patches = plt.hist(x, 31, normed=0, histtype='bar',facecolor='green', alpha=1, edgecolor='black') plt.xlabel('Energy Value') plt.ylabel('Number of Sweeps') plt.title('Energy Values for Post-Stab...
Spstolar/BMachine
PythonCode/dataExtract_reduced.py
import numpy as np # url to format of files: http://yann.lecun.com/exdb/mnist/ # definition of constants corresponding to the MNIST data sets num_train_examples = 60000 num_test_examples = 10000 num_classes = 10 pixels_per_image = 784 bits_per_pixel = 8 header_bytes_images = 16 header_bytes_labels = 8 def bits(f): ...
Spstolar/BMachine
PythonCode/mult_out.py
import numpy as np def whacky(): a = np.arange(3) b = np.arange(4) c = np.arange(5) return a, b, c cat_a = np.zeros(3) cat_b = np.zeros(4) cat_c = np.zeros(5) for i in range(4): a_cat_a, a_cat_b, a_cat_c = whacky() cat_a += a_cat_a cat_b += a_cat_b cat_c += a_cat_c print cat_a print ...
medhasharma/codezilla
Sorting/Bubble Sort/Python/bubbleSort.py
def bubbleSort(arr): lengthArr = len(arr) for i in range(lengthArr): for j in range(0, lengthArr-i-1): if(arr[j] > arr[j+1]): arr[j], arr[j+1] = arr[j+1], arr[j]
boomletsgo/falcon-rest
setup.py
<filename>setup.py from setuptools import setup, find_packages classifiers = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language ...
boomletsgo/falcon-rest
falcon_rest/tests/__init__.py
<reponame>boomletsgo/falcon-rest import falcon import falcon_json_middleware class MiddlewareTestsMixin: def setUp(self): super().setUp() self.api = falcon.API(middleware=falcon_json_middleware.Middleware())
boomletsgo/falcon-rest
falcon_rest/tests/test_resources.py
from falcon import testing from marshmallow import Schema, fields from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base from falcon_rest.resources import BaseResource, ModelResource from . import MiddlewareTestsMixin # First, let's generate the engine a...
boomletsgo/falcon-rest
falcon_rest/exceptions.py
class FalconRestException(Exception): pass
boomletsgo/falcon-rest
falcon_rest/resources.py
import datetime import falcon from falcon_rest import exceptions, session import sqlalchemy class BaseResource(object): def __init__(self): self.id_param = getattr(self, "id_param", "id") self.id_field = getattr(self, "id_field", "id") def get_data_filters(self, kwargs=None): return...
boomletsgo/falcon-rest
falcon_rest/session.py
<reponame>boomletsgo/falcon-rest from contextlib import contextmanager from sqlalchemy.orm import sessionmaker @contextmanager def make(db_engine, **kwargs): """Scope a db_session for a context, and close it afterwards""" db_session = sessionmaker(bind=db_engine, **kwargs)() try: yield db_session ...
CodeForTravel/DynamicFilterWithDjango
src/core/migrations/0002_auto_20200427_1229.py
<filename>src/core/migrations/0002_auto_20200427_1229.py # Generated by Django 3.0.5 on 2020-04-27 06:29 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ] operations = [ migrations.AlterField( model_n...
CodeForTravel/DynamicFilterWithDjango
src/core/admin.py
from django.contrib import admin from . import models admin.site.register(models.Author) admin.site.register(models.Category) admin.site.register(models.Journal)
CodeForTravel/DynamicFilterWithDjango
Scripts/django-admin.py
<reponame>CodeForTravel/DynamicFilterWithDjango #!e:\development\dynamicfilter\env\scripts\python.exe from django.core import management if __name__ == "__main__": management.execute_from_command_line()
hushon/learning-not-to-learn-tensorflow
main.py
<filename>main.py import argparse import os from datetime import datetime import tensorflow as tf import numpy as np from PIL import Image import model import utils class Trainer(object): def __init__(self, args): self.args = args self.global_step = 0 self._timestamp = datetime.now().strfti...
hushon/learning-not-to-learn-tensorflow
utils.py
from tkinter import Tk, filedialog import os import numpy as np def quantize(x, dim_bias): bins = list(range(0, 256, 256//dim_bias)) + [256] return np.digitize(x, bins, False) - 1 def ask_openfile(filetype=("numpy files","*.npy")): root = Tk() filepath = filedialog.askopenfilename(title='Select file',...
hushon/learning-not-to-learn-tensorflow
model.py
import tensorflow as tf @tf.custom_gradient def grad_reverse(x): scale = 0.1 y = tf.identity(x) grad = lambda dy: -dy * scale return y, grad class GradientReversalLayer(tf.keras.layers.Layer): def __init__(self): super().__init__() def call(self, x): return grad_reverse(x) cl...
Lee-W/pycontw-postevent-report-generator
report_generator/controller/report_generator_cli.py
<filename>report_generator/controller/report_generator_cli.py import logging import pkg_resources import click import pandas as pd import report_generator.config as report_generatorconfig import report_generator.analyzer.generic as ag import report_generator.viewer.text as vtext import report_generator.analyzer.plott...
Lee-W/pycontw-postevent-report-generator
report_generator/exporter/html.py
import base64 from pathlib import Path from collections.abc import Iterable from jinja2 import Environment, PackageLoader from jinja2 import Markup loader = PackageLoader("report_generator.exporter", "data") env = Environment(loader=loader) def _generate_html_rows(*data, with_tr=False): if not isinstance(data,...
Lee-W/pycontw-postevent-report-generator
tasks/__init__.py
from invoke import Collection from tasks import env, test, style, secure, git from tasks.build import build_ns ns = Collection() ns.add_collection(env) ns.add_collection(test) ns.add_collection(style) ns.add_collection(build_ns) ns.add_collection(secure) ns.add_collection(git)
Lee-W/pycontw-postevent-report-generator
tasks/env.py
<reponame>Lee-W/pycontw-postevent-report-generator<filename>tasks/env.py from invoke import task @task def clean(ctx): """Remove virtual environement""" ctx.run("pipenv --rm", warn=True) @task def init(ctx): """Install production dependencies""" ctx.run("pipenv install --deploy") @task def init_de...
Lee-W/pycontw-postevent-report-generator
tasks/git.py
<reponame>Lee-W/pycontw-postevent-report-generator from invoke import task from tasks.common import PIPENV_PREFIX @task def authors(ctx): """Print all the authors in this project""" result = ctx.run('git log --pretty=format:"%an <%ae>"', encoding="utf-8", hide=True) authors = set(result.stdout.splitlin...
shikow/grafana-http-notifier
dynamo.py
<reponame>shikow/grafana-http-notifier from functools import lru_cache from boto3 import resource from botocore.config import Config from boto3.dynamodb.conditions import Key @lru_cache() def get_dynamo_resource(region): account_config = Config( region_name=region, retries={ 'max_attem...
shikow/grafana-http-notifier
app.py
from os import getenv from sqs import send_message from flask import Flask, request, Response from dynamo import get_dynamo_resource, get_alert import logging app = Flask(__name__) logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', level=logging.INFO) log = logging.getLogger() @app.route('/notify/<...
shikow/grafana-http-notifier
sqs.py
<reponame>shikow/grafana-http-notifier from boto3 import resource from functools import lru_cache from json import dumps from os import getenv @lru_cache() def get_sqs_resource(): return resource('sqs') def send_message(message, alert): aws_resource = get_sqs_resource() queue = aws_resource.get_queue_b...
skyf0cker/SRCNN_TORCH
models.py
import torch import torch.nn as nn class NetWork(nn.Module): def __init__(self): super(NetWork, self).__init__() self.conv1 = nn.Conv2d(3, 64, kernel_size=9, stride=1) self.relu1 = nn.ReLU() self.conv2 = nn.Conv2d(64, 32, kernel_size=1, stride=1) self.relu2 = nn.ReLU() ...
skyf0cker/SRCNN_TORCH
train.py
<filename>train.py from dataLoadess import Imgdataset from torch.utils.data import DataLoader from models import NetWork import torch.optim as optim import torch.nn as nn import torch from torch.autograd import Variable if not torch.cuda.is_available(): raise Exception('NO GPU!') dataset = Imgdataset("/home/tens...
skyf0cker/SRCNN_TORCH
dataLoadess.py
<filename>dataLoadess.py from torch.utils.data import Dataset import os from PIL import Image import numpy as np import torchvision.transforms as transform class Imgdataset(Dataset): def __init__(self, path): super(Imgdataset, self).__init__() self.data = [] if os.path.exists(path): ...
jdmoorman/python-boilerplate
src/python_boilerplate/example.py
<filename>src/python_boilerplate/example.py class Example: def get_value(self): return 10
jdmoorman/python-boilerplate
src/python_boilerplate/__init__.py
<gh_stars>0 """Top-level package for Python Boilerplate.""" # Do not edit this string manually, always use bumpversion # Details in CONTRIBUTING.md __version__ = "0.0.1" __author__ = "<NAME>" __email__ = "<EMAIL>" __license__ = "MIT" __copyright__ = "Copyright (c) 2020, <NAME>" from .example import Example # noqa...
justinkjackson/ImpactTestFixture
enterTool.py
<reponame>justinkjackson/ImpactTestFixture<filename>enterTool.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import time from PyQt5 import QtWidgets, uic from PyQt5.QtCore import pyqtSlot # import second capture tool screen from captureTool2 import CaptureTool2 EnterToolUI, EnterToolWind...
justinkjackson/ImpactTestFixture
SrDesign_Milwaukee/example.py
#! /usr/bin/python2 import time import sys EMULATE_HX711=False referenceUnit = 1 if not EMULATE_HX711: import RPi.GPIO as GPIO from hx711 import HX711 else: from emulated_hx711 import HX711 def cleanAndExit(): print("Cleaning...") if not EMULATE_HX711: GPIO.cleanup()...
justinkjackson/ImpactTestFixture
pyqtcheck.py
<reponame>justinkjackson/ImpactTestFixture from PyQt5.Qt import PYQT_VERSION_STR #cfg = Configuration() print("PyQT version: ",PYQT_VERSION_STR)
justinkjackson/ImpactTestFixture
SrDesign_Milwaukee/image_proc.py
""" Image OCR to detect the cat no from images Requires packages: cv2 (open cv), numpy, matplolib, pytesseract, and PIL (pillow) Note: Pathnames need to be modified for your setup """ ## this code needed to be stored into a function or and instance of the testing screen. ##once the button "Start...
justinkjackson/ImpactTestFixture
captureTool.py
<filename>captureTool.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys from PyQt5 import QtWidgets, uic os.system('cls' if os.name == 'nt' else 'clear') # Clear screen import re import cv2 import numpy as np from pytesseract import image_to_string from PIL import Image # To ins...
justinkjackson/ImpactTestFixture
captureTool2.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from PyQt5 import QtCore, QtGui, QtWidgets, uic from PyQt5.QtCore import pyqtSlot CaptureTool2UI, CaptureTool2WindowBase = uic.loadUiType("captureTool2.ui") class CaptureTool2(CaptureTool2UI, CaptureTool2WindowBase): def __init__(self, parent : ...
justinkjackson/ImpactTestFixture
SrDesign_Milwaukee/sensor_test.py
<gh_stars>0 import time import sys #import RPi.GPIO as GPIO EMULATE_HX711 =False referenceUnit = 431 if not EMULATE_HX711: import RPi.GPIO as GPIO from hx711 import HX711 else: from emulated_hx711 import HX711 def cleanAndExit(): print("Cleaning") if not EMULATE_HX...
justinkjackson/ImpactTestFixture
main.py
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from PyQt5 import QtCore, QtWidgets, uic from PyQt5.QtCore import pyqtSlot # import capture tool screen from captureTool import CaptureTool # import enter tool screen from enterTool import EnterTool # import select tool screen from se...
justinkjackson/ImpactTestFixture
testrun.py
import RPi.GPIO as GPIO from hx711 import HX711 GPIO.setmode(GPIO.BCM) hx = HX711(dout_pin=29, pd_sck_pin=31) print(hx.get_raw_data_mean()) GPIO.cleanup()
justinkjackson/ImpactTestFixture
example.py
<filename>example.py #! /usr/bin/python2 import time import sys import matplotlib.pyplot as plt from time import sleep EMULATE_HX711=False referenceUnit = 3800 if not EMULATE_HX711: import RPi.GPIO as GPIO from hx711 import HX711 else: from emulated_hx711 import HX711 def cleanAndExit(): print("Cle...
justinkjackson/ImpactTestFixture
SrDesign_Milwaukee/sensor_test2.py
import time import sys referenceUnit = 431 if not EMULATE_HX711: import RPi.GPIO as GPIO from hx711 import HX711 else: from emulated_hx711 import HX711 def cleanAndExit(): print("Cleaning") if not EMULATE_HX711: GPIO.cleanup() print("Bye") sys.exit() hx = HX711(5,6) hx.set_...
justinkjackson/ImpactTestFixture
selectTool.py
<filename>selectTool.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import time from PyQt5 import QtWidgets, uic # import second capture tool screen from captureTool2 import CaptureTool2 SelectToolUI, SelectToolWindowBase = uic.loadUiType("selectTool.ui") class SelectTool(SelectToolUI,...
Denzel97/Instaclone
insta/apps.py
<reponame>Denzel97/Instaclone from django.apps import AppConfig from __future__ import unicode_literals class InstaConfig(AppConfig): name = 'insta'
Denzel97/Instaclone
insta/admin.py
<filename>insta/admin.py<gh_stars>0 from django.contrib import admin # from __future__ import unicode_literals # Register your models here.
mczerski/mopidy-dleyna
mopidy_dleyna/backend.py
<filename>mopidy_dleyna/backend.py from __future__ import absolute_import, unicode_literals import errno import logging import os import os.path import re import signal import stat import subprocess from mopidy import backend, exceptions import pykka from . import Extension from .client import dLeynaClient from .li...
mczerski/mopidy-dleyna
tests/conftest.py
from __future__ import unicode_literals import mock import pytest @pytest.fixture def audio(): return mock.Mock() @pytest.fixture def config(): return { 'dleyna': { 'upnp_browse_limit': 1000, 'upnp_lookup_limit': 50, 'upnp_search_limit': 100 } } @p...
mczerski/mopidy-dleyna
tests/test_browse.py
<reponame>mczerski/mopidy-dleyna from __future__ import unicode_literals import mock from mopidy.models import Ref import pytest from mopidy_dleyna.util import Future @pytest.fixture def servers(): return [ { 'FriendlyName': 'Media Server #1', 'DisplayName': 'Media1', ...
mczerski/mopidy-dleyna
mopidy_dleyna/client.py
<reponame>mczerski/mopidy-dleyna<filename>mopidy_dleyna/client.py from __future__ import absolute_import, unicode_literals import collections import logging import threading import time import dbus import uritools from . import Extension, util SERVER_BUS_NAME = 'com.intel.dleyna-server' SERVER_ROOT_PATH = '/com/i...
mczerski/mopidy-dleyna
docs/conf.py
def setup(app): app.add_object_type( 'confval', 'confval', objname='configuration value', indextemplate='pair: %s; configuration value' ) def get_version(filename): from re import findall with open(filename) as f: metadata = dict(findall(r"__([a-z]+)__ = '([^']+)'", f.r...
mczerski/mopidy-dleyna
tests/test_search.py
from __future__ import unicode_literals import mock from mopidy import models import pytest from mopidy_dleyna.util import Future @pytest.fixture def server(): return { 'FriendlyName': 'Media Server', 'DisplayName': 'Media', 'SearchCaps': ['DisplayName'], 'URI': 'dleyna://media...
mczerski/mopidy-dleyna
tests/test_translator.py
<filename>tests/test_translator.py from __future__ import unicode_literals from mopidy.models import Album, Artist, Ref, Track import pytest from mopidy_dleyna import translator BASEURI = 'dleyna://foo' BASEPATH = '/com/intel/dLeynaServer/server/0' ALBUM_TYPE = 'container.album.musicAlbum' ARTIST_TYPE = 'container...
mczerski/mopidy-dleyna
tests/test_lookup.py
<reponame>mczerski/mopidy-dleyna<gh_stars>0 from __future__ import unicode_literals import mock from mopidy import models import pytest from mopidy_dleyna.util import Future @pytest.fixture def container(): return { 'DisplayName': 'Album #1', 'Type': 'container', 'TypeEx': 'container.a...
TinkoffCreditSystems/overhave
tests/unit/transport/s3/test_settings.py
import pytest from pydantic import ValidationError from overhave.transport import OverhaveS3ManagerSettings class TestS3ManagerSettings: """ Unit tests for :class:`OverhaveS3ManagerSettings`. """ @pytest.mark.parametrize("test_s3_enabled", [False]) def test_disabled(self, test_s3_enabled: bool) -> None:...
TinkoffCreditSystems/overhave
tests/unit/feature/test_extractor.py
from typing import Sequence import pytest from faker import Faker from overhave.entities import ( FeatureExtractor, FeatureTypeExtractionError, OverhaveFileSettings, ScenariosTestFileNotFound, ) from tests.objects import FeatureTestContainer, get_test_feature_extractor from tests.unit.feature.conftest...
TinkoffCreditSystems/overhave
tests/unit/entities/conftest.py
<gh_stars>10-100 from pathlib import Path from uuid import uuid1 import py import pytest from faker import Faker from overhave import OverhaveFileSettings from overhave.entities.archiver import ArchiveManager @pytest.fixture() def test_file_settings(tmpdir: py.path.local) -> OverhaveFileSettings: settings = Ove...
TinkoffCreditSystems/overhave
overhave/transport/s3/__init__.py
# flake8: noqa from .manager import S3Manager from .objects import OverhaveS3Bucket from .settings import OverhaveS3ManagerSettings
TinkoffCreditSystems/overhave
overhave/admin/views/emulation_run.py
<gh_stars>10-100 import logging from typing import cast import werkzeug from flask_admin import expose from flask_login import current_user from wtforms import ValidationError from overhave import db from overhave.admin.views.base import ModelViewConfigured logger = logging.getLogger(__name__) class EmulationRunVi...
TinkoffCreditSystems/overhave
overhave/authorization/manager/__init__.py
<gh_stars>10-100 # flake8: noqa from .abstract import IAdminAuthorizationManager from .default import DefaultAdminAuthorizationManager from .ldap import LDAPAdminAuthorizationManager, LDAPAuthenticator from .simple import SimpleAdminAuthorizationManager
TinkoffCreditSystems/overhave
tests/sanity/test_execution/conftest.py
from typing import Callable, cast from unittest import mock import pytest import werkzeug from _pytest.fixtures import FixtureRequest from demo.demo import _run_demo_consumer from demo.settings import OverhaveDemoSettingsGenerator from overhave import OverhaveRedisStream from overhave.db import TestReportStatus from ...
TinkoffCreditSystems/overhave
overhave/entities/file_extractor.py
<gh_stars>10-100 from pathlib import Path from typing import List class BaseFileExtractor: """ Base class for file extraction. """ def __init__(self, extenstion: str) -> None: self._extenstion = extenstion @staticmethod def _check_dir_compliance(path: Path) -> bool: return all((path....
TinkoffCreditSystems/overhave
tests/unit/admin/conftest.py
from typing import List, Optional, cast from unittest import mock from unittest.mock import patch from uuid import uuid1 import pytest from _pytest.fixtures import FixtureRequest from _pytest.python import Metafunc from alchemy_mock.mocking import UnifiedAlchemyMagicMock from faker import Faker from pytest_mock import...