Skip to content

Instantly share code, notes, and snippets.

View EdMan1022's full-sized avatar
💭
working

Edward Brennan EdMan1022

💭
working
  • Red Hat
  • Raleigh, NC
View GitHub Profile
import datetime
from dateutil.relativedelta import relativedelta
from dateutil.rrule import rrule, MONTHLY
today = datetime.datetime.today()
end1 = today + relativedelta(years=1)
end2 = today + relativedelta(years=2)
from .base_model import BaseModel
from ..extensions import db
from .classes.foreign_key_cascade import ForeignKeyCascade
# Association table between Payment and Subscription
payment_subscription = db.Table(
'payment_subscription',
db.Column('payment_id', db.Integer, db.ForeignKey('payment.id'), primary_key=True),
db.Column('subscription_id', db.Integer, db.ForeignKey('subscription.id'),
primary_key=True)
@EdMan1022
EdMan1022 / config.py
Created August 29, 2018 15:52
Flask config setup that utilizes a Singleton pattern to always return the same configuration instance when called multiple times. Could allow for other functions or methods to run and modify the config, and have those changes represented later on during app lifetime.
from os import environ
from logging.config import dictConfig
from werkzeug.security import generate_password_hash
class BaseConfig(object):
def _config_logger(self):
"""
@EdMan1022
EdMan1022 / inheritance_example.py
Created September 21, 2018 15:08
Quick dirty example of freely passing args to parent class
class ExampleParent(object):
def run(self, *args, **kwargs):
print(args[0])
print(kwargs['a'])
class ExampleChild(ExampleParent):
def upload(line):
"""
Executes some operation using a dict and returns some output
This is where the Eloqua POST function would go,
I haven't implemented anything
:param line:
:return:
"""
raise NotImplementedError
def upload(line):
"""
Executes some operation using a dict and returns some output
This is where the Eloqua POST function would go,
I haven't implemented anything
:param line:
:return:
"""
return list(line.values())