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
#!/usr/bin/env python | |
""" | |
Credit System for Python Code | |
This program analyzes Python code with pylint | |
and calculates a credit for the code, depending | |
on a miimum required score and the previous run. | |
""" | |
import sys |
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
def versionsverbesserung_fuer_sofort([{'artnr': menge}, ...]): | |
ret = defaultdict(0) | |
erfuellbar = True | |
# wir koennen ja theoretisch mehrfach auf den selben Artikel zugreifen | |
# deswegen merken wir uns, was wir schon an freier menge "verbruacht" | |
# haben. | |
freimengenspeicher = {} | |
for artnr, menge in ...: | |
eap = get_eap(artnr) | |
if eap.fuer_kunde: |
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
diff --git i/modules/market/mk_controllers.py w/modules/market/mk_controllers.py | |
index 6334a83..90903ce 100644 | |
--- i/modules/market/mk_controllers.py | |
+++ w/modules/market/mk_controllers.py | |
@@ -16,6 +16,7 @@ from google.appengine.ext import ndb | |
from huTools import postmark | |
import config | |
+ | |
from modules import bot |
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
diff --git i/modules/market/mk_forms.py w/modules/market/mk_forms.py | |
index dd3646a..e78a8d8 100644 | |
--- i/modules/market/mk_forms.py | |
+++ w/modules/market/mk_forms.py | |
@@ -6,6 +6,8 @@ modules/market/mk_forms.py | |
Created by Christian Klein on 2015-12-01. | |
Copyright (c) 2015 HUDORA GmbH. All rights reserved. | |
""" | |
+import logging | |
+ |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
paffrater.py - Dieses Progrtamm liesst Volksbank Kontoauszüge und konvertiert sie in OFX. | |
OFX wurde mit xero.com getestet. | |
Created by Maximillian Dornseif on 2010-06-05. | |
Copyright (c) 2010, 2013 HUDORA. All rights reserved. | |
""" |
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
# Dateien, die wir strenger checken. | |
STRICT_LINT_FILES= views/admin.py modules/beliza | |
# Alle Projektdateien | |
LINT_FILES= $(STRICT_LINT_FILES) *.py controllers/ modules/ views/ bin/import_rechnung.py | |
LINT_LINE_LENGTH= 110 | |
LINT_FLAKE8_ARGS= --max-complexity=18 --builtins=_ --max-line-length=$(LINT_LINE_LENGTH) | |
GOOD_NAMES=_,setUp,application,fd,gaetk_replication_SQL_INSTANCE_NAME,gaetk_replication_SQL_DATABASE_NAME,gaetk_replication_SQL_QUEUE_NAME |
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
def ig2adn(profile): | |
logging.debug(profile) | |
instagram_client = InstagramAPI(access_token=profile.ig_access_token) | |
try: | |
media, next = instagram_client.user_recent_media() | |
except InstagramAPIError, msg: | |
if 'The "access_token" provided is invalid.' in str(msg): | |
# profile.ig_access_token = None | |
# profile.put() | |
return |
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 UeCheckin2(gaetk.handler.BasicHandler): | |
def put(self, uuid): | |
key = "sekrit" # determined by some other process | |
bodyhash = base64.b64encode(hashlib.sha256(self.request.body).digest()) | |
toBeSigned = "&".join([self.request.method, self.request.path, bodyhash]) | |
signature = base64.b64encode(hmac.new(key, toBeSigned, hashlib.sha256).digest()) | |
header = self.request.headers['Authorization'] | |
typ, value = header.split() | |
if typ != 'X-Signature': | |
raise gaetk.handler.HTTP401_Unauthorized |
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 RateLimitTimeMiddleware(object): | |
def __init__(self, app): | |
self.app = app | |
def __call__(self, environ, start_response): | |
if environ.get('HTTP_X_APPENGINE_COUNTRY', '??') in ['KW', 'CN']: | |
start_response('429 Too Many Requests', [('Content-type', 'text/html')]) | |
return ["""<html><head><title>429 Too Many Requests, sorry...</title> | |
<style>body { font-family: verdana, arial, sans-serif; background-color: #fff; color: #000; }</style> | |
</head><body><div style="margin-left: 4em;"><h1>We're sorry...</h1> |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
import sys | |
def main(): | |
if len(sys.argv) < 2: | |
sys.stderr.write('Usage: %s filename\n' % sys.argv[1]) | |
sys.exit() |