commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
9442338d329e7f87d6265e0b0d3728a0df18d945
viper/lexer/reserved_tokens.py
viper/lexer/reserved_tokens.py
RESERVED_NAMES = { 'def', 'pass', 'return', 'class', 'interface', 'data', 'if', 'elif', 'else', 'or', 'and', 'not', 'for', 'true', 'false', } RESERVED_CLASSES = set()
RESERVED_NAMES = { 'def', 'pass', 'return', 'class', 'interface', 'data', 'static', 'public', 'private', 'protected', 'module', 'if', 'elif', 'else', 'or', 'and', 'not', 'for', 'true', 'false', } RESERVED_CLASSES = set()
Update list of reserved tokens
Update list of reserved tokens
Python
apache-2.0
pdarragh/Viper
--- +++ @@ -5,6 +5,11 @@ 'class', 'interface', 'data', + 'static', + 'public', + 'private', + 'protected', + 'module', 'if', 'elif', 'else',
c0ad52072dfe3ae489875c36a3a84561b43583a6
devtools/travis-ci/set_doc_version.py
devtools/travis-ci/set_doc_version.py
import os import shutil from yank import version if version.release: docversion = version.version else: docversion = 'latest' os.mkdir("docs/_deploy") shutil.copytree("docs/_build/html", "docs/_deploy/{docversion}" .format(docversion=docversion))
import os import shutil from yank import version if version.release: docversion = version.version else: docversion = 'latest' os.mkdir("docs/_deploy") shutil.copytree("docs/_build", "docs/_deploy/{docversion}" .format(docversion=docversion))
Set the correct doc build dir to copy
Set the correct doc build dir to copy
Python
mit
andrrizzi/yank,choderalab/yank,choderalab/yank,andrrizzi/yank,andrrizzi/yank
--- +++ @@ -8,5 +8,5 @@ docversion = 'latest' os.mkdir("docs/_deploy") -shutil.copytree("docs/_build/html", "docs/_deploy/{docversion}" +shutil.copytree("docs/_build", "docs/_deploy/{docversion}" .format(docversion=docversion))
53fb42f275050986072060a550e4fee09ab418f6
wagtail/wagtailadmin/checks.py
wagtail/wagtailadmin/checks.py
import os from django.core.checks import Error, register @register() def css_install_check(app_configs, **kwargs): errors = [] css_path = os.path.join( os.path.dirname(__file__), 'static', 'wagtailadmin', 'css', 'normalize.css' ) if not os.path.isfile(css_path): error_hint = """ ...
import os from django.core.checks import Warning, register @register() def css_install_check(app_configs, **kwargs): errors = [] css_path = os.path.join( os.path.dirname(__file__), 'static', 'wagtailadmin', 'css', 'normalize.css' ) if not os.path.isfile(css_path): error_hint = """ ...
Throw warning on missing CSS rather than error, so that tests can still run on Dj1.7
Throw warning on missing CSS rather than error, so that tests can still run on Dj1.7
Python
bsd-3-clause
nilnvoid/wagtail,gasman/wagtail,wagtail/wagtail,nutztherookie/wagtail,thenewguy/wagtail,rsalmaso/wagtail,kurtw/wagtail,nilnvoid/wagtail,nutztherookie/wagtail,iansprice/wagtail,thenewguy/wagtail,nimasmi/wagtail,nealtodd/wagtail,Toshakins/wagtail,FlipperPA/wagtail,nilnvoid/wagtail,iansprice/wagtail,zerolab/wagtail,mikedi...
--- +++ @@ -1,6 +1,6 @@ import os -from django.core.checks import Error, register +from django.core.checks import Warning, register @register() @@ -21,10 +21,10 @@ """ % css_path errors.append( - Error( + Warning( "CSS for the Wagtail admin is missing...
ae4a13da2857a5826fa701f25b242c95d56995d9
string_length.py
string_length.py
#!/usr/bin/env python2 #encoding: UTF-8 # Define a function that computes the length of a given list or string. # (It is true that Python has the len() function built in, # but writing it yourself is nevertheless a good exercise.) def string_length(string): if string == None: return False ...
#!/usr/bin/env python2 #encoding: UTF-8 # Define a function that computes the length of a given list or string. # (It is true that Python has the len() function built in, # but writing it yourself is nevertheless a good exercise.) def string_length(string): if string == None: return False ...
Add support for list input
Add support for list input
Python
mit
giantas/minor-python-tests
--- +++ @@ -14,7 +14,14 @@ return False value = 0 + new_string = [] + if '[' in string and ']' in string: + for i in string: + if i != '[' and i != ']' and i != ',': + new_string.append(i) + string = new_string + for i in string: ...
c45881530694488c5ef139e89c05aa24ddb671ff
djlint/analyzers/context_processors.py
djlint/analyzers/context_processors.py
import ast from .base import BaseAnalyzer, ModuleVisitor, Result class ContextProcessorsVisitor(ast.NodeVisitor): def __init__(self): self.found = [] removed_items = { 'django.core.context_processors.auth': 'django.contrib.auth.context_processors.auth', 'django.core.cont...
import ast from .base import BaseAnalyzer, ModuleVisitor, Result class ContextProcessorsVisitor(ast.NodeVisitor): def __init__(self): self.found = [] deprecated_items = { 'django.core.context_processors.auth': 'django.contrib.auth.context_processors.auth', 'django.core.c...
Fix context processors analyzer: deprecated processors will be removed in Django 1.5
Fix context processors analyzer: deprecated processors will be removed in Django 1.5
Python
isc
alfredhq/djlint
--- +++ @@ -8,7 +8,7 @@ def __init__(self): self.found = [] - removed_items = { + deprecated_items = { 'django.core.context_processors.auth': 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.PermWrapper': @@ -18,7 +18,7 @@ } ...
b55e58f3619305946decc7c17c558879895f3b1a
tests/request_methods/test_sellers.py
tests/request_methods/test_sellers.py
""" Tests for the MWS.Sellers API class. """ import unittest import mws from .utils import CommonRequestTestTools class SellersTestCase(unittest.TestCase, CommonRequestTestTools): """ Test cases for Sellers. """ # TODO: Add remaining methods for Sellers def setUp(self): self.api = mws.Sell...
""" Tests for the Sellers API class. """ import unittest import mws from .utils import CommonRequestTestTools class SellersTestCase(unittest.TestCase, CommonRequestTestTools): """ Test cases for Sellers. """ # TODO: Add remaining methods for Sellers def setUp(self): self.api = mws.Sellers(...
Expand tests for Sellers API
Expand tests for Sellers API
Python
unlicense
Bobspadger/python-amazon-mws,GriceTurrble/python-amazon-mws
--- +++ @@ -1,5 +1,5 @@ """ -Tests for the MWS.Sellers API class. +Tests for the Sellers API class. """ import unittest import mws @@ -19,3 +19,31 @@ auth_token=self.CREDENTIAL_TOKEN ) self.api._test_request_params = True + + def test_list_marketplace_participations(self): + ...
83a086b865c2db791a208d3854c15963ed3fc693
plum/tests/service_test.py
plum/tests/service_test.py
from unittest import TestCase from docker import Client from plum import Service class ServiceTestCase(TestCase): def setUp(self): self.client = Client('http://127.0.0.1:4243') self.client.pull('ubuntu') for c in self.client.containers(): self.client.kill(c['Id']) sel...
from unittest import TestCase from docker import Client from plum import Service class ServiceTestCase(TestCase): def setUp(self): self.client = Client('http://127.0.0.1:4243') self.client.pull('ubuntu') for c in self.client.containers(all=True): self.client.kill(c['Id']) ...
Delete all containers on the Docker daemon before running test
Delete all containers on the Docker daemon before running test
Python
apache-2.0
phiroict/docker,xydinesh/compose,unodba/compose,shin-/docker.github.io,bdwill/docker.github.io,bsmr-docker/compose,KevinGreene/compose,Katlean/fig,screwgoth/compose,bobphill/compose,aanand/fig,zhangspook/compose,GM-Alex/compose,KevinGreene/compose,saada/compose,docker-zh/docker.github.io,ekristen/compose,jrabbit/compos...
--- +++ @@ -8,8 +8,9 @@ self.client = Client('http://127.0.0.1:4243') self.client.pull('ubuntu') - for c in self.client.containers(): + for c in self.client.containers(all=True): self.client.kill(c['Id']) + self.client.remove_container(c['Id']) self...
83a5688181ed3fac058cd1b9b15f885e47578409
testsuite/E20.py
testsuite/E20.py
#: E201 spam( ham[1], {eggs: 2}) #: E201 spam(ham[ 1], {eggs: 2}) #: E201 spam(ham[1], { eggs: 2}) #: Okay spam(ham[1], {eggs: 2}) #: #: E202 spam(ham[1], {eggs: 2} ) #: E202 spam(ham[1], {eggs: 2 }) #: E202 spam(ham[1 ], {eggs: 2}) #: Okay spam(ham[1], {eggs: 2}) result = func( arg1='some value', arg2='anot...
#: E201:1:6 spam( ham[1], {eggs: 2}) #: E201:1:10 spam(ham[ 1], {eggs: 2}) #: E201:1:15 spam(ham[1], { eggs: 2}) #: Okay spam(ham[1], {eggs: 2}) #: #: E202:1:23 spam(ham[1], {eggs: 2} ) #: E202:1:22 spam(ham[1], {eggs: 2 }) #: E202:1:11 spam(ham[1 ], {eggs: 2}) #: Okay spam(ham[1], {eggs: 2}) result = func( arg1...
Add some tests with row and column
Add some tests with row and column
Python
mit
jayvdb/pep8,pedros/pep8,fabioz/pep8,MeteorAdminz/pep8,ojengwa/pep8,PyCQA/pep8,codeclimate/pep8,reinout/pep8,ABaldwinHunter/pep8,jayvdb/pep8,reinout/pep8,asandyz/pep8,ABaldwinHunter/pep8-clone-classic,pandeesh/pep8,doismellburning/pep8,fabioz/pep8,zevnux/pep8
--- +++ @@ -1,19 +1,19 @@ -#: E201 +#: E201:1:6 spam( ham[1], {eggs: 2}) -#: E201 +#: E201:1:10 spam(ham[ 1], {eggs: 2}) -#: E201 +#: E201:1:15 spam(ham[1], { eggs: 2}) #: Okay spam(ham[1], {eggs: 2}) #: -#: E202 +#: E202:1:23 spam(ham[1], {eggs: 2} ) -#: E202 +#: E202:1:22 spam(ham[1], {eggs: 2 }) -#: E2...
3c86abb5d2a728604b97a33c3f989039231205b0
ooni/tests/test_utils.py
ooni/tests/test_utils.py
import unittest from ooni.utils import pushFilenameStack class TestUtils(unittest.TestCase): def test_pushFilenameStack(self): f = open("dummyfile", "w+") f.write("0\n") f.close() for i in xrange(1, 5): f = open("dummyfile.%s" % i, "w+") f.write("%s\n" % i) ...
import os import unittest from ooni.utils import pushFilenameStack basefilename = os.path.abspath('dummyfile') class TestUtils(unittest.TestCase): def test_pushFilenameStack(self): f = open(basefilename, "w+") f.write("0\n") f.close() for i in xrange(1, 5): f = open(basef...
Use absolute filepath instead of relative
Use absolute filepath instead of relative
Python
bsd-2-clause
lordappsec/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-pro...
--- +++ @@ -1,19 +1,20 @@ +import os import unittest from ooni.utils import pushFilenameStack - +basefilename = os.path.abspath('dummyfile') class TestUtils(unittest.TestCase): def test_pushFilenameStack(self): - f = open("dummyfile", "w+") + f = open(basefilename, "w+") f.write("0\n") ...
6aee8af90e5c09fb56d5d9194f0d0db5ce8b38f8
tmpl/__init__.py
tmpl/__init__.py
""" All class templated which can be derivated. List: Platform Prompt """
""" All class templated which can be derivated. List: Platform Prompt """ import Platform import Prompt
Make a new entry to import all modules.
Make a new entry to import all modules.
Python
mit
nday-dev/Spider-Framework
--- +++ @@ -4,3 +4,5 @@ Platform Prompt """ +import Platform +import Prompt
b013e96cb1762f46f3281ac61b5e1b53e07ede18
prime-factors/prime_factors.py
prime-factors/prime_factors.py
import sieve def prime_factors(n): primes = sieve.sieve(n) factors = [] for p in primes: while n % p == 0: factors += [p] n //= p return factors
def prime_factors(n): factors = [] factor = 2 while n != 1: while n % factor == 0: factors += [factor] n //= factor factor += 1 return factors
Fix memory issues by just trying every number
Fix memory issues by just trying every number
Python
agpl-3.0
CubicComet/exercism-python-solutions
--- +++ @@ -1,11 +1,9 @@ -import sieve - - def prime_factors(n): - primes = sieve.sieve(n) factors = [] - for p in primes: - while n % p == 0: - factors += [p] - n //= p + factor = 2 + while n != 1: + while n % factor == 0: + factors += [factor] + ...
df98c8bd70f25727810e6eb9d359cf1e14fd6645
update_prices.py
update_prices.py
import sqlite3 import urllib2 import xml.etree.ElementTree as ET MARKET_URL = 'http://api.eve-central.com/api/marketstat?hours=24&%s' ITEMS = [ 34, # Tritanium 35, # Pyerite 36, # Mexallon 37, # Isogen 38, # Nocxium 39, # Zydrine 40, # Megacyte 11399, # Morphite ] def main(): conn = sq...
import sqlite3 import urllib2 import xml.etree.ElementTree as ET MARKET_URL = 'http://api.eve-central.com/api/marketstat?hours=24&%s' def main(): conn = sqlite3.connect('everdi.db') cur = conn.cursor() # Get all items used in current BlueprintInstances cur.execute(""" SELECT DISTINCT c.item_id ...
Update prices for all BlueprintInstances we currently have
Update prices for all BlueprintInstances we currently have
Python
bsd-2-clause
madcowfred/evething,Gillingham/evething,cmptrgeekken/evething,madcowfred/evething,cmptrgeekken/evething,cmptrgeekken/evething,cmptrgeekken/evething,madcowfred/evething,Gillingham/evething,madcowfred/evething,cmptrgeekken/evething,Gillingham/evething,Gillingham/evething
--- +++ @@ -5,38 +5,37 @@ MARKET_URL = 'http://api.eve-central.com/api/marketstat?hours=24&%s' -ITEMS = [ - 34, # Tritanium - 35, # Pyerite - 36, # Mexallon - 37, # Isogen - 38, # Nocxium - 39, # Zydrine - 40, # Megacyte - 11399, # Morphite -] - def main(): conn = sqlite3.connect('everdi.db') cur = conn.c...
b1a33b1a89c00ee6de7949c529ecd4bcf2d38578
python/helper/asset_loading.py
python/helper/asset_loading.py
# Defining a function to load images def load_image(image_name, fade_enabled=False): """fade_enabled should be True if you want images to be able to fade""" try: #! Add stuff for loading images of the correct resolution # depending on the player's resolution settings if not fade_enabled:...
# Defining a function to load images def load_image(image_name, fade_enabled=False): """fade_enabled should be True if you want images to be able to fade""" try: #! Add stuff for loading images of the correct resolution # depending on the player's resolution settings if not fade_enabled:...
Fix error in file path of where images are loaded from in load_image()
Fix error in file path of where images are loaded from in load_image()
Python
mit
AndyDeany/pygame-template
--- +++ @@ -6,12 +6,12 @@ # depending on the player's resolution settings if not fade_enabled: return pygame.image.load("".join(( - file_directory, "Image Files\\", + file_directory, "assets\\images\\", image_name, ".png" )...
3103bba12ee3580b3f707e88dd23e853af7b47e0
calc.py
calc.py
#!/usr/bin/env python """A Python calculator""" import sys command = sys.argv[1] numbers = [float(a) for a in sys.argv[2:]] a = float(sys.argv[2]) b = float(sys.argv[3]) if command == 'add': print sum(numbers) elif command == 'multiply': product = 1 for num in numbers: product *= num print p...
#!/usr/bin/env python """A Python calculator""" import sys command = sys.argv[1] numbers = [float(a) for a in sys.argv[2:]] a = float(sys.argv[2]) b = float(sys.argv[3]) if command == 'add': print sum(numbers) elif command == 'multiply': product = 1 for num in numbers: product *= num print p...
Add smiley face to output
Add smiley face to output
Python
bsd-3-clause
mkuiper/calc
--- +++ @@ -22,3 +22,4 @@ div = a/b print div +print ':)'
54f70d759b2e0d384d626f4b55016166f9b26f16
camelot/roundtable/migrations/0002_add_knight_data.py
camelot/roundtable/migrations/0002_add_knight_data.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.core.management import call_command def add_knight_data(apps, schema_editor): call_command('loaddata', 'knight_data.json') def remove_knight_data(apps, schema_editor): pass class Migration(...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def add_knight_data(apps, schema_editor): Knight = apps.get_model('roundtable', 'Knight') Knight.objects.bulk_create([ Knight(name='Arthur'), Knight(name='Bedevere'), Knight(name='B...
Implement add_knight_data to generate data directly.
Implement add_knight_data to generate data directly.
Python
bsd-2-clause
jambonrose/djangocon2014-updj17
--- +++ @@ -1,11 +1,20 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations -from django.core.management import call_command def add_knight_data(apps, schema_editor): - call_command('loaddata', 'knight_data.json') + Knight = apps.get_model('roundtab...
8f0d56334243fa51b401b18139cefeefd26b6a9d
core/cb.project/python/sample/app.py
core/cb.project/python/sample/app.py
import os from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run( port=int(os.environ.get('PORT', 5000)) )
import os from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run( host="0.0.0.0", port=int(os.environ.get('PORT', 5000)) )
Fix error when running python sample on codebox.io
Fix error when running python sample on codebox.io
Python
apache-2.0
nobutakaoshiro/codebox,indykish/codebox,blubrackets/codebox,lcamilo15/codebox,rodrigues-daniel/codebox,rodrigues-daniel/codebox,Ckai1991/codebox,smallbal/codebox,code-box/codebox,rajthilakmca/codebox,fly19890211/codebox,ronoaldo/codebox,quietdog/codebox,LogeshEswar/codebox,listepo/codebox,indykish/codebox,CodeboxIDE/co...
--- +++ @@ -9,5 +9,6 @@ if __name__ == "__main__": app.run( + host="0.0.0.0", port=int(os.environ.get('PORT', 5000)) )
8b46628656e0e649a9c973c911c01e44222906b7
anchor/models.py
anchor/models.py
# Copyright 2014 Dave Kludt # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2014 Dave Kludt # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
Remove token from being stored
Remove token from being stored
Python
apache-2.0
oldarmyc/anchor,oldarmyc/anchor,oldarmyc/anchor
--- +++ @@ -30,7 +30,6 @@ class Account: def __init__(self, data): self.account_number = data.get('account_number') - self.token = data.get('token') self.cache_expiration = self.set_expiration() self.host_servers = data.get('host_servers') self.region = data.get('regio...
70a97ab38d2b30652c41d1e058ef4447fdd54863
test_settings.py
test_settings.py
import os SECRET_KEY = "h_ekayhzss(0lzsacd5cat7d=pu#51sh3w&uqn&#3#tz26vuq4" DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}} INSTALLED_APPS = [ "django.contrib.sites", "django.contrib.sessions", "django.contrib.contenttypes", "tz_detect", ] MIDDLEWARE_CLASSES = [...
import os SECRET_KEY = "h_ekayhzss(0lzsacd5cat7d=pu#51sh3w&uqn&#3#tz26vuq4" DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}} INSTALLED_APPS = [ "django.contrib.sites", "django.contrib.sessions", "django.contrib.contenttypes", "tz_detect", ] MIDDLEWARE_CLASSES = [...
Fix Django 5.0 deprecation warning.
Fix Django 5.0 deprecation warning.
Python
mit
adamcharnock/django-tz-detect,adamcharnock/django-tz-detect,adamcharnock/django-tz-detect
--- +++ @@ -20,3 +20,5 @@ MIDDLEWARE = MIDDLEWARE_CLASSES SITE_ID = 1 + +USE_TZ = True
8e13a10af23991bbd8aa6e59b6890fa729fe698f
social/info.py
social/info.py
""" Contains DemographicInfo class, which stores info found by accounts. """ from collections import UserDict class DemographicInfo(UserDict): def __setitem__(self, key, value): if key in self.data: self.data[key].add(value) else: self.data[key] = set([value])
""" Contains DemographicInfo class, which stores info found by accounts. """ from collections import UserDict import logging log = logging.getLogger('social.info') class DemographicInfo(UserDict): def __setitem__(self, key, value): # Ignore empty strings... if type(value) is str and value == '': ...
Add logging for DemographicInfo, and ignore empty strings.
Add logging for DemographicInfo, and ignore empty strings.
Python
bsd-3-clause
brenns10/social,brenns10/social
--- +++ @@ -3,10 +3,18 @@ """ from collections import UserDict +import logging +log = logging.getLogger('social.info') class DemographicInfo(UserDict): def __setitem__(self, key, value): + # Ignore empty strings... + if type(value) is str and value == '': + return + + log...
dcc309f0634eac6d7461d506cac4bc5b9cfbc311
experiments/T1T2/RamseySequence.py
experiments/T1T2/RamseySequence.py
import argparse import sys, os parser = argparse.ArgumentParser() parser.add_argument('pyqlabpath', help='path to PyQLab directory') parser.add_argument('qubit', help='qubit name') parser.add_argument('stop', help='longest delay in ns', type = int) parser.add_argument('step', help='delay step in ns', type = int) args ...
import argparse import sys, os parser = argparse.ArgumentParser() parser.add_argument('pyqlabpath', help='path to PyQLab directory') parser.add_argument('qubit', help='qubit name') parser.add_argument('stop', help='longest delay in ns', type = int) parser.add_argument('step', help='delay step in ns', type = int) args ...
Remove unnecessary (and py2) print
Remove unnecessary (and py2) print
Python
apache-2.0
BBN-Q/Qlab,BBN-Q/Qlab,BBN-Q/Qlab,BBN-Q/Qlab
--- +++ @@ -13,8 +13,6 @@ q = QubitFactory(args.qubit) RamseyStop = args.stop RamseyStep = args.step -print RamseyStep -print RamseyStop Ramsey(q, np.arange(0,RamseyStop/1e9,RamseyStep/1e9), suffix=True)
3d48b9b976603ea8c13937a0c6eac8a74d62b72d
calexicon/calendars/other.py
calexicon/calendars/other.py
from datetime import date as vanilla_date, timedelta from .base import Calendar class JulianDayNumber(Calendar): first_ce_day = vanilla_date(1, 1, 1) first_ce_day_number = 1721423 display_name = "Julian Day Number" @staticmethod def date_display_string(d): n = JulianDayNumber._day_number(...
from datetime import date as vanilla_date, timedelta from .base import Calendar from ..dates.bce import BCEDate class JulianDayNumber(Calendar): first_ce_day = vanilla_date(1, 1, 1) first_ce_day_number = 1721423 display_name = "Julian Day Number" @staticmethod def date_display_string(d): ...
Make a BCEDate for the dates before CE day 1.
Make a BCEDate for the dates before CE day 1.
Python
apache-2.0
jwg4/calexicon,jwg4/qual
--- +++ @@ -1,6 +1,7 @@ from datetime import date as vanilla_date, timedelta from .base import Calendar +from ..dates.bce import BCEDate class JulianDayNumber(Calendar): first_ce_day = vanilla_date(1, 1, 1) @@ -21,5 +22,12 @@ return (d - JulianDayNumber.first_ce_day).days + JulianDayNumber.first_...
a31103d5001c7c6ebebddd25f9d1bb4ed0e0c2e9
polling_stations/apps/data_importers/management/commands/import_gosport.py
polling_stations/apps/data_importers/management/commands/import_gosport.py
from data_importers.management.commands import BaseDemocracyCountsCsvImporter class Command(BaseDemocracyCountsCsvImporter): council_id = "GOS" addresses_name = "2022-05-05/2022-03-07T15:47:28.644792/2022 Borough of Gosport - Democracy Club - Polling Districts v1 (07 03 2022).csv" stations_name = "2022-05...
from data_importers.management.commands import BaseDemocracyCountsCsvImporter class Command(BaseDemocracyCountsCsvImporter): council_id = "GOS" addresses_name = "2022-05-05/2022-03-07T15:47:28.644792/2022 Borough of Gosport - Democracy Club - Polling Districts v1 (07 03 2022).csv" stations_name = "2022-05...
Fix Gosport import script error
Fix Gosport import script error
Python
bsd-3-clause
DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
--- +++ @@ -8,7 +8,7 @@ elections = ["2022-05-05"] def address_record_to_dict(self, record): - if record.addressline6 in ["PO12 2EH"]: + if record.postcode in ["PO12 2EH"]: return None return super().address_record_to_dict(record)
5d9eabe588231444083d13dc50371ea6952d445e
mirrit/web/models.py
mirrit/web/models.py
from bson.objectid import ObjectId from humbledb import Mongo, Document class ClassProperty (property): """Subclass property to make classmethod properties possible""" def __get__(self, cls, owner): return self.fget.__get__(None, owner)() class User(Document): username = '' password = '' ...
from bson.objectid import ObjectId from humbledb import Mongo, Document class ClassProperty (property): """Subclass property to make classmethod properties possible""" def __get__(self, cls, owner): return self.fget.__get__(None, owner)() class User(Document): username = '' password = '' ...
Add github token to model
Add github token to model
Python
bsd-3-clause
1stvamp/mirrit
--- +++ @@ -12,6 +12,7 @@ username = '' password = '' email = '' + github_access_token = '' config_database = 'mirrit' config_collection = 'users'
2b5a3f0209d4a5fc5e821ca4f749931d8f6a18be
app/wmmetrics.py
app/wmmetrics.py
from flask import Flask, render_template app = Flask(__name__) @app.route("/") def index(): return render_template('index.html') @app.route("/fdc") def fdc_report_page(): return render_template('fdc-report.html') if __name__ == "__main__": app.run(debug=True)
import os import sys from flask import Flask, render_template, request current_dir = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(current_dir, '..')) from wm_metrics import fdc from wm_metrics import wmfr_photography from wm_metrics import commons_cat_metrics app = Flask(__name__) @app...
Add imports for Wm_metrics module
Webapp: Add imports for Wm_metrics module We have to manually add wm_metrics to the Python Path
Python
mit
danmichaelo/wm_metrics,Commonists/wm_metrics,Commonists/wm_metrics,Commonists/wm_metrics,Commonists/wm_metrics,danmichaelo/wm_metrics,danmichaelo/wm_metrics,danmichaelo/wm_metrics
--- +++ @@ -1,4 +1,14 @@ -from flask import Flask, render_template +import os +import sys +from flask import Flask, render_template, request + +current_dir = os.path.abspath(os.path.dirname(__file__)) +sys.path.insert(0, os.path.join(current_dir, '..')) + +from wm_metrics import fdc +from wm_metrics import wmfr_photo...
85748ff761ef1373a9828829a447c7b83db246de
coliziune/teste/generate_ok.py
coliziune/teste/generate_ok.py
from sh import cp, rm import sh import os SURSA_CPP = 'main.cpp' PROBLEMA = 'coliziune' cp('../' + SURSA_CPP, '.') os.system('g++ ' + SURSA_CPP) for i in range(1, 11): print 'Testul ', i cp(PROBLEMA + str(i) + '.in', PROBLEMA + '.in') os.system('./a.out') cp(PROBLEMA + '.out', PROBLEMA + str(i) + '.ok') for...
import subprocess from sh import cp, rm import sh import os SURSA_CPP = 'medie.cpp' PROBLEMA = 'coliziune' cp('../' + SURSA_CPP, '.') os.system('g++ ' + SURSA_CPP) for i in range(1, 11): print 'Testul ', i cp(PROBLEMA + str(i) + '.in', PROBLEMA + '.in') print subprocess.check_output('time ./a.out', shell=True)...
Print time it took to run the source
Print time it took to run the source
Python
mit
palcu/rotopcoder,palcu/rotopcoder
--- +++ @@ -1,8 +1,9 @@ +import subprocess from sh import cp, rm import sh import os -SURSA_CPP = 'main.cpp' +SURSA_CPP = 'medie.cpp' PROBLEMA = 'coliziune' cp('../' + SURSA_CPP, '.') @@ -11,7 +12,7 @@ for i in range(1, 11): print 'Testul ', i cp(PROBLEMA + str(i) + '.in', PROBLEMA + '.in') - os.syst...
87978c2b72777f3ef97cf1ae16f14797977bc34d
morenines/ignores.py
morenines/ignores.py
import os from fnmatch import fnmatchcase import click class Ignores(object): @classmethod def read(cls, path): ignores = cls() with click.open_file(path, 'r') as stream: ignores.patterns = [line.strip() for line in stream] return ignores def __init__(self): ...
import os from fnmatch import fnmatchcase import click class Ignores(object): def __init__(self, default_patterns=[]): self.patterns = default_patterns def read(cls, path): with open(path, 'r') as stream: self.patterns.extend([line.strip() for line in stream]) def match(s...
Make Ignores init accept default patterns
Make Ignores init accept default patterns This also makes read() an instance method instead of a class method.
Python
mit
mcgid/morenines,mcgid/morenines
--- +++ @@ -4,18 +4,13 @@ class Ignores(object): - @classmethod + def __init__(self, default_patterns=[]): + self.patterns = default_patterns + def read(cls, path): - ignores = cls() - - with click.open_file(path, 'r') as stream: - ignores.patterns = [line.strip() for l...
c3838132d3a4622ab4c9660f574e8219ac5e164b
mysite/core/tasks.py
mysite/core/tasks.py
from intercom.client import Client from django.conf import settings from celery import shared_task intercom = Client(personal_access_token=settings.INTERCOM_ACCESS_TOKEN) @shared_task def intercom_event(event_name, created_at, email, metadata): intercom.events.create( event_name=event_name, crea...
import logging from intercom.client import Client from django.conf import settings from celery import shared_task log = logging.getLogger(__name__) intercom = Client(personal_access_token=settings.INTERCOM_ACCESS_TOKEN) @shared_task def intercom_event(event_name, created_at, email, metadata): intercom.even...
Add logging for Intercom event generation
Add logging for Intercom event generation
Python
apache-2.0
raccoongang/socraticqs2,raccoongang/socraticqs2,cjlee112/socraticqs2,raccoongang/socraticqs2,cjlee112/socraticqs2,cjlee112/socraticqs2,raccoongang/socraticqs2,cjlee112/socraticqs2
--- +++ @@ -1,16 +1,20 @@ +import logging + from intercom.client import Client from django.conf import settings from celery import shared_task +log = logging.getLogger(__name__) intercom = Client(personal_access_token=settings.INTERCOM_ACCESS_TOKEN) @shared_task -def intercom_event(event_name, created_at...
702217fee6e332b3d08902bb67f0725626f0c88d
test_defuzz.py
test_defuzz.py
from defuzz import Defuzzer def test_it(): dfz = Defuzzer() assert dfz.defuzz((1, 2)) == (1, 2) assert dfz.defuzz((1, 3)) == (1, 3) assert dfz.defuzz((1.00000001, 2)) == (1, 2) assert dfz.defuzz((1, 2, 3, 4, 5)) == (1, 2, 3, 4, 5) assert dfz.defuzz((2.00000001, 3)) == (2.00000001, 3) asser...
import itertools import math from defuzz import Defuzzer from hypothesis import given from hypothesis.strategies import floats, lists, tuples from hypo_helpers import f def test_it(): dfz = Defuzzer() assert dfz.defuzz((1, 2)) == (1, 2) assert dfz.defuzz((1, 3)) == (1, 3) assert dfz.defuzz((1.00000...
Add a Hypothesis test for Defuzzer
Add a Hypothesis test for Defuzzer
Python
apache-2.0
nedbat/zellij
--- +++ @@ -1,4 +1,12 @@ +import itertools +import math + from defuzz import Defuzzer + +from hypothesis import given +from hypothesis.strategies import floats, lists, tuples + +from hypo_helpers import f def test_it(): @@ -9,3 +17,20 @@ assert dfz.defuzz((1, 2, 3, 4, 5)) == (1, 2, 3, 4, 5) assert dfz...
12209289ebbdd5d7b93e6eb671582a36bec1d6c2
wdom/__init__.py
wdom/__init__.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*-
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys if sys.version_info < (3, 5): import warnings warnings.warn( 'Next version of WDOM will not support python 3.4. Please update to version 3.6+.' # noqa: E501 )
Raise warning when python version is < 3.5
Raise warning when python version is < 3.5
Python
mit
miyakogi/wdom,miyakogi/wdom,miyakogi/wdom
--- +++ @@ -1,2 +1,10 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- + +import sys + +if sys.version_info < (3, 5): + import warnings + warnings.warn( + 'Next version of WDOM will not support python 3.4. Please update to version 3.6+.' # noqa: E501 + )
c9868c56ca2aa4e5cfe2c9bad595b4d46d3a0137
bcbiovm/__init__.py
bcbiovm/__init__.py
"""Run bcbio-nextgen installations inside of virtual machines and containers. """
"""Run bcbio-nextgen installations inside of virtual machines and containers. """ class Config(object): """Container for global config values.""" def __init__(self, config=None): self._data = {} if config: self.update(config) def __str__(self): """String representat...
Add container for global configurations
Add container for global configurations
Python
mit
alexandrucoman/bcbio-nextgen-vm,alexandrucoman/bcbio-nextgen-vm
--- +++ @@ -1,2 +1,47 @@ -"""Run bcbio-nextgen installations inside of virtual machines and containers. +"""Run bcbio-nextgen installations inside of virtual machines +and containers. """ + + +class Config(object): + + """Container for global config values.""" + + def __init__(self, config=None): + self...
8d5658ac5fa12381797b8c5f5fcd7f010aa3af0d
azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/__init__.py
azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/__init__.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
Fix incorrect CustomVision base init.py
Fix incorrect CustomVision base init.py
Python
mit
Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python
--- +++ @@ -11,6 +11,4 @@ from .version import VERSION -__all__ = ['ManagedServiceIdentityClient'] - __version__ = VERSION
d25d5569f51bf78d58eb461d16e9283b920b3fd7
skylines/api/views/__init__.py
skylines/api/views/__init__.py
from flask import request from werkzeug.exceptions import Forbidden from werkzeug.useragents import UserAgent from .errors import register as register_error_handlers from .airports import airports_blueprint from .airspace import airspace_blueprint from .mapitems import mapitems_blueprint from .waves import waves_bluepr...
from flask import request from werkzeug.exceptions import Forbidden from werkzeug.useragents import UserAgent def register(app): """ :param flask.Flask app: a Flask app """ from .errors import register as register_error_handlers from .airports import airports_blueprint from .airspace import a...
Move blueprint imports into register() function
api/views: Move blueprint imports into register() function
Python
agpl-3.0
TobiasLohner/SkyLines,shadowoneau/skylines,skylines-project/skylines,RBE-Avionik/skylines,Harry-R/skylines,RBE-Avionik/skylines,snip/skylines,snip/skylines,skylines-project/skylines,skylines-project/skylines,skylines-project/skylines,shadowoneau/skylines,TobiasLohner/SkyLines,Harry-R/skylines,TobiasLohner/SkyLines,Turb...
--- +++ @@ -1,17 +1,18 @@ from flask import request from werkzeug.exceptions import Forbidden from werkzeug.useragents import UserAgent -from .errors import register as register_error_handlers -from .airports import airports_blueprint -from .airspace import airspace_blueprint -from .mapitems import mapitems_bluepr...
34d895499f9e2a9fe35937ad511fc1adbfd8c12d
tailor/main.py
tailor/main.py
import os import sys PARENT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..') sys.path.append(PARENT_PATH) from antlr4 import FileStream, CommonTokenStream, ParseTreeWalker from tailor.listeners.mainlistener import MainListener from tailor.output.printer import Printer from tailor.swift.swiftlexe...
"""Perform static analysis on a Swift source file.""" import argparse import os import sys PARENT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..') sys.path.append(PARENT_PATH) from antlr4 import FileStream, CommonTokenStream, ParseTreeWalker from tailor.listeners.mainlistener import MainListene...
Set up argparse to accept params and display usage
Set up argparse to accept params and display usage
Python
mit
sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor
--- +++ @@ -1,3 +1,6 @@ +"""Perform static analysis on a Swift source file.""" + +import argparse import os import sys @@ -12,10 +15,20 @@ from tailor.swift.swiftparser import SwiftParser -def main(argv): - infile = FileStream(argv[1]) - printer = Printer(filepath=argv[1]) - lexer = SwiftLexer(infil...
cae249ff553083e3546e26b08779baf6abc69a69
active_link/templatetags/active_link_tags.py
active_link/templatetags/active_link_tags.py
from django import VERSION as DJANGO_VERSION from django import template from django.conf import settings if DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] <= 9: from django.core.urlresolvers import reverse else: from django.urls import reverse register = template.Library() @register.simple_tag(takes_context=T...
from django import VERSION as DJANGO_VERSION from django import template from django.conf import settings if DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] <= 9: from django.core.urlresolvers import reverse else: from django.urls import reverse register = template.Library() @register.simple_tag(takes_context=T...
Improve how the active link is checked
Improve how the active link is checked
Python
bsd-3-clause
valerymelou/django-active-link
--- +++ @@ -33,7 +33,7 @@ if strict: active = request.path == path else: - active = path in request.path + active = request.path.find(path) == 0 if active: return css_class return ''
2036b054a57cade23e513877e1dff9455c3d74c7
meetup/models.py
meetup/models.py
from django.db import models from pizzaplace.models import PizzaPlace from django.core.validators import RegexValidator from meetup.services.meetup_api_lookup_agent import MeetupApiLookupAgent from django.core.exceptions import ValidationError def validate_urlname(link): validator = RegexValidator( regex='meetu...
from django.db import models from pizzaplace.models import PizzaPlace from django.core.validators import RegexValidator from meetup.services.meetup_api_lookup_agent import MeetupApiLookupAgent from django.core.exceptions import ValidationError from model_utils.models import TimeStampedModel def validate_urlname(link):...
Improve meetup's validation error messages
Improve meetup's validation error messages
Python
mit
nicole-a-tesla/meetup.pizza,nicole-a-tesla/meetup.pizza
--- +++ @@ -3,26 +3,23 @@ from django.core.validators import RegexValidator from meetup.services.meetup_api_lookup_agent import MeetupApiLookupAgent from django.core.exceptions import ValidationError - +from model_utils.models import TimeStampedModel def validate_urlname(link): validator = RegexValidator( ...
494bfbd5f189cb0f61eecc7e86df53fb9f9a8203
src/ggrc/migrations/versions/20150911131818_29dca3ce0556_change_conclusion_dropdowns_options_in_.py
src/ggrc/migrations/versions/20150911131818_29dca3ce0556_change_conclusion_dropdowns_options_in_.py
"""Change conclusion dropdowns options in control assessment Revision ID: 29dca3ce0556 Revises: 2d8a46b1e4a4 Create Date: 2015-09-11 13:18:18.269109 """ # revision identifiers, used by Alembic. revision = '29dca3ce0556' down_revision = '2d8a46b1e4a4' from alembic import op import sqlalchemy as sa from sqlalchemy.d...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: jost@reciprocitylabs.com # Maintained By: jost@reciprocitylabs.com """Change conclusion dropdowns options in control assessment Revision ID: 29dca...
Add copyright header to migration
Add copyright header to migration
Python
apache-2.0
NejcZupec/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,josthkko/ggrc-core,hyperNURb/ggrc-core,NejcZupec/ggrc-core,jmakov/ggrc-core,hyperNURb/ggrc-core,kr41/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,andrei-karalionak/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,hasanalom/ggrc-core,andrei-karalionak/ggrc-core,j...
--- +++ @@ -1,3 +1,7 @@ +# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> +# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> +# Created By: jost@reciprocitylabs.com +# Maintained By: jost@reciprocitylabs.com """Change conclusion dropdowns options in contro...
1d0c6389cc7d67acb5123555568d83f17f6b0ff0
templatetags/generic_markup.py
templatetags/generic_markup.py
""" A filter which can perform many types of text-to-HTML conversion. """ from django.template import Library from template_utils.markup import markup_filter def apply_markup(value): """ Applies text-to-HTML conversion. """ return markup_filter(value) register = Library() register.filter(apply_mark...
""" A filter which can perform many types of text-to-HTML conversion. """ from django.template import Library from template_utils.markup import markup_filter def apply_markup(value, arg=None): """ Applies text-to-HTML conversion. Takes an optional argument to specify the name of a filter to use. ""...
Make markup template filter take filter_name argument
Make markup template filter take filter_name argument
Python
bsd-3-clause
dongpoliu/django-template-utils
--- +++ @@ -6,11 +6,15 @@ from django.template import Library from template_utils.markup import markup_filter -def apply_markup(value): +def apply_markup(value, arg=None): """ Applies text-to-HTML conversion. + Takes an optional argument to specify the name of a filter to use. + """ + if ar...
27d40996f0912a1b9b16afa0884f10b1504acce2
scoring_engine/web/__init__.py
scoring_engine/web/__init__.py
import os from flask import Flask app = Flask(__name__) app.config.from_pyfile('settings.cfg') app.secret_key = os.urandom(128) from scoring_engine.web.views import welcome, scoreboard, overview, services, admin, auth, profile, api, about app.register_blueprint(welcome.mod) app.register_blueprint(scoreboard.mod) ap...
import os import logging from flask import Flask app = Flask(__name__) app.config.from_pyfile('settings.cfg') app.secret_key = os.urandom(128) log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) from scoring_engine.web.views import welcome, scoreboard, overview, services, admin, auth, profile, api, ab...
Use error severity for flask output
Use error severity for flask output
Python
mit
pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine
--- +++ @@ -1,10 +1,16 @@ import os +import logging from flask import Flask + app = Flask(__name__) app.config.from_pyfile('settings.cfg') app.secret_key = os.urandom(128) + + +log = logging.getLogger('werkzeug') +log.setLevel(logging.ERROR) from scoring_engine.web.views import welcome, scoreboard, overvi...
a22b1019b8bcea2f6bdaf90635165d8d8968dee1
scripts/parse-include-paths.py
scripts/parse-include-paths.py
#!/usr/bin/env python3 """ Deploys the website to a target directory supplied as an argument. """ import json import os import sys def iterate_over(dict_or_list, result): """ Iterates recursively over nested lists and dictionaries keeping track of all "path" values with the key "includePath" within n...
#!/usr/bin/env python3 """ Parses .vscode/.cmaketools.json to obtain a list of include paths. These can then be subsequently pasted into .vscode/c_cpp_properties.json to make intellisense work. This is script exists purely for convenience and only needs to be used when the include paths change (e.g. when a new depende...
Fix incorrect global comment in include path script
Fix incorrect global comment in include path script
Python
bsd-3-clause
Tom94/tev,Tom94/tev,Tom94/tev,Tom94/tev
--- +++ @@ -1,7 +1,11 @@ #!/usr/bin/env python3 """ -Deploys the website to a target directory supplied as an argument. +Parses .vscode/.cmaketools.json to obtain a list of include paths. +These can then be subsequently pasted into .vscode/c_cpp_properties.json +to make intellisense work. This is script exists pu...
06d9ada18ef8d201383317e6e0fac078a01ab206
tests/test_vector2_equality.py
tests/test_vector2_equality.py
from hypothesis import given from ppb_vector import Vector2 from utils import vectors def test_equal(): test_vector_1 = Vector2(50, 800) test_vector_2 = Vector2(50, 800) assert test_vector_1 == test_vector_2 @given(x=vectors(), y=vectors()) def test_not_equal_equivalent(x: Vector2, y: Vector2): assert (x !=...
from hypothesis import assume, given from ppb_vector import Vector2 from utils import vectors @given(x=vectors()) def test_equal_self(x: Vector2): assert x == x @given(x=vectors()) def test_non_zero_equal(x: Vector2): assume(x != (0, 0)) assert x != 1.1 * x @given(x=vectors(), y=vectors()) def test_not_equal_...
Replace test for == with an Hypothesis test
tests/equality: Replace test for == with an Hypothesis test
Python
artistic-2.0
ppb/ppb-vector,ppb/ppb-vector
--- +++ @@ -1,13 +1,16 @@ -from hypothesis import given +from hypothesis import assume, given from ppb_vector import Vector2 from utils import vectors -def test_equal(): - test_vector_1 = Vector2(50, 800) - test_vector_2 = Vector2(50, 800) - assert test_vector_1 == test_vector_2 +@given(x=vectors()) +def tes...
2f7551b953bb225b68880cdeec87236ea6453b12
tohu/v6/set_special_methods.py
tohu/v6/set_special_methods.py
""" This module is not meant to be imported directly. Its purpose is to patch the TohuBaseGenerator class so that its special methods __add__, __mul__ etc. support other generators as arguments. """ from operator import add, mul, gt, ge, lt, le, eq from .base import TohuBaseGenerator from .primitive_generators import...
""" This module is not meant to be imported directly. Its purpose is to patch the TohuBaseGenerator class so that its special methods __add__, __mul__ etc. support other generators as arguments. """ from .base import TohuBaseGenerator from .primitive_generators import GeoJSONGeolocation, as_tohu_generator from .derive...
Set special methods on TohuBaseGenerator to allow e.g. adding two generators
Set special methods on TohuBaseGenerator to allow e.g. adding two generators
Python
mit
maxalbert/tohu
--- +++ @@ -5,13 +5,61 @@ support other generators as arguments. """ +from .base import TohuBaseGenerator +from .primitive_generators import GeoJSONGeolocation, as_tohu_generator +from .derived_generators import Apply, GetAttribute from operator import add, mul, gt, ge, lt, le, eq -from .base import TohuBaseGe...
abd7987e698e9102a7d737f3b32296d703ae0a7c
scripts/buildAll.py
scripts/buildAll.py
#! /usr/bin/python # # Build the entire ISAAC Project # # # import subprocess import os import sys projects = ['va-ochre', 'va-isaac-metadata', 'va-isaac-mojo', 'va-newtons-cradle', 'va-logic', 'va-query-service', 'va-isaac-gui', 'va-solor-goods', 'va-expression-service', 'va-isaac-gui-pa']...
#! /usr/bin/python # # Build the entire ISAAC Project # # # import subprocess import os import sys projects = ['va-isaac-parent', 'va-ochre', 'va-isaac-metadata', 'va-isaac-mojo', 'va-newtons-cradle', 'va-logic', 'va-query-service', 'va-isaac-gui', 'va-solor-goods', 'va-expression-service',...
Revert "Fixed a windows bug that prevented run locating the Maven batch file to run mvn commands. This will need to be modified to run on Linux"
Revert "Fixed a windows bug that prevented run locating the Maven batch file to run mvn commands. This will need to be modified to run on Linux" This reverts commit b9dfad50415d6f7d90d66da30a1a55cbe62a07ef.
Python
apache-2.0
Apelon-VA/va-isaac-docs
--- +++ @@ -9,7 +9,8 @@ import os import sys -projects = ['va-ochre', +projects = ['va-isaac-parent', + 'va-ochre', 'va-isaac-metadata', 'va-isaac-mojo', 'va-newtons-cradle', @@ -21,36 +22,26 @@ 'va-isaac-gui-pa'] -args = ['-e', 'clean'] +defaultArgs = ['-e', 'clean'] -def mvn(*args): - pr...
62d7924f6f5097845a21408e975cae1dfff01c1c
android/app/src/main/assets/python/enamlnative/widgets/analog_clock.py
android/app/src/main/assets/python/enamlnative/widgets/analog_clock.py
''' Copyright (c) 2017, Jairus Martin. Distributed under the terms of the MIT License. The full license is in the file COPYING.txt, distributed with this software. Created on May 20, 2017 @author: jrm ''' from atom.api import ( Typed, ForwardTyped, Unicode, observe ) from enaml.core.declarative import d_ from...
''' Copyright (c) 2017, Jairus Martin. Distributed under the terms of the MIT License. The full license is in the file COPYING.txt, distributed with this software. Created on May 20, 2017 @author: jrm ''' from atom.api import ( Typed, ForwardTyped, Unicode, observe ) from enaml.core.declarative import d_ from...
Use correct parent class for clock
Use correct parent class for clock
Python
mit
codelv/enaml-native,codelv/enaml-native,codelv/enaml-native,codelv/enaml-native
--- +++ @@ -15,10 +15,10 @@ from enaml.core.declarative import d_ -from .text_view import TextView, ProxyTextView +from .view import View, ProxyView -class ProxyAnalogClock(ProxyTextView): +class ProxyAnalogClock(ProxyView): """ The abstract definition of a proxy AnalogClock object. """ @@ -26,7 ...
634f718aa4fe4052a8dc9be1f82078ebcd2338df
build-release.py
build-release.py
import sys import glob import re NEW_VERSION = sys.argv[1] with open('VERSION') as f: VERSION=f.read() print NEW_VERSION print VERSION def set_assemblyinfo_version(version): aLineRe = "AssemblyVersion|AssemblyFileVersion\(\"([\.0-9]+)\"\)" aVersionRe = "(\d\.\d\.\d)" print "Changing versi...
import sys import glob import re NEW_VERSION = sys.argv[1] with open('VERSION') as f: VERSION=f.read() print NEW_VERSION print VERSION def set_assemblyinfo_version(version): aLineRe = "AssemblyVersion|AssemblyFileVersion\(\"([\.0-9]+)\"\)" aVersionRe = "(\d\.\d\.\d)" print "Changing versi...
Revert "working on version file"
Revert "working on version file" This reverts commit cb159cd3d907aeaa65f6a293d95a0aa7d7f2fee8.
Python
mit
psistats/windows-client,psistats/windows-client,psistats/windows-client
--- +++ @@ -35,10 +35,4 @@ with open(name, "w") as f: f.write("".join(new_file)) -def set_version_file(version): - print "Working on VERSION file" - with open("VERSION", "w") as f: - f.write(version) - -set_verion_file(NEW_VERSION) set_assemblyinfo_version(NEW...
d4c5e7a9d9b6fb795c5a16cf6a7d12f5ec32b160
peas-demo/plugins/pythonhello/pythonhello.py
peas-demo/plugins/pythonhello/pythonhello.py
# -*- coding: utf-8 -*- # ex:set ts=4 et sw=4 ai: import gobject from gi.repository import Peas from gi.repository import Gtk LABEL_STRING="Python Says Hello!" class PythonHelloPlugin(gobject.GObject, Peas.Activatable): __gtype_name__ = 'PythonHelloPlugin' def do_activate(self, window): print "Pytho...
# -*- coding: utf-8 -*- # ex:set ts=4 et sw=4 ai: import gobject from gi.repository import Peas from gi.repository import PeasUI from gi.repository import Gtk LABEL_STRING="Python Says Hello!" class PythonHelloPlugin(gobject.GObject, Peas.Activatable): __gtype_name__ = 'PythonHelloPlugin' def do_activate(se...
Add a configure dialog to the python plugin.
peas-demo: Add a configure dialog to the python plugin.
Python
lgpl-2.1
chergert/libpeas,chergert/libpeas,GNOME/libpeas,Distrotech/libpeas,GNOME/libpeas,Distrotech/libpeas,gregier/libpeas,Distrotech/libpeas,gregier/libpeas,gregier/libpeas,chergert/libpeas,gregier/libpeas
--- +++ @@ -3,6 +3,7 @@ import gobject from gi.repository import Peas +from gi.repository import PeasUI from gi.repository import Gtk LABEL_STRING="Python Says Hello!" @@ -24,3 +25,9 @@ def do_update_state(self, window): print "PythonHelloPlugin.do_update_state", repr(window) + +class PythonHe...
aeafebbb2bb5ddf4e2d2ddd47cd16d8ed515ac1b
portal/models.py
portal/models.py
from django.db import models from common.util.generator import get_random_id class Student(models.Model): # ToDo: Make username unique username = models.CharField(max_length=7) magic_id = models.CharField(max_length=8) child = models.BooleanField() def __str__(self): return self.username...
from django.db import models from common.util.generator import get_random_id class Student(models.Model): username = models.CharField(max_length=7,unique=True) magic_id = models.CharField(max_length=8) child = models.BooleanField() def __str__(self): return self.username def save(self, ...
Enforce unique user names in the database model
Enforce unique user names in the database model Set unique=TRUE and deleted TODO comment line
Python
mit
martinzlocha/mad,martinzlocha/mad,martinzlocha/mad
--- +++ @@ -4,8 +4,7 @@ class Student(models.Model): - # ToDo: Make username unique - username = models.CharField(max_length=7) + username = models.CharField(max_length=7,unique=True) magic_id = models.CharField(max_length=8) child = models.BooleanField()
f38eb25fe13320297baad173c8e6d6ac7cfb9542
spacy/tests/tokens/test_vec.py
spacy/tests/tokens/test_vec.py
from __future__ import unicode_literals from spacy.en import English import pytest @pytest.mark.models def test_vec(EN): hype = EN.vocab['hype'] assert hype.orth_ == 'hype' assert 0.08 >= hype.vector[0] > 0.07 @pytest.mark.models def test_capitalized(EN): hype = EN.vocab['Hype'] assert hype.ort...
from __future__ import unicode_literals from spacy.en import English import pytest @pytest.mark.models def test_vec(EN): hype = EN.vocab['hype'] assert hype.orth_ == 'hype' assert -0.7 >= hype.vector[0] > -0.8 @pytest.mark.models def test_capitalized(EN): hype = EN.vocab['Hype'] assert hype.ort...
Fix test for word vector
Fix test for word vector
Python
mit
oroszgy/spaCy.hu,recognai/spaCy,oroszgy/spaCy.hu,oroszgy/spaCy.hu,banglakit/spaCy,explosion/spaCy,explosion/spaCy,raphael0202/spaCy,banglakit/spaCy,Gregory-Howard/spaCy,recognai/spaCy,Gregory-Howard/spaCy,recognai/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,honnibal/spaCy,recognai/spaCy,banglakit/spaCy,explosion/spaCy,a...
--- +++ @@ -8,11 +8,11 @@ def test_vec(EN): hype = EN.vocab['hype'] assert hype.orth_ == 'hype' - assert 0.08 >= hype.vector[0] > 0.07 + assert -0.7 >= hype.vector[0] > -0.8 @pytest.mark.models def test_capitalized(EN): hype = EN.vocab['Hype'] assert hype.orth_ == 'Hype' - assert 0...
e81c56e1f3b682e0cfffa40851aed817be3b1812
etcd3/__init__.py
etcd3/__init__.py
from __future__ import absolute_import import etcd3.etcdrpc as etcdrpc from etcd3.client import Etcd3Client from etcd3.client import Transactions from etcd3.client import client from etcd3.members import Member __author__ = 'Louis Taylor' __email__ = 'louis@kragniz.eu' __version__ = '0.2.2' __all__ = ( 'Etcd3Cli...
from __future__ import absolute_import import etcd3.etcdrpc as etcdrpc from etcd3.client import Etcd3Client from etcd3.client import Transactions from etcd3.client import client from etcd3.leases import Lease from etcd3.members import Member __author__ = 'Louis Taylor' __email__ = 'louis@kragniz.eu' __version__ = '0....
Add Lease to public api
Add Lease to public api
Python
apache-2.0
kragniz/python-etcd3
--- +++ @@ -4,6 +4,7 @@ from etcd3.client import Etcd3Client from etcd3.client import Transactions from etcd3.client import client +from etcd3.leases import Lease from etcd3.members import Member __author__ = 'Louis Taylor' @@ -12,6 +13,7 @@ __all__ = ( 'Etcd3Client', + 'Lease', 'Member', ...
00a7f13ac2dbbd7449fd0ce260a21448c67b73e9
birdwatch/api.py
birdwatch/api.py
__author__ = 'jloeffler' def list_projects(): return {} def list_contributors(): return {}
__author__ = 'jloeffler' from github3 import GitHub from github3.models import GitHubError from github3.repos.repo import Repository from birdwatch.configuration import configuration from birdwatch.collector import Project def list_projects(): # just for testing github = GitHub(token=configuration.github_tok...
Return one project for testing
Return one project for testing
Python
apache-2.0
marky-mark/catwatch,AlexanderYastrebov/catwatch,AlexanderYastrebov/catwatch,marky-mark/catwatch,AlexanderYastrebov/catwatch,marky-mark/catwatch,AlexanderYastrebov/catwatch,marky-mark/catwatch
--- +++ @@ -1,8 +1,22 @@ __author__ = 'jloeffler' + +from github3 import GitHub +from github3.models import GitHubError +from github3.repos.repo import Repository +from birdwatch.configuration import configuration +from birdwatch.collector import Project def list_projects(): - return {} + # just for testi...
36d3c2f81ea39968bc58bab172e6bf035147ae3c
mpld3/test_plots/test_logscale.py
mpld3/test_plots/test_logscale.py
"""Plot to test logscale""" import matplotlib.pyplot as plt import numpy as np import mpld3 def create_plot(): fig = plt.figure() fig.subplots_adjust(hspace=0.4, wspace=0.4) ax1 = fig.add_subplot(2, 2, 1) ax2 = fig.add_subplot(2, 2, 2, sharey=ax1, xscale='log') ax3 = fig.add_subplot(2, 2, 3, shar...
""" Plot to test logscale TODO (@vladh): `sharex` and `sharey` seem to cause the tick labels to go nuts. This needs to be fixed. """ import matplotlib.pyplot as plt import numpy as np import mpld3 def create_plot(): fig = plt.figure() fig.subplots_adjust(hspace=0.4, wspace=0.4) ax1 = fig.add_subplot(2, ...
Add TODO to broken test
Add TODO to broken test
Python
bsd-3-clause
mpld3/mpld3,jakevdp/mpld3,jakevdp/mpld3,mpld3/mpld3
--- +++ @@ -1,4 +1,9 @@ -"""Plot to test logscale""" +""" +Plot to test logscale + +TODO (@vladh): `sharex` and `sharey` seem to cause the tick labels to go nuts. This needs to +be fixed. +""" import matplotlib.pyplot as plt import numpy as np import mpld3
692f13b9dbe994baf44bf42384e956608b94fede
aldryn_apphooks_config/utils.py
aldryn_apphooks_config/utils.py
# -*- coding: utf-8 -*- from app_data import AppDataContainer, app_registry from cms.apphook_pool import apphook_pool from django.core.urlresolvers import resolve def get_app_instance(request): """ Returns a tuple containing the current namespace and the AppHookConfig instance :param request: request obj...
# -*- coding: utf-8 -*- from app_data import AppDataContainer, app_registry from cms.apphook_pool import apphook_pool from django.core.urlresolvers import resolve def get_app_instance(request): """ Returns a tuple containing the current namespace and the AppHookConfig instance :param request: request obj...
Add better check for being in a CMS-page request
Add better check for being in a CMS-page request
Python
bsd-3-clause
aldryn/aldryn-apphooks-config,aldryn/aldryn-apphooks-config,aldryn/aldryn-apphooks-config
--- +++ @@ -12,7 +12,7 @@ :return: namespace, config """ app = None - if request.current_page: + if getattr(request, 'current_page', None): app = apphook_pool.get_apphook(request.current_page.application_urls) config = None
829ad434f42b457294d44108b26c6880cd0e4c36
pymatgen/__init__.py
pymatgen/__init__.py
__author__ = ", ".join(["Shyue Ping Ong", "Anubhav Jain", "Geoffroy Hautier", "William Davidson Richard", "Stephen Dacek", "Sai Jayaraman", "Michael Kocher", "Dan Gunter", "Shreyas Cholia", "Vincent L Chevrier", "Rickard Arm...
__author__ = ", ".join(["Shyue Ping Ong", "Anubhav Jain", "Geoffroy Hautier", "William Davidson Richard", "Stephen Dacek", "Sai Jayaraman", "Michael Kocher", "Dan Gunter", "Shreyas Cholia", "Vincent L Chevrier", "Rickard Arm...
Remove zopen in pymatgen root.
Remove zopen in pymatgen root. Former-commit-id: 375be0147716d3b4d2dee95680eae4ee3804716b [formerly 05648421c1fa77f6f339f68be2c43bb7952e918a] Former-commit-id: e5cfaf0277815951ddb09d9d6b30876e400870d7
Python
mit
dongsenfo/pymatgen,Bismarrck/pymatgen,czhengsci/pymatgen,fraricci/pymatgen,blondegeek/pymatgen,johnson1228/pymatgen,montoyjh/pymatgen,richardtran415/pymatgen,vorwerkc/pymatgen,fraricci/pymatgen,tallakahath/pymatgen,mbkumar/pymatgen,davidwaroquiers/pymatgen,ndardenne/pymatgen,montoyjh/pymatgen,xhqu1981/pymatgen,vorwerkc...
--- +++ @@ -12,6 +12,5 @@ from .serializers.json_coders import PMGJSONEncoder, PMGJSONDecoder, \ pmg_dump, pmg_load from .electronic_structure.core import Spin, Orbital -from .util.io_utils import zopen from .io.smartio import read_structure, write_structure, read_mol, write_mol from .matproj.rest import MPR...
b800f746e73634fe04a9a1ec45ef62dd7528f219
comrade/utils.py
comrade/utils.py
import random import hashlib import base64 def generate_key(): key = hashlib.sha224(str(random.getrandbits(256))).digest() key = base64.b64encode(key, random.choice(['rA','aZ','gQ','hH','hG','aR','DD'])) key = key.rstrip('==') return key def chunked(seq, n): """By Ned Batchelder. ...
import random import hashlib import base64 def generate_key(): key = hashlib.sha224(str(random.getrandbits(256))).digest() key = base64.b64encode(key, random.choice(['rA','aZ','gQ','hH','hG','aR','DD'])) key = key.rstrip('==').lower() return key def chunked(seq, n): """By Ned Batcheld...
Return lowercased random tokens for consistency.
Return lowercased random tokens for consistency.
Python
mit
bueda/django-comrade
--- +++ @@ -6,7 +6,7 @@ key = hashlib.sha224(str(random.getrandbits(256))).digest() key = base64.b64encode(key, random.choice(['rA','aZ','gQ','hH','hG','aR','DD'])) - key = key.rstrip('==') + key = key.rstrip('==').lower() return key def chunked(seq, n):
0563882d0d1bfdf4e64a65bcd91e8d6d4ab6ed8f
core/polyaxon/polypod/compiler/lineage/artifacts_collector.py
core/polyaxon/polypod/compiler/lineage/artifacts_collector.py
#!/usr/bin/python # # Copyright 2018-2022 Polyaxon, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
#!/usr/bin/python # # Copyright 2018-2022 Polyaxon, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
Fix artifacts name sanitization for root folders
Fix artifacts name sanitization for root folders
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
--- +++ @@ -24,7 +24,7 @@ def collect_lineage_artifacts_path(artifact_path: str) -> Optional[V1RunArtifact]: name = os.path.basename(artifact_path.rstrip("/")) # Trim handles cases like `foo/` -> '' return V1RunArtifact( - name=to_fqn_name(name), + name=to_fqn_name(name) if name else "_", ...
365da65390a0c2093fbbc5681c72cbfbd73ae78f
rctk/widgets/text.py
rctk/widgets/text.py
from rctk.widgets.control import Control, remote_attribute from rctk.task import Task from rctk.event import Changable, Submittable class Text(Control, Changable, Submittable): name = "text" value = remote_attribute('value', "") def __init__(self, tk, value="", rows=1, columns=20): self._value =...
from rctk.widgets.control import Control, remote_attribute from rctk.task import Task from rctk.event import Changable, Submittable class Text(Control, Changable, Submittable): name = "text" value = remote_attribute('value', "") def __init__(self, tk, value="", rows=1, columns=20, **properties): ...
Allow additional properties on Text
Allow additional properties on Text git-svn-id: ec97508af0aa29a1d296967d6f0ba22a468c79d6@350 286bb87c-ec97-11de-a004-2f18c49ebcc3
Python
bsd-2-clause
rctk/rctk,rctk/rctk
--- +++ @@ -8,11 +8,11 @@ value = remote_attribute('value', "") - def __init__(self, tk, value="", rows=1, columns=20): + def __init__(self, tk, value="", rows=1, columns=20, **properties): self._value = value self._rows = rows self._columns = columns - super(Text, sel...
5d1fe61d152d2c5544982322a9f156809ea267f0
main.py
main.py
from __future__ import print_function import time from slackclient import SlackClient import mh_python as mh import argparse import random def main(): parser = argparse.ArgumentParser( description="Slack chatbot using MegaHAL") parser.add_argument( "-t", "--token", type=str, help="Slack token"...
from __future__ import print_function import time from slackclient import SlackClient import mh_python as mh import argparse import random def main(): parser = argparse.ArgumentParser( description="Slack chatbot using MegaHAL") parser.add_argument( "-t", "--token", type=str, help="Slack token"...
Fix crashes from misc. events
Fix crashes from misc. events
Python
mit
Spferical/slack-megahal,Spferical/matrix-chatbot,Spferical/matrix-chatbot,Spferical/matrix-megahal
--- +++ @@ -19,8 +19,9 @@ if sc.rtm_connect(): while True: for event in sc.rtm_read(): - if event['type'] == 'message': - message = event['text'] + if 'type' in event and event['type'] == 'message' \ + ...
152dfbb9fc5ca5fe5c859fea5ba4a25a31f3ff13
gn/compile_processors.py
gn/compile_processors.py
#!/usr/bin/env python # # Copyright 2017 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import subprocess import sys skslc = sys.argv[1] clangFormat = sys.argv[2] fetchClangFormat = sys.argv[3] processors = sys.argv[4:] exeSuffix = '.exe'...
#!/usr/bin/env python # # Copyright 2017 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import subprocess import sys skslc = sys.argv[1] clangFormat = sys.argv[2] fetchClangFormat = sys.argv[3] processors = sys.argv[4:] exeSuffix = '.exe'...
Remove "Recompiling..." output when building .fp files
Remove "Recompiling..." output when building .fp files Change-Id: I41402dc04d4388217d7f7cd8de9aff8fbb4a3765 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317391 Reviewed-by: John Stiles <f4fcf42d3bb5924557f1eeb3be66747535e585da@google.com> Commit-Queue: Brian Osman <794c0b5534edf5601d88e1d41975d0262da1289...
Python
bsd-3-clause
google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/pla...
--- +++ @@ -17,7 +17,6 @@ exeSuffix = '.exe' if sys.platform.startswith('win') else ''; for p in processors: - print("Recompiling " + p + "...") try: if not os.path.isfile(clangFormat + exeSuffix): subprocess.check_call([sys.executable, fetchClangFormat]);
c1508d51a90db1ebf3c0278c777ff3169e0d13f9
tests/unit/test_wrapper.py
tests/unit/test_wrapper.py
import numpy as np from functools import partial from elfi.wrapper import Wrapper class Test_wrapper(): def test_echo_exec_arg(self): command = "echo {0}" wrapper = Wrapper(command, post=int) ret = wrapper("1") assert ret == 1 def test_echo_default_arg(self): command ...
import numpy as np from functools import partial from elfi.wrapper import Wrapper class Test_wrapper(): def test_echo_exec_arg(self): command = "echo {0}" wrapper = Wrapper(command, post=int) ret = wrapper("1") assert ret == 1 def test_echo_default_arg(self): command ...
Add test for 1d array arguments for Wrapper
Add test for 1d array arguments for Wrapper
Python
bsd-3-clause
lintusj1/elfi,elfi-dev/elfi,lintusj1/elfi,HIIT/elfi,elfi-dev/elfi
--- +++ @@ -43,3 +43,9 @@ ret = wrapper(1) assert ret == 1 + def test_echo_1d_array_args(self): + command = "echo {0}" + wrapper = Wrapper(command, post=int) + ret = wrapper(np.array([1])) + assert ret == 1 +
90655c89fcf56af06a69f8110a9f7154294ca11c
ritter/analytics/sentiment_analyzer.py
ritter/analytics/sentiment_analyzer.py
import re, math from collections import Counter import itertools from sentimental import sentimental class SentimentAnalyzer(): _sentimental = sentimental.Sentimental(max_ngrams=2) path = sentimental.Sentimental.get_datafolder() _sentimental.train([path + '/sv/ruhburg']) def calculate_friend_scores...
import re, math from collections import Counter import itertools from sentimental import sentimental class SentimentAnalyzer(): _sentimental = sentimental.Sentimental(max_ngrams=2, undersample=True) path = sentimental.Sentimental.get_datafolder() _sentimental.train([path + '/sv/ruhburg']) def calcu...
Update to Sentimental 2.2.x with undersampling
feat: Update to Sentimental 2.2.x with undersampling
Python
mit
ErikGartner/ghostdoc-ritter
--- +++ @@ -7,7 +7,7 @@ class SentimentAnalyzer(): - _sentimental = sentimental.Sentimental(max_ngrams=2) + _sentimental = sentimental.Sentimental(max_ngrams=2, undersample=True) path = sentimental.Sentimental.get_datafolder() _sentimental.train([path + '/sv/ruhburg'])
93be15b7f74673247eeabc208fd56cc6cb735e43
tests/matchers/test_contain.py
tests/matchers/test_contain.py
import unittest from robber import expect from robber.matchers.contain import Contain class TestAbove(unittest.TestCase): def test_matches(self): expect(Contain({'key': 'value'}, 'key').matches()) == True expect(Contain({1, 2, 3}, 1).matches()) == True expect(Contain([1, 2, 3], 2).matches()...
import unittest from robber import expect from robber.matchers.contain import Contain class TestAbove(unittest.TestCase): def test_matches(self): expect(Contain({'key': 'value'}, 'key').matches()) == True expect(Contain([1, 2, 3], 2).matches()) == True expect(Contain((1, 2, 3), 3).matches()...
Remove sets from tests Since python 2.6 does not have literal set syntax
Remove sets from tests Since python 2.6 does not have literal set syntax
Python
mit
vesln/robber.py,taoenator/robber.py
--- +++ @@ -5,12 +5,10 @@ class TestAbove(unittest.TestCase): def test_matches(self): expect(Contain({'key': 'value'}, 'key').matches()) == True - expect(Contain({1, 2, 3}, 1).matches()) == True expect(Contain([1, 2, 3], 2).matches()) == True expect(Contain((1, 2, 3), 3).matche...
6ee083f5b5a190f30f4916698c57c7ee1c2225fe
create_sample.py
create_sample.py
# importing modules/ libraries import pandas as pd import random # create sample of order products train data n = 1384617 s = round(0.1 * n) skip = sorted(random.sample(range(1,n), n-s)) order_products__train_sample_df = pd.read_csv('Data/order_products__train.csv', skiprows = s...
# importing modules/ libraries import pandas as pd import random import numpy as np # create sample of order products train data n = 1384617 s = round(0.1 * n) skip = sorted(random.sample(range(1,n), n-s)) order_products__train_sample_df = pd.read_csv('Data/order_products__train.csv', ...
Change create sample code to ensure matching order ids data
fix: Change create sample code to ensure matching order ids data
Python
mit
rjegankumar/instacart_prediction_model
--- +++ @@ -1,30 +1,28 @@ # importing modules/ libraries import pandas as pd import random +import numpy as np # create sample of order products train data n = 1384617 s = round(0.1 * n) skip = sorted(random.sample(range(1,n), n-s)) order_products__train_sample_df = pd.read_csv('Data/order_products__train.c...
acc3888ef55d7df22df08b16cc746186fc1a75c7
main.py
main.py
#!/usr/bin/env python3 import argparse import asyncio import logging import sys from pathlib import Path from MoMMI.logsetup import setup_logs # Do this BEFORE we import master, because it does a lot of event loop stuff. if sys.platform == "win32": loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop...
#!/usr/bin/env python3.6 import argparse import asyncio import logging import sys from pathlib import Path from MoMMI.logsetup import setup_logs # Do this BEFORE we import master, because it does a lot of event loop stuff. if sys.platform == "win32": loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(lo...
Use uvloop because apparently it's fast.
Use uvloop because apparently it's fast.
Python
mit
PJB3005/MoMMI,PJB3005/MoMMI,PJB3005/MoMMI
--- +++ @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python3.6 import argparse import asyncio import logging @@ -10,6 +10,14 @@ if sys.platform == "win32": loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) + +else: + try: + import uvloop + asyncio.set_event_loop...
3fb56e434182e5b28dcad0c547b0326ebe5be352
main.py
main.py
from createCollection import createCollectionFile from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection import datetime, json, os.path, argparse CONST_COLLECTIONS_NAME = 'collections' def generateArgumentsFromParser(): parser = parser = argparse.ArgumentParser(descripti...
from createCollection import createCollectionFile from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection import datetime, json, os.path, argparse CONST_COLLECTIONS_NAME = 'collections' def generateArgumentsFromParser(): parser = parser = argparse.ArgumentParser(descripti...
Refactor create action into function
Refactor create action into function
Python
apache-2.0
AmosGarner/PyInventory
--- +++ @@ -19,16 +19,19 @@ def generateNewCollection(username, collectionType, collectionName): return Collection(username, collectionType, collectionName, []) +def writeCollectionToFile(collectionFileName, arguments): + collection = generateNewCollection(arguments.username, arguments.collectionType, argu...
f34f67247d97d75039c65f71da8489fbffa17575
snowpenguin/django/recaptcha2/tests.py
snowpenguin/django/recaptcha2/tests.py
import os from django.forms import Form from django.test import TestCase from snowpenguin.django.recaptcha2.fields import ReCaptchaField from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget class RecaptchaTestForm(Form): recaptcha = ReCaptchaField(widget=ReCaptchaWidget()) class TestRecaptchaForm...
import os from django.forms import Form from django.test import TestCase from snowpenguin.django.recaptcha2.fields import ReCaptchaField from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget class RecaptchaTestForm(Form): recaptcha = ReCaptchaField(widget=ReCaptchaWidget()) class TestRecaptchaForm...
Check possible exception with wrong key data
Check possible exception with wrong key data
Python
lgpl-2.1
kbytesys/django-recaptcha2,kbytesys/django-recaptcha2
--- +++ @@ -19,5 +19,10 @@ form = RecaptchaTestForm({}) self.assertTrue(form.is_valid()) + def test_dummy_error(self): + del os.environ['RECAPTCHA_DISABLE'] + form = RecaptchaTestForm({}) + self.assertFalse(form.is_valid()) + def tearDown(self): del os.environ...
969aed7046e4965962e8ed5daa9c557baffc48bc
glue_h5part/io.py
glue_h5part/io.py
import os import h5py from glue.core import Data def read_step_to_data(filename, step_id=0): """ Given a filename and a step ID, read in the data into a new Data object. """ f = h5py.File(filename, 'r') try: group = f['Step#{0}'.format(step_id)] except KeyError: raise ValueEr...
import os import h5py from glue.core import Data def read_step_to_data(filename, step_id=0): """ Given a filename and a step ID, read in the data into a new Data object. """ f = h5py.File(filename, 'r') try: group = f['Step#{0}'.format(step_id)] except KeyError: raise ValueEr...
Fix issue with HDF5 objects that don't have a value
Fix issue with HDF5 objects that don't have a value
Python
bsd-2-clause
glue-viz/glue-h5part
--- +++ @@ -18,7 +18,10 @@ data = Data() for attribute in group: - data[attribute] = group[attribute].value + try: + data[attribute] = group[attribute].value + except AttributeError: + pass data.label = os.path.basename(filename.rsplit('.', 1)[0])
a9c1cc5517f2e32c812cf041359a64fea9af9bad
main.py
main.py
#!/usr/bin/python3 from ANN import ANN from random import seed as srand, randint from time import time srand(time()) # Test data for a XOR gate testData = [ [0.1, 0.1, 0.9], [0.1, 0.9, 0.9], [0.9, 0.1, 0.9], [0.9, 0.9, 0.1] ] # Create ANN with 2 input neurons, 1 hidden layer with 3 neurons, # 1 outp...
#!/usr/bin/python3 """ Uses a genetic algorithm to determine the optimal number of layers, neurons per each layer, learning rate and training iterations for an ANN given a set of training data. When running this script via a command line, it can take one optional argument for the name of a file to stream output into in...
Add description and user-end functionality
Add description and user-end functionality Main.py takes one optional parameter: a filepath for a log file. If left empty, all output goes into stdout.
Python
mit
JoshuaBrockschmidt/ideal_ANN
--- +++ @@ -1,51 +1,33 @@ #!/usr/bin/python3 +""" +Uses a genetic algorithm to determine the optimal number of layers, +neurons per each layer, learning rate and training iterations for an ANN given +a set of training data. +When running this script via a command line, it can take one optional argument +for the name...
adee7a2530d22d1242f89cddc84795efd1d02653
imagesift/cms_plugins.py
imagesift/cms_plugins.py
import datetime from django.utils.translation import ugettext_lazy as _ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from .models import GalleryPlugin class ImagesiftPlugin(CMSPluginBase): model = GalleryPlugin name = _('Imagesift Plugin') render_template = "imagesif...
import datetime from django.utils.translation import ugettext_lazy as _ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from .models import GalleryPlugin class ImagesiftPlugin(CMSPluginBase): model = GalleryPlugin name = _('Imagesift Plugin') render_template = "imagesif...
Sort returned images by date, taking into account overrides
Sort returned images by date, taking into account overrides
Python
bsd-3-clause
topiaruss/cmsplugin-imagesift,topiaruss/cmsplugin-imagesift,topiaruss/cmsplugin-imagesift
--- +++ @@ -26,14 +26,20 @@ date = context['request'].GET.get('date') limit = instance.thumbnail_limit qs = instance.get_images_queryset() - if limit: - qs = qs[:limit] + # there's no way around listing, sorry. + qs = list(qs) + filtered = False ...
8f14126e36e7f5c15431cd7541762e485c3f8169
main.py
main.py
from createCollection import createCollection from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection import datetime import json def main(): #createCollection('agarner','books') now = datetime.datetime.now() items = [] for i in range(0,10): ...
from createCollection import createCollection from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection import datetime, json, os.path CONST_COLLECTIONS_NAME = 'collections' CONST_USERNAME = 'agarner' CONST_COLLECTION = 'Items' def generateItemsCollection(): items = [] ...
Implement ability to save json data to collection file
Implement ability to save json data to collection file
Python
apache-2.0
AmosGarner/PyInventory
--- +++ @@ -1,19 +1,32 @@ from createCollection import createCollection from ObjectFactories.ItemFactory import ItemFactory from DataObjects.Collection import Collection -import datetime -import json +import datetime, json, os.path + +CONST_COLLECTIONS_NAME = 'collections' +CONST_USERNAME = 'agarner' +CONST_COLLEC...
d63509e0d68a1dceabbbcf58432a92f7a4cbfd77
robot/robot/src/autonomous/main.py
robot/robot/src/autonomous/main.py
try: import wpilib except ImportError: from pyfrc import wpilib # import components here from components import drive, intake, catapult class MyRobot(wpilib.SimpleRobot): def __init__ (self): super().__init__() print("Team 1418 robot code for 2014") ...
try: import wpilib except ImportError: from pyfrc import wpilib # import components here from components import drive, intake, catapult class MyRobot(wpilib.SimpleRobot): def __init__ (self, drive, intake, catapult): super().__init__() print("Team 1418 autonomous...
Bring the autonomous mode back
Bring the autonomous mode back
Python
bsd-3-clause
frc1418/2014
--- +++ @@ -8,10 +8,10 @@ from components import drive, intake, catapult class MyRobot(wpilib.SimpleRobot): - def __init__ (self): + def __init__ (self, drive, intake, catapult): super().__init__() - print("Team 1418 robot code for 2014") + print("Team 1418 autonomous code f...
ba4ea2169a13d61d30c94e89db512a34bc0fe3b5
bluesky/tests/test_documents.py
bluesky/tests/test_documents.py
from bluesky.run_engine import RunEngine from bluesky.tests.utils import setup_test_run_engine from bluesky.examples import simple_scan, motor RE = setup_test_run_engine() def test_custom_metadata(): def assert_lion(name, doc): assert 'animal' in doc assert doc['animal'] == 'lion' RE(simple...
import pytest import jsonschema from bluesky.run_engine import RunEngine from event_model import DocumentNames, schemas from bluesky.tests.utils import setup_test_run_engine from bluesky.utils import new_uid from bluesky.examples import simple_scan, motor RE = setup_test_run_engine() def test_custom_metadata(): ...
Test that event_model forbids dots in key names.
TST: Test that event_model forbids dots in key names.
Python
bsd-3-clause
ericdill/bluesky,ericdill/bluesky
--- +++ @@ -1,5 +1,9 @@ +import pytest +import jsonschema from bluesky.run_engine import RunEngine +from event_model import DocumentNames, schemas from bluesky.tests.utils import setup_test_run_engine +from bluesky.utils import new_uid from bluesky.examples import simple_scan, motor @@ -14,3 +18,45 @@ RE(...
aca1b138350434c9afb08f31164269cd58de1d2d
YouKnowShit/CheckFile.py
YouKnowShit/CheckFile.py
import os import sys (dir, filename) = os.path.split(os.path.abspath(sys.argv[0])) print(dir) filenames = os.listdir(dir) for file in filenames: print(file) print('*****************************************************') updir = os.path.abspath('..') print(updir) filenames = os.listdir(updir) for file in filenames...
import os import sys (dir, filename) = os.path.split(os.path.abspath(sys.argv[0])) print(dir) filenames = os.listdir(dir) for file in filenames: print(file) print() print() print() print('*****************************************************') updir = os.path.abspath('..') print(updir) filenames = os.listdir(updi...
Add a level of uper directory
Add a level of uper directory
Python
mit
jiangtianyu2009/PiSoftCake
--- +++ @@ -7,6 +7,9 @@ for file in filenames: print(file) +print() +print() +print() print('*****************************************************') updir = os.path.abspath('..') print(updir) @@ -14,6 +17,9 @@ for file in filenames: print(file) +print() +print() +print() print('*******************...
1f527bd99a35cf6396e6300369719b3f5f5490ff
app/main/forms.py
app/main/forms.py
from flask.ext.wtf import Form from wtforms import validators from dmutils.forms import StripWhitespaceStringField class EmailAddressForm(Form): email_address = StripWhitespaceStringField('Email address', validators=[ validators.DataRequired(message="Email can not be empty"), validators.Email(mes...
from flask.ext.wtf import Form from wtforms import validators from dmutils.forms import StripWhitespaceStringField from .. import data_api_client class AdminEmailAddressValidator(object): def __init__(self, message=None): self.message = message def __call__(self, form, field): if not data_...
Add new validator that applies data_api_client.email_is_valid_for_admin_user to field
Add new validator that applies data_api_client.email_is_valid_for_admin_user to field
Python
mit
alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend
--- +++ @@ -2,6 +2,18 @@ from wtforms import validators from dmutils.forms import StripWhitespaceStringField + +from .. import data_api_client + + +class AdminEmailAddressValidator(object): + + def __init__(self, message=None): + self.message = message + + def __call__(self, form, field): + if...
62b7b01fe9a1d87692e97a6a75b52d542f8a43be
scrapi/processing/elastic_search.py
scrapi/processing/elastic_search.py
import logging from elasticsearch import Elasticsearch from scrapi import settings from scrapi.processing.base import BaseProcessor es = Elasticsearch( settings.ELASTIC_URI, request_timeout=settings.ELASTIC_TIMEOUT ) logging.getLogger('elasticsearch').setLevel(logging.WARN) logging.getLogger('elasticsearch....
import logging from elasticsearch import Elasticsearch from scrapi import settings from scrapi.processing.base import BaseProcessor es = Elasticsearch( settings.ELASTIC_URI, request_timeout=settings.ELASTIC_TIMEOUT ) logging.getLogger('elasticsearch').setLevel(logging.WARN) logging.getLogger('elasticsearch....
Add some versioning for dateUpdated so that updated documents aren't bumped to the top of the stream
Add some versioning for dateUpdated so that updated documents aren't bumped to the top of the stream
Python
apache-2.0
fabianvf/scrapi,felliott/scrapi,fabianvf/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,icereval/scrapi,mehanig/scrapi,felliott/scrapi,ostwald/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,jeffreyliu3230/scrapi,alexgarciac/scrapi
--- +++ @@ -25,6 +25,9 @@ key: value for key, value in normalized.attributes.items() if key in settings.FRONTEND_KEYS } + + normalized['dateUpdated'] = self.version_dateUpdated(normalized) + es.index( body=data, refresh=True, @@ -33,5 +36,12...
0460404bb7f3e9a9f6ece1c4a141b16fced6f741
tests/test_chunked_http.py
tests/test_chunked_http.py
from disco.test import TestCase, TestJob from disco.core import Job import disco import threading import BaseHTTPServer def map(line, params): for word in line.split(): yield word, 1 def reduce(iter, params): from disco.util import kvgroup for word, counts in kvgroup(sorted(iter)): yield ...
from disco.test import TestCase, TestJob from disco.core import Job from disco.compat import http_server import disco import threading def map(line, params): for word in line.split(): yield word, 1 def reduce(iter, params): from disco.util import kvgroup for word, counts in kvgroup(sorted(iter)):...
Use the disco.compat.http_server to work with python3.
Use the disco.compat.http_server to work with python3.
Python
bsd-3-clause
pombredanne/disco,simudream/disco,ErikDubbelboer/disco,beni55/disco,discoproject/disco,ErikDubbelboer/disco,oldmantaiter/disco,simudream/disco,oldmantaiter/disco,seabirdzh/disco,seabirdzh/disco,seabirdzh/disco,discoproject/disco,ktkt2009/disco,discoproject/disco,ktkt2009/disco,beni55/disco,ErikDubbelboer/disco,pombreda...
--- +++ @@ -1,8 +1,8 @@ from disco.test import TestCase, TestJob from disco.core import Job +from disco.compat import http_server import disco import threading -import BaseHTTPServer def map(line, params): @@ -16,7 +16,7 @@ PORT = 1234 -class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): +class MyHa...
dd5b8c55e601709f1f04cb0ec7dbde63b84801d8
snippet_parser/fr.py
snippet_parser/fr.py
#-*- encoding: utf-8 -*- import base class SnippetParser(base.SnippetParserBase): def strip_template(self, template, normalize, collapse): if template.name.matches('unité'): return ' '.join(map(unicode, template.params[:2])) elif self.is_citation_needed(template): repl = [b...
#-*- encoding: utf-8 -*- import base def handle_date(template): year = None if len(template.params) >= 3: try: year = int(unicode(template.params[2])) except ValueError: pass if isinstance(year, int): # assume {{date|d|m|y|...}} return ' '.join(map(u...
Implement a couple of other French templates.
Implement a couple of other French templates. Still need to add tests for these. Former-commit-id: 4021d27a7bd15a396b637beb57c10fc95936cb3f
Python
mit
eggpi/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,eggpi/citationhunt
--- +++ @@ -1,11 +1,37 @@ #-*- encoding: utf-8 -*- import base + +def handle_date(template): + year = None + if len(template.params) >= 3: + try: + year = int(unicode(template.params[2])) + except ValueError: + pass + if isinstance(year, int): + # assume {{date|...
878c14e04327f2f9d2d4acd22de21ed23b0cfb9a
skan/test/test_vendored_correlate.py
skan/test/test_vendored_correlate.py
from time import time import numpy as np from skan.vendored import thresholding as th class Timer: def __init__(self): self.interval = 0 def __enter__(self): self.t0 = time() return self def __exit__(self, exc_type, exc_val, exc_tb): self.interval = time() - self.t0 def...
from time import time from functools import reduce import numpy as np from skan.vendored import thresholding as th from skimage.transform import integral_image from scipy import ndimage as ndi class Timer: def __init__(self): self.interval = 0 def __enter__(self): self.t0 = time() ret...
Add test for new fast correlation
Add test for new fast correlation
Python
bsd-3-clause
jni/skan
--- +++ @@ -1,6 +1,9 @@ from time import time +from functools import reduce import numpy as np from skan.vendored import thresholding as th +from skimage.transform import integral_image +from scipy import ndimage as ndi class Timer: @@ -25,3 +28,16 @@ with Timer() as t1: th.threshold_sauvola(ima...
425a06b852b5abfbbd46cd82065daff9b8bf9f51
ehriportal/devel_settings.py
ehriportal/devel_settings.py
import sys ADMINS = ( ("Mike", "michael.bryant@kcl.ac.uk"), ) EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' if "test" in sys.argv: DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": "test.db", } }
import sys ADMINS = ( ("Mike", "michael.bryant@kcl.ac.uk"), ) EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' if "test" in sys.argv: DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": "test.db", } } ...
Use terminal for dev email output
Use terminal for dev email output
Python
mit
mikesname/ehri-collections,mikesname/ehri-collections,mikesname/ehri-collections
--- +++ @@ -5,7 +5,7 @@ ("Mike", "michael.bryant@kcl.ac.uk"), ) -EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' if "test" in sys.argv: DATABASES = {
98ba687e67c8d5a17560bed59f42dbe8e3fb0cf6
amaascore/books/enums.py
amaascore/books/enums.py
from __future__ import absolute_import, division, print_function, unicode_literals BOOK_TYPES = {'Counterparty', 'Individual', 'Management', 'Trading', 'Wash'}
from __future__ import absolute_import, division, print_function, unicode_literals BOOK_TYPES = {'Counterparty', 'Management', 'Trading', 'Wash'}
Remove Individual as a book_type - it doesn’t really add anything. AMAAS-639.
Remove Individual as a book_type - it doesn’t really add anything. AMAAS-639.
Python
apache-2.0
amaas-fintech/amaas-core-sdk-python,nedlowe/amaas-core-sdk-python,paul-rs/amaas-core-sdk-python,amaas-fintech/amaas-core-sdk-python,nedlowe/amaas-core-sdk-python,paul-rs/amaas-core-sdk-python
--- +++ @@ -1,3 +1,3 @@ from __future__ import absolute_import, division, print_function, unicode_literals -BOOK_TYPES = {'Counterparty', 'Individual', 'Management', 'Trading', 'Wash'} +BOOK_TYPES = {'Counterparty', 'Management', 'Trading', 'Wash'}
4650b6730d925c4a5fde34ec4c2f9058763ab58b
cupcake/smush.py
cupcake/smush.py
""" User-facing interface to all dimensionality reduction algorithms """ def smushplot(data, smusher): if isinstance(smusher, str): # Need to get appropriate smusher from sklearn given the string pass else: # Assume this is already an initialized sklearn object with the # ``fit_...
""" User-facing interface for plotting all dimensionality reduction algorithms """ def smushplot(data, smusher, n_components=2, marker='o', marker_order=None, text=False, text_order=None, linewidth=1, linewidth_order=None, edgecolor='k', edgecolor_order=None, smusher_kws=None, ...
Add a bunch of plotting and keyword arguments
Add a bunch of plotting and keyword arguments
Python
bsd-3-clause
olgabot/cupcake
--- +++ @@ -1,8 +1,11 @@ """ -User-facing interface to all dimensionality reduction algorithms +User-facing interface for plotting all dimensionality reduction algorithms """ -def smushplot(data, smusher): +def smushplot(data, smusher, n_components=2, marker='o', marker_order=None, + text=False, text...
fc7c08aecf9d247e54db70ae14c999902d6f6bfa
workflow/migrations/0024_auto_20180620_0537.py
workflow/migrations/0024_auto_20180620_0537.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2018-06-20 12:37 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('workflow', '0023_auto_20180425_0136'), ] operations = [ migrations.AddField...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2018-06-20 12:37 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('workflow', '0023_auto_20180425_0136'), ] operations = [ migrations.AddField...
Fix the dashboard migration for UUID
Fix the dashboard migration for UUID
Python
apache-2.0
toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity
--- +++ @@ -15,7 +15,7 @@ migrations.AddField( model_name='dashboard', name='dashboard_uuid', - field=models.UUIDField(default=None, verbose_name='Dashboard UUID'), + field=models.UUIDField(blank=True, null=True, default=None, verbose_name='Dashboard UUID'), ...
9c6ad90f20354ca47a2fc56cc0d7ff6ebfc613d3
weather/weather-display.py
weather/weather-display.py
#!/usr/bin/env python from subprocess import call URL = 'http://microdash.herokuapp.com/FOG/' OUTPUT_FILE = '/mnt/us/weather/weather-script-output.png' def clear_screen(): call('/usr/sbin/eips -c', shell=True) def get_image(): call('wget -O "%s" "%s"' % (OUTPUT_FILE, URL), shell=True) def main(): cle...
#!/usr/bin/env python from subprocess import call from datetime import datetime URL = 'http://microdash.herokuapp.com/FOG/' OUTPUT_FILE = '/mnt/us/weather/weather-script-output.png' def clear_screen(): call('/usr/sbin/eips -c', shell=True) def get_dashboard(url, output_file): call('rm %s' % output_file, sh...
Update weather display to be run during specified intervals.
Update weather display to be run during specified intervals.
Python
bsd-3-clause
alfredo/microdash,alfredo/microdash
--- +++ @@ -1,5 +1,6 @@ #!/usr/bin/env python from subprocess import call +from datetime import datetime URL = 'http://microdash.herokuapp.com/FOG/' OUTPUT_FILE = '/mnt/us/weather/weather-script-output.png' @@ -9,13 +10,22 @@ call('/usr/sbin/eips -c', shell=True) -def get_image(): - call('wget -O "%...
33ee2cdad20aab11ffdc76c4bd2bd5a82295e798
scripts/first_level_admin_clusters.py
scripts/first_level_admin_clusters.py
import csv import json with open('2015_06_29_NNHS_2015_Selected EA_Final.xlsx - EA_2015.csv') as csvfile: reader = csv.reader(csvfile, delimiter=',') clusterfile = {} next(reader) for row in reader: clusterfile[row[0].upper()] = { "reserve": 5, "standard": 10 } ...
import csv import json with open('2015_06_29_NNHS_2015_Selected EA_Final.xlsx - EA_2015.csv') as csvfile: reader = csv.reader(csvfile, delimiter=',') clusterfile = {} next(reader) for row in reader: clusterfile[row[0].upper()] = { # FIXME this should be a real count of enumeration a...
Add EA count bug note
Add EA count bug note
Python
agpl-3.0
eHealthAfrica/nutsurv,eHealthAfrica/nutsurv,johanneswilm/eha-nutsurv-django,eHealthAfrica/nutsurv,johanneswilm/eha-nutsurv-django,johanneswilm/eha-nutsurv-django
--- +++ @@ -7,6 +7,9 @@ next(reader) for row in reader: clusterfile[row[0].upper()] = { + # FIXME this should be a real count of enumeration areas + # (EA/EA_NAME) per state (see #592) e.g.: + # { ABIA: { standard: 32, reserve: 4 } } "reserve": 5, ...
a6785b6ec546ba31f52420fcf55f4f45b00926ca
info.py
info.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Provides info about a particular server. """ from usage import usage import restclient import simplejson import subprocess import sys from uuid import uuid1 class Info: def __init__(self): self.debug = False def runCmd(self, cmd, server, port, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Provides info about a particular server. """ from usage import usage import restclient import simplejson import subprocess import sys import string import random class Info: def __init__(self): self.debug = False def _remoteShellName(self): ...
Use just a random string instead of uuid in shell name.
Use just a random string instead of uuid in shell name. python 2.4 lacks uuid module. Change-Id: I5a1d5339741af2f4defa67d17f557639cd30bb91 Reviewed-on: http://review.couchbase.org/12462 Tested-by: Aliaksey Artamonau <3c875bcfb3adf2a65b2ae7686ca921e6c9433147@gmail.com> Tested-by: Farshid Ghods <e312e45b3dfe8923eeb42f1...
Python
apache-2.0
membase/membase-cli,couchbaselabs/couchbase-cli,couchbaselabs/couchbase-cli,couchbase/couchbase-cli,membase/membase-cli,couchbase/couchbase-cli,membase/membase-cli,couchbaselabs/couchbase-cli
--- +++ @@ -12,11 +12,16 @@ import subprocess import sys -from uuid import uuid1 +import string +import random class Info: def __init__(self): self.debug = False + + def _remoteShellName(self): + tmp = ''.join(random.choice(string.ascii_letters) for i in xrange(20)) + return 'ctl...
c1189bf7c24068fda9871436a705b70fd016dfd5
examples/json_editor.py
examples/json_editor.py
""" This is a very basic usage example of the JSONCodeEdit. The interface is minimalist, it will open a test file. You can open other documents by pressing Ctrl+O """ import logging import os import random import sys from pyqode.qt import QtWidgets from pyqode.core import api, modes from pyqode.json.widgets import JSO...
""" This is a very basic usage example of the JSONCodeEdit. The interface is minimalist, it will open a test file. You can open other documents by pressing Ctrl+O """ import logging import os import random import sys from pyqode.qt import QtWidgets from pyqode.core import api, modes from pyqode.json.widgets import JSO...
Add missing open action to the example so that you can open other files
Add missing open action to the example so that you can open other files (usefull for testing and evaluating)
Python
mit
pyQode/pyqode.json,pyQode/pyqode.json
--- +++ @@ -28,6 +28,17 @@ self.editor.syntax_highlighter.color_scheme = api.ColorScheme( pygment_style) + self.action_open = QtWidgets.QAction('open file', self) + self.action_open.setShortcut('Ctrl+O') + self.action_open.triggered.connect(self.open_file) + self.ad...
446738f7615711766952205558fee7ce85ca3a3b
MS1/ddp-erlang-style/dna_lib.py
MS1/ddp-erlang-style/dna_lib.py
__author__ = 'mcsquaredjr' import os node_file = os.environ["NODES"] cad_file = os.environ["CAD"] procs_per_nod = os.environ["PROCS_PER_NODE"] def my_lines(ip): with open(cad_file, "r") as cad: lines = [] for line in cad: ip, port = line.split(":") if ip == str(ip): ...
__author__ = 'mcsquaredjr' import os import socket node_file = os.environ["NODES"] cad_file = os.environ["CAD"] procs_per_nod = os.environ["PROCS_PER_NODE"] itemcount = os.environ["ITEMCOUNT"] ddp = os.environment["DDP"] def my_lines(i): ip = socket.gethostbyname(socket.gethostname()) with open(cad_file, "...
Add more variables and bug fixes
Add more variables and bug fixes
Python
apache-2.0
SKA-ScienceDataProcessor/RC,SKA-ScienceDataProcessor/RC,SKA-ScienceDataProcessor/RC,SKA-ScienceDataProcessor/RC,SKA-ScienceDataProcessor/RC
--- +++ @@ -1,19 +1,24 @@ __author__ = 'mcsquaredjr' import os +import socket node_file = os.environ["NODES"] cad_file = os.environ["CAD"] procs_per_nod = os.environ["PROCS_PER_NODE"] +itemcount = os.environ["ITEMCOUNT"] +ddp = os.environment["DDP"] -def my_lines(ip): + +def my_lines(i): + ip = socket...
936b20a61fc48960cb21a8ad1c81ca1303151776
talkoohakemisto/settings/production.py
talkoohakemisto/settings/production.py
# -*- coding: utf-8 -*- """ talkoohakemisto.settings.production ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains application settings specific to a production environment running on Heroku. """ import os from .base import * # flake8: noqa # # Generic # ------- # If a secret key is set, cry...
# -*- coding: utf-8 -*- """ talkoohakemisto.settings.production ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains application settings specific to a production environment running on Heroku. """ import os from .base import * # flake8: noqa # # Generic # ------- # If a secret key is set, cry...
Fix wrong mail server in settings
Fix wrong mail server in settings
Python
mit
talkoopaiva/talkoohakemisto-api
--- +++ @@ -42,7 +42,7 @@ # Email configuration # ------------------- -MAIL_SERVER = 'smtp.mandrillapp.net' +MAIL_SERVER = 'smtp.mandrillapp.com' MAIL_USERNAME = os.environ['MANDRILL_USERNAME'] MAIL_PASSWORD = os.environ['MANDRILL_APIKEY'] MAIL_PORT = 587
f6013aa29fddf9883f8f0bea4b7733718b9d8846
core/admin/migrations/versions/3f6994568962_.py
core/admin/migrations/versions/3f6994568962_.py
""" Add keep as an option in fetches Revision ID: 3f6994568962 Revises: 2335c80a6bc3 Create Date: 2017-02-02 22:31:00.719703 """ # revision identifiers, used by Alembic. revision = '3f6994568962' down_revision = '2335c80a6bc3' from alembic import op import sqlalchemy as sa from mailu import app fetch_table = sa....
""" Add keep as an option in fetches Revision ID: 3f6994568962 Revises: 2335c80a6bc3 Create Date: 2017-02-02 22:31:00.719703 """ # revision identifiers, used by Alembic. revision = '3f6994568962' down_revision = '2335c80a6bc3' from alembic import op import sqlalchemy as sa fetch_table = sa.Table( 'fetch', ...
Fix an old migration that was reading configuration before migrating
Fix an old migration that was reading configuration before migrating
Python
mit
kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io
--- +++ @@ -13,8 +13,6 @@ from alembic import op import sqlalchemy as sa -from mailu import app - fetch_table = sa.Table( 'fetch', @@ -24,13 +22,7 @@ def upgrade(): - connection = op.get_bind() op.add_column('fetch', sa.Column('keep', sa.Boolean(), nullable=False, server_default=sa.sql.expres...
9e785ef701e4c9d04924eff0ffc9c8d50fa267f6
ingestors/email/outlookpst.py
ingestors/email/outlookpst.py
from ingestors.base import Ingestor from ingestors.support.temp import TempFileSupport from ingestors.support.shell import ShellSupport from ingestors.support.ole import OLESupport from ingestors.directory import DirectoryIngestor class OutlookPSTIngestor(Ingestor, TempFileSupport, ShellSupport, OLESupport): MIME...
from ingestors.base import Ingestor from ingestors.support.temp import TempFileSupport from ingestors.support.shell import ShellSupport from ingestors.support.ole import OLESupport from ingestors.directory import DirectoryIngestor class OutlookPSTIngestor(Ingestor, TempFileSupport, ShellSupport, OLESupport): MIME...
Make readpst partial output ingest.
Make readpst partial output ingest.
Python
mit
alephdata/ingestors
--- +++ @@ -19,13 +19,18 @@ with self.create_temp_dir() as temp_dir: if self.result.mime_type is None: self.result.mime_type = 'application/vnd.ms-outlook' - self.exec_command('readpst', - '-M', # make subfolders, files per message - ...
b4c292374175b8623a232bed47e8fa0bef60680b
astatsscraper/parsing.py
astatsscraper/parsing.py
def parse_app_page(response): # Should always be able to grab a title title = response.xpath('//div[@class = "panel panel-default panel-gameinfo"]/div[@class = "panel-heading"]/text()').extract()[0].strip() # Parse times into floats time_to_hundo = response.xpath('//table[@class = "Default1000"]/tr/td[s...
def parse_app_page(response): # Should always be able to grab a title title = response.xpath('//div[@class = "panel panel-default panel-gameinfo"]/div[@class = "panel-heading"]/text()').extract()[0].strip() # Parse times into floats time_to_hundo = response.xpath('//table[@class = "Default1000"]/tr/td[s...
Fix up parse search func
Fix up parse search func
Python
mit
SingingTree/AStatsScraper,SingingTree/AStatsScraper
--- +++ @@ -18,12 +18,8 @@ 'points': points, } -def parse_search_result(response): +def parse_search_result_for_apps(response): for href in response.xpath('//table//table//a/@href'): relative_url = href.extract() if relative_url.startswith('Steam_Game_Info.php?AppID='): - ...
43d283cb4cb01ec919f9129571a51594e699fcf5
src/gogoutils/formats.py
src/gogoutils/formats.py
"""Determine the generator format""" from collections import ChainMap DEFAULT_FORMAT = { 'domain': 'example.com', 'app': '{repo}{project}', 'dns_elb': '{repo}.{project}.{env}.{domain}', 'dns_instance': '{repo}{project}-xx.{env}.{domain}', 'iam_base': '{project}_{repo}', 'iam_user': '{project}_{...
"""Determine the generator format""" try: from collections import ChainMap except ImportError: from ConfigParser import _Chainmap as ChainMap DEFAULT_FORMAT = { 'domain': 'example.com', 'app': '{repo}{project}', 'dns_elb': '{repo}.{project}.{env}.{domain}', 'dns_instance': '{repo}{project}-xx.{...
Add Chainmap support for python2
Add Chainmap support for python2
Python
apache-2.0
gogoair/gogo-utils
--- +++ @@ -1,5 +1,8 @@ """Determine the generator format""" -from collections import ChainMap +try: + from collections import ChainMap +except ImportError: + from ConfigParser import _Chainmap as ChainMap DEFAULT_FORMAT = { 'domain': 'example.com',
a75ff3a9d9b86ea71fbc582641ea943c282bfe2d
analyser/api.py
analyser/api.py
from flask.ext.classy import FlaskView class AnalyserView(FlaskView): def get(self): return "awesome"
from flask.ext.classy import FlaskView from utils.decorators import validate, require from utils.validators import validate_url class AnalyserView(FlaskView): @require('url') @validate({ 'url': validate_url }) def post(self, url): return url
Add more joy using decorators
Add more joy using decorators
Python
apache-2.0
vtemian/kruncher
--- +++ @@ -1,6 +1,13 @@ from flask.ext.classy import FlaskView + +from utils.decorators import validate, require +from utils.validators import validate_url class AnalyserView(FlaskView): - def get(self): - return "awesome" + @require('url') + @validate({ + 'url': validate_url + }) + def post(self,...
402c010b6ab4673ae3b5c684b8e0c155ec98b172
gentle/gt/operations.py
gentle/gt/operations.py
#coding=utf-8 from __future__ import absolute_import from fabric.api import local, run, sudo, task from fabric.contrib.console import confirm from fabric.state import env from fabric.context_managers import cd, lcd, hide, settings from fabric.colors import red, green from .utils import repl_root from .project import...
#coding=utf-8 from __future__ import absolute_import from fabric.api import local, run, sudo, task from fabric.contrib.console import confirm from fabric.state import env from fabric.context_managers import cd, lcd, hide, settings from fabric.colors import red, green, yellow from .utils import repl_root from .projec...
Add yellow color for services
Add yellow color for services
Python
apache-2.0
dongweiming/gentle
--- +++ @@ -6,7 +6,7 @@ from fabric.contrib.console import confirm from fabric.state import env from fabric.context_managers import cd, lcd, hide, settings -from fabric.colors import red, green +from fabric.colors import red, green, yellow from .utils import repl_root from .project import rsync_project @@ -30,...
7a804eac3f354a778eda3daa8cd5f88b09259f74
south/signals.py
south/signals.py
""" South-specific signals """ from django.dispatch import Signal from django.conf import settings # Sent at the start of the migration of an app pre_migrate = Signal(providing_args=["app"]) # Sent after each successful migration of an app post_migrate = Signal(providing_args=["app"]) # Sent after each run of a par...
""" South-specific signals """ from django.dispatch import Signal from django.conf import settings # Sent at the start of the migration of an app pre_migrate = Signal(providing_args=["app"]) # Sent after each successful migration of an app post_migrate = Signal(providing_args=["app"]) # Sent after each run of a par...
Remove the auth contenttypes thing for now, needs improvement
Remove the auth contenttypes thing for now, needs improvement
Python
apache-2.0
smartfile/django-south,smartfile/django-south
--- +++ @@ -15,9 +15,10 @@ ran_migration = Signal(providing_args=["app","migration","method"]) # Compatibility code for django.contrib.auth -if 'django.contrib.auth' in settings.INSTALLED_APPS: - def create_permissions_compat(app, **kwargs): - from django.db.models import get_app - from django.co...
8b1d878aff4168d74437d3ba0cfaf8307e7c377d
consts/model_type.py
consts/model_type.py
class ModelType(object): """ Enums for the differnet model types DO NOT CHANGE EXISTING ONES """ EVENT = 0 TEAM = 1 MATCH = 2 EVENT_TEAM = 3 DISTRICT = 4 AWARD = 5 MEDIA = 6
class ModelType(object): """ Enums for the differnet model types DO NOT CHANGE EXISTING ONES """ EVENT = 0 TEAM = 1 MATCH = 2 EVENT_TEAM = 3 DISTRICT = 4 DISTRICT_TEAM = 5 AWARD = 6 MEDIA = 7
Update model enums to match app
Update model enums to match app
Python
mit
josephbisch/the-blue-alliance,verycumbersome/the-blue-alliance,bdaroz/the-blue-alliance,the-blue-alliance/the-blue-alliance,fangeugene/the-blue-alliance,josephbisch/the-blue-alliance,the-blue-alliance/the-blue-alliance,synth3tk/the-blue-alliance,1fish2/the-blue-alliance,synth3tk/the-blue-alliance,bvisness/the-blue-alli...
--- +++ @@ -9,5 +9,6 @@ MATCH = 2 EVENT_TEAM = 3 DISTRICT = 4 - AWARD = 5 - MEDIA = 6 + DISTRICT_TEAM = 5 + AWARD = 6 + MEDIA = 7
4fb3a127706d7ff7ead0d2d8b698183905d85d4e
dependency_injector/__init__.py
dependency_injector/__init__.py
"""Dependency injector.""" from .catalog import AbstractCatalog from .catalog import override from .providers import Provider from .providers import Delegate from .providers import Factory from .providers import Singleton from .providers import ExternalDependency from .providers import Class from .providers import Ob...
"""Dependency injector.""" from .catalog import AbstractCatalog from .catalog import override from .providers import Provider from .providers import Delegate from .providers import Factory from .providers import Singleton from .providers import ExternalDependency from .providers import Class from .providers import Ob...
Add additional shortcuts for top level package
Add additional shortcuts for top level package
Python
bsd-3-clause
ets-labs/python-dependency-injector,ets-labs/dependency_injector,rmk135/dependency_injector,rmk135/objects
--- +++ @@ -15,37 +15,56 @@ from .providers import Callable from .providers import Config +from .injections import Injection from .injections import KwArg from .injections import Attribute from .injections import Method from .injections import inject +from .utils import is_provider +from .utils import ensur...
b61bf7dbdb26b6ff3e76f10173ffb94a76cd4f4e
lego.py
lego.py
import cv2 WINDOW_NAME = 'hello' def global_on_mouse(event, x, y, unknown, lego_player): lego_player.on_mouse(event, x, y) class LegoPlayer(object): def __init__(self): self.rect = [] cv2.namedWindow(WINDOW_NAME) cv2.setMouseCallback(WINDOW_NAME, global_on_mouse, self) self.c...
import numpy as np import cv2 WINDOW_NAME = 'hello' def global_on_mouse(event, x, y, unknown, lego_player): lego_player.on_mouse(event, x, y) class LegoPlayer(object): def __init__(self): self.rect = np.empty((4, 2)) self.rect_index = -1 cv2.namedWindow(WINDOW_NAME) cv2.setMo...
Use numpy array for ROI
Use numpy array for ROI
Python
mit
superquadratic/beat-bricks
--- +++ @@ -1,3 +1,4 @@ +import numpy as np import cv2 WINDOW_NAME = 'hello' @@ -7,18 +8,25 @@ class LegoPlayer(object): def __init__(self): - self.rect = [] + self.rect = np.empty((4, 2)) + self.rect_index = -1 cv2.namedWindow(WINDOW_NAME) cv2.setMouseCallback(WIN...
da75222fa286588394da7f689d47bd53716ffaa1
coverage/execfile.py
coverage/execfile.py
"""Execute files of Python code.""" import imp, os, sys def run_python_file(filename, args): """Run a python file as if it were the main program on the command line. `filename` is the path to the file to execute, it need not be a .py file. `args` is the argument array to present as sys.argv, includin...
"""Execute files of Python code.""" import imp, os, sys def run_python_file(filename, args): """Run a python file as if it were the main program on the command line. `filename` is the path to the file to execute, it need not be a .py file. `args` is the argument array to present as sys.argv, includin...
Simplify the construction of the __main__ module in run_python_file.
Simplify the construction of the __main__ module in run_python_file.
Python
apache-2.0
blueyed/coveragepy,nedbat/coveragepy,larsbutler/coveragepy,blueyed/coveragepy,7WebPages/coveragepy,jayhetee/coveragepy,larsbutler/coveragepy,nedbat/coveragepy,larsbutler/coveragepy,hugovk/coveragepy,larsbutler/coveragepy,7WebPages/coveragepy,larsbutler/coveragepy,nedbat/coveragepy,hugovk/coveragepy,blueyed/coveragepy,7...
--- +++ @@ -12,13 +12,10 @@ """ # Create a module to serve as __main__ old_main_mod = sys.modules['__main__'] - main_mod = imp.new_module("__main__") + main_mod = imp.new_module('__main__') sys.modules['__main__'] = main_mod - main_mod.__dict__.update({ - '__name__': '__main__', - ...
64d7fb0b9ae9e14447a236a51e27b033aee20219
urls.py
urls.py
from django.conf.urls.defaults import * from django.contrib import admin from django.views.generic.simple import direct_to_template import settings admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^registration/', include('registration.urls')), (r'^$', direct_to_...
from django.conf.urls.defaults import * from django.contrib import admin from django.views.generic.simple import direct_to_template import settings admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^accounts/', include('registration.urls')), (r'^$', direct_to_temp...
Move pages from registration to accounts/
Move pages from registration to accounts/
Python
agpl-3.0
pu239ppy/authentic2,BryceLohr/authentic,pu239ppy/authentic2,incuna/authentic,adieu/authentic2,pu239ppy/authentic2,pu239ppy/authentic2,incuna/authentic,adieu/authentic2,adieu/authentic2,BryceLohr/authentic,BryceLohr/authentic,incuna/authentic,incuna/authentic,adieu/authentic2,incuna/authentic,BryceLohr/authentic
--- +++ @@ -8,7 +8,7 @@ urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), - (r'^registration/', include('registration.urls')), + (r'^accounts/', include('registration.urls')), (r'^$', direct_to_template, { 'template': 'index.html' }, 'index'), )
96884e4c35b89cb1f63a6249c9c24e27894a3752
tacker/db/api.py
tacker/db/api.py
# Copyright 2011 VMware, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
# Copyright 2011 VMware, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
Remove unused LOG to keep code clean
Remove unused LOG to keep code clean TrivialFix Change-Id: I21fa9ebda98005c377d395f498cb44cf6599f0e5
Python
apache-2.0
stackforge/tacker,zeinsteinz/tacker,stackforge/tacker,openstack/tacker,openstack/tacker,openstack/tacker,zeinsteinz/tacker
--- +++ @@ -15,10 +15,7 @@ from oslo_config import cfg from oslo_db.sqlalchemy import enginefacade -from oslo_log import log as logging - -LOG = logging.getLogger(__name__) context_manager = enginefacade.transaction_context()
50bdb59f7629b60d6aa6c9f3f21b447f00476b19
webmanager/views_oauth2.py
webmanager/views_oauth2.py
from djangoautoconf.django_utils import retrieve_param from django.utils import timezone from provider.oauth2.backends import AccessTokenBackend from provider.oauth2.models import AccessToken from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth import login def login_from_oauth2(request...
from djangoautoconf.django_utils import retrieve_param from django.utils import timezone from provider.oauth2.backends import AccessTokenBackend from provider.oauth2.models import AccessToken from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth import login from djangoautoconf.req_with_a...
Move user login code to djangoautoconf.
Move user login code to djangoautoconf.
Python
bsd-3-clause
weijia/webmanager,weijia/webmanager,weijia/webmanager
--- +++ @@ -4,6 +4,8 @@ from provider.oauth2.models import AccessToken from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth import login + +from djangoautoconf.req_with_auth import login_by_django_user def login_from_oauth2(request): @@ -15,7 +17,6 @@ user_access_to...