This file contains hidden or 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
#!/usr/bin/env bash | |
NEW_REQUIREMENTS=$(poetry export -f requirements.txt --without-hashes | cut -d';' -f1) | |
if [ ! -f requirements.txt ]; then | |
echo "requirements.txt does not exist!" | |
poetry export --without-hashes | cut -d';' -f1 > requirements.txt | |
exit 1 | |
fi | |
REQUIREMENTS=$(cat requirements.txt) |
This file contains hidden or 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 types import GeneratorType | |
def remove_duplicates(iterable, key=None): | |
iterable_class = type(iterable) | |
if iterable_class in [dict, set]: | |
raise TypeError("You can't remove duplicates from a {}!".format(iterable_class)) | |
if not key: | |
_key = lambda a: a |
This file contains hidden or 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 collections import defaultdict | |
from django.db.models.signals import * | |
class DisableSignals(object): | |
def __init__(self, disabled_signals=None): | |
self.stashed_signals = defaultdict(list) | |
self.disabled_signals = disabled_signals or [ | |
pre_init, post_init, | |
pre_save, post_save, |
This file contains hidden or 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 django.conf import settings | |
from django.core.files.storage import default_storage | |
from django.http import HttpResponse | |
import json | |
import os | |
def upload_file(request): | |
if request.method.lower() != 'post': | |
return HttpResponse('Invalid method {}. Only POST allowed.'.format(request.method.upper()), status=405) |