commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
e885f0557037d2df03453961acd1c40b7c44c069
timesheet_activity_report/__openerp__.py
timesheet_activity_report/__openerp__.py
# -*- coding: utf-8 -*- # © 2015 Elico corp (www.elico-corp.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Timesheet Activities Report', 'version': '8.0.1.1.0', 'category': 'Human Resources', 'depends': [ 'project_timesheet', 'project_issue_...
# -*- coding: utf-8 -*- # © 2015 Elico corp (www.elico-corp.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Timesheet Activities Report', 'version': '8.0.1.1.0', 'category': 'Human Resources', 'depends': [ 'project_timesheet', 'project_issue_...
Add support key for Travis LINT check
Add support key for Travis LINT check
Python
agpl-3.0
Elico-Corp/odoo-addons,Elico-Corp/odoo-addons,Elico-Corp/odoo-addons
60d6f3ea5495503584220c60353df833304aff53
linkedin_scraper/parsers/base.py
linkedin_scraper/parsers/base.py
from os import path import linkedin_scraper class BaseParser: @staticmethod def get_data_dir(): return path.abspath(path.join(linkedin_scraper.__file__, '../..', 'data')) @staticmethod def normalize_lines(lines): return set(line.lower().strip() for line in...
import logging from os import path import linkedin_scraper logger = logging.getLogger(__name__) class BaseParser: @staticmethod def get_data_dir(): return path.abspath(path.join(linkedin_scraper.__file__, '../..', 'data')) @staticmethod def normalize_lines(lines)...
Handle non existing data files in BaseParser.
Handle non existing data files in BaseParser.
Python
mit
nihn/linkedin-scraper,nihn/linkedin-scraper
5dacf6d2e2e74b783e39641674fc0f8e718618b3
imager/ImagerProfile/models.py
imager/ImagerProfile/models.py
from django.db import models # from django.conf import settings # Create your models here. class ImagerProfile(models.Model): profile_picture = models.ImageField() # user = models.OneToOneField(settings.AUTH_USER_MODEL) phone_number = models.CharField(max_length=15) # X(XXX) XXX-XXXX birthday = mod...
from django.db import models from django.contrib.auth.models import User # class ImagerProfile(models.Manager): # pass class ImagerProfile(models.Model): user = models.OneToOneField(User) # objects = ImagerProfile() profile_picture = models.ImageField(null=True) phone_number = models.CharField(...
Change ImagerProfile model privacy booleans to default of False, profile_picture to nullable
Change ImagerProfile model privacy booleans to default of False, profile_picture to nullable
Python
mit
nbeck90/django-imager,nbeck90/django-imager
1f03af4a3ceda754dc0196c49f295fc683bd6e5a
opps/core/cache/models.py
opps/core/cache/models.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.db import models class ModelCaching(models.Model): pass
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.db import models from django.core.cache import cache from .managers import CacheManager ModelBase = type(models.Model) class MetaCaching(ModelBase): def __new__(*args, **kwargs): new_class = ModelBase.__new__(*args, **kwargs) new_manager...
Create MetaCaching, ModelBase for core cache
Create MetaCaching, ModelBase for core cache
Python
mit
YACOWS/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,opps/opps
8b6d10e8339510bbc745a3167fd1d5a60422b370
tests/test_planner.py
tests/test_planner.py
import cutplanner import unittest class TestPlanner(unittest.TestCase): def setUp(self): sizes = [50, 80, 120] needed = [10, 25, 75] loss = 0.25 self.planner = cutplanner.Planner(sizes, needed, loss) def test_largest_stock(self): largest = self.planner.largest_stock ...
import cutplanner import unittest class TestPlanner(unittest.TestCase): def setUp(self): sizes = [50, 80, 120] needed = [10, 25, 75] loss = 0.25 self.planner = cutplanner.Planner(sizes, needed, loss) def test_init_pieces(self): self.assertEqual(len(self.planner.pieces_...
Add tests for planner init
Add tests for planner init
Python
mit
alanc10n/py-cutplanner
88245d2cd66c75e1096eec53882a2750826f03be
zerver/migrations/0108_fix_default_string_id.py
zerver/migrations/0108_fix_default_string_id.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-08-24 02:39 from django.db import migrations from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor from django.db.migrations.state import StateApps def fix_realm_string_ids(apps, schema_editor): # type: (StateApps, DatabaseSchem...
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-08-24 02:39 from django.db import migrations from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor from django.db.migrations.state import StateApps def fix_realm_string_ids(apps, schema_editor): # type: (StateApps, DatabaseSchem...
Fix deactivated realm corner cases with 0108.
migrations: Fix deactivated realm corner cases with 0108. Previously the default-string-id migration would not correctly handle ignoring deactivated realms.
Python
apache-2.0
hackerkid/zulip,dhcrzf/zulip,tommyip/zulip,jackrzhang/zulip,kou/zulip,brockwhittaker/zulip,hackerkid/zulip,brainwane/zulip,andersk/zulip,mahim97/zulip,brainwane/zulip,punchagan/zulip,rht/zulip,timabbott/zulip,mahim97/zulip,punchagan/zulip,synicalsyntax/zulip,brainwane/zulip,synicalsyntax/zulip,brockwhittaker/zulip,rht/...
464fc1e9a905df25b12975422d5b48cf8286306c
custom/icds_reports/utils/migrations.py
custom/icds_reports/utils/migrations.py
from __future__ import absolute_import from __future__ import unicode_literals from corehq.sql_db.operations import RawSQLMigration def get_view_migrations(): sql_views = [ 'awc_location_months.sql', 'agg_awc_monthly.sql', 'agg_ccs_record_monthly.sql', 'agg_child_health_monthly.sq...
from __future__ import absolute_import from __future__ import unicode_literals from corehq.sql_db.operations import RawSQLMigration def get_view_migrations(): sql_views = [ 'awc_location_months.sql', 'agg_awc_monthly.sql', 'agg_ccs_record_monthly.sql', 'agg_child_health_monthly.sq...
Add aww_incentive report view to migration util
Add aww_incentive report view to migration util
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
4c50bcf29dc397405b21322c6115a00c1df56559
indico/modules/events/views.py
indico/modules/events/views.py
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
Add view for the events modules
Add view for the events modules
Python
mit
indico/indico,ThiefMaster/indico,ThiefMaster/indico,pferreir/indico,DirkHoffmann/indico,indico/indico,indico/indico,DirkHoffmann/indico,DirkHoffmann/indico,OmeGak/indico,mvidalgarcia/indico,indico/indico,OmeGak/indico,pferreir/indico,mic4ael/indico,mic4ael/indico,ThiefMaster/indico,OmeGak/indico,pferreir/indico,OmeGak/...
2dda63a9a71764c5f4b5e6d15372dd2eb296ef4b
nflpool/services/activeplayers_service.py
nflpool/services/activeplayers_service.py
import requests from nflpool.data.dbsession import DbSessionFactory from nflpool.data.activeplayers import ActiveNFLPlayers import nflpool.data.secret as secret from requests.auth import HTTPBasicAuth from nflpool.data.seasoninfo import SeasonInfo class ActivePlayersService: @classmethod def add_active_nflpla...
import requests from nflpool.data.dbsession import DbSessionFactory from nflpool.data.activeplayers import ActiveNFLPlayers import nflpool.data.secret as secret from requests.auth import HTTPBasicAuth from nflpool.data.seasoninfo import SeasonInfo class ActivePlayersService: @classmethod def add_active_nflpla...
Remove TODO - complete as of last commit
Remove TODO - complete as of last commit Season object is passed to the table update
Python
mit
prcutler/nflpool,prcutler/nflpool
1b68bd3c5cb81f06ccc4dcf69baeafca1104ed37
nirikshak/workers/files/ini.py
nirikshak/workers/files/ini.py
# Copyright 2017 <thenakliman@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
# Copyright 2017 <thenakliman@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
Support for python3.5 has been added for configparser
Support for python3.5 has been added for configparser
Python
apache-2.0
thenakliman/nirikshak,thenakliman/nirikshak
7a1056e7c929b07220fdefb45e282104ee192836
github3/__init__.py
github3/__init__.py
""" github3 ======= See http://github3py.rtfd.org/ for documentation. :copyright: (c) 2012 by Ian Cordasco :license: Modified BSD, see LICENSE for more details """ __title__ = 'github3' __author__ = 'Ian Cordasco' __license__ = 'Modified BSD' __copyright__ = 'Copyright 2012 Ian Cordasco' __version__ = '0.1a3' from...
""" github3 ======= See http://github3py.rtfd.org/ for documentation. :copyright: (c) 2012 by Ian Cordasco :license: Modified BSD, see LICENSE for more details """ __title__ = 'github3' __author__ = 'Ian Cordasco' __license__ = 'Modified BSD' __copyright__ = 'Copyright 2012 Ian Cordasco' __version__ = '0.1a3' from...
Add more objects to the default namespace.
Add more objects to the default namespace. Ease of testing, I'm not exactly a fan of polluting it though. Might rework this later.
Python
bsd-3-clause
wbrefvem/github3.py,itsmemattchung/github3.py,christophelec/github3.py,sigmavirus24/github3.py,icio/github3.py,h4ck3rm1k3/github3.py,krxsky/github3.py,jim-minter/github3.py,ueg1990/github3.py,agamdua/github3.py,degustaf/github3.py,balloob/github3.py
689980daec94683557113163d0b7384c33904bbf
app/aandete/model/model.py
app/aandete/model/model.py
from google.appengine.ext import db class Recipe(db.Model): title = db.StringProperty(required=True) text = db.TextProperty() ingredients = db.TextProperty() tags = db.StringListProperty() photo = db.BlobProperty() owner = db.UserProperty(auto_current_user_add=True, required=True) class Cookb...
from google.appengine.ext import db class Recipe(db.Model): title = db.StringProperty(required=True) text = db.TextProperty() ingredients = db.TextProperty() tags = db.StringListProperty() photo = db.BlobProperty() owner = db.UserProperty(auto_current_user_add=True, required=True) @classm...
Allow string IDs in get_by_id.
Allow string IDs in get_by_id.
Python
bsd-3-clause
stefanv/aandete,stefanv/aandete
a047fe167a598adfccc70268a01829b8bcdb11e1
python/test/clienttest.py
python/test/clienttest.py
import molequeue client = molequeue.Client() client.connect_to_server('MoleQueue') job_request = molequeue.JobRequest() job_request.queue = 'salix' job_request.program = 'sleep (testing)' client.submit_job_request(job_request)
import unittest import molequeue class TestClient(unittest.TestCase): def test_submit_job_request(self): client = molequeue.Client() client.connect_to_server('MoleQueue') job_request = molequeue.JobRequest() job_request.queue = 'salix' job_request.program = 'sleep (testing)' client.submit...
Convert test case to Python unittest.TestCase
Convert test case to Python unittest.TestCase Use Python's testing framework Change-Id: I924f329c43294bb1fbb395a7bb19bcaf06ea9385
Python
bsd-3-clause
OpenChemistry/molequeue,OpenChemistry/molequeue,OpenChemistry/molequeue
82b45c3ec1344bed87ac7d572d82f43a4320492c
craigomatic/wsgi.py
craigomatic/wsgi.py
""" WSGI config for craigomatic project. It exposes the WSGI callable as a module-level variable named ``application``. """ import os from os.path import abspath, dirname from sys import path from django.core.wsgi import get_wsgi_application SITE_ROOT = dirname(dirname(abspath(__file__))) path.append(SITE_ROOT) os....
""" WSGI config for craigomatic project. It exposes the WSGI callable as a module-level variable named ``application``. """ import os from os.path import abspath, dirname from sys import path from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise SITE_ROOT = dirname(dirname...
Integrate whitenoise with the Django application
Integrate whitenoise with the Django application This allows Django to serve static files in production.
Python
mit
rgreinho/craigomatic,rgreinho/craigomatic,rgreinho/craigomatic,rgreinho/craigomatic
61ebf3fd3a80dc5573cb65c4250ede591d161b9e
pyaavso/formats/visual.py
pyaavso/formats/visual.py
from __future__ import unicode_literals import pyaavso class VisualFormatWriter(object): """ A class responsible for writing observation data in AAVSO `Visual File Format`_. The API here mimics the ``csv`` module in Python standard library. .. _`Visual File Format`: http://www.aavso.org/aavso-v...
from __future__ import unicode_literals import pyaavso class VisualFormatWriter(object): """ A class responsible for writing observation data in AAVSO `Visual File Format`_. The API here mimics the ``csv`` module in Python standard library. .. _`Visual File Format`: http://www.aavso.org/aavso-v...
Write date format in header.
Write date format in header.
Python
mit
zsiciarz/pyaavso
81b9a8179ef4db9857b4d133769c92c7b1972ee6
pysuru/tests/test_base.py
pysuru/tests/test_base.py
# coding: utf-8 from pysuru.base import BaseAPI, ObjectMixin def test_baseapi_headers_should_return_authorization_header(): api = BaseAPI(None, 'TOKEN') assert {'Authorization': 'bearer TOKEN'} == api.headers def test_build_url_should_return_full_api_endpoint(): api = BaseAPI('http://example.com/', None...
# coding: utf-8 from pysuru.base import BaseAPI, ObjectMixin def test_baseapi_headers_should_return_authorization_header(): api = BaseAPI(None, 'TOKEN') assert {'Authorization': 'bearer TOKEN'} == api.headers def test_baseapi_conn_should_return_same_object(): api = BaseAPI(None, None) obj1 = api.con...
Add test to ensure only one conn object is created
Add test to ensure only one conn object is created
Python
mit
rcmachado/pysuru
d32710e53b89e1377a64427f934053c3b0d33802
bin/intake_multiprocess.py
bin/intake_multiprocess.py
import json import logging import argparse import numpy as np import emission.pipeline.scheduler as eps if __name__ == '__main__': try: intake_log_config = json.load(open("conf/log/intake.conf", "r")) except: intake_log_config = json.load(open("conf/log/intake.conf.sample", "r")) intake_l...
import json import logging import argparse import numpy as np import emission.pipeline.scheduler as eps if __name__ == '__main__': try: intake_log_config = json.load(open("conf/log/intake.conf", "r")) except: intake_log_config = json.load(open("conf/log/intake.conf.sample", "r")) parser =...
Use a separate log file for the public launcher data
Use a separate log file for the public launcher data Log files are not thread-safe
Python
bsd-3-clause
sunil07t/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server
f0371f68fc0ece594710ad9dbbdbfdab00a22e49
migrations/003_add_capped_collections.py
migrations/003_add_capped_collections.py
""" Add capped collections for real time data """ import logging log = logging.getLogger(__name__) def up(db): capped_collections = [ "fco_realtime_pay_legalisation_post", "fco_realtime_pay_legalisation_drop_off", "fco_realtime_pay_register_birth_abroad", "fco_realtime_pay_registe...
""" Add capped collections for real time data """ import logging log = logging.getLogger(__name__) def up(db): capped_collections = [ "fco_pay_legalisation_post_realtime", "fco_pay_legalisation_drop_off_realtime", "fco_pay_register_birth_abroad_realtime", "fco_pay_register_death_a...
Make realtim fco bucket names match format of others
Make realtim fco bucket names match format of others
Python
mit
alphagov/backdrop,alphagov/backdrop,alphagov/backdrop
db7583b62aad9eaf10c67e89cd46087b36c77d81
scikits/image/io/setup.py
scikits/image/io/setup.py
#!/usr/bin/env python from scikits.image._build import cython import os.path base_path = os.path.abspath(os.path.dirname(__file__)) def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs config = Configuration('io', parent_package, t...
#!/usr/bin/env python from scikits.image._build import cython import os.path base_path = os.path.abspath(os.path.dirname(__file__)) def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs config = Configuration('io', parent_package, t...
Move plugin tests to io/tests.
io: Move plugin tests to io/tests.
Python
bsd-3-clause
ClinicalGraphics/scikit-image,emmanuelle/scikits.image,juliusbierk/scikit-image,Hiyorimi/scikit-image,almarklein/scikit-image,newville/scikit-image,SamHames/scikit-image,ClinicalGraphics/scikit-image,almarklein/scikit-image,youprofit/scikit-image,jwiggins/scikit-image,Britefury/scikit-image,pratapvardhan/scikit-image,c...
43238d0de9e4d6d4909b4d67c17449a9599e5dac
mygpo/web/templatetags/time.py
mygpo/web/templatetags/time.py
from datetime import time from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ from django import template register = template.Library() @register.filter def sec_to_time(sec): """ Converts seconds to a time object >>> t = sec_to_time(1000) >>> (t.hour, t.minu...
from datetime import time from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ from django import template register = template.Library() @register.filter def sec_to_time(sec): """ Converts seconds to a time object >>> t = sec_to_time(1000) >>> (t.hour, t.minu...
Format short durations without "0 hours"
Format short durations without "0 hours"
Python
agpl-3.0
gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo
e6210d4d3fcdff4c9b4b22946e03062e01efd830
pika/adapters/__init__.py
pika/adapters/__init__.py
from asyncore_connection import AsyncoreConnection from blocking_connection import BlockingConnection from tornado_connection import TornadoConnection
# ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0 # # The contents of this file are subject to the Mozilla Public License # Version 1.1 (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.mozilla.org/MPL/ # # Software distri...
Add the license block and BaseConnection
Add the license block and BaseConnection
Python
bsd-3-clause
skftn/pika,shinji-s/pika,Zephor5/pika,zixiliuyue/pika,reddec/pika,pika/pika,renshawbay/pika-python3,vrtsystems/pika,knowsis/pika,fkarb/pika-python3,jstnlef/pika,Tarsbot/pika,vitaly-krugl/pika,hugoxia/pika,benjamin9999/pika
f7b1d233ed39eed24e3c1489738df01f700112e3
tensorflow/contrib/tensorrt/__init__.py
tensorflow/contrib/tensorrt/__init__.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Move the pylint message and fix comment length
Move the pylint message and fix comment length
Python
apache-2.0
paolodedios/tensorflow,lukeiwanski/tensorflow,alshedivat/tensorflow,kobejean/tensorflow,frreiss/tensorflow-fred,Xeralux/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,alsrgv/tensorflow,nburn42/tensorflow,meteorcloudy/tensorflow,Xeralux/tensorflow,paolodedios/tensorflow,ppwwyyxx/tensorflow,gaut...
dd21586d910dded2932f96b98d6d0588c18d2f58
great_expectations/cli/cli_logging.py
great_expectations/cli/cli_logging.py
import logging import warnings warnings.filterwarnings("ignore") ### # REVIEWER NOTE: THE ORIGINAL IMPLEMENTATION WAS HEAVY HANDED AND I BELIEVE WAS A TEMPORARY WORKAROUND. # PLEASE CAREFULLY REVIEW TO ENSURE REMOVING THIS DOES NOT AFFECT DESIRED BEHAVIOR ### logger = logging.getLogger("great_expectations.cli") de...
import logging import warnings warnings.filterwarnings("ignore") ### # REVIEWER NOTE: THE ORIGINAL IMPLEMENTATION WAS HEAVY HANDED AND I BELIEVE WAS A TEMPORARY WORKAROUND. # PLEASE CAREFULLY REVIEW TO ENSURE REMOVING THIS DOES NOT AFFECT DESIRED BEHAVIOR ### logger = logging.getLogger("great_expectations.cli") de...
Set level on module logger instead
Set level on module logger instead
Python
apache-2.0
great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations
25f26842b8371b13b3fc9f4abf12dfba0b0408bc
shapely/tests/__init__.py
shapely/tests/__init__.py
# package from test_doctests import test_suite
from unittest import TestSuite import test_doctests, test_prepared def test_suite(): suite = TestSuite() suite.addTest(test_doctests.test_suite()) suite.addTest(test_prepared.test_suite()) return suite
Integrate tests of prepared geoms into main test suite.
Integrate tests of prepared geoms into main test suite. git-svn-id: 1a8067f95329a7fca9bad502d13a880b95ac544b@1508 b426a367-1105-0410-b9ff-cdf4ab011145
Python
bsd-3-clause
mindw/shapely,mindw/shapely,mouadino/Shapely,mouadino/Shapely,abali96/Shapely,jdmcbr/Shapely,abali96/Shapely,jdmcbr/Shapely
4fc803a61b7c6322b079554bfec52b34b130b810
config/urls.py
config/urls.py
"""wuppdays URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
"""yunity URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-base...
Fix config to use yunity_swagger
Fix config to use yunity_swagger
Python
agpl-3.0
yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core
356cb63327ce578d31a0c0ee5201423a8ed0e9d2
wensleydale/cli.py
wensleydale/cli.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import json import click from wensleydale import parser @click.command() @click.argument('path', type=str) @click.argument('query', type=str) @click.version_option() def main(path, query, level=None, version=None): ''' Mr Wen...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import json import click from wensleydale import parser @click.command() @click.argument('path', type=click.Path(exists=True)) @click.argument('query', type=str) @click.version_option() def main(path, query, level=None, version=None)...
Add file path existince checking
Add file path existince checking
Python
mit
RishiRamraj/wensleydale
7eff20d706eb35513d8d1f420e59879e80400417
pseudon/ast_translator.py
pseudon/ast_translator.py
from ast import AST import yaml class ASTTranslator: def __init__(self, tree): self.tree = tree def translate(self): return yaml.dump({'type': 'program', 'code': []})
import ast import yaml class ASTTranslator: def __init__(self, tree): self.tree = tree def translate(self): return yaml.dump(self._translate_node(self.tree)) def _translate_node(self, node): if isinstance(node, ast.AST): return getattr('_translate_%s' % type(node).__...
Add a basic ast translator
Add a basic ast translator
Python
mit
alehander42/pseudo-python
df027db957b38656e3acf42d6065af34509ea053
project/api/managers.py
project/api/managers.py
# Django from django.contrib.auth.models import BaseUserManager class UserManager(BaseUserManager): def create_user(self, email, password='', person, **kwargs): user = self.model( email=email, password='', person=person, is_active=True, **kwargs...
# Django from django.contrib.auth.models import BaseUserManager class UserManager(BaseUserManager): def create_user(self, email, password='', **kwargs): user = self.model( email=email, password='', is_active=True, **kwargs ) user.save(using=...
Revert "Update manager for Person requirement"
Revert "Update manager for Person requirement" This reverts commit 1f7c21280b7135f026f1ff807ffc50c97587f6fd.
Python
bsd-2-clause
barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore
33a1df824ef3b339874e0a24d1c84ad05ebcb9e1
cvui.py
cvui.py
# This is a documentation block with several lines # so I can test how it works. import cv2 def main(): print("cvui main"); if __name__ == '__main__': main() def random_number_generator(arg1, arg2): """ Summary line. Extended description of function. Parameters ---------- arg1 : ...
# This is a documentation block with several lines # so I can test how it works. import cv2 def main(): print("cvui main") if __name__ == '__main__': main() def random_number_generator(arg1, arg2): """ Summary line. Extended description of function. Parameters ---------- arg1 : i...
Add draft of printf in python
Add draft of printf in python
Python
mit
Dovyski/cvui,Dovyski/cvui,Dovyski/cvui
9ecf7d7aa6f6d3a80ba2a327ee5b402b665a3e0c
test/tests/nodalkernels/high_order_time_integration/convergence_study.py
test/tests/nodalkernels/high_order_time_integration/convergence_study.py
import os import csv from collections import deque import matplotlib import numpy as np import matplotlib.pyplot as plt schemes = ['implicit-euler', 'bdf2', 'crank-nicolson', 'dirk', 'explicit-euler', 'rk-2'] scheme_errors = {} # Generate list of dts dt = 1.0 dts = [] for i in range(0,10): dts.append(dt) dt = d...
import os import csv from collections import deque import matplotlib import numpy as np import matplotlib.pyplot as plt schemes = ['implicit-euler', 'bdf2', 'crank-nicolson', 'dirk'] scheme_errors = {} # Generate list of dts dt = 1.0 dts = [] for i in range(0,5): dts.append(dt) dt = dt / 2.0 for scheme in sche...
Test fewer dts, only test implicit methods.
Test fewer dts, only test implicit methods. The timesteps used here are not valid for explicit methods.
Python
lgpl-2.1
jessecarterMOOSE/moose,backmari/moose,giopastor/moose,andrsd/moose,jiangwen84/moose,sapitts/moose,Chuban/moose,friedmud/moose,milljm/moose,bwspenc/moose,sapitts/moose,nuclear-wizard/moose,idaholab/moose,liuwenf/moose,dschwen/moose,permcody/moose,joshua-cogliati-inl/moose,lindsayad/moose,nuclear-wizard/moose,stimpsonsg/...
3fed93e1c0c12dd98a1be7e024a4c637c5751549
src/sentry/tasks/base.py
src/sentry/tasks/base.py
""" sentry.tasks.base ~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from celery.task import task from django_statsd.clients import statsd from functools import wraps def instrumented_task(name, queue, stat_suffix=None, ...
""" sentry.tasks.base ~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from celery.task import task from django_statsd.clients import statsd from functools import wraps def instrumented_task(name, queue, stat_suffix=None, ...
Change tasks key prefix to jobs.duration
Change tasks key prefix to jobs.duration
Python
bsd-3-clause
gencer/sentry,korealerts1/sentry,JTCunning/sentry,fuziontech/sentry,wujuguang/sentry,jean/sentry,mvaled/sentry,jean/sentry,BuildingLink/sentry,zenefits/sentry,drcapulet/sentry,ewdurbin/sentry,TedaLIEz/sentry,fotinakis/sentry,nicholasserra/sentry,looker/sentry,gencer/sentry,BayanGroup/sentry,BuildingLink/sentry,mvaled/s...
0c6a27b483fdfaf04c0481151d2c3e282e4eca4f
opps/images/templatetags/images_tags.py
opps/images/templatetags/images_tags.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import template from ..generate import image_url as url register = template.Library() @register.simple_tag def image_url(image_url, **kwargs): return url(image_url=image_url, **kwargs)
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import template from ..generate import image_url as url register = template.Library() @register.simple_tag def image_url(image_url, **kwargs): return url(image_url=image_url, **kwargs) @register.simple_tag def image_obj(image, **kwargs): new = {} ...
Create template tag image obj on images receive obj image
Create template tag image obj on images receive obj image
Python
mit
jeanmask/opps,williamroot/opps,opps/opps,williamroot/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,opps/opps
fb9a16917ba8f26caa0d941b181fa083fcb7a2da
bot.py
bot.py
from discord.ext.commands import Bot, CommandInvokeError from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument class BeattieBot(Bot): async def reply(self, ctx, message): return await ctx.send(f'{ctx.message.author.mention}\n{message}') async def handle_error(self, ex...
from discord.ext.commands import Bot, CommandInvokeError from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument class BeattieBot(Bot): async def reply(self, ctx, message): return await ctx.send(f'{ctx.message.author.mention}\n{message}') async def handle_error(self, ex...
Change isinstance check to duck typing because this is Python lol
Change isinstance check to duck typing because this is Python lol
Python
mit
BeatButton/beattie-bot,BeatButton/beattie
4a2bd50b6747eb00ddedd0d3e26f28cc43980b11
tools/test-commands.py
tools/test-commands.py
#!/usr/bin/python import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("localhost", 5001)) s.send("imei:123456789012345,tracker,151030080103,,F,000101.000,A,5443.3834,N,02512.9071,E,0.00,0;") while True: print s.recv(1024) s.close()
#!/usr/bin/python import socket import binascii s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("localhost", 5001)) #s.send(binascii.unhexlify('68680f0504035889905831401700df1a00000d0a')) s.send("imei:123456789012345,tracker,151030080103,,F,000101.000,A,5443.3834,N,02512.9071,E,0.00,0;") while True:...
Extend script to test binary commands
Extend script to test binary commands
Python
apache-2.0
5of9/traccar,jssenyange/traccar,tananaev/traccar,duke2906/traccar,AnshulJain1985/Roadcast-Tracker,tsmgeek/traccar,stalien/traccar_test,renaudallard/traccar,orcoliver/traccar,AnshulJain1985/Roadcast-Tracker,tsmgeek/traccar,joseant/traccar-1,ninioe/traccar,tananaev/traccar,5of9/traccar,renaudallard/traccar,al3x1s/traccar...
841da00ffa000acec3e287b8b2af91147271b728
cupy/array_api/_typing.py
cupy/array_api/_typing.py
""" This file defines the types for type annotations. These names aren't part of the module namespace, but they are used in the annotations in the function signatures. The functions in the module are only valid for inputs that match the given type annotations. """ from cupy.cuda import Device as _Device __all__ = [...
""" This file defines the types for type annotations. These names aren't part of the module namespace, but they are used in the annotations in the function signatures. The functions in the module are only valid for inputs that match the given type annotations. """ from cupy.cuda import Device as _Device __all__ = [...
Fix invalid parameter types used in `Dtype`
MAINT: Fix invalid parameter types used in `Dtype`
Python
mit
cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy
f048d62b7831f0364093025c6bf9e3458d1a7b11
projects/urls.py
projects/urls.py
from django.conf.urls import patterns, url urlpatterns = patterns('projects.views', url(r'^add/$', 'add_project', name='add_project'), url(r'^edit/(?P<project_id>.*)/$', 'edit_project', name='edit_project'), url(r'^status/(?P<project_id>.*)/$', 'edit_status', name='edit_status'), url(r'^archive/$', 'p...
from django.conf.urls import patterns, url urlpatterns = patterns('projects.views', url(r'^add/$', 'add_project', name='add_project'), url(r'^edit/(?P<project_id>\d+)/$', 'edit_project', name='edit_project'), url(r'^status/(?P<project_id>\d+)/$', 'edit_status', name='edit_status'), url(r'^archive/', '...
Add url corresponding to the added view
Add url corresponding to the added view
Python
mit
Hackfmi/Diaphanum,Hackfmi/Diaphanum
0c1ecf09d892e15ae02a92a1643e7cdb4ae95069
unit_tests/test_ccs.py
unit_tests/test_ccs.py
#!/usr/bin/env python3 import pytest import sys # This line allows the tests to run if you just naively run this script. # But the preferred way is to use run_tests.sh sys.path.insert(0,'../MultiQC') from multiqc.modules.ccs.ccs import parse_PacBio_log, parse_line PARSABLE_LINES = [ '', 'ZMWs input...
#!/usr/bin/env python3 import pytest import sys # This line allows the tests to run if you just naively run this script. # But the preferred way is to use run_tests.sh sys.path.insert(0,'../MultiQC') from multiqc.modules.ccs.ccs import parse_PacBio_log, parse_line PARSABLE_LINES = [ '', 'ZMWs input...
Add tests for lines with both a count and percentage
Add tests for lines with both a count and percentage
Python
mit
ewels/MultiQC_TestData,ewels/MultiQC_TestData,ewels/MultiQC_TestData,ewels/MultiQC_TestData,ewels/MultiQC_TestData
9d5c534339c417842428d2a4dcca6c1745fb9770
test/test_integration.py
test/test_integration.py
import unittest import http.client class TestStringMethods(unittest.TestCase): def test_404NoConfig(self): connRouter = http.client.HTTPConnection("localhost", 8666) connRouter.request("GET", "/google") response = connRouter.getresponse() connRouter.close() self.assertEqual...
import unittest import http.client class TestStringMethods(unittest.TestCase): def test_404NoConfig(self): connRouter = http.client.HTTPConnection("localhost", 8666) connRouter.request("GET", "/google") response = connRouter.getresponse() connRouter.close() self.assertEqual...
Use query parameters through the python library
Use query parameters through the python library
Python
apache-2.0
dhiaayachi/dynx,dhiaayachi/dynx
7e4a8698532a79ec6338961e91e71c54c155f02a
demo/apps/catalogue/migrations/0011_auto_20160616_1335.py
demo/apps/catalogue/migrations/0011_auto_20160616_1335.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('wagtailimages', '0013_make_rendition_upload_callable'), ('catalogue', '0010_auto_20160616_1048'), ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('wagtailimages', '0013_make_rendition_upload_callable'), ('catalogue', '0010_auto_20160616_1048'), ...
Remove name field. It already exists
Remove name field. It already exists
Python
mit
pgovers/oscar-wagtail-demo,pgovers/oscar-wagtail-demo
18998011bb52616a3002ca298a64ea61c5727a76
skeleton/website/jasyscript.py
skeleton/website/jasyscript.py
import konstrukteur.Konstrukteur import jasy.asset.Manager2 as AssetManager @task def build(regenerate = False): """Generate source (development) version""" # Initialize assets AssetManager.AssetManager(profile, session) # Build static website konstrukteur.Konstrukteur.build(regenerate)
import konstrukteur.Konstrukteur import jasy.asset.Manager2 as AssetManager @task def build(regenerate = False): """Generate source (development) version""" # Initialize assets assetManager = AssetManager.AssetManager(profile, session) # Build static website konstrukteur.Konstrukteur.build(regenerate) # Copy ...
Copy used assets to output path
Copy used assets to output path
Python
mit
fastner/konstrukteur,fastner/konstrukteur,fastner/konstrukteur
fe442d84140b0a588c6a8490b58a10995df58f17
tests/optimizers/test_constant_optimizer.py
tests/optimizers/test_constant_optimizer.py
"""Test suite for optimizers.constant.""" from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import ast import pytest from pycc.asttools import parse from pycc.optimizers import constant source = """ ONE = 1 TWO = 2 T...
"""Test suite for optimizers.constant.""" from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import ast import pytest from pycc.asttools import parse from pycc.optimizers import constant source = """ ONE = 1 TWO = 2 T...
Fix test to use new optimizer interface
Fix test to use new optimizer interface Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com>
Python
apache-2.0
kevinconway/pycc,kevinconway/pycc
b2396e90d9da252766979c154e6f98707dda6e0c
python/helpers/profiler/_prof_imports.py
python/helpers/profiler/_prof_imports.py
import sys IS_PY3K = False try: if sys.version_info[0] >= 3: IS_PY3K = True except AttributeError: pass #Not all versions have sys.version_info if IS_PY3K: # noinspection PyUnresolvedReferences from thriftpy3 import TSerialization # noinspection PyUnresolvedReferences from thriftpy3...
import sys IS_PY3K = False try: if sys.version_info[0] >= 3: IS_PY3K = True except AttributeError: pass #Not all versions have sys.version_info if IS_PY3K: # noinspection PyUnresolvedReferences from thriftpy3 import TSerialization # noinspection PyUnresolvedReferences from thriftpy3...
Remove JSON serialization usages (PY-16388, PY-16389)
Remove JSON serialization usages (PY-16388, PY-16389)
Python
apache-2.0
orekyuu/intellij-community,MER-GROUP/intellij-community,semonte/intellij-community,da1z/intellij-community,slisson/intellij-community,xfournet/intellij-community,youdonghai/intellij-community,wreckJ/intellij-community,blademainer/intellij-community,robovm/robovm-studio,lucafavatella/intellij-community,salguarnieri/inte...
f300f3b31dcdefa91fa8fe46bdaab2d2490ac06a
snd/image_board/serializers.py
snd/image_board/serializers.py
from django.contrib.auth.models import User from .models import ContentItem, Profile, Comment, Hashtag, ContentHashTag, Like from rest_framework import serializers class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ('id', 'url', 'username', 'email', 'la...
from django.contrib.auth.models import User from .models import ContentItem, Profile, Comment, Hashtag, ContentHashTag, Like from rest_framework import serializers class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ('id', 'url', 'username', 'email', 'la...
Add URLs to each searializer
Add URLs to each searializer
Python
mit
SNDjango/server,SNDjango/server,SNDjango/server
0df8a958b479e01d9c931bd4ca185c68720e14e6
analyser/api.py
analyser/api.py
import os import json import requests import rethinkdb as r from flask import Blueprint, current_app from utils.decorators import validate, require from utils.validators import validate_url from krunchr.vendors.rethinkdb import db from .parser import Parser from .tasks import get_file endpoint = Blueprint('analys...
import os import json import requests import rethinkdb as r from flask import Blueprint, current_app from utils.decorators import validate, require from utils.validators import validate_url from krunchr.vendors.rethinkdb import db from .parser import Parser from .tasks import get_file, push_data endpoint = Bluepr...
Use a chord in order to start tasks
Use a chord in order to start tasks
Python
apache-2.0
vtemian/kruncher
8bcc4fe29468868190dcfcbea5438dc0aa638387
sweetercat/test_utils.py
sweetercat/test_utils.py
from __future__ import division from utils import absolute_magnitude, plDensity, hz def test_absolute_magnitude(): m = 10 assert isinstance(absolute_magnitude(1, 1), float) assert absolute_magnitude(1, m) > m assert absolute_magnitude(1, m) == 15 assert absolute_magnitude(0.1, m) == m assert a...
from __future__ import division import pytest import pandas as pd from utils import absolute_magnitude, plDensity, hz, readSC def test_absolute_magnitude(): m = 10 assert isinstance(absolute_magnitude(1, 1), float) assert absolute_magnitude(1, m) > m assert absolute_magnitude(1, m) == 15 assert ab...
Add couple more utils tests.
Add couple more utils tests.
Python
mit
DanielAndreasen/SWEETer-Cat,DanielAndreasen/SWEETer-Cat
11df95a61f93a8654817f9837226a33c98f34af8
arguments.py
arguments.py
import argparse """ usage: mfh.py [-h] [-c | --client [PORT]] [-u] [-v] Serve some sweet honey to the ubiquitous bots! optional arguments: -h, --help show this help message and exit -c launch client with on port defined in settings --client [PORT] port to start a client on -u, --updater ...
import argparse """ usage: mfh.py [-h] [-c | --client [PORT]] [-u] [-v] Serve some sweet honey to the ubiquitous bots! optional arguments: -h, --help show this help message and exit -c launch client with on port defined in settings --client [PORT] port to start a client on -u, --updater ...
Add option for launching server
Add option for launching server There was no option to start the server and you had to do it manually. Now it can be started with: 1) -s with default configuration 2) --server <PORT> for manual port choice
Python
mit
Zloool/manyfaced-honeypot
8cef502afb45638d74306b2fcebec37f445b13c6
Recorders.py
Recorders.py
from Measurement import Measurement class Recorder(object): def __init__(self, recorderType): self.recorderType = recorderType def record(self, measure: Measurement): None class PrintRecorder(Recorder): def __init__(self, config): Recorder.__init__(self, 'file') self.form...
from Measurement import Measurement class Recorder(object): def __init__(self, recorderType): self.recorderType = recorderType def record(self, measure: Measurement): None class PrintRecorder(Recorder): def __init__(self, config): Recorder.__init__(self, 'file') self.form...
Remove last slash from file path
Remove last slash from file path
Python
mit
hectortosa/py-temperature-recorder
d05fdd1ed6657894ecc624777762b463a3ea69da
tests/basics/fun_name.py
tests/basics/fun_name.py
def Fun(): pass class A: def __init__(self): pass def Fun(self): pass try: print(Fun.__name__) print(A.__init__.__name__) print(A.Fun.__name__) print(A().Fun.__name__) except AttributeError: print('SKIP') raise SystemExit # __name__ of a bound native method is not ...
def Fun(): pass class A: def __init__(self): pass def Fun(self): pass try: print(Fun.__name__) print(A.__init__.__name__) print(A.Fun.__name__) print(A().Fun.__name__) except AttributeError: print('SKIP') raise SystemExit # __name__ of a bound native method is not ...
Add test for getting name of func with closed over locals.
tests/basics: Add test for getting name of func with closed over locals. Tests correct decoding of the prelude to get the function name.
Python
mit
pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython
91fc886bf302f9850977c8d88abba3bffd51928b
tests/test_compliance.py
tests/test_compliance.py
#!/usr/bin/env python import os.path import nose.tools as nose import pep8 def test_pep8(): '''all Python files should comply with PEP 8''' for subdir_path, subdir_names, file_names in os.walk('.'): if '.git' in subdir_names: subdir_names.remove('.git') for file_name in file_names...
#!/usr/bin/env python import os.path import nose.tools as nose import pep8 import radon.complexity as radon def test_pep8(): '''all Python files should comply with PEP 8''' for subdir_path, subdir_names, file_names in os.walk('.'): if '.git' in subdir_names: subdir_names.remove('.git') ...
Add test generator for function complexity
Add test generator for function complexity
Python
mit
caleb531/ssh-wp-backup,caleb531/ssh-wp-backup
315ad5f2f31f82f8d42d2a65fe4f056b4e3fcfd7
tests/test_quickstart.py
tests/test_quickstart.py
import pytest from lektor.quickstart import get_default_author from lektor.quickstart import get_default_author_email from lektor.utils import locate_executable def test_default_author(os_user): assert get_default_author() == "Lektor Test" @pytest.mark.skipif(locate_executable("git") is None, reason="git not i...
import os import pytest from lektor.quickstart import get_default_author from lektor.quickstart import get_default_author_email from lektor.utils import locate_executable def test_default_author(os_user): assert get_default_author() == "Lektor Test" @pytest.mark.skipif(locate_executable("git") is None, reason...
Add test case for when git is not available
Add test case for when git is not available
Python
bsd-3-clause
lektor/lektor,lektor/lektor,lektor/lektor,lektor/lektor
ce2f07e7fa5ac38235cbb6ea6c4fee3a60031246
social_core/tests/backends/test_udata.py
social_core/tests/backends/test_udata.py
import json from six.moves.urllib_parse import urlencode from .oauth import OAuth2Test class DatagouvfrOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.udata.DatagouvfrOAuth2' user_data_url = 'https://www.data.gouv.fr/api/1/me/' expected_username = 'foobar' access_token_body = json.dumps...
import json from six.moves.urllib_parse import urlencode from .oauth import OAuth2Test class DatagouvfrOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.udata.DatagouvfrOAuth2' user_data_url = 'https://www.data.gouv.fr/api/1/me/' expected_username = 'foobar' access_token_body = json.dumps...
Fix tests for udata/datagouvfr backend
Fix tests for udata/datagouvfr backend
Python
bsd-3-clause
python-social-auth/social-core,python-social-auth/social-core
61be68b330c6e37a4f53b2441370c96c9aa13777
PRESUBMIT.py
PRESUBMIT.py
# Copyright (c) 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. """Top-level presubmit script for catapult. See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the pres...
# 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. """Top-level presubmit script for catapult. See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmi...
Add a presubmit script that runs pylint in catapult/dashboard.
Add a presubmit script that runs pylint in catapult/dashboard. Also, resolve current issues in catapult/dashboard that pylint warns about. (Note: these were also resolved in cl/95586698.) Review URL: https://codereview.chromium.org/1188483002
Python
bsd-3-clause
sahiljain/catapult,catapult-project/catapult,danbeam/catapult,SummerLW/Perf-Insight-Report,sahiljain/catapult,catapult-project/catapult,dstockwell/catapult,catapult-project/catapult-csm,SummerLW/Perf-Insight-Report,benschmaus/catapult,benschmaus/catapult,scottmcmaster/catapult,benschmaus/catapult,0x90sled/catapult,cata...
ae7960e2e3b7c3cd4bd63e55613e7a1f58b51949
utils/http.py
utils/http.py
import httplib2 def url_exists(url): """Check that a url- when following redirection - exists. This is needed because django's validators rely on python's urllib2 which in verions < 2.6 won't follow redirects. """ h = httplib2.Http() try: resp, content = h.request(url, method="HEAD") ...
import requests def url_exists(url): """Check that a url (when following redirection) exists. This is needed because Django's validators rely on Python's urllib2 which in verions < 2.6 won't follow redirects. """ try: return 200 <= requests.head(url).status_code < 400 except requests....
Switch to requests for checking if links are valid.
Switch to requests for checking if links are valid. This should have the side effect of not caring about invalid SSL certs, for https://unisubs.sifterapp.com/projects/12298/issues/557501/comments
Python
agpl-3.0
norayr/unisubs,eloquence/unisubs,norayr/unisubs,pculture/unisubs,wevoice/wesub,eloquence/unisubs,wevoice/wesub,pculture/unisubs,eloquence/unisubs,pculture/unisubs,ofer43211/unisubs,eloquence/unisubs,ReachingOut/unisubs,ujdhesa/unisubs,norayr/unisubs,ofer43211/unisubs,ujdhesa/unisubs,wevoice/wesub,ReachingOut/unisubs,uj...
f529c9f5092262f9089ad51831a8545d8f8650fa
workers/subscriptions.py
workers/subscriptions.py
import os import telegram from leonard import Leonard if __name__ == '__main__': os.chdir('../') telegram_client = telegram.Bot(os.environ['BOT_TOKEN']) bot = Leonard(telegram_client) i = 0 while True: if i % 10 == 0: bot.collect_plugins() for name, check, send in bot....
import os import time import telegram from leonard import Leonard if __name__ == '__main__': os.chdir('../') telegram_client = telegram.Bot(os.environ['BOT_TOKEN']) bot = Leonard(telegram_client) bot.collect_plugins() while True: for name, check, send in bot.subscriptions: sen...
Remove collecting plugins every second
Remove collecting plugins every second
Python
mit
sevazhidkov/leonard
038bc954ed63db6df192de50483f218b037c2438
searchlight/cmd/listener.py
searchlight/cmd/listener.py
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # # 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) 2014 Hewlett-Packard Development Company, L.P. # # 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...
Enable mutable config in searchlight
Enable mutable config in searchlight New releases of oslo.config support a 'mutable' parameter to Opts. oslo.service provides an option here Icec3e664f3fe72614e373b2938e8dee53cf8bc5e allows services to tell oslo.service they want mutate_config_files to be called by passing a parameter. This commit is to use the same....
Python
apache-2.0
openstack/searchlight,openstack/searchlight,openstack/searchlight
aed365f2f86090c22640c05e9fb2f821a6ab12a5
minique_tests/conftest.py
minique_tests/conftest.py
import logging import os import pytest from redis import Redis from minique.utils import get_random_pronounceable_string def pytest_configure() -> None: logging.basicConfig(datefmt="%Y-%m-%d %H:%M:%S", level=logging.INFO) @pytest.fixture() def redis() -> Redis: redis_url = os.environ.get("REDIS_URL") ...
import logging import os import pytest from redis import Redis from minique.utils import get_random_pronounceable_string def pytest_configure() -> None: logging.basicConfig(datefmt="%Y-%m-%d %H:%M:%S", level=logging.INFO) @pytest.fixture(scope="session") def redis_url() -> str: url = os.environ.get("REDIS...
Make test fixtures more modular
Make test fixtures more modular
Python
mit
valohai/minique
b6f51e8873d1905da53027b73614f2eeb4c4ed3d
web/form/fields/validators.py
web/form/fields/validators.py
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. from wtforms.validators import Optional class OptionalIf(Optional): # makes a field optional if some other...
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. from wtforms.validators import Optional class OptionalIf(Optional): # makes a field optional if some other...
Add option to invert `OptionalIf` validator
Add option to invert `OptionalIf` validator
Python
apache-2.0
agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft
1b31a86fcf5a449c67c20e4c971e6cb8b6bba126
providers/org/ttu/apps.py
providers/org/ttu/apps.py
from share.provider import OAIProviderAppConfig class AppConfig(OAIProviderAppConfig): name = 'providers.org.ttu' version = '0.0.1' title = 'ttu' long_title = 'Texas Tech Univeristy Libraries' home_page = 'http://ttu-ir.tdl.org/' url = 'http://ttu-ir.tdl.org/ttu-oai/request' time_granulari...
from share.provider import OAIProviderAppConfig class AppConfig(OAIProviderAppConfig): name = 'providers.org.ttu' version = '0.0.1' title = 'ttu' long_title = 'Texas Tech Univeristy Libraries' home_page = 'http://ttu-ir.tdl.org/' url = 'http://ttu-ir.tdl.org/ttu-oai/request' time_granulari...
Add approved sets for Texas Tech
Add approved sets for Texas Tech
Python
apache-2.0
CenterForOpenScience/SHARE,aaxelb/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,aaxelb/SHARE,laurenbarker/SHARE,zamattiac/SHARE,zamattiac/SHARE,aaxelb/SHARE,laurenbarker/SHARE,zamattiac/SHARE
cad612fff70f89307cb4601e4dfca2c3b4a0b420
test_suite.py
test_suite.py
import os import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' from django.core import management apps = sys.argv[1:] if not apps: apps = [ 'resources', 'forms', 'base', ] management.call_command('test', *apps, interactive=False)
import os import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' import django if hasattr(django, 'setup'): django.setup() from django.core import management apps = sys.argv[1:] if not apps: apps = [ 'resources', 'forms', 'base', ] management.call_command('test', *a...
Call setup() before testing on Django 1.7+
Call setup() before testing on Django 1.7+ Signed-off-by: Don Naegely <e690a32c1e2176a2bfface09e204830e1b5491e3@gmail.com>
Python
bsd-2-clause
chop-dbhi/serrano,chop-dbhi/serrano
72fe5252a05f8afc8b2cc4e2f10a0572acb1a629
wispy/tree.py
wispy/tree.py
""" wispy.tree ~~~~~~~~~~ Contains the AST nodes defined by *wispy*. """ # pylint: disable=no-init, too-few-public-methods, missing-docstring class Node: """ Base class for all CST nodes. Exports a couple of attributes, which can be find in any CST node: * parent: the parent of this node...
""" wispy.tree ~~~~~~~~~~ Contains the AST nodes defined by *wispy*. """ # pylint: disable=no-init, too-few-public-methods, missing-docstring # pylint: disable=protected-access from inspect import Parameter as SignatureParameter, Signature def make_signature(names): """ Build a Signature object from...
Allow creating AST nodes using call syntax, through signatures.
Allow creating AST nodes using call syntax, through signatures. By using Python 3's signatures, we can create AST nodes using call syntax, as in Name(value=...). This also improves the introspection.
Python
apache-2.0
RoPython/wispy
0c47a60185122dbea6ded2118305094d6917afb1
tests/urls.py
tests/urls.py
from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^edtf/', include('edtf.urls', namespace='edtf')) ]
from django.conf.urls import include, url urlpatterns = [ url(r'^edtf/', include('edtf.urls', namespace='edtf')) ]
Remove admin site from test project.
Remove admin site from test project.
Python
bsd-3-clause
unt-libraries/django-edtf,unt-libraries/django-edtf,unt-libraries/django-edtf
7a855a5cd09785a23061af1be13135ad23c4daf1
runtests.py
runtests.py
#!/usr/bin/env python import os import sys from django.conf import settings if not settings.configured: settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }, INSTALLED_APPS=( ...
#!/usr/bin/env python import os import sys from django.conf import settings if not settings.configured: settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }, INSTALLED_APPS=( ...
Test with the default test runner for all Django versions.
Test with the default test runner for all Django versions.
Python
bsd-2-clause
mlavin/django-selectable,affan2/django-selectable,mlavin/django-selectable,mlavin/django-selectable,affan2/django-selectable,affan2/django-selectable
0cd5deefc61f56351af24f6597a1509ea4b4b567
settings.py
settings.py
import os INTERVAL = int(os.environ.get('INTERVAL', 60)) AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID'] AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY'] AWS_REGION = os.environ.get('AWS_REGION', 'us-west-2') ALERTS = os.environ['ALERTS'] ANALYTICS_KEY_NAME = os.environ['ANALYTICS_KEY_NAME'] FROM_EMAIL ...
import os INTERVAL = int(os.environ.get('INTERVAL', 60)) AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID'] AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY'] AWS_REGION = os.environ.get('AWS_REGION', 'us-west-2') ALERTS = os.environ['ALERTS'] ANALYTICS_KEY_NAME = os.environ['ANALYTICS_KEY_NAME'] FROM_EMAIL ...
Read log file from ENV and add full path for default
Read log file from ENV and add full path for default
Python
mit
lorden/right-now-alerts
6c57f18e9f40f5dd54fc35ef2f34924ccc50ee76
app/views.py
app/views.py
from app import app from flask import render_template, request from .looper import getNextLink @app.route('/') def index_page(): return render_template('index.html') @app.route('/loop') def loop_request(): link = request.args.get('link', '', type=str) return getNextLink(link.strip())
from app import app from flask import render_template, request from .looper import getNextLink @app.route('/') def index_page(): return render_template('index.html') @app.route('/loop') def loop_request(): if "unicode" in __builtins__: str_type = unicode else: str_type = str link = req...
Fix link being empty string in py2 if it's unicode
Fix link being empty string in py2 if it's unicode Should fix any remaining Unicode errors.
Python
mit
kartikanand/wikilooper,kartikanand/wikilooper,kartikanand/wikilooper
10379c2210b39d507af61530c56c1dbfa8cf5307
pbxplore/demo/__init__.py
pbxplore/demo/__init__.py
""" Demonstration files --- :mod:`pbxplore.demo` ============================================ PBxplore bundles a set of demonstration files. This module ease the access to these files. The path to the demonstration files is stored in :const:`DEMO_DATA_PATH`. This constant can be accessed as :const:`pbxplore.demo.DEMO...
""" Demonstration files --- :mod:`pbxplore.demo` ============================================ PBxplore bundles a set of demonstration files. This module ease the access to these files. The path to the demonstration files is stored in :const:`DEMO_DATA_PATH`. This constant can be accessed as :const:`pbxplore.demo.DEMO...
Add a function to list absolute path to demo files
Add a function to list absolute path to demo files
Python
mit
jbarnoud/PBxplore,jbarnoud/PBxplore,pierrepo/PBxplore,HubLot/PBxplore,pierrepo/PBxplore,HubLot/PBxplore
b7faf879e81df86e49ec47f1bcce1d6488f743b2
medical_patient_species/tests/test_medical_patient_species.py
medical_patient_species/tests/test_medical_patient_species.py
# -*- coding: utf-8 -*- # © 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp.tests.common import TransactionCase class TestMedicalPatientSpecies(TransactionCase): def setUp(self): super(TestMedicalPatientSpecies, self).setUp() self.human = self....
# -*- coding: utf-8 -*- # © 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp.tests.common import TransactionCase from openerp.exceptions import Warning class TestMedicalPatientSpecies(TransactionCase): def setUp(self): super(TestMedicalPatientSpecies, s...
Remove tests for is_person (default is False, human set to True in xml). Re-add test ensuring warning raised if trying to unlink Human.
[FIX] medical_patient_species: Remove tests for is_person (default is False, human set to True in xml). Re-add test ensuring warning raised if trying to unlink Human.
Python
agpl-3.0
laslabs/vertical-medical,laslabs/vertical-medical
f9e1c2bd5976623bcebbb4b57fb011eb4d1737bc
support/appveyor-build.py
support/appveyor-build.py
#!/usr/bin/env python # Build the project on AppVeyor. import os from download import Downloader from subprocess import check_call build = os.environ['BUILD'] cmake_command = ['cmake', '-DFMT_EXTRA_TESTS=ON', '-DCMAKE_BUILD_TYPE=' + os.environ['CONFIG']] build_command = ['msbuild', '/m:4', '/p:Config=' + os.environ['...
#!/usr/bin/env python # Build the project on AppVeyor. import os from subprocess import check_call build = os.environ['BUILD'] config = os.environ['CONFIG'] cmake_command = ['cmake', '-DFMT_EXTRA_TESTS=ON', '-DCMAKE_BUILD_TYPE=' + config] if build == 'mingw': cmake_command.append('-GMinGW Makefiles') build_comman...
Use preinstalled mingw on appveyor
Use preinstalled mingw on appveyor
Python
bsd-2-clause
lightslife/cppformat,blaquee/cppformat,mojoBrendan/fmt,alabuzhev/fmt,alabuzhev/fmt,wangshijin/cppformat,nelson4722/cppformat,cppformat/cppformat,cppformat/cppformat,alabuzhev/fmt,blaquee/cppformat,wangshijin/cppformat,Jopie64/cppformat,nelson4722/cppformat,lightslife/cppformat,cppformat/cppformat,seungrye/cppformat,Jop...
c87b5f8392dc58d6fa1d5398245b4ffe9edb19c8
praw/models/mod_action.py
praw/models/mod_action.py
"""Provide the ModAction class.""" from typing import TYPE_CHECKING from .base import PRAWBase if TYPE_CHECKING: # pragma: no cover from ... import praw class ModAction(PRAWBase): """Represent a moderator action.""" @property def mod(self) -> "praw.models.Redditor": """Return the :class:`....
"""Provide the ModAction class.""" from typing import TYPE_CHECKING, Union from .base import PRAWBase if TYPE_CHECKING: # pragma: no cover from ... import praw class ModAction(PRAWBase): """Represent a moderator action.""" @property def mod(self) -> "praw.models.Redditor": """Return the :c...
Add str as a type for mod setter
Add str as a type for mod setter
Python
bsd-2-clause
praw-dev/praw,praw-dev/praw
b8e085c538b9eda06a831c78f55219ac4612a5da
model.py
model.py
import collections LearningObject = collections.namedtuple( 'LearningObject', ['text', 'image']) class Model(object): def __init__(self, name): self._name = name self._objs = [] def add_object(self, text, image): self._objs.append(LearningObject(text, image)) def write(self): path = 'xml/...
import os import collections LearningObject = collections.namedtuple( 'LearningObject', ['text', 'image']) class Model(object): def __init__(self, name): self._name = name self._objs = [] def add_object(self, text, image): self._objs.append(LearningObject(text, image)) def write(self): if...
Make directory if it doesnt exist
Make directory if it doesnt exist
Python
apache-2.0
faskiri/google-drive-extract-images
dd0405965f816a2a71bfb6d7a3f939691a6ab6d8
ibmcnx/doc/DataSources.py
ibmcnx/doc/DataSources.py
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
Create documentation of DataSource Settings
8: Create documentation of DataSource Settings Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
cff7bb0fda7e126ce65701231cab0e67a5a2794c
endpoints.py
endpoints.py
import requests class AlgoliaEndpoint(object): """Class used to call the Algolia API and parse the response.""" URL = "http://hn.algolia.com/api/v1/search_by_date" @staticmethod def get(tag, since, until=None, page=0): """Send a GET request to the endpoint. Since Algolia only returns JSON, parse it...
import requests class AlgoliaEndpoint(object): """Class used to call the Algolia API and parse the response.""" URL = "http://hn.algolia.com/api/v1/search_by_date" @staticmethod def get(tag, since, until=None, page=0): """Send a GET request to the endpoint. Since Algolia only returns JSON, parse it...
Add Algolia API website in docstring.
Add Algolia API website in docstring.
Python
bsd-2-clause
NiGhTTraX/hackernews-scraper
05e9c3e9c58732e68eacc0462f949c2525d670fe
tests/contrib/test_sqlalchemy_handler.py
tests/contrib/test_sqlalchemy_handler.py
# -*- coding: utf-8 -*- import unittest from flask.ext.sqlalchemy import SQLAlchemy import flask_featureflags as feature_flags from flask_featureflags.contrib.sqlalchemy import SQLAlchemyFeatureFlags from tests.fixtures import app, feature_setup db = SQLAlchemy(app) SQLAlchemyHandler = SQLAlchemyFeatureFlags(db) ...
# -*- coding: utf-8 -*- import unittest from flask.ext.sqlalchemy import SQLAlchemy import flask_featureflags as feature_flags from flask_featureflags.contrib.sqlalchemy import SQLAlchemyFeatureFlags from tests.fixtures import app, feature_setup db = SQLAlchemy(app) SQLAlchemyHandler = SQLAlchemyFeatureFlags(db) ...
Use add_handler instead of set handlers as a list.
Use add_handler instead of set handlers as a list.
Python
apache-2.0
jskulski/Flask-FeatureFlags,iromli/Flask-FeatureFlags,trustrachel/Flask-FeatureFlags
0e9acfe35396582f95c22994e061be871fdaf865
tests/test_datapackage.py
tests/test_datapackage.py
import pytest import datapackage class TestDataPackage(object): def test_schema(self): descriptor = {} schema = {'foo': 'bar'} dp = datapackage.DataPackage(descriptor, schema=schema) assert dp.schema.to_dict() == schema def test_datapackage_attributes(self): dp = datap...
import pytest import datapackage class TestDataPackage(object): def test_init_uses_base_schema_by_default(self): dp = datapackage.DataPackage() assert dp.schema.title == 'DataPackage' def test_schema(self): descriptor = {} schema = {'foo': 'bar'} dp = datapackage.DataP...
Add tests to ensure DataPackage uses base schema by default
Add tests to ensure DataPackage uses base schema by default
Python
mit
okfn/datapackage-model-py,sirex/datapackage-py,sirex/datapackage-py,okfn/datapackage-model-py,okfn/datapackage-py,datapackages/datapackage-py,datapackages/datapackage-py,okfn/datapackage-py
cc17f806e3fcbc6974a9ee13be58585e681cc59a
jose/backends/__init__.py
jose/backends/__init__.py
try: from jose.backends.cryptography_backend import CryptographyRSAKey as RSAKey # noqa: F401 except ImportError: try: from jose.backends.pycrypto_backend import RSAKey # noqa: F401 except ImportError: from jose.backends.rsa_backend import RSAKey # noqa: F401 try: from jose.backends...
try: from jose.backends.cryptography_backend import CryptographyRSAKey as RSAKey # noqa: F401 except ImportError: try: from jose.backends.pycrypto_backend import RSAKey # noqa: F401 # time.clock was deprecated in python 3.3 in favor of time.perf_counter # and removed in python 3.8. p...
Add fix for time.clock removal in 3.8 for pycrypto backend
Add fix for time.clock removal in 3.8 for pycrypto backend
Python
mit
mpdavis/python-jose
abc95f3a10cd27ec67e982b187f7948d0dc83fe3
corgi/sql.py
corgi/sql.py
from six.moves import configparser as CP from sqlalchemy.engine.url import URL from sqlalchemy.engine import create_engine import os import pandas as pd def get_odbc_engine(name, odbc_filename='/etc/odbc.ini', database=None): """ Looks up the connection details in an odbc file and returns a SQLAlchemy engine i...
import os from pathlib import Path from six.moves import configparser as CP import pandas as pd from sqlalchemy.engine import create_engine from sqlalchemy.engine.url import URL home = str(Path.home()) def get_odbc_engine(name, odbc_filename=None, database=None): """ Looks up the connection details in an od...
Set the get_odbc_engine function to check etc, then user home for odbc file by default
Set the get_odbc_engine function to check etc, then user home for odbc file by default
Python
mit
log0ymxm/corgi
a46bc83eb16888e374f5f24080581818617539a2
src/cards.py
src/cards.py
from random import seed as srand, randint from time import time srand(time()) class Card: types = ("def", "atk") limits = {"def": (1, 25), "atk": (1, 40)} def __init__(self, type = None, value = None): if type: if not type in types: print("ERROR: Invalid card type") ...
from random import seed as srand, randint from time import time srand(time()) class Card: card_types = ("def", "atk") card_limits = {"def": (1, 25), "atk": (1, 40)} def __init__(self, card_type = None, card_value = None): if card_type: if not card_type in card_types: p...
Change variable names to remove conflict with standard functions
Change variable names to remove conflict with standard functions
Python
mit
TheUnderscores/card-fight-thingy
063a655327cf0872e01170653604db6901d5aacd
pagebits/managers.py
pagebits/managers.py
from django.db import models from django.core.cache import cache from django.conf import settings from .utils import bitgroup_cache_key class BitGroupManager(models.Manager): def get_group(self, slug): """ Retrieve a group by slug, with caching """ key = bitgroup_cache_key(slug) cached_g...
from django.db import models from django.core.cache import cache from django.conf import settings from .utils import bitgroup_cache_key class BitGroupManager(models.Manager): def get_group(self, slug): """ Retrieve a group by slug, with caching """ key = bitgroup_cache_key(slug) cached_g...
Remove select related. Django 1.8 requires existing fields instead of ignoring missing ones.
Remove select related. Django 1.8 requires existing fields instead of ignoring missing ones.
Python
bsd-3-clause
nngroup/django-pagebits,nngroup/django-pagebits
3c1f2c46485aee91dbf4c61b7b096c2cc4b28c06
kcdc3/apps/pinata/urls.py
kcdc3/apps/pinata/urls.py
from django.conf.urls import patterns, include, url from models import Page urlpatterns = patterns('kcdc3.apps.pinata.views', url(r'^$', 'page_view'), url(r'^[0-9a-zA-Z_-]+/$', 'page_view'), )
from django.conf.urls import patterns, include, url from models import Page urlpatterns = patterns('kcdc3.apps.pinata.views', url(r'^$', 'page_view'), url(r'^[0-9a-zA-Z_-]+/$', 'page_view'), url(r'^[0-9a-zA-Z_-]+/[0-9a-zA-Z_-]+/$', 'page_view'), # Surely there's a better way to handle paths that contain several s...
Allow three-deep paths in Pinata
Allow three-deep paths in Pinata
Python
mit
knowledgecommonsdc/kcdc3,knowledgecommonsdc/kcdc3,knowledgecommonsdc/kcdc3,knowledgecommonsdc/kcdc3,knowledgecommonsdc/kcdc3,knowledgecommonsdc/kcdc3
65d3e588606f533b2d2934bf52439e586a01f2b4
pdc/settings_test.py
pdc/settings_test.py
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # """ Extra Django settings for test environment of pdc project. """ from settings import * # Database settings DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'te...
# # Copyright (c) 2015 Red Hat # Licensed under The MIT License (MIT) # http://opensource.org/licenses/MIT # """ Extra Django settings for test environment of pdc project. """ from settings import * # Database settings DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'te...
Use persistent test DB (--keepdb can skip migrations)
Use persistent test DB (--keepdb can skip migrations) By default test database is in-memory (':memory:'), i.e. not saved on disk, making it impossible to skip migrations to quickly re-run tests with '--keepdb' argument.
Python
mit
release-engineering/product-definition-center,release-engineering/product-definition-center,product-definition-center/product-definition-center,product-definition-center/product-definition-center,product-definition-center/product-definition-center,product-definition-center/product-definition-center,release-engineering/...
0610628771df849119e6ed316dfa0f8107d8fe6e
src/WaveBlocksND/Utils.py
src/WaveBlocksND/Utils.py
"""The WaveBlocks Project Various small utility functions. @author: R. Bourquin @copyright: Copyright (C) 2012 R. Bourquin @license: Modified BSD License """ from numpy import squeeze, asarray def meshgrid_nd(arrays): """Like 'meshgrid()' but for arbitrary number of dimensions. """ arrays = tuple(map(s...
"""The WaveBlocks Project Various small utility functions. @author: R. Bourquin @copyright: Copyright (C) 2012, 2013 R. Bourquin @license: Modified BSD License """ from numpy import squeeze, asarray, atleast_1d def meshgrid_nd(arrays): """Like 'meshgrid()' but for arbitrary number of dimensions. :param ar...
Allow 0-dimensional arrays for tensor meshgrids
Allow 0-dimensional arrays for tensor meshgrids
Python
bsd-3-clause
WaveBlocks/WaveBlocksND,WaveBlocks/WaveBlocksND
fb9999b8dfcbc67da3a14ecbfed8fcd5676c0ea3
akhet/demo/subscribers.py
akhet/demo/subscribers.py
from akhet.urlgenerator import URLGenerator import pyramid.threadlocal as threadlocal from pyramid.exceptions import ConfigurationError from .lib import helpers def includeme(config): """Configure all application-specific subscribers.""" config.add_subscriber(create_url_generator, "pyramid.events.ContextFound...
from akhet.urlgenerator import URLGenerator import pyramid.threadlocal as threadlocal from pyramid.exceptions import ConfigurationError from .lib import helpers def includeme(config): """Configure all application-specific subscribers.""" config.add_subscriber(create_url_generator, "pyramid.events.ContextFound...
Add renderer global 'r' as alias for 'request'.
Add renderer global 'r' as alias for 'request'.
Python
mit
Pylons/akhet,Pylons/akhet,hlwsmith/akhet,hlwsmith/akhet,hlwsmith/akhet
c5c92c852d27fb370e4efdc631caf38ebcfdd8ba
tests/GIR/test_query_select.py
tests/GIR/test_query_select.py
# coding=utf-8 import sys import struct import unittest from test_000_config import TestConfig from test_001_connection import TestConnection from gi.repository import Midgard from gi.repository import GObject class TestQuerySelect(unittest.TestCase): def testSelectAdminPerson(self): mgd = TestConnection.openC...
# coding=utf-8 import sys import struct import unittest from test_000_config import TestConfig from test_001_connection import TestConnection from gi.repository import Midgard from gi.repository import GObject class TestQuerySelect(unittest.TestCase): def setUp(self): self.mgd = TestConnection.openConnection()...
Set MidgardConnection in setUp method
Set MidgardConnection in setUp method
Python
lgpl-2.1
piotras/midgard-core,piotras/midgard-core,midgardproject/midgard-core,midgardproject/midgard-core,midgardproject/midgard-core,midgardproject/midgard-core,piotras/midgard-core,piotras/midgard-core
264b7f26b872f4307c70cf6c68d84fdce620f5bb
utils/CIndex/completion_logger_server.py
utils/CIndex/completion_logger_server.py
#!/usr/bin/env python import sys from socket import * from time import localtime, strftime def main(): if len(sys.argv) < 4: print "completion_logger_server.py <listen address> <listen port> <log file>" exit(1) host = sys.argv[1] port = int(sys.argv[2]) buf = 1024 * 8 addr = (host,port) # Creat...
#!/usr/bin/env python import sys from socket import * from time import localtime, strftime def main(): if len(sys.argv) < 4: print "completion_logger_server.py <listen address> <listen port> <log file>" exit(1) host = sys.argv[1] port = int(sys.argv[2]) buf = 1024 * 8 addr = (host,port) # Creat...
Include sender address in completion log.
Include sender address in completion log. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@101358 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-cl...
d623b9904e4fa1967d8f83b45d39c9b57d2a4b0e
DDSP/Header.py
DDSP/Header.py
# The Header class contains the data structure of the Header class, and methods includes encapsulate, and decapsulate. import struct import random from MessageType import MessageType class Header: """docstring for Header""" def __init__(self, type = MessageType.undefined): self.type = type sel...
# The Header class contains the data structure of the Header class, and methods includes encapsulate, and decapsulate. import struct import random from MessageType import MessageType class Header: """docstring for Header""" def __init__(self, type = MessageType.undefined): self.version = 1 sel...
Add a version field into the header.
Add a version field into the header.
Python
mit
CharKwayTeow/ddsp
9a850232e187080222e7d245c65264e9b3484ee8
tests/test_git_mongo.py
tests/test_git_mongo.py
from unittest import TestCase from datetime import datetime from citools.mongo import get_database_connection from citools.git import get_last_revision class TestLastStoreRetrieval(TestCase): def setUp(self): TestCase.setUp(self) self.db = get_database_connection(database="test_citools") ...
from unittest import TestCase from datetime import datetime from citools.mongo import get_database_connection from citools.git import get_last_revision from helpers import MongoTestCase class TestLastStoreRetrieval(MongoTestCase): def setUp(self): super(TestLastStoreRetrieval, self).setUp() sel...
Use MongoTestCase when we have it...
Use MongoTestCase when we have it...
Python
bsd-3-clause
ella/citools,ella/citools
70138da1fa6a28d0e7b7fdf80ab894236c0f5583
tests/test_tokenizer.py
tests/test_tokenizer.py
import unittest from cobe.tokenizer import MegaHALTokenizer class testMegaHALTokenizer(unittest.TestCase): def setUp(self): self.tokenizer = MegaHALTokenizer() def testSplitEmpty(self): self.assertEquals(len(self.tokenizer.split("")), 0) def testSplitSentence(self): words = self....
import unittest from cobe.tokenizer import MegaHALTokenizer class testMegaHALTokenizer(unittest.TestCase): def setUp(self): self.tokenizer = MegaHALTokenizer() def testSplitEmpty(self): self.assertEquals(len(self.tokenizer.split("")), 0) def testSplitSentence(self): words = self....
Make all the tokenizer unit tests assertEquals() on arrays
Make all the tokenizer unit tests assertEquals() on arrays
Python
mit
LeMagnesium/cobe,tiagochiavericosta/cobe,pteichman/cobe,wodim/cobe-ng,meska/cobe,wodim/cobe-ng,meska/cobe,tiagochiavericosta/cobe,DarkMio/cobe,DarkMio/cobe,pteichman/cobe,LeMagnesium/cobe
5ccf3753882c6cbde98923fe535857afca4a7187
webapp/calendars/forms.py
webapp/calendars/forms.py
from django import forms from django.contrib.admin import widgets from .models import Event class LoginForm(forms.Form): username = forms.CharField() password = forms.CharField(widget=forms.PasswordInput()) class EventForm(forms.ModelForm): class Meta: model = Event fields = ( ...
from django import forms from django.contrib.admin import widgets from .models import Event class LoginForm(forms.Form): username = forms.CharField(label='Nazwa użytkownika'); password = forms.CharField(label='Hasło', widget=forms.PasswordInput()) class EventForm(forms.ModelForm): class Meta: mo...
Use Polish lables in login form.
Use Polish lables in login form. Signed-off-by: Mariusz Fik <e22610367d206dca7aa58af34ebf008b556228c5@fidano.pl>
Python
agpl-3.0
Fisiu/calendar-oswiecim,Fisiu/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim,firemark/calendar-oswiecim,firemark/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim,firemark/calendar-oswiecim,hackerspace-silesia/calendar-oswiecim,Fisiu/calendar-oswiecim
c15875062be2b59c78fca9a224b0231986a37868
feincms3/templatetags/feincms3_renderer.py
feincms3/templatetags/feincms3_renderer.py
from django import template from django.utils.html import mark_safe register = template.Library() @register.simple_tag(takes_context=True) def render_plugin(context, plugin): """ Render a single plugin. See :mod:`feincms3.renderer` for additional details. """ return context['renderer'].render_plu...
from django import template from django.utils.html import mark_safe register = template.Library() @register.simple_tag(takes_context=True) def render_plugin(context, plugin): """ Render a single plugin. See :mod:`feincms3.renderer` for additional details. In general you should prefer :func:`~fei...
Add note to render_plugin[s] that render_region should be preferred
Add note to render_plugin[s] that render_region should be preferred
Python
bsd-3-clause
matthiask/feincms3,matthiask/feincms3,matthiask/feincms3
f11f482688d6374a7771c40ce48f4f743cc98b9b
storage_service/common/apps.py
storage_service/common/apps.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from django.apps import AppConfig class CommonAppConfig(AppConfig): name = "common" def ready(self): import common.signals # noqa: F401
# -*- coding: utf-8 -*- from __future__ import absolute_import from django.apps import AppConfig from prometheus_client import Info from storage_service import __version__ version_info = Info("version", "Archivematica Storage Service version info") class CommonAppConfig(AppConfig): name = "common" def re...
Include application version info metric
Include application version info metric
Python
agpl-3.0
artefactual/archivematica-storage-service,artefactual/archivematica-storage-service,artefactual/archivematica-storage-service,artefactual/archivematica-storage-service
7f4d233c48bcdcd327286f3c2ce4f3e2942e6c3c
data_test.py
data_test.py
import data from client import authentication_request_url, GoogleAPIClient c = GoogleAPIClient() if c.access_token is None: print 'Open the following URL in your Web browser and grant access' print authentication_request_url print print 'Enter the authorization code here:' code = raw_input('> ')...
import data from client import authentication_request_url, GoogleAPIClient c = GoogleAPIClient() if c.access_token is None: print 'Open the following URL in your Web browser and grant access' print authentication_request_url print print 'Enter the authorization code here:' code = raw_input('> ')...
Test getting playlist videos, too
Test getting playlist videos, too
Python
mit
drkitty/metatube,drkitty/metatube
450a1f64a21afce008392e321fff2d268bb9fc41
setup.py
setup.py
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import numpy ALGPATH = "clusterpy/core/toolboxes/cluster/componentsAlg/" ALGPKG = "clusterpy.core.toolboxes.cluster.componentsAlg." CLUSPATH = "clusterpy/core/toolboxes/cluster/" CLUSPKG = "clusterpy.cor...
from distutils.core import setup from distutils.extension import Extension setup( name='clusterPy', version='0.9.9', description='Library of spatially constrained clustering algorithms', long_description=""" clusterPy is a Python library with algorithms for spatially constrained...
Remove cython Extension builder and build_ext from Setup
Remove cython Extension builder and build_ext from Setup
Python
bsd-3-clause
clusterpy/clusterpy,clusterpy/clusterpy
494d2a2cfcfa5dc9058f087588fb1371021174d4
src/python/twitter/mesos/location.py
src/python/twitter/mesos/location.py
import re import socket class Location(object): """Determine which cluster the code is running in, or CORP if we are not in prod.""" PROD_SUFFIXES = [ '.corpdc.twitter.com', '.prod.twitter.com', ] @staticmethod def is_corp(): """ Returns true if this job is in corp and requires an ssh tun...
import re import socket class Location(object): """Determine which cluster the code is running in, or CORP if we are not in prod.""" PROD_SUFFIXES = [ '.corpdc.twitter.com', '.prod.twitter.com', '.devel.twitter.com' ] @staticmethod def is_corp(): """ Returns true if this job is in cor...
Add devel.twitter.com to PROD suffixes
Add devel.twitter.com to PROD suffixes
Python
apache-2.0
rosmo/aurora,rosmo/aurora,kidaa/aurora,crashlytics/aurora,wfarner/aurora,kidaa/aurora,mkhutornenko/incubator-aurora,apache/aurora,kidaa/aurora,medallia/aurora,mschenck/aurora,wfarner/aurora,mschenck/aurora,apache/aurora,protochron/aurora,shahankhatch/aurora,crashlytics/aurora,shahankhatch/aurora,mkhutornenko/incubator-...
f82a9994bfe782a575136af506b92c72fd6ac60e
src/python/twitter/mesos/location.py
src/python/twitter/mesos/location.py
import re import socket class Location(object): " Determine which cluster the code is running in, or CORP if we are not in prod. " CORP = "corp" @staticmethod def get_location(): hostname = socket.gethostname() prod_matcher = re.match('^(\w{3}).*.twitter\.com$', hostname) if re.search('.+\.local...
import re import socket class Location(object): """Determine which cluster the code is running in, or CORP if we are not in prod.""" CORP = "corp" @staticmethod def get_location(): hostname = socket.gethostname() prod_matcher = re.match('^(\w{3}\d+).*\.twitter\.com$', hostname) prod_host = prod_m...
Update Location determination to current hostname standards.
Update Location determination to current hostname standards.
Python
apache-2.0
apache/aurora,shahankhatch/aurora,kidaa/aurora,protochron/aurora,thinker0/aurora,medallia/aurora,apache/aurora,medallia/aurora,mkhutornenko/incubator-aurora,rosmo/aurora,crashlytics/aurora,thinker0/aurora,protochron/aurora,thinker0/aurora,mschenck/aurora,medallia/aurora,wfarner/aurora,wfarner/aurora,kidaa/aurora,kidaa/...
238c6b73115f6493246f25d45268e7a675980397
build/build.py
build/build.py
# # Copyright (c) 2004 Specifix, Inc. # All rights reserved # import os import shutil import util class Make: def doBuild(self, dir): os.system("cd %s; make" % dir) class MakeInstall: def doInstall(self, dir, root): os.system("cd %s; make %s=%s install" % (dir, self.rootVar, root)) def __init__(self,...
# # Copyright (c) 2004 Specifix, Inc. # All rights reserved # import os import shutil import util class ManualConfigure: def doBuild(self, dir): os.system("cd %s; ./configure %s" % (dir, self.extraflags)) def __init__(self, extraflags=""): self.extraflags = extraflags class Configure: def doBu...
Add classes to run ./configure
Add classes to run ./configure
Python
apache-2.0
sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary
b363536d92a955150eef1b412c1e34cba66caeeb
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='psycopg-nestedtransactions', version='1.0', description='Database transaction manager for psycopg2 database connections with seamless support for nested transactions.', url='https://github.com/asqui/psycopg-nestedtransactions', ...
#!/usr/bin/env python from distutils.core import setup setup(name='psycopg-nestedtransactions', version='1.0', description='Database transaction manager for psycopg2 database connections with seamless support for nested transactions.', url='https://github.com/asqui/psycopg-nestedtransactions', ...
Revert "Fix Python 2.7 build" and un-pin pg8000 version on Python 2
Revert "Fix Python 2.7 build" and un-pin pg8000 version on Python 2 The underlying issue has been resolved in pg8000: https://github.com/tlocke/pg8000/issues/7 This reverts commit f27e5a3f.
Python
mit
asqui/psycopg-nestedtransactions
fc4fa5d06ea0ca557d69112d1c8d0f10c8e594e0
diet_gtfs.py
diet_gtfs.py
import csv import sys # agency.txt done # feed_info.txt nothing to change # calendar_dates.txt depends on service_id. # routes.txt depends on agency.txt # shapes.txt depends on trips.txt # stops.txt depends on stop_times.txt # stop_times.txt depends on trip_id. # transfers.txt depends on stop_id from and to, routes. ...
import csv import sys # agency.txt done # feed_info.txt nothing to change # calendar_dates.txt depends on service_id. # routes.txt depends on agency.txt # shapes.txt depends on trips.txt # stops.txt depends on stop_times.txt # stop_times.txt depends on trip_id. # transfers.txt depends on stop_id from and to, routes. ...
Create a complete filtered output agency.txt
Create a complete filtered output agency.txt Filter based on arguments passed from shell.
Python
bsd-2-clause
sensiblecodeio/diet-gtfs
37f28dba866ffa3457a4f14a7d3e74e8e88a1dd0
testing/get_value_test.py
testing/get_value_test.py
#!/usr/bin/env python from __future__ import print_function import sys import numpy as np from bmi import MyBMI def print_var_values (bmi, var_name): s = ', '.join ([str (x) for x in bmi.get_value (var_name)]) print ('%s' % s) def run (): bmi = MyBMI () bmi.initialize (None) print ('%s' % bmi...
#!/usr/bin/env python from __future__ import print_function import sys import numpy as np from poisson import BmiPoisson def main(): model = BmiPoisson() model.initialize() print('%s' % model.get_component_name ()) for i in xrange(10): print('Time %d' % i) np.savetxt(sys.stdout, ...
Update to use new bmi model.
Update to use new bmi model.
Python
mit
mperignon/bmi-STM,mperignon/bmi-delta,mperignon/bmi-STM,mperignon/bmi-delta
3fdc0db2608427ccb63b53b827e2a78aee40366a
tests/test_ui_elements.py
tests/test_ui_elements.py
import pytest @pytest.fixture def pyglui_ui_instance(): import glfw from pyglui import cygl, ui glfw.ERROR_REPORTING = "raise" glfw_init_successful = glfw.init() assert glfw_init_successful, "Failed to initialize GLFW" glfw.window_hint(glfw.VISIBLE, glfw.FALSE) try: window = glfw...
import pytest @pytest.fixture def pyglui_ui_instance(): import glfw from pyglui import cygl, ui glfw.ERROR_REPORTING = "raise" try: glfw_init_successful = glfw.init() assert glfw_init_successful, "Failed to initialize GLFW" glfw.window_hint(glfw.VISIBLE, glfw.FALSE) w...
Allow glfw.init() to fail on CI as well
Allow glfw.init() to fail on CI as well
Python
mit
pupil-labs/pyglui,pupil-labs/pyglui
fcec71d285236dc3906611323ab74ecd89337081
metakernel/magics/tests/test_edit_magic.py
metakernel/magics/tests/test_edit_magic.py
from metakernel.tests.utils import (get_kernel, get_log_text, clear_log_text, EvalKernel) def test_edit_magic(): kernel = get_kernel(EvalKernel) results = kernel.do_execute("%edit LICENSE.txt") text = results["payload"][0]["text"] assert '%%file LICENSE.txt\n\n# Co...
from metakernel.tests.utils import (get_kernel, get_log_text, clear_log_text, EvalKernel) def test_edit_magic(): kernel = get_kernel(EvalKernel) results = kernel.do_execute("%%edit %s" % __file__) text = results["payload"][0]["text"] assert text.startswith('%%file...
Fix test edit magic test
Fix test edit magic test
Python
bsd-3-clause
Calysto/metakernel
7a21d2bccbcff2eb6a8b7cfd00c38a28553c0bcd
gratipay/models/country.py
gratipay/models/country.py
from __future__ import absolute_import, division, print_function, unicode_literals from postgres.orm import Model class Country(Model): """Represent country records from our database (read-only). :var int id: the record's primary key in our ``countries`` table :var unicode code: the country's `ISO 3166-...
from __future__ import absolute_import, division, print_function, unicode_literals from postgres.orm import Model class Country(Model): """Represent country records from our database (read-only). :var int id: the record's primary key in our ``countries`` table :var unicode code: the country's `ISO 3166-...
Add a helper to Country; should go upstream prolly
Add a helper to Country; should go upstream prolly
Python
mit
gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com