<commit_before>import logging

import click
import stripe

from config import settings
from catwatch.blueprints.billing.services import StripePlan

from catwatch.app import create_app

app = create_app()


@click.group()
def cli():
    """ Perform various tasks with Stripe's API. """
    stripe.api_key = app.config.get('STRIPE_SECRET_KEY', None)


@click.command()
def sync_plans():
    """
    Sync (upsert) STRIPE_PLANS to Stripe.
    """
    plans = settings.STRIPE_PLANS

    for _, value in plans.iteritems():
        plan = StripePlan.retrieve(value['id'])
        if plan:
            StripePlan.update(value)
        else:
            StripePlan.create(value)

<commit_msg>Remove the need to create an app in the stripe CLI<commit_after>import logging

import click
import stripe

from config import settings as settings_
from catwatch.blueprints.billing.services import StripePlan

try:
    from instance import settings
except ImportError:
    logging.error('Your instance/ folder must contain an __init__.py file')
    exit(1)


@click.group()
def cli():
    """ Perform various tasks with Stripe's API. """
    stripe.api_key = settings.STRIPE_SECRET_KEY


@click.command()
def sync_plans():
    """
    Sync (upsert) STRIPE_PLANS to Stripe.
    """
    plans = settings_.STRIPE_PLANS

    for _, value in plans.iteritems():
        plan = StripePlan.retrieve(value['id'])
        if plan:
            StripePlan.update(value)
        else:
            StripePlan.create(value)


{'fraction_non_alphanumeric': 0.09845947756195579, 'fraction_numerical': 0.0006697923643670462, 'mean_word_length': 3.1385041551246537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3484795', 'n_tokens_mistral': 492, 'n_tokens_neox': 460, 'n_words': 127}