repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
fxdemolisher/frano
frano/main/models.py
<reponame>fxdemolisher/frano # Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. import random import string from datetime import datetime from django.db import models #-------------\ # CONSTANTS | #-------------/ TOKEN_LETTERS = string.digits + string.uppercas...
fxdemolisher/frano
frano/main/decorators.py
<gh_stars>0 # Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from django.shortcuts import redirect from models import Portfolio from models import User #-------------\ # CONSTANTS | #-------------/ #---------------------\ # EXPOSED FUNCTIONS | #------------...
fxdemolisher/frano
frano/main/demo.py
<filename>frano/main/demo.py # Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from datetime import datetime from datetime import timedelta from math import ceil from math import floor from random import choice from random import randint from random import random f...
fxdemolisher/frano
frano/positions/models.py
<filename>frano/positions/models.py # Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from bisect import insort from datetime import datetime from django.db import models from main.models import Portfolio from quotes.models import CASH_SYMBOL from transactions.mo...
fxdemolisher/frano
frano/quotes/models.py
<filename>frano/quotes/models.py # Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. import json from datetime import date from datetime import datetime from datetime import timedelta from urllib import quote_plus from urllib import urlopen from django.db import mo...
fxdemolisher/frano
frano/management/commands/refresh_quotes.py
# Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from sys import stdout from django.core.management.base import BaseCommand from frano.main.demo import DEMO_INSTRUMENTS from frano.quotes.models import Quote from frano.quotes.models import quotes_by_symbols clas...
fxdemolisher/frano
frano/transactions/models.py
# Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. import codecs import csv from exceptions import Exception from django.db import models from parsers import FRANO_TRANSACTION_EXPORT_HEADER from parsers import GOOGLE_TRANSACTION_EXPORT_HEADER from parsers import...
fxdemolisher/frano
frano/management/commands/cleanup_sample_portfolios.py
# Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from datetime import datetime, timedelta from sys import stdout from django.core.management.base import BaseCommand from frano.main.models import Portfolio from frano.main.models import User from frano.main.view_u...
fxdemolisher/frano
frano/positions/views.py
# Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from datetime import datetime from datetime import timedelta from django.db import connection from django.db import transaction from main.decorators import portfolio_manipulation_decorator from main.decorators imp...
fxdemolisher/frano
frano/main/views.py
# Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. import json import random from StringIO import StringIO from urllib import urlopen from django.shortcuts import redirect from demo import get_demo_transactions from models import Portfolio from models import User...
fxdemolisher/frano
frano/urls.py
<filename>frano/urls.py # Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. import os from django.conf.urls.defaults import * from django.views.static import serve from settings import SERVE_STATICS # Main views urlpatterns = patterns('frano.main.views', (r'^$',...
fxdemolisher/frano
frano/management/commands/cleanup_unused_quotes.py
# Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from sys import stdout from django.core.management.base import BaseCommand from django.db import connection from frano.main.demo import DEMO_INSTRUMENTS from frano.quotes.models import Quote from frano.positions.v...
fxdemolisher/frano
frano/transactions/parsers.py
<reponame>fxdemolisher/frano<gh_stars>0 # Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from datetime import datetime from exceptions import Exception from quotes.models import CASH_SYMBOL from quotes.models import quote_by_symbol from quotes.models import price...
fxdemolisher/frano
frano/account/views.py
# Copyright (c) 2011 <NAME> # Licensed under the MIT license # see LICENSE file for copying permission. from django import forms from django.shortcuts import redirect from main.decorators import login_required_decorator from main.decorators import portfolio_manipulation_decorator from main.models import Portfolio fro...
otchlan/Pytkon_wprowadzenie
src/main.py
<filename>src/main.py import podstawy as po import toto as tt import tablica_np as tn if __name__ == '__main__': # print("Witaj świecie") a = 7 b = 5.5 """SKTÓTY KLAWISZOWE""" """cTRL+d - duplikownie lini kodu""" """Ctrl + / - komentowanie lini/linijek kodu""" # print ("to jest liczbe ca...
otchlan/Pytkon_wprowadzenie
src/tablica_np.py
<reponame>otchlan/Pytkon_wprowadzenie<gh_stars>0 import numpy as np def prosta(): print() tablica = np.array([4,5,6]) print("Tablica jednowymiarowa ", tablica) print() tablica_dwu = np.array([[1,2,3],[4,5,6],[7,8,9]]) print("Tablica dwuwymiarowa:\n", tablica_dwu) print() tablica_m = ...
otchlan/Pytkon_wprowadzenie
src/podstawy.py
def suma (a, b): print("w klasie", a+b) def jezeli (a, b, c): ab = a+b if ab == c: print ("if-1 a+b=c", a+b) elif a+c == b: print ("if-2 a+c=b", a+c) elif b+c == a: print ("if-3 b+c=a", b+c) else: print ("żadna liczba nie psuje") """1.True""" """2.<""" """3.<=...
otchlan/Pytkon_wprowadzenie
src/toto.py
<gh_stars>0 # 1. importujemy rand -> tworzymy funkcję losowanie -> wywołujemy ją w main # 2. tworzymy funkcję lotek: # tworzymy listę i FORa dla listy -> wywołujemy w main # importujemy numpy -> instalujemy przez PIP -> tworzymy tablice import random import numpy as np def losowanie (): liczba = random.ra...
ztaylor2/sr-problems
problems.py
<gh_stars>0 """Problem solutions.""" """Qualitative questions: 1. What are your goals for the next five years? I am currently very focused on getting my first software engineering job, and my hope is that after I get that job I will be able to move vertically within that organization. I would like to be something ...
Operation-Falcon/sectrails
dns.py
import argparse import sys from banner.banner import banner_design from function import * banner=banner_design() parser=argparse.ArgumentParser(description="Subdomain enumeration", formatter_class=argparse.RawTextHelpFormatter) parser.add_argument("-d", "--domain", help="domain name for subdomain enumeration", type=s...
Operation-Falcon/sectrails
function.py
<reponame>Operation-Falcon/sectrails import requests def subdomain(domain, api, output): param={"children_only":"false", "include_inactive":"true"} header={"Accept": "application/json", "APIKEY": f"{api}"} r=requests.get(f"https://api.securitytrails.com/v1/domain/{domain}/subdomains...
miniyus/finance-data-auto-posting
fdap/app/autopost/template.py
def make_subject(sector: str, year: str, q: str): return f'[업종: {sector}] {year}년도 {q}분기' def make_strong_tag(value: str): return f'<strong>{value}</strong>' def make_p_tag(value: str): return f'<p>{value}</p>' def make_img_tag(name: str, src: str): return f'<img src="{src}" alt="{name}">' def m...
miniyus/finance-data-auto-posting
fdap_manage/views.py
<filename>fdap_manage/views.py from django.shortcuts import render from django.shortcuts import redirect from django.urls import reverse from django.http import HttpResponse from django.utils import timezone from .models import Posts from fdap.definitions import LOG_PATH from fdap.utils.util import config_json, write_c...
miniyus/finance-data-auto-posting
fdap/contracts/webdriver.py
<gh_stars>0 from abc import ABC, abstractmethod from selenium.webdriver.remote.webdriver import WebDriver from selenium.common.exceptions import WebDriverException from typing import Union from fdap.utils.loggeradapter import LoggerAdapter from fdap.contracts.blog_client import BlogLoginInfo class WebDriverHandler(AB...
miniyus/finance-data-auto-posting
fdap/__init__.py
<reponame>miniyus/finance-data-auto-posting from fdap.application import Application from fdap.core.containter import Container app = Application(Container())
miniyus/finance-data-auto-posting
fdap/app/opendart/__init__.py
<reponame>miniyus/finance-data-auto-posting # Resolve dependency injection # use: from fdap.app.opendart import OpenDartService def service(): from fdap.app.opendart.opendart_service import OpenDartService from fdap.config.config import Config config = Config.OPENDART return OpenDartService(config['a...
miniyus/finance-data-auto-posting
fdap/application.py
<gh_stars>0 from dependency_injector import containers from fdap.config.config import Config from fdap.utils.customlogger import CustomLogger from fdap.utils.loggeradapter import LoggerAdapter from typing import Callable class Application: _container: containers.DeclarativeContainer _logger: LoggerAdapter ...
miniyus/finance-data-auto-posting
fdap/database/database.py
<gh_stars>0 from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base from fdap.config.config import Config config = Config.DATABASE['mysql'] access_info = 'mysql://{id}:{passwd}@{host}/{db}?charset=utf8'.format( id=config[...
miniyus/finance-data-auto-posting
fdap/app/tistory/__init__.py
<filename>fdap/app/tistory/__init__.py # Resolve dependency injection # use: from fdap.app.tistory import TistoryClient def service(): from fdap.app.tistory.tistory_client import TistoryClient, LoginInfo from fdap.config.config import Config config = Config.TISTORY api_config = config['api'] kakao...
miniyus/finance-data-auto-posting
fdap.py
<gh_stars>0 # execute fdap from fdap.application import Application def run(app: Application): from fdap.database.database import init_db from fdap.app.autopost.autopost import AutoPost from fdap.app.tistory.tistory_client import TistoryClient init_db() tistory_login_info = app.get('tistory_logi...
miniyus/finance-data-auto-posting
fdap/app/kiwoom/__init__.py
<filename>fdap/app/kiwoom/__init__.py # Resolve dependency injection # use: from fdap.app.kiwoom import KiwoomService def service(): from fdap.app.kiwoom.kiwoom_service import KiwoomService from fdap.config.config import Config return KiwoomService(Config.KOAPY['account']['id'], Config.KOAPY['account']['p...
miniyus/finance-data-auto-posting
fdap/prototype/auto_post.py
from fdap.prototype.handler import Handler from fdap.app.autopost import instance class AutoPost(Handler): TAG: str = 'auto-post' @staticmethod def make_module(): return instance() def handle(self): module = self.make_module() # result = module.run( # Parameters( ...
miniyus/finance-data-auto-posting
fdap/app/autopost/autopost.py
<gh_stars>0 from fdap.contracts.service import Service from fdap.app.opendart.report_code import ReportCode from fdap.app.kiwoom.kiwoom_service import KiwoomService from fdap.app.opendart.opendart_service import OpenDartService from fdap.app.tistory.tistory_client import TistoryClient from fdap.app.kiwoom.basic_info im...
miniyus/finance-data-auto-posting
fdap_manage/forms.py
from django import forms from abc import abstractmethod class ConfigForm(forms.Form): @abstractmethod def to_dict(self) -> dict: pass class KoapyForm(ConfigForm): kw_id = forms.CharField(label='koapy id') kw_pass = forms.CharField(label='koapy pass') def to_dict(self) -> dict: r...
miniyus/finance-data-auto-posting
fdap/contracts/core.py
<reponame>miniyus/finance-data-auto-posting from abc import ABC class Container(ABC): def run(self, **kwargs): pass
miniyus/finance-data-auto-posting
fdap/app/opendart/opendart_service.py
<reponame>miniyus/finance-data-auto-posting<filename>fdap/app/opendart/opendart_service.py import xmltodict import os from fdap.app.opendart.opendart_client import OpenDartClient from fdap.app.opendart.opendart_data import * from fdap.utils.util import currency_to_int from fdap.config.config import Config from fdap.app...
miniyus/finance-data-auto-posting
fdap/app/opendart/finance_data.py
import dataclasses from fdap.app.opendart.opendart_service import OpenDartService from fdap.utils.data import BaseData from typing import Dict, Union from fdap.app.opendart.opendart_data import AcntCollection from fdap.utils.customlogger import CustomLogger from fdap.utils.util import currency_to_int @dataclasses.dat...
miniyus/finance-data-auto-posting
fdap/app/opendart/report_code.py
<reponame>miniyus/finance-data-auto-posting from enum import Enum, unique @unique class ReportCode(Enum): Q1 = '11013' Q2 = '11012' Q3 = '11014' Q4 = '11011' @classmethod def get_by_str(cls, q: str) -> __name__: for k, v in cls.__members__.items(): if q == v.value: ...
miniyus/finance-data-auto-posting
fdap/contracts/blog_client.py
from abc import ABC, abstractmethod from dataclasses import dataclass from fdap.app.client.client import Client from typing import Dict @dataclass(frozen=False) class BlogPostData(ABC): title: str content: str @dataclass(frozen=True) class BlogLoginInfo(ABC): login_id: str login_password: str clas...
miniyus/finance-data-auto-posting
fdap/app/autopost/parameters.py
<reponame>miniyus/finance-data-auto-posting from fdap.app.autopost.rotation import StockCondition from fdap.utils.data import BaseData from dataclasses import dataclass @dataclass class Parameters(BaseData): sector_name: str sector_code: str year: str quarter: int stock_condition: StockCondition
miniyus/finance-data-auto-posting
fdap/config/config.py
<filename>fdap/config/config.py from fdap.utils.util import config_json class Config: DATABASE: dict = config_json('database') KOAPY: dict = config_json('koapy') LOGGER: dict = config_json('logger') OPENDART: dict = config_json('opendart') TISTORY: dict = config_json('tistory') @classmethod ...
miniyus/finance-data-auto-posting
fdap/app/tistory/webdriver.py
from fdap.contracts.blog_client import BlogLoginInfo from fdap.contracts.webdriver import WebDriverHandler as Handler from fdap.utils.loggeradapter import LoggerAdapter from fdap.utils.util import get_query_str_dict from selenium.webdriver.common.by import By from selenium.webdriver.remote.webelement import WebElement ...
miniyus/finance-data-auto-posting
fdap/core/containter.py
from dependency_injector import containers, providers from fdap.app.kiwoom.kiwoom_service import KiwoomService from fdap.app.opendart.opendart_service import OpenDartService from fdap.app.refine.refine import Refine from fdap.database.database import db_session from fdap.app.repositories.post_repository import PostsRep...
miniyus/finance-data-auto-posting
fdap/app/tistory/tistory_client.py
<filename>fdap/app/tistory/tistory_client.py import requests from typing import Union from fdap.utils.util import make_url from selenium import webdriver from fdap.definitions import ROOT_DIR from fdap.utils.customlogger import CustomLogger from fdap.app.tistory.tistory_data import * from fdap.app.tistory.webdriver imp...
miniyus/finance-data-auto-posting
fdap/app/refine/__init__.py
# Resolve dependency injection # use: from fdap.app.refine import Refine def service(): from fdap.app.refine.refine import Refine return Refine()
miniyus/finance-data-auto-posting
fdap/app/autopost/__init__.py
# Resolve dependency injection # use: from fdap.app.autopost import AutoPost def service(): from fdap.app.autopost.autopost import AutoPost from fdap.app.kiwoom import service as kiwoom from fdap.app.opendart import service as opendart from fdap.app.refine import service as refine from fdap.app.tis...
miniyus/finance-data-auto-posting
fdap_manage/models.py
<gh_stars>0 from django.db import models # Create your models here. class Posts(models.Model): post_id = models.AutoField(primary_key=True) post_subject = models.CharField(max_length=255, null=False) post_contents = models.TextField(null=False) post_category = models.CharField(max_length=255, null=Tru...
miniyus/finance-data-auto-posting
fdap/app/client/client.py
<reponame>miniyus/finance-data-auto-posting import requests import json from typing import Union from fdap.contracts.logging import Logging class Client(Logging): """ requests wrapper """ def __init__(self, host: str = None): """ Args: host(str): 요청할 웹 서버의 호스트정보(URL), ex)...
AndyKhang404/noimport
noimport.py
import sys #No importing sys.path = [] sys.meta_path = [] for key in sys.modules.keys(): sys.modules[key] = None sys.builtin_module_names = [] sys.path_hooks = [] for key in sys.path_importer_cache.keys(): sys.path_importer_cache[key] = None
UBC-MDS/game_sales
src/platforms.py
import altair as alt import pandas as pd import numpy as np alt.data_transformers.disable_max_rows() sales = pd.read_csv("data/raw/vgsales.csv") def plotPlatforms(top_val, daterange): top_platforms = sales["Platform"].value_counts().head(int(top_val)).index.tolist() top_platforms_df = sales.query("Platform in...
SimonBoothroyd/beflow
beflow/services/coordinator/models.py
from typing import List, Optional from openff.bespokefit.schema.fitting import BespokeOptimizationSchema from pydantic import BaseModel, Field from beflow.services.coordinator.stages import StageType from beflow.utilities.typing import Status class CoordinatorGETStageStatus(BaseModel): stage_type: str = Field(...
SimonBoothroyd/beflow
beflow/tests/services/qcgenerator/test_app.py
from typing import List import numpy import pytest from celery.result import AsyncResult from openff.bespokefit.schema.tasks import HessianTask, OptimizationTask, Torsion1DTask from openff.toolkit.topology import Molecule from pydantic import parse_raw_as from qcelemental.models import AtomicResult, AtomicResultProper...
SimonBoothroyd/beflow
beflow/utilities/depiction.py
import functools from typing import Optional, Tuple IMAGE_UNAVAILABLE_SVG = """ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 200 200" width="200pt" height="200pt"><defs><clipPath id="_clipPath_eSdCSpw1sB1xWp7flmMoZ0WjTPwPpzQh"><rect width="20...
SimonBoothroyd/beflow
beflow/tests/services/optimizer/test_app.py
from celery.result import AsyncResult from openff.bespokefit.schema.fitting import BespokeOptimizationSchema from openff.bespokefit.schema.optimizers import ForceBalanceSchema from openff.bespokefit.schema.results import BespokeOptimizationResults from openff.fragmenter.fragment import WBOFragmenter from beflow.servic...
SimonBoothroyd/beflow
beflow/services/models.py
<reponame>SimonBoothroyd/beflow from typing import Optional from pydantic import BaseModel, Field class Error(BaseModel): type: str = Field(..., description="The type of exception that was raised.") message: str = Field(..., description="The message associated with the exception.") traceback: Optional[...
SimonBoothroyd/beflow
beflow/utilities/typing.py
<reponame>SimonBoothroyd/beflow from typing_extensions import Literal Status = Literal["waiting", "running", "errored", "success"]
SimonBoothroyd/beflow
beflow/services/qcgenerator/models.py
from typing import Optional, Union from openff.bespokefit.schema.tasks import HessianTask, OptimizationTask, Torsion1DTask from pydantic import BaseModel, Field from qcelemental.models import AtomicResult, FailedOperation, OptimizationResult from qcengine.procedures.torsiondrive import TorsionDriveResult from typing_e...
SimonBoothroyd/beflow
beflow/services/fragmenter/models.py
<reponame>SimonBoothroyd/beflow from typing import List, Optional, Union from openff.fragmenter.fragment import ( FragmentationResult, PfizerFragmenter, WBOFragmenter, ) from pydantic import BaseModel, Field from beflow.utilities.typing import Status class FragmenterBaseResponse(BaseModel): fragmen...
SimonBoothroyd/beflow
beflow/services/qcgenerator/worker.py
<reponame>SimonBoothroyd/beflow from typing import List import qcengine import redis from openff.bespokefit.schema.tasks import OptimizationTask, Torsion1DTask from openff.toolkit.topology import Molecule from qcelemental.models import AtomicResult from qcelemental.models.common_models import DriverEnum from qcelement...
SimonBoothroyd/beflow
beflow/tests/utilities/test_redis.py
<filename>beflow/tests/utilities/test_redis.py import os.path import shutil import pytest from redis import Redis from beflow.utilities.redis import is_redis_available, launch_redis def test_launch_redis(tmpdir): assert not is_redis_available("localhost", 1234) redis_process = launch_redis(port=1234, dire...
SimonBoothroyd/beflow
beflow/services/optimizer/app.py
<filename>beflow/services/optimizer/app.py<gh_stars>0 import json from fastapi import APIRouter from qcelemental.util import serialize from beflow.services import settings from beflow.services.optimizer import worker from beflow.services.optimizer.models import ( OptimizerGETResponse, OptimizerPOSTBody, O...
SimonBoothroyd/beflow
beflow/utilities/redis.py
import atexit import functools import shlex import shutil import subprocess import time from typing import IO, Optional, Union import redis def is_redis_available(host: str, port: int = 6379) -> bool: """Returns whether a server running on the local host on a particular port is available. """ redis_...
SimonBoothroyd/beflow
beflow/services/optimizer/models.py
from typing import Optional from openff.bespokefit.schema.fitting import BespokeOptimizationSchema from openff.bespokefit.schema.results import BespokeOptimizationResults from pydantic import BaseModel, Field from beflow.utilities.typing import Status class OptimizerBaseResponse(BaseModel): optimization_id: st...
SimonBoothroyd/beflow
beflow/services/settings.py
<gh_stars>0 from pydantic import BaseSettings class Settings(BaseSettings): BEFLOW_API_V1_STR: str = "/api/v1" BEFLOW_GATEWAY_PORT: int = 8000 BEFLOW_GATEWAY_LOG_LEVEL: str = "error" BEFLOW_REDIS_ADDRESS: str = "localhost" BEFLOW_REDIS_PORT: int = 6379 BEFLOW_REDIS_DB: int = 0 BEFLOW_C...
SimonBoothroyd/beflow
examples/launch-executor.py
from openff.bespokefit.schema.data import BespokeQCData from openff.bespokefit.schema.fitting import BespokeOptimizationSchema from openff.bespokefit.schema.optimizers import ForceBalanceSchema from openff.bespokefit.schema.smirnoff import ( ProperTorsionHyperparameters, ProperTorsionSMIRKS, ) from openff.bespo...
SimonBoothroyd/beflow
beflow/tests/__init__.py
<reponame>SimonBoothroyd/beflow<gh_stars>0 from contextlib import contextmanager import redis from beflow.services import settings try: from pytest_cov.embed import cleanup_on_sigterm except ImportError: pass else: cleanup_on_sigterm() @contextmanager def patch_settings(redis_connection: redis.Redis): ...
SimonBoothroyd/beflow
beflow/services/coordinator/app.py
<reponame>SimonBoothroyd/beflow import asyncio import logging import os import pickle import signal import urllib.parse from typing import List, Optional from fastapi import APIRouter, HTTPException from fastapi.responses import Response from openff.toolkit.topology import Molecule from beflow.services import setting...
SimonBoothroyd/beflow
beflow/tests/services/fragmenter/test_app.py
<reponame>SimonBoothroyd/beflow from celery.result import AsyncResult from openff.fragmenter.fragment import FragmentationResult, PfizerFragmenter from beflow.services.fragmenter import worker from beflow.services.fragmenter.models import ( FragmenterGETResponse, FragmenterPOSTBody, FragmenterPOSTResponse,...
SimonBoothroyd/beflow
beflow/services/__init__.py
<filename>beflow/services/__init__.py<gh_stars>0 from beflow.services.settings import Settings settings = Settings() __all__ = [settings]
SimonBoothroyd/beflow
beflow/tests/services/qcgenerator/test_worker.py
<gh_stars>0 import json import pytest from openff.bespokefit.schema.tasks import OptimizationTask, Torsion1DTask from openff.toolkit.topology import Molecule from qcelemental.models.common_models import Model from qcelemental.models.procedures import OptimizationResult, TorsionDriveResult from beflow.services.qcgener...
SimonBoothroyd/beflow
beflow/executor.py
import functools import importlib import logging import multiprocessing import os import time from typing import Optional import celery import requests from openff.bespokefit.schema.fitting import BespokeOptimizationSchema from openff.utilities import temporary_cd from beflow.services import settings from beflow.serv...
SimonBoothroyd/beflow
beflow/services/fragmenter/app.py
import json from fastapi import APIRouter from fastapi.responses import Response from openff.fragmenter.depiction import _oe_render_fragment from openff.fragmenter.fragment import FragmentationResult from beflow.services import settings from beflow.services.fragmenter import worker from beflow.services.fragmenter.mod...
SimonBoothroyd/beflow
beflow/services/fragmenter/worker.py
from typing import List, Union import redis from openff.fragmenter.fragment import PfizerFragmenter, WBOFragmenter from pydantic import parse_raw_as from beflow.services import settings from beflow.utilities.celery import configure_celery_app redis_connection = redis.Redis( host=settings.BEFLOW_REDIS_ADDRESS, ...
SimonBoothroyd/beflow
beflow/tests/test_beflow.py
import importlib def test_importable(): importlib.import_module("beflow")
SimonBoothroyd/beflow
beflow/services/qcgenerator/__init__.py
<gh_stars>0 from beflow.services.qcgenerator.app import router __all__ = [router]
SimonBoothroyd/beflow
beflow/__init__.py
<reponame>SimonBoothroyd/beflow """ beflow A proof of concept refactoring of the OpenFF bespoke executor to use something closer to a microservice pattern. """ from ._version import get_versions versions = get_versions() __version__ = versions["version"] __git_revision__ = versions["full-revisionid"] del get_versions...
SimonBoothroyd/beflow
beflow/services/coordinator/stages.py
import abc import json from collections import defaultdict from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union import httpx from chemper.graphs.cluster_graph import ClusterGraph from openff.bespokefit.schema.data import BespokeQCData, LocalQCData from openff.bespokefit.schema.fitting import BespokeOpt...
SimonBoothroyd/beflow
beflow/services/optimizer/worker.py
from typing import Union import redis from openff.bespokefit.optimizers import get_optimizer from openff.bespokefit.schema.fitting import BespokeOptimizationSchema from pydantic import parse_raw_as from qcelemental.util import serialize from beflow.services import settings from beflow.utilities.celery import configur...
SimonBoothroyd/beflow
beflow/services/fragmenter/__init__.py
<filename>beflow/services/fragmenter/__init__.py from beflow.services.fragmenter.app import router __all__ = [router]
SimonBoothroyd/beflow
beflow/services/coordinator/__init__.py
from beflow.services.coordinator.app import router __all__ = [router]
SimonBoothroyd/beflow
beflow/services/optimizer/__init__.py
<gh_stars>0 from beflow.services.optimizer.app import router __all__ = [router]
SimonBoothroyd/beflow
beflow/tests/utilities/test_depiction.py
<gh_stars>0 import pytest from beflow.utilities.depiction import ( _oe_smiles_to_image, _rd_smiles_to_image, smiles_to_image, ) @pytest.mark.parametrize( "to_image", [_oe_smiles_to_image, _rd_smiles_to_image, smiles_to_image] ) def test_smiles_to_image(to_image): try: svg_contents = to_...
SimonBoothroyd/beflow
beflow/tests/services/fragmenter/test_worker.py
import json from openff.fragmenter.fragment import FragmentationResult, PfizerFragmenter from openff.toolkit.topology import Molecule from beflow.services.fragmenter import worker def test_fragment(): molecule = Molecule.from_smiles("CCCCCC") result_json = worker.fragment( cmiles=molecule.to_smile...
SimonBoothroyd/beflow
beflow/tests/services/optimizer/test_worker.py
<filename>beflow/tests/services/optimizer/test_worker.py import json from openff.bespokefit.optimizers import ForceBalanceOptimizer from openff.bespokefit.schema.fitting import BespokeOptimizationSchema from openff.bespokefit.schema.optimizers import ForceBalanceSchema from openff.bespokefit.schema.results import Besp...
SimonBoothroyd/beflow
beflow/tests/conftest.py
<filename>beflow/tests/conftest.py import subprocess import pytest import redis from beflow.utilities.redis import launch_redis @pytest.fixture(scope="session") def redis_session(tmpdir_factory): redis_exists_error = RuntimeError( "It looks like a redis server is already running with the test " ...
SimonBoothroyd/beflow
beflow/services/qcgenerator/app.py
import json from typing import List, Optional, Union from fastapi import APIRouter, Query from fastapi.responses import Response from openff.bespokefit.schema.tasks import HessianTask, OptimizationTask, Torsion1DTask from pydantic import parse_obj_as from qcelemental.models import AtomicResult, OptimizationResult from...
SimonBoothroyd/beflow
beflow/tests/services/test_gateway.py
import functools from multiprocessing import Process import pytest from beflow.services import settings from beflow.services.gateway import app, launch, wait_for_gateway def test_default_routes_loaded(): found_routes = [router.path for router in app.routes] assert all( route in found_routes ...
SimonBoothroyd/beflow
beflow/tests/utilities/test_celery.py
<reponame>SimonBoothroyd/beflow import functools import celery import pytest from celery import shared_task from beflow.tests.mocking.celery import mock_celery_result from beflow.utilities.celery import ( _spawn_worker, configure_celery_app, get_status, get_task_information, spawn_worker, ) @sha...
Bruck1701/Windhoek-Weather-Bot
SensorReader.py
<filename>SensorReader.py import time import serial import sys from datetime import datetime import ast class ArduinoSensor: def __init__(self): self.ser = serial.Serial('/dev/ttyACM0',9600, timeout = 5) # listen for the input, exit if nothing received in timeout period def ReadInput(self): ...
Bruck1701/Windhoek-Weather-Bot
LambdaFunctions/subscriberDDB.py
<filename>LambdaFunctions/subscriberDDB.py<gh_stars>1-10 import json import boto3 import time import os from decimal import Decimal dynamodb = boto3.resource('dynamodb') table = dynamodb.Table(os.environ['TABLE_NAME']) def lambda_handler(event, context): ts = time.time() message_attrs = event['Re...
Bruck1701/Windhoek-Weather-Bot
Publisher.py
<reponame>Bruck1701/Windhoek-Weather-Bot import config import tweepy import datetime from SensorReader import ArduinoSensor import requests import boto3 def getWeatherDataAPI(): temp_data={} url = "https://api.openweathermap.org/data/2.5/weather?q=Windhoek,na&appid="+config.WEATHER_API respons...
Bruck1701/Windhoek-Weather-Bot
LambdaFunctions/subscriberTwitter.py
<reponame>Bruck1701/Windhoek-Weather-Bot import json import boto3 import tweepy ssm = boto3.client('ssm',region_name='us-east-1') def lambda_handler(event, context): params = ssm.get_parameters(Names=['/wwbot-app/dev/twitter/api_key', '/wwbot-app/dev/twitter/api_secret_key', ...
piotrwolinski-intel/incubator-mxnet
tests/python/dnnl/subgraphs/test_fc_subgraph.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
piotrwolinski-intel/incubator-mxnet
tests/python/gpu/test_amp.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
piotrwolinski-intel/incubator-mxnet
tests/python/amp/common.py
<reponame>piotrwolinski-intel/incubator-mxnet<filename>tests/python/amp/common.py # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this fi...
piotrwolinski-intel/incubator-mxnet
python/mxnet/amp/lists/symbol_bf16.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
piotrwolinski-intel/incubator-mxnet
tests/python/dnnl/subgraphs/test_amp_subgraph.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
piotrwolinski-intel/incubator-mxnet
tests/python/dnnl/test_amp.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
CornellLenard/Deep-Learning-Course-Exercises
Exercise 06/exercise_code/hyperparameter_tuning.py
<filename>Exercise 06/exercise_code/hyperparameter_tuning.py import random from math import log10 from itertools import product from exercise_code.solver import Solver from exercise_code.networks.layer import Sigmoid, Relu from exercise_code.networks import (ClassificationNet, BCE, CrossEntropyFromLogits) ALLOWED_RAN...
CornellLenard/Deep-Learning-Course-Exercises
Exercise 09/exercise_code/data/base_dataset.py
<gh_stars>0 """Dataset Base Class""" from torch.utils.data import Dataset from .download_utils import download_dataset class BaseDataset(Dataset): """ Abstract Dataset Base Class All subclasses must define __getitem__() and __len__() """ def __init__(self, root, download_url=None, force_download...