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
1eb9830485ec82713d3e8d4d1e13ea1fdc1733c6
airtable.py
airtable.py
import requests, json import pandas as pd class AT: def __init__(self, base, api): self.base = base self.api = api self.headers = {"Authorization": "Bearer "+self.api} def getTable(self,table): r = requests.get("https://api.airtable.com/v0/"+self.base+"/"+table, headers=self.headers) j = r.json() df = ...
import requests, json import pandas as pd class AT: def __init__(self, base, api): self.base = base self.api = api self.headers = {"Authorization": "Bearer "+self.api} def getTable(self,table): r = requests.get("https://api.airtable.com/v0/"+self.base+"/"+table, headers=self.headers) j = r.json() df = ...
Add quick error messaging for easier debugging
Add quick error messaging for easier debugging
Python
mit
MeetMangrove/location-bot
--- +++ @@ -18,4 +18,8 @@ h = self.headers h["Content-type"] = "application/json" r = requests.post("https://api.airtable.com/v0/"+self.base+"/"+table, headers=h, data=json.dumps({"fields": obj, "typecast": typecast})) - return r.json() + if r.status_code == requests.codes.ok: + return r.json() + else:...
378b5679f9ca3b814eb0a2a89e9f8045ae4bc4c1
FunctionHandler.py
FunctionHandler.py
import os, sys from glob import glob import GlobalVars def LoadFunction(path, loadAs=''): loadType = 'l' name = path src = __import__('Functions.' + name, globals(), locals(), []) if loadAs != '': name = loadAs if name in GlobalVars.functions: loadType = 'rel' del sys.module...
import os, sys from glob import glob import GlobalVars def LoadFunction(path, loadAs=''): loadType = 'l' name = path src = __import__('Functions.' + name, globals(), locals(), []) if loadAs != '': name = loadAs if name in GlobalVars.functions: loadType = 'rel' del sys.module...
Clean up module loading printing
Clean up module loading printing
Python
mit
HubbeKing/Hubbot_Twisted
--- +++ @@ -20,7 +20,9 @@ for comp in components[:1]: src = getattr(src, comp) - print str(src) + ModuleName = str(src).split("from")[0].strip("(").rstrip(" ") + if loadType != 'rel': + print ModuleName + " loaded." func = src.Instantiate()
47d69320261a3126637229c9deaf02ba425998af
members/models.py
members/models.py
from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): faculty_number = models.CharField(max_length=8) def __unicode__(self): return unicode(self.username) def attended_meetings(self): return self.protocols.all()
from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): faculty_number = models.CharField(max_length=8) def __unicode__(self): return unicode(self.username) def attended_meetings(self): return self.meetings_attend.all() def absent_m...
Add attended_meetings and absent_meetings methos to User class
Add attended_meetings and absent_meetings methos to User class
Python
mit
Hackfmi/Diaphanum,Hackfmi/Diaphanum
--- +++ @@ -9,4 +9,7 @@ return unicode(self.username) def attended_meetings(self): - return self.protocols.all() + return self.meetings_attend.all() + + def absent_meetings(self): + return self.meetings_absent.all()
b261eb0b2180ebc07ace6c1abad4ec68d6c17840
app/__init__.py
app/__init__.py
from __future__ import absolute_import from __future__ import unicode_literals # Import flask and template operators from flask import Flask, request, render_template # Define the WSGI application object app = Flask(__name__) # Configurations app.config.from_object('config.default') # Configure webhooks from .webho...
from __future__ import absolute_import from __future__ import unicode_literals # Import flask and template operators from flask import Flask, request, render_template # Define the WSGI application object app = Flask(__name__) # Configurations app.config.from_object('config.default') # Configure webhooks from .webho...
Configure slacker on app initialization
Configure slacker on app initialization
Python
apache-2.0
pipex/gitbot,pipex/gitbot,pipex/gitbot
--- +++ @@ -16,6 +16,10 @@ from .gitlab import GitlabWebHook webhooks.add_handler('gitlab', GitlabWebHook) + +# Configure Slacker +from slacker import Slacker +slack = Slacker(app.config.get('SLACK_TOKEN')) # Configure logging import logging
2917e089734ace4fd212ef9a16e8adf71d671312
test/partial_double_test.py
test/partial_double_test.py
from doubles import allow, teardown class User(object): def __init__(self, name): self.name = name def get_name(self): return self.name class TestPartialDouble(object): def test_stubs_real_object(self): user = User('Alice') allow(user).to_receive('get_name').and_return(...
from doubles import allow, teardown class User(object): def __init__(self, name, age): self.name = name self._age = age @property def age(self): return self._age def get_name(self): return self.name class TestPartialDouble(object): def test_stubs_real_object(sel...
Test that only stubbed methods are altered on partial doubles.
Test that only stubbed methods are altered on partial doubles.
Python
mit
uber/doubles
--- +++ @@ -2,8 +2,13 @@ class User(object): - def __init__(self, name): + def __init__(self, name, age): self.name = name + self._age = age + + @property + def age(self): + return self._age def get_name(self): return self.name @@ -11,16 +16,23 @@ class TestP...
efb7191428756f8ef0b85475d00297e2594eca4c
feincms/content/comments/models.py
feincms/content/comments/models.py
# ------------------------------------------------------------------------ # coding=utf-8 # ------------------------------------------------------------------------ # # Created by Martin J. Laubach on 08.01.10. # # ------------------------------------------------------------------------ from django.db import models ...
# ------------------------------------------------------------------------ # coding=utf-8 # ------------------------------------------------------------------------ # # Created by Martin J. Laubach on 08.01.10. # # ------------------------------------------------------------------------ from django.db import models ...
Handle posting in comments content type so the "post comment" stays in the cms framework instead of showing an external page from django.contrib.comments.
Handle posting in comments content type so the "post comment" stays in the cms framework instead of showing an external page from django.contrib.comments.
Python
bsd-3-clause
joshuajonah/feincms,feincms/feincms,matthiask/django-content-editor,matthiask/django-content-editor,hgrimelid/feincms,michaelkuty/feincms,nickburlett/feincms,hgrimelid/feincms,mjl/feincms,matthiask/django-content-editor,joshuajonah/feincms,mjl/feincms,joshuajonah/feincms,michaelkuty/feincms,nickburlett/feincms,nickburl...
--- +++ @@ -26,11 +26,26 @@ parent_type = self.parent.__class__.__name__.lower() request = kwargs.get('request') + # TODO: Check for translation extension before use! + comment_page = self.parent.original_translation + + f = None + if self.comments_enabled and request.P...
12cca87c2c84db562361ee230dfc033c31f7e0d4
webhooks/azuremonitor/setup.py
webhooks/azuremonitor/setup.py
from setuptools import setup, find_packages version = '5.0.0' setup( name="alerta-azure-monitor", version=version, description='Alerta webhook for Azure Monitor', url='https://github.com/alerta/alerta-contrib', license='MIT', author='Anton Delitsch', author_email='anton@trugen.net', pa...
from setuptools import setup, find_packages version = '5.0.1' setup( name="alerta-azure-monitor", version=version, description='Alerta webhook for Azure Monitor', url='https://github.com/alerta/alerta-contrib', license='MIT', author='Anton Delitsch', author_email='anton@trugen.net', pa...
Add dependency to azure monitor
Add dependency to azure monitor
Python
mit
alerta/alerta-contrib,alerta/alerta-contrib,alerta/alerta-contrib
--- +++ @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = '5.0.0' +version = '5.0.1' setup( name="alerta-azure-monitor", @@ -13,6 +13,7 @@ packages=find_packages(), py_modules=['alerta_azuremonitor'], install_requires=[ + 'python-dateutil' ], include_pac...
b37eb87e73f049b87dcd0bf3cd3ff9be1ffaff4b
scripts/run_tests.py
scripts/run_tests.py
#!/usr/bin/env python import optparse import sys from os import path from os.path import expanduser import unittest import argparse # Simple stand-alone test runner # - Runs independently of appengine runner # - So we need to find the GAE library # - Looks for tests as ./tests/test*.py # - Use --skipbasics to skip th...
#!/usr/bin/env python import argparse import optparse from os import getenv, path from os.path import expanduser import sys import unittest # Simple stand-alone test runner # - Runs independently of appengine runner # - So we need to find the GAE library # - Looks for tests as ./tests/test*.py # - Use --skipbasics to...
Check APP_ENGINE env var before using hard-coded path to Google AppEngine SDK.
Check APP_ENGINE env var before using hard-coded path to Google AppEngine SDK.
Python
apache-2.0
hschema/schemaorg,schemaorg/schemaorg,pwz3n0/schemaorg,gkellogg/schemaorg,vholland/schemaorg,URXtech/schemaorg,schemaorg/schemaorg,cesarmarinhorj/schemaorg,sdo-sport/schemaorg,hschema/schemaorg,tfrancart/schemaorg,ya7lelkom/schemaorg,ynh/schemaorg,sdo-sport/schemaorg,twamarc/schemaorg,haonature/schemaorg,schemaorg/sche...
--- +++ @@ -1,11 +1,11 @@ #!/usr/bin/env python +import argparse import optparse +from os import getenv, path +from os.path import expanduser import sys -from os import path -from os.path import expanduser import unittest -import argparse # Simple stand-alone test runner # - Runs independently of appengine ...
f86c43e7f1d59aa2b6b8bf636c736cb36da877f9
google/cloud/forseti/__init__.py
google/cloud/forseti/__init__.py
# Copyright 2017 The Forseti Security 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 ap...
# Copyright 2017 The Forseti Security 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 ap...
Change version number to 2.11.0.
Change version number to 2.11.0.
Python
apache-2.0
forseti-security/forseti-security,forseti-security/forseti-security,forseti-security/forseti-security,forseti-security/forseti-security
--- +++ @@ -14,5 +14,5 @@ """Google CLoud Forseti.""" -__version__ = '2.10.0' +__version__ = '2.11.0' __package_name__ = 'forseti-security'
1a61ba3655e575cbf4d20190182654cb677bce9c
app/grandchallenge/serving/tasks.py
app/grandchallenge/serving/tasks.py
from celery import shared_task from django.db.models import F from grandchallenge.serving.models import Download @shared_task def create_download(*_, **kwargs): try: d = Download.objects.get(**kwargs) d.count = F("count") + 1 d.save() except Download.DoesNotExist: Download.obj...
from celery import shared_task from django.db.models import F from grandchallenge.serving.models import Download @shared_task def create_download(*_, **kwargs): d, created = Download.objects.get_or_create(**kwargs) if not created: d.count = F("count") + 1 d.save()
Fix race condition in create_download
Fix race condition in create_download
Python
apache-2.0
comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django
--- +++ @@ -6,9 +6,8 @@ @shared_task def create_download(*_, **kwargs): - try: - d = Download.objects.get(**kwargs) + d, created = Download.objects.get_or_create(**kwargs) + + if not created: d.count = F("count") + 1 d.save() - except Download.DoesNotExist: - Download.o...
094b16a8088c8e7f8012465984c53e87e6e61eac
prompt_toolkit/__init__.py
prompt_toolkit/__init__.py
""" prompt_toolkit ============== Author: Jonathan Slenders Description: prompt_toolkit is a Library for building powerful interactive command lines in Python. It can be a replacement for GNU readline, but it can be much more than that. See the examples directory to learn about the usage. ...
""" prompt_toolkit ============== Author: Jonathan Slenders Description: prompt_toolkit is a Library for building powerful interactive command lines in Python. It can be a replacement for GNU readline, but it can be much more than that. See the examples directory to learn about the usage. ...
Fix typo: `meight` -> `might`
Fix typo: `meight` -> `might`
Python
bsd-3-clause
jonathanslenders/python-prompt-toolkit
--- +++ @@ -10,7 +10,7 @@ See the examples directory to learn about the usage. -Probably, to get started, you meight also want to have a look at +Probably, to get started, you might also want to have a look at `prompt_toolkit.shortcuts.prompt`. """ from .application import Application
8c10f7a3112ecece857ee9c3d20076377f7196a0
upload.py
upload.py
import os import re import datetime from trovebox import Trovebox def main(): try: client = Trovebox() client.configure(api_version=2) except IOError, e: print print '!! Could not initialize Trovebox connection.' print '!! Check that ~/.config/trovebox/default exists a...
import os import re import datetime from trovebox import Trovebox from trovebox.errors import TroveboxError def main(): try: client = Trovebox() client.configure(api_version=2) except IOError, e: print print '!! Could not initialize Trovebox connection.' print '!! Chec...
Use full path as album name fallback. Support all Trovebox file types.
Use full path as album name fallback. Support all Trovebox file types.
Python
mit
nip3o/trovebox-uploader
--- +++ @@ -3,6 +3,7 @@ import datetime from trovebox import Trovebox +from trovebox.errors import TroveboxError def main(): try: @@ -22,12 +23,19 @@ folder_name = album = None for filename in files: - if not re.match(r'^.+\.jpg$', filename, flags=re.IGNORECASE): + ...
b13c8b5cd0dde5d329a14b99c672307567992434
workshop_drf/todo/serializers.py
workshop_drf/todo/serializers.py
from rest_framework import serializers from . import models class Category(serializers.ModelSerializer): class Meta: model = models.Category class Task(serializers.ModelSerializer): class Meta: model = models.Task
from rest_framework import serializers from django.contrib.auth import get_user_model from . import models class Category(serializers.ModelSerializer): class Meta: model = models.Category fields = ('id', 'name') class Task(serializers.ModelSerializer): owner = serializers.SlugRelatedField( ...
Add human readable owner & categories.
Add human readable owner & categories.
Python
mit
arnlaugsson/workshop_drf,xordoquy/workshop_drf_djangoconeu2015,pombredanne/workshop_drf_djangoconeu2015
--- +++ @@ -1,13 +1,24 @@ from rest_framework import serializers +from django.contrib.auth import get_user_model from . import models class Category(serializers.ModelSerializer): class Meta: model = models.Category + fields = ('id', 'name') class Task(serializers.ModelSerializer): + ...
303f7e3e623294f63e53de2a1949a8bfb4a416ab
src/wirecloudcommons/utils/transaction.py
src/wirecloudcommons/utils/transaction.py
from django.db.transaction import is_dirty, leave_transaction_management, rollback, commit, enter_transaction_management, managed from django.db import DEFAULT_DB_ALIAS from django.http import HttpResponse def commit_on_http_success(func, using=None): """ This decorator activates db commit on HTTP success res...
from django.db.transaction import is_dirty, leave_transaction_management, rollback, commit, enter_transaction_management, managed from django.db import DEFAULT_DB_ALIAS from django.http import HttpResponse def commit_on_http_success(func, using=None): """ This decorator activates db commit on HTTP success res...
Make commit_on_http_success commit for status codes from 200 to 399 and not only with 200
Make commit_on_http_success commit for status codes from 200 to 399 and not only with 200 Signed-off-by: Álvaro Arranz García <3a7352a9ec78d7d17a9240a830621a1f159ca041@conwet.com>
Python
agpl-3.0
jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud
--- +++ @@ -25,7 +25,7 @@ else: if is_dirty(using=using): - if not isinstance(res, HttpResponse) or res.status_code > 200 or res.status_code < 200: + if not isinstance(res, HttpResponse) or res.status_code < 200 or res.status_code >= 400: roll...
8ddfcf45b4da91a02e12ebff2304e7ecf8a04378
IPython/utils/importstring.py
IPython/utils/importstring.py
# encoding: utf-8 """ A simple utility to import something by its string name. Authors: * Brian Granger """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is...
# encoding: utf-8 """ A simple utility to import something by its string name. Authors: * Brian Granger """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is...
Restructure code to avoid unnecessary list slicing by using rsplit.
Restructure code to avoid unnecessary list slicing by using rsplit.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -34,29 +34,17 @@ mod : module object The module that was imported. """ - - package = '.'.join(name.split('.')[0:-1]) - obj = name.split('.')[-1] - # Note: the original code for this was the following. We've left it - # visible for now in case the new implementatio...
531974ce5d621b903608aa226110277f77918167
tools/reset_gids.py
tools/reset_gids.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import types from sfa.storage.model import * from sfa.storage.alchemy import * from sfa.trust.gid import create_uuid from sfa.trust.hierarchy import Hierarchy from sfa.util.xrn import Xrn from sfa.trust.certificate import Certificate, Keypair, convert_public_key def fix_u...
#!/usr/bin/env python # -*- coding:utf-8 -*- import types from sfa.storage.model import * from sfa.storage.alchemy import * from sfa.trust.gid import create_uuid from sfa.trust.hierarchy import Hierarchy from sfa.util.xrn import Xrn from sfa.trust.certificate import Certificate, Keypair, convert_public_key def fix_u...
Reset GIDs works even if user has no pub_key
Fix: Reset GIDs works even if user has no pub_key
Python
mit
yippeecw/sfa,onelab-eu/sfa,onelab-eu/sfa,yippeecw/sfa,onelab-eu/sfa,yippeecw/sfa
--- +++ @@ -20,7 +20,8 @@ uuid = create_uuid() pkey = Keypair(create=True) pub_key=getattr(record,'reg_keys',None) - if pub_key is not None: + print pub_key + if len(pub_key) > 0: # use only first key in record i...
1a069e7a8565dcd72b362d6b4c0cc3b1b981e5a6
Streamer/iterMapper.py
Streamer/iterMapper.py
#!/usr/bin/env python from utils import read_input from constants import EURISTIC_FACTOR from collections import Counter import sys def choose_nodes(nodes, neighbours_iterable): neighbours_count = len(neighbours_iterable) unpacked_list = [] for t in neighbours_iterable: unpacked_list += t[1:] ...
#!/usr/bin/env python from utils import read_input from constants import EURISTIC_FACTOR from collections import Counter import sys def choose_nodes(nodes, neighbours_iterable): neighbours_count = len(neighbours_iterable) unpacked_list = [] for t in neighbours_iterable: unpacked_list += t[1:] ...
Improve choose_nodes method (set problem)
Improve choose_nodes method (set problem)
Python
mit
AldurD392/SubgraphExplorer,AldurD392/SubgraphExplorer,AldurD392/SubgraphExplorer
--- +++ @@ -15,7 +15,9 @@ unpacked_list += t[1:] c = Counter(unpacked_list) - return tuple(k for k, v in c.items() if v >= neighbours_count * EURISTIC_FACTOR and k not in set(nodes)) + nodes_set = set(nodes) + + return tuple(k for k, v in c.items() if v >= neighbours_count * EURISTIC_FACTOR a...
474d7c95e5fec4a8638f1eb4ff7225f01d116308
heap.py
heap.py
# -*- coding: utf-8 -*- class Heap(object): """Implements a heap data structure in Python. The underlying data structure used to hold the data is a list. """ _heap = [] def __init__(self, initial=None): """Creates a new heap. Args: initial: (Optional): A continguous list containing the dat...
# -*- coding: utf-8 -*- class Heap(object): """Implements a heap data structure in Python. The underlying data structure used to hold the data is a list. """ __heap = [] def __init__(self, initial=None): """Creates a new heap. Args: initial: (Optional): A continguous list containing the da...
Revert "remove name mangling to make testing easier"
Revert "remove name mangling to make testing easier" This reverts commit c0647badcab661e0ac6e0499c36868e516dcd2e6.
Python
mit
DasAllFolks/PyAlgo
--- +++ @@ -7,7 +7,7 @@ The underlying data structure used to hold the data is a list. """ - _heap = [] + __heap = [] def __init__(self, initial=None): """Creates a new heap. @@ -17,12 +17,12 @@ initialize the new heap. """ if isinstance(initial, list) or isinstance(initial, tup...
1d1a64c8a98d98a243307dd58ec3874f0369ce8f
tests/ex12_tests.py
tests/ex12_tests.py
from nose.tools import * from exercises import ex12 def test_histogram(): ''' Test our histogram output is correct ''' test_histogram = ex12.histogram([1, 2, 3]) print(test_histogram) assert_equal(test_histogram, '*\n**\n***\n')
from nose.tools import * from exercises import ex12 def test_histogram(): ''' Test our histogram output is correct ''' test_histogram = ex12.histogram([1, 2, 3]) # assert_equal(test_histogram, '*\n**\n***\n')
Drop ex12 tests for now.
Drop ex12 tests for now.
Python
mit
gravyboat/python-exercises
--- +++ @@ -7,6 +7,5 @@ ''' test_histogram = ex12.histogram([1, 2, 3]) - print(test_histogram) - assert_equal(test_histogram, '*\n**\n***\n') +# assert_equal(test_histogram, '*\n**\n***\n')
13da665f07be45f5c5b9308d0219250b368810d5
tests/test_utils.py
tests/test_utils.py
import unittest from app import create_app, db from app.utils import get_or_create, is_safe_url from app.models import User class TestUtils(unittest.TestCase): def setUp(self): self.app = create_app("testing") self.app_ctx = self.app.app_context() self.app_ctx.push() db.create_all...
import unittest from app import create_app, db from app.utils import get_or_create, is_safe_url, get_redirect_target from app.models import User class TestUtils(unittest.TestCase): def setUp(self): self.app = create_app("testing") self.app_ctx = self.app.app_context() self.app_ctx.push() ...
Add unit test for get_redirect_target utility function
Add unit test for get_redirect_target utility function
Python
mit
Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary
--- +++ @@ -1,7 +1,7 @@ import unittest from app import create_app, db -from app.utils import get_or_create, is_safe_url +from app.utils import get_or_create, is_safe_url, get_redirect_target from app.models import User @@ -31,3 +31,10 @@ self.assertFalse(is_safe_url("http://externalsite.com")) ...
7c646414121e68b69896b5f700f65a1963977f72
tests/test_views.py
tests/test_views.py
from test_plus.test import TestCase from django_private_chat.views import * from django.test import RequestFactory from django.urls import reverse from django_private_chat.models import * class TestDialogListView(TestCase): def setUp(self): self.factory = RequestFactory() self.owner_user = self.ma...
from test_plus.test import TestCase from django_private_chat.views import * from django.test import RequestFactory from django.urlresolvers import reverse from django_private_chat.models import * class TestDialogListView(TestCase): def setUp(self): self.factory = RequestFactory() self.owner_user =...
Fix for older versions of django
Fix for older versions of django
Python
isc
Bearle/django-private-chat,Bearle/django-private-chat,Bearle/django-private-chat
--- +++ @@ -1,7 +1,7 @@ from test_plus.test import TestCase from django_private_chat.views import * from django.test import RequestFactory -from django.urls import reverse +from django.urlresolvers import reverse from django_private_chat.models import *
23e984fe24428241b873b93a4ca541b69d3345d2
nipy/labs/viz_tools/test/test_cm.py
nipy/labs/viz_tools/test/test_cm.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Smoke testing the cm module """ from nose import SkipTest try: import matplotlib as mp # Make really sure that we don't try to open an Xserver connection. mp.use('svg', warn=False) impo...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Smoke testing the cm module """ from nose import SkipTest try: import matplotlib as mp # Make really sure that we don't try to open an Xserver connection. mp.use('svg', warn=False) impo...
Fix tests on old MPL
BUG: Fix tests on old MPL Old MPL do not have function-defined colormaps, so the corresponding code path cannot be tested.
Python
bsd-3-clause
alexis-roche/nipy,nipy/nipy-labs,arokem/nipy,arokem/nipy,alexis-roche/nipy,alexis-roche/nireg,alexis-roche/register,alexis-roche/niseg,alexis-roche/nipy,bthirion/nipy,alexis-roche/nipy,bthirion/nipy,alexis-roche/register,arokem/nipy,nipy/nireg,nipy/nireg,bthirion/nipy,alexis-roche/nireg,alexis-roche/niseg,arokem/nipy,a...
--- +++ @@ -30,6 +30,8 @@ pl.switch_backend('svg') replace_inside(pl.cm.jet, pl.cm.hsv, .2, .8) # We also test with gnuplot, which is defined using function - replace_inside(pl.cm.gnuplot, pl.cm.gnuplot2, .2, .8) + if hasattr(pl.cm, 'gnuplot'): + # gnuplot is only in recent version of MPL ...
d348c4f7c60b599e713eeeda7ed6806c5b1baae0
tests/explorers_tests/test_additive_ou.py
tests/explorers_tests/test_additive_ou.py
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() import unittest import numpy as np from chainerrl.explorers.additive_ou import AdditiveOU class ...
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() import unittest from chainer import testing import numpy as np from chainerrl.explorers.additive_o...
Add tests of non-scalar sigma for AddtiveOU
Add tests of non-scalar sigma for AddtiveOU
Python
mit
toslunar/chainerrl,toslunar/chainerrl
--- +++ @@ -6,22 +6,32 @@ standard_library.install_aliases() import unittest +from chainer import testing import numpy as np from chainerrl.explorers.additive_ou import AdditiveOU +@testing.parameterize(*testing.product({ + 'action_size': [1, 3], + 'sigma_type': ['scalar', 'ndarray'], +})) class Te...
0049a5b12b60e0bbd104c7d88d36d432f51a3d37
cobe/control.py
cobe/control.py
import cmdparse import commands import logging import optparse import sys parser = cmdparse.CommandParser() parser.add_option("-b", "--brain", type="string", default="cobe.brain", help="Specify an alternate brain file") parser.add_option("", "--debug", action="store_true", help=optp...
import cmdparse import commands import logging import optparse import sys parser = cmdparse.CommandParser() parser.add_option("-b", "--brain", type="string", default="cobe.brain", help="Specify an alternate brain file") parser.add_option("", "--debug", action="store_true", help=optp...
Remove built-in profiling support; use cProfile from outside
Remove built-in profiling support; use cProfile from outside
Python
mit
meska/cobe,DarkMio/cobe,LeMagnesium/cobe,meska/cobe,wodim/cobe-ng,LeMagnesium/cobe,wodim/cobe-ng,pteichman/cobe,tiagochiavericosta/cobe,DarkMio/cobe,tiagochiavericosta/cobe,pteichman/cobe
--- +++ @@ -8,8 +8,6 @@ parser.add_option("-b", "--brain", type="string", default="cobe.brain", help="Specify an alternate brain file") parser.add_option("", "--debug", action="store_true", - help=optparse.SUPPRESS_HELP) -parser.add_option("", "--profile", action="store_true", ...
37161832aab8ecb611f9a80e1b58fc57866cdc14
tests/rules/test_git_remote_seturl_add.py
tests/rules/test_git_remote_seturl_add.py
import pytest from thefuck.rules.git_remote_seturl_add import match, get_new_command from tests.utils import Command @pytest.mark.parametrize('command', [ Command(script='git remote set-url origin url', stderr="fatal: No such remote")]) def test_match(command): assert match(command) @pytest.mark.parametrize...
import pytest from thefuck.rules.git_remote_seturl_add import match, get_new_command from tests.utils import Command @pytest.mark.parametrize('command', [ Command(script='git remote set-url origin url', stderr="fatal: No such remote")]) def test_match(command): assert match(command) @pytest.mark.parametrize...
Fix flake8 errors: E123 closing bracket does not match indentation of opening bracket's line
Fix flake8 errors: E123 closing bracket does not match indentation of opening bracket's line
Python
mit
Clpsplug/thefuck,SimenB/thefuck,mlk/thefuck,nvbn/thefuck,nvbn/thefuck,scorphus/thefuck,scorphus/thefuck,SimenB/thefuck,Clpsplug/thefuck,mlk/thefuck
--- +++ @@ -14,8 +14,7 @@ Command('git remote add origin url'), Command('git remote remove origin'), Command('git remote prune origin'), - Command('git remote set-branches origin branch') - ]) + Command('git remote set-branches origin branch')]) def test_not_match(command): assert not ma...
7baac2883aa6abc0f1f458882025ba1d0e9baab2
app/migrations/versions/4ef20b76cab1_.py
app/migrations/versions/4ef20b76cab1_.py
"""Enable PostGIS Revision ID: 4ef20b76cab1 Revises: 55004b0f00d6 Create Date: 2015-02-11 20:49:42.303864 """ # revision identifiers, used by Alembic. revision = '4ef20b76cab1' down_revision = '55004b0f00d6' from alembic import op import sqlalchemy as sa def upgrade(): op.execute("CREATE EXTENSION postgis;") ...
"""Enable PostGIS Revision ID: 4ef20b76cab1 Revises: 55004b0f00d6 Create Date: 2015-02-11 20:49:42.303864 """ # revision identifiers, used by Alembic. revision = '4ef20b76cab1' down_revision = '55004b0f00d6' from alembic import op import sqlalchemy as sa def upgrade(): op.execute("CREATE EXTENSION IF NOT EXIS...
Add extra code to PostGIS migration to only create extensions if they're not already there. Drop on rollback only if extensions exist.
Add extra code to PostGIS migration to only create extensions if they're not already there. Drop on rollback only if extensions exist.
Python
mit
openchattanooga/cpd-zones-old,openchattanooga/cpd-zones-old
--- +++ @@ -15,9 +15,9 @@ def upgrade(): - op.execute("CREATE EXTENSION postgis;") - op.execute("CREATE EXTENSION postgis_topology;") + op.execute("CREATE EXTENSION IF NOT EXISTS postgis;") + op.execute("CREATE EXTENSION IF NOT EXISTS postgis_topology;") def downgrade(): - op.execute("DROP EXTE...
e697743b89f262a179881e2c58e2422a146248d0
db_cleanup.py
db_cleanup.py
#!/usr/bin/env python # # Periodic cleanup job for blog comments. # This will remove any abandoned comments that # may have been posted by bots and did not get # past the captcha. # # Use PYTHONPATH=<StackSmash dir to manage.py> ./db_cleanup.py # import os, datetime def clean_up(): # Set Django settings module. os....
#!/usr/bin/env python # # Periodic cleanup job for blog comments. # This will remove any abandoned comments that # may have been posted by bots and did not get # past the captcha. # # Use PYTHONPATH=<StackSmash dir to manage.py> ./db_cleanup.py # # Cronjob to run on the 12th hour of every day: # * 12 * * * PYTHONPATH=/...
Add cron information, clean up old cruft that isnt needed.
Add cron information, clean up old cruft that isnt needed.
Python
bsd-2-clause
Justasic/StackSmash,Justasic/StackSmash
--- +++ @@ -6,6 +6,9 @@ # past the captcha. # # Use PYTHONPATH=<StackSmash dir to manage.py> ./db_cleanup.py +# +# Cronjob to run on the 12th hour of every day: +# * 12 * * * PYTHONPATH=/StackSmash /StackSmash/db_cleanup.py # import os, datetime @@ -20,13 +23,5 @@ # if comments are not listed and older than ...
6e6aaac438a18220db20ad480a8a82af49c44caa
pages/serializers.py
pages/serializers.py
from rest_framework import serializers from rest_framework.reverse import reverse from pages import fields, mixins, models from pages.utils import build_url class PageSerializer(serializers.HyperlinkedModelSerializer): name = serializers.CharField() regions = serializers.SerializerMethodField('rendered_regio...
from rest_framework import serializers from rest_framework.reverse import reverse from pages import fields, mixins, models from pages.utils import build_url class PageSerializer(serializers.HyperlinkedModelSerializer): name = serializers.CharField() regions = serializers.SerializerMethodField('rendered_regio...
Add 'view_name' to url extra kwargs
Add 'view_name' to url extra kwargs
Python
bsd-2-clause
incuna/feincms-pages-api
--- +++ @@ -14,7 +14,7 @@ model = models.Page view_name = 'pages:page-detail' extra_kwargs = { - 'url': {'lookup_field': 'slug'}, + 'url': {'lookup_field': 'slug', 'view_name': 'pages:page-detail'}, } def rendered_regions(self, obj):
fb7b9618d5e54e8500efb0904913b4febf80222c
catsnap/batch/image_batch.py
catsnap/batch/image_batch.py
from __future__ import unicode_literals from catsnap import Client, HASH_KEY from boto.dynamodb.batch import BatchList import json MAX_ITEMS_TO_REQUEST = 99 def get_images(filenames): if not filenames: raise StopIteration filenames = list(filenames) unprocessed_keys = filenames[MAX_ITEMS_TO_REQUE...
from __future__ import unicode_literals from catsnap import Client, HASH_KEY from boto.dynamodb.batch import BatchList import json MAX_ITEMS_TO_REQUEST = 99 def get_image_items(filenames): if not filenames: raise StopIteration filenames = list(filenames) unprocessed_keys = filenames[MAX_ITEMS_TO_...
Break get_images up to match get_tags
Break get_images up to match get_tags
Python
mit
ErinCall/catsnap,ErinCall/catsnap,ErinCall/catsnap
--- +++ @@ -6,7 +6,7 @@ MAX_ITEMS_TO_REQUEST = 99 -def get_images(filenames): +def get_image_items(filenames): if not filenames: raise StopIteration filenames = list(filenames) @@ -20,9 +20,6 @@ attributes_to_get=['tags', HASH_KEY]) response = dynamo.batch_get_item(batch_list...
39d370f314431e44e7eb978865be4f7696625eec
scraper/models.py
scraper/models.py
from django.db import models class Author(models.Model): name = models.TextField() def __str__(self): return self.name class Paper(models.Model): url = models.TextField() title = models.TextField() citations = models.IntegerField() abstract = models.TextField() journal = models....
from django.db import models class Author(models.Model): name = models.TextField() def __str__(self): return self.name class Paper(models.Model): url = models.TextField() title = models.TextField() citations = models.IntegerField() abstract = models.TextField() journal = models....
Order entries in table by year, then title
Order entries in table by year, then title
Python
mit
Spferical/cure-alzheimers-fund-tracker,Spferical/cure-alzheimers-fund-tracker,Spferical/cure-alzheimers-fund-tracker
--- +++ @@ -18,6 +18,8 @@ issue = models.IntegerField(null=True) year = models.IntegerField() authors = models.ManyToManyField(Author) + class Meta: + ordering = ['year', 'title'] class Project(models.Model): @@ -26,3 +28,5 @@ url = models.TextField() funding_amount = models.In...
9c3c5ede82b6672f23b5aec90cdbadb57ca8b92c
construi/cli.py
construi/cli.py
from .config import parse from .target import Target from .__version__ import __version__ from argparse import ArgumentParser import logging import os import sys def main(): setup_logging() parser = ArgumentParser(prog='construi', description='Run construi') parser.add_argument('target', metavar='TARG...
from .config import parse from .target import Target from .__version__ import __version__ from argparse import ArgumentParser import logging import os import sys def main(): setup_logging() parser = ArgumentParser(prog='construi', description='Run construi') parser.add_argument('target', metavar='TARG...
Add -T option to list available targets
Add -T option to list available targets
Python
apache-2.0
lstephen/construi
--- +++ @@ -17,14 +17,22 @@ parser.add_argument('target', metavar='TARGET', nargs='?') parser.add_argument('--basedir', metavar='DIR', default=os.getcwd()) parser.add_argument('--version', action='version', version=__version__) + parser.add_argument('-T', '--list-targets', action='store_true') ...
a754323facdb05b18d19a1a0365ad12e8c25ed06
ocradmin/core/tests/test_core.py
ocradmin/core/tests/test_core.py
""" Core tests. Test general environment. """ import subprocess as sp from django.test import TestCase from django.test.client import Client from django.contrib.auth.models import User from django.conf import settings class CoreTest(TestCase): def setUp(self): pass def tearDown(self): pass ...
""" Core tests. Test general environment. """ import subprocess as sp from django.test import TestCase from django.test.client import Client from django.contrib.auth.models import User from django.conf import settings class CoreTest(TestCase): def setUp(self): pass def tearDown(self): pass ...
Test the presence of various tools
Test the presence of various tools
Python
apache-2.0
vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium
--- +++ @@ -22,7 +22,32 @@ in usage info. Basically we want to make sure that the accuracy binary is available. """ - p = sp.Popen(["accuracy"], stderr=sp.PIPE) - self.assertRegexpMatches(p.communicate()[1], "^Usage") + stdout, stderr = self._run_cmd("accuracy") + ...
9c5c2f916f8f8fceb38848212d7c4d8883fd2aef
polling_stations/apps/api/mixins.py
polling_stations/apps/api/mixins.py
from rest_framework.decorators import list_route from rest_framework.pagination import LimitOffsetPagination from rest_framework.response import Response class LargeResultsSetPagination(LimitOffsetPagination): default_limit = 100 max_limit = 1000 class PollingEntityMixin(): pagination_class = LargeResu...
from rest_framework.decorators import list_route from rest_framework.pagination import LimitOffsetPagination from rest_framework.response import Response class LargeResultsSetPagination(LimitOffsetPagination): default_limit = 100 max_limit = 1000 class PollingEntityMixin(): pagination_class = LargeResu...
Return object not array when requesting single district/station
Return object not array when requesting single district/station If we are requesting a single polling station or district return an object instead of an array with length 1
Python
bsd-3-clause
DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
--- +++ @@ -30,6 +30,20 @@ ) return self.get_paginated_response(serializer.data) + if 'council_id' in request.query_params and ( + 'station_id' in request.query_params or + 'district_id' in request.query_params) and\ + len(queryse...
3d03959224de39f2c7d491bdac438c08e368fb6c
comics/comics/komistriper.py
comics/comics/komistriper.py
# encoding: utf-8 from comics.aggregator.crawler import NettserierCrawlerBase from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "Samtull" language = "no" url = "https://nettserier.no/aikomi/comic/" rights = "Emil Åslund" start_date = "2015-01-14" class Craw...
# encoding: utf-8 from comics.aggregator.crawler import NettserierCrawlerBase from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "Samtull" language = "no" url = "https://nettserier.no/aikomi/comic/" rights = "Emil Åslund" start_date = "2015-01-24" class Craw...
Correct start date for "Samtull"
Correct start date for "Samtull"
Python
agpl-3.0
jodal/comics,datagutten/comics,jodal/comics,jodal/comics,datagutten/comics,datagutten/comics,datagutten/comics,jodal/comics
--- +++ @@ -9,11 +9,11 @@ language = "no" url = "https://nettserier.no/aikomi/comic/" rights = "Emil Åslund" - start_date = "2015-01-14" + start_date = "2015-01-24" class Crawler(NettserierCrawlerBase): - history_capable_date = "2015-01-14" + history_capable_date = "2015-01-24" ti...
dcd39f2955cd80e3888458954a58203ae74dab71
cyder/base/eav/forms.py
cyder/base/eav/forms.py
from django import forms from django.core.exceptions import ValidationError from cyder.base.eav.constants import ATTRIBUTE_TYPES from cyder.base.eav.models import Attribute def get_eav_form(eav_model, entity_model): class EAVForm(forms.ModelForm): def __init__(self, *args, **kwargs): if 'inst...
from django import forms from django.core.exceptions import ValidationError from cyder.base.eav.constants import ATTRIBUTE_TYPES from cyder.base.eav.models import Attribute def get_eav_form(eav_model, entity_model): class EAVForm(forms.ModelForm): def __init__(self, *args, **kwargs): if 'inst...
Set EAV form class name to match EAV model name
Set EAV form class name to match EAV model name (for easier debugging, at least in theory)
Python
bsd-3-clause
murrown/cyder,akeym/cyder,OSU-Net/cyder,drkitty/cyder,drkitty/cyder,zeeman/cyder,drkitty/cyder,zeeman/cyder,drkitty/cyder,akeym/cyder,murrown/cyder,murrown/cyder,murrown/cyder,zeeman/cyder,zeeman/cyder,OSU-Net/cyder,OSU-Net/cyder,OSU-Net/cyder,akeym/cyder,akeym/cyder
--- +++ @@ -35,4 +35,6 @@ model = eav_model fields = ('entity', 'attribute_type', 'attribute', 'value') + EAVForm.__name__ = eav_model.__name__ + 'Form' + return EAVForm
43e43e9f342d69bd2b0652d833e204916517efe2
module_auto_update/migrations/10.0.2.0.0/pre-migrate.py
module_auto_update/migrations/10.0.2.0.0/pre-migrate.py
# -*- coding: utf-8 -*- # Copyright 2018 Tecnativa - Jairo Llopis # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). import logging from psycopg2 import IntegrityError from odoo.addons.module_auto_update.models.module_deprecated import \ PARAM_DEPRECATED _logger = logging.getLogger(__name__) def mi...
# -*- coding: utf-8 -*- # Copyright 2018 Tecnativa - Jairo Llopis # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). import logging from psycopg2 import IntegrityError from odoo.addons.module_auto_update.models.module_deprecated import \ PARAM_DEPRECATED _logger = logging.getLogger(__name__) def mi...
Rollback cursor if param exists
[FIX] module_auto_update: Rollback cursor if param exists Without this patch, when upgrading after you have stored the deprecated features parameter, the cursor became broken and no more migrations could happen. You got this error: Traceback (most recent call last): File "/usr/local/bin/odoo", line 6, in <mod...
Python
agpl-3.0
Vauxoo/server-tools,Vauxoo/server-tools,Vauxoo/server-tools
--- +++ @@ -12,10 +12,12 @@ def migrate(cr, version): """Autoenable deprecated behavior.""" try: - cr.execute( - "INSERT INTO ir_config_parameter (key, value) VALUES (%s, '1')", - (PARAM_DEPRECATED,) - ) + with cr.savepoint(): + cr.execute( + ...
f6f3c7a70ff2c47adc2525c0c5868debc7e78fdd
make_a_plea/settings/production.py
make_a_plea/settings/production.py
from .base import * import os DEBUG = False TEMPLATE_DEBUG = DEBUG GOOGLE_ANALYTICS_ID = "UA-53811587-1" DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['POSTGRES_DB'], 'USER': os.environ['POSTGRES_USER'], 'PASSWORD': os.environ.g...
from .base import * import os DEBUG = False TEMPLATE_DEBUG = DEBUG GOOGLE_ANALYTICS_ID = "UA-53811587-1" DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['POSTGRES_DB'], 'USER': os.environ['POSTGRES_USER'], 'PASSWORD': os.environ.g...
Update ALLOWED_HOSTS for move to service domain
Update ALLOWED_HOSTS for move to service domain
Python
mit
ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas
--- +++ @@ -28,7 +28,7 @@ INSTALLED_APPS += ('raven.contrib.django.raven_compat', ) -ALLOWED_HOSTS = ["www.makeaplea.justice.gov.uk", "www.service.justice.gov.uk" ] +ALLOWED_HOSTS = ["www.makeaplea.justice.gov.uk", "www.makeaplea.service.gov.uk"] # Enable CachedStaticFilesStorage for cache-busting assets STA...
505772740004ec8c73db49b7772e15d563a27b38
themint/__init__.py
themint/__init__.py
import os from flask import Flask import logging from raven.contrib.flask import Sentry from themint.health import Health app = Flask(__name__) app.config.from_object(os.environ.get('SETTINGS')) if not app.debug: app.logger.addHandler(logging.StreamHandler()) app.logger.setLevel(logging.INFO) if 'SENTRY_...
import os from flask import Flask import logging from raven.contrib.flask import Sentry from themint.health import Health app = Flask(__name__) app.config.from_object(os.environ.get('SETTINGS')) if not app.debug: app.logger.addHandler(logging.StreamHandler()) app.logger.setLevel(logging.INFO) if 'SENTRY_...
Set config logging in init to debug
Set config logging in init to debug
Python
mit
LandRegistry/mint-alpha,LandRegistry/mint-alpha
--- +++ @@ -18,7 +18,7 @@ if 'SENTRY_DSN' in os.environ: sentry = Sentry(app, dsn=os.environ['SENTRY_DSN']) -app.logger.info(app.config) +app.logger.debug(app.config) from themint.service import message_service Health(app, checks=[message_service.health])
82c31412190e42f98ce65d5ad1a6a9b8faad2cb6
lcd_ticker.py
lcd_ticker.py
#!/usr/bin/env python """Display stock quotes on LCD""" import ystockquote as y from lcd import lcd_string, tn symbols = ['AAPL', 'MSFT', 'F', 'T', 'KO', 'GOOG', 'SYK', 'DIS', 'GM', 'GE', 'BAC', 'IBM', 'C', 'AMZN', 'AET', 'DOW', 'INTC', 'PFE', 'MRK', 'RTN'] def compact_quote(symbol): symbo...
#!/usr/bin/env python """Display stock quotes on LCD""" import ystockquote as y from lcd import lcd_string, tn symbols = ['AAPL', 'MSFT', 'F', 'T', 'KO', 'GOOG', 'SYK', 'DIS', 'GM', 'GE', 'BAC', 'IBM', 'C', 'AMZN', 'AET', 'DOW', 'INTC', 'PFE', 'MRK', 'RTN'] def compact_quote(symbol): a = y...
Handle when N/A comes thru the quote.
Handle when N/A comes thru the quote.
Python
mit
zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie
--- +++ @@ -10,16 +10,31 @@ 'RTN'] def compact_quote(symbol): - symbol = 'SYK' a = y.get_all(symbol) - - L52 = int(round(float(a['fifty_two_week_low']), 0)) - P = round(float(a['price']), 1) - C = a['change'] - H52 = int(round(float(a['fifty_two_week_high']), 0)) - PE = round(flo...
b9dde5e9fc56feaea581cecca3f919f4e053044d
brumecli/config.py
brumecli/config.py
import os import yaml from subprocess import check_output, CalledProcessError from colors import red from jinja2 import Template class Config(): @staticmethod def load(config_file='brume.yml'): """Return the YAML configuration for a project based on the `config_file` template.""" template_fu...
import os import yaml from subprocess import check_output, CalledProcessError from colors import red from jinja2 import Template class Config(): @staticmethod def env(key): """Return the value of the `key` environment variable.""" try: return os.environ[key] except KeyErr...
Move template functions out of `Config.load()`
Move template functions out of `Config.load()`
Python
mit
flou/brume,geronimo-iia/brume
--- +++ @@ -9,37 +9,47 @@ class Config(): @staticmethod + def env(key): + """Return the value of the `key` environment variable.""" + try: + return os.environ[key] + except KeyError: + print(red('[ERROR] No environment variable with key {}'.format(key))) + ...
fe42da2e9c642c7e4f8b480012e9455ffcb294a0
openacademy/model/openacademy_course.py
openacademy/model/openacademy_course.py
# -*- coding: utf-8 -*- from openerp import fields, models ''' This module create model of Course ''' class Course(models.Model): ''' This class create model of Course ''' _name = 'openacademy.course' # Model odoo name name = fields.Char(string='Title', required=True) # Field reserved to iden...
# -*- coding: utf-8 -*- from openerp import api, fields, models ''' This module create model of Course ''' class Course(models.Model): ''' This class create model of Course ''' _name = 'openacademy.course' # Model odoo name name = fields.Char(string='Title', required=True) # Field reserved to...
Modify copy method into inherit
[REF] openacademy: Modify copy method into inherit
Python
apache-2.0
deivislaya/openacademy-project
--- +++ @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp import fields, models +from openerp import api, fields, models ''' This module create model of Course @@ -30,3 +30,19 @@ "The course title must be unique"), ] + @api.one # api.one send defaults params: cr, uid, id, context + ...
b27a09e67d737310ec419eb76a39e667316184f0
userprofile/forms.py
userprofile/forms.py
from datetime import datetime from django import forms from news.forms import MaterialFileWidget from .models import Profile class ProfileSearchForm(forms.Form): name = forms.CharField(max_length=200) class ProfileForm(forms.ModelForm): image = forms.FileField(required=False, widget=MaterialFileWidget) ...
from datetime import datetime, timedelta from django import forms from news.forms import MaterialFileWidget from .models import Profile class ProfileSearchForm(forms.Form): name = forms.CharField(max_length=200) class ProfileForm(forms.ModelForm): image = forms.FileField(required=False, widget=MaterialFi...
Add 24 hour waiting time for removing phone number after reservation
Add 24 hour waiting time for removing phone number after reservation
Python
mit
hackerspace-ntnu/website,hackerspace-ntnu/website,hackerspace-ntnu/website
--- +++ @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timedelta from django import forms @@ -20,13 +20,14 @@ def clean(self): cleaned_data = super().clean() - has_ongoing_or_future_reservations = self.user.reservations.filter( - end__gt=datetime....
b8a1e049024289a0665c5bff3ecdf60cf3e63825
typhon/spareice/__init__.py
typhon/spareice/__init__.py
# -*- coding: utf-8 -*- """All SPARE-ICE related modules.""" from typhon.spareice.collocations import * # noqa from typhon.spareice.common import * # noqa from typhon.spareice.datasets import * # noqa __all__ = [s for s in dir() if not s.startswith('_')]
# -*- coding: utf-8 -*- """All SPARE-ICE related modules.""" from typhon.spareice.array import * from typhon.spareice.collocations import * # noqa from typhon.spareice.common import * # noqa from typhon.spareice.datasets import * # noqa __all__ = [s for s in dir() if not s.startswith('_')]
Add array submodule to standard import
Add array submodule to standard import
Python
mit
atmtools/typhon,atmtools/typhon
--- +++ @@ -2,6 +2,7 @@ """All SPARE-ICE related modules.""" +from typhon.spareice.array import * from typhon.spareice.collocations import * # noqa from typhon.spareice.common import * # noqa from typhon.spareice.datasets import * # noqa
12b46a902f1596c0559e6e7d3faf6ea7b812a800
api/radar_api/tests/conftest.py
api/radar_api/tests/conftest.py
import string import random import pytest from radar_api.app import create_app from radar.database import db @pytest.fixture(scope='session') def app(): return create_app({ 'TESTING': True, 'SQLALCHEMY_DATABASE_URI': 'postgres://postgres@localhost/radar_test', 'SECRET_KEY': ''.join(rando...
import string import random import pytest from radar_api.app import create_app from radar.database import db @pytest.fixture(scope='session') def app(): return create_app({ 'TESTING': True, 'SQLALCHEMY_DATABASE_URI': 'postgres://postgres@localhost/radar_test', 'SECRET_KEY': ''.join(rando...
Add UKRDC_PATIENT_SEARCH_URL to test app config
Add UKRDC_PATIENT_SEARCH_URL to test app config
Python
agpl-3.0
renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar
--- +++ @@ -13,7 +13,8 @@ 'TESTING': True, 'SQLALCHEMY_DATABASE_URI': 'postgres://postgres@localhost/radar_test', 'SECRET_KEY': ''.join(random.sample(string.printable, 32)), - 'BASE_URL': 'http://localhost' + 'BASE_URL': 'http://localhost', + 'UKRDC_PATIENT_SEARCH_URL':...
7e60f9d7962b3795983fdf5af0605319b1447098
whack/operations.py
whack/operations.py
import os from whack.caching import DirectoryCacher, NoCachingStrategy import whack.builder def install(package, install_dir, caching, builder_uris, params): if caching.enabled: cacher = DirectoryCacher(os.path.expanduser("~/.cache/whack/builds")) else: cacher = NoCachingStrategy() ...
import os from whack.caching import HttpCacher, DirectoryCacher, NoCachingStrategy import whack.builder def install(package, install_dir, caching, builder_uris, params): if not caching.enabled: cacher = NoCachingStrategy() elif caching.http_cache_url is not None: # TODO: add DirectoryCacher in...
Implement HTTP caching when CLI option is set
Implement HTTP caching when CLI option is set
Python
bsd-2-clause
mwilliamson/whack
--- +++ @@ -1,13 +1,16 @@ import os -from whack.caching import DirectoryCacher, NoCachingStrategy +from whack.caching import HttpCacher, DirectoryCacher, NoCachingStrategy import whack.builder def install(package, install_dir, caching, builder_uris, params): - if caching.enabled: + if not caching.enabled...
73caeecd963326f4789eb3dc484e59ffb475e12f
blankspot_stats.py
blankspot_stats.py
#! /usr/bin/env python import MapGardening import optparse usage = "usage: %prog [options]" p = optparse.OptionParser(usage) p.add_option('--place', '-p', default="all" ) options, arguments = p.parse_args() possible_tables = [ 'hist_point', 'hist_poin...
#! /usr/bin/env python """ Calculate statistics for each study area, and prints results to stdout. All it prints is the number of blankspots, the number of v1 nodes, and the number of total nodes. Since I am no longer storing the blankspot information in the hist_point table itself, these stats are no longer very inf...
Add docstring, change tables searched
Add docstring, change tables searched
Python
mit
almccon/mapgardening,almccon/mapgardening,almccon/mapgardening,almccon/mapgardening
--- +++ @@ -1,4 +1,13 @@ #! /usr/bin/env python +""" +Calculate statistics for each study area, and prints results to stdout. + +All it prints is the number of blankspots, the number of v1 nodes, +and the number of total nodes. Since I am no longer storing the blankspot +information in the hist_point table itself, ...
b97842ecf1c8fa22b599353c1c7fe75fcf482702
tests/test_utils.py
tests/test_utils.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from modeltrans.manager import (split_translated_fieldname, transform_translatable_fields) from modeltrans.utils import build_localized_fieldname from tests.app.models import Blog class U...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from modeltrans.manager import transform_translatable_fields from modeltrans.utils import (build_localized_fieldname, split_translated_fieldname) from tests.app.models import Blog class Uti...
Use proper import from utils
Use proper import from utils
Python
bsd-3-clause
zostera/django-modeltrans,zostera/django-modeltrans
--- +++ @@ -3,9 +3,9 @@ from django.test import TestCase -from modeltrans.manager import (split_translated_fieldname, - transform_translatable_fields) -from modeltrans.utils import build_localized_fieldname +from modeltrans.manager import transform_translatable_fields +from modeltr...
a9d4fab047249fbf5db26385779902d0f7483057
qsimcirq/__init__.py
qsimcirq/__init__.py
from .qsim_circuit import * from .qsim_simulator import * from .qsimh_simulator import *
from .qsim_circuit import add_op_to_opstring, add_op_to_circuit, QSimCircuit from .qsim_simulator import QSimSimulatorState, QSimSimulatorTrialResult, QSimSimulator from .qsimh_simulator import QSimhSimulator
Replace star imports to fix mypy issue.
Replace star imports to fix mypy issue.
Python
apache-2.0
quantumlib/qsim,quantumlib/qsim,quantumlib/qsim,quantumlib/qsim
--- +++ @@ -1,5 +1,3 @@ -from .qsim_circuit import * -from .qsim_simulator import * -from .qsimh_simulator import * - - +from .qsim_circuit import add_op_to_opstring, add_op_to_circuit, QSimCircuit +from .qsim_simulator import QSimSimulatorState, QSimSimulatorTrialResult, QSimSimulator +from .qsimh_simulator import Q...
f5592efd0cf780c6e97483a16820f98478be8e3d
devil/devil/android/sdk/version_codes.py
devil/devil/android/sdk/version_codes.py
# Copyright 2015 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. """Android SDK version codes. http://developer.android.com/reference/android/os/Build.VERSION_CODES.html """ JELLY_BEAN = 16 JELLY_BEAN_MR1 = 17 JELLY_BEAN...
# Copyright 2015 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. """Android SDK version codes. http://developer.android.com/reference/android/os/Build.VERSION_CODES.html """ JELLY_BEAN = 16 JELLY_BEAN_MR1 = 17 JELLY_BEAN...
Add NOUGAT version code constant.
Add NOUGAT version code constant. Review-Url: https://codereview.chromium.org/2386453002
Python
bsd-3-clause
sahiljain/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,benschmaus/catapult,catapult-project/catapult-csm,benschmaus/catapult,sahiljain/catapult,sahiljain/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,benschmaus/catapult,benschmaus/catapult,sahiljain/catap...
--- +++ @@ -15,4 +15,5 @@ LOLLIPOP = 21 LOLLIPOP_MR1 = 22 MARSHMALLOW = 23 +NOUGAT = 24
881a57be20adb82eb7632bcd8282b0971c2793f7
test/test.py
test/test.py
#!/usr/bin/python import os import re import commands successRE = re.compile("Hello, GitHub!") testsPassed = 0 # Add more tests here tests = [ "bin/hello_c", "bin/hello_cpp", "java -cp bin hello", "python hello.py", "ruby hello.rb", "perl hello.pl", "sh hello.sh", "expect hello.tcl" ] def...
#!/usr/bin/python import os import re import commands successRE = re.compile("Hello, GitHub!") testsPassed = 0 # Add more tests here tests = [ "bin/hello_c", "bin/hello_cpp", "java -cp bin hello", "python hello.py", "ruby hello.rb", "perl hello.pl", "sh hello.sh", "tclsh hello.tcl" ] def ...
Use tclsh. Old habits die hard :)
Use tclsh. Old habits die hard :)
Python
mit
luke-ho/hello-github,luke-ho/hello-github,luke-ho/hello-github,luke-ho/hello-github,luke-ho/hello-github,luke-ho/hello-github,luke-ho/hello-github,luke-ho/hello-github,luke-ho/hello-github
--- +++ @@ -17,7 +17,7 @@ "ruby hello.rb", "perl hello.pl", "sh hello.sh", - "expect hello.tcl" + "tclsh hello.tcl" ] def run_test(test):
8dbf6f4c581430ae7393d1ed0c5f0b377ffebd7e
doc/examples/plot_match_face_template.py
doc/examples/plot_match_face_template.py
""" ================= Template Matching ================= In this example, we use template matching to identify the occurrence of an image patch (in this case, a sub-image centered on the camera man's head). Since there's only a single match, the maximum value in the `match_template` result` corresponds to the head lo...
""" ================= Template Matching ================= In this example, we use template matching to identify the occurrence of an image patch (in this case, a sub-image centered on the camera man's head). Since there's only a single match, the maximum value in the `match_template` result` corresponds to the head lo...
Fix shape unpacking ((height, width), not (w, h)).
Fix shape unpacking ((height, width), not (w, h)).
Python
bsd-3-clause
rjeli/scikit-image,Midafi/scikit-image,ofgulban/scikit-image,vighneshbirodkar/scikit-image,paalge/scikit-image,michaelpacer/scikit-image,chriscrosscutler/scikit-image,Hiyorimi/scikit-image,almarklein/scikit-image,paalge/scikit-image,emon10005/scikit-image,SamHames/scikit-image,emmanuelle/scikits.image,jwiggins/scikit-i...
--- +++ @@ -33,7 +33,7 @@ # highlight matched region xy = np.unravel_index(np.argmax(result), result.shape)[::-1] #-1 flips ij to xy -wface, hface = head.shape +hface, wface = head.shape rect = plt.Rectangle(xy, wface, hface, edgecolor='r', facecolor='none') ax2.add_patch(rect)
70863101a882eee0811460cf9bf0f8442d9b0775
djproxy/urls.py
djproxy/urls.py
from django.conf.urls import patterns from djproxy.views import HttpProxy def generate_routes(config): routes = [] for service_name, proxy_config in config.items(): ProxyClass = type( 'ProxyClass', (HttpProxy, ), {'base_url': proxy_config['base_url']} ) ...
import re from django.conf.urls import patterns, url from djproxy.views import HttpProxy def generate_routes(config): routes = () for service_name, proxy_config in config.items(): base_url = proxy_config['base_url'] prefix = proxy_config['prefix'] ProxyClass = type('ProxyClass', (Ht...
Return a `patterns` rather than a list of tuples
Return a `patterns` rather than a list of tuples
Python
mit
thomasw/djproxy
--- +++ @@ -1,17 +1,18 @@ -from django.conf.urls import patterns +import re + +from django.conf.urls import patterns, url + from djproxy.views import HttpProxy def generate_routes(config): - routes = [] + routes = () for service_name, proxy_config in config.items(): - ProxyClass = type( - ...
48ef416352870ae5c695ada006f1855d03d893df
dlexperiment.py
dlexperiment.py
class Experiment(object): def __init__(self, epochs=1): self.epochs = epochs def get_epochs(self): return self.epochs def train(self): raise NotImplementedError def test(self): raise NotImplementedError def set_loss(self): raise NotImplementedError de...
class Experiment(object): def __init__(self, model, optimizer, train_data, test_data, epochs=1): self.model = model self.optimizer = optimizer self.train_data = train_data self.test_data = test_data self.epochs = epochs self.loss = 0 self.current_epoch = 0 ...
Add necessary params to Experiment.
Add necessary params to Experiment.
Python
apache-2.0
sagelywizard/dlex
--- +++ @@ -1,9 +1,15 @@ class Experiment(object): - def __init__(self, epochs=1): + def __init__(self, model, optimizer, train_data, test_data, epochs=1): + self.model = model + self.optimizer = optimizer + self.train_data = train_data + self.test_data = test_data self.epo...
05e8170326c5aa2be48eee5f90ab5a3919775e01
io_EDM/__init__.py
io_EDM/__init__.py
bl_info = { 'name': "Import: .EDM model files", 'description': "Importing of .EDM model files", 'author': "Nicholas Devenish", 'version': (0,0,1), 'blender': (2, 78, 0), 'location': "File > Import/Export > .EDM Files", 'category': 'Import-Export', } try: import bpy def register(): from .io_oper...
bl_info = { 'name': "Import: .EDM model files", 'description': "Importing of .EDM model files", 'author': "Nicholas Devenish", 'version': (0,0,1), 'blender': (2, 78, 0), 'location': "File > Import/Export > .EDM Files", 'category': 'Import-Export', } try: import bpy def register(): from .io_oper...
Remove potential duplicate registration code
Remove potential duplicate registration code Was sometimes causing an error when importing the project
Python
mit
ndevenish/Blender_ioEDM,ndevenish/Blender_ioEDM
--- +++ @@ -19,8 +19,7 @@ rna_register() panels_register() importer_register() - bpy.utils.register_module(__name__) - + def unregister(): from .io_operators import unregister as importer_unregister from .rna import unregister as rna_unregister @@ -28,7 +27,6 @@ importer_unregi...
f8fe7041d209bb83e8483180824ffa73ceaa5f52
ckanny/__init__.py
ckanny/__init__.py
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ ckanny ~~~~~~ Miscellaneous CKAN utility scripts Examples: literal blocks:: python example_google.py Attributes: module_level_variable1 (int): Module level variables may be documented in """ from __future__ import ( absolute_import, divisi...
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ ckanny ~~~~~~ Miscellaneous CKAN utility scripts Examples: literal blocks:: python example_google.py Attributes: module_level_variable1 (int): Module level variables may be documented in """ from __future__ import ( absolute_import, divisi...
Move version num to own line
Move version num to own line
Python
mit
reubano/ckanny,reubano/ckanny
--- +++ @@ -23,11 +23,12 @@ from manager import Manager from . import datastorer, filestorer, package, hdx +__version__ = '0.17.0' + __title__ = 'ckanny' __author__ = 'Reuben Cummings' __description__ = 'Miscellaneous CKAN utility scripts' __email__ = 'reubano@gmail.com' -__version__ = '0.17.0' __license__ =...
899cf1aa2bc274602a7f9b2ef315ed67239f955a
examples/inprocess/embedded_qtconsole.py
examples/inprocess/embedded_qtconsole.py
import os from IPython.qt.console.qtconsoleapp import IPythonQtConsoleApp from IPython.qt.console.rich_ipython_widget import RichIPythonWidget from IPython.qt.inprocess import QtInProcessKernelManager from IPython.lib import guisupport from IPython.utils import path def print_process_id(): print 'Process ID is:'...
import os from IPython.qt.console.rich_ipython_widget import RichIPythonWidget from IPython.qt.inprocess import QtInProcessKernelManager from IPython.lib import guisupport def print_process_id(): print 'Process ID is:', os.getpid() def main(): # Print the ID of the main process print_process_id() ...
Revert config-loading change in embedding example.
Revert config-loading change in embedding example.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -1,10 +1,8 @@ import os -from IPython.qt.console.qtconsoleapp import IPythonQtConsoleApp from IPython.qt.console.rich_ipython_widget import RichIPythonWidget from IPython.qt.inprocess import QtInProcessKernelManager from IPython.lib import guisupport -from IPython.utils import path def print_pro...
ae324434fb00a46eae45d8218954950947bd636c
test_board_pytest.py
test_board_pytest.py
from board import Board def test_constructor(): board = Board(0,0) assert board.boardMatrix.size == 0 assert board.columns == 0 assert board.rows == 0 board = Board(5,5) assert board.boardMatrix.size == 25 assert board.columns == 5 assert board.rows == 5 def test_addPiece(): board...
from board import Board def test_constructor(): board = Board(0,0) assert board.boardMatrix.size == 0 assert board.columns == 0 assert board.rows == 0 board = Board(5,5) assert board.boardMatrix.size == 25 assert board.columns == 5 assert board.rows == 5 def test_addPiece(): board...
Add test checking board can't get overfilled.
Add test checking board can't get overfilled.
Python
mit
isaacarvestad/four-in-a-row
--- +++ @@ -24,5 +24,24 @@ assert board.addPiece(4, 1) == True assert board.boardMatrix.item((4,4)) == 1 - +""" +Tests that the board can be filled up completely +but no more. +""" +def test_addPieceMaxColumn(): + board = Board(5,5) + + # Fill board + for x in range(board.columns): + ...
9437b7fa2ef7f581968d6628561940dcb1e3f4ad
test_tws/__init__.py
test_tws/__init__.py
'''Unit test package for package "tws".''' __copyright__ = "Copyright (c) 2008 Kevin J Bluck" __version__ = "$Id$" import socket from tws import EWrapper def test_import(): '''Verify successful import of top-level "tws" package''' import tws assert tws class mock_wrapper(EWrapper): def __init__...
'''Unit test package for package "tws".''' __copyright__ = "Copyright (c) 2008 Kevin J Bluck" __version__ = "$Id$" import socket from tws import EWrapper def test_import(): '''Verify successful import of top-level "tws" package''' import tws assert tws class mock_wrapper(EWrapper): def __init__...
Implement a __getattr__() for mock_wrapper that just returns a lambda that records whatever call was attempted along with the call params.
Implement a __getattr__() for mock_wrapper that just returns a lambda that records whatever call was attempted along with the call params.
Python
bsd-3-clause
kbluck/pytws,kbluck/pytws
--- +++ @@ -16,11 +16,18 @@ class mock_wrapper(EWrapper): def __init__(self): + self.calldata = [] self.errors = [] def error(self, id, code, text): self.errors.append((id, code, text)) - + + def __getattr__(self, name): + # Any arbitrary unknown attribute...
87c6a222c7e979c2e44ecf152158bfcbe3b61d2a
calaccess_processed/managers.py
calaccess_processed/managers.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Custom managers for working with CAL-ACCESS processed data models. """ from __future__ import unicode_literals import os from django.db import models, connection class ProcessedDataManager(models.Manager): """ Utilities for loading raw CAL-ACCESS data into proc...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Custom managers for working with CAL-ACCESS processed data models. """ from __future__ import unicode_literals import os from django.db import models, connection class ProcessedDataManager(models.Manager): """ Utilities for loading raw CAL-ACCESS data into proc...
Fix path to .sql files
Fix path to .sql files
Python
mit
california-civic-data-coalition/django-calaccess-processed-data,california-civic-data-coalition/django-calaccess-processed-data
--- +++ @@ -18,7 +18,7 @@ @property def raw_data_load_query_path(self): return os.path.join( - 'calaccess_processed', + os.path.dirname(__file__), 'sql', 'load_%s_model.sql' % self.model._meta.model_name, )
334b3e1bbda58439020131fe178db1e72cbf662a
2/Solution.py
2/Solution.py
from ListNode import * class Solution(): def addTwoNumbers(self, l1, l2): current_node = ListNode(None) head_node = current_node carry = 0 p = l1 q = l2 while p or q or carry: x = y = 0 if p is not None: x = p.val ...
from ListNode import * class Solution(): def addTwoNumbers(self, l1, l2): head_node = current_node = ListNode(None) carry = 0 p = l1 q = l2 while p or q or carry: x = y = 0 if p is not None: x = p.val p = p.next ...
Refactor build and print method
Refactor build and print method
Python
mit
xliiauo/leetcode,xiao0720/leetcode,xiao0720/leetcode,xliiauo/leetcode,xliiauo/leetcode
--- +++ @@ -3,8 +3,7 @@ class Solution(): def addTwoNumbers(self, l1, l2): - current_node = ListNode(None) - head_node = current_node + head_node = current_node = ListNode(None) carry = 0 p = l1 q = l2 @@ -30,19 +29,23 @@ def buildTree(nums): - node = Li...
edb10e7ae1f428dade04a9976c3b3f985065d458
settings/__init__.py
settings/__init__.py
# -*- coding: utf-8 -*- from __future__ import print_function # Standard Library import sys if "test" in sys.argv: print("\033[1;91mNo django tests.\033[0m") print("Try: \033[1;33mpy.test\033[0m") sys.exit(0) from .common import * # noqa try: from .dev import * # noqa from .prod import * # no...
# -*- coding: utf-8 -*- from __future__ import print_function # Standard Library import sys if "test" in sys.argv: print("\033[1;91mNo django tests.\033[0m") print("Try: \033[1;33mpy.test\033[0m") sys.exit(0) from .common import * # noqa try: from .dev import * # noqa except ImportError: pass ...
Make sure prod.py is read in settings
Make sure prod.py is read in settings
Python
mit
hTrap/junction,farhaanbukhsh/junction,ChillarAnand/junction,farhaanbukhsh/junction,akshayaurora/junction,NabeelValapra/junction,pythonindia/junction,shashisp/junction,hTrap/junction,ChillarAnand/junction,shashisp/junction,nava45/junction,NabeelValapra/junction,shashisp/junction,farhaanbukhsh/junction,akshayaurora/junct...
--- +++ @@ -13,6 +13,10 @@ try: from .dev import * # noqa +except ImportError: + pass + +try: from .prod import * # noqa except ImportError: pass
b7db1d067c8efe86a6ab39a15fef0ab878656249
uber/__init__.py
uber/__init__.py
import os from decimal import Decimal from pockets.autolog import log from uber._version import __version__ # noqa: F401 def on_load(): """ Called by sideboard when the uber plugin is loaded. """ # Note: The following imports have side effects from uber import config # noqa: F401 from uber...
import os from decimal import Decimal from pockets.autolog import log from uber._version import __version__ # noqa: F401 def on_load(): """ Called by sideboard when the uber plugin is loaded. """ # Note: The following imports have side effects from uber import config # noqa: F401 from uber...
Revert "Don't make dirs on startup"
Revert "Don't make dirs on startup" This reverts commit 17243b31fc6c8d8f4bb0dc7e11e2601800e80bb0.
Python
agpl-3.0
magfest/ubersystem,magfest/ubersystem,magfest/ubersystem,magfest/ubersystem
--- +++ @@ -32,3 +32,12 @@ # NOTE: this will decrease the precision of some serialized decimal.Decimals sideboard.lib.serializer.register(Decimal, lambda n: float(n)) + +@sideboard.lib.on_startup +def create_data_dirs(): + from uber.config import c + + for directory in c.DATA_DIRS.values(): + if not ...
84bb5fbef5c98bdee344ac9d9739f035bd9a8f7b
tooz/drivers/zake.py
tooz/drivers/zake.py
# Copyright (c) 2013-2014 Mirantis Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright (c) 2013-2014 Mirantis Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Change inline docs about class fake storage variable
Change inline docs about class fake storage variable Adjust the docs to better describe why a fake storage class attribute exists and how it is used and what it represents compared to a real zookeeper setup. Change-Id: I255ccd83c8033266e9cee09a343468ae4e0f2bfd
Python
apache-2.0
citrix-openstack-build/tooz,openstack/tooz,citrix-openstack-build/tooz,openstack/tooz
--- +++ @@ -25,7 +25,11 @@ without the need of real ZooKeeper servers. """ - # here we need to pass *threading handler* as an argument + # NOTE(harlowja): this creates a shared backend 'storage' layer that + # would typically exist inside a zookeeper server, but since zake has + # no concept o...
40493966b989e73a07f6a33bd9e9497ae9ad9f3f
user/admin.py
user/admin.py
from django.contrib import admin from .models import User @admin.register(User) class UserAdmin(admin.ModelAdmin): # list view list_display = ( 'get_name', 'email', 'get_date_joined', 'is_staff', 'is_superuser') list_display_links = ('get_name', 'email') list_f...
from django.contrib import admin from .models import User @admin.register(User) class UserAdmin(admin.ModelAdmin): # list view list_display = ( 'get_name', 'email', 'get_date_joined', 'is_staff', 'is_superuser') list_display_links = ('get_name', 'email') list_f...
Remove password from UserAdmin fieldsets.
Ch23: Remove password from UserAdmin fieldsets.
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
--- +++ @@ -23,7 +23,7 @@ fieldsets = ( (None, { 'classes': ('wide',), - 'fields': ('email', 'password')}), + 'fields': ('email',)}), ('Permissions', { 'classes': ('collapse',), 'fields': (
178373851bcb66487b89224f19e3c3dc887a8f95
user_profile/urls.py
user_profile/urls.py
from django.conf.urls import include, url from django.contrib import admin from . import views urlpatterns = [ url(r'^', views.ViewView.as_view(), name='profile_own_view'), url(r'^edit/', views.EditView.as_view(), name='profile_edit'), url(r'^view/', views.ViewView.as_view(), name='profile_own_view'), ...
from django.conf.urls import include, url from django.contrib import admin from . import views urlpatterns = [ url(r'^$', views.ViewView.as_view(), name='profile_own_view'), url(r'^edit/', views.EditView.as_view(), name='profile_edit'), url(r'^view/', views.ViewView.as_view(), name='profile_own_view'), ...
Fix user_profile index page url-pattern
Fix user_profile index page url-pattern
Python
mit
DeWaster/Tviserrys,DeWaster/Tviserrys
--- +++ @@ -4,7 +4,7 @@ from . import views urlpatterns = [ - url(r'^', views.ViewView.as_view(), name='profile_own_view'), + url(r'^$', views.ViewView.as_view(), name='profile_own_view'), url(r'^edit/', views.EditView.as_view(), name='profile_edit'), url(r'^view/', views.ViewView.as_view(), name=...
01b15e2df498706a342009e300c77168032c7824
fbmsgbot/bot.py
fbmsgbot/bot.py
from http_client import HttpClient from models.message import ReceivedMessage class Bot(): """ @brief Facebook messenger bot """ def __init__(self, token): self.api_token = token self.client = HttpClient(token) def send_message(self, message, completion): def _completio...
from http_client import HttpClient from models.message import ReceivedMessage class Bot(): """ @brief Facebook messenger bot """ def __init__(self, token): self.api_token = token self.client = HttpClient(token) def send_message(self, message): response, error = self.cli...
Refactor send_message to remove completion block
Refactor send_message to remove completion block
Python
mit
ben-cunningham/python-messenger-bot,ben-cunningham/pybot
--- +++ @@ -11,20 +11,19 @@ self.api_token = token self.client = HttpClient(token) - def send_message(self, message, completion): + def send_message(self, message): - def _completion(response, error): - if error is not None: - print 'Error Encountered! Coul...
c209115dfb385cc167457aa87808b21a554f63cf
yvs/set_pref.py
yvs/set_pref.py
# yvs.set_pref # coding=utf-8 from __future__ import unicode_literals import json import sys import yvs.shared as shared # Parse pref set data from the given JSON string def parse_pref_set_data(pref_set_data_str): pref_set_data = json.loads(pref_set_data_str) return pref_set_data['pref'], pref_set_data['val...
# yvs.set_pref # coding=utf-8 from __future__ import unicode_literals import json import sys import yvs.shared as shared # Parse pref set data from the given JSON string def parse_pref_set_data(pref_set_data_str): pref_set_data = json.loads(pref_set_data_str) return pref_set_data['pref'], pref_set_data['val...
Revise "set preference" notification to be clearer
Revise "set preference" notification to be clearer Notification message originally read as though it were in the imperative when it is meant to be in past tense.
Python
mit
caleb531/youversion-suggest,caleb531/youversion-suggest
--- +++ @@ -32,7 +32,7 @@ pref, value = parse_pref_set_data(pref_set_data_str) set_pref(pref['id'], value['id']) - print('Set preferred {} to {}'.format( + print('Preferred {} set to {}'.format( pref['name'].lower(), value['name']).encode('utf-8'))
bf53b5a1e6562162ba9c3f89568ebfeb0124249d
athenet/layers/pool.py
athenet/layers/pool.py
"""Pooling layer.""" from theano.tensor.signal import downsample from athenet.layers import Layer class MaxPool(Layer): """Max-pooling layer.""" def __init__(self, poolsize, stride=None): """Create max-pooling layer. :poolsize: Pooling factor in the format (height, width). :stride: ...
"""Pooling layer.""" from theano.tensor.signal import downsample from athenet.layers import Layer class MaxPool(Layer): """Max-pooling layer.""" def __init__(self, poolsize, stride=None): """Create max-pooling layer. :poolsize: Pooling factor in the format (height, width). :stride: ...
Change stride semantic in MaxPool
Change stride semantic in MaxPool
Python
bsd-2-clause
heurezjusz/Athenet,heurezjusz/Athena
--- +++ @@ -15,13 +15,16 @@ """ super(MaxPool, self).__init__() self.poolsize = poolsize - self.stride = stride + if stride is None: + self.stride = poolsize + else: + self.stride = stride @property def output_shape(self): imag...
f56ed1c14b87e4d28e8e853cf64d91cf756576d1
dashboard/tasks.py
dashboard/tasks.py
import json import requests from bitcoinmonitor.celeryconfig import app from channels import Group app.conf.beat_schedule = { 'add-every-30-seconds': { 'task': 'dashboard.tasks.get_bitcoin_price', 'schedule': 6.0, 'args': ("dale",) }, } @app.task def get_bitcoin_price(arg): last...
import json from bitcoinmonitor.celeryconfig import app from channels import Group from .helpers import get_coin_price app.conf.beat_schedule = { 'get-bitcoin-price-every-five-seconds': { 'task': 'dashboard.tasks.get_bitcoin_price', 'schedule': 5.0, }, 'get-litecoin-price-every-five-secon...
Create another task to get the litecoin price
Create another task to get the litecoin price
Python
mit
alessandroHenrique/coinpricemonitor,alessandroHenrique/coinpricemonitor,alessandroHenrique/coinpricemonitor
--- +++ @@ -1,22 +1,31 @@ import json -import requests from bitcoinmonitor.celeryconfig import app from channels import Group +from .helpers import get_coin_price app.conf.beat_schedule = { - 'add-every-30-seconds': { + 'get-bitcoin-price-every-five-seconds': { 'task': 'dashboard.tasks.get_bi...
8d53a7478a139770d9ffb241ec2985123c403845
bookmarks/bookmarks/models.py
bookmarks/bookmarks/models.py
from __future__ import unicode_literals from django.db import models from django.utils import timezone from django.dispatch import receiver from django.conf import settings from taggit.managers import TaggableManager import requests class Bookmark(models.Model): title = models.CharField(max_length=200, blank=T...
from __future__ import unicode_literals from django.db import models from django.utils import timezone from django.dispatch import receiver from django.conf import settings from taggit.managers import TaggableManager import requests class Bookmark(models.Model): title = models.CharField(max_length=200, blank=T...
Remove attachment and use slack link unfurling
Remove attachment and use slack link unfurling
Python
mit
tom-henderson/bookmarks,tom-henderson/bookmarks,tom-henderson/bookmarks
--- +++ @@ -36,19 +36,13 @@ payload = { 'channel': "#bookmarks-dev", 'username': "Bookmarks", - 'text': "{}".format( - "Bookmark added:", + 'text': "<{}|{}>\n{}".format( + instance.url, + instance.title, + ...
b9e2418e90ba61905aacf37d254e2718124aba77
apps/graphing/tests/__init__.py
apps/graphing/tests/__init__.py
from basic import * # this generates a lot of non-exception generating errors # all the more incentive to fix these tests up sooner! # TODO - fix from views import *
from basic import * # this generates a lot of non-exception generating errors # all the more incentive to fix these tests up sooner! # TODO - fix # actually, to prevent getting swamped by email error # logs, i'll comment this out until it's fixed # from views import *
Disable graphing unit tests until we fix logger.error conditions
Disable graphing unit tests until we fix logger.error conditions
Python
bsd-3-clause
SEL-Columbia/commcare-hq,gmimano/commcaretest,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedso...
--- +++ @@ -2,4 +2,6 @@ # this generates a lot of non-exception generating errors # all the more incentive to fix these tests up sooner! # TODO - fix -from views import * +# actually, to prevent getting swamped by email error +# logs, i'll comment this out until it's fixed +# from views import *
abe9be5cc9789b7b1c091f08b23655f903d71fb2
apps/impala/src/impala/tests.py
apps/impala/src/impala/tests.py
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
Fix test looking for Impala icon
[impala] Fix test looking for Impala icon Use regexp in tests for matching white spaces and new lines
Python
apache-2.0
xiangel/hue,xiangel/hue,GitHublong/hue,kawamon/hue,kawamon/hue,rahul67/hue,cloudera/hue,lumig242/Hue-Integration-with-CDAP,dulems/hue,xq262144/hue,sanjeevtripurari/hue,epssy/hue,rahul67/hue,pwong-mapr/private-hue,x303597316/hue,ahmed-mahran/hue,epssy/hue,ChenJunor/hue,sanjeevtripurari/hue,abhishek-ch/hue,epssy/hue,xian...
--- +++ @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import re + from nose.tools import assert_true, assert_equal, assert_false from desktop.lib.django_test_util import make_logged_in_client @@ -26,8 +28,7 @@ def test_basic_flow...
4cfa123da2ccf416e2cb7e4bd9bc0c189a06081b
tests/__init__.py
tests/__init__.py
# Copyright 2013-2014 DataStax, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
# Copyright 2013-2014 DataStax, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
Add test logger if not added by nose
Add test logger if not added by nose
Python
apache-2.0
jregovic/python-driver,thobbs/python-driver,mobify/python-driver,stef1927/python-driver,stef1927/python-driver,coldeasy/python-driver,thelastpickle/python-driver,beobal/python-driver,bbirand/python-driver,HackerEarth/cassandra-python-driver,yi719/python-driver,HackerEarth/cassandra-python-driver,thelastpickle/python-dr...
--- +++ @@ -16,3 +16,8 @@ log = logging.getLogger() log.setLevel('DEBUG') +# if nose didn't already attach a log handler, add one here +if not log.handlers: + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s [%(module)s:%(lineno)s]: %(message)s')) + lo...
5841590444d202e6fb1fe8d7d937807ff9805677
astropy/table/tests/test_row.py
astropy/table/tests/test_row.py
import pytest import numpy as np from .. import Column, Row, Table class TestRow(): def setup_method(self, method): self.a = Column('a', [1, 2, 3]) self.b = Column('b', [4, 5, 6]) def test_subclass(self): """Row is subclass of ndarray and Row""" table = Table([self.a, self.b]...
import pytest import numpy as np from .. import Column, Row, Table class TestRow(): def setup_method(self, method): self.a = Column('a', [1, 2, 3]) self.b = Column('b', [4, 5, 6]) self.t = Table([self.a, self.b]) def test_subclass(self): """Row is subclass of ndarray and Row"...
Add a (skipped) test for row slice assignment.
Add a (skipped) test for row slice assignment. E. Bray requested the ability to assign to a table via a row with slice assignment, e.g. row = table[2] row[2:5] = [2, 3, 4] row[:] = 3 This does not currently work because np.void (which is what numpy returns for structured array row access) does not support slice assi...
Python
bsd-3-clause
bsipocz/astropy,lpsinger/astropy,MSeifert04/astropy,larrybradley/astropy,bsipocz/astropy,astropy/astropy,kelle/astropy,DougBurke/astropy,stargaser/astropy,dhomeier/astropy,lpsinger/astropy,pllim/astropy,dhomeier/astropy,DougBurke/astropy,lpsinger/astropy,astropy/astropy,tbabej/astropy,joergdietrich/astropy,funbaker/ast...
--- +++ @@ -8,16 +8,16 @@ def setup_method(self, method): self.a = Column('a', [1, 2, 3]) self.b = Column('b', [4, 5, 6]) + self.t = Table([self.a, self.b]) def test_subclass(self): """Row is subclass of ndarray and Row""" - table = Table([self.a, self.b]) - ...
7faeebea3186443055cd8dd5e02137339c048ac9
src/ggrc_basic_permissions/roles/ProgramOwner.py
src/ggrc_basic_permissions/roles/ProgramOwner.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> scope = "Private Program" description = """ User with authorization to peform administrative tasks such as associating users to roles within the scope of of a program.<br/><br/>When a person creates a ...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> scope = "Private Program" description = """ User with authorization to peform administrative tasks such as associating users to roles within the scope of of a program.<br/><br/>When a person creates a ...
Add support for creating snapshots for program owner
Add support for creating snapshots for program owner
Python
apache-2.0
AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core
--- +++ @@ -27,6 +27,7 @@ "Relationship", "UserRole", "Audit", + "Snapshot", ], "view_object_page": [ "__GGRC_ALL__"
ce95fbb56d7b331c0d1f55f6f6f8fc32b1e0f135
datastories/admin.py
datastories/admin.py
from models import Story, Page, StoryPage from django.contrib import admin admin.site.register(Story) admin.site.register(Page) admin.site.register(StoryPage)
from models import Story, Page, StoryPage from django.contrib import admin class StoryAdmin(admin.ModelAdmin): list_display = ('title', 'slug') prepopulated_fields = dict(slug=['title']) exclude = ('owner',) # Uncomment the stuff below to automate keeping creator as owner # and restricting editing to own...
Add a StoryAdmin to hide owner.
Add a StoryAdmin to hide owner. Also has comment out code for automating owner and restrincting editing of a story to its owner and superuser. We can decide whether we want it later (untested).
Python
bsd-3-clause
MAPC/masshealth,MAPC/masshealth
--- +++ @@ -1,6 +1,36 @@ from models import Story, Page, StoryPage from django.contrib import admin -admin.site.register(Story) +class StoryAdmin(admin.ModelAdmin): + list_display = ('title', 'slug') + prepopulated_fields = dict(slug=['title']) + exclude = ('owner',) + +# Uncomment the stuff below to aut...
c0f37084b587e142aaadfa2c803d40bb9c4e55fe
website/project/metadata/authorizers/__init__.py
website/project/metadata/authorizers/__init__.py
import json import os import logging logger = logging.getLogger(__name__) HERE = os.path.dirname(os.path.realpath(__file__)) groups = json.load( open( os.path.join(HERE, 'defaults.json') ) ) fp = None try: fp = open('{0}/local.json'.format(HERE)) except IOError: logger.info('No local.json fou...
import json import os import logging logger = logging.getLogger(__name__) HERE = os.path.dirname(os.path.realpath(__file__)) groups = None with open(os.path.join(HERE, 'defaults.json')) as defaults: groups = json.load(defaults) fp = None try: fp = open('{0}/local.json'.format(HERE)) except IOError: logg...
Use context manager for filepointer management
Use context manager for filepointer management
Python
apache-2.0
kch8qx/osf.io,wearpants/osf.io,pattisdr/osf.io,cwisecarver/osf.io,billyhunt/osf.io,crcresearch/osf.io,baylee-d/osf.io,mfraezz/osf.io,DanielSBrown/osf.io,cwisecarver/osf.io,TomHeatwole/osf.io,sloria/osf.io,cwisecarver/osf.io,brianjgeiger/osf.io,samanehsan/osf.io,asanfilippo7/osf.io,felliott/osf.io,jnayak1/osf.io,brandon...
--- +++ @@ -6,11 +6,10 @@ HERE = os.path.dirname(os.path.realpath(__file__)) -groups = json.load( - open( - os.path.join(HERE, 'defaults.json') - ) -) +groups = None +with open(os.path.join(HERE, 'defaults.json')) as defaults: + groups = json.load(defaults) + fp = None try: fp = open('{0}/...
dbd92c4fd50f81ee23387636fddff827da8fb7f3
dduplicated/cli.py
dduplicated/cli.py
# The client of DDuplicated tool. from os import path as opath, getcwd from pprint import pprint from sys import argv from dduplicated import commands def get_paths(params): paths = [] for param in params: path = opath.join(getcwd(), param) if opath.exists(path) and opath.isdir(path) and not opath.islink(path):...
# The client of DDuplicated tool. from os import path as opath, getcwd from pprint import pprint from sys import argv from dduplicated import commands def get_paths(params): paths = [] for param in params: path = opath.join(getcwd(), param) if opath.exists(path) and opath.isdir(path) and not opath.islink(path):...
Fix in output to help command.
Fix in output to help command. Signed-off-by: messiasthi <8562fc1efba9a3c99753c749fdfb1b6932b70fbf@gmail.com>
Python
mit
messiasthi/dduplicated-cli
--- +++ @@ -23,6 +23,8 @@ if len(params) == 0 or "help" in params: commands.help() + exit() + elif "detect" in params: processed_files = commands.detect(get_paths(params))
b4d9fb47e040b199f88cffb4a0b761c443f390b4
dduplicated/cli.py
dduplicated/cli.py
# The client of DDuplicated tool. from os import path as opath, getcwd from pprint import pprint from sys import argv from dduplicated import commands def get_paths(params): paths = [] for param in params: path = opath.join(getcwd(), param) if opath.exists(path) and opath.isdir(path) and not opath.islink(path): ...
# The client of DDuplicated tool. from os import path as opath, getcwd from pprint import pprint from sys import argv from dduplicated import commands def get_paths(params): paths = [] for param in params: path = opath.join(getcwd(), param) if opath.exists(path) and opath.isdir(path) and not opath.islink(path):...
Update in output to terminal.
Update in output to terminal. Signed-off-by: messiasthi <8562fc1efba9a3c99753c749fdfb1b6932b70fbf@gmail.com>
Python
mit
messiasthi/dduplicated-cli
--- +++ @@ -2,6 +2,7 @@ from os import path as opath, getcwd from pprint import pprint from sys import argv + from dduplicated import commands def get_paths(params): @@ -33,6 +34,7 @@ else: commands.help() + exit() if len(processed_files) > 0: pprint(processed_files)
44e50483a4ba9a4c47ee092d8d807930340c4e8e
testClient.py
testClient.py
#!/usr/bin/env python """ Binary memcached test client. Copyright (c) 2007 Dustin Sallings <dustin@spy.net> """ import sys import socket import random import struct from testServer import REQ_MAGIC_BYTE, PKT_FMT, MIN_RECV_PACKET if __name__ == '__main__': s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
#!/usr/bin/env python """ Binary memcached test client. Copyright (c) 2007 Dustin Sallings <dustin@spy.net> """ import sys import socket import random import struct from testServer import REQ_MAGIC_BYTE, PKT_FMT, MIN_RECV_PACKET, EXTRA_HDR_FMTS from testServer import CMD_SET, CMD_ADD, CMD_REPLACE if __name__ == '_...
Allow mutation commands from the test client.
Allow mutation commands from the test client.
Python
mit
dustin/memcached-test
--- +++ @@ -10,21 +10,32 @@ import random import struct -from testServer import REQ_MAGIC_BYTE, PKT_FMT, MIN_RECV_PACKET +from testServer import REQ_MAGIC_BYTE, PKT_FMT, MIN_RECV_PACKET, EXTRA_HDR_FMTS +from testServer import CMD_SET, CMD_ADD, CMD_REPLACE if __name__ == '__main__': + s=socket.socket(socke...
a0db97549a64595cb30554ccb583f928f4ad430d
api/models.py
api/models.py
import json from django.db import models import requests from Suchary.settings import GCM_API_KEY class Device(models.Model): registration_id = models.TextField() android_id = models.TextField(unique=True) alias = models.TextField(blank=True) version = models.CharField(max_length=20) model = mod...
import json from django.db import models import requests from Suchary.settings import GCM_API_KEY class Device(models.Model): registration_id = models.TextField() android_id = models.TextField(unique=True) alias = models.TextField(blank=True) version = models.CharField(max_length=20) model = mod...
Fix Device model, not needed to set last_seen on creation
Fix Device model, not needed to set last_seen on creation
Python
mit
jchmura/suchary-django,jchmura/suchary-django,jchmura/suchary-django
--- +++ @@ -16,7 +16,7 @@ type = models.CharField(max_length=20) active = models.BooleanField(default=True) last_used = models.DateTimeField(auto_now=True) - last_seen = models.DateTimeField() + last_seen = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=T...
83c5cc34539f68360cbab585af9465e95f3ec592
tensorbayes/__init__.py
tensorbayes/__init__.py
from . import layers from . import utils from . import nputils from . import tbutils from . import distributions from .utils import FileWriter from .tbutils import function
import sys from . import layers from . import utils from . import nputils from . import tbutils from . import distributions from .utils import FileWriter from .tbutils import function if 'ipykernel' in sys.argv[0]: from . import nbutils
Add nbutils import to base import
Add nbutils import to base import
Python
mit
RuiShu/tensorbayes
--- +++ @@ -1,3 +1,4 @@ +import sys from . import layers from . import utils from . import nputils @@ -5,3 +6,6 @@ from . import distributions from .utils import FileWriter from .tbutils import function + +if 'ipykernel' in sys.argv[0]: + from . import nbutils
e5812200c68a720345310e9a14ffa2a1a8f849e0
arg-reader.py
arg-reader.py
#!/usr/bin/env python3 # References: # http://docs.python.org/3.3/library/argparse.html?highlight=argparse#argparse # http://bip.weizmann.ac.il/course/python/PyMOTW/PyMOTW/docs/argparse/index.html import argparse def main(): ''' For help, use argument -h $ ./arg-reader.py -h To specify an argument, p...
#!/usr/bin/env python3 # References: # http://docs.python.org/3.3/library/argparse.html?highlight=argparse#argparse # http://bip.weizmann.ac.il/course/python/PyMOTW/PyMOTW/docs/argparse/index.html # http://stackoverflow.com/questions/3853722/python-argparse-how-to-insert-newline-the-help-text import argparse from arg...
Format description to multiple lines using RawTextHelpFormatter.
Format description to multiple lines using RawTextHelpFormatter. Reference: # http://stackoverflow.com/questions/3853722/python-argparse-how-to-insert-newline-the-help-text
Python
mit
beepscore/argparse
--- +++ @@ -3,23 +3,26 @@ # References: # http://docs.python.org/3.3/library/argparse.html?highlight=argparse#argparse # http://bip.weizmann.ac.il/course/python/PyMOTW/PyMOTW/docs/argparse/index.html +# http://stackoverflow.com/questions/3853722/python-argparse-how-to-insert-newline-the-help-text import argpars...
39c4d50b08f92a5d76ac5864e13a3427e7dfd86a
app/accounts/tests/test_models.py
app/accounts/tests/test_models.py
from django.contrib.auth.models import User from django.db import IntegrityError from django.test import TestCase from app.accounts.models import UserProfile class UserProfileTest(TestCase): """Test UserProfile model""" def setUp(self): self.user = User.objects.create(username='frank', password='sec...
from django.contrib.auth.models import User from django.db import IntegrityError from django.test import TestCase from app.accounts.models import UserProfile class UserProfileTest(TestCase): """Test UserProfile model""" def setUp(self): self.user = User.objects.create(username='frank', password='sec...
Add test for creating profile on user creation
Add test for creating profile on user creation
Python
mit
teamtaverna/core
--- +++ @@ -10,9 +10,11 @@ def setUp(self): self.user = User.objects.create(username='frank', password='secret') - UserProfile.objects.create(user=self.user) def test_user_can_only_have_one_profile_entry(self): profile = UserProfile(user=self.user, custom_auth_id='134664323567')...
4007508e10d730068e7f0a2ded0a7403525051a4
checklisthq/checklisthq/urls.py
checklisthq/checklisthq/urls.py
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^login/$', 'django.contrib.auth.views.login'), url(r'^users/new$', 'main.views.new_user', name="new_user"), url(r'^...
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^login/$', 'django.contrib.auth.views.login'), url(r'^users/new$', 'main.views.new_user', name="new_user"), url(r'^...
Reorder URLs, catchall at the end
Reorder URLs, catchall at the end
Python
agpl-3.0
checklisthq/checklisthq.com,checklisthq/checklisthq.com
--- +++ @@ -8,7 +8,6 @@ url(r'^login/$', 'django.contrib.auth.views.login'), url(r'^users/new$', 'main.views.new_user', name="new_user"), url(r'^logout/$', 'django.contrib.auth.views.logout_then_login'), - url(r'^.*$', 'main.views.home', name='home'), # url(r'^checklisthq/', include('checklisth...
265f36fb7fac426d662fbdebf29e8aad01e257d2
flask_oauthlib/utils.py
flask_oauthlib/utils.py
# coding: utf-8 import base64 from flask import request, Response from oauthlib.common import to_unicode, bytes_type def extract_params(): """Extract request params.""" uri = request.url http_method = request.method headers = dict(request.headers) if 'wsgi.input' in headers: del headers['...
# coding: utf-8 import base64 from flask import request, Response from oauthlib.common import to_unicode, bytes_type def extract_params(): """Extract request params.""" uri = request.url http_method = request.method headers = dict(request.headers) if 'wsgi.input' in headers: del headers['...
Fix to_bytes when text is None
Fix to_bytes when text is None
Python
bsd-3-clause
tonyseek/flask-oauthlib,auerj/flask-oauthlib,icook/flask-oauthlib,RealGeeks/flask-oauthlib,Fleurer/flask-oauthlib,CoreyHyllested/flask-oauthlib,huxuan/flask-oauthlib,landler/flask-oauthlib,lepture/flask-oauthlib,lepture/flask-oauthlib,tonyseek/flask-oauthlib,CommonsCloud/CommonsCloud-FlaskOAuthlib,brightforme/flask-oau...
--- +++ @@ -21,6 +21,8 @@ def to_bytes(text, encoding='utf-8'): """Make sure text is bytes type.""" + if not text: + return text if not isinstance(text, bytes_type): text = text.encode(encoding) return text
c480ed20fd5b7c5d53b4f0112feed801cd99ef9c
tests/test_data_prep.py
tests/test_data_prep.py
import os import pandas as pd import numpy.testing as npt from gypsy import DATA_DIR from gypsy.data_prep import prep_standtable def test_prep_standtable(): data_file_name = 'raw_standtable.csv' plot_data = pd.read_csv(os.path.join(DATA_DIR, data_file_name)) expected_data_path = os.path.join( DAT...
import os import pandas as pd import numpy.testing as npt from gypsy import DATA_DIR from gypsy.data_prep import prep_standtable def test_prep_standtable(): data_file_name = 'raw_standtable.csv' plot_data = pd.read_csv(os.path.join(DATA_DIR, data_file_name)) expected_data_path = os.path.join( DAT...
Use allclose for dataprep test
Use allclose for dataprep test
Python
mit
tesera/pygypsy,tesera/pygypsy
--- +++ @@ -17,8 +17,10 @@ expected = pd.read_csv(expected_data_path, index_col=0) assert isinstance(result, pd.DataFrame) - assert npt.assert_almost_equal( - expected.values, result.values, decimal=3 + assert npt.assert_allclose( + expected.values, result.values, + rtol=0.01, a...
07455e5821d21c988c7c5fcda9345e99355eb4e7
redash/__init__.py
redash/__init__.py
import json import urlparse from flask import Flask, make_response from flask.ext.restful import Api from flask_peewee.db import Database import redis from redash import settings, utils __version__ = '0.3.2' app = Flask(__name__, template_folder=settings.STATIC_ASSETS_PATH, static_folder=sett...
import json import urlparse from flask import Flask, make_response from flask.ext.restful import Api from flask_peewee.db import Database import redis from redash import settings, utils __version__ = '0.3.2' app = Flask(__name__, template_folder=settings.STATIC_ASSETS_PATH, static_folder=sett...
Use database number from redis url if available.
Use database number from redis url if available.
Python
bsd-2-clause
chriszs/redash,imsally/redash,44px/redash,guaguadev/redash,denisov-vlad/redash,rockwotj/redash,44px/redash,rockwotj/redash,getredash/redash,ninneko/redash,akariv/redash,amino-data/redash,akariv/redash,imsally/redash,EverlyWell/redash,getredash/redash,easytaxibr/redash,M32Media/redash,vishesh92/redash,ninneko/redash,get...
--- +++ @@ -33,7 +33,11 @@ redis_url = urlparse.urlparse(settings.REDIS_URL) -redis_connection = redis.StrictRedis(host=redis_url.hostname, port=redis_url.port, db=0, password=redis_url.password) +if redis_url.path: + redis_db = redis_url.path[1] +else: + redis_db = 0 +redis_connection = redis.StrictRedis(...
4139dafb967c61ac8d10b3b9fa8d64c8c079bfa2
scripts/png2raw.py
scripts/png2raw.py
#!/usr/bin/env python import Image import logging import sys def main(argv): pngFileName = sys.argv[1] baseFileName, _ = pngFileName.rsplit('.') rawFileName = '%s.raw' % baseFileName palFileName = '%s.pal' % baseFileName image = Image.open(pngFileName) with open(palFileName, 'w') as palFile: pal = ...
#!/usr/bin/env python import Image import argparse import os def main(): parser = argparse.ArgumentParser( description='Converts input image to raw image and palette data.') parser.add_argument('-f', '--force', action='store_true', help='If output files exist, the tool will overwrite them.') parser....
Add cmdline options parser and a sanity check.
Add cmdline options parser and a sanity check.
Python
artistic-2.0
cahirwpz/demoscene,cahirwpz/demoscene,cahirwpz/demoscene,cahirwpz/demoscene
--- +++ @@ -1,30 +1,47 @@ #!/usr/bin/env python import Image -import logging -import sys +import argparse +import os -def main(argv): - pngFileName = sys.argv[1] - baseFileName, _ = pngFileName.rsplit('.') +def main(): + parser = argparse.ArgumentParser( + description='Converts input image to raw image ...
3fe8498b8599238fd18b8f96edff438e1f569f48
sheldon/storage.py
sheldon/storage.py
# -*- coding: utf-8 -*- """ Interface to Redis-storage. @author: Seva Zhidkov @contact: zhidkovseva@gmail.com @license: The MIT license Copyright (C) 2015 """ from .utils import logger # We will catch all import exceptions in bot.py from redis import StrictRedis class Storage: def __init__(self, bot): ...
# -*- coding: utf-8 -*- """ Interface to Redis-storage. @author: Seva Zhidkov @contact: zhidkovseva@gmail.com @license: The MIT license Copyright (C) 2015 """ from .utils import logger # We will catch all import exceptions in bot.py from redis import StrictRedis class Storage: def __init__(self, bot): ...
Fix typo in redis error message
Fix typo in redis error message
Python
mit
lises/sheldon
--- +++ @@ -40,7 +40,7 @@ ) ) except Exception as error: - logger.error_log_message('Error while connection Redis:') + logger.error_log_message('Error while connecting Redis:') logger.error_log_messa...
f1b1542b28b83f7adabbadc7e2932ed8b42aa8c3
main/_config.py
main/_config.py
import os import inspect # Flask DEBUG = True # Amazon S3 Settings AWS_KEY = '' AWS_SECRET_KEY = '' AWS_BUCKET = 'www.vpr.net' AWS_DIRECTORY = 'sandbox/app/' SOUNDCLOUD_API = { "client_id": "", "client_secret": "", "username": "", "password": ""} SOUNDCLOUD_NUM_TRACKS = 5 # Cache Settings (units in seconds) ...
import os import inspect # Flask DEBUG = True # Amazon S3 Settings AWS_KEY = '' AWS_SECRET_KEY = '' AWS_BUCKET = 'www.vpr.net' AWS_DIRECTORY = 'sandbox/app/' SOUNDCLOUD_API = { "client_id": "", "client_secret": "", "username": "", "password": ""} SOUNDCLOUD_NUM_TRACKS = 10 # Cache Settings (units in seconds)...
Increase number of SoundCloud episodes pulled in
Increase number of SoundCloud episodes pulled in This is related to the fact that unpublished episodes still pull through.
Python
apache-2.0
vprnet/EOTS-iframe-widget,vprnet/EOTS-iframe-widget,vprnet/EOTS-iframe-widget
--- +++ @@ -15,7 +15,7 @@ "client_secret": "", "username": "", "password": ""} -SOUNDCLOUD_NUM_TRACKS = 5 +SOUNDCLOUD_NUM_TRACKS = 10 # Cache Settings (units in seconds) STATIC_EXPIRES = 60 * 24 * 3600
3c4f7906f98e6dfb9afe6993bee993ed05b969f3
apps/splash/views.py
apps/splash/views.py
import datetime from django.shortcuts import render from apps.splash.models import SplashEvent, SplashYear def index(request): # I'm really sorry ... splash_year = SplashYear.objects.get(start_date__gt=str(datetime.date.today() - datetime.timedelta(180))) return render(request, 'splash/base.html', {'splas...
import datetime from django.shortcuts import render from apps.splash.models import SplashEvent, SplashYear def index(request): # I'm really sorry ... splash_year = SplashYear.objects.get(start_date__gt=str(datetime.date.today() - datetime.timedelta(180))) return render(request, 'splash/base.html', {'splas...
Add method for merging duplicated events
Add method for merging duplicated events
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
--- +++ @@ -7,3 +7,16 @@ # I'm really sorry ... splash_year = SplashYear.objects.get(start_date__gt=str(datetime.date.today() - datetime.timedelta(180))) return render(request, 'splash/base.html', {'splash_year': splash_year }) + + +# And I'm really sorry for this ... +def _merge_events(splash_events):...
7b108ec9392c70113a5f5bf04e104de1fe123815
autosort/wrapping.py
autosort/wrapping.py
def _dynamic_wrap(items, limit): scores, trace = [0], [] for j in range(len(items)): best, psum, index = 0, limit, -1 for i in reversed(range(j + 1)): psum -= items[i] score = scores[i] + psum ** 2 if i == j or score < best and psum >= 0: best ...
def _dynamic_wrap(items, limit): scores, trace = [0], [] for j in range(len(items)): best, psum, index = float('inf'), limit, -1 for i in reversed(range(j + 1)): psum -= items[i] score = scores[i] + psum ** 2 if score < best and (psum >= 0 or i == j): ...
Make it clearer that exactly one item allows psum < 0
Make it clearer that exactly one item allows psum < 0
Python
mit
fbergroth/autosort
--- +++ @@ -1,11 +1,11 @@ def _dynamic_wrap(items, limit): scores, trace = [0], [] for j in range(len(items)): - best, psum, index = 0, limit, -1 + best, psum, index = float('inf'), limit, -1 for i in reversed(range(j + 1)): psum -= items[i] score = scores[i...
e0797f6dbefea651420f474940963b470a0931fd
test/functional/test_framework/txtools.py
test/functional/test_framework/txtools.py
from .cdefs import MIN_TX_SIZE, MAX_TXOUT_PUBKEY_SCRIPT from .mininode import CTransaction, FromHex, ToHex, CTxOut from .script import OP_RETURN, CScript import random from binascii import hexlify, unhexlify # Pad outputs until it reaches at least min_size def pad_tx(tx, min_size=None): if min_size is None: ...
from .cdefs import MIN_TX_SIZE, MAX_TXOUT_PUBKEY_SCRIPT from .mininode import CTransaction, FromHex, ToHex, CTxOut from .script import OP_RETURN, CScript import random from binascii import hexlify, unhexlify # Pad outputs until it reaches at least min_size def pad_tx(tx, min_size=None): if min_size is None: ...
Fix pad_tx off by one error + nits
Fix pad_tx off by one error + nits Summary: See title Test Plan: test_runner.py Reviewers: deadalnix, schancel, #bitcoin_abc Reviewed By: schancel, #bitcoin_abc Subscribers: teamcity Differential Revision: https://reviews.bitcoinabc.org/D2096
Python
mit
Bitcoin-ABC/bitcoin-abc,cculianu/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,cculianu/bitcoin-abc,cculianu/bitcoin-abc,ftrader-bitcoinabc/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,ftrader-bitcoinabc/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,cculianu/bitcoin-abc,ftrader-bitcoinabc/bitcoin-abc,Bitcoin-ABC/bitcoin-abc...
--- +++ @@ -23,18 +23,17 @@ tx.vout.append(CTxOut(0, CScript([OP_RETURN]))) else: padding = random.randrange( - 1 << 8 * padding_len - 1, 1 << 8 * padding_len) + 1 << 8 * padding_len - 2, 1 << 8 * padding_len - 1) tx.vout.append( ...
bdcecb3c96cef5b663b1ada22efa952b0882f1f0
spacy/tests/regression/test_issue600.py
spacy/tests/regression/test_issue600.py
from __future__ import unicode_literals from ...tokens import Doc from ...vocab import Vocab def test_issue600(): doc = Doc(Vocab(tag_map={'NN': {'pos': 'NOUN'}}), words=['hello']) doc[0].tag_ = u'NN'
from __future__ import unicode_literals from ...tokens import Doc from ...vocab import Vocab from ...attrs import POS def test_issue600(): doc = Doc(Vocab(tag_map={'NN': {'pos': 'NOUN'}}), words=['hello']) doc[0].tag_ = u'NN'
Add import in regression test
Add import in regression test
Python
mit
Gregory-Howard/spaCy,spacy-io/spaCy,raphael0202/spaCy,explosion/spaCy,oroszgy/spaCy.hu,Gregory-Howard/spaCy,banglakit/spaCy,banglakit/spaCy,raphael0202/spaCy,honnibal/spaCy,aikramer2/spaCy,recognai/spaCy,Gregory-Howard/spaCy,Gregory-Howard/spaCy,explosion/spaCy,recognai/spaCy,recognai/spaCy,oroszgy/spaCy.hu,recognai/sp...
--- +++ @@ -1,6 +1,7 @@ from __future__ import unicode_literals from ...tokens import Doc from ...vocab import Vocab +from ...attrs import POS def test_issue600():
1f3183acbe50df32d76d1cc0cb71b4cd9afdaa79
controller/__init__.py
controller/__init__.py
# -*- coding: utf-8 -*- import sys __version__ = '0.6.0' FRAMEWORK_NAME = 'RAPyDo' # PROJECT_YAML_SPECSDIR = 'specs' COMPOSE_ENVIRONMENT_FILE = '.env' SUBMODULES_DIR = 'submodules' PLACEHOLDER = '#@$%-REPLACE-#@%$-ME-#@$%' ################## # NOTE: telling the app if testing or not # http://j.mp/2uifoza TESTING = ...
# -*- coding: utf-8 -*- import sys __version__ = '0.5.1' FRAMEWORK_NAME = 'RAPyDo' # PROJECT_YAML_SPECSDIR = 'specs' COMPOSE_ENVIRONMENT_FILE = '.env' SUBMODULES_DIR = 'submodules' PLACEHOLDER = '#@$%-REPLACE-#@%$-ME-#@$%' ################## # NOTE: telling the app if testing or not # http://j.mp/2uifoza TESTING = ...
Fix version with last package
Fix version with last package
Python
mit
rapydo/do
--- +++ @@ -2,7 +2,7 @@ import sys -__version__ = '0.6.0' +__version__ = '0.5.1' FRAMEWORK_NAME = 'RAPyDo' # PROJECT_YAML_SPECSDIR = 'specs'
ff13cc4b7ef29c4454abb41b8e9a525d12c9ff7d
tailorscad/tests/test_arg_parser.py
tailorscad/tests/test_arg_parser.py
import unittest from tailorscad.arg_parser import parse_args class TestArgParser(unittest.TestCase): def test_parse_args_none(self): args = [] argv = [] args = parse_args(argv) self.assertFalse(args) def test_parse_args_inknown(self): args = [] argv = ['...
import unittest from tailorscad.arg_parser import parse_args class TestArgParser(unittest.TestCase): def test_parse_args_none(self): args = [] argv = [] args = parse_args(argv) self.assertFalse(args.config) def test_parse_args_inknown(self): args = [] ar...
Fix unit tests for arg_parser
Fix unit tests for arg_parser
Python
mit
savorywatt/tailorSCAD
--- +++ @@ -13,7 +13,7 @@ args = parse_args(argv) - self.assertFalse(args) + self.assertFalse(args.config) def test_parse_args_inknown(self): @@ -22,7 +22,7 @@ args = parse_args(argv) - self.assertFalse(args) + self.assertFalse(args.config) def tes...
ccbd25f196453f4c7b61fa4e69d192d7b96595e2
remo/remozilla/tests/__init__.py
remo/remozilla/tests/__init__.py
import datetime from django.utils.timezone import utc import factory from factory import fuzzy from remo.profiles.tests import UserFactory from remo.remozilla.models import Bug from remo.remozilla.tasks import COMPONENTS CHANGE_DT = datetime.datetime(2012, 1, 1, tzinfo=utc) CREATION_DT = datetime.datetime(2011, 1, ...
import datetime from django.utils.timezone import utc import factory from factory import fuzzy from remo.profiles.tests import UserFactory from remo.remozilla.models import Bug from remo.remozilla.tasks import COMPONENTS CHANGE_DT = datetime.datetime(2012, 1, 1, tzinfo=utc) CREATION_DT = datetime.datetime(2011, 1, ...
Add default RESOLUTION and STATUS in BugFactory.
Add default RESOLUTION and STATUS in BugFactory. * Fixes failing tests.
Python
bsd-3-clause
tsmrachel/remo,johngian/remo,mozilla/remo,tsmrachel/remo,flamingspaz/remo,abdullah2891/remo,johngian/remo,chirilo/remo,akatsoulas/remo,flamingspaz/remo,Mte90/remo,mozilla/remo,tsmrachel/remo,Mte90/remo,johngian/remo,chirilo/remo,abdullah2891/remo,johngian/remo,akatsoulas/remo,mozilla/remo,abdullah2891/remo,abdullah2891...
--- +++ @@ -12,10 +12,6 @@ CHANGE_DT = datetime.datetime(2012, 1, 1, tzinfo=utc) CREATION_DT = datetime.datetime(2011, 1, 1, tzinfo=utc) DUE_DT = datetime.datetime(2013, 1, 1, tzinfo=utc) -RESOLUTION = ['FIXED', 'INVALID', 'WONTFIX', 'DUPLICATE', 'WORKSFORME', - 'INCOMPLETE'] -STATUS = ['UNCONFIRMED',...
f17310e0fcf5d7ea7ceab2b9243f106eb1222b69
desertbot/datastore.py
desertbot/datastore.py
import json import os class DataStore(object): def __init__(self, storagePath="desertbot_data.json"): self.storagePath = storagePath self.data = None self.load() def load(self): if not os.path.exists(self.storagePath): self.data = {} self.save() ...
import json import os class DataStore(object): def __init__(self, storagePath="desertbot_data.json"): self.storagePath = storagePath self.data = {} self.load() def load(self): if not os.path.exists(self.storagePath): self.save() return with open...
Allow using DataStore class as if dict
Allow using DataStore class as if dict
Python
mit
DesertBot/DesertBot
--- +++ @@ -5,12 +5,11 @@ class DataStore(object): def __init__(self, storagePath="desertbot_data.json"): self.storagePath = storagePath - self.data = None + self.data = {} self.load() def load(self): if not os.path.exists(self.storagePath): - self.data...
4ef159ae6d45bc546f1c84b57416fc2b87eecc33
thrift/test/py/adapter_for_tests.py
thrift/test/py/adapter_for_tests.py
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
Convert type check targets in thrift/test to use configuration
Convert type check targets in thrift/test to use configuration Summary: Migrating buck integration to use configurations. For more information about this migration, please see: https://fb.workplace.com/groups/295311271085134/permalink/552700215346237/ Reviewed By: dkgi Differential Revision: D30708385 fbshipit-sou...
Python
apache-2.0
facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift
--- +++ @@ -21,9 +21,13 @@ Type = Dict[str, int] @staticmethod + # pyre-fixme[3]: Return type must be annotated. + # pyre-fixme[2]: Parameter must be annotated. def from_thrift(thrift_value): return {k: v for k, v in thrift_value.__dict__.items() if v is not None} @staticmethod ...