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
fcdcf2b997c4adebd852ce399492a76868e8b0ad
greenmine/base/monkey.py
greenmine/base/monkey.py
# -*- coding: utf-8 -*- from rest_framework import views from rest_framework import status, exceptions from rest_framework.response import Response def patch_api_view(): from django.views.generic import View if hasattr(views, "_patched"): return views._APIView = views.APIView views._patched ...
# -*- coding: utf-8 -*- from __future__ import print_function import sys from rest_framework import views from rest_framework import status, exceptions from rest_framework.response import Response def patch_api_view(): from django.views.generic import View if hasattr(views, "_patched"): return v...
Send print message to sys.stderr
Smallfix: Send print message to sys.stderr
Python
agpl-3.0
astronaut1712/taiga-back,gauravjns/taiga-back,obimod/taiga-back,gauravjns/taiga-back,Tigerwhit4/taiga-back,EvgeneOskin/taiga-back,rajiteh/taiga-back,CoolCloud/taiga-back,bdang2012/taiga-back-casting,jeffdwyatt/taiga-back,astronaut1712/taiga-back,frt-arch/taiga-back,bdang2012/taiga-back-casting,crr0004/taiga-back,CMLL/t...
--- +++ @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import print_function +import sys from rest_framework import views from rest_framework import status, exceptions @@ -27,5 +29,5 @@ view.cls_instance = cls(**initkwargs) return view - print "Patching APIView" + prin...
06914af3d8df899947a53c2fe3b3ce1de208d04d
robot-framework-needle.py
robot-framework-needle.py
from needle.cases import NeedleTestCase from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as ec class TestLogo(NeedleTestCase): def test_logo(self): self.driver.get('http://www.bbc.co.uk/news/') ...
from needle.cases import NeedleTestCase from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as ec class TestLogo(NeedleTestCase): def test_logo(self): self.driver.get('http://www.bbc.co.uk/news/') ...
Fix locators used in needle example on BBC site
Fix locators used in needle example on BBC site
Python
apache-2.0
laurentbristiel/robotframework-needle
--- +++ @@ -10,8 +10,8 @@ self.driver.get('http://www.bbc.co.uk/news/') try: WebDriverWait(self.driver, 20).until( - ec.presence_of_element_located((By.ID, "blq-mast")) + ec.presence_of_element_located((By.ID, "idcta-link")) ) ...
061306d137b85ac59e182ffbba29d22bc8c624ba
characters/views.py
characters/views.py
from django.shortcuts import get_object_or_404, redirect, render from django.views import generic from characters.forms import CharacterForm from characters.models import Character, Class, Race class CharacterIndexView(generic.ListView): template_name = 'characters/index.html' context_object_name = 'all_cha...
from django.shortcuts import get_object_or_404, redirect, render from django.views import generic from characters.forms import CharacterForm from characters.models import Character, Class, Race class CharacterIndexView(generic.ListView): template_name = 'characters/index.html' context_object_name = 'all_cha...
Order character listing by name
Order character listing by name
Python
mit
mpirnat/django-tutorial-v2
--- +++ @@ -11,7 +11,7 @@ context_object_name = 'all_characters' # better than 'object_list' def get_queryset(self): - return Character.objects.all() + return Character.objects.all().order_by('name') class CharacterDetailView(generic.DetailView):
ede4689ce3f9e03db5f250617e793083333af3a5
notification/backends/email.py
notification/backends/email.py
from django.conf import settings from django.core.urlresolvers import reverse from django.template.loader import render_to_string from django.utils.translation import ugettext from django.contrib.sites.models import Site from notification import backends from notification.message import message_to_text # favour djan...
from django.conf import settings from django.db.models.loading import get_app from django.core.urlresolvers import reverse from django.template.loader import render_to_string from django.utils.translation import ugettext from django.contrib.sites.models import Site from django.core.exceptions import ImproperlyConfigur...
Use get_app over to include django-mailer support over a standard import and ImportError exception handling.
pluggable-backends: Use get_app over to include django-mailer support over a standard import and ImportError exception handling. git-svn-id: 12265af7f62f437cb19748843ef653b20b846039@130 590c3fc9-4838-0410-bb95-17a0c9b37ca9
Python
mit
brosner/django-notification,arctelix/django-notification-automated
--- +++ @@ -1,17 +1,20 @@ from django.conf import settings +from django.db.models.loading import get_app from django.core.urlresolvers import reverse from django.template.loader import render_to_string from django.utils.translation import ugettext from django.contrib.sites.models import Site +from django.core....
24c1309a9f221ec8be6a3b15dc843769f4157cf1
allauth/socialaccount/providers/twitch/views.py
allauth/socialaccount/providers/twitch/views.py
import requests from allauth.socialaccount.providers.oauth2.views import ( OAuth2Adapter, OAuth2CallbackView, OAuth2LoginView, ) from .provider import TwitchProvider class TwitchOAuth2Adapter(OAuth2Adapter): provider_id = TwitchProvider.id access_token_url = 'https://api.twitch.tv/kraken/oauth2/...
import requests from allauth.socialaccount.providers.oauth2.client import OAuth2Error from allauth.socialaccount.providers.oauth2.views import ( OAuth2Adapter, OAuth2CallbackView, OAuth2LoginView, ) from .provider import TwitchProvider class TwitchOAuth2Adapter(OAuth2Adapter): provider_id = TwitchPr...
Add error checking in API response
twitch: Add error checking in API response
Python
mit
rsalmaso/django-allauth,lukeburden/django-allauth,pennersr/django-allauth,AltSchool/django-allauth,pztrick/django-allauth,AltSchool/django-allauth,rsalmaso/django-allauth,bittner/django-allauth,pztrick/django-allauth,pennersr/django-allauth,lukeburden/django-allauth,lukeburden/django-allauth,pztrick/django-allauth,bitt...
--- +++ @@ -1,5 +1,6 @@ import requests +from allauth.socialaccount.providers.oauth2.client import OAuth2Error from allauth.socialaccount.providers.oauth2.views import ( OAuth2Adapter, OAuth2CallbackView, @@ -16,13 +17,19 @@ profile_url = 'https://api.twitch.tv/kraken/user' def complete_logi...
8d9bb10d5281fe89f693068143e45ff761200abd
01_Built-in_Types/list.py
01_Built-in_Types/list.py
#!/usr/bin/env python import sys print("argv: %d" % len(sys.argv)) # Object related test print(type(sys.argv)) print(id(sys.argv)) print(type(sys.argv) is list) if len(sys.argv) != 2: print("%s filename" % sys.argv[0]) raise SystemExit(1) file = open(sys.argv[1], "w") line = [] while True: line = sys.s...
#!/usr/bin/env python import sys print("argv: %d" % len(sys.argv)) # Object related test # type and id are unique # ref: https://docs.python.org/2/reference/datamodel.html # mutable object: value can be changed # immutable object: value can NOT be changed after created # This means readonly # ex: ...
Add comment for object types
Add comment for object types
Python
bsd-2-clause
zzz0072/Python_Exercises,zzz0072/Python_Exercises
--- +++ @@ -4,6 +4,13 @@ print("argv: %d" % len(sys.argv)) # Object related test +# type and id are unique +# ref: https://docs.python.org/2/reference/datamodel.html +# mutable object: value can be changed +# immutable object: value can NOT be changed after created +# This means readonly +# ex...
8386d7372f9ff8bfad651efe43504746aff19b73
app/models/rooms/rooms.py
app/models/rooms/rooms.py
from models.people.people import Staff, Fellow from models.rooms.rooms import Office, LivingSpace import random class Dojo(object): def __init__(self): self.offices = [] self.livingrooms = [] self.staff = [] self.fellows = [] self.all_rooms = [] self.all_people = []...
import os import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) class Room(object): """Models the kind of rooms available at Andela, It forms the base class Room from which OfficeSpace and LivingRoom inherit""" def __init__(self, room_name, room_type, room_...
Implement the Room base class
Implement the Room base class
Python
mit
Alweezy/alvin-mutisya-dojo-project
--- +++ @@ -1,45 +1,20 @@ -from models.people.people import Staff, Fellow -from models.rooms.rooms import Office, LivingSpace -import random +import os +import sys +from os import path +sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) -class Dojo(object): - def __init__(self): - self....
fe25e0d68647af689c4015f1728cd7dd2d48b7ee
scripts/example_parser.py
scripts/example_parser.py
# This is an example of how to parse ooniprobe reports import yaml import sys print "Opening %s" % sys.argv[1] f = open(sys.argv[1]) yamloo = yaml.safe_load_all(f) report_header = yamloo.next() print "ASN: %s" % report_header['probe_asn'] print "CC: %s" % report_header['probe_cc'] print "IP: %s" % report_header['prob...
# This is an example of how to parse ooniprobe reports import yaml import sys print "Opening %s" % sys.argv[1] f = open(sys.argv[1]) yamloo = yaml.safe_load_all(f) report_header = yamloo.next() print "ASN: %s" % report_header['probe_asn'] print "CC: %s" % report_header['probe_cc'] print "IP: %s" % report_header['prob...
Update parser to the changes in the report format
Update parser to the changes in the report format
Python
bsd-2-clause
0xPoly/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,0xPoly/...
--- +++ @@ -15,7 +15,7 @@ print "Test version: %s" % report_header['test_version'] for report_entry in yamloo: - print "Test: %s" % report_entry['test'] + print "Test: %s" % report_entry['test_name'] print "Input: %s" % report_entry['input'] print "Report: %s" % report_entry['report']
df2d24757d8e12035437d152d17dc9016f1cd9df
app/__init__.py
app/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: __init__.py Author: huxuan <i(at)huxuan.org> Description: Initial file for app. """ from flask import Flask app = Flask(__name__) # pylint: disable=invalid-name app.config.from_object('config') # commented as for file structure, should recover later. # from ap...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: __init__.py Author: huxuan <i(at)huxuan.org> Description: Initial file for app. """ from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) # pylint: disable=invalid-name app.config.from_object('config') # commented as for fil...
Create model in config file.
Create model in config file.
Python
mit
CAPU-ENG/CAPUHome-API,huxuan/CAPUHome-API
--- +++ @@ -7,6 +7,7 @@ """ from flask import Flask +from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) # pylint: disable=invalid-name app.config.from_object('config') @@ -14,6 +15,8 @@ # commented as for file structure, should recover later. # from app import models +db = SQLAlchemy(app) ...
8c2996b94cdc3210b24ebeaeb957c625629f68a5
hunting/level/encoder.py
hunting/level/encoder.py
import json import hunting.sim.entities as entities class GameObjectEncoder(json.JSONEncoder): def default(self, o): d = o.__dict__ d.pop('owner', None) if isinstance(o, entities.GameObject): d.pop('log', None) d.pop('ai', None) return d elif is...
import json import hunting.sim.entities as entities class GameObjectEncoder(json.JSONEncoder): def default(self, o): d = o.__dict__ d.pop('owner', None) if isinstance(o, entities.GameObject): d.pop('log', None) d.pop('ai', None) return d elif is...
Add log to encoding output (still fails due to objects)
Add log to encoding output (still fails due to objects)
Python
mit
MoyTW/RL_Arena_Experiment
--- +++ @@ -21,6 +21,13 @@ def encode_level(level): - save_factions = [f for f in level.get_factions() if level.get_faction_info(f)['save'] is True] - factions_to_objects = {f: level.get_objects_inside_faction(f) for f in save_factions} - return json.dumps(factions_to_objects, cls=GameObjectEncoder, ind...
28960dc03e5e14db94d18b968947257029f934d8
cw_draw_stairs.py
cw_draw_stairs.py
"""Codewars: Draw stairs 8 kyu URL: https://www.codewars.com/kata/draw-stairs/ Given a number n, draw stairs using the letter "I", n tall and n wide, with the tallest in the top left. For example n = 3 result in "I\n I\n I", or printed: I I I Another example, a 7-step stairs should be drawn like this: I I I ...
"""Codewars: Draw stairs 8 kyu URL: https://www.codewars.com/kata/draw-stairs/ Given a number n, draw stairs using the letter "I", n tall and n wide, with the tallest in the top left. For example n = 3 result in "I\n I\n I", or printed: I I I Another example, a 7-step stairs should be drawn like this: I I I ...
Simplify adding spaces and add time/space complexity
Simplify adding spaces and add time/space complexity
Python
bsd-2-clause
bowen0701/algorithms_data_structures
--- +++ @@ -22,12 +22,15 @@ """ def draw_stairs(n): + """ + Time complexity: O(n^2). + Space complexity: O(n). + """ stairs = [] for i in range(n): # Append (i - 1) spaces. - for _ in range(i): - stairs.append(' ') + stairs.append(' ' * i) ...
b723cbceb896f7ca8690eaa13c38ffb20fecd0be
avocado/search_indexes.py
avocado/search_indexes.py
import warnings from haystack import indexes from avocado.conf import settings from avocado.models import DataConcept, DataField # Warn if either of the settings are set to false if not getattr(settings, 'CONCEPT_SEARCH_ENABLED', True) or \ not getattr(settings, 'FIELD_SEARCH_ENABLED', True): warnings.warn...
from haystack import indexes from avocado.models import DataConcept, DataField class DataIndex(indexes.SearchIndex): text = indexes.CharField(document=True, use_template=True) text_auto = indexes.EdgeNgramField(use_template=True) def index_queryset(self, using=None): return self.get_model().objec...
Change DataIndex to restrict on published and archived flags only
Change DataIndex to restrict on published and archived flags only In addition, the warnings of the deprecated settings have been removed. Fix #290 Signed-off-by: Byron Ruth <e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98@devel.io>
Python
bsd-2-clause
murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado
--- +++ @@ -1,16 +1,5 @@ -import warnings from haystack import indexes -from avocado.conf import settings from avocado.models import DataConcept, DataField - -# Warn if either of the settings are set to false -if not getattr(settings, 'CONCEPT_SEARCH_ENABLED', True) or \ - not getattr(settings, 'FIELD_SEARCH...
c954c153525265b2b4ff0d89f0cf7f89c08a136c
settings/test_settings.py
settings/test_settings.py
# -*- coding: utf-8 -*-# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import os from .common import * # noqa DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(ROOT_DIR, 'test.sqlite3'), ...
# -*- coding: utf-8 -*-# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import os from .common import * # noqa DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(ROOT_DIR, 'test.sqlite3'), ...
Remove debug toolbar in test settings
Remove debug toolbar in test settings
Python
mit
praba230890/junction,praba230890/junction,farhaanbukhsh/junction,farhaanbukhsh/junction,pythonindia/junction,ChillarAnand/junction,pythonindia/junction,praba230890/junction,ChillarAnand/junction,pythonindia/junction,nava45/junction,nava45/junction,ChillarAnand/junction,nava45/junction,ChillarAnand/junction,praba230890/...
--- +++ @@ -24,6 +24,3 @@ INSTALLED_APPS += ('django_extensions',) DEVICE_VERIFICATION_CODE = 11111 - -# DEBUG TOOLBAR -INSTALLED_APPS += ('debug_toolbar',)
d36a4453eb6b62f8eda4614f276fdf9ba7afb26a
tests/test_main.py
tests/test_main.py
# -*- coding:utf-8 -*- from os.path import curdir, devnull from subprocess import check_call from pytest import fixture, mark, raises from csft import __main__ as main @fixture def null(): with open(devnull, 'w') as fobj: yield fobj def test_call(null): check_call(['python', '-m', 'csft', 'csft']...
# -*- coding:utf-8 -*- from os.path import curdir, devnull from subprocess import check_call from pytest import fixture, mark, raises from csft import __main__ as main @fixture def null(): with open(devnull, 'w') as fobj: yield fobj def test_call(null): check_call(['python', '-m', 'csft', 'csft']...
Fix compatible error about capsys.
Fix compatible error about capsys.
Python
mit
yanqd0/csft
--- +++ @@ -45,4 +45,5 @@ assert 0 == err.code from csft import __version__ - assert __version__ == capsys.readouterr().out.strip() + out = capsys.readouterr()[0] + assert __version__ == out.strip()
87acf306addc60d7678ff980aef4b87f4225839b
theo_actual_nut.py
theo_actual_nut.py
from itertools import combinations from deuces.deuces import Card, Evaluator, Deck from nuts import nut_hand evaluator = Evaluator() deck = Deck() flop = deck.draw(3) def omaha_eval(hole, board): assert(len(hole)) == 4 ranks = [] for ph in combinations(hole, 2): thisrank = evaluator.evaluate(list(...
from itertools import combinations from deuces.deuces import Card, Evaluator, Deck from nuts import nut_hand evaluator = Evaluator() deck = Deck() flop = deck.draw(3) def omaha_eval(hole, board): assert(len(hole)) == 4 ranks = [] for ph in combinations(hole, 2): thisrank = evaluator.evaluate(list(...
Determine winning hand & compare to nut hand.
Determine winning hand & compare to nut hand.
Python
mit
zimolzak/poker-experiments,zimolzak/poker-experiments,zimolzak/poker-experiments
--- +++ @@ -17,6 +17,9 @@ def r2t(x): return evaluator.class_to_string(evaluator.get_rank_class(x)) +def r2c(x): + return evaluator.get_rank_class(x) + def list_to_pretty_str(card_ints): output = " " for i in range(len(card_ints)): @@ -27,10 +30,14 @@ output += Card.int_to_pretty_st...
86a2e55954ff4b8f5e005296e2ae336b6be627a0
py/rackattack/clientfactory.py
py/rackattack/clientfactory.py
import os from rackattack.tcp import client _VAR_NAME = "RACKATTACK_PROVIDER" def factory(): if _VAR_NAME not in os.environ: raise Exception( "The environment variable '%s' must be defined properly" % _VAR_NAME) request, subscribe, http = os.environ[_VAR_NAME].split("@@") return clie...
import os from rackattack.tcp import client _VAR_NAME = "RACKATTACK_PROVIDER" def factory(connectionString=None): if connectionString is None: if _VAR_NAME not in os.environ: raise Exception( "The environment variable '%s' must be defined properly" % _VAR_NAME) connec...
Allow passing the rackattack connection string as an argument to the client factory
Allow passing the rackattack connection string as an argument to the client factory
Python
apache-2.0
eliran-stratoscale/rackattack-api,Stratoscale/rackattack-api
--- +++ @@ -5,11 +5,13 @@ _VAR_NAME = "RACKATTACK_PROVIDER" -def factory(): - if _VAR_NAME not in os.environ: - raise Exception( - "The environment variable '%s' must be defined properly" % _VAR_NAME) - request, subscribe, http = os.environ[_VAR_NAME].split("@@") +def factory(connectionSt...
d78fad6937fb20a1ea7374240607b5d6800aa11b
username_to_uuid.py
username_to_uuid.py
""" Username to UUID Converts a Minecraft username to it's UUID equivalent. Parses http://www.lb-stuff.com/Minecraft-Name-History output to retrieve the UUID of an old name that's no longer in use. """ import http.client from bs4 import BeautifulSoup class UsernameToUUID: def __init__(self, username): ...
""" Username to UUID Converts a Minecraft username to it's UUID equivalent. Uses the official Mojang API to fetch player data. """ import http.client import json class UsernameToUUID: def __init__(self, username): self.username = username def get_uuid(self, timestamp=None): """ Ge...
Use the Mojang API directly; reduces overhead.
Use the Mojang API directly; reduces overhead.
Python
mit
mrlolethan/MinecraftUsernameToUUID
--- +++ @@ -1,25 +1,38 @@ """ Username to UUID Converts a Minecraft username to it's UUID equivalent. -Parses http://www.lb-stuff.com/Minecraft-Name-History output to retrieve the UUID - of an old name that's no longer in use. +Uses the official Mojang API to fetch player data. """ import http.client - -from b...
43f67067c470386b6b24080642cc845ec1655f58
utils/networking.py
utils/networking.py
import fcntl import socket import struct from contextlib import contextmanager @contextmanager def use_interface(ifname): """ :type ifname: str """ ip = _ip_address_for_interface(ifname.encode('ascii')) original_socket = socket.socket def rebound_socket(*args, **kwargs): sock = origi...
import fcntl import socket import struct from contextlib import contextmanager @contextmanager def use_interface(ifname): """ :type ifname: str """ ip = _ip_address_for_interface(ifname) original_socket = socket.socket def rebound_socket(*args, **kwargs): sock = original_socket(*args...
Make _ip_address_for_interface easier to use
Make _ip_address_for_interface easier to use
Python
apache-2.0
OPWEN/opwen-webapp,ascoderu/opwen-webapp,ascoderu/opwen-webapp,OPWEN/opwen-webapp,OPWEN/opwen-webapp,ascoderu/opwen-cloudserver,ascoderu/opwen-cloudserver,ascoderu/opwen-webapp
--- +++ @@ -10,7 +10,7 @@ :type ifname: str """ - ip = _ip_address_for_interface(ifname.encode('ascii')) + ip = _ip_address_for_interface(ifname) original_socket = socket.socket def rebound_socket(*args, **kwargs): @@ -25,10 +25,11 @@ def _ip_address_for_interface(ifname): """ - ...
c80a68b81e936435434931f0b5bf748bcbea54dc
statistics/webui.py
statistics/webui.py
from flask import render_template, g, redirect, request from db import connect_db, get_all_sum from statistics import app @app.before_request def before_request(): g.db = connect_db() g.fields = ["CPU", "TOTAL", "SQL", "SOLR", "REDIS", "MEMCACHED"] @app.route("/") def main_page(): sort_by = request.args....
from flask import render_template, g, redirect, request from db import connect_db, get_all_sum from statistics import app @app.before_request def before_request(): g.db = connect_db() g.fields = ["CPU", "TOTAL", "SQL", "SOLR", "REDIS", "MEMCACHED"] @app.route("/") def main_page(): sort_by = request.args....
Add proto of average page. Without sorting.
Add proto of average page. Without sorting.
Python
mit
uvNikita/appstats,uvNikita/appstats,uvNikita/appstats
--- +++ @@ -16,6 +16,16 @@ data = sorted(data, key=lambda row: row[sort_by]) return render_template("main_page.html", data=data) +@app.route("/average/") +def average(): + data = get_all_sum(g.db) + for row in data: + req_count = row['REQUESTS'] + for k in row: + if k !=...
236a3e81164e8f7c37c50eaf59bfadd32e76735a
defines.py
defines.py
INFINITY = 1e+31 DIRECTIONS = ((-1,-1),(-1,0),(-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)) EMPTY = 0 BLACK = 1 WHITE = 2 def opposite_colour(col): if col == BLACK: return WHITE if col == WHITE: return BLACK
INFINITY = 1e+31 DIRECTIONS = ((-1,-1),(-1,0),(-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)) EMPTY = 0 BLACK = 1 WHITE = 2 def opposite_colour(col): if col == BLACK: return WHITE if col == WHITE: return BLACK from pdb import set_trace as st
Make a shortcut for debugging with pdb
Make a shortcut for debugging with pdb
Python
mit
cropleyb/pentai,cropleyb/pentai,cropleyb/pentai
--- +++ @@ -13,3 +13,5 @@ return WHITE if col == WHITE: return BLACK + +from pdb import set_trace as st
1bd3d7d16da7cc1cf98fa68768910010251f2fea
tests/storage_adapter_tests/test_storage_adapter.py
tests/storage_adapter_tests/test_storage_adapter.py
from unittest import TestCase from chatterbot.storage import StorageAdapter class StorageAdapterTestCase(TestCase): """ This test case is for the StorageAdapter base class. Although this class is not intended for direct use, this test case ensures that exceptions requiring basic functionality are ...
from unittest import TestCase from chatterbot.storage import StorageAdapter class StorageAdapterTestCase(TestCase): """ This test case is for the StorageAdapter base class. Although this class is not intended for direct use, this test case ensures that exceptions requiring basic functionality are ...
Add test for unimplemented get_response_statements function
Add test for unimplemented get_response_statements function
Python
bsd-3-clause
gunthercox/ChatterBot,vkosuri/ChatterBot
--- +++ @@ -41,3 +41,7 @@ def test_drop(self): with self.assertRaises(StorageAdapter.AdapterMethodNotImplementedError): self.adapter.drop() + + def test_get_response_statements(self): + with self.assertRaises(StorageAdapter.AdapterMethodNotImplementedError): + self.adap...
67b243915ef95ff1b9337bc67053d18df372e79d
unitypack/enums.py
unitypack/enums.py
from enum import IntEnum class RuntimePlatform(IntEnum): OSXEditor = 0 OSXPlayer = 1 WindowsPlayer = 2 OSXWebPlayer = 3 OSXDashboardPlayer = 4 WindowsWebPlayer = 5 WindowsEditor = 7 IPhonePlayer = 8 PS3 = 9 XBOX360 = 10 Android = 11 NaCl = 12 LinuxPlayer = 13 FlashPlayer = 15 WebGLPlayer = 17 MetroPla...
from enum import IntEnum class RuntimePlatform(IntEnum): OSXEditor = 0 OSXPlayer = 1 WindowsPlayer = 2 OSXWebPlayer = 3 OSXDashboardPlayer = 4 WindowsWebPlayer = 5 WindowsEditor = 7 IPhonePlayer = 8 PS3 = 9 XBOX360 = 10 Android = 11 NaCl = 12 LinuxPlayer = 13 FlashPlayer = 15 WebGLPlayer = 17 MetroPla...
Add PSMPlayer and SamsungTVPlayer platforms
Add PSMPlayer and SamsungTVPlayer platforms
Python
mit
andburn/python-unitypack
--- +++ @@ -30,4 +30,6 @@ PSP2 = 24 PS4 = 25 PSM = 26 + PSMPlayer = 26 XboxOne = 27 + SamsungTVPlayer = 28
c4de9152f34d2831d43dfa3769a7a6452bba5814
blockbuster/bb_security.py
blockbuster/bb_security.py
__author__ = 'matt' from blockbuster import bb_dbconnector_factory def credentials_are_valid(username, password): db = bb_dbconnector_factory.DBConnectorInterfaceFactory().create() print(username) result = db.api_username_exists(username) print (result) return result
__author__ = 'matt' from blockbuster import bb_dbconnector_factory def credentials_are_valid(username, password): db = bb_dbconnector_factory.DBConnectorInterfaceFactory().create() print(username) result = db.api_credentials_are_valid(username, password) print (result) return result
Update method to check both username and password
Update method to check both username and password
Python
mit
mattstibbs/blockbuster-server,mattstibbs/blockbuster-server
--- +++ @@ -6,6 +6,6 @@ def credentials_are_valid(username, password): db = bb_dbconnector_factory.DBConnectorInterfaceFactory().create() print(username) - result = db.api_username_exists(username) + result = db.api_credentials_are_valid(username, password) print (result) return result
b28a40e38f0cbd40e01906063b97731ba6cd3fb6
backend/geonature/core/gn_profiles/models.py
backend/geonature/core/gn_profiles/models.py
from geonature.utils.env import DB from utils_flask_sqla.serializers import serializable @serializable class VmCorTaxonPhenology(DB.Model): __tablename__ = "vm_cor_taxon_phenology" __table_args__ = {"schema": "gn_profiles"} cd_ref = DB.Column(DB.Integer, primary_key=True) period = DB.Column(DB.Integer)...
from flask import current_app from geoalchemy2 import Geometry from utils_flask_sqla.serializers import serializable from utils_flask_sqla_geo.serializers import geoserializable from geonature.utils.env import DB @serializable class VmCorTaxonPhenology(DB.Model): __tablename__ = "vm_cor_taxon_phenology" __ta...
Add VM valid profile model
Add VM valid profile model
Python
bsd-2-clause
PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature
--- +++ @@ -1,5 +1,10 @@ +from flask import current_app +from geoalchemy2 import Geometry + +from utils_flask_sqla.serializers import serializable +from utils_flask_sqla_geo.serializers import geoserializable + from geonature.utils.env import DB -from utils_flask_sqla.serializers import serializable @serializable...
80531076a713618cda6de815bdd6675bdf6f85f1
bluebottle/clients/management/commands/export_tenants.py
bluebottle/clients/management/commands/export_tenants.py
import json from rest_framework.authtoken.models import Token from django.contrib.contenttypes.models import ContentType from django.core.management.base import BaseCommand from bluebottle.clients import properties from bluebottle.clients.models import Client from bluebottle.clients.utils import LocalTenant class C...
import json from rest_framework.authtoken.models import Token from django.contrib.contenttypes.models import ContentType from django.core.management.base import BaseCommand from bluebottle.clients import properties from bluebottle.clients.models import Client from bluebottle.clients.utils import LocalTenant class C...
Use client_name instead of schema_name
Use client_name instead of schema_name
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -33,7 +33,7 @@ api_key = Token.objects.get(user__username='accounting').key results.append({ - "name": client.schema_name, + "name": client.client_name, "domain": properties.TENANT_MAIL_PROPERTIES['website'], ...
753f5bdc3f023cf31c0f189dd835978aad2b5d49
djs_playground/urls.py
djs_playground/urls.py
from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from django.contrib import admin from djs_playground.views import index urlpatterns = [ url(r'^$', index, name='index'), url(r'^admin/', admin.site.urls), url(r'^summernote/', include('djan...
from django.conf import settings from django.urls import re_path, include from django.conf.urls.static import static from django.contrib import admin from djs_playground.views import index urlpatterns = [ re_path(r'^$', index, name='index'), re_path(r'^admin/', admin.site.urls), re_path(r'^summernote/', in...
Change url in favor of the re_path
Change url in favor of the re_path
Python
mit
summernote/django-summernote,summernote/django-summernote,summernote/django-summernote
--- +++ @@ -1,11 +1,11 @@ from django.conf import settings -from django.conf.urls import url, include +from django.urls import re_path, include from django.conf.urls.static import static from django.contrib import admin from djs_playground.views import index urlpatterns = [ - url(r'^$', index, name='index')...
5a641736faf6bb3ce335480848464a1f22fab040
fabfile.py
fabfile.py
# -*- coding: utf-8 -*- from contextlib import nested from fabric.api import * def prepare_project(): u""" Enters the directory and sources environment configuration. I know ``nested`` is deprecated, but what a nice shortcut it is here ;) """ return nested( cd(PROJECT_PATH), pre...
# -*- coding: utf-8 -*- from contextlib import nested from fabric.api import * def prepare_project(): u""" Enters the directory and sources environment configuration. I know ``nested`` is deprecated, but what a nice shortcut it is here ;) """ return nested( cd(PROJECT_PATH), pre...
Make Fabric honor .ssh/config settings
Make Fabric honor .ssh/config settings
Python
mit
zsiciarz/variablestars.net,zsiciarz/variablestars.net,zsiciarz/variablestars.net
--- +++ @@ -24,6 +24,7 @@ } env.color = True env.forward_agent = True +env.use_ssh_config = True @task
dc1cf6fabcf871e3661125f7ac5d1cf9567798d6
cms/management/commands/load_dev_fixtures.py
cms/management/commands/load_dev_fixtures.py
import requests from django.core.management import call_command from django.core.management.base import NoArgsCommand from django.conf import settings from django.utils.six.moves import input class Command(NoArgsCommand): """ Download and load dev fixtures from www.python.org """ help = "Download and...
import requests from django.core.management import call_command from django.core.management.base import NoArgsCommand from django.conf import settings from django.utils.six.moves import input class Command(NoArgsCommand): """ Download and load dev fixtures from www.python.org """ help = "Download and...
Use self.stdout.write() instead of print().
Use self.stdout.write() instead of print(). This is the recommended way in the Django documentation: https://docs.djangoproject.com/en/1.7/howto/custom-management-commands/
Python
apache-2.0
manhhomienbienthuy/pythondotorg,python/pythondotorg,SujaySKumar/pythondotorg,lebronhkh/pythondotorg,SujaySKumar/pythondotorg,lepture/pythondotorg,python/pythondotorg,proevo/pythondotorg,Mariatta/pythondotorg,malemburg/pythondotorg,willingc/pythondotorg,fe11x/pythondotorg,berkerpeksag/pythondotorg,demvher/pythondotorg,p...
--- +++ @@ -22,19 +22,17 @@ Type 'y' or 'yes' to continue, 'n' or 'no' to cancel: """) if confirm in ('y', 'yes'): - if confirm: - print() - print("Beginning download, note this can take a couple of minutes...") + self.stdout.write("\nBeginning download, note t...
06f0edb71086573a3d7f9efb01b97b073cf415a3
tests/DdlTextWrterTest.py
tests/DdlTextWrterTest.py
import io import os import unittest from pyddl import * __author__ = "Jonathan Hale" class DdlTextWriterTest(unittest.TestCase): def tearDown(self): try: os.remove("test.oddl") except FileNotFoundError: pass # test_empty failed? def test_empty(self): # creat...
import os import unittest from pyddl import * from pyddl.enum import * __author__ = "Jonathan Hale" class DdlTextWriterTest(unittest.TestCase): def tearDown(self): try: os.remove("test.oddl") except FileNotFoundError: pass # test_empty failed? def test_empty(self): ...
Create a document in DdlTextWriterTest.test_full()
Create a document in DdlTextWriterTest.test_full() Signed-off-by: Squareys <0f6a03d4883e012ba4cb2c581a68f35544703cd6@googlemail.com>
Python
mit
Squareys/PyDDL
--- +++ @@ -1,7 +1,7 @@ -import io import os import unittest from pyddl import * +from pyddl.enum import * __author__ = "Jonathan Hale" @@ -28,8 +28,16 @@ self.fail("DdlTextWriter did not create the specified file.") def test_full(self): - self.assertTrue(True) - pass + ...
125dfa47e5656c3f9b1e8846be03010ed02c6f91
tests/rules_tests/isValid_tests/InvalidSyntaxTest.py
tests/rules_tests/isValid_tests/InvalidSyntaxTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Rule class InvalidSyntaxTest(TestCase): pass if __name__ == '__main__': main()
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Rule from grammpy.exceptions import RuleSyntaxException from .grammar import * class InvalidSyntaxTest(TestCase): def test_rulesMissingEncloseLis...
Add base set of rule's invalid syntax tests
Add base set of rule's invalid syntax tests
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -9,10 +9,70 @@ from unittest import main, TestCase from grammpy import Rule +from grammpy.exceptions import RuleSyntaxException +from .grammar import * class InvalidSyntaxTest(TestCase): - pass + def test_rulesMissingEncloseList(self): + class tmp(Rule): + rules = ([0], [1]...
12cb8ca101faa09e4cc07f9e257b3d3130892297
tests/sentry/web/frontend/tests.py
tests/sentry/web/frontend/tests.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import pytest from django.core.urlresolvers import reverse from exam import fixture from sentry.testutils import TestCase @pytest.mark.xfail class ReplayTest(TestCase): @fixture def path(self): return reverse('sentry-replay', kwargs={ ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from django.core.urlresolvers import reverse from exam import fixture from sentry.testutils import TestCase class ReplayTest(TestCase): @fixture def path(self): return reverse('sentry-replay', kwargs={ 'organization_slug': s...
Remove xfail from replay test
Remove xfail from replay test
Python
bsd-3-clause
mitsuhiko/sentry,fotinakis/sentry,beeftornado/sentry,mvaled/sentry,mvaled/sentry,BuildingLink/sentry,alexm92/sentry,mvaled/sentry,mvaled/sentry,BuildingLink/sentry,nicholasserra/sentry,JackDanger/sentry,fotinakis/sentry,gencer/sentry,fotinakis/sentry,beeftornado/sentry,ifduyue/sentry,JamesMura/sentry,imankulov/sentry,l...
--- +++ @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import - -import pytest from django.core.urlresolvers import reverse from exam import fixture @@ -10,7 +8,6 @@ from sentry.testutils import TestCase -@pytest.mark.xfail class ReplayTest(TestCase): @fixture def path...
f920f7e765dac7057e3c48ebe0aa9723c3d431f5
src/cclib/progress/__init__.py
src/cclib/progress/__init__.py
__revision__ = "$Revision$" from textprogress import TextProgress try: import qt except ImportError: pass # import QtProgress will cause an error else: from qtprogress import QtProgress
__revision__ = "$Revision$" from textprogress import TextProgress import sys if 'qt' in sys.modules.keys(): from qtprogress import QtProgress
Check to see if qt is loaded; if so, export QtProgress class
Check to see if qt is loaded; if so, export QtProgress class git-svn-id: d468cea6ffe92bc1eb1f3bde47ad7e70b065426a@224 5acbf244-8a03-4a8b-a19b-0d601add4d27
Python
lgpl-2.1
Clyde-fare/cclib_bak,Clyde-fare/cclib_bak
--- +++ @@ -1,9 +1,7 @@ __revision__ = "$Revision$" from textprogress import TextProgress -try: - import qt -except ImportError: - pass # import QtProgress will cause an error -else: +import sys + +if 'qt' in sys.modules.keys(): from qtprogress import QtProgress
23675e41656cac48f390d97f065b36de39e27d58
duckbot.py
duckbot.py
import discord import duckbot_settings import random from discord.ext import commands _DESCRIPTION = '''quack''' bot = commands.Bot(command_prefix='/', description=_DESCRIPTION) @bot.event async def on_ready(): print('logged in: %s (%s)' % (bot.user.name, bot.user.id)) oauth_url = discord.utils.oauth_url(duckbot...
import discord import duckbot_settings import random from discord.ext import commands _DESCRIPTION = '''quack''' bot = commands.Bot(command_prefix='/', description=_DESCRIPTION) rand = random.SystemRandom() @bot.event async def on_ready(): print('logged in: %s (%s)' % (bot.user.name, bot.user.id)) oauth_url = di...
Add a real roll command
Add a real roll command
Python
mit
andrewlin16/duckbot,andrewlin16/duckbot
--- +++ @@ -6,6 +6,7 @@ _DESCRIPTION = '''quack''' bot = commands.Bot(command_prefix='/', description=_DESCRIPTION) +rand = random.SystemRandom() @bot.event async def on_ready(): @@ -24,6 +25,8 @@ @bot.command() async def roll(): - await bot.say('pretending to roll') + lower_bound = 1 + upper_boundb = 6 +...
30ed3800fdeec4aec399e6e0ec0760e46eb891ec
djangoautoconf/model_utils/model_reversion.py
djangoautoconf/model_utils/model_reversion.py
from django.contrib.contenttypes.models import ContentType from django.db.models.signals import pre_save from django.dispatch import receiver from reversion.models import Version from reversion.revisions import default_revision_manager global_save_signal_receiver = [] class PreSaveHandler(object): def __init__(s...
from django.contrib.contenttypes.models import ContentType from django.db.models.signals import pre_save from django.dispatch import receiver from reversion.models import Version def create_initial_version(obj): try: from reversion.revisions import default_revision_manager default_revision_manager...
Fix broken initial version creation.
Fix broken initial version creation.
Python
bsd-3-clause
weijia/djangoautoconf,weijia/djangoautoconf
--- +++ @@ -2,7 +2,15 @@ from django.db.models.signals import pre_save from django.dispatch import receiver from reversion.models import Version -from reversion.revisions import default_revision_manager + + +def create_initial_version(obj): + try: + from reversion.revisions import default_revision_manage...
5237cb7f1339eb13b4c01f1c3611448a8f865726
terms/templatetags/terms.py
terms/templatetags/terms.py
# coding: utf-8 from django.template import Library from ..html import TermsHTMLReconstructor register = Library() @register.filter def replace_terms(html): parser = TermsHTMLReconstructor() parser.feed(html) return parser.out
# coding: utf-8 from django.template import Library from django.template.defaultfilters import stringfilter from ..html import TermsHTMLReconstructor register = Library() @register.filter @stringfilter def replace_terms(html): parser = TermsHTMLReconstructor() parser.feed(html) return parser.out
Make sure the filter arg is a string.
Make sure the filter arg is a string.
Python
bsd-3-clause
BertrandBordage/django-terms,philippeowagner/django-terms,BertrandBordage/django-terms,philippeowagner/django-terms
--- +++ @@ -1,12 +1,14 @@ # coding: utf-8 from django.template import Library +from django.template.defaultfilters import stringfilter from ..html import TermsHTMLReconstructor register = Library() @register.filter +@stringfilter def replace_terms(html): parser = TermsHTMLReconstructor() parse...
1b218de76e8b09c70abcd88a2c6dd2c043bfc7f0
drcli/__main__.py
drcli/__main__.py
#!/usr/bin/env python import os.path import sys import imp import argparse from api import App, add_subparsers def load_plugins(dir): for f in os.listdir(dir): module_name, ext = os.path.splitext(f) if ext == '.py': imp.load_source('arbitrary', os.path.join(dir, f)) def main(args=sys.argv[1:]): lo...
#!/usr/bin/env python import os.path import sys import imp import argparse from api import App, add_subparsers def load_plugins(dir): for f in os.listdir(dir): module_name, ext = os.path.splitext(f) if ext == '.py': imp.load_source('arbitrary', os.path.join(dir, f)) def main(args=None): if args is...
Allow sub-commands to use same main function
Allow sub-commands to use same main function
Python
mit
schwa-lab/dr-apps-python
--- +++ @@ -13,14 +13,22 @@ imp.load_source('arbitrary', os.path.join(dir, f)) -def main(args=sys.argv[1:]): +def main(args=None): + if args is None: + args = sys.argv[1:] + cmd = os.path.basename(sys.argv[0]) + if cmd.startswith('dr-'): + args.insert(0, cmd[3:]) + prog = 'dr' + else: ...
85d684369e72aa2968f9ffbd0632f84558e1b44e
tests/test_vector2_dot.py
tests/test_vector2_dot.py
from ppb_vector import Vector2 from math import isclose, sqrt import pytest # type: ignore from hypothesis import assume, given, note from utils import floats, vectors @given(x=vectors(), y=vectors()) def test_dot_commutes(x: Vector2, y: Vector2): assert x * y == y * x MAGNITUDE=1e10 @given(x=vectors(max_magn...
from ppb_vector import Vector2 from math import isclose, sqrt import pytest # type: ignore from hypothesis import assume, given, note from utils import floats, vectors @given(x=vectors(), y=vectors()) def test_dot_commutes(x: Vector2, y: Vector2): assert x * y == y * x @given(x=vectors()) def test_dot_length(x...
Test that x² == |x|²
tests/dot: Test that x² == |x|²
Python
artistic-2.0
ppb/ppb-vector,ppb/ppb-vector
--- +++ @@ -10,6 +10,10 @@ def test_dot_commutes(x: Vector2, y: Vector2): assert x * y == y * x +@given(x=vectors()) +def test_dot_length(x: Vector2): + assert isclose(x * x, x.length * x.length) + MAGNITUDE=1e10 @given(x=vectors(max_magnitude=MAGNITUDE), z=vectors(max_magnitude=MAGNITUDE),
99e1377deb066b9bee64b40799caaeaccd0db7d8
src/conditions/signals.py
src/conditions/signals.py
# coding: utf-8 import os import traceback from .handlers import find_handler _activate_debugger = os.environ.get('DEBUG') == 'yes' if _activate_debugger: try: from trepan.api import debug set_trace = debug except ImportError: import pdb set_trace = pdb.set_trace def signal...
# coding: utf-8 from __future__ import print_function import os import traceback from .handlers import find_handler _activate_debugger = os.environ.get('DEBUG') == 'yes' if _activate_debugger: try: from trepan.api import debug set_trace = debug except ImportError: import pdb ...
Fix use of Python 2 print
Fix use of Python 2 print
Python
bsd-2-clause
svetlyak40wt/python-cl-conditions
--- +++ @@ -1,4 +1,6 @@ # coding: utf-8 + +from __future__ import print_function import os import traceback @@ -23,7 +25,7 @@ callback = find_handler(e) if callback is None: if _activate_debugger: - print 'Handler for error {0} not found'.format(type(e)) + print('Handler ...
fd81c4cea0d28275123539c23c27dcfdd71e9aef
scipy/testing/nulltester.py
scipy/testing/nulltester.py
''' Null tester (when nose not importable) Merely returns error reporting lack of nose package See pkgtester, nosetester modules ''' nose_url = 'http://somethingaboutorange.com/mrl/projects/nose' class NullTester(object): def __init__(self, *args, **kwargs): pass def test(self, labels=None, *args, ...
''' Null tester (when nose not importable) Merely returns error reporting lack of nose package See pkgtester, nosetester modules ''' nose_url = 'http://somethingaboutorange.com/mrl/projects/nose' class NullTester(object): def __init__(self, *args, **kwargs): pass def test(self, labels=None, *args, ...
Fix bench error on scipy import when nose is not installed
Fix bench error on scipy import when nose is not installed
Python
bsd-3-clause
aman-iitj/scipy,maciejkula/scipy,efiring/scipy,gfyoung/scipy,teoliphant/scipy,pizzathief/scipy,pbrod/scipy,Eric89GXL/scipy,jor-/scipy,larsmans/scipy,anntzer/scipy,behzadnouri/scipy,pschella/scipy,ogrisel/scipy,sriki18/scipy,aarchiba/scipy,WarrenWeckesser/scipy,newemailjdm/scipy,Srisai85/scipy,pbrod/scipy,surhudm/scipy,...
--- +++ @@ -13,4 +13,6 @@ pass def test(self, labels=None, *args, **kwargs): raise ImportError, 'Need nose for tests - see %s' % nose_url + def bench(self, labels=None, *args, **kwargs): + raise ImportError, 'Need nose for benchmarks - see %s' % nose_url
6d08c13fbf42eb4251d3477a904ab6d8513620df
dataset.py
dataset.py
from scrapy.item import Item, Field class DatasetItem(Item): name = Field() frequency = Field()
from scrapy.item import Item, Field class DatasetItem(Item): url = Field() name = Field() frequency = Field()
Add url field to Dataset web item
Add url field to Dataset web item
Python
mit
MaxLikelihood/CODE
--- +++ @@ -2,6 +2,6 @@ class DatasetItem(Item): + url = Field() name = Field() frequency = Field() -
b7a24dca6b52d8924f59dc0e8ecd8e25cac998a2
common/djangoapps/enrollment/urls.py
common/djangoapps/enrollment/urls.py
""" URLs for the Enrollment API """ from django.conf import settings from django.conf.urls import patterns, url from .views import ( EnrollmentView, EnrollmentListView, EnrollmentCourseDetailView ) urlpatterns = patterns( 'enrollment.views', url( r'^enrollment/{username},{course_key}$'.f...
""" URLs for the Enrollment API """ from django.conf import settings from django.conf.urls import patterns, url from .views import ( EnrollmentView, EnrollmentListView, EnrollmentCourseDetailView ) urlpatterns = patterns( 'enrollment.views', url( r'^enrollment/{username},{course_key}/$'....
Add options trailing slashes to the Enrollment API.
Add options trailing slashes to the Enrollment API. This allows the edX REST API Client to perform a sucessful GET against this API, since Slumber (which our client is based off of) appends the trailing slash by default.
Python
agpl-3.0
zhenzhai/edx-platform,zhenzhai/edx-platform,zhenzhai/edx-platform,zhenzhai/edx-platform,zhenzhai/edx-platform
--- +++ @@ -15,20 +15,20 @@ urlpatterns = patterns( 'enrollment.views', url( - r'^enrollment/{username},{course_key}$'.format( + r'^enrollment/{username},{course_key}/$'.format( username=settings.USERNAME_PATTERN, course_key=settings.COURSE_ID_PATTERN ), Enrollm...
62317424b7e318ac9c59aecc768a4487788bd179
content/test/gpu/gpu_tests/pixel_expectations.py
content/test/gpu/gpu_tests/pixel_expectations.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from gpu_test_expectations import GpuTestExpectations # See the GpuTestExpectations class for documentation. class PixelExpectations(GpuTestExpectations): ...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from gpu_test_expectations import GpuTestExpectations # See the GpuTestExpectations class for documentation. class PixelExpectations(GpuTestExpectations): ...
Mark pixel tests as failing on all platform
Mark pixel tests as failing on all platform BUG=511580 R=kbr@chromium.org Review URL: https://codereview.chromium.org/1245243003 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#340191}
Python
bsd-3-clause
lihui7115/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,lihui7115/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBacke...
--- +++ @@ -11,10 +11,7 @@ # Sample Usage: # self.Fail('Pixel.Canvas2DRedBox', # ['mac', 'amd', ('nvidia', 0x1234)], bug=123) - self.Fail('Pixel.Canvas2DRedBox', - [ 'linux', ('nvidia', 0x104a)], bug=511580) - self.Fail('Pixel.CSS3DBlueBox', - [ 'linux', ('nvidia',...
b5006a2820051e00c9fe4f5efe43e90129c12b4d
troposphere/cloudtrail.py
troposphere/cloudtrail.py
from . import AWSObject, AWSProperty, Tags from .validators import boolean class DataResource(AWSProperty): props = { "Type": (str, True), "Values": ([str], False), } class EventSelector(AWSProperty): props = { "DataResources": ([DataResource], False), "IncludeManagementE...
from . import AWSObject, AWSProperty, Tags from .validators import boolean class DataResource(AWSProperty): props = { "Type": (str, True), "Values": ([str], False), } class EventSelector(AWSProperty): props = { "DataResources": ([DataResource], False), "ExcludeManagementE...
Update Cloudtrail per 2021-09-10 changes
Update Cloudtrail per 2021-09-10 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
--- +++ @@ -12,8 +12,15 @@ class EventSelector(AWSProperty): props = { "DataResources": ([DataResource], False), + "ExcludeManagementEventSources": ([str], False), "IncludeManagementEvents": (boolean, False), "ReadWriteType": (str, False), + } + + +class InsightSelector(AWSP...
fddd44624f1c8ff6f66a2f33cafe908a5853389d
glaciercmd/command_delete_archive_from_vault.py
glaciercmd/command_delete_archive_from_vault.py
import boto from boto.glacier.exceptions import UnexpectedHTTPResponseError class CommandDeleteArchiveFromVault(object): def execute(self, args, config): glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=config.get('configuration', 'aws_sec...
import boto from boto.glacier.exceptions import UnexpectedHTTPResponseError from boto.dynamodb2.table import Table from boto.dynamodb2.layer1 import DynamoDBConnection class CommandDeleteArchiveFromVault(object): def execute(self, args, config): glacier_connection = boto.connect_glacier(aws_access_key_id=confi...
Clean up dynamodb table when deleting an archive
Clean up dynamodb table when deleting an archive
Python
mit
carsonmcdonald/glacier-cmd
--- +++ @@ -1,5 +1,8 @@ import boto + from boto.glacier.exceptions import UnexpectedHTTPResponseError +from boto.dynamodb2.table import Table +from boto.dynamodb2.layer1 import DynamoDBConnection class CommandDeleteArchiveFromVault(object): @@ -16,6 +19,11 @@ else: try: vault.delete_archiv...
053d6a2ca13b1f36a02fa3223092a10af35f6579
erpnext/patches/v10_0/item_barcode_childtable_migrate.py
erpnext/patches/v10_0/item_barcode_childtable_migrate.py
# Copyright (c) 2017, Frappe and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe def execute(): items_barcode = frappe.get_all('Item', ['name', 'barcode'], { 'barcode': ('!=', '') }) frappe.reload_doc("stock", "doctype", "item") frappe...
# Copyright (c) 2017, Frappe and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe def execute(): frappe.reload_doc("stock", "doctype", "item_barcode") items_barcode = frappe.get_all('Item', ['name', 'barcode'], { 'barcode': ('!=', '') })...
Move reload doc before get query
Move reload doc before get query
Python
agpl-3.0
gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext
--- +++ @@ -7,10 +7,12 @@ def execute(): + frappe.reload_doc("stock", "doctype", "item_barcode") + items_barcode = frappe.get_all('Item', ['name', 'barcode'], { 'barcode': ('!=', '') }) + frappe.reload_doc("stock", "doctype", "item") - frappe.reload_doc("stock", "doctype", "item") - frappe.reload_doc("stock"...
16b9f48c2b6548a16e1c34a57c103b325fae381d
farmers_api/farmers/models.py
farmers_api/farmers/models.py
from django.db import models from django.utils.translation import ugettext_lazy as _ class Farmer(models.Model): first_name = models.CharField(_('first name'), max_length=50) surname = models.CharField(_('surname'), max_length=50) town = models.CharField(_('town'), max_length=50, db_index=True) class...
from django.db import models from django.utils.translation import ugettext_lazy as _ class Farmer(models.Model): first_name = models.CharField(_('first name'), max_length=50) surname = models.CharField(_('surname'), max_length=50) town = models.CharField(_('town'), max_length=50, db_index=True) class...
Repair bug in the Farmer model
Repair bug in the Farmer model
Python
bsd-2-clause
tm-kn/farmers-api
--- +++ @@ -18,4 +18,4 @@ return '%s %s' % (self.first_name, self.surname) def get_short_name(self): - return '%s. %s' % (self.first_name[:1], self_surname) + return '%s. %s' % (self.first_name[:1], self.surname)
70f9275d7b87d56ae560a2ff60c3eed3469739af
edx_rest_api_client/tests/mixins.py
edx_rest_api_client/tests/mixins.py
import responses class AuthenticationTestMixin(object): """ Mixin for testing authentication. """ def setUp(self): super(AuthenticationTestMixin, self).setUp() responses.reset() def _mock_auth_api(self, url, status, body=None): body = body or {} responses.add( ...
import responses class AuthenticationTestMixin: """ Mixin for testing authentication. """ def setUp(self): super(AuthenticationTestMixin, self).setUp() responses.reset() def _mock_auth_api(self, url, status, body=None): body = body or {} responses.add( response...
Fix new lint errors now that we've dropped python 2 support.
Fix new lint errors now that we've dropped python 2 support.
Python
apache-2.0
edx/ecommerce-api-client,edx/edx-rest-api-client
--- +++ @@ -1,7 +1,7 @@ import responses -class AuthenticationTestMixin(object): +class AuthenticationTestMixin: """ Mixin for testing authentication. """ def setUp(self): super(AuthenticationTestMixin, self).setUp()
a2efdbc7c790df31f511d9a347774a961132d565
txircd/modules/cmode_l.py
txircd/modules/cmode_l.py
from twisted.words.protocols import irc from txircd.modbase import Mode class LimitMode(Mode): def checkSet(self, user, target, param): intParam = int(param) if str(intParam) != param: return [False, param] return [(intParam >= 0), param] def checkPermission(self, user,...
from twisted.words.protocols import irc from txircd.modbase import Mode class LimitMode(Mode): def checkSet(self, user, target, param): try: intParam = int(param) except ValueError: return [False, param] if str(intParam) != param: return [False, param] ...
Fix checking of limit parameter
Fix checking of limit parameter
Python
bsd-3-clause
DesertBus/txircd,Heufneutje/txircd,ElementalAlchemist/txircd
--- +++ @@ -3,10 +3,13 @@ class LimitMode(Mode): def checkSet(self, user, target, param): - intParam = int(param) + try: + intParam = int(param) + except ValueError: + return [False, param] if str(intParam) != param: return [False, param] - ...
380331a54ae09a54e458b30a0fb6a459faa76f37
emission/analysis/point_features.py
emission/analysis/point_features.py
# Standard imports import math import logging import numpy as np import emission.core.common as ec import emission.analysis.section_features as sf def calDistance(point1, point2): return ec.calDistance([point1.longitude, point1.latitude], [point2.longitude, point2.latitude]) def calHeading(point1, point2): re...
# Standard imports import math import logging import numpy as np import emission.core.common as ec import emission.analysis.section_features as sf def calDistance(point1, point2): return ec.calDistance([point1.longitude, point1.latitude], [point2.longitude, point2.latitude]) def calHeading(point1, point2): re...
Change the feature calculation to match the new unified format
Change the feature calculation to match the new unified format - the timestamps are now in seconds, so no need to divide them - the field is called ts, not mTime
Python
bsd-3-clause
e-mission/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,joshzarrabi/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,joshzarrabi/e-mission-server,joshzarrabi/e-mission-server,yw374cornell/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission...
--- +++ @@ -19,7 +19,7 @@ def calSpeed(point1, point2): distanceDelta = calDistance(point1, point2) - timeDelta = point2.mTime - point1.mTime + timeDelta = point2.ts - point1.ts # print "Distance delta = %s and time delta = %s" % (distanceDelta, timeDelta) # assert(timeDelta != 0) if (tim...
4de5050deda6c73fd9812a5e53938fea11e0b2cc
tests/unit/minion_test.py
tests/unit/minion_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Mike Place <mp@saltstack.com>` ''' # Import Salt Testing libs from salttesting import TestCase, skipIf from salttesting.helpers import ensure_in_syspath from salttesting.mock import NO_MOCK, NO_MOCK_REASON, patch from salt import minion from salt.exceptions import ...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Mike Place <mp@saltstack.com>` ''' # Import python libs import os # Import Salt Testing libs from salttesting import TestCase, skipIf from salttesting.helpers import ensure_in_syspath from salttesting.mock import NO_MOCK, NO_MOCK_REASON, patch # Import salt libs f...
Add test for sock path length
Add test for sock path length
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -2,15 +2,19 @@ ''' :codeauthor: :email:`Mike Place <mp@saltstack.com>` ''' + +# Import python libs +import os # Import Salt Testing libs from salttesting import TestCase, skipIf from salttesting.helpers import ensure_in_syspath from salttesting.mock import NO_MOCK, NO_MOCK_REASON, patch +# I...
1fc6eb9ccc9789e2717898108f286adf5b351031
payments/management/commands/init_plans.py
payments/management/commands/init_plans.py
from django.conf import settings from django.core.management.base import BaseCommand import stripe class Command(BaseCommand): help = "Make sure your Stripe account has the plans" def handle(self, *args, **options): stripe.api_key = settings.STRIPE_SECRET_KEY for plan in settings.PAYMENTS_P...
from django.conf import settings from django.core.management.base import BaseCommand import stripe class Command(BaseCommand): help = "Make sure your Stripe account has the plans" def handle(self, *args, **options): stripe.api_key = settings.STRIPE_SECRET_KEY for plan in settings.PAYMENTS_P...
Make sure this value is always an integer
Make sure this value is always an integer
Python
bsd-3-clause
wahuneke/django-stripe-payments,aibon/django-stripe-payments,boxysean/django-stripe-payments,crehana/django-stripe-payments,adi-li/django-stripe-payments,wahuneke/django-stripe-payments,jawed123/django-stripe-payments,jamespacileo/django-stripe-payments,ZeevG/django-stripe-payments,ZeevG/django-stripe-payments,crehana/...
--- +++ @@ -13,7 +13,7 @@ for plan in settings.PAYMENTS_PLANS: if settings.PAYMENTS_PLANS[plan].get("stripe_plan_id"): stripe.Plan.create( - amount=100 * settings.PAYMENTS_PLANS[plan]["price"], + amount=int(100 * settings.PAYMENTS_PLANS[plan...
27ab83010f7cc8308debfec16fab38544a9c7ce7
running.py
running.py
import tcxparser from configparser import ConfigParser from datetime import datetime import urllib.request import dateutil.parser t = '1984-06-02T19:05:00.000Z' # Darksky weather API # Create config file manually parser = ConfigParser() parser.read('slowburn.config', encoding='utf-8') darksky_key = parser.get('darksky...
import tcxparser from configparser import ConfigParser from datetime import datetime import urllib.request import dateutil.parser import json # Darksky weather API # Create config file manually parser = ConfigParser() parser.read('slowburn.config', encoding='utf-8') darksky_key = parser.get('darksky', 'key') tcx = tc...
Print all hourly temperatures from run date
Print all hourly temperatures from run date
Python
mit
briansuhr/slowburn
--- +++ @@ -3,8 +3,8 @@ from datetime import datetime import urllib.request import dateutil.parser +import json -t = '1984-06-02T19:05:00.000Z' # Darksky weather API # Create config file manually parser = ConfigParser() @@ -21,7 +21,13 @@ unix_run_time = convert_time_to_unix(run_time) darksky_request = ur...
e379aa75690d5bacc1d0bdec325ed4c16cf1a183
lims/permissions/views.py
lims/permissions/views.py
from django.contrib.auth.models import Permission from rest_framework import viewsets from .serializers import PermissionSerializer class PermissionViewSet(viewsets.ReadOnlyModelViewSet): queryset = Permission.objects.all() serializer_class = PermissionSerializer
from django.contrib.auth.models import Permission from rest_framework import viewsets from .serializers import PermissionSerializer class PermissionViewSet(viewsets.ReadOnlyModelViewSet): queryset = Permission.objects.all() serializer_class = PermissionSerializer search_fields = ('name',)
Add search functionality to permissions endpoint
Add search functionality to permissions endpoint
Python
mit
GETLIMS/LIMS-Backend,GETLIMS/LIMS-Backend
--- +++ @@ -8,3 +8,4 @@ class PermissionViewSet(viewsets.ReadOnlyModelViewSet): queryset = Permission.objects.all() serializer_class = PermissionSerializer + search_fields = ('name',)
00922099d6abb03a0dbcca19781eb586d367eab0
skimage/measure/__init__.py
skimage/measure/__init__.py
from .find_contours import find_contours from ._regionprops import regionprops from .find_contours import find_contours from ._structural_similarity import ssim
from .find_contours import find_contours from ._regionprops import regionprops from ._structural_similarity import ssim
Remove double import of find contours.
BUG: Remove double import of find contours.
Python
bsd-3-clause
robintw/scikit-image,WarrenWeckesser/scikits-image,ofgulban/scikit-image,ajaybhat/scikit-image,rjeli/scikit-image,SamHames/scikit-image,chintak/scikit-image,ofgulban/scikit-image,SamHames/scikit-image,dpshelio/scikit-image,chintak/scikit-image,rjeli/scikit-image,oew1v07/scikit-image,almarklein/scikit-image,pratapvardha...
--- +++ @@ -1,4 +1,3 @@ from .find_contours import find_contours from ._regionprops import regionprops -from .find_contours import find_contours from ._structural_similarity import ssim
985cefd81472069240b074423a831fe6031d6887
website_sale_available/controllers/website_sale_available.py
website_sale_available/controllers/website_sale_available.py
# -*- coding: utf-8 -*- from openerp import http from openerp.http import request from openerp.addons.website_sale.controllers.main import website_sale class controller(website_sale): @http.route(['/shop/confirm_order'], type='http', auth="public", website=True) def confirm_order(self, **post): res ...
# -*- coding: utf-8 -*- from openerp import http from openerp.http import request from openerp.addons.website_sale.controllers.main import website_sale class controller(website_sale): @http.route(['/shop/confirm_order'], type='http', auth="public", website=True) def confirm_order(self, **post): res ...
FIX sale_available integration with delivery
FIX sale_available integration with delivery
Python
mit
it-projects-llc/website-addons,it-projects-llc/website-addons,it-projects-llc/website-addons
--- +++ @@ -14,7 +14,7 @@ order = request.website.sale_get_order(context=request.context) if not all([ line.product_uom_qty <= line.product_id.virtual_available - for line in order.order_line + for line in order.order_line if not line.is_delivery ...
1f409a2732886b6a77d348529e07e9f90fbfd8ba
conanfile.py
conanfile.py
from conans import ConanFile, CMake class CausalSetsExplorer(ConanFile): settings = "os", "compiler", "build_type", "arch" requires = "boost/1.67.0@conan/stable", "catch2/2.3.0@bincrafters/stable" generators = "cmake" default_options = "Boost:header_only=True" def build(self): cmake = CMak...
from conans import ConanFile, CMake class CausalSetsExplorer(ConanFile): settings = "os", "compiler", "build_type", "arch" requires = "boost/1.67.0@conan/stable", "catch2/2.2.2@bincrafters/stable" generators = "cmake" default_options = "Boost:header_only=True" def build(self): cmake = CMak...
Revert back to older Catch2, part 2
Revert back to older Catch2, part 2 Too quick on the commit button
Python
bsd-3-clause
acgetchell/causal-sets-explorer,acgetchell/causal-sets-explorer
--- +++ @@ -2,7 +2,7 @@ class CausalSetsExplorer(ConanFile): settings = "os", "compiler", "build_type", "arch" - requires = "boost/1.67.0@conan/stable", "catch2/2.3.0@bincrafters/stable" + requires = "boost/1.67.0@conan/stable", "catch2/2.2.2@bincrafters/stable" generators = "cmake" default_op...
31ee04b2eed6881a4f6642495545868f7c167a20
sipa/blueprints/hooks.py
sipa/blueprints/hooks.py
import logging from flask import current_app, request, abort from flask.blueprints import Blueprint from sipa.utils.git_utils import update_repo logger = logging.getLogger(__name__) bp_hooks = Blueprint('hooks', __name__, url_prefix='/hooks') @bp_hooks.route('/update-content', methods=['POST']) def content_hook(...
import logging from flask import current_app, request, abort from flask.blueprints import Blueprint from sipa.utils.git_utils import update_repo logger = logging.getLogger(__name__) bp_hooks = Blueprint('hooks', __name__, url_prefix='/hooks') @bp_hooks.route('/update-content', methods=['POST']) def content_hook(...
Use ascii in logging message
Use ascii in logging message
Python
mit
MarauderXtreme/sipa,agdsn/sipa,agdsn/sipa,agdsn/sipa,MarauderXtreme/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,lukasjuhrich/sipa,agdsn/sipa,MarauderXtreme/sipa
--- +++ @@ -40,7 +40,7 @@ logger.debug("UWSGI not present, skipping reload") pass else: - logger.debug("Reloading UWSGI…") + logger.debug("Reloading UWSGI...") uwsgi.reload() # 204: No content
3f26d3c53f4bff36ec05da7a51a026b7d3ba5517
tests/modules/test_atbash.py
tests/modules/test_atbash.py
"""Tests for the Caeser module""" import pycipher from lantern.modules import atbash def _test_atbash(plaintext, *fitness_functions, top_n=1): ciphertext = pycipher.Atbash().encipher(plaintext, keep_punct=True) decryption = atbash.decrypt(ciphertext) assert decryption == plaintext.upper() def test_de...
"""Tests for the Caeser module""" from lantern.modules import atbash def test_decrypt(): """Test decryption""" assert atbash.decrypt("uozt{Yzybolm}") == "flag{Babylon}" def test_encrypt(): """Test encryption""" assert ''.join(atbash.encrypt("flag{Babylon}")) == "uozt{Yzybolm}"
Remove unnecessary testing code from atbash
Remove unnecessary testing code from atbash
Python
mit
CameronLonsdale/lantern
--- +++ @@ -1,15 +1,6 @@ """Tests for the Caeser module""" -import pycipher - from lantern.modules import atbash - - -def _test_atbash(plaintext, *fitness_functions, top_n=1): - ciphertext = pycipher.Atbash().encipher(plaintext, keep_punct=True) - decryption = atbash.decrypt(ciphertext) - - assert decryp...
2c7065f82a242e6f05eaefda4ec902ddf9d90037
tests/test_stanc_warnings.py
tests/test_stanc_warnings.py
"""Test that stanc warnings are visible.""" import contextlib import io import stan def test_stanc_no_warning() -> None: """No warnings.""" program_code = "parameters {real y;} model {y ~ normal(0,1);}" buffer = io.StringIO() with contextlib.redirect_stderr(buffer): stan.build(program_code=pr...
"""Test that stanc warnings are visible.""" import contextlib import io import stan def test_stanc_no_warning() -> None: """No warnings.""" program_code = "parameters {real y;} model {y ~ normal(0,1);}" buffer = io.StringIO() with contextlib.redirect_stderr(buffer): stan.build(program_code=pr...
Update test for Stan 2.29
test: Update test for Stan 2.29
Python
isc
stan-dev/pystan,stan-dev/pystan
--- +++ @@ -14,7 +14,24 @@ assert "warning" not in buffer.getvalue().lower() -def test_stanc_warning() -> None: +def test_stanc_unused_warning() -> None: + """Test that stanc warning is shown to user.""" + program_code = """ + parameters { + real y; + } + model { + real x; + x = 5; + ...
f668956fd37fa2fa0a0c82a8241671bf3cc306cb
tests/unit/moto_test_data.py
tests/unit/moto_test_data.py
""" These functions are written assuming the under a moto call stack. TODO add check is a fake bucket? """ import boto3 def pre_load_s3_data(bucket_name, prefix, region='us-east-1'): s3 = boto3.client('s3', region_name=region) res = s3.create_bucket(Bucket=bucket_name) default_kwargs = {"Body": b"Fake da...
""" These functions are written assuming the under a moto call stack. TODO add check is a fake bucket? """ import boto3 def pre_load_s3_data(bucket_name, prefix, region='us-east-1'): s3 = boto3.client('s3', region_name=region) res = s3.create_bucket(Bucket=bucket_name) default_kwargs = {"Body": b"Fake da...
Fix string using py3 only feature.
Fix string using py3 only feature.
Python
mit
DigitalGlobe/gbdxtools,DigitalGlobe/gbdxtools
--- +++ @@ -10,22 +10,19 @@ res = s3.create_bucket(Bucket=bucket_name) default_kwargs = {"Body": b"Fake data for testing.", "Bucket": bucket_name} - s3.put_object(Key=f"{prefix}/readme.txt", **default_kwargs) - s3.put_object(Key=f"{prefix}/notes.md", **default_kwargs) + s3.put_object(Key="{}/read...
03b685055037283279394d940602520c5ff7a817
email_log/models.py
email_log/models.py
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ @python_2_unicode_compatible class Email(models.Model): """Model to store outgoing email information""" from_email = mod...
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ @python_2_unicode_compatible class Email(models.Model): """Model to store outgoing email information""" from_email = mod...
Fix indentation problem and line length (PEP8)
Fix indentation problem and line length (PEP8)
Python
mit
treyhunner/django-email-log,treyhunner/django-email-log
--- +++ @@ -15,13 +15,13 @@ subject = models.TextField(_("subject")) body = models.TextField(_("body")) ok = models.BooleanField(_("ok"), default=False, db_index=True) - date_sent = models.DateTimeField(_("date sent"), auto_now_add=True, db_index=True) + date_sent = models.DateTimeField(_("date s...
9cbb73371db450599b7a3a964ab43f2f717b8bb7
connector/__manifest__.py
connector/__manifest__.py
# -*- coding: utf-8 -*- # Copyright 2013-2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) {'name': 'Connector', 'version': '10.0.1.0.0', 'author': 'Camptocamp,Openerp Connector Core Editors,' 'Odoo Community Association (OCA)', 'website': 'http://odoo-connector.com',...
# -*- coding: utf-8 -*- # Copyright 2013-2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) {'name': 'Connector', 'version': '10.0.1.0.0', 'author': 'Camptocamp,Openerp Connector Core Editors,' 'Odoo Community Association (OCA)', 'website': 'http://odoo-connector.com',...
Remove application flag, not an application
Remove application flag, not an application
Python
agpl-3.0
OCA/connector,OCA/connector
--- +++ @@ -20,5 +20,4 @@ 'res_partner_view.xml', ], 'installable': True, - 'application': True, }
ad6bb5b787b4b959ff24c71122fc6f4d1a7e7ff9
cooltools/cli/__init__.py
cooltools/cli/__init__.py
# -*- coding: utf-8 -*- from __future__ import division, print_function import click from .. import __version__ # Monkey patch click.core._verify_python3_env = lambda: None CONTEXT_SETTINGS = { 'help_option_names': ['-h', '--help'], } @click.version_option(version=__version__) @click.group(context_settings=CO...
# -*- coding: utf-8 -*- from __future__ import division, print_function import click import sys from .. import __version__ # Monkey patch click.core._verify_python3_env = lambda: None CONTEXT_SETTINGS = { 'help_option_names': ['-h', '--help'], } @click.version_option(version=__version__) @click.group(context_...
Add top-level cli debugging and verbosity options
Add top-level cli debugging and verbosity options
Python
mit
open2c/cooltools
--- +++ @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import division, print_function import click +import sys from .. import __version__ @@ -15,8 +16,35 @@ @click.version_option(version=__version__) @click.group(context_settings=CONTEXT_SETTINGS) -def cli(): - pass +@click.option( + '--de...
efab6ea568c11411d901249d7660765cd987b532
examples/completion.py
examples/completion.py
import gtk from kiwi.ui.widgets.entry import Entry entry = Entry() entry.set_completion_strings(['apa', 'apapa', 'apbla', 'apppa', 'aaspa']) win = gtk.Window() win.connect('delete-event', gtk.main_quit) win.add(entry) win.show_all() gtk.main()
# encoding: iso-8859-1 import gtk from kiwi.ui.widgets.entry import Entry def on_entry_activate(entry): print 'You selected:', entry.get_text().encode('latin1') gtk.main_quit() entry = Entry() entry.connect('activate', on_entry_activate) entry.set_completion_strings(['Belo Horizonte', ...
Extend example to include non-ASCII characters
Extend example to include non-ASCII characters
Python
lgpl-2.1
Schevo/kiwi,Schevo/kiwi,Schevo/kiwi
--- +++ @@ -1,10 +1,21 @@ +# encoding: iso-8859-1 import gtk from kiwi.ui.widgets.entry import Entry +def on_entry_activate(entry): + print 'You selected:', entry.get_text().encode('latin1') + gtk.main_quit() + entry = Entry() -entry.set_completion_strings(['apa', 'apapa', 'apbla', - ...
b25164e69d255beae1a76a9e1f7168a436a81f38
tests/test_utils.py
tests/test_utils.py
import helper from rock import utils class UtilsTestCase(helper.unittest.TestCase): def test_shell(self): utils.Shell.run = lambda self: self s = utils.Shell() self.assertTrue(isinstance(s.__enter__(), utils.Shell)) s.write('ok') s.__exit__(None, None, None) self.a...
import helper from rock import utils from rock.exceptions import ConfigError class UtilsTestCase(helper.unittest.TestCase): def test_shell(self): utils.Shell.run = lambda self: self s = utils.Shell() self.assertTrue(isinstance(s.__enter__(), utils.Shell)) s.write('ok') s._...
Test isexecutable check in utils.Shell
Test isexecutable check in utils.Shell
Python
mit
silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock,silas/rock
--- +++ @@ -1,5 +1,6 @@ import helper from rock import utils +from rock.exceptions import ConfigError class UtilsTestCase(helper.unittest.TestCase): @@ -19,3 +20,9 @@ self.assertEqual(args[3], 'ok\n') utils.os.execl = execl s.__exit__('type', 'value', 'tracebook') + + def test...
fc14e41432fece7d724aef73dd8ad7fef5e85c9a
flow/__init__.py
flow/__init__.py
from model import BaseModel from feature import Feature,JSONFeature,TextFeature,CompressedFeature,PickleFeature from extractor import Node,Graph,Aggregator,NotEnoughData from bytestream import ByteStream,ByteStreamFeature from data import \ IdProvider,UuidProvider,UserSpecifiedIdProvider,KeyBuilder\ ,StringDelimite...
from model import BaseModel from feature import Feature,JSONFeature,TextFeature,CompressedFeature,PickleFeature from extractor import Node,Graph,Aggregator,NotEnoughData from bytestream import ByteStream,ByteStreamFeature from data import \ IdProvider,UuidProvider,UserSpecifiedIdProvider,KeyBuilder\ ,StringDelimite...
Add IdentityEncoder to top-level exports
Add IdentityEncoder to top-level exports
Python
mit
JohnVinyard/featureflow,JohnVinyard/featureflow
--- +++ @@ -17,6 +17,8 @@ from database_iterator import DatabaseIterator +from encoder import IdentityEncoder + from decoder import Decoder from lmdbstore import LmdbDatabase
ff4477c870b9c618b7432047071792c3a8055eb7
coffeeraspi/messages.py
coffeeraspi/messages.py
class DrinkOrder(): def __init__(self, mug_size, add_ins, name=None): self.mug_size = mug_size self.add_ins = add_ins self.name = name @classmethod def deserialize(cls, data): return DrinkOrder(data['mug_size'], data['add_ins'], data.get('name...
class DrinkOrder(): def __init__(self, mug_size, add_ins, name=None): self.mug_size = mug_size self.add_ins = add_ins self.name = name @classmethod def deserialize(cls, data): return DrinkOrder(data['mug_size'], data['add_ins'], data.get('name...
Add nicer drink order logging
Add nicer drink order logging
Python
apache-2.0
umbc-hackafe/htcpcp,umbc-hackafe/htcpcp,umbc-hackafe/htcpcp,umbc-hackafe/htcpcp
--- +++ @@ -9,3 +9,6 @@ return DrinkOrder(data['mug_size'], data['add_ins'], data.get('name', None)) + + def __str__(self): + return 'DrinkOrder("{}")'.format(self.name if self.name else '')
056bb4adada68d96f127a7610289d874ebe0cf1b
cray_test.py
cray_test.py
# -*- coding: utf-8 -*- '''module for unit test and task for CI''' import sys import unittest from yatest import testpost, testpage, testutility, testconfig if __name__ == '__main__': all_test_suites = [] all_test_suites.append(testpost.get_test_suites()) all_test_suites.append(testpage.get_test_suites())...
# -*- coding: utf-8 -*- '''module for unit test and task for CI''' import sys import unittest from yatest import testpost, testpage, testutility, testconfig, testgenerator, testpostmanager if __name__ == '__main__': all_test_suites = [] all_test_suites.append(testpost.get_test_suites()) all_test_suites.ap...
Add test cases for module post_manager, refactor part of class PostManager and update TODO list.
Add test cases for module post_manager, refactor part of class PostManager and update TODO list.
Python
mit
boluny/cray,boluny/cray
--- +++ @@ -3,7 +3,7 @@ import sys import unittest -from yatest import testpost, testpage, testutility, testconfig +from yatest import testpost, testpage, testutility, testconfig, testgenerator, testpostmanager if __name__ == '__main__': all_test_suites = [] @@ -11,6 +11,8 @@ all_test_suites.append(t...
ea96ed757e3709fbf8a7c12640e40ed3392d90fb
tensorflow/python/keras/preprocessing/__init__.py
tensorflow/python/keras/preprocessing/__init__.py
# Copyright 2016 The TensorFlow Authors. 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 applica...
# Copyright 2016 The TensorFlow Authors. 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 applica...
Fix build failure for mac/ubuntu, which relies on an old version for keras-preprocessing.
Fix build failure for mac/ubuntu, which relies on an old version for keras-preprocessing. PiperOrigin-RevId: 273405152
Python
apache-2.0
DavidNorman/tensorflow,gautam1858/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,freedomtan/tensorflow,davidzchen/tensorflow,aldian/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_saved_model,annarev/tensorflow,tensorflow/tensorflow,davidzchen/tensorflow,ten...
--- +++ @@ -18,6 +18,17 @@ from __future__ import division from __future__ import print_function +# TODO(mihaimaruseac): remove the import of keras_preprocessing and injecting +# once we update to latest version of keras_preprocessing +import keras_preprocessing + +from tensorflow.python.keras import backend +fro...
58be36ca646c4bb7fd4263a592cf3a240fbca64f
post_tag.py
post_tag.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from common import init, globaldata, tag_clean, tag_prefix, tag_post, tagtypes from bottle import post, request, redirect, mako_view as view @post("/post-tag") @view("post-tag") def r_post_tag(): client = init() m = request.forms.post post = client.get_post(m) tags = ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from common import init, globaldata, tag_clean, tag_prefix, tag_post, tagtypes from bottle import post, request, redirect, mako_view as view @post("/post-tag") @view("post-tag") def r_post_tag(): client = init() m = request.forms.post post = client.get_post(m) tags = ...
Fix tag creation with non-ascii chars. (Dammit bottle!)
Fix tag creation with non-ascii chars. (Dammit bottle!)
Python
mit
drougge/wwwwellpapp,drougge/wwwwellpapp,drougge/wwwwellpapp
--- +++ @@ -11,8 +11,8 @@ m = request.forms.post post = client.get_post(m) tags = request.forms.tags - create = request.forms.getall("create") - ctype = request.forms.getall("ctype") + create = [a.decode("utf-8") for a in request.forms.getall("create")] + ctype = [a.decode("utf-8") for a in request.forms.geta...
bb32f2327d2e3aa386fffd2fd320a7af7b03ce95
corehq/apps/domain/project_access/middleware.py
corehq/apps/domain/project_access/middleware.py
from __future__ import absolute_import from __future__ import unicode_literals from datetime import datetime, timedelta from django.utils.deprecation import MiddlewareMixin from corehq.apps.domain.project_access.models import SuperuserProjectEntryRecord, ENTRY_RECORD_FREQUENCY from corehq.util.quickcache import quickc...
from __future__ import absolute_import from __future__ import unicode_literals from datetime import datetime, timedelta from django.utils.deprecation import MiddlewareMixin from corehq.apps.domain.project_access.models import SuperuserProjectEntryRecord, ENTRY_RECORD_FREQUENCY from corehq.util.quickcache import quickc...
Include superusers in web user domaing access record
Include superusers in web user domaing access record
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -12,13 +12,13 @@ def process_view(self, request, view_func, view_args, view_kwargs): if getattr(request, 'couch_user', None) and request.couch_user.is_superuser \ and hasattr(request, 'domain'): - return self.record_entry(request.domain, request.couch_user.username...
dd336c7555390d2713ef896f49ba27dbadc80a14
tests/server/extensions/test_execute_command.py
tests/server/extensions/test_execute_command.py
"""Tests for execute commands function""" import os import subprocess import pytest from scout.server.extensions.loqus_extension import execute_command TRAVIS = os.getenv("TRAVIS") GITHUB = os.getenv("GITHUB") def test_run_execute_command(): """Test run echo with execute command""" # GIVEN a command to run...
"""Tests for execute commands function""" import os import subprocess import pytest from scout.server.extensions.loqus_extension import execute_command TRAVIS = os.getenv("TRAVIS") GITHUB = os.getenv("CI") def test_run_execute_command(): """Test run echo with execute command""" # GIVEN a command to run in ...
Use correct env to check if on github
Use correct env to check if on github
Python
bsd-3-clause
Clinical-Genomics/scout,Clinical-Genomics/scout,Clinical-Genomics/scout
--- +++ @@ -7,7 +7,7 @@ from scout.server.extensions.loqus_extension import execute_command TRAVIS = os.getenv("TRAVIS") -GITHUB = os.getenv("GITHUB") +GITHUB = os.getenv("CI") def test_run_execute_command():
6d8e535a56ee2f05f051d101ee5f3903176f19fe
rnacentral/rnacentral/local_settings_default.py
rnacentral/rnacentral/local_settings_default.py
""" Copyright [2009-2014] EMBL-European Bioinformatics Institute 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 a...
""" Copyright [2009-2014] EMBL-European Bioinformatics Institute 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 a...
Update the default settings file to include the database threaded option
Update the default settings file to include the database threaded option
Python
apache-2.0
RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode
--- +++ @@ -13,11 +13,13 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.', - 'NAME': '', + 'ENGINE': 'django.db.backends.oracle', + 'NAME': '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=)))', 'USER': '', ...
3d3809931b5683b69e57507320b6d78df102f8d1
warehouse/database/mixins.py
warehouse/database/mixins.py
from sqlalchemy.dialects import postgresql as pg from sqlalchemy.sql import func from sqlalchemy.sql.expression import text from warehouse import db from warehouse.database.schema import TableDDL class UUIDPrimaryKeyMixin(object): id = db.Column(pg.UUID(as_uuid=True), primary_key=True, server_defaul...
from sqlalchemy.dialects import postgresql as pg from sqlalchemy.schema import FetchedValue from sqlalchemy.sql import func from sqlalchemy.sql.expression import text from warehouse import db from warehouse.database.schema import TableDDL class UUIDPrimaryKeyMixin(object): id = db.Column(pg.UUID(as_uuid=True), ...
Mark TimeStampedMixin.modified as an onupdate FetchedValue
Mark TimeStampedMixin.modified as an onupdate FetchedValue
Python
bsd-2-clause
davidfischer/warehouse
--- +++ @@ -1,4 +1,5 @@ from sqlalchemy.dialects import postgresql as pg +from sqlalchemy.schema import FetchedValue from sqlalchemy.sql import func from sqlalchemy.sql.expression import text @@ -32,5 +33,7 @@ """), ) - created = db.Column(db.DateTime, server_default=func.now(), nullable=F...
d9f20935f6a0d5bf4e2c1dd1a3c5b41167f8518b
email_log/migrations/0001_initial.py
email_log/migrations/0001_initial.py
# encoding: utf8 from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Email', fields=[ (u'id', models.AutoField(verbose_name=u'ID', serialize=False, auto_created=Tru...
# encoding: utf8 from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Email', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, ...
Fix migration file for Python 3.2 (and PEP8)
Fix migration file for Python 3.2 (and PEP8)
Python
mit
treyhunner/django-email-log,treyhunner/django-email-log
--- +++ @@ -11,18 +11,22 @@ migrations.CreateModel( name='Email', fields=[ - (u'id', models.AutoField(verbose_name=u'ID', serialize=False, auto_created=True, primary_key=True)), - ('from_email', models.TextField(verbose_name=u'from e-mail')), - ...
733404ba2eb7218bb4d253cd74fe88107ff75afc
test/test_live_openid_login.py
test/test_live_openid_login.py
import time import pytest from chatexchange.browser import SEChatBrowser, LoginError import live_testing if live_testing.enabled: def test_openid_login(): """ Tests login to the Stack Exchange OpenID provider. """ browser = SEChatBrowser() # avoid hitting the SE servers...
import time import pytest from chatexchange.browser import SEChatBrowser, LoginError import live_testing if live_testing.enabled: def test_openid_login_recognizes_failure(): """ Tests that failed SE OpenID logins raise errors. """ browser = SEChatBrowser() # avoid hitti...
Remove successful OpenID login live test. It's redundant with our message-related live tests.
Remove successful OpenID login live test. It's redundant with our message-related live tests.
Python
apache-2.0
ByteCommander/ChatExchange6,hichris1234/ChatExchange,Charcoal-SE/ChatExchange,hichris1234/ChatExchange,ByteCommander/ChatExchange6,Charcoal-SE/ChatExchange
--- +++ @@ -8,20 +8,6 @@ if live_testing.enabled: - def test_openid_login(): - """ - Tests login to the Stack Exchange OpenID provider. - """ - browser = SEChatBrowser() - - # avoid hitting the SE servers too frequently - time.sleep(2) - - # This will raise an ...
210e99b9b19484991f4d7d4106ed9c0ae802b2f7
windmill/server/__init__.py
windmill/server/__init__.py
# Copyright (c) 2006-2007 Open Source Applications Foundation # Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@gmail.com> # # 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 # # ...
# Copyright (c) 2006-2007 Open Source Applications Foundation # Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@gmail.com> # # 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 # # ...
Stop forwarding flash by default, it breaks more than it doesn't.
Stop forwarding flash by default, it breaks more than it doesn't. git-svn-id: 87d19257dd11500985d055ec4730e446075a5f07@1279 78c7df6f-8922-0410-bcd3-9426b1ad491b
Python
apache-2.0
windmill/windmill,windmill/windmill,windmill/windmill,windmill/windmill,windmill/windmill,windmill/windmill
--- +++ @@ -18,6 +18,7 @@ forwarding_conditions = [ lambda e : 'google.com/safebrowsing/downloads' not in e['reconstructed_url'], lambda e : 'mozilla.org/en-US/firefox/livebookmarks.html' not in e['reconstructed_url'], + lambda e : e.get('CONTENT_TYPE') != 'application/x-shockwave-flash', ] def ...
9c428fbfb69c93ef3da935d0d2ab098fbeb1c317
dsh.py
dsh.py
# ----- Info ------------------------------------------------------------------ __author__ = 'Michael Montero <mcmontero@gmail.com>' # ----- Imports --------------------------------------------------------------- from tinyAPI.base.data_store.provider import DataStoreProvider import tinyAPI __all__ = [ 'dsh' ] ...
# ----- Info ------------------------------------------------------------------ __author__ = 'Michael Montero <mcmontero@gmail.com>' # ----- Imports --------------------------------------------------------------- from tinyAPI.base.data_store.provider import DataStoreProvider import tinyAPI __all__ = [ 'dsh' ] ...
Revert "Testing NoOpDSH() when database commands are executed without a connection being opened."
Revert "Testing NoOpDSH() when database commands are executed without a connection being opened." This reverts commit 57dd36da6f558e9bd5c9b7c97e955600c2fa0b8e.
Python
mit
mcmontero/tinyAPI,mcmontero/tinyAPI
--- +++ @@ -14,17 +14,13 @@ # ----- Private Classes ------------------------------------------------------- -class NoOpDSH(object): +class UnitTestNullDSH(object): ''' - The use of this object in __DSH is ambiguous. It's unclear why a call - to a commit or rollback command would be executed without a...
eced06f6f523fa6fd475987ae688b7ca2b6c3415
checks/system/__init__.py
checks/system/__init__.py
""" Return information about the given platform. """ import sys class Platform(object): @staticmethod def is_darwin(name=None): name = name or sys.platform return 'darwin' in name @staticmethod def is_freebsd(name=None): name = name or sys.platform return name.start...
""" Return information about the given platform. """ import sys class Platform(object): @staticmethod def is_darwin(name=None): name = name or sys.platform return 'darwin' in name @staticmethod def is_freebsd(name=None): name = name or sys.platform return name.start...
Add win32 to platform information
Add win32 to platform information
Python
bsd-3-clause
jraede/dd-agent,tebriel/dd-agent,JohnLZeller/dd-agent,a20012251/dd-agent,remh/dd-agent,tebriel/dd-agent,AntoCard/powerdns-recursor_check,tebriel/dd-agent,AniruddhaSAtre/dd-agent,urosgruber/dd-agent,polynomial/dd-agent,JohnLZeller/dd-agent,Mashape/dd-agent,JohnLZeller/dd-agent,eeroniemi/dd-agent,c960657/dd-agent,mderomp...
--- +++ @@ -43,3 +43,7 @@ or Platform.is_freebsd() ) + @staticmethod + def is_win32(name=None): + name = name or sys.platform + return name == "win32"
1c5f36b0f133ff668f17a1f023c2d52dc2bfbf49
generate_files_json.py
generate_files_json.py
#!/usr/bin/python3 import os import json import glob data = {} data['comparisonfiles'] = {} for subset in next(os.walk("comparisonfiles/"))[1]: data['comparisonfiles'][subset] = {} data['comparisonfiles'][subset]["format"] = [] format_list = [ format for format in next(os.walk("comparison...
#!/usr/bin/python3 import os import json import glob data = {} data['comparisonfiles'] = {} for subset in next(os.walk("comparisonfiles/"))[1]: data['comparisonfiles'][subset] = {} data['comparisonfiles'][subset]["format"] = [] format_list = [ format for format in next(os.walk("comparison...
Fix extension detection in JSON generation
Fix extension detection in JSON generation
Python
bsd-3-clause
WyohKnott/image-comparison-sources
--- +++ @@ -19,7 +19,7 @@ os.path.splitext(os.path.basename(fn))[1][1:] for fn in glob.glob( "comparisonfiles/" + subset + "/large/" + format + "/*") - if os.path.splitext(os.path.basename(fn))[1] != "png" + if os.path.splitext(os.path.basename(fn))[1] ...
ba6ef2ac850c91ac8a72401b7bd7b130bc2cc1d6
docs/conf.py
docs/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import setuptools_scm extensions = [ 'sphinx.ext.autodoc', ] # General information about the project. project = 'jaraco.logging' copyright = '2015 Jason R. Coombs' # The short X.Y version. version = setuptools_scm.get_version(root='..') # The full ve...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import setuptools_scm extensions = [ 'sphinx.ext.autodoc', ] # General information about the project. project = 'jaraco.logging' copyright = '2015 Jason R. Coombs' # The short X.Y version. version = setuptools_scm.get_version(root='..', relative_to=__...
Fix version detection for tests
Fix version detection for tests
Python
mit
jaraco/jaraco.logging
--- +++ @@ -12,7 +12,7 @@ copyright = '2015 Jason R. Coombs' # The short X.Y version. -version = setuptools_scm.get_version(root='..') +version = setuptools_scm.get_version(root='..', relative_to=__file__) # The full version, including alpha/beta/rc tags. release = version
b974bbcc7e243fca7c3dc63fbbaf530fe9b69e50
runtests.py
runtests.py
import sys try: from django.conf import settings from django.test.utils import get_runner settings.configure( DEBUG=True, USE_TZ=True, DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", } ...
import os import sys try: sys.path.append('demoproject') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demoproject.settings") from django.conf import settings from django.core.management import call_command settings.DATABASES['default']['NAME'] = ':memory:' settings.INSTALLED_APPS.append('...
Load DB migrations before testing and use verbose=2 and failfast
Load DB migrations before testing and use verbose=2 and failfast Note that we use `manage.py test` instead of `manage.py migrate` and manually running the tests. This lets Django take care of applying migrations before running tests. This works around https://code.djangoproject.com/ticket/22487 which causes a test fai...
Python
bsd-2-clause
pgollakota/django-chartit,pgollakota/django-chartit,pgollakota/django-chartit
--- +++ @@ -1,30 +1,15 @@ +import os import sys try: + sys.path.append('demoproject') + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demoproject.settings") + from django.conf import settings - from django.test.utils import get_runner + from django.core.management import call_command - se...
471bb3847b78f36f79af6cbae288a8876357cb3c
runtests.py
runtests.py
#!/usr/bin/env python import sys from django.conf import settings from django.core.management import execute_from_command_line if not settings.configured: params = dict( LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'consol...
#!/usr/bin/env python import sys from django.conf import settings from django.core.management import execute_from_command_line if not settings.configured: params = dict( LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'consol...
Add missing config that caused test to fail
Add missing config that caused test to fail
Python
mit
Frojd/wagtail-geo-widget,Frojd/wagtail-geo-widget,Frojd/wagtail-geo-widget,Frojd/wagtail-geo-widget
--- +++ @@ -34,6 +34,7 @@ 'django.contrib.auth', 'django.contrib.sites', 'wagtail.core', + "wagtail.admin", 'wagtail.sites', 'wagtail.users', 'wagtail.images', @@ -43,6 +44,7 @@ ], MIDDLEWARE_CLASSES=[], ...
25224af8c002c05397e5c3163f0b77cb82ce325e
data_collection/management/commands/assignfirms.py
data_collection/management/commands/assignfirms.py
from django.core.management.base import BaseCommand, CommandError from data_collection.models import User, Firm, Assignment import itertools class Command(BaseCommand): help = "Assign firms to users" def add_arguments(self, parser): parser.add_argument('users', nargs='+', type=str) def handle(sel...
from django.core.management.base import BaseCommand, CommandError from data_collection.models import User, Firm, Assignment import itertools, random class Command(BaseCommand): help = "Assign firms to users" def add_arguments(self, parser): parser.add_argument('users', nargs='+', type=str) par...
Add ability to proportionally assign to different users
Add ability to proportionally assign to different users
Python
bsd-3-clause
sunlightlabs/hanuman,sunlightlabs/hanuman,sunlightlabs/hanuman
--- +++ @@ -1,15 +1,34 @@ from django.core.management.base import BaseCommand, CommandError from data_collection.models import User, Firm, Assignment -import itertools +import itertools, random class Command(BaseCommand): help = "Assign firms to users" def add_arguments(self, parser): parser...
54b3b69d152611d55ce7db66c2c34dc2b1140cc7
wellknown/models.py
wellknown/models.py
from django.db import models from django.db.models.signals import post_save import mimetypes import wellknown # # create default host-meta handler # from wellknown.resources import HostMeta wellknown.register('host-meta', handler=HostMeta(), content_type='application/xrd+xml') # # resource model # class Resource(mo...
from django.db import models from django.db.models.signals import post_save import mimetypes import wellknown # # create default host-meta handler # from wellknown.resources import HostMeta wellknown.register('host-meta', handler=HostMeta(), content_type='application/xrd+xml') # # resource model # class Resource(mo...
Remove code that was causing a problem running syncdb. Code seems to be redundant anyway.
Remove code that was causing a problem running syncdb. Code seems to be redundant anyway.
Python
bsd-3-clause
jcarbaugh/django-wellknown
--- +++ @@ -45,10 +45,3 @@ ) post_save.connect(save_handler, sender=Resource) - -# -# cache resources -# - -for res in Resource.objects.all(): - wellknown.register(res.path, content=res.content, content_type=res.content_type)
4e7917ab5a2e112af8c69b89805af6b097eed97e
examples/custom_table_caching/grammar.py
examples/custom_table_caching/grammar.py
from parglare import Grammar grammar = Grammar.from_string(""" start: ab EOF; ab: "a" ab "b" | EMPTY; """) start_symbol = 'start'
from parglare import Grammar grammar = Grammar.from_string(""" start: ab; ab: "a" ab "b" | EMPTY; """) start_symbol = 'start'
Remove `EOF` -- update examples
Remove `EOF` -- update examples refs #64
Python
mit
igordejanovic/parglare,igordejanovic/parglare
--- +++ @@ -2,7 +2,7 @@ grammar = Grammar.from_string(""" - start: ab EOF; + start: ab; ab: "a" ab "b" | EMPTY; """)
75289980c658e081fec2d7e34651837c4629d4b7
settings.py
settings.py
# -*- coding: utf-8 -*- """ * Project: udacity-fsnd-p4-conference-app * Author name: Iraquitan Cordeiro Filho * Author login: iraquitan * File: settings * Date: 3/23/16 * Time: 12:16 AM """ # Replace the following lines with client IDs obtained from the APIs # Console or Cloud Console. WEB_CLIENT_ID = 'your-app-i...
# -*- coding: utf-8 -*- """ * Project: udacity-fsnd-p4-conference-app * Author name: Iraquitan Cordeiro Filho * Author login: iraquitan * File: settings * Date: 3/23/16 * Time: 12:16 AM """ # Replace the following lines with client IDs obtained from the APIs # Console or Cloud Console. WEB_CLIENT_ID = 'your-web-c...
Fix the placeholder for better understanding
fix: Fix the placeholder for better understanding
Python
mit
iraquitan/udacity-fsnd-p4-conference-app,iraquitan/udacity-fsnd-p4-conference-app,iraquitan/udacity-fsnd-p4-conference-app
--- +++ @@ -9,4 +9,4 @@ """ # Replace the following lines with client IDs obtained from the APIs # Console or Cloud Console. -WEB_CLIENT_ID = 'your-app-id' +WEB_CLIENT_ID = 'your-web-client-id'
68b52fedf5b22891a4fc9cf121417ced38d0ea00
rolepermissions/utils.py
rolepermissions/utils.py
from __future__ import unicode_literals import re import collections def user_is_authenticated(user): if isinstance(user.is_authenticated, collections.Callable): authenticated = user.is_authenticated() else: authenticated = user.is_authenticated return authenticated def camelToSnake(s)...
from __future__ import unicode_literals import re try: from collections.abc import Callable except ImportError: from collections import Callable def user_is_authenticated(user): if isinstance(user.is_authenticated, Callable): authenticated = user.is_authenticated() else: authenticated...
Fix import of Callable for Python 3.9
Fix import of Callable for Python 3.9 Python 3.3 moved Callable to collections.abc and Python 3.9 removes Callable from collections module
Python
mit
vintasoftware/django-role-permissions
--- +++ @@ -1,11 +1,14 @@ from __future__ import unicode_literals import re -import collections +try: + from collections.abc import Callable +except ImportError: + from collections import Callable def user_is_authenticated(user): - if isinstance(user.is_authenticated, collections.Callable): + if ...
7f7fd4e7547af3a6d7e3cd4da025c2b0ab24508b
widgy/contrib/widgy_mezzanine/migrations/0001_initial.py
widgy/contrib/widgy_mezzanine/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import widgy.db.fields import django.db.models.deletion import widgy.contrib.widgy_mezzanine.models class Migration(migrations.Migration): dependencies = [ ('pages', '__first__'), ('review_qu...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import widgy.db.fields import django.db.models.deletion import widgy.contrib.widgy_mezzanine.models class Migration(migrations.Migration): dependencies = [ ('pages', '__first__'), ('widgy', '...
Remove dependency for ReviewedVersionTracker in migrations
Remove dependency for ReviewedVersionTracker in migrations The base widgy migrations had references to ReviewedVersionTracker, which is not part of the base widgy install. This commit changes the dependency to VersionTracker instead, which is part of the base widgy install.
Python
apache-2.0
j00bar/django-widgy,j00bar/django-widgy,j00bar/django-widgy
--- +++ @@ -11,7 +11,7 @@ dependencies = [ ('pages', '__first__'), - ('review_queue', '0001_initial'), + ('widgy', '0001_initial'), ] operations = [ @@ -19,7 +19,7 @@ name='WidgyPage', fields=[ ('page_ptr', models.OneToOneField(paren...
e9dc10532a0357bc90ebaa2655b36822f9249673
test/__init__.py
test/__init__.py
from cellulario import iocell import asyncio import uvloop asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) iocell.DEBUG = True
from cellulario import iocell iocell.DEBUG = True
Remove uvloop from test run.
Remove uvloop from test run.
Python
mit
mayfield/cellulario
--- +++ @@ -1,8 +1,4 @@ from cellulario import iocell -import asyncio -import uvloop - -asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) iocell.DEBUG = True
16369ed6a11aaa39e94479b06ed78eb75f5b33e1
src/args.py
src/args.py
#!/usr/bin/env python3 # chameleon-crawler # # Copyright 2014 ghostwords. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from argparse import ArgumentParser from gl...
#!/usr/bin/env python3 # chameleon-crawler # # Copyright 2014 ghostwords. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from glob import glob from os import path ...
Fix --crx arg error reporting.
Fix --crx arg error reporting.
Python
mpl-2.0
ghostwords/chameleon-crawler,ghostwords/chameleon-crawler,ghostwords/chameleon-crawler
--- +++ @@ -8,18 +8,18 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -from argparse import ArgumentParser from glob import glob from os import path + +import argparse def is_valid_file(f, parser): if path.isfile(f): ...
78675420e9d23d9978f68ed002de0fc1284d3d0c
node.py
node.py
class Node(object): def __init__(self): # Node(s) from which this Node receives values self.inbound_nodes = inbound_nodes # Node(s) to which this Node passes values self.outbound_nodes = [] # For each inbound Node here, add this Node as an outbound to that Node. for n in self.inbound_nodes: ...
class Node(object): def __init__(self): # Node(s) from which this Node receives values self.inbound_nodes = inbound_nodes # Node(s) to which this Node passes values self.outbound_nodes = [] # For each inbound Node here, add this Node as an outbound to that Node. for n in self.inbound_nodes: ...
Add forward function declaration to Class Node
Add forward function declaration to Class Node
Python
mit
YabinHu/miniflow
--- +++ @@ -10,3 +10,12 @@ # A calculated value self.value = None + + def forward(self): + """ + Forward propagation. + + Compute the output value based on `inbound_nodes` and store the result in + self.value. + """ + raise NotImplemented
238578d41beec33d7428cb53d79fc21c028cfc87
tests/specifications/external_spec_test.py
tests/specifications/external_spec_test.py
from fontbakery.checkrunner import Section from fontbakery.fonts_spec import spec_factory def check_filter(checkid, font=None, **iterargs): if checkid in ( "com.google.fonts/check/035", # ftxvalidator "com.google.fonts/check/036", # ots-sanitize "com.google.fonts/check/037", # Font Validator ...
from fontbakery.checkrunner import Section from fontbakery.fonts_spec import spec_factory def check_filter(item_type, item_id, item): if item_type == "check" and item_id in ( "com.google.fonts/check/035", # ftxvalidator "com.google.fonts/check/036", # ots-sanitize "com.google.fonts/check/037", ...
Use auto_register's filter_func to filter tests
Use auto_register's filter_func to filter tests
Python
apache-2.0
moyogo/fontbakery,moyogo/fontbakery,googlefonts/fontbakery,googlefonts/fontbakery,moyogo/fontbakery,graphicore/fontbakery,graphicore/fontbakery,graphicore/fontbakery,googlefonts/fontbakery
--- +++ @@ -2,28 +2,29 @@ from fontbakery.fonts_spec import spec_factory -def check_filter(checkid, font=None, **iterargs): - if checkid in ( +def check_filter(item_type, item_id, item): + if item_type == "check" and item_id in ( "com.google.fonts/check/035", # ftxvalidator "com.google.fonts/che...
a7be90536618ac52c91f599bb167e05f831cddfb
mangopaysdk/entities/transaction.py
mangopaysdk/entities/transaction.py
from mangopaysdk.entities.entitybase import EntityBase from mangopaysdk.types.money import Money class Transaction (EntityBase): """Transaction entity. Base class for: PayIn, PayOut, Transfer. """ def __init__(self, id = None): self.AuthorId = None self.CreditedUserId = None #...
from mangopaysdk.entities.entitybase import EntityBase from mangopaysdk.types.money import Money class Transaction (EntityBase): """Transaction entity. Base class for: PayIn, PayOut, Transfer. """ def __init__(self, id = None): self.AuthorId = None self.CreditedUserId = None #...
Add possibilty to get ResultMessage
Add possibilty to get ResultMessage
Python
mit
chocopoche/mangopay2-python-sdk,Mangopay/mangopay2-python-sdk
--- +++ @@ -23,6 +23,7 @@ # TransactionStatus {CREATED, SUCCEEDED, FAILED} self.Status = None self.ResultCode = None + self.ResultMessage = None # timestamp self.ExecutionDate = None return super(Transaction, self).__init__(id)
1a9c5c6cee3b8c31d92ab0949fc312907adf6611
swf/core.py
swf/core.py
# -*- coding:utf-8 -*- # Copyright (c) 2013, Theo Crevon # Copyright (c) 2013, Greg Leclercq # # See the file LICENSE for copying permission. import boto.swf from . import settings SETTINGS = settings.get() class ConnectedSWFObject(object): """Authenticated object interface Provides the instance attribu...
# -*- coding:utf-8 -*- # Copyright (c) 2013, Theo Crevon # Copyright (c) 2013, Greg Leclercq # # See the file LICENSE for copying permission. import boto.swf from . import settings SETTINGS = settings.get() class ConnectedSWFObject(object): """Authenticated object interface Provides the instance attribu...
Fix ConnectedSWFObject: pass default value to pop()
Fix ConnectedSWFObject: pass default value to pop()
Python
mit
botify-labs/python-simple-workflow,botify-labs/python-simple-workflow
--- +++ @@ -31,7 +31,7 @@ settings_ = {k: v for k, v in SETTINGS.iteritems()} settings_.update(kwargs) - self.region = (settings_.pop('region') or + self.region = (settings_.pop('region', None) or boto.swf.layer1.Layer1.DefaultRegionName) self.conne...
3cacced39d9cb8bd5d6a2b3db8aa4b5aa1b37f58
jaraco/util/meta.py
jaraco/util/meta.py
""" meta.py Some useful metaclasses. """ from __future__ import unicode_literals class LeafClassesMeta(type): """ A metaclass for classes that keeps track of all of them that aren't base classes. """ _leaf_classes = set() def __init__(cls, name, bases, attrs): if not hasattr(cls, '_leaf_classes'): cls._...
""" meta.py Some useful metaclasses. """ from __future__ import unicode_literals class LeafClassesMeta(type): """ A metaclass for classes that keeps track of all of them that aren't base classes. """ _leaf_classes = set() def __init__(cls, name, bases, attrs): if not hasattr(cls, '_leaf_classes'): cls._...
Allow attribute to be customized in TagRegistered
Allow attribute to be customized in TagRegistered
Python
mit
jaraco/jaraco.classes
--- +++ @@ -26,12 +26,15 @@ class TagRegistered(type): """ As classes of this metaclass are created, they keep a registry in the - base class of all classes by a class attribute, 'tag'. + base class of all classes by a class attribute, indicated by attr_name. """ + attr_name = 'tag' + def __init__(cls, name,...
7b6838ea292e011f96f5212992d00c1009e1f6b2
examples/gitter_example.py
examples/gitter_example.py
# -*- coding: utf-8 -*- from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer from settings import GITTER # Uncomment the following lines to enable verbose logging # import logging # logging.basicConfig(level=logging.INFO) chatbot = ChatBot( 'GitterBot', gitter_room=GITTER['...
# -*- coding: utf-8 -*- from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer from settings import GITTER # Uncomment the following lines to enable verbose logging # import logging # logging.basicConfig(level=logging.INFO) ''' To use this example, create a new file called settings.p...
Add better instructions to the Gitter example
Add better instructions to the Gitter example
Python
bsd-3-clause
gunthercox/ChatterBot,vkosuri/ChatterBot
--- +++ @@ -7,6 +7,17 @@ # Uncomment the following lines to enable verbose logging # import logging # logging.basicConfig(level=logging.INFO) + + +''' +To use this example, create a new file called settings.py. +In settings.py define the following: + +GITTER = { + "API_TOKEN": "my-api-token", + "ROOM": "exam...
260a5601a9b2990374d2f97d92898236e0b9342e
tests/profiling_test_script.py
tests/profiling_test_script.py
#!/usr/bin/python # -*- coding: utf-8 -*- u""" :author: Joseph Martinot-Lagarde Created on Sat Jan 19 14:57:57 2013 """ from __future__ import ( print_function, division, unicode_literals, absolute_import) import subdir.profiling_test_script2 as script2 @profile def fact(n): result = 1 for i in xrange...
#!/usr/bin/python # -*- coding: utf-8 -*- u""" :author: Joseph Martinot-Lagarde Created on Sat Jan 19 14:57:57 2013 """ from __future__ import ( print_function, division, unicode_literals, absolute_import) import subdir.profiling_test_script2 as script2 @profile def fact(n): result = 1 for i in xrange...
Add diversity to test script
Add diversity to test script
Python
mit
jitseniesen/spyder-memory-profiler,jitseniesen/spyder-memory-profiler,Nodd/spyder_line_profiler,spyder-ide/spyder.line_profiler,spyder-ide/spyder.memory_profiler,spyder-ide/spyder.line-profiler,Nodd/spyder.line_profiler
--- +++ @@ -15,6 +15,12 @@ @profile def fact(n): + result = 1 + for i in xrange(2, n // 4): + result *= i + result = 1 + for i in xrange(2, n // 16): + result *= i result = 1 for i in xrange(2, n + 1): result *= i
c0db57b52aa0546fd6f7a2cf4fc0242cbcf76537
test_bot.py
test_bot.py
#!/usr/bin/env python from tpb import TPB t = TPB() # when using a proxy site # t = TPB('http://uberproxy.net/thepiratebay.sx') for to in t.get_recent_torrents(): print '*' * 50 to.print_torrent() print '\n' """ # search for programming ebooks results = t.search('hello world', categor...
#!/usr/bin/env python from tpb import TPB t = TPB() # when using a proxy site # t = TPB(domain='http://uberproxy.net/thepiratebay.sx') for to in t.get_recent_torrents(): print '*' * 50 to.print_torrent() print '\n' """ # search for programming ebooks results = t.search('hello world', ...
Fix the test bot's TPB initialization
Fix the test bot's TPB initialization
Python
mit
karan/TPB,karan/TPB
--- +++ @@ -5,7 +5,7 @@ t = TPB() # when using a proxy site -# t = TPB('http://uberproxy.net/thepiratebay.sx') +# t = TPB(domain='http://uberproxy.net/thepiratebay.sx') for to in t.get_recent_torrents():
97a67e022d094743e806896386bdbe317cb56fb6
gitcloner.py
gitcloner.py
#! /usr/bin/env python3 import sys from gitaccount import GitAccount def main(): if len(sys.argv) < 2: print("""Usage: gitcloner.py [OPTION] [NAME] OPTIONS: -u - for user repositories -o - for organization repositories NAME: Username or Organization Name """) ...
#! /usr/bin/env python3 import sys import argparse from gitaccount import GitAccount def main(): parser = argparse.ArgumentParser( prog='gitcloner', description='Clone all the repositories from a github user/org\naccount to the current directory') group = parser.add_mutually_exclusiv...
Use argparse instead of sys.argv
Use argparse instead of sys.argv
Python
mit
shakib609/gitcloner
--- +++ @@ -1,31 +1,35 @@ #! /usr/bin/env python3 import sys +import argparse from gitaccount import GitAccount def main(): - if len(sys.argv) < 2: - print("""Usage: - gitcloner.py [OPTION] [NAME] + parser = argparse.ArgumentParser( + prog='gitcloner', + description='Cl...