repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
Audio10/Comparte-crite
cride/circles/urls.py
<reponame>Audio10/Comparte-crite """Circles URLs.""" # Django from django.urls import path, include # Django REST Framework from rest_framework.routers import DefaultRouter # Views from .views import circles as circle_views router = DefaultRouter() router.register(r'circles', circle_views.CircleViewSet, basename='c...
andrewp-as-is/django-command-error.py
django_command_error/migrations/0001_initial.py
# Generated by Django 3.1.7 on 2021-06-16 16:52 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Error', fields=[ ('id', models.AutoField(au...
andrewp-as-is/django-command-error.py
setup.py
from setuptools import setup setup( name='django-command-error', version='2021.8.26', packages=[ 'django_command_error', 'django_command_error.management', 'django_command_error.migrations' ] )
andrewp-as-is/django-command-error.py
django_command_error/utils.py
<gh_stars>0 import traceback from django.core.management import get_commands from django.core.management.base import CommandError def getapp(name): try: return get_commands()[name] except KeyError: raise CommandError("Unknown command: %r" % name) def getinstance(command): if isinstance(co...
andrewp-as-is/django-command-error.py
django_command_error/management/base.py
import sys import traceback from django.core.management.base import BaseCommand, CommandError, OutputWrapper from django.core.management.color import color_style, no_style from ..decorators import command_error from ..models import Error class ErrorMixin: def error(self,e,*args,**options): module_name = ...
andrewp-as-is/django-command-error.py
django_command_error/decorators.py
<reponame>andrewp-as-is/django-command-error.py import logging import sys import traceback from .models import Error from .utils import getinstance def command_error(f): def wrapper(command,*args,**options): instance = getinstance(command) module_name = type(instance).__module__ app, name ...
andrewp-as-is/django-command-error.py
django_command_error/apps.py
<filename>django_command_error/apps.py from django.apps import AppConfig class Config(AppConfig): name = 'django_command_error' verbose_name = 'command-error'
andrewp-as-is/django-command-error.py
django_command_error/models.py
__all__ = ['Error'] from django.db import models class Error(models.Model): app = models.TextField() name = models.TextField() sys_argv = models.TextField(null=True,verbose_name='sys.argv') args = models.TextField(null=True) options = models.TextField(null=True) exc_type = models.TextField(v...
andrewp-as-is/django-command-error.py
django_command_error/admin.py
from datetime import date from django.contrib import admin from django.template.defaultfilters import linebreaksbr from django.utils.safestring import mark_safe from django.utils.timesince import timesince from .models import Error class ErrorAdmin(admin.ModelAdmin): list_display = ['id','app','name','sys_argv','...
DChialvi/Python_HYT939
HYT939/HYT939.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import smbus import time import math import logging from enum import IntEnum I2C_BUS = 1 # HYT939 default address HYT939_I2CADDR = 0x28 # HYT939 address, 0x28(40) # Operating Modes HYT939_NORMALMODE = 0x80 # 0x80(128) Send normal mode HYT939_COMMANDMODE ...
DChialvi/Python_HYT939
setup.py
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2021 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includ...
cumulant/eccodes_py3
grib_read.py
# Test to read ICON-EU GRIB2 data witch Eccodes and python3 # By <NAME> # based on examples from ECMWF https://confluence.ecmwf.int/display/ECC/grib_get_keys # changed by <NAME> # aim is to learn Python3 Interface of EcCodes to read GRIB data # example Input GRIB is from Numerical Weather Prediction Model ICON-EU from ...
cabouman/mbircone
demo/demo_3D_shepp_logan.py
import os import numpy as np import mbircone from demo_utils import plot_image, plot_gif, plt_cmp_3dobj """ This script is a demonstration of the 3D qGGMRF reconstruction algorithm. Demo functionality includes * generating a 3D Shepp Logan phantom, and zero-padding it to the size of ROR * generating synthetic sinogr...
cabouman/mbircone
demo/demo_mace3D.py
import os, sys import numpy as np import math import urllib.request import tarfile import mbircone import demo_utils, denoiser_utils os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' """ This script is a demonstration of the mace3D reconstruction algorithm. Demo functionality includes * downloading phantom and denoiser data ...
cabouman/mbircone
mbircone/cone3D.py
<filename>mbircone/cone3D.py import math from psutil import cpu_count import shutil import numpy as np import os import hashlib import mbircone.interface_cy_c as ci import random __lib_path = os.path.join(os.path.expanduser('~'), '.cache', 'mbircone') __namelen_sysmatrix = 20 def _mbircone_lib_path(): """Returns...
cabouman/mbircone
demo/demo_utils.py
<reponame>cabouman/mbircone<filename>demo/demo_utils.py<gh_stars>1-10 import os, sys import numpy as np import matplotlib.pyplot as plt import imageio import urllib.request import tarfile import yaml from PIL import Image from datetime import datetime from datatest import validate, ValidationError def strftime_format...
IChowdhury01/Attachable-Smart-Lock
RPI/src/BluetoothServoController.py
<reponame>IChowdhury01/Attachable-Smart-Lock<gh_stars>1-10 from bluetooth import * import RPi.GPIO as GPIO from Adafruit_PWM_Servo_Driver import PWM
IChowdhury01/Attachable-Smart-Lock
RPI/src/dobby_beta.py
import RPi.GPIO as GPIO import time #5V(red) -> pin 4 #GND(black) -> pin 6 #servo motor -> pin 11 (GPIO17) servoPIN = 11 GPIO.setmode(GPIO.BOARD) GPIO.setup(servoPIN, GPIO.OUT) p = GPIO.PWM(servoPIN, 50) #servo having 20ms cycles, dc=0.5/20 X100 = 2.5% ->90degree p.start(5) #initialization, 0degree try: whi...
hodaa/desgin-patterns
Iterator/index.py
<reponame>hodaa/desgin-patterns def compute_closest_to_zero(ts): if not ts: return 0 else: min = ts[0]; for item in ts: if abs(item) < min: min = item else: if(min == -(item)): min =abs(min) # Write your ...
Amphenol-Borisch-Technologies/Zup-Python-Library
test_Zup.py
<reponame>Amphenol-Borisch-Technologies/Zup-Python-Library """ Zup-Python-Library: control TDK-Lambda™ Zup™ power supplies programmatically via Python™ "TDK", "TDK-Lambda" & "Zup" are registered trademarks of the TDK Corporation. "Python" is a registered trademark of the Python Software Foundation. py...
Amphenol-Borisch-Technologies/Zup-Python-Library
zup_example_usage.py
<filename>zup_example_usage.py<gh_stars>0 """ "TDK", "TDK-Lambda" & "Zup" are registered trademarks of the TDK Corporation. "Python" is a registered trademark of the Python Software Foundation. pySerial Copyrighted by <NAME>. pytest Copyrighted by <NAME> and pytest-dev team. This script Copyrig...
Amphenol-Borisch-Technologies/Zup-Python-Library
Zup.py
<gh_stars>0 """ Zup-Python-Library: control TDK-Lambda™ Zup™ power supplies programmatically via Python™ "TDK", "TDK-Lambda" & "Zup" are registered trademarks of the TDK Corporation. "Python" is a registered trademark of the Python Software Foundation. pySerial Copyrighted by <NAME>. pytest Copyr...
HiroyoshiOgata/test
server.py
#!/usr/bin/python # -*- coding: utf-8 -*- import requests import os from flask import Flask, request, render_template from sklearn import datasets import numpy from PIL import Image import urllib3 import json from cfenv import AppEnv from os.path import join, dirname from dotenv import load_dotenv # 認証情報の読み取り (.env また...
Colin-Fredericks/hx-util
HX Archive Prep 14Mar2018.app/Contents/Resources/SrtRename.py
import sys import os import csv import shutil import argparse import xml.etree.ElementTree as ET from glob import glob instructions = """ To use: python SrtRename.py course_folder (options) Renames the .srt files in a course's /static/ folder to match our original uploaded filenames, as described in a CourseName.tsv ...
Colin-Fredericks/hx-util
SetShowAnswer.py
<filename>SetShowAnswer.py<gh_stars>0 # import XML libraries import xml.etree.ElementTree as ET import sys import os import argparse instructions = """ To use: python3 SetShowAnswer.py show_answer_value path/to/problem/folder show_answer_value can be one of the usual edX set: Always Answered Attempted Closed ...
Colin-Fredericks/hx-util
pdfrw/uncompress.py
# A part of pdfrw (https://github.com/pmaupin/pdfrw) # Copyright (C) 2006-2015 <NAME>, Austin, Texas # Copyright (C) 2012-2015 <NAME> # MIT license -- See LICENSE.txt for details # Copyright (c) 2006, <NAME> # BSD license -- see LICENSE.txt for details ''' A small subset of decompression filters. Should add more later...
Colin-Fredericks/hx-util
link_checker (halted)/linkcheck.py
<reponame>Colin-Fredericks/hx-util # Link checker for edX archives. # Requires lxml, BeautifulSoup 4+, and Requests # Borrows heavily from code on Webucator. # https://www.webucator.com/blog/2016/05/checking-your-sitemap-for-broken-links-with-python/ from __future__ import print_function import requests from requests....
Colin-Fredericks/hx-util
SetVideoDownloads.py
# import XML libraries import xml.etree.ElementTree as ET import sys import os import argparse instructions = """ To use: python3 SetVideoDownloads.py choice path/to/video/folder -options Set your choice as... "true" to allow downloads of videos and transcripts for every video. "false" to disallow downloads of vi...
Colin-Fredericks/hx-util
HXArchive.py
import sys if sys.version_info <= (3, 0): sys.exit('I am a Python 3 script. Run me with python3.') import os import Make_Course_Sheet import json2srt import SrtRename ###################################### # HarvardX Archive Prep Script # # Usage: python3 HXArchive.py path/to/course/folder # Calls multiple script...
Colin-Fredericks/hx-util
HX Archive Prep 28Mar2017.app/Contents/Resources/Make_Course_Sheet.py
<filename>HX Archive Prep 28Mar2017.app/Contents/Resources/Make_Course_Sheet.py<gh_stars>0 import sys if sys.version_info <= (3, 0): sys.exit('I am a Python 3 script. Run me with python3.') import os import argparse from bs4 import BeautifulSoup from lxml import etree from glob import glob import unicodecsv as csv...
Colin-Fredericks/hx-util
HX Archive Prep 26Jan2018.app/Contents/Resources/Make_Course_Sheet.py
import xml.etree.ElementTree as ET import sys import os import unicodecsv as csv # https://pypi.python.org/pypi/unicodecsv/0.14.1 instructions = """ To use: python Make_Course_Sheet.py path/to/course.xml (options) Run this on a course folder, or a course.xml file inside an edX course folder (from export). You will ge...
Colin-Fredericks/hx-util
GetPPTLinks.py
<reponame>Colin-Fredericks/hx-util import sys import os import zipfile import argparse from glob import glob from bs4 import BeautifulSoup import unicodecsv as csv # https://pypi.python.org/pypi/unicodecsv/0.14.1 instructions = """ Usage: python3 GetPPTLinks.py path/to/file/ (options) Extract all hyperlinks from a ...
Colin-Fredericks/hx-util
SetMaxAttempts.py
<reponame>Colin-Fredericks/hx-util<filename>SetMaxAttempts.py # import XML libraries import xml.etree.ElementTree as ET import sys import os import argparse instructions = """ To use: python3 SetMaxAttempts.py number path/to/problem/folder Your options for the number are: - An actual number, which sets all problems...
Colin-Fredericks/hx-util
Adaptive Prep/PrepAdaptiveProblems.py
import os import sys import shutil import argparse import xml.etree.ElementTree as ET import unicodecsv as csv instructions = """ To use: python PrepAdaptiveProblems.py path/to/problem_table.csv path/to/problem_folder (options) Run this on a folder full of edX problems and a CSV file that categorizes these problems i...
vitbaq/zephyr
scripts/kconfig/kconfig.py
#!/usr/bin/env python3 # Modified from: https://github.com/ulfalizer/Kconfiglib/blob/master/examples/merge_config.py import argparse import sys import textwrap from kconfiglib import Kconfig, Symbol, BOOL, STRING, TRISTATE, TRI_TO_STR # Warnings that won't be turned into errors (but that will still be printed), # ide...
ThomasLobker/KRYPTON
contract/krypton.py
# KRYPTON # https://krypton.live/ # Version: 1 (2017-11-16) # Author: <NAME> # Copyright: MediaServe International # License: MIT # KRYPTON is a Smart Contract to provide SIP registration on the NEO blockchain # using a KRYPTON compatible SIP provider. With KRYPTON you can decentralize # SIP trunking and provide real...
tracquangthinh/angr
angr/state_plugins/symbolic_memory.py
<filename>angr/state_plugins/symbolic_memory.py<gh_stars>1-10 from collections import defaultdict import logging import itertools l = logging.getLogger(name=__name__) import claripy from ..storage.memory import SimMemory, DUMMY_SYMBOLIC_READ_VALUE from ..storage.paged_memory import SimPagedMemory from ..storage.mem...
tracquangthinh/angr
angr/analyses/decompiler/structured_codegen.py
<gh_stars>1-10 import logging from ailment import Block, Expr, Stmt from ...sim_type import SimTypeLongLong, SimTypeInt, SimTypeShort, SimTypeChar, SimTypePointer from ...sim_variable import SimVariable, SimTemporaryVariable from .. import Analysis, register_analysis from .region_identifier import MultiNode from .st...
tracquangthinh/angr
angr/analyses/dominance_frontier.py
<reponame>tracquangthinh/angr import networkx from ..utils.graph import compute_dominance_frontier, Dominators from .analysis import Analysis from . import register_analysis class DominanceFrontier(Analysis): """ Computes the dominance frontier of all nodes in a function graph, and provides an easy-to-use i...
tracquangthinh/angr
angr/analyses/decompiler/decompiler.py
from .. import Analysis, AnalysesHub class Decompiler(Analysis): def __init__(self, func, cfg=None): self.func = func self._cfg = cfg self.codegen = None self._decompile() def _decompile(self): if self.func.is_simprocedure: return # convert fun...
tracquangthinh/angr
angr/analyses/stack_pointer_tracker.py
<reponame>tracquangthinh/angr<gh_stars>1-10 # pylint:disable=abstract-method from collections import defaultdict import logging import pyvex from ..knowledge_plugins import Function from ..block import BlockNode from .analysis import Analysis from .forward_analysis import ForwardAnalysis, FunctionGraphVisitor _l ...
tracquangthinh/angr
angr/analyses/reaching_definitions/dataset.py
import logging import operator from .constants import DEBUG from .undefined import Undefined l = logging.getLogger(name=__name__) class DataSet(object): """ This class represents a set of data. Addition and subtraction are performed on the cartesian product of the operands. Duplicate results are remove...
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/base/client.py
<gh_stars>0 from typing import Any from simple_amqp_pubsub.data import Event, Source class PubSubClient: def __init__(self, pubsub: 'BasePubSub', source: Source): self.pubsub = pubsub self.source = source self._source_name = source.name self.events_cache = {} def push(self, ...
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/gevent.py
<filename>simple_amqp_pubsub/gevent.py<gh_stars>0 import traceback from simple_amqp import AmqpChannel, AmqpMsg, AmqpParameters from simple_amqp.gevent import GeventAmqpConnection from simple_amqp_pubsub import Event, Pipe from simple_amqp_pubsub.base import BaseAmqpPubSub class GeventAmqpPubSub(BaseAmqpPubSub): ...
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/encoding.py
import json from simple_amqp import AmqpMsg from .data import Event CONTENT_TYPE_MSGPACK = 'application/msgpack' def encode_event(event: Event) -> AmqpMsg: payload = json.dumps({ 'source': event.source, 'topic': event.topic, 'payload': event.payload, }) payload = payload.encode(...
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/base/__init__.py
from .amqp import BaseAmqpPubSub from .client import PubSubClient from .conn import BasePubSub __all__ = [ 'BasePubSub', 'BaseAmqpPubSub', 'PubSubClient', ]
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/subscriber.py
from .data import Pipe, Source class Subscriber: def __init__(self, pipe: Pipe): self.pipe = pipe self.sources = {} def listen(self, source: Source, topic: str): def decorator(func): self._save_event_handler(source, topic, func) return func return deco...
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/data.py
from typing import Any, List from dataclasses import dataclass, field, replace class Data: def replace(self, **kwargs): return replace(self, **kwargs) @dataclass(frozen=True) class Event(Data): source: str topic: str payload: Any pipe: str = '' retry_count: int = 0 @dataclass(froz...
rudineirk/py-simple-amqp-pubsub
examples/asyncio/master.py
import timeit from asyncio import get_event_loop, set_event_loop_policy, sleep import uvloop from simple_amqp import AmqpParameters from simple_amqp_pubsub import Source from simple_amqp_pubsub.asyncio import AsyncioAmqpPubSub set_event_loop_policy(uvloop.EventLoopPolicy()) pubsub_conn = AsyncioAmqpPubSub( par...
rudineirk/py-simple-amqp-pubsub
examples/asyncio/worker.py
import timeit from asyncio import get_event_loop, set_event_loop_policy, sleep import uvloop from simple_amqp import AmqpParameters from simple_amqp_pubsub import Event, Pipe, Source, Subscriber from simple_amqp_pubsub.asyncio import AsyncioAmqpPubSub set_event_loop_policy(uvloop.EventLoopPolicy()) pubsub_conn = As...
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/consts.py
<filename>simple_amqp_pubsub/consts.py PUBSUB_EXCHANGE = 'events.{name}' PUBSUB_QUEUE = 'events.{name}' RETRY_EXCHANGE_NAME = 'events-retry.{name}' RETRY_QUEUE_NAME = 'events-retry.{time}.{name}' RETRY_DLX_EXCHANGE_NAME = 'events-retry-dlx.{name}'
rudineirk/py-simple-amqp-pubsub
examples/gevent/master.py
from gevent import monkey # isort:skip monkey.patch_all() # isort:skip import timeit # noqa: E402 from gevent import sleep # noqa: E402 from simple_amqp import AmqpParameters # noqa: E402 from simple_amqp_pubsub import Source # noqa: E402 from simple_amqp_pubsub.gevent import GeventAmqpPubSub # noqa: E402 pu...
rudineirk/py-simple-amqp-pubsub
examples/gevent/worker.py
<reponame>rudineirk/py-simple-amqp-pubsub<filename>examples/gevent/worker.py from gevent import monkey # isort:skip monkey.patch_all() # isort:skip import timeit # noqa: E402 from gevent import sleep # noqa: E402 from simple_amqp import AmqpParameters # noqa: E402 from simple_amqp_pubsub import Event, Pipe, Sou...
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/base/conn.py
<gh_stars>0 from abc import ABCMeta from typing import Callable, Dict, Set, Tuple from simple_amqp_pubsub.data import Event, Pipe, Source from simple_amqp_pubsub.log import setup_logger from simple_amqp_pubsub.subscriber import Subscriber from .client import PubSubClient class BasePubSub(metaclass=ABCMeta): CLI...
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/__init__.py
<reponame>rudineirk/py-simple-amqp-pubsub<gh_stars>0 from .data import Event, Pipe, Source from .subscriber import Subscriber __all__ = [ 'Event', 'Pipe', 'Source', 'Subscriber', ]
rudineirk/py-simple-amqp-pubsub
simple_amqp_pubsub/base/amqp.py
from abc import ABCMeta from typing import Dict from simple_amqp import ( AmqpChannel, AmqpConnection, AmqpExchange, AmqpMsg, AmqpParameters, AmqpQueue ) from simple_amqp_pubsub.consts import ( PUBSUB_EXCHANGE, PUBSUB_QUEUE, RETRY_DLX_EXCHANGE_NAME, RETRY_EXCHANGE_NAME, RET...
shyouhei/operators
conanfile.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from conans import ConanFile, CMake class OperatorsConan(ConanFile): name = "operators" description = "C++11 single-header library that provides highly efficient, move aware operators for arithmetic data types" homepage = "https://github.com/taocpp/operators" ...
nat5142/rossby
tests/base_test.py
<filename>tests/base_test.py import unittest from rossby import Rossby import requests class BaseTestClass(unittest.TestCase): rossby = Rossby() session = requests.Session() def plain_request(self, endpoint, params): resp = self.session.get(f"https://api.weather.gov/{endpoint}", params=params) ...
nat5142/rossby
tests/__init__.py
<filename>tests/__init__.py from .endpoints.alerts import TestAlertsEndpoint from .endpoints.glossary import TestGlossaryEndpoint from .endpoints.gridpoints import TestGridpointsEndpoint from .endpoints.icons import TestIconsEndpoint from .endpoints.offices import TestOfficesEndpoint from .endpoints.points import TestP...
nat5142/rossby
tests/endpoints/alerts.py
from tests.base_test import BaseTestClass class TestAlertsEndpoint(BaseTestClass): def test_base_alerts_endpoint(self): params = {'limit': 10} test_against = self.plain_request('alerts', params=params) content = self.rossby.alerts.get_all() # self.assertDictEqual(test_against, c...
nat5142/rossby
tests/endpoints/points.py
from tests.base_test import BaseTestClass class TestPointsEndpoint(BaseTestClass): def test_point(self): params = {} test_against = self.plain_request('points/{point}'.format(point='40.0,-73.0'), params=params) content = self.rossby.points.get_point(point='40.0,-73.0') self.asse...
nat5142/rossby
tests/endpoints/stations.py
from tests.base_test import BaseTestClass class TestStationsEndpoint(BaseTestClass): def test_base_endpoint(self): """Test base /stations endpoint""" assert len(self.rossby.stations.get_all().features) == 2478 def test_get_station_by_id(self): test_against = { "type": "Po...
nat5142/rossby
tests/endpoints/glossary.py
from tests.base_test import BaseTestClass class TestGlossaryEndpoint(BaseTestClass): def test_glossary_endpoint(self): params = {} test_against = self.plain_request('glossary', params=params) content = self.rossby.glossary.get() self.assertDictEqual(test_against, content.json)
nat5142/rossby
tests/endpoints/zones.py
from tests.base_test import BaseTestClass class TestZonesEndpoint(BaseTestClass): def test_base_zones_endpoint_no_params(self): # TODO: Add test with params params = {} test_against = self.plain_request('zones', params=params) content = self.rossby.zones.get() self.asser...
nat5142/rossby
rossby/__init__.py
from .rossby import Rossby
nat5142/rossby
tests/endpoints/products.py
<gh_stars>1-10 from tests.base_test import BaseTestClass import random class TestProductsEndpoint(BaseTestClass): def test_base_products_with_limit_endpoint(self): params = {'limit': 50} test_against = self.plain_request('products', params=params) content = self.rossby.products.get(limit...
nat5142/rossby
tests/special.py
<gh_stars>1-10 from .base_test import BaseTestClass from rossby import Rossby rossby = Rossby() class SpecialCaseTestClass(BaseTestClass): data = rossby.alerts.get_all() def test_default_pagination_limit(self): params = {'limit': 10} test_against = self.plain_request('/alerts', params) ...
nat5142/rossby
rossby/api_config.py
<reponame>nat5142/rossby from collections import namedtuple from functools import partial from rossby.default_response import RossbyResponse response_types = { 'geo+json': 'application/geo+json', 'ld+json': 'application/ld+json', 'dwml': 'application/vnd.noaa.dwml+xml', 'oxml': 'application/vnd.noaa.o...
nat5142/rossby
tests/endpoints/gridpoints.py
<reponame>nat5142/rossby from tests.base_test import BaseTestClass class TestGridpointsEndpoint(BaseTestClass): def test_gridpoints_lat_lon_endpoint(self): params = {} office_id = 'PHI' lon = 40 lat = 73 test_against = self.plain_request(f'gridpoints/{office_id}/{lon},{lat...
nat5142/rossby
rossby/rossby.py
<reponame>nat5142/rossby<gh_stars>1-10 import requests from collections import namedtuple from string import Formatter from urllib.parse import urljoin from rossby.api_config import api_endpoints from rossby.default_response import RossbyResponse class RossbyAPIMeta(type): def __new__(mcs, name, bases, attrs): ...
nat5142/rossby
tests/endpoints/offices.py
from tests.base_test import BaseTestClass class TestOfficesEndpoint(BaseTestClass): def test_office_by_id_endpoint(self): params = {} test_against = self.plain_request('offices/CTP', params=params) content = self.rossby.offices.by_id(office_id='CTP') self.assertDictEqual(test_ag...
nat5142/rossby
tests/endpoints/thumbnails.py
from tests.base_test import BaseTestClass class TestThumbnailsEndpoint(BaseTestClass): def test_thumbnail_by_area_endpoint(self): params = {} test_against = self.plain_request('thumbnails/satellite/PA', params=params) if test_against.get('status') == 500: # TODO: Log/output 5...
nat5142/rossby
setup.py
import setuptools with open('README.md', 'r') as readme: long_description = readme.read() setuptools.setup( name='rossby', version='0.0.3', author='<NAME>', author_email='<EMAIL>', description='A wrapper for the U.S. National Weather Service API', long_description=long_description, lon...
nat5142/rossby
rossby/default_response.py
import builtins import itertools from addict import Dict def format_key(key): strip = key.strip('@') return '{}_'.format(strip) if strip in itertools.chain(dir(builtins)) else strip class RossbyResponse(Dict): def __init__(self, *args, **kwargs): super(RossbyResponse, self).__init__(*args, **kw...
nat5142/rossby
tests/endpoints/icons.py
from tests.base_test import BaseTestClass class TestIconsEndpoint(BaseTestClass): def test_base_icons_endpoint(self): params = {} test_against = self.plain_request('icons', params=params) content = self.rossby.icons.all() self.assertDictEqual(test_against, content.json) def...
Hedgehog57/home-assistant
homeassistant/components/sms/gateway.py
<gh_stars>0 """The sms gateway to interact with a GSM modem.""" import logging import gammu # pylint: disable=import-error, no-member from gammu.asyncworker import ( # pylint: disable=import-error, no-member GammuAsyncWorker, ) _LOGGER = logging.getLogger(__name__) class Gateway: """SMS gateway to interac...
off-grid-block/aca-py-controllers
aries_cloudagent/transport/outbound/ws.py
"""Websockets outbound transport.""" import logging from aiohttp import ClientSession, DummyCookieJar from ...messaging.outbound_message import OutboundMessage from .base import BaseOutboundTransport class WsTransport(BaseOutboundTransport): """Websockets outbound transport class.""" schemes = ("ws", "ws...
off-grid-block/aca-py-controllers
aries_cloudagent/task_processor.py
"""Classes for managing a limited set of concurrent tasks.""" import asyncio import logging import time from typing import Awaitable, Callable LOGGER = logging.getLogger(__name__) async def delay_task(delay: float, task: Awaitable): """Wait a given amount of time before executing an awaitable.""" await asyn...
off-grid-block/aca-py-controllers
demo/runners/client.py
<reponame>off-grid-block/aca-py-controllers # ######################################### # This is for multiple client implementation # ######################################### import base64 import asyncio import argparse import binascii import json import logging import os import sys import json from urllib.parse impo...
off-grid-block/aca-py-controllers
aries_cloudagent/transport/inbound/manager.py
"""Inbound transport manager.""" import logging from .base import ( BaseInboundTransport, InboundTransportConfiguration, InboundTransportRegistrationError, ) from ...classloader import ClassLoader, ModuleLoadError, ClassNotFoundError MODULE_BASE_PATH = "aries_cloudagent.transport.inbound" class Inbound...
off-grid-block/aca-py-controllers
aries_cloudagent/tests/test_dispatcher.py
import asyncio import json from asynctest import TestCase as AsyncTestCase, mock as async_mock from .. import dispatcher as test_module from ..config.injection_context import InjectionContext from ..connections.models.connection_record import ConnectionRecord from ..messaging.agent_message import AgentMessage, AgentM...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_handler.py
<gh_stars>0 import pytest from asynctest import ( mock as async_mock, TestCase as AsyncTestCase, ) from ......messaging.request_context import RequestContext from ......messaging.message_delivery import MessageDelivery from ......messaging.responder import MockResponder from ...messages.presentation import Pr...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/trustping/handlers/tests/test_ping_response_handler.py
import pytest from .....messaging.base_handler import HandlerException from .....messaging.message_delivery import MessageDelivery from .....messaging.request_context import RequestContext from .....messaging.responder import MockResponder from ...handlers.ping_response_handler import PingResponseHandler from ...mess...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/present_proof/v1_0/handlers/tests/test_presentation_proposal_handler.py
import pytest from asynctest import ( mock as async_mock, TestCase as AsyncTestCase, ) from ......messaging.request_context import RequestContext from ......messaging.message_delivery import MessageDelivery from ......messaging.responder import MockResponder from ...messages.presentation_proposal import Prese...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/discovery/routes.py
"""Feature discovery admin routes.""" from aiohttp import web from aiohttp_apispec import docs, response_schema from marshmallow import fields, Schema from ...messaging.protocol_registry import ProtocolRegistry class QueryResultSchema(Schema): """Result schema for the protocol list.""" results = fields.Di...
off-grid-block/aca-py-controllers
aries_cloudagent/messaging/responder.py
<filename>aries_cloudagent/messaging/responder.py<gh_stars>0 """ A message responder. The responder is provided to message handlers to enable them to send a new message in response to the message being handled. """ from abc import ABC, abstractmethod from typing import Union from ..error import BaseError from ..conn...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/problem_report/handler.py
<reponame>off-grid-block/aca-py-controllers """Generic problem report handler.""" from ...messaging.base_handler import BaseHandler, BaseResponder, RequestContext from .message import ProblemReport class ProblemReportHandler(BaseHandler): """Problem report handler class.""" async def handle(self, context: ...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/connections/handlers/connection_response_handler.py
<reponame>off-grid-block/aca-py-controllers """Connection response handler.""" from ....messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ....protocols.trustping.messages.ping import Ping from ..manager import ConnectionManager, ConnectionManagerError from ..messages.connection_response im...
off-grid-block/aca-py-controllers
aries_cloudagent/cache/base.py
<reponame>off-grid-block/aca-py-controllers<gh_stars>1-10 """Abstract base classes for cache.""" import asyncio from abc import ABC, abstractmethod from typing import Any, Sequence, Text, Union from ..error import BaseError class CacheError(BaseError): """Base class for cache-related errors.""" class BaseCach...
off-grid-block/aca-py-controllers
aries_cloudagent/transport/outbound/base.py
"""Base outbound transport.""" from abc import ABC, abstractmethod import asyncio from ...error import BaseError from ...messaging.outbound_message import OutboundMessage from ...stats import Collector class BaseOutboundTransport(ABC): """Base outbound transport class.""" def __init__(self) -> None: ...
off-grid-block/aca-py-controllers
aries_cloudagent/issuer/indy.py
"""Indy issuer implementation.""" import json import logging import indy.anoncreds from ..error import BaseError from .base import BaseIssuer from .util import encode class IssuerError(BaseError): """Generic issuer error.""" class IndyIssuer(BaseIssuer): """Indy issuer class.""" def __init__(self, ...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/routing/manager.py
<filename>aries_cloudagent/protocols/routing/manager.py<gh_stars>1-10 """Routing manager classes for tracking and inspecting routing records.""" import json from typing import Sequence from ...config.injection_context import InjectionContext from ...error import BaseError from ...messaging.util import time_now from ....
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/connections/tests/test_manager.py
from asynctest import TestCase as AsyncTestCase from ....config.injection_context import InjectionContext from ....connections.models.connection_record import ConnectionRecord from ....connections.models.diddoc import DIDDoc, PublicKey, PublicKeyType, Service from ....messaging.message_delivery import MessageDelivery ...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/introduction/base_service.py
"""Introduction service base classes.""" from abc import ABC, abstractmethod from ...error import BaseError from ...messaging.base_context import BaseRequestContext from .messages.invitation import Invitation class IntroductionError(BaseError): """Generic introduction service error.""" class BaseIntroduction...
off-grid-block/aca-py-controllers
aries_cloudagent/messaging/plugin_registry.py
"""Handle registration of plugin modules for extending functionality.""" import logging from collections import OrderedDict from types import ModuleType from typing import Sequence from ..classloader import ClassLoader, ModuleLoadError from ..config.injection_context import InjectionContext from ..messaging.protocol_...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_ack_handler.py
import pytest from asynctest import ( mock as async_mock, TestCase as AsyncTestCase, ) from ......messaging.request_context import RequestContext from ......messaging.message_delivery import MessageDelivery from ......messaging.responder import MockResponder from ...messages.credential_ack import CredentialAc...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/credentials/tests/test_routes.py
<filename>aries_cloudagent/protocols/credentials/tests/test_routes.py<gh_stars>1-10 from asynctest import TestCase as AsyncTestCase from asynctest import mock as async_mock from .. import routes as test_module from ....storage.error import StorageNotFoundError class TestCredentialRoutes(AsyncTestCase): async de...
off-grid-block/aca-py-controllers
aries_cloudagent/protocols/issue_credential/v1_0/handlers/tests/test_credential_proposal_handler.py
import pytest from asynctest import ( mock as async_mock, TestCase as AsyncTestCase, ) from ......messaging.request_context import RequestContext from ......messaging.message_delivery import MessageDelivery from ......messaging.responder import MockResponder from ...messages.credential_proposal import Credent...
off-grid-block/aca-py-controllers
demo/runners/acme.py
import argparse import asyncio import json import logging import os import sys from uuid import uuid4 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # noqa from aiohttp import web, ClientSession, DummyCookieJar from aiohttp_apispec import docs, response_schema, setup_aiohttp_apispec impor...
off-grid-block/aca-py-controllers
aries_cloudagent/tests/test_delivery_queue.py
<reponame>off-grid-block/aca-py-controllers import asyncio from unittest import mock, TestCase from aries_cloudagent.delivery_queue import DeliveryQueue from asynctest import TestCase as AsyncTestCase from asynctest import mock as async_mock from aries_cloudagent import messaging from aries_cloudagent.connections.mod...