repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
CristianContrera95/strict_df | tests/test_utils.py | import pytest
from src.strictdf.utils.dtypes import str_check_float, str_check_bool, str_check_int
@pytest.mark.parametrize(
'string, expected',
[
("", False),
(".", False),
("2.0", False),
("1.5", False),
("a", False),
("adsada", False),
("0.5", False),... |
CristianContrera95/strict_df | setup.py | <reponame>CristianContrera95/strict_df
"""
Module setup for installation
"""
import os
from setuptools import setup
def load_requirements(fname):
"""Turn requirements.txt into a list"""
requirements = []
if os.path.exists(fname):
with open(fname, "r") as fp:
requirements = [line.strip... |
CristianContrera95/strict_df | tests/test_strict_df.py | <reponame>CristianContrera95/strict_df
import pytest
import pandas as pd
import numpy as np
from src.strictdf import StrictDataFrame
@pytest.mark.parametrize(
'df, expected',
[
(pd.DataFrame({}), pd.DataFrame({})),
(pd.DataFrame({
'col1': np.arange(10),
'col2': list(ra... |
CristianContrera95/strict_df | src/strictdf/__main__.py | print("strictdf version 0.1.0")
|
pexip/os-python-treq | setup.py | <gh_stars>0
from setuptools import find_packages, setup
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Framework :: Twisted",
"Programming Language :: Python",
... |
narayananmtrs/College-Project | main.py | <filename>main.py
import os
import cv2
import uuid
import time
import click
import pickle
import face_recognition
def prepare_image(cameraImage):
image_encoded = face_recognition.face_encodings(cameraImage)
if(len(image_encoded) == 0):
print("Error : Face features cannot be extracted from this file."... |
bcbernardo/Zenity | setup.py | <reponame>bcbernardo/Zenity<gh_stars>0
# -*- coding: utf-8 -*-
"""
Zenity setup script.
"""
__doc__="""zenity - display dialogs with python
DESCRIPTION
zenity is a Python library that will display GTK+ dialogs using zanity
tool, and return (eitherin the return code, or on standard output) the
users input. This allo... |
bcbernardo/Zenity | zenity.py | """Zenity - display dialogs with python
DESCRIPTION
zenity is a Python library that will display GTK+ dialogs using zanity
tool, and return (eitherin the return code, or on standard output) the
users input. This allows you to present information, and ask for infor
mation from the user.
For example, zenity.show(zenit... |
bcbernardo/Zenity | test.py | <reponame>bcbernardo/Zenity
import zenity
import time
t = zenity.show("progress",writeable=True)
|
russetrob/nail | examples/dns_cpp/dns/bench/visualize.py | <reponame>russetrob/nail<filename>examples/dns_cpp/dns/bench/visualize.py<gh_stars>100-1000
#!/usr/bin/python
import sys
import os
import numpy as np
from pylab import *
def labelstr(path):
return os.path.splitext(path)[0]
files = sys.argv
del files[0]
data = []
labels = []
for file in files:
print(file)
... |
fstrnad/pyunicorn | examples/tutorials/spatial_networks.py | <reponame>fstrnad/pyunicorn
import numpy as np
import matplotlib.pyplot as plt
from pyunicorn.core import spatial_network as sp
from pyunicorn.core.grid import Grid
"""
This example code offers an overview of the spatial network code for GeoModel1
and GeoModel2 can be called. Furthermore, with the python versions ... |
fstrnad/pyunicorn | pyunicorn/core/spatial_network.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of pyunicorn.
# Copyright (C) 2008--2019 <NAME> and pyunicorn authors
# URL: <http://www.pik-potsdam.de/members/donges/software>
# License: BSD (3-clause)
import igraph
import sys
from .geo_network import GeoNetwork
from .network import NetworkError
from p... |
wiredlab/orbit | orbit/utilities.py | def calc_year(year):
twentieth = ('6', '7', '8', '9')
twenty_first = ('0', '1', '2', '3', '4', '5')
if year.startswith(twentieth):
return "19%s" % year
elif year.startswith(twenty_first):
return "20%s" % year
else:
return year |
wiredlab/orbit | orbit/__init__.py | <reponame>wiredlab/orbit
__all__ = ["satellite", "tle", "utilities"]
from .satellite import satellite |
wiredlab/orbit | setup.py | from setuptools import setup
setup(name='orbit',
version='0.2',
description='Gives current information about orbital objects of interest',
url='http://github.com/seanherron/orbit',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
long_description=open('README.txt').read... |
wiredlab/orbit | orbit/tle.py | <filename>orbit/tle.py<gh_stars>1-10
import math
from lxml import html
import requests
import requests_cache
import ephem
from . import utilities
requests_cache.install_cache(expire_after=86400)
def get(catnr):
page = html.fromstring(requests.get('http://www.celestrak.com/cgi-bin/TLE.pl?CATNR=%s' % catnr).text)... |
wiredlab/orbit | orbit/satellite.py | <filename>orbit/satellite.py
from math import degrees
from . import tle, utilities
class satellite:
def __init__(self,catnr):
self.tle_raw = tle.get(catnr)
self.tle_parsed = tle.parse(self.tle_raw[0], self.tle_raw[1], self.tle_raw[2])
def name(self):
return self.tle_raw[0].strip()... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0017_auto_20201118_2308.py | <filename>reddit_dashboard/migrations/0017_auto_20201118_2308.py
# Generated by Django 3.1.2 on 2020-11-18 20:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0016_auto_20201118_2255'),
]
operations = [
migrations.... |
tarikyayla/reddit_dashboard | reddit_dashboard/redis_connection.py | import redis
from reddit_dashboard.settings import REDIS_DATABASE, REDIS_HOST, REDIS_PORT
REDIS_CONNECTION = redis.Redis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DATABASE)
class RedisConsts(object):
DISCORD_PUSH = 'discord:push'
SERVER_PUSH = 'django:model'
|
tarikyayla/reddit_dashboard | reddit_dashboard/utils/user_utils.py | from rest_framework.authtoken.models import Token
from reddit_dashboard.models import DashboardUser
from django.conf import settings
def get_default_user_token():
user = DashboardUser.objects.filter(username=settings.USERNAME).first()
token = None
if not user:
user = DashboardUser.objects.create_... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0006_auto_20201029_1917.py | # Generated by Django 3.1.2 on 2020-10-29 16:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0005_dashboarduser_subreddits'),
]
operations = [
migrations.AlterField(
model_name='dashboarduser',
... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0003_dashboarduser_reddit_username.py | <reponame>tarikyayla/reddit_dashboard
# Generated by Django 3.1.2 on 2020-10-17 18:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0002_auto_20201017_1650'),
]
operations = [
migrations.AddField(
model... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0016_auto_20201118_2255.py | <gh_stars>0
# Generated by Django 3.1.2 on 2020-11-18 19:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0015_auto_20201118_2250'),
]
operations = [
migrations.RenameField(
model_name='sentposts',
... |
tarikyayla/reddit_dashboard | reddit_dashboard/celery_loader.py | <filename>reddit_dashboard/celery_loader.py<gh_stars>0
import os
from celery import Celery
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "reddit_dashboard.settings")
app = Celery("reddit_dashboard",
include=['reddit_dashboard.tasks'])
app.config_from_object('django.conf:settings', namespace='CELERY')
|
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0002_auto_20201017_1650.py | # Generated by Django 3.1.2 on 2020-10-17 13:50
import django.contrib.auth.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0001_initial'),
]
operations = [
migrations.AlterModelManagers(
name='dashboarduse... |
tarikyayla/reddit_dashboard | api/views/consts.py | <filename>api/views/consts.py
GET_FROM_REDDIT = 1
|
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0015_auto_20201118_2250.py | # Generated by Django 3.1.2 on 2020-11-18 19:50
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0014_posts_subreddit'),
]
operations = [
migrations.AddFie... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0009_auto_20201114_2009.py | # Generated by Django 3.1.2 on 2020-11-14 17:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0008_auto_20201030_0021'),
]
operations = [
migrations.RemoveField(
model_n... |
tarikyayla/reddit_dashboard | api/serializers/discord_serializers.py | <filename>api/serializers/discord_serializers.py
from rest_framework import serializers
from reddit_dashboard.models import DiscordServer, TextChannel
from api.serializers.reddit_serializers import SubredditSerializer
class TextChannelSerializer(serializers.ModelSerializer):
following_subreddits = SubredditSeria... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0004_discordserver_subreddit.py | # Generated by Django 3.1.2 on 2020-10-18 14:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0003_dashboarduser_reddit_username'),
]
operations = [
... |
tarikyayla/reddit_dashboard | api/urls.py | from django.urls import path, include
from api.views.public import api_check, get_api_token
from api.views import user, discord
from rest_framework.routers import DefaultRouter
router = DefaultRouter(trailing_slash=False)
router.register(r'subreddits', user.Subreddits, basename="subreddits")
router.register(r'text-c... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0018_auto_20201122_1313.py | # Generated by Django 3.1.2 on 2020-11-22 10:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0017_auto_20201118_2308'),
]
operations = [
migrations.AlterModelOptions(
name='posts',
options={'verbos... |
tarikyayla/reddit_dashboard | api/serializers/reddit_serializers.py | <reponame>tarikyayla/reddit_dashboard
from rest_framework import serializers
from reddit_dashboard.models import Subreddit
class SubredditSerializer(serializers.ModelSerializer):
class Meta:
model = Subreddit
exclude = ('description',)
|
tarikyayla/reddit_dashboard | api/migrations/0001_initial.py | <reponame>tarikyayla/reddit_dashboard
# Generated by Django 3.1.2 on 2020-10-17 11:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(set... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0010_auto_20201114_2015.py | <gh_stars>0
# Generated by Django 3.1.2 on 2020-11-14 17:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0009_auto_20201114_2009'),
]
operations = [
migrations.AlterField(
model_name='dashboarduser',
... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0007_subreddit_banner_img.py | <filename>reddit_dashboard/migrations/0007_subreddit_banner_img.py
# Generated by Django 3.1.2 on 2020-10-29 21:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0006_auto_20201029_1917'),
]
operations = [
migration... |
tarikyayla/reddit_dashboard | api/reddit/manager.py | <reponame>tarikyayla/reddit_dashboard
import praw
from praw.exceptions import PRAWException
from django.conf import settings
from reddit_dashboard.models import Subreddit
from reddit_dashboard.models import DashboardUser
import json
class RedditManager:
instance = None
def __init__(self):
self.instan... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0005_dashboarduser_subreddits.py | # Generated by Django 3.1.2 on 2020-10-18 14:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0004_discordserver_subreddit'),
]
operations = [
migrations.AddField(
model_name='dashboarduser',
... |
tarikyayla/reddit_dashboard | reddit_dashboard/redis_serializers.py | <reponame>tarikyayla/reddit_dashboard
from reddit_dashboard.models import DashboardUser, TextChannel, DiscordServer, REDIS_CONNECTION, RedisConsts
import json
class RedisModelSerializer:
def __init__(self, server_id=None, server_name=None):
self.payload = {
"server_id": server_id,
"... |
tarikyayla/reddit_dashboard | reddit_dashboard/migrations/0011_discordserver_code.py | <reponame>tarikyayla/reddit_dashboard
# Generated by Django 3.1.2 on 2020-11-14 18:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit_dashboard', '0010_auto_20201114_2015'),
]
operations = [
migrations.AddField(
model... |
tarikyayla/reddit_dashboard | discord_bot/bot.py | <gh_stars>0
import discord
from discord.ext import tasks
import redis
import json
from asgiref.sync import sync_to_async
from reddit_dashboard.redis_connection import REDIS_CONNECTION, RedisConsts
from reddit_dashboard.redis_serializers import RedisModelSerializer
REDIS_KEY = RedisConsts.DISCORD_PUSH
client = discord... |
tarikyayla/reddit_dashboard | reddit_dashboard/settings.py | <gh_stars>0
"""
Django settings for reddit_dashboard project.
Generated by 'django-admin startproject' using Django 3.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settin... |
tarikyayla/reddit_dashboard | api/migrations/0002_auto_20201018_1714.py | <filename>api/migrations/0002_auto_20201018_1714.py
# Generated by Django 3.1.2 on 2020-10-18 14:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='subreddi... |
tarikyayla/reddit_dashboard | api/views/discord.py | <gh_stars>0
from reddit_dashboard.models import DiscordServer, Subreddit, TextChannel, DashboardUser
from api.serializers.discord_serializers import TextChannelSerializer, TextChannelCreateSerializer, \
TextChannelFollowSerializer
from rest_framework.views import APIView
from rest_framework.viewsets import ModelVie... |
tarikyayla/reddit_dashboard | api/exceptions/validation_exception.py | from rest_framework.exceptions import APIException
class ValidationException(APIException):
status_code = 500
validation_key = ""
reason = ""
def __init__(self, key, reason, status_code=500):
self.status_code = status_code
self.detail = {"success": False, "reason": reason, "key": key}... |
tarikyayla/reddit_dashboard | reddit_dashboard/management/commands/get_token.py | <gh_stars>0
from django.core.management import BaseCommand
from reddit_dashboard.utils.user_utils import get_default_user_token
from reddit_dashboard.tasks import get_hot_posts
from discord_bot.bot import client
from discord import TextChannel
from reddit_dashboard.settings import DISCORD_BOT_TOKEN
class Command(BaseCo... |
tarikyayla/reddit_dashboard | reddit_dashboard/__init__.py | import logging
from .celery_loader import app as celery_app
__all__ = ('celery_app',)
logger = logging.getLogger(name="reddit_dashboard")
|
tarikyayla/reddit_dashboard | api/views/user.py | from rest_framework.views import APIView
from rest_framework import generics, viewsets
from api.responses import SUCCESS_RESPONSE, FAIL_RESPONSE
from api.reddit.manager import reddit_manager, RedditManager
from api.serializers import StandardResultsSetPagination
from reddit_dashboard.models import Subreddit
from reddit... |
tarikyayla/reddit_dashboard | reddit_dashboard/management/commands/run_bot.py | from django.core.management import BaseCommand
from discord_bot.bot import client
from reddit_dashboard.settings import DISCORD_BOT_TOKEN
class Command(BaseCommand):
help = "To run discord bot"
def handle(self, *args, **options):
client.run(DISCORD_BOT_TOKEN)
|
tarikyayla/reddit_dashboard | reddit_dashboard/models.py | <filename>reddit_dashboard/models.py
from django.contrib.auth.models import AbstractBaseUser, UserManager
from django.db import models
from django.utils.timezone import now
from django.conf import settings
from reddit_dashboard.redis_connection import REDIS_CONNECTION, RedisConsts
import json
class DashboardUser(Abst... |
tarikyayla/reddit_dashboard | api/views/public.py | from django.shortcuts import render
from django.http.response import JsonResponse
from django.contrib.auth.decorators import login_required
from reddit_dashboard.utils.user_utils import get_default_user_token
# Create your views here.
def api_check(request):
return JsonResponse({"status": True})
def get_api_tok... |
tarikyayla/reddit_dashboard | api/permissions.py | <reponame>tarikyayla/reddit_dashboard
from rest_framework import permissions
class OnlyAnon(permissions.BasePermission):
message = "Already logged in!"
def has_permission(self, request, view):
return not request.user.is_authenticated |
tarikyayla/reddit_dashboard | reddit_dashboard/views.py | <reponame>tarikyayla/reddit_dashboard<gh_stars>0
from django.shortcuts import render, redirect
from django.views.decorators.csrf import ensure_csrf_cookie
from api.reddit.manager import reddit_manager
from django.http.response import HttpResponseNotFound, HttpResponse, HttpResponseRedirect
from reddit_dashboard.models ... |
tarikyayla/reddit_dashboard | api/responses.py | <reponame>tarikyayla/reddit_dashboard
from rest_framework import status
from rest_framework.response import Response
from django.conf import settings
SUCCESS_RESPONSE = Response({
"success": True
}, status=status.HTTP_200_OK)
def FAIL_RESPONSE(detail=None):
resp = {
"success": False,
}
if se... |
tarikyayla/reddit_dashboard | reddit_dashboard/tasks.py | <reponame>tarikyayla/reddit_dashboard
from celery.task import periodic_task, task
from celery.schedules import crontab
from datetime import timedelta
from reddit_dashboard.models import TextChannel, Posts
from api.reddit.manager import reddit_manager
from reddit_dashboard.redis_connection import RedisConsts, REDIS_CONN... |
tarikyayla/reddit_dashboard | reddit_dashboard/admin.py | from django.contrib import admin
from reddit_dashboard.models import DashboardUser, Subreddit, SentPosts, Posts, DiscordServer, TextChannel
admin.site.register(DashboardUser)
admin.site.register(Subreddit)
admin.site.register(SentPosts)
admin.site.register(Posts)
admin.site.register(DiscordServer)
admin.site.register(... |
tarikyayla/reddit_dashboard | api/serializers/user_serializers.py | from rest_framework import serializers
from api.exceptions.validation_exception import ValidationException
from django.contrib.auth import login, authenticate, checks
from reddit_dashboard.models import DashboardUser
|
Alexis-ba6/Z-WaterHeater | RPi.py | <reponame>Alexis-ba6/Z-WaterHeater<gh_stars>1-10
class gpio:
def __getattr__(self, name):
def t(*args):
return None
return t
GPIO = gpio()
|
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/control/controlSet.py | <gh_stars>1-10
from flask import request
from Z_WH.api.middlewares import response, authentification
from Z_WH.services import outputManager
@response.json
@authentification.checkUserKey
def setControlState(**kwargs):
mode = kwargs['mode']
groupId = request.args.get('groupId')
if mode == 'AUTO':
... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/outGroup/groupAdd.py |
from Z_WH.api.middlewares import authentification, response, schema
from Z_WH.services import groupManager
from Z_WH.services.output import GroupManagerError
from Z_WH.config.output import AVAILABLE_OUTPUTS
AVAILABLE_OUTPUTS_ID = [availableOutput[1] for availableOutput in AVAILABLE_OUTPUTS]
@response.json
@authent... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/token/code.py | from Z_WH.services import verificationCodeManager
from Z_WH.api.middlewares import response, schema, authentification
@response.json
def generateCodeCtrl():
valid_time = 6
verificationCodeManager.generateCode(60)
return {
'message': 'Code generated !',
'validTime': valid_time
}, 200
... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/timeSlot/timeSlotUpdate.py | <gh_stars>1-10
from typing import List
from Z_WH.api.middlewares import authentification, response, schema
from Z_WH.tools.time import ISO_TIME_PATTERN
from Z_WH.services import autoTimeSlotManager, groupManager
from Z_WH.services.autoTimeSlot import TimeSlot
@response.json
@authentification.checkUserKey
@schema.sch... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/settings/settingsTempSaver.py | <reponame>Alexis-ba6/Z-WaterHeater<gh_stars>1-10
from Z_WH.api.middlewares import response, schema, authentification
from Z_WH.services import tempSaverManager
@response.json
@authentification.checkUserKey
def getTempSaverSettings(**kwargs):
return tempSaverManager.getSettings(), 200
@response.json
@authentifi... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/settings/settingsMail.py |
from Z_WH.api.middlewares import response, schema, authentification
from Z_WH.services import mailManager
@response.json
@authentification.checkUserKey
def getMailSettings(**kwargs):
return mailManager.getSettings(), 200
@response.json
@authentification.checkUserKey
@schema.schemaValidator(mailManager.getSetti... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/auth/key.py | from Z_WH.api.middlewares import response, authentification
from Z_WH.services import userManager
@response.json
@authentification.checkUserKey
def regenerateKeyCtrl(**kwargs):
logKey = userManager.regenerateKey(kwargs['keyId'])
return {
'keyId': logKey.id,
'newKey': logKey.key
}, 200
@r... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/settings/settingsOutput.py | <filename>Z_WH/api/controllers/settings/settingsOutput.py
from Z_WH.api.middlewares import response, schema, authentification
from Z_WH.services import outputManager
@response.json
@authentification.checkUserKey
def getTempSaverSettings(**kwargs):
return outputManager.getSettings(), 200
@response.json
@authent... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/control/controlGet.py |
from Z_WH.api.middlewares import response, authentification
from Z_WH.services import outputManager
@response.json
@authentification.checkUserKey
def getControlOutputInfo(**kwargs):
return outputManager.getInfoControl(), 200
|
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/timeSlot/timeSlotGet.py | from Z_WH.api.middlewares import authentification, response
from Z_WH.services import autoTimeSlotManager
@response.json
@authentification.checkUserKey
def getTimeSlotCtrl(**kwargs):
return {
'timeSlots': [{
'id': timeSlot.id,
'groupIp': timeSlot.id,
'start': timeSlot.s... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/__init__.py | from .router.auth import authRouter
from .router.token import tokenRouter
from .router.user import userRouter
from .router.timeSlots import timeSlotRouter
from .router.outGroup import outGroupRouter
from .router.temperature import temperatureRouter
from .router.tempSensor import tempSensorRouter
from .router.settings i... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/temperature/tempGetDay.py | import datetime
from flask import request
from Z_WH.api.middlewares import response, authentification
from Z_WH.services import tempSaverManager
@response.json
@authentification.checkUserKey
def getTempDayCtrl(**kwargs):
date = datetime.date.today()
dateArg = request.args.get('date')
if dateArg:
t... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/tempSensors/tempSensorUpdate.py | <reponame>Alexis-ba6/Z-WaterHeater<gh_stars>1-10
from Z_WH.api.middlewares import authentification, response, schema
from Z_WH.services import tempSensorManager
from Z_WH.services.tempSensor import TempSensorManagerError
@response.json
@authentification.checkUserKey
@schema.schemaValidator({
'type': 'object',
... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/settings/settingsTempLimit.py |
from Z_WH.api.middlewares import response, authentification, schema
from Z_WH.services import tempLimitManager
from Z_WH.services.tempSensor import TempSensorManagerError
@response.json
@authentification.checkUserKey
def getTempLimitSettings(**kwargs):
return tempLimitManager.getSettings(), 200
@response.json
... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/auth/logout.py | from Z_WH.api.middlewares import response, authentification
from Z_WH.services import userManager
@response.json
@authentification.checkUserKey
def logoutCtrl(**kwargs):
userManager.deleteKey(kwargs['keyId'])
return {
'message': 'Logout successfully !'
}, 200
|
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/timeSlot/timeSlotAdd.py | <gh_stars>1-10
from typing import List
from Z_WH.api.middlewares import authentification, response, schema
from Z_WH.tools.time import ISO_TIME_PATTERN
from Z_WH.services import autoTimeSlotManager
from Z_WH.services.autoTimeSlot import TimeSlot
@response.json
@authentification.checkUserKey
@schema.schemaValidator({... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/tempSensors/tempSensorGet.py |
from Z_WH.api.middlewares import authentification, response
from Z_WH.services import tempSensorManager
@response.json
@authentification.checkUserKey
def getSensorsCtrl(**kwargs):
return {
'sensors': tempSensorManager.getSensorsInfo()
}, 200
|
Alexis-ba6/Z-WaterHeater | Z_WH/__init__.py | from os import getenv
from dotenv import load_dotenv
from .api import app
from .config import DEBUG
from .services import initAllServices, notificationManager
from .services.notification import Notification
from .tools.schedule import run_continuously
load_dotenv()
def setup():
run_continuously()
initAllS... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/app.py | <gh_stars>1-10
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
app.config['debug'] = True
app.config['CORS_HEADERS'] = True
CORS(app)
|
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/auth/login.py | from flask import request
from Z_WH.api.middlewares import response, schema
from Z_WH.services import userManager
@response.json
@schema.schemaValidator({
'type': 'object',
'properties': {
'email': {
'type': 'string'
},
'password': {
'type': 'string'
}
... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/outGroup/groupDelete.py | <filename>Z_WH/api/controllers/outGroup/groupDelete.py<gh_stars>1-10
from Z_WH.api.middlewares import authentification, response
from Z_WH.services import groupManager
from Z_WH.services.output import GroupManagerError
@response.json
@authentification.checkUserKey
def deleteGroupCtrl(**kwargs):
try:
grou... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/timeSlot/timeSlotDelete.py | from Z_WH.api.middlewares import authentification, response
from Z_WH.services import autoTimeSlotManager
@response.json
@authentification.checkUserKey
def deleteTimeSlotCtrl(**kwargs):
autoTimeSlotManager.deleteTimeSlot(kwargs['slotId'])
return {
'message': 'Time slot deleted !'
}, 200
|
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/outGroup/groupGet.py | <filename>Z_WH/api/controllers/outGroup/groupGet.py
from Z_WH.services import groupManager
from Z_WH.api.middlewares import response, authentification
@response.json
@authentification.checkUserKey
def getGroupCtrl(**kwargs):
return {
'outGroups': [
{
'id': group.id,
... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/outGroup/groupUpdate.py | <reponame>Alexis-ba6/Z-WaterHeater
from Z_WH.api.middlewares import authentification, response, schema
from Z_WH.services import groupManager
from Z_WH.services.output import GroupManagerError
from Z_WH.config.output import AVAILABLE_OUTPUTS
AVAILABLE_OUTPUTS_ID = [availableOutput[1] for availableOutput in AVAILABLE... |
Alexis-ba6/Z-WaterHeater | Z_WH/api/controllers/users/userGet.py | <filename>Z_WH/api/controllers/users/userGet.py
from Z_WH.api.middlewares import authentification, response
from Z_WH.services import userManager
@response.json
@authentification.checkUserKey
def getUser(**kwargs):
return {
'email': userManager.email
}, 200
|
ScottSoren/EC_MS | src/EC_MS/utils/kinetic_models.py | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 23 16:03:33 2020
@author: scott
"""
import numpy as np
from scipy.optimize import minimize
from scipy.integrate import odeint
from scipy.interpolate import interp1d
def carbonic_ode(S, t, pars):
"""
Equations from Scott's Thesis page 53
"""
... |
ScottSoren/EC_MS | src/EC_MS/Chips.py | <filename>src/EC_MS/Chips.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 22 15:26:33 2017
@author: scott
"""
from __future__ import print_function, division
import os
import numpy as np
from matplotlib import pyplot as plt
from . import Chem
from .Molecules import Molecule
from .Object_Fil... |
ScottSoren/EC_MS | _tests_/29C10_capillary_equation/testing_cap.py | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 10 15:34:09 2020
@author: scott
"""
import numpy as np
from matplotlib import pyplot as plt
from EC_MS import Chip, Chem
chip = Chip()
print("design length = " + str(chip.l_cap * 1e3) + " mm")
T0 = 273.15
T_vec = np.linspace(0, 100, 101) + T0
fig, ax = plt.subplots... |
ScottSoren/EC_MS | src/EC_MS/converters.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 5 11:39:18 2021
@author: scott
"""
import json, re
from .Molecules import Molecule
def mdict_from_SI2020_calibration_file(calibration_file):
"""Return a molecule dict from an old Spectro Inlets calibration file"""
mdict = {}
with open(calibration_file, ... |
ScottSoren/EC_MS | src/EC_MS/Plotting.py | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 28 19:07:45 2016
Most recently edited: 17B21
@author: scott
"""
from matplotlib import pyplot as plt
from matplotlib import gridspec
import numpy as np
import os
# from mpl_toolkits.axes_grid1 import make_axes_locatable
from .EC import sync_metadata, select_cycles
fro... |
ScottSoren/EC_MS | src/EC_MS/preferences/colors.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 16 10:07:44 2017
@author: scott
"""
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import colors
ColorConverter = colors.ColorConverter
plt.close("all")
colorlist = list(colors.cnames.items())
ourcolors_0 = {
"M2": "... |
ScottSoren/EC_MS | src/EC_MS/Object_Files.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 1 22:28 2016
@author: scott
[
20B14:
This module basically implements my own version of JSON, which I did not
know about when I wrote it. It is in ToDo.txt to change uses of Object_Files
to uses of JSON.
Because:
Simple is better than comp... |
ScottSoren/EC_MS | src/EC_MS/utils/icpms.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 5 15:33:05 2019
@author: scott
"""
import re
import numpy as np
from matplotlib import pyplot as plt
unit_to_ppb = {
"ppt": 1e-3,
"ng/l": 1e-3,
"ppb": 1,
"ug/l": 1,
"ppm": 1000,
"mg/l": 1000,
}
float_match = "[-]?\d+[\.]?\... |
ScottSoren/EC_MS | src/EC_MS/Combining.py | <filename>src/EC_MS/Combining.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 19 10:40:46 2016
@author: Scott
This is the core file of the package. Includes functions for combining datasets.
"""
# make python2-compatible:
from __future__ import print_function
from __future__ import division
import time
import re
... |
ScottSoren/EC_MS | _tests_/20C02_Spectrum_demo/Spectrum_class_demo.py | <reponame>ScottSoren/EC_MS
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 20 19:08:46 2020
@author: scott
"""
import os
import numpy as np
from matplotlib import pyplot as plt
from EC_MS import Spectrum
plt.close("all")
"""
This script demonstrates the Spectrum class. All its methods are quite simple,
except for the... |
ScottSoren/EC_MS | src/EC_MS/Calibration.py | <filename>src/EC_MS/Calibration.py
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 14 16:50:10 2016
Most recently edited: 16J27
@author: scott
"""
from __future__ import division, print_function
import os, sys, pickle
import numpy as np
from matplotlib import pyplot as plt
# then we use relative import
from . impo... |
ScottSoren/EC_MS | _tests_/20C02_Spectrum_demo/Spectra_class_demo.py | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 20 19:08:46 2020
@author: scott
This example is pending more writing in the Zilien.py module and its integration
with the Spectra class. You will have to wait.
"""
import os
import numpy as np
from matplotlib import pyplot as plt
from EC_MS import Spectra
plt.close("al... |
ScottSoren/EC_MS | src/EC_MS/Quantification.py | <reponame>ScottSoren/EC_MS
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 14 13:44:31 2016
@author: scott
"""
from __future__ import print_function, division
import os
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import curve_fit
from .Molecules import Molecule
from .Combining import ... |
ScottSoren/EC_MS | src/EC_MS/Data_Importing.py | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 10 03:17:41 2017
@author: scott
"""
"""
This module is thought of as a set of high-level functions that can do
switching between file types and combining of multiple files.
TODO:
Low-level functions (many of them having to do with ti... |
ScottSoren/EC_MS | src/EC_MS/MS.py | <reponame>ScottSoren/EC_MS
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 14 10:28:25 2020
Peak class copied from EC_Xray commit 13b3dbf
@author: scott
"""
import os, re
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import curve_fit
data_directory = os.path.dirname(os.path.realpath(__f... |
ScottSoren/EC_MS | src/EC_MS/SPEC.py | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 9 15:58:57 2020
@author: scott
This module contains stuff that was copied into Data_Importing from EC_Xray.
It should probably just be removed from EC_MS altogether.
"""
import re
from .parsing_tools import (
get_creation_timestamp,
timetag_to_timestamp,
... |
ScottSoren/EC_MS | src/EC_MS/Potentiostat.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 11 14:55:48 2017
@author: murems
"""
import os, codecs, io
import numpy as np
U_lines = ["Ei (V)", "E1 (V)", "E2 (V)", "Ef (V)", "EL (V)"]
check_lines = ["vs."]
class SettingsFile:
def __init__(
self, name, file_name=None, RE_vs_RHE=None, settings={}, verb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.