This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typing | |
import requests | |
import pandas as pd | |
from io import StringIO | |
from ._utils import (_init_session, _format_date, | |
_sanitize_dates, _url, RemoteDataError, _handle_request_errors, EnvironNotSet, | |
_handle_environ_error, sentinel, api_key_not_authorized) | |
from config.config import Config | |
config_data: Config = Config() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO Create Test Cases for Memberships & Documentations | |
class Validators(UserValid, PlanValid, MemberValid, CouponValid): | |
def __init__(self): | |
super(Validators, self).__init__() | |
self._max_retries = current_app.config.get('DATASTORE_RETRIES') | |
self._max_timeout = current_app.config.get('DATASTORE_TIMEOUT') | |
@ndb.tasklet | |
def can_add_member(self, uid: str, plan_id: str, start_date: date) -> any: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from google.cloud.ndb.exceptions import BadValueError | |
from pytest import raises | |
from data_service.store.stocks import BuyVolumeModel | |
from data_service.utils.utils import create_id, today | |
from .. import app | |
buy_volume_instance: BuyVolumeModel = BuyVolumeModel() | |
def test_buy_volume_instance(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AffiliateQueryMock: | |
affiliate_instance = Affiliates() | |
def __init__(self): | |
pass | |
def fetch(self) -> list: | |
return [self.affiliate_instance] | |
def get(self) -> Affiliates: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this listens for page load event | |
self.addEventListener('load', e => { | |
//you need to attach the event handler to submit-button after the page has loaded | |
document.getElementById('submit-button').addEventListener(e => { | |
e.preventDefault(); | |
// obtain form elements here | |
const value1 = document.getElementById('elementid').value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:16.2-alpine3.11 | |
# set working directory | |
WORKDIR /app | |
# add `/app/node_modules/.bin` to $PATH | |
ENV PATH /app/node_modules/.bin:$PATH | |
# install app dependencies | |
COPY package.json ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello_world(): | |
name = os.environ.get("NAME", "World") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use the official lightweight Python image. | |
# https://hub.docker.com/_/python | |
FROM python:3.9-slim | |
# Allow statements and log messages to immediately appear in the Knative logs | |
ENV PYTHONUNBUFFERED True | |
COPY ./requirements.txt /app/requirements.txt | |
# Copy local code to the container image. | |
ENV APP_HOME /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
**ndb BaseModel ** | |
used as a superclass to define data models | |
""" | |
__author__ = "mobius-crypt" | |
__email__ = "mobiusndou@gmail.com" | |
__twitter__ = "@blueitserver" | |
__github_repo__ = "https://github.com/freelancing-solutions/memberships-and-affiliate-api" | |
__github_profile__ = "https://github.com/freelancing-solutions/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
**Exchange Data Model | |
""" | |
from google.cloud import ndb | |
from src.models.basemodel import BaseModel | |
class Exchange(BaseModel): | |
exchange_id: str = ndb.StringProperty(required=True, indexed=True) | |
name: str = ndb.StringProperty(required=True, indexed=True) |