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
6bc1f6e466fa09dd0bc6a076f9081e1aa03efdc7
examples/translations/dutch_test_1.py
examples/translations/dutch_test_1.py
# Dutch Language Test from seleniumbase.translate.dutch import Testgeval class MijnTestklasse(Testgeval): def test_voorbeeld_1(self): self.openen("https://nl.wikipedia.org/wiki/Hoofdpagina") self.controleren_element('a[title*="hoofdpagina gaan"]') self.controleren_tekst("Welkom op Wikiped...
# Dutch Language Test from seleniumbase.translate.dutch import Testgeval class MijnTestklasse(Testgeval): def test_voorbeeld_1(self): self.openen("https://nl.wikipedia.org/wiki/Hoofdpagina") self.controleren_element('a[title*="hoofdpagina gaan"]') self.controleren_tekst("Welkom op Wikiped...
Update the Dutch example test
Update the Dutch example test
Python
mit
seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase
f8d8aac9f342c10268165f4e2e641a6c667f97fd
Algorithms/Implementation/the-grid-search.py
Algorithms/Implementation/the-grid-search.py
# Python 2 import sys def search_inside(G, P, R, C, r, c): for i in range(R - r + 1): for j in range(C - c + 1): valid = True for k in range(r): if G[i + k][j:j + c] != P[k]: valid = False break if va...
# Python 2 import sys def search_inside(G, P, R, C, r, c): for i in range(R - r + 1): for j in range(C - c + 1): valid = True for k in range(r): if G[i + k][j:j + c] != P[k]: valid = False break # break out of for-l...
Add comment to clarify roll of break on line 12
Add comment to clarify roll of break on line 12
Python
mit
ugaliguy/HackerRank,ugaliguy/HackerRank,ugaliguy/HackerRank
7e068075c6cd231926cc5f5469472f3fafba7c18
biwako/bin/fields/util.py
biwako/bin/fields/util.py
import sys from .base import Field class Reserved(Field): def __init__(self, *args, **kwargs): super(Reserved, self).__init__(*args, **kwargs) # Hack to add the reserved field to the class without # having to explicitly give it a (likely useless) name frame = sys._getf...
import sys from .base import Field from ..fields import args class Reserved(Field): default = args.Override(default=None) def __init__(self, *args, **kwargs): super(Reserved, self).__init__(*args, **kwargs) # Hack to add the reserved field to the class without # having ...
Add a default value of None for reserved fields
Add a default value of None for reserved fields
Python
bsd-3-clause
gulopine/steel
dc2c960bb937cc287dedf95d407ed2e95f3f6724
sigma_files/serializers.py
sigma_files/serializers.py
from rest_framework import serializers from sigma.utils import CurrentUserCreateOnlyDefault from sigma_files.models import Image class ImageSerializer(serializers.ModelSerializer): class Meta: model = Image file = serializers.ImageField(max_length=255) height = serializers.IntegerField(source='f...
from rest_framework import serializers from dry_rest_permissions.generics import DRYPermissionsField from sigma.utils import CurrentUserCreateOnlyDefault from sigma_files.models import Image class ImageSerializer(serializers.ModelSerializer): class Meta: model = Image file = serializers.ImageField(m...
Add permissions field on ImageSerializer
Add permissions field on ImageSerializer
Python
agpl-3.0
ProjetSigma/backend,ProjetSigma/backend
05c9039c364d87c890cffdb9de7f0c8d1f7f9cb3
tfx/orchestration/config/kubernetes_component_config.py
tfx/orchestration/config/kubernetes_component_config.py
# Lint as: python2, python3 # Copyright 2019 Google LLC. 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 req...
# Lint as: python2, python3 # Copyright 2019 Google LLC. 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 req...
Convert k8s pod spec into dict structure to make sure that it's json serializable.
Convert k8s pod spec into dict structure to make sure that it's json serializable. PiperOrigin-RevId: 279162159
Python
apache-2.0
tensorflow/tfx,tensorflow/tfx
0f0a5e42422f71143c8bcbc3278ad0dc3b81c818
eratosthenes_lambda.py
eratosthenes_lambda.py
from __future__ import print_function from timeit import default_timer as timer import json import datetime print('Loading function') def eratosthenes(n): sieve = [ True for i in range(n+1) ] def markOff(pv): for i in range(pv+pv, n+1, pv): sieve[i] = False markOff(2) f...
from __future__ import print_function from timeit import default_timer as timer import json import datetime print('Loading function') def eratosthenes(n): sieve = [ True for i in range(n+1) ] def markOff(pv): for i in range(pv+pv, n+1, pv): sieve[i] = False markOff(2) for i in ...
Convert tabs to spaces per PEP 8.
Convert tabs to spaces per PEP 8.
Python
mit
jconning/lambda-cpu-cost,jconning/lambda-cpu-cost
525e7d5061326c7c815f4ede7757afb7c085ff78
apartments/models.py
apartments/models.py
from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker Base = declarative_base() class Listing(Base): __tablename__ = 'listings' id = Column(Integer, primary_key=True) craigslist_id = Column(String, u...
from sqlalchemy import create_engine, Column, DateTime, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from sqlalchemy.sql import func Base = declarative_base() class Listing(Base): __tablename__ = 'listings' id = Column(Integer, primary_key=...
Add timestamp field to Listing
Add timestamp field to Listing
Python
mit
rlucioni/apartments,rlucioni/craigbot,rlucioni/craigbot
f67746750bdd2a1d6e662b1fc36d5a6fa13098c5
scripts/generate.py
scripts/generate.py
#!/usr/bin/env python template = """#!/bin/bash #PBS -l walltime=72:00:00 #PBS -l nodes=1:ppn=1 cd /RQusagers/vanmerb/rnnencdec export PYTHONPATH=/RQusagers/vanmerb/rnnencdec/groundhog-private/:$PYTHONPATH python /RQusagers/vanmerb/rnnencdec/groundhog-private/scripts/RNN_Enc_Dec_Phrase.py \"{options}\" >{log} 2>&1"...
#!/usr/bin/env python template = """#!/bin/bash #PBS -l walltime=72:00:00 #PBS -l nodes=1:ppn=1 cd /RQusagers/vanmerb/rnnencdec export PYTHONPATH=/RQusagers/vanmerb/rnnencdec/groundhog-private/:$PYTHONPATH python /RQusagers/vanmerb/rnnencdec/groundhog-private/scripts/RNN_Enc_Dec_Phrase.py \"{options}\" >{log} 2>&1"...
Add different prefixes for the experiments
Add different prefixes for the experiments
Python
bsd-3-clause
rizar/groundhog-private
7675547ab7669d1df03bf258ffc676799879a191
build/android/pylib/gtest/gtest_config.py
build/android/pylib/gtest/gtest_config.py
# Copyright (c) 2013 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. """Configuration file for android gtest suites.""" # Add new suites here before upgrading them to the stable list below. EXPERIMENTAL_TEST_SUITES = [ ...
# Copyright (c) 2013 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. """Configuration file for android gtest suites.""" # Add new suites here before upgrading them to the stable list below. EXPERIMENTAL_TEST_SUITES = [ ] ...
Move content_browsertests to main waterfall/trybots.
[Android] Move content_browsertests to main waterfall/trybots. It's passing consistently on android_fyi_dbg trybots and on FYI waterfall bots running ICS. BUG=270144 NOTRY=True Review URL: https://chromiumcodereview.appspot.com/22299007 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@216442 0039d316-1c4b-4281-...
Python
bsd-3-clause
jaruba/chromium.src,krieger-od/nwjs_chromium.src,krieger-od/nwjs_chromium.src,Chilledheart/chromium,patrickm/chromium.src,hgl888/chromium-crosswalk,M4sse/chromium.src,Chilledheart/chromium,Fireblend/chromium-crosswalk,bright-sparks/chromium-spacewalk,markYoungH/chromium.src,ltilve/chromium,ChromiumWebApps/chromium,mark...
8abd52f37e713d9d26cccd5c073fe338145759fd
child_sync_gp/model/project_compassion.py
child_sync_gp/model/project_compassion.py
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file _...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file _...
Fix bug in write project.
Fix bug in write project.
Python
agpl-3.0
CompassionCH/compassion-switzerland,eicher31/compassion-switzerland,eicher31/compassion-switzerland,eicher31/compassion-switzerland,CompassionCH/compassion-switzerland,Secheron/compassion-switzerland,ecino/compassion-switzerland,ndtran/compassion-switzerland,MickSandoz/compassion-switzerland,Secheron/compassion-switzer...
1986000f7e3fff1366de245dadf8cd3b6e53f238
djstripe/contrib/rest_framework/permissions.py
djstripe/contrib/rest_framework/permissions.py
""" .. module:: dj-stripe.contrib.rest_framework.permissions. :synopsis: dj-stripe - Permissions to be used with the dj-stripe REST API. .. moduleauthor:: @kavdev, @pydanny """ from rest_framework.permissions import BasePermission from ...settings import subscriber_request_callback from ...utils import subscrib...
""" .. module:: dj-stripe.contrib.rest_framework.permissions. :synopsis: dj-stripe - Permissions to be used with the dj-stripe REST API. .. moduleauthor:: @kavdev, @pydanny """ from rest_framework.permissions import BasePermission from ...settings import subscriber_request_callback from ...utils import subscrib...
Fix missing return statement in DJStripeSubscriptionPermission
Fix missing return statement in DJStripeSubscriptionPermission Fixes #1250
Python
mit
dj-stripe/dj-stripe,dj-stripe/dj-stripe,pydanny/dj-stripe,pydanny/dj-stripe
94351ce09112c7bd4c9ed58722334ee48fe99883
datapackage_pipelines_fiscal/processors/upload.py
datapackage_pipelines_fiscal/processors/upload.py
import os import zipfile import tempfile from datapackage_pipelines.wrapper import ingest, spew import gobble params, datapackage, res_iter = ingest() spew(datapackage, res_iter) user = gobble.user.User() in_filename = open(params['in-file'], 'rb') in_file = zipfile.ZipFile(in_filename) temp_dir = tempfile.mkdtemp...
import os import zipfile import tempfile from datapackage_pipelines.wrapper import ingest, spew import gobble params, datapackage, res_iter = ingest() spew(datapackage, res_iter) user = gobble.user.User() in_filename = open(params['in-file'], 'rb') in_file = zipfile.ZipFile(in_filename) temp_dir = tempfile.mkdtemp...
Set the publication with a parameter.
Set the publication with a parameter.
Python
mit
openspending/datapackage-pipelines-fiscal
ec4d84e0b67d26dd9888d1b54adda6fbbcdc67da
packages/blueprints/api.py
packages/blueprints/api.py
from flask import Blueprint, render_template, abort, request, redirect, session, url_for from flask.ext.login import current_user, login_user from sqlalchemy import desc from packages.objects import * from packages.common import * from packages.config import _cfg import os import zipfile import urllib api = Blueprint...
from flask import Blueprint, render_template, abort, request, redirect, session, url_for from flask.ext.login import current_user, login_user from sqlalchemy import desc from packages.objects import * from packages.common import * from packages.config import _cfg import os import zipfile import urllib api = Blueprint...
Add API endpoint for logging in
Add API endpoint for logging in
Python
mit
KnightOS/packages.knightos.org,MaxLeiter/packages.knightos.org,MaxLeiter/packages.knightos.org,KnightOS/packages.knightos.org,KnightOS/packages.knightos.org,MaxLeiter/packages.knightos.org
58c97445c8d55d48e03498c758f7b7c6dee245aa
enabled/_50_admin_add_monitoring_panel.py
enabled/_50_admin_add_monitoring_panel.py
# The name of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'monitoring' # The name of the dashboard the PANEL associated with. Required. PANEL_DASHBOARD = 'overcloud' # The name of the panel group the PANEL is associated with. #PANEL_GROUP = 'admin' # Python panel class of the PANEL to be added. ADD_PANE...
# The name of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'monitoring' # The name of the dashboard the PANEL associated with. Required. PANEL_DASHBOARD = 'overcloud' # The name of the panel group the PANEL is associated with. #PANEL_GROUP = 'admin' DEFAULT_PANEL = 'monitoring' # Python panel class of t...
Set DEFAULT_PANEL to monitoring panel
Set DEFAULT_PANEL to monitoring panel
Python
apache-2.0
stackforge/monasca-ui,openstack/monasca-ui,openstack/monasca-ui,stackforge/monasca-ui,openstack/monasca-ui,openstack/monasca-ui,stackforge/monasca-ui,stackforge/monasca-ui
948c269ba191339a471844eb512448941be4497c
readthedocs/doc_builder/base.py
readthedocs/doc_builder/base.py
from functools import wraps import os from functools import wraps def restoring_chdir(fn): @wraps(fn) def decorator(*args, **kw): try: path = os.getcwd() return fn(*args, **kw) finally: os.chdir(path) return decorator class BaseBuilder(object): """ ...
from functools import wraps import os from functools import wraps def restoring_chdir(fn): @wraps(fn) def decorator(*args, **kw): try: path = os.getcwd() return fn(*args, **kw) finally: os.chdir(path) return decorator class BaseBuilder(object): """ ...
Kill _changed from the Base so subclassing makes more sense.
Kill _changed from the Base so subclassing makes more sense.
Python
mit
gjtorikian/readthedocs.org,cgourlay/readthedocs.org,tddv/readthedocs.org,wanghaven/readthedocs.org,asampat3090/readthedocs.org,kenwang76/readthedocs.org,KamranMackey/readthedocs.org,clarkperkins/readthedocs.org,VishvajitP/readthedocs.org,emawind84/readthedocs.org,Carreau/readthedocs.org,johncosta/private-readthedocs.or...
7cedab4826d5d184e595864f4cf5ca3966a1921e
random_object_id/random_object_id.py
random_object_id/random_object_id.py
import binascii import os import time from optparse import OptionParser def gen_random_object_id(): timestamp = '{0:x}'.format(int(time.time())) rest = binascii.b2a_hex(os.urandom(8)).decode('ascii') return timestamp + rest if __name__ == '__main__': parser = OptionParser() parser.add_option('-l...
import binascii import os import time from argparse import ArgumentParser def gen_random_object_id(): timestamp = '{0:x}'.format(int(time.time())) rest = binascii.b2a_hex(os.urandom(8)).decode('ascii') return timestamp + rest if __name__ == '__main__': parser = ArgumentParser(description='Generate a...
Use argparse instead of optparse
Use argparse instead of optparse
Python
mit
mxr/random-object-id
404b9208d98753dfccffb6c87594cfc70faed073
filer/tests/general.py
filer/tests/general.py
#-*- coding: utf-8 -*- from django.test import TestCase import filer class GeneralTestCase(TestCase): def test_version_is_set(self): self.assertTrue(len(filer.get_version())>0) def test_travisci_configuration(self): self.assertTrue(False)
#-*- coding: utf-8 -*- from django.test import TestCase import filer class GeneralTestCase(TestCase): def test_version_is_set(self): self.assertTrue(len(filer.get_version())>0)
Revert "travis ci: test if it REALLY works"
Revert "travis ci: test if it REALLY works" This reverts commit 78d87177c71adea7cc06d968374d2c2197dc5289.
Python
bsd-3-clause
Flight/django-filer,obigroup/django-filer,DylannCordel/django-filer,vstoykov/django-filer,o-zander/django-filer,mitar/django-filer,stefanfoulis/django-filer,skirsdeda/django-filer,thomasbilk/django-filer,kriwil/django-filer,sbussetti/django-filer,jakob-o/django-filer,lory87/django-filer,rollstudio/django-filer,Flight/d...
bbe2ef061eb52113d4579eac0415c79275b04721
src/masterfile/formatters.py
src/masterfile/formatters.py
# -*- coding: utf-8 -*- # Part of the masterfile package: https://github.com/njvack/masterfile # Copyright (c) 2018 Board of Regents of the University of Wisconsin System # Written by Nate Vack <njvack@wisc.edu> at the Center for Healthy Minds # at the University of Wisconsin-Madison. # Released under MIT licence; see...
# -*- coding: utf-8 -*- # Part of the masterfile package: https://github.com/njvack/masterfile # Copyright (c) 2018 Board of Regents of the University of Wisconsin System # Written by Nate Vack <njvack@wisc.edu> at the Center for Healthy Minds # at the University of Wisconsin-Madison. # Released under MIT licence; see...
Improve documentation for column formatter
Improve documentation for column formatter The algorithm is similar to a "convert to base X" one, except that it doesn't have a zero -- we go from "Z" to "AA" which is like going from 9 to 11. This is important enough to mention.
Python
mit
njvack/masterfile
ffb8f3f0d1fe17e13b349f8f4bae8fd9acbbd146
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ethan Zimmerman # Copyright (c) 2014 Ethan Zimmerman # # License: MIT # """This module exports the RamlCop plugin class.""" from SublimeLinter.lint import NodeLinter class RamlCop(NodeLinter): """Provides an ...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ethan Zimmerman # Copyright (c) 2014 Ethan Zimmerman # # License: MIT # """This module exports the RamlCop plugin class.""" from SublimeLinter.lint import NodeLinter class RamlCop(NodeLinter): """Provides an ...
Update regex to match new parser output
Update regex to match new parser output
Python
mit
thebinarypenguin/SublimeLinter-contrib-raml-cop
90c5c9db788c0450483d71c38155fcf0a9d56220
sc2reader/engine/plugins/apm.py
sc2reader/engine/plugins/apm.py
from collections import Counter class APMTracker(object): def handleInitGame(self, event, replay): for player in replay.players: player.apm = Counter() player.aps = Counter() player.seconds_played = replay.length.seconds def handlePlayerActionEvent(self, event, rep...
from collections import Counter class APMTracker(object): """ Builds ``player.aps`` and ``player.apm`` dictionaries where an action is any Selection, Hotkey, or Ability event. Also provides ``player.avg_apm`` which is defined as the sum of all the above actions divided by the number of seconds pla...
Fix the engine's APM plugin and add some documentation.
Fix the engine's APM plugin and add some documentation.
Python
mit
StoicLoofah/sc2reader,vlaufer/sc2reader,ggtracker/sc2reader,GraylinKim/sc2reader,GraylinKim/sc2reader,vlaufer/sc2reader,ggtracker/sc2reader,StoicLoofah/sc2reader
cd1eac109ed52f34df35ecea95935b7546147c87
tests/builtins/test_sum.py
tests/builtins/test_sum.py
from .. utils import TranspileTestCase, BuiltinFunctionTestCase class SumTests(TranspileTestCase): def test_sum_list(self): self.assertCodeExecution(""" print(sum([1, 2, 3, 4, 5, 6, 7])) """) def test_sum_tuple(self): self.assertCodeExecution(""" print(sum((1, ...
from .. utils import TranspileTestCase, BuiltinFunctionTestCase class SumTests(TranspileTestCase): def test_sum_list(self): self.assertCodeExecution(""" print(sum([1, 2, 3, 4, 5, 6, 7])) print(sum([[1, 2], [3, 4], [5, 6]], [])) """) def test_sum_tuple(self): se...
Add more tests for the sum builtin
Add more tests for the sum builtin
Python
bsd-3-clause
cflee/voc,freakboy3742/voc,freakboy3742/voc,cflee/voc
f3aea781c633c2ee212b59f17a6028684041568c
scripts/dbutil/clean_afos.py
scripts/dbutil/clean_afos.py
""" Clean up the AFOS database called from RUN_2AM.sh """ import psycopg2 AFOS = psycopg2.connect(database='afos', host='iemdb') acursor = AFOS.cursor() acursor.execute(""" delete from products WHERE entered < ('YESTERDAY'::date - '7 days'::interval) and entered > ('YESTERDAY'::date - '31 days'::interval...
"""Clean up some tables that contain bloaty NWS Text Data called from RUN_2AM.sh """ import psycopg2 # Clean AFOS AFOS = psycopg2.connect(database='afos', host='iemdb') acursor = AFOS.cursor() acursor.execute(""" delete from products WHERE entered < ('YESTERDAY'::date - '7 days'::interval) and entered >...
Add purging of postgis/text_products table
Add purging of postgis/text_products table
Python
mit
akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem
69c81b16e07b67ba0a0bc8e1f55049e7987c5b8c
openstack_dashboard/dashboards/admin/instances/panel.py
openstack_dashboard/dashboards/admin/instances/panel.py
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
Fix an incorrect policy rule in Admin > Instances
Fix an incorrect policy rule in Admin > Instances Change-Id: I765ae0c36d19c88138fbea9545a2ca4791377ffb Closes-Bug: #1703066
Python
apache-2.0
BiznetGIO/horizon,BiznetGIO/horizon,noironetworks/horizon,ChameleonCloud/horizon,yeming233/horizon,NeCTAR-RC/horizon,yeming233/horizon,BiznetGIO/horizon,yeming233/horizon,openstack/horizon,noironetworks/horizon,NeCTAR-RC/horizon,yeming233/horizon,ChameleonCloud/horizon,NeCTAR-RC/horizon,noironetworks/horizon,openstack/...
5516b125bb00b928d85a044d3df777e1b0004d03
ovp_organizations/migrations/0008_auto_20161207_1941.py
ovp_organizations/migrations/0008_auto_20161207_1941.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-12-07 19:41 from __future__ import unicode_literals from django.db import migrations from ovp_organizations.models import Organization def add_members(apps, schema_editor): for organization in Organization.objects.all(): organization.members.add(orga...
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-12-07 19:41 from __future__ import unicode_literals from django.db import migrations from ovp_organizations.models import Organization def add_members(apps, schema_editor): for organization in Organization.objects.only('pk', 'members').all(): organiz...
Add ".only" restriction to query on migration 0008
Add ".only" restriction to query on migration 0008
Python
agpl-3.0
OpenVolunteeringPlatform/django-ovp-organizations,OpenVolunteeringPlatform/django-ovp-organizations
8b7529551d11c67aad4729e53a2b25473599b1f7
billjobs/urls.py
billjobs/urls.py
from django.conf.urls import url, include from rest_framework.authtoken.views import obtain_auth_token from . import views router = routers.DefaultRouter() router.register(r'users', views.UserViewSet) urlpatterns = [ url(r'^generate_pdf/(?P<bill_id>\d+)$', views.generate_pdf, name='generate-pdf'), url...
from django.conf.urls import url, include from rest_framework.authtoken.views import obtain_auth_token from . import views urlpatterns = [ url(r'^generate_pdf/(?P<bill_id>\d+)$', views.generate_pdf, name='generate-pdf'), url(r'^users/$', views.UserAdmin.as_view(), name='users'), url(r'^users/(?P<pk...
Remove rest_framework routers, add urlpattern for users api
Remove rest_framework routers, add urlpattern for users api
Python
mit
ioO/billjobs
f8bc5893ee875a309361c26b93996917dbef3ba8
silk/webdoc/html/__init__.py
silk/webdoc/html/__init__.py
from .common import *
from .common import ( # noqa A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, ARTICLE, ASIDE, AUDIO, B, BASE, BASEFONT, BDI, BDO, BIG, BLOCKQUOTE, BODY, BR, BUTTON, Body, CANVAS, CAPTION, CAT, CENTER, CITE, CODE, COL, ...
Replace import * with explicit names
Replace import * with explicit names
Python
bsd-3-clause
orbnauticus/silk
4ec16018192c1bd8fbe60a9e4c410c6c898149f0
server/ec2spotmanager/migrations/0007_instance_type_to_list.py
server/ec2spotmanager/migrations/0007_instance_type_to_list.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2018-02-28 16:47 from __future__ import unicode_literals from django.db import migrations, models def instance_types_to_list(apps, schema_editor): PoolConfiguration = apps.get_model("ec2spotmanager", "PoolConfiguration") for pool in PoolConfiguration.ob...
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2018-02-28 16:47 from __future__ import print_function, unicode_literals import json import sys from django.db import migrations, models def instance_type_to_list(apps, schema_editor): PoolConfiguration = apps.get_model("ec2spotmanager", "PoolConfiguration"...
Fix migration. Custom triggers are not run in data migrations.
Fix migration. Custom triggers are not run in data migrations.
Python
mpl-2.0
MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager
19cd85215a7a305e6f253405a88d087aef114811
candidates/tests/test_constituencies_view.py
candidates/tests/test_constituencies_view.py
import re from django_webtest import WebTest class TestConstituencyDetailView(WebTest): def test_constituencies_page(self): # Just a smoke test to check that the page loads: response = self.app.get('/constituencies') aberdeen_north = response.html.find( 'a', text=re.compile(r'...
import re from mock import patch from django_webtest import WebTest class TestConstituencyDetailView(WebTest): @patch('candidates.popit.PopIt') def test_constituencies_page(self, mock_popit): # Just a smoke test to check that the page loads: response = self.app.get('/constituencies') ...
Make test_constituencies_page work without PopIt
Make test_constituencies_page work without PopIt
Python
agpl-3.0
DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mysociety/yournextrepresentative,YoQuieroSaber/yournextrepresentative,YoQuieroSaber/yournextrepresentative,openstate/...
723a102d6272e7ba4b9df405b7c1493c34ac5b77
masters/master.chromium.fyi/master_site_config.py
masters/master.chromium.fyi/master_site_config.py
# Copyright 2013 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. """ActiveMaster definition.""" from config_bootstrap import Master class ChromiumFYI(Master.Master1): project_name = 'Chromium FYI' master_port = 8011 ...
# Copyright 2013 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. """ActiveMaster definition.""" from config_bootstrap import Master class ChromiumFYI(Master.Master1): project_name = 'Chromium FYI' master_port = 8011 ...
Revert pubsub roll on FYI
Revert pubsub roll on FYI BUG= TBR=estaab Review URL: https://codereview.chromium.org/1688503002 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@298680 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
39d3f605d240a8abef22107424ec1d6f76161580
static_precompiler/models.py
static_precompiler/models.py
from django.db import models class Dependency(models.Model): source = models.CharField(max_length=255, db_index=True) depends_on = models.CharField(max_length=255, db_index=True) class Meta: unique_together = ("source", "depends_on")
from __future__ import unicode_literals from django.db import models class Dependency(models.Model): source = models.CharField(max_length=255, db_index=True) depends_on = models.CharField(max_length=255, db_index=True) class Meta: unique_together = ("source", "depends_on") def __unicode__(s...
Add __unicode__ to Dependency model
Add __unicode__ to Dependency model
Python
mit
jaheba/django-static-precompiler,jaheba/django-static-precompiler,paera/django-static-precompiler,liumengjun/django-static-precompiler,jaheba/django-static-precompiler,liumengjun/django-static-precompiler,paera/django-static-precompiler,liumengjun/django-static-precompiler,liumengjun/django-static-precompiler,liumengju...
d2051073d48873408a711b56676ee099e5ff685a
sunpy/timeseries/__init__.py
sunpy/timeseries/__init__.py
""" SunPy's TimeSeries module provides a datatype for 1D time series data, replacing the SunPy LightCurve module. Currently the objects can be instansiated from files (such as CSV and FITS) and urls to these files, but don't include data downloaders for their specific instruments as this will become part of the univer...
""" SunPy's TimeSeries module provides a datatype for 1D time series data, replacing the SunPy LightCurve module. Currently the objects can be instansiated from files (such as CSV and FITS) and urls to these files, but don't include data downloaders for their specific instruments as this will become part of the univer...
Fix matplotlib / pandas 0.21 bug in examples
Fix matplotlib / pandas 0.21 bug in examples Here we manually register the pandas matplotlib converters so people doing manual plotting with pandas works under pandas 0.21
Python
bsd-2-clause
dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy
dae3f42c6f6800181bc1d9f2e98cbacf03849431
scripts/create_heatmap.py
scripts/create_heatmap.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os sys.path.append(os.path.dirname(os.path.dirname(__file__)) + '/src') import DataVisualizing if len(sys.argv) != 2: print 'usage: create_heatmap.py <data file>' print ' expected infile is a datafile containing tracking data' print ' this is a...
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os sys.path.append(os.path.dirname(os.path.dirname(__file__)) + '/src') import DataVisualizing if len(sys.argv) != 2: print 'usage: create_heatmap.py <data file>' print ' expected infile is a datafile containing tracking data' print ' this is a...
Add raw line data to output
Add raw line data to output
Python
mit
LifeWatchINBO/bird-tracking,LifeWatchINBO/bird-tracking
2de7222ffd3d9f4cc7971ad142aa2542eb7ca117
yunity/stores/models.py
yunity/stores/models.py
from config import settings from yunity.base.base_models import BaseModel, LocationModel from django.db import models class PickupDate(BaseModel): date = models.DateTimeField() collectors = models.ManyToManyField(settings.AUTH_USER_MODEL) store = models.ForeignKey('stores.store', related_name='pickupdates...
from config import settings from yunity.base.base_models import BaseModel, LocationModel from django.db import models class PickupDate(BaseModel): date = models.DateTimeField() collectors = models.ManyToManyField(settings.AUTH_USER_MODEL) store = models.ForeignKey('stores.store', related_name='pickupdates...
Add related name for group of store
Add related name for group of store
Python
agpl-3.0
yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend
7ddc4b975910bf9c77b753e8e0aeaebc45949e4e
linkatos.py
linkatos.py
#! /usr/bin/env python import os import time from slackclient import SlackClient import pyrebase import linkatos.parser as parser import linkatos.confirmation as confirmation import linkatos.printer as printer import linkatos.utils as utils import linkatos.firebase as fb # starterbot environment variables BOT_ID = os....
#! /usr/bin/env python import os import time from slackclient import SlackClient import pyrebase import linkatos.firebase as fb # starterbot environment variables BOT_ID = os.environ.get("BOT_ID") SLACK_BOT_TOKEN = os.environ.get("SLACK_BOT_TOKEN") # instantiate Slack clients slack_client = SlackClient(SLACK_BOT_TOKE...
Remove old imports from main
refactor: Remove old imports from main
Python
mit
iwi/linkatos,iwi/linkatos
d5cd1eddf1ecf0c463a90d0e69413aadd311977a
lots/urls.py
lots/urls.py
from django.conf.urls import patterns, include, url from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^$', 'lots_client.views.home', name='home'), url(r'^status/$', 'lots_client.views.status', name='status'), url(r'^appl...
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^$', 'lots_client.views.home', name='home'), url(r'^status/$', 'lots_client.views.status', name='status'), url(r'^apply/$', 'lots_client.views.apply', ...
Revert "Picture access from admin console"
Revert "Picture access from admin console" This reverts commit 324fa160fb629f6c4537ca15212c0822e8ac436d.
Python
mit
opencleveland/large-lots,skorasaurus/large-lots,opencleveland/large-lots,skorasaurus/large-lots,skorasaurus/large-lots,skorasaurus/large-lots,opencleveland/large-lots,opencleveland/large-lots
88a31ebcd7b65f9282bb0d0a19ad299c1ad431ec
spectral_cube/__init__.py
spectral_cube/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This is an Astropy affiliated package. """ # Affiliated packages may add whatever they like to this file, but # should keep this content at the top. # ---------------------------------------------------------------------------- from ._astropy_init im...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This is an Astropy affiliated package. """ # Affiliated packages may add whatever they like to this file, but # should keep this content at the top. # ---------------------------------------------------------------------------- from ._astropy_init im...
Make Projection importable from the top level of the package
Make Projection importable from the top level of the package
Python
bsd-3-clause
e-koch/spectral-cube,jzuhone/spectral-cube,radio-astro-tools/spectral-cube,keflavich/spectral-cube,low-sky/spectral-cube
26749bd6bd36c4cd930e60c1eb2d0460fd16506e
CodeFights/knapsackLight.py
CodeFights/knapsackLight.py
#!/usr/local/bin/python # Code Fights Knapsack Problem def knapsackLight(value1, weight1, value2, weight2, maxW): if weight1 + weight2 <= maxW: return value1 + value2 else: return max([v for v, w in zip((value1, value2), (weight1, weight2)) if w <= maxW] + [0]) def main():...
#!/usr/local/bin/python # Code Fights Knapsack Problem def knapsackLight(value1, weight1, value2, weight2, maxW): if weight1 + weight2 <= maxW: return value1 + value2 else: return max([v for v, w in zip((value1, value2), (weight1, weight2)) if w <= maxW] + [0]) def main():...
Add half tests to knapsack light problem
Add half tests to knapsack light problem
Python
mit
HKuz/Test_Code
a8d2ede0a38188670f6921bd9c2f08ee073b0cdd
test/test_configuration.py
test/test_configuration.py
from __future__ import with_statement import os.path import tempfile from nose.tools import * from behave import configuration # one entry of each kind handled TEST_CONFIG='''[behave] outfile=/tmp/spam paths = /absolute/path relative/path tags = @foo,~@bar @zap format=pretty tag-counter stdout_c...
from __future__ import with_statement import os.path import tempfile from nose.tools import * from behave import configuration # one entry of each kind handled TEST_CONFIG='''[behave] outfile=/tmp/spam paths = /absolute/path relative/path tags = @foo,~@bar @zap format=pretty tag-counter stdout_c...
FIX test for Windows platform.
FIX test for Windows platform.
Python
bsd-2-clause
allanlewis/behave,allanlewis/behave,Gimpneek/behave,vrutkovs/behave,metaperl/behave,kymbert/behave,jenisys/behave,Abdoctor/behave,kymbert/behave,benthomasson/behave,mzcity123/behave,joshal/behave,charleswhchan/behave,joshal/behave,hugeinc/behave-parallel,benthomasson/behave,spacediver/behave,connorsml/behave,KevinOrtma...
6a4046aafe43930c202e2f18a55b1cd8517d95f9
testanalyzer/javaanalyzer.py
testanalyzer/javaanalyzer.py
import re from fileanalyzer import FileAnalyzer class JavaAnalyzer(FileAnalyzer): def get_class_count(self, content): return len( re.findall("[a-zA-Z ]*class +[a-zA-Z0-9_]+ *\n*\{", content)) # TODO: Accept angle brackets and decline "else if" def get_function_count(self, content): ...
import re from fileanalyzer import FileAnalyzer class JavaAnalyzer(FileAnalyzer): def get_class_count(self, content): return len( re.findall("[a-zA-Z ]*class +[a-zA-Z0-9_<>, ]+\n*\{", content)) def get_function_count(self, content): matches = re.findall( "[a-zA-Z <>]+ ...
Fix regex to match generics
Fix regex to match generics
Python
mpl-2.0
CheriPai/TestAnalyzer,CheriPai/TestAnalyzer,CheriPai/TestAnalyzer
ea1c62ae3f13d47ee820eae31a2e284e3d66b6ab
libPiLite.py
libPiLite.py
#!/usr/bin/env python def createBlankGrid(row,column): blankgrid = [[0 for x in range(column)] for y in range(row)] return blankgrid def getHeight(grid): return len(grid) def getWidth(grid): return len(grid[0]) def printGrid(grid): numRow = len(grid) for i in range(0,numRow): ro...
#!/usr/bin/env python def createBlankGrid(row,column): blankgrid = [[0 for x in range(column)] for y in range(row)] return blankgrid def getHeight(grid): return len(grid) def getWidth(grid): return len(grid[0]) def printGrid(grid): numRow = len(grid) for i in range(0,numRow): ro...
Add setGrid and resetGrid functions
Add setGrid and resetGrid functions
Python
mit
rorasa/RPiClockArray
e0b3b767ccb7fc601eb7b40d336f94d75f8aa43c
2016/python/aoc_2016_03.py
2016/python/aoc_2016_03.py
from __future__ import annotations from typing import List, Tuple from aoc_common import load_puzzle_input, report_solution def parse_horizontal(string: str) -> List[Tuple[int, int, int]]: """Parse the instruction lines into sorted triples of side lengths.""" sorted_sides = [ sorted(int(x) for x in ...
from __future__ import annotations from typing import List, Tuple from aoc_common import load_puzzle_input, report_solution def parse_horizontal(string: str) -> List[Tuple[int, int, int]]: """Parse the instruction lines into triples of side lengths.""" sides = [[int(x) for x in line.split()] for line in str...
Sort triples in separate step
2016-03.py: Sort triples in separate step
Python
mit
robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions
28fe69ab1bb9362a1ee105821ec4631b574417d3
tools/perf_expectations/PRESUBMIT.py
tools/perf_expectations/PRESUBMIT.py
#!/usr/bin/python # Copyright (c) 2009 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. """Presubmit script for perf_expectations. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for details on ...
#!/usr/bin/python # Copyright (c) 2009 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. """Presubmit script for perf_expectations. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for details on ...
Use full pathname to perf_expectations in test.
Use full pathname to perf_expectations in test. BUG=none TEST=none Review URL: http://codereview.chromium.org/266055 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@28770 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
littlstar/chromium.src,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,keishi/chromium,markYoungH/chromium.src,Just-D/chromium-1,chuan9/chromium-crosswalk,Chilledheart/chromium,timopulkkinen/BubbleFish,keishi/chromium,pozdnyakov/chromium-crosswalk,mogoweb/chromium-crosswalk,ltilve/chromium,pozdnyakov/chromium-crossw...
8b5337878172df95400a708b096e012436f8a706
dags/main_summary.py
dags/main_summary.py
from airflow import DAG from datetime import datetime, timedelta from operators.emr_spark_operator import EMRSparkOperator from airflow.operators import BashOperator default_args = { 'owner': 'mreid@mozilla.com', 'depends_on_past': False, 'start_date': datetime(2016, 6, 27), 'email': ['telemetry-alerts...
from airflow import DAG from datetime import datetime, timedelta from operators.emr_spark_operator import EMRSparkOperator from airflow.operators import BashOperator default_args = { 'owner': 'mreid@mozilla.com', 'depends_on_past': False, 'start_date': datetime(2016, 6, 25), 'email': ['telemetry-alerts...
Prepare "Main Summary" job for backfill
Prepare "Main Summary" job for backfill Set the max number of active runs so we don't overwhelm the system, and rewind the start date by a couple of days to test that the scheduler does the right thing.
Python
mpl-2.0
opentrials/opentrials-airflow,opentrials/opentrials-airflow
847375a5cd6cbc160c190c9fb5e9fa2b1f0cdea9
lustro/db.py
lustro/db.py
# -*- coding: utf-8 -*- from sqlalchemy import MetaData, create_engine from sqlalchemy.orm import Session from sqlalchemy.ext.automap import automap_base class DB(object): """Facade for the low level DB operations""" def __init__(self, dsn, schema=None): self.engine = create_engine(dsn) self....
# -*- coding: utf-8 -*- from sqlalchemy import MetaData, create_engine from sqlalchemy.orm import Session from sqlalchemy.ext.automap import automap_base class DB(object): """Facade for the low level DB operations""" def __init__(self, dsn, schema=None): self.engine = create_engine(dsn) self....
Fix arguments to diff method
Fix arguments to diff method
Python
mit
ashwoods/lustro
5a49e5bea67465528b1e644a98da282c66e9c35f
tests/fixtures/postgres.py
tests/fixtures/postgres.py
import pytest from sqlalchemy import text from sqlalchemy.exc import ProgrammingError from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlalchemy.ext.asyncio import AsyncSession from virtool.models import Base @pytest.fixture(scope="function") async def engine(): engine = create_async_en...
import pytest from sqlalchemy import text from sqlalchemy.exc import ProgrammingError from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlalchemy.ext.asyncio import AsyncSession from virtool.models import Base @pytest.fixture(scope="function") async def test_engine(): engine = create_asy...
Rename 'engine' fixture to 'test_engine'
Rename 'engine' fixture to 'test_engine'
Python
mit
igboyes/virtool,virtool/virtool,virtool/virtool,igboyes/virtool
7f59bf7b24caf0ae92abadae9427d0293f4a39b7
longshot.py
longshot.py
#!/usr/local/bin/python __version__ = '0.1' HOME_URL = 'https://raw.githubusercontent.com/ftobia/longshot/develop/longshot.py' def upgrade(): backup_self() download_and_overwrite() restart() def backup_self(): import shutil new_name = __file__ + '.bak' shutil.copy(__file__, new_name) def ...
#!/usr/local/bin/python __version__ = '0.1' HOME_URL = 'https://raw.githubusercontent.com/ftobia/longshot/develop/longshot.py' def upgrade(): backup_self() download_and_overwrite() restart() def backup_self(): import shutil new_name = __file__ + '.bak' shutil.copy(__file__, new_name) def ...
Call execvp correctly (I hope).
Call execvp correctly (I hope).
Python
bsd-3-clause
ftobia/longshot
3131ea5c8dd41d18192f685e61c1bc8987038193
vcs_info_panel/tests/test_clients/test_git.py
vcs_info_panel/tests/test_clients/test_git.py
import subprocess from unittest.mock import patch from django.test import TestCase from vcs_info_panel.clients.git import GitClient class GitClientTestCase(TestCase): def setUp(self): self.client = GitClient() def _test_called_check_output(self, commands): with patch('subprocess.check_output...
import subprocess from unittest.mock import patch from django.test import TestCase from vcs_info_panel.clients.git import GitClient def without_git_repository(func): def inner(*args, **kwargs): with patch('subprocess.check_output') as _check_output: _check_output.side_effect = subprocess.Call...
Use decorator to patch git repository is not exist
Use decorator to patch git repository is not exist
Python
mit
giginet/django-debug-toolbar-vcs-info,giginet/django-debug-toolbar-vcs-info
f4adce54b573b7776cf3f56230821f982c16b49f
modules/helloworld/helloworld.py
modules/helloworld/helloworld.py
def run(seed): """ function to run Args: seed: The value of each line striped in seed file Returns: String, object, list, directory, etc. """ name, age = seed.split(',') return 'Hello World! {}, {}'.format(seed, int(age)) def callback(result): """ callback function to ca...
import time def run(seed): """ function to run Args: seed: The value of each line striped in seed file Returns: String, object, list, directory, etc. """ name, age = seed.split(',') return 'Hello World! {}, {}'.format(seed, int(age)) def callback(result): """ callback ...
Add time.sleep(0.05) in test module
Add time.sleep(0.05) in test module
Python
mit
RickGray/cyberbot
41ba2d55ed00269465d49ba22a1cb07eb899273a
test/test_run.py
test/test_run.py
from exp_test_helper import run_exp import pytest class TestRun(): """ Run and check return code. """ @pytest.mark.fast def test_run(self): run_exp('1deg_jra55_ryf') @pytest.mark.slow def test_slow_run(self): run_exp('025deg_jra55_ryf')
from exp_test_helper import run_exp import pytest class TestRun(): """ Run and check return code. """ @pytest.mark.fast def test_1deg_jra55_run(self): run_exp('1deg_jra55_ryf') @pytest.mark.slow def test_1deg_core_run(self): run_exp('1deg_core_nyf') @pytest.mark.slo...
Include the 1deg core experiment in tests.
Include the 1deg core experiment in tests.
Python
apache-2.0
CWSL/access-om
cc3d89d4357099ba2df1628e9d91e48c743bd471
api/common/views.py
api/common/views.py
import subprocess from django.conf import settings from django.http import JsonResponse, HttpResponseBadRequest from django.shortcuts import redirect from django.views.decorators.csrf import csrf_exempt from rest_framework.authtoken.models import Token @csrf_exempt def deploy(request): deploy_secret_key = request...
import subprocess from django.conf import settings from django.http import JsonResponse, HttpResponseBadRequest from django.shortcuts import redirect from django.views.decorators.csrf import csrf_exempt from rest_framework.authtoken.models import Token @csrf_exempt def deploy(request): deploy_secret_key = request...
Fix incorrect social redirect link
Fix incorrect social redirect link
Python
apache-2.0
prattl/teamfinder,prattl/teamfinder,prattl/teamfinder,prattl/teamfinder
107b97e952d731f8c55c9ca3208ecd2a41512b8d
tests/integration/modules/sysmod.py
tests/integration/modules/sysmod.py
import integration class SysModuleTest(integration.ModuleCase): ''' Validate the sys module ''' def test_list_functions(self): ''' sys.list_functions ''' funcs = self.run_function('sys.list_functions') self.assertTrue('hosts.list_hosts' in funcs) self.as...
import integration class SysModuleTest(integration.ModuleCase): ''' Validate the sys module ''' def test_list_functions(self): ''' sys.list_functions ''' funcs = self.run_function('sys.list_functions') self.assertTrue('hosts.list_hosts' in funcs) self.as...
Add test to verify loader modules
Add test to verify loader modules
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
9058d2ddc9a89913710df0efc8d7c88471592795
back2back/management/commands/import_entries.py
back2back/management/commands/import_entries.py
import csv from optparse import make_option from django.core.management import BaseCommand from back2back.models import Entry class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option( '-i', '--input', action='store', dest='input_file', ...
import collections import csv from optparse import make_option from django.core.management import BaseCommand from back2back.models import Entry class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option( '-i', '--input', action='store', dest='i...
Save indexes as well when importing entries.
Save indexes as well when importing entries.
Python
bsd-2-clause
mjtamlyn/back2back,mjtamlyn/back2back,mjtamlyn/back2back,mjtamlyn/back2back
47a9271a00fae3f55c79323c93feb4dc2e1fd515
portal/tests/models/test_profile.py
portal/tests/models/test_profile.py
from django.contrib.auth import get_user_model from django.test import TestCase from portal.models import Profile class TestProfile(TestCase): """Profile test suite""" users = ["john", "jane"] UserModel = get_user_model() def setUp(self): for user in self.users: self.UserModel....
from django.contrib.auth import get_user_model from django.test import TestCase from portal.models import Profile class TestProfile(TestCase): """Profile test suite""" users = ["john", "jane"] UserModel = get_user_model() def setUp(self): for user in self.users: self.UserModel....
Add more profile model tests
Add more profile model tests
Python
mit
huangsam/chowist,huangsam/chowist,huangsam/chowist
f1e946f5dde4648428c91bcff59728b615df021b
packages/Python/lldbsuite/test/lang/swift/foundation_value_types/data/TestSwiftFoundationTypeData.py
packages/Python/lldbsuite/test/lang/swift/foundation_value_types/data/TestSwiftFoundationTypeData.py
# TestSwiftFoundationValueTypes.py # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.txt for license information # See https://swif...
# TestSwiftFoundationValueTypes.py # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.txt for license information # See https://swif...
Revert "x-fail this test - it was broken by changes to Data"
Revert "x-fail this test - it was broken by changes to Data" This reverts commit 4f1ce1ee7ca2d897602113ac82b55f8422a849c1.
Python
apache-2.0
apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb
76d1d1ba04e9d91559ca017c72c7291752fcc330
PVGeo/__tester__.py
PVGeo/__tester__.py
__all__ = [ 'test', ] import unittest import fnmatch import os try: from colour_runner.runner import ColourTextTestRunner as TextTestRunner except ImportError: from unittest import TextTestRunner def test(close=False): """ @desc: This is a convienance method to run all of the tests in `PVGeo`. ...
__all__ = [ 'test', ] import unittest import fnmatch import os try: from colour_runner.runner import ColourTextTestRunner as TextTestRunner except ImportError: from unittest import TextTestRunner def test(close=False): """ @desc: This is a convienance method to run all of the tests in `PVGeo`. ...
Fix python 2 testing issue
Fix python 2 testing issue
Python
bsd-3-clause
banesullivan/ParaViewGeophysics,banesullivan/ParaViewGeophysics,banesullivan/ParaViewGeophysics
416dea771c5750044b99e8c8bfe0755feeb3ee71
astropy/vo/samp/constants.py
astropy/vo/samp/constants.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Defines constants used in `astropy.vo.samp`.""" import os DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') __all__ = ['SAMP_STATUS_OK', 'SAMP_STATUS_WARNING', 'SAMP_STATUS_ERROR', 'SAMP_HUB_SINGLE_INSTANCE', 'SAMP_HUB_MULTIPLE_IN...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Defines constants used in `astropy.vo.samp`.""" import os from ...utils.data import get_pkg_data_filename __all__ = ['SAMP_STATUS_OK', 'SAMP_STATUS_WARNING', 'SAMP_STATUS_ERROR', 'SAMP_HUB_SINGLE_INSTANCE', 'SAMP_HUB_MULTIPLE_INSTANCE', ...
Make use of get_pkg_data_filename for icon
Make use of get_pkg_data_filename for icon
Python
bsd-3-clause
StuartLittlefair/astropy,StuartLittlefair/astropy,bsipocz/astropy,saimn/astropy,bsipocz/astropy,tbabej/astropy,dhomeier/astropy,aleksandr-bakanov/astropy,AustereCuriosity/astropy,larrybradley/astropy,mhvk/astropy,stargaser/astropy,dhomeier/astropy,pllim/astropy,kelle/astropy,DougBurke/astropy,AustereCuriosity/astropy,d...
745ec6f3dd227cc00c3db0d100b005fb6fd4d903
test/on_yubikey/test_cli_openpgp.py
test/on_yubikey/test_cli_openpgp.py
import unittest from ykman.util import TRANSPORT from .util import (DestructiveYubikeyTestCase, missing_mode, ykman_cli) @unittest.skipIf(*missing_mode(TRANSPORT.CCID)) class TestOpenPGP(DestructiveYubikeyTestCase): def test_openpgp_info(self): output = ykman_cli('openpgp', 'info') self.assertIn(...
import unittest from ykman.util import TRANSPORT from .util import (DestructiveYubikeyTestCase, missing_mode, ykman_cli) @unittest.skipIf(*missing_mode(TRANSPORT.CCID)) class TestOpenPGP(DestructiveYubikeyTestCase): def setUp(self): ykman_cli('openpgp', 'reset', '-f') def test_openpgp_info(self): ...
Reset OpenPGP applet before each test
Reset OpenPGP applet before each test
Python
bsd-2-clause
Yubico/yubikey-manager,Yubico/yubikey-manager
29d41cf99f66aa075bda5fed6feb78cbb9ccdd74
tests/dojo_test.py
tests/dojo_test.py
import unittest from src.dojo import Dojo class TestCreateRoom (unittest.TestCase): def setUp(self): self.dojo = Dojo() self.test_office = self.dojo.create_room("office", "test") self.test_living_space = self.dojo.create_room("living_space", "test living space") def test_create_room_...
import unittest from src.dojo import Dojo class TestCreateRoom (unittest.TestCase): def setUp(self): self.dojo = Dojo() self.test_office = self.dojo.create_room("office", "test") self.test_living_space = self.dojo.create_room("living_space", "test living space") def test_create_room_...
Add test for duplicate rooms
Add test for duplicate rooms
Python
mit
EdwinKato/Space-Allocator,EdwinKato/Space-Allocator
beb224f23403e0f7e4676aca156420420fe3653f
tests/dojo_test.py
tests/dojo_test.py
import unittest from src.dojo import Dojo class TestCreateRoom (unittest.TestCase): def test_create_room_successfully(self): my_class_instance = Dojo() initial_room_count = len(my_class_instance.all_rooms) blue_office = my_class_instance.create_room("office", "Blue") self.assertTru...
import unittest from src.dojo import Dojo class TestCreateRoom (unittest.TestCase): def test_create_room_successfully(self): my_class_instance = Dojo() initial_room_count = len(my_class_instance.all_rooms) blue_office = my_class_instance.create_room("office", "Blue") self.assertTru...
Add test to check that person has been given office
Add test to check that person has been given office
Python
mit
EdwinKato/Space-Allocator,EdwinKato/Space-Allocator
2b1e60a9910561de5a71e83d042b845f6be0bc73
__init__.py
__init__.py
from . import platform_specific, input from .graphics import screen from .run_loop import main_run_loop, every platform_specific.fixup_env() def run(): main_run_loop.add_wait_callback(input.check_for_quit_event) main_run_loop.add_after_action_callback(screen.after_loop) main_run_loop.run()
from . import platform_specific, input from .graphics import screen from .run_loop import main_run_loop, every platform_specific.fixup_env() def run(loop=None): if loop is not None: every(seconds=1.0/30)(loop) main_run_loop.add_wait_callback(input.check_for_quit_event) main_run_loop.add_after_a...
Allow run argument to avoid @every template
Allow run argument to avoid @every template
Python
bsd-2-clause
furbrain/tingbot-python
0d42aa0158bb4f13098bdb5341bead9b1d7c686a
__init__.py
__init__.py
from django.core.mail import mail_managers from django.dispatch import dispatcher from django.contrib.auth.models import User from django.db.models.signals import post_save from django.contrib.comments.signals import comment_was_posted from kamu.comments.models import KamuComment import settings def comment_notificati...
from django.core.mail import mail_managers from django.dispatch import dispatcher from django.contrib.auth.models import User from django.db.models.signals import post_save from django.contrib.comments.signals import comment_was_posted from kamu.comments.models import KamuComment import settings def comment_notificati...
Make sure to send email only when a new user is created
Make sure to send email only when a new user is created
Python
agpl-3.0
kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu
7c3edfb8971331c0058ce6426e10239f57cbfc97
app.py
app.py
import requests from flask import Flask, render_template app = Flask(__name__, instance_relative_config=True) app.config.from_pyfile("appconfig.py") BBC_id= "bbc-news" @app.route("/") def index(): r = requests.get( f"https://newsapi.org/v1/articles?source={BBC_id}&sortBy=top&apiKey={app.config['API_KEY']...
import requests from flask import Flask, render_template app = Flask(__name__, instance_relative_config=True) app.config.from_pyfile("appconfig.py") sources = { "bbc": "bbc-news", "cnn": "cnn", "hackernews": "hacker-news" } def create_link(source): if source in sources.keys(): return f"https:...
Create dynamic routing for supported sources.
Create dynamic routing for supported sources.
Python
mit
alchermd/headlines,alchermd/headlines
6c53778132eeba03acbca718d76ad703615fadc6
troposphere/kms.py
troposphere/kms.py
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, Tags from .compat import policytypes from .validators import boolean, integer_range, key_usage_type class Alias(AWSObject): resource_type = "AWS::KMS::Alias" props = { ...
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, Tags from .compat import policytypes from .validators import boolean, integer_range, key_usage_type class Alias(AWSObject): resource_type = "AWS::KMS::Alias" props = { ...
Update KMS per 2020-11-19 changes
Update KMS per 2020-11-19 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
ad7e93fa74054e3d962e34807f5d04acd719df33
website/search_migration/migrate.py
website/search_migration/migrate.py
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Migration script for Search-enabled Models.''' from __future__ import absolute_import import logging from modularodm.query.querydialect import DefaultQueryDialect as Q from website.models import Node from framework.auth import User import website.search.search as search...
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Migration script for Search-enabled Models.''' from __future__ import absolute_import import logging from modularodm.query.querydialect import DefaultQueryDialect as Q from website.models import Node from framework.auth import User import website.search.search as search...
Add additional logging for users'
Add additional logging for users'
Python
apache-2.0
KAsante95/osf.io,hmoco/osf.io,petermalcolm/osf.io,amyshi188/osf.io,rdhyee/osf.io,samanehsan/osf.io,GaryKriebel/osf.io,mluo613/osf.io,ticklemepierce/osf.io,jnayak1/osf.io,GaryKriebel/osf.io,bdyetton/prettychart,mfraezz/osf.io,GaryKriebel/osf.io,ticklemepierce/osf.io,caneruguz/osf.io,crcresearch/osf.io,abought/osf.io,zac...
305849d57cc6897c65b4e0996f70a21f1d873d25
awp/main.py
awp/main.py
#!/usr/bin/env python3 # coding=utf-8 import argparse import json import jsonschema import awp.packager import awp.validator # Parse arguments given via command-line interface def parse_cli_args(): parser = argparse.ArgumentParser() parser.add_argument( '--force', '-f', action='store_true', ...
#!/usr/bin/env python3 # coding=utf-8 import argparse import json import jsonschema import awp.packager import awp.validator # Parse arguments given via command-line interface def parse_cli_args(): parser = argparse.ArgumentParser() parser.add_argument( '--force', '-f', action='store_true', ...
Clarify where packager.json validation error originates
Clarify where packager.json validation error originates
Python
mit
caleb531/alfred-workflow-packager
ad7507f795f465425e72fb6821115e395046b84d
pyshtools/shio/yilm_index_vector.py
pyshtools/shio/yilm_index_vector.py
def YilmIndexVector(i, l, m): """ Compute the index of an 1D array of spherical harmonic coefficients corresponding to i, l, and m. Usage ----- index = YilmIndexVector (i, l, m) Returns ------- index : integer Index of an 1D array of spherical harmonic coefficients correspo...
def YilmIndexVector(i, l, m): """ Compute the index of a 1D array of spherical harmonic coefficients corresponding to i, l, and m. Usage ----- index = YilmIndexVector (i, l, m) Returns ------- index : integer Index of a 1D array of spherical harmonic coefficients correspond...
Add error checks to YilmIndexVector (and update docs)
Add error checks to YilmIndexVector (and update docs)
Python
bsd-3-clause
SHTOOLS/SHTOOLS,MarkWieczorek/SHTOOLS,MarkWieczorek/SHTOOLS,SHTOOLS/SHTOOLS
f1e1df825b69c33913096af1cb6e20b7d2db72ce
scrapi/harvesters/pubmedcentral.py
scrapi/harvesters/pubmedcentral.py
""" Harvester of pubmed for the SHARE notification service """ from __future__ import unicode_literals from scrapi.base import schemas from scrapi.base import helpers from scrapi.base import OAIHarvester def oai_extract_url_pubmed(identifiers): identifiers = [identifiers] if not isinstance(identifiers, list) e...
""" Harvester of PubMed Central for the SHARE notification service Example API call: http://www.pubmedcentral.nih.gov/oai/oai.cgi?verb=ListRecords&metadataPrefix=oai_dc&from=2015-04-13&until=2015-04-14 """ from __future__ import unicode_literals from scrapi.base import schemas from scrapi.base import helpers from s...
Add API call to top docstring
Add API call to top docstring
Python
apache-2.0
CenterForOpenScience/scrapi,mehanig/scrapi,icereval/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,alexgarciac/scrapi,fabianvf/scrapi,felliott/scrapi,jeffreyliu3230/scrapi,felliott/scrapi,ostwald/scrapi,erinspace/scrapi,fabianvf/scrapi,erinspace/scrapi
631f9edec1574054ef5612b652b94397af141d7a
tests/test_rule.py
tests/test_rule.py
from datetime import datetime from unittest import TestCase from rule import PriceRule from stock import Stock class TestPriceRule(TestCase): @classmethod def setUpClass(cls): goog = Stock("GOOG") goog.update(datetime(2014, 2, 10), 11) cls.exchange = {"GOOG": goog} def test_a_Pri...
from datetime import datetime from unittest import TestCase from rule import PriceRule from stock import Stock class TestPriceRule(TestCase): @classmethod def setUpClass(cls): goog = Stock("GOOG") goog.update(datetime(2014, 2, 10), 11) cls.exchange = {"GOOG": goog} def test_a_Pri...
Add a PriceRule test if a condition is not met.
Add a PriceRule test if a condition is not met.
Python
mit
bsmukasa/stock_alerter
2c7621143a9d110ebb1ea5dc7884f2c21e2786b5
microgear/cache.py
microgear/cache.py
import os import json import sys def get_item(key): try: return json.loads(open(os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),key), "rb").read().decode('UTF-8'))["_"] except (IOError, ValueError): return None def set_item(key,value): open(os.path.join(os.path.abspat...
import os import json import sys CURRENT_DIR = os.path.abspath(os.path.dirname(sys.argv[0])) def get_item(key): """Return content in cached file in JSON format""" CACHED_KEY_FILE = os.path.join(CURRENT_DIR, key) try: return json.loads(open(CACHED_KEY_FILE, "rb").read().decode('UTF-...
Add docstring to function and refactor some code for clarification
Add docstring to function and refactor some code for clarification
Python
isc
netpieio/microgear-python
562fa35a036a43526b55546d97490b3f36001a18
robotpy_ext/misc/periodic_filter.py
robotpy_ext/misc/periodic_filter.py
import logging import time class PeriodicFilter: """ Periodic Filter to help keep down clutter in the console. Simply add this filter to your logger and the logger will only print periodically. The logger will always print logging levels of WARNING or higher """ def __ini...
import logging import time class PeriodicFilter: """ Periodic Filter to help keep down clutter in the console. Simply add this filter to your logger and the logger will only print periodically. The logger will always print logging levels of WARNING or higher, unless given ...
Create example usage. Rename bypass_level
Create example usage. Rename bypass_level
Python
bsd-3-clause
robotpy/robotpy-wpilib-utilities,Twinters007/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities,Twinters007/robotpy-wpilib-utilities
ef72be28dc83ff2c73335c6eb13135cab8affe53
troposphere/sso.py
troposphere/sso.py
# Copyright (c) 2012-2020, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 18.6.0 from . import AWSObject from troposphere import Tags class Assignment(AWSObject): resource_type = "AW...
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 25.0.0 from . import AWSObject from . import AWSProperty from troposphere import Tags class Assignment(AWSObject...
Update SSO per 2020-12-18 changes
Update SSO per 2020-12-18 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
7c3a3283b3da0c01da012bb823d781036d1847b6
packages/syft/src/syft/core/node/common/node_table/node_route.py
packages/syft/src/syft/core/node/common/node_table/node_route.py
# third party from sqlalchemy import Boolean from sqlalchemy import Column from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import String # relative from . import Base class NodeRoute(Base): __tablename__ = "node_route" id = Column(Integer(), primary_key=True, autoincrement=T...
# third party from sqlalchemy import Boolean from sqlalchemy import Column from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import String # relative from . import Base class NodeRoute(Base): __tablename__ = "node_route" id = Column(Integer(), primary_key=True, autoincrement=T...
ADD vpn_endpoint and vpn_key columns
ADD vpn_endpoint and vpn_key columns
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
1f697a2c7bcf0f7769a9fc4f81be676ed5ee97c6
examples/flask/flask_seguro/cart.py
examples/flask/flask_seguro/cart.py
from flask_seguro.products import Products from flask import current_app as app class Cart: def __init__(self, cart_dict={}): if cart_dict == {}: self.total = 0 self.subtotal = 0 self.items = [] else: self.total = cart_dict["total"] self...
from flask_seguro.products import Products from flask import current_app as app class Cart: def __init__(self, cart_dict=None): cart_dict = cart_dict or {} if cart_dict == {}: self.total = 0 self.subtotal = 0 self.items = [] else: self.total...
Fix dangerous default mutable value
Fix dangerous default mutable value
Python
mit
rgcarrasqueira/python-pagseguro,vintasoftware/python-pagseguro,rochacbruno/python-pagseguro
45ee803cad9b16351a2d02c7ce9d39a36f8f2480
stutuz/__init__.py
stutuz/__init__.py
#-*- coding:utf-8 -*- from __future__ import division from __future__ import absolute_import from __future__ import with_statement from __future__ import print_function from __future__ import unicode_literals from logbook import NestedSetup from flask import Flask, request from flaskext.babel import Babel, get_locale...
#-*- coding:utf-8 -*- from __future__ import division from __future__ import absolute_import from __future__ import with_statement from __future__ import print_function from __future__ import unicode_literals from logbook import NestedSetup from flask import Flask, request from flaskext.babel import Babel, get_locale...
Allow setting locale with a query parameter
Allow setting locale with a query parameter
Python
bsd-2-clause
dag/stutuz
ae8a91dbfb657ba2ac4f1ef9aa89c8b8ba25cde2
wsgi_intercept/requests_intercept.py
wsgi_intercept/requests_intercept.py
"""Intercept HTTP connections that use `requests <http://docs.python-requests.org/en/latest/>`_. """ from . import WSGI_HTTPConnection, wsgi_fake_socket from requests.packages.urllib3.connectionpool import (HTTPConnectionPool, HTTPSConnectionPool) from requests.packages.urllib3.connection import (HTTPConnectio...
"""Intercept HTTP connections that use `requests <http://docs.python-requests.org/en/latest/>`_. """ from . import WSGI_HTTPConnection, WSGI_HTTPSConnection, wsgi_fake_socket from requests.packages.urllib3.connectionpool import (HTTPConnectionPool, HTTPSConnectionPool) from requests.packages.urllib3.connection...
Fix the interceptor installation for HTTPSConnection.
Fix the interceptor installation for HTTPSConnection.
Python
mit
cdent/wsgi-intercept,sileht/python3-wsgi-intercept
8bfe6e791228ccbc3143f3a8747c68d2e8b0cbb5
runtests.py
runtests.py
#!/usr/bin/env python from django.conf import settings from django.core.management import execute_from_command_line import django import os import sys if not settings.configured: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testproj.settings") django.setup() module_root = os.path.dirname(os.path.realp...
#!/usr/bin/env python from django.conf import settings from django.core.management import execute_from_command_line import django import os import sys if not settings.configured: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testproj.settings") if django.VERSION >= (1,7): django.setup() module_...
Fix running tests on lower Django versions
Fix running tests on lower Django versions
Python
apache-2.0
AdrianLC/django-parler-rest,edoburu/django-parler-rest
b6836dd7bccd40eec146bc034cc8ac83b4e7f16a
runtests.py
runtests.py
#!/usr/bin/env python import sys import os from coverage import coverage from optparse import OptionParser # This envar must be set before importing NoseTestSuiteRunner, # silence flake8 E402 ("module level import not at top of file"). os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_settings") from django_nose i...
#!/usr/bin/env python import sys import os from coverage import coverage from optparse import OptionParser # This envar must be set before importing NoseTestSuiteRunner, # silence flake8 E402 ("module level import not at top of file"). os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_settings") from django_nose i...
Extend sys.path with required paths from edx-platform submodule
Extend sys.path with required paths from edx-platform submodule
Python
agpl-3.0
hastexo/edx-shopify,fghaas/edx-shopify
bde09206bf308167a11bcb012753d10d845dc810
test_project/blog/models.py
test_project/blog/models.py
from django.db import models from django.contrib.auth.models import User class Entry(models.Model): content = models.TextField() author = models.ForeignKey(User) created = models.DateTimeField() class Comment(models.Model): post = models.ForeignKey(Entry, related_name='comments') content = model...
from django.db import models from django.contrib.auth.models import User class Entry(models.Model): content = models.TextField() author = models.ForeignKey(User) created = models.DateTimeField() class Comment(models.Model): post = models.ForeignKey(Entry, related_name='comments') content = model...
Create SmartTag model to demonstrate multi-word resource names.
Create SmartTag model to demonstrate multi-word resource names.
Python
bsd-3-clause
juanique/django-chocolate,juanique/django-chocolate,juanique/django-chocolate
f35163ad752a52983d7d5ff9bfd383e98db06f0b
tests/test_pycookiecheat.py
tests/test_pycookiecheat.py
# -*- coding: utf-8 -*- """ test_pycookiecheat ---------------------------------- Tests for `pycookiecheat` module. """ from pycookiecheat import chrome_cookies from uuid import uuid4 import pytest def test_raises_on_empty(): with pytest.raises(TypeError): broken = chrome_cookies() def test_no_cookies(...
# -*- coding: utf-8 -*- """ test_pycookiecheat ---------------------------------- Tests for `pycookiecheat` module. """ from pycookiecheat import chrome_cookies from uuid import uuid4 import pytest import os def test_raises_on_empty(): with pytest.raises(TypeError): broken = chrome_cookies() def test...
Test for travis-CI and skip tests accordingly.
Test for travis-CI and skip tests accordingly.
Python
mit
fxxkhand/pycookiecheat,n8henrie/pycookiecheat
5b282d9322a676b4185fcd253f338a342ec5e5ce
.config/i3/py3status/playerctlbar.py
.config/i3/py3status/playerctlbar.py
# py3status module for playerctl import subprocess def run(*cmdlist): return subprocess.run(cmdlist, stdout=subprocess.PIPE).stdout.decode() def player_args(players): if not players: return 'playerctl', else: return 'playerctl', '-p', players def get_status(players): status = run(*pl...
# py3status module for playerctl import subprocess def run(*cmdlist): return subprocess.run( cmdlist, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).stdout.decode() def player_args(players): if not players: return 'playerctl', else: return 'playerct...
Fix stderr from playerctl bar
Fix stderr from playerctl bar
Python
unlicense
louisswarren/dotfiles,louisswarren/dotfiles
7527ce1b48f769d33eb5ede3d54413e51eb2ac12
senkumba/models.py
senkumba/models.py
from django.contrib.auth.models import User def user_new_str(self): return self.username if self.get_full_name() == "" else self.get_full_name() # Replace the __str__ method in the User class with our new implementation User.__str__ = user_new_str
from django.contrib import admin from django.contrib.auth.models import User def user_new_str(self): return self.username if self.get_full_name() == "" else self.get_full_name() # Replace the __str__ method in the User class with our new implementation User.__str__ = user_new_str admin.site.site_header = 'SENK...
Change titles for the site
Change titles for the site
Python
mit
lubegamark/senkumba
d3a203725d13a7abef091f0070f90826d3225dbc
settings_travis.py
settings_travis.py
import ssl LDAP_SERVER = 'ldap.rserver.de' LDAP_PORT = 3389 LDAP_SSL_PORT = 6636 LDAP_REQUIRE_CERT = ssl.CERT_NONE
import ssl LDAP_SERVER = 'ldap.rserver.de' LDAP_PORT = 3389 LDAP_SSL_PORT = 6636 LDAP_REQUIRE_CERT = ssl.CERT_NONE LDAP_TLS_VERSION = ssl.PROTOCOL_TLSv1
Fix travis unit test for python 3.3
Fix travis unit test for python 3.3
Python
bsd-2-clause
rroemhild/flask-ldapconn
c84e22824cd5546406656ecc06a7dcd37a013954
shopit_app/urls.py
shopit_app/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() import authentication_app.views urlpatterns = patterns('', # Examples: # url(r'^$', 'gettingstarted.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', authentication_a...
from rest_frmaework_nested import routers from authentication_app.views import AccountViewSet router = routers.SimpleRouter() router.register(r'accounts', AccountViewSet) urlpatterns = patterns('', # APIendpoints url(r'^api/v1/', include(router.urls)), url('^.*$', IndexView.as_view(), name='index'), )
Add the API endpoint url for the account view set.
Add the API endpoint url for the account view set.
Python
mit
mvpgomes/shopit-app,mvpgomes/shopit-app,mvpgomes/shopit-app,mvpgomes/shopit-app
bc15058cc95916788250d660d5560b69a82e0b89
warehouse/__main__.py
warehouse/__main__.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from warehouse import script def main(): script.run() if __name__ == "__main__": main()
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import sys from flask.ext.script import InvalidCommand # pylint: disable=E0611,F0401 from warehouse import script def main(): # This is copied over from script.run and modified for Warehouse try:...
Customize the command runner for cleaner output
Customize the command runner for cleaner output
Python
bsd-2-clause
davidfischer/warehouse
0f1f7963c2ea80604593644e1c04643031561970
app/timetables/migrations/0004_course.py
app/timetables/migrations/0004_course.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-30 19:59 from __future__ import unicode_literals import common.mixins from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('timetables', '0003_mealoption'), ] operations = [ migra...
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-30 19:59 from __future__ import unicode_literals import common.mixins from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('timetables', '0003_mealoption'), ] operations = [ migra...
Remove reference to ForceCapitalizeMixin from migration file and update with SlugifyMixin
Remove reference to ForceCapitalizeMixin from migration file and update with SlugifyMixin
Python
mit
teamtaverna/core
a57f7c43bc7749de5acd42b6db95d77074308cef
scaper/__init__.py
scaper/__init__.py
#!/usr/bin/env python """Top-level module for scaper""" from .core import * __version__ = '0.1.0'
#!/usr/bin/env python """Top-level module for scaper""" from .core import * import jams from pkg_resources import resource_filename __version__ = '0.1.0' # Add sound_event namesapce namespace_file = resource_filename(__name__, 'namespaces/sound_event.json') jams.schema.add_namespace(namespace_file)
Add sound_event namespace to jams during init
Add sound_event namespace to jams during init
Python
bsd-3-clause
justinsalamon/scaper
b62c8c905cdd332a0073ce462be3e5c5b17b282d
api/webview/views.py
api/webview/views.py
from rest_framework import generics from rest_framework import permissions from rest_framework.response import Response from rest_framework.decorators import api_view from django.views.decorators.clickjacking import xframe_options_exempt from api.webview.models import Document from api.webview.serializers import Docum...
from rest_framework import generics from rest_framework import permissions from rest_framework.response import Response from rest_framework.decorators import api_view from django.views.decorators.clickjacking import xframe_options_exempt from api.webview.models import Document from api.webview.serializers import Docum...
Make the view List only remove Create
Make the view List only remove Create
Python
apache-2.0
erinspace/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,fabianvf/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,felliott/scrapi
067b557258a85945635a880ced65454cfa2b61af
supermega/tests/test_session.py
supermega/tests/test_session.py
import unittest import hashlib from .. import Session from .. import models class TestSession(unittest.TestCase): def setUp(self): self.sess = Session() def test_public_file_download(self): url = 'https://mega.co.nz/#!2ctGgQAI!AkJMowjRiXVcSrRLn3d-e1vl47ZxZEK0CbrHGIKFY-E' sha256 = '9431103cb989f2913cbc5037670...
import unittest import hashlib from .. import Session from .. import models class TestSession(unittest.TestCase): def setUp(self): self.sess = Session() def test_public_file_download(self): url = 'https://mega.co.nz/#!2ctGgQAI!AkJMowjRiXVcSrRLn3d-e1vl47ZxZEK0CbrHGIKFY-E' sha256 = '9431103cb989f2913cbc5037670...
Add test for key derivation
Add test for key derivation
Python
bsd-3-clause
lmb/Supermega
bbfe056602075a46b231dc28ddcada7f525ce927
conftest.py
conftest.py
import pytest import django_webtest from django.core.urlresolvers import reverse from ideasbox.tests.factories import UserFactory @pytest.fixture() def user(): return UserFactory(short_name="Hello", password='password') @pytest.fixture() def staffuser(): return UserFactory(short_name="Hello", password='pa...
import pytest import django_webtest from django.core.urlresolvers import reverse from ideasbox.tests.factories import UserFactory @pytest.fixture() def user(): return UserFactory(short_name="Hello", password='password') @pytest.fixture() def staffuser(): return UserFactory(short_name="Hello", password='pa...
Use yield_fixture for app fixture
Use yield_fixture for app fixture
Python
agpl-3.0
ideascube/ideascube,Lcaracol/ideasbox.lan,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,Lcaracol/ideasbox.lan,Lcaracol/ideasbox.lan
3509243e467a8546a3fa9ba123f77a1a96643402
xml_json_import/__init__.py
xml_json_import/__init__.py
from django.conf import settings class XmlJsonImportModuleException(Exception): pass
from django.conf import settings class XmlJsonImportModuleException(Exception): pass if not hasattr(settings, 'XSLT_FILES_DIR'): raise XmlJsonImportModuleException('Settings must contain XSLT_FILES_DIR parameter')
Throw exception for not existing XSLT_FILES_DIR setting
Throw exception for not existing XSLT_FILES_DIR setting
Python
mit
lev-veshnyakov/django-import-data,lev-veshnyakov/django-import-data
9e7aed847c2d5fcd6e00bc787d8b3558b590f605
api/logs/urls.py
api/logs/urls.py
from django.conf.urls import url from api.logs import views urlpatterns = [ url(r'^(?P<log_id>\w+)/$', views.NodeLogDetail.as_view(), name=views.NodeLogDetail.view_name), url(r'^(?P<log_id>\w+)/nodes/$', views.LogNodeList.as_view(), name=views.LogNodeList.view_name), ]
from django.conf.urls import url from api.logs import views urlpatterns = [ url(r'^(?P<log_id>\w+)/$', views.NodeLogDetail.as_view(), name=views.NodeLogDetail.view_name), url(r'^(?P<log_id>\w+)/nodes/$', views.LogNodeList.as_view(), name=views.LogNodeList.view_name), url(r'^(?P<log_id>\w+)/added_contribut...
Add /v2/logs/log_id/added_contributors/ to list of URL's.
Add /v2/logs/log_id/added_contributors/ to list of URL's.
Python
apache-2.0
abought/osf.io,mfraezz/osf.io,TomHeatwole/osf.io,chennan47/osf.io,RomanZWang/osf.io,alexschiller/osf.io,billyhunt/osf.io,crcresearch/osf.io,saradbowman/osf.io,acshi/osf.io,jnayak1/osf.io,RomanZWang/osf.io,emetsger/osf.io,KAsante95/osf.io,zachjanicki/osf.io,mattclark/osf.io,RomanZWang/osf.io,emetsger/osf.io,monikagrabow...
a9c6e045631103fe8508fd1b60d6076c05092fe1
tests/examples/customnode/nodes.py
tests/examples/customnode/nodes.py
from viewflow.activation import AbstractGateActivation, Activation from viewflow.flow import base from viewflow.token import Token class DynamicSplitActivation(AbstractGateActivation): def calculate_next(self): self._split_count = self.flow_task._task_count_callback(self.process) @Activation.status.s...
from viewflow.activation import AbstractGateActivation from viewflow.flow import base from viewflow.token import Token class DynamicSplitActivation(AbstractGateActivation): def calculate_next(self): self._split_count = self.flow_task._task_count_callback(self.process) def activate_next(self): ...
Add undo to custom node sample
Add undo to custom node sample
Python
agpl-3.0
ribeiro-ucl/viewflow,codingjoe/viewflow,pombredanne/viewflow,pombredanne/viewflow,codingjoe/viewflow,codingjoe/viewflow,viewflow/viewflow,viewflow/viewflow,ribeiro-ucl/viewflow,viewflow/viewflow,ribeiro-ucl/viewflow
fffca3d2198f7c65b2e4fa2b805efa54f4c9fdb9
tests/zeus/artifacts/test_xunit.py
tests/zeus/artifacts/test_xunit.py
from io import BytesIO from zeus.artifacts.xunit import XunitHandler from zeus.constants import Result from zeus.models import Job from zeus.utils.testresult import TestResult as ZeusTestResult def test_result_generation(sample_xunit): job = Job() fp = BytesIO(sample_xunit.encode("utf8")) handler = Xun...
from io import BytesIO from zeus.artifacts.xunit import XunitHandler from zeus.constants import Result from zeus.models import Job from zeus.utils.testresult import TestResult as ZeusTestResult def test_result_generation(sample_xunit): job = Job() fp = BytesIO(sample_xunit.encode("utf8")) handler = Xun...
Fix test case being integers
test: Fix test case being integers
Python
apache-2.0
getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus
cfde8a339c52c1875cb3b863ace3cad6174eb54c
account_cost_spread/models/account_invoice.py
account_cost_spread/models/account_invoice.py
# Copyright 2016-2018 Onestein (<http://www.onestein.eu>) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, models class AccountInvoice(models.Model): _inherit = 'account.invoice' @api.multi def action_move_create(self): """Override, button Validate on invoic...
# Copyright 2016-2018 Onestein (<http://www.onestein.eu>) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, models class AccountInvoice(models.Model): _inherit = 'account.invoice' @api.multi def action_move_create(self): """Invoked when validating the invoice...
Fix method description in account_cost_spread
Fix method description in account_cost_spread
Python
agpl-3.0
onesteinbv/addons-onestein,onesteinbv/addons-onestein,onesteinbv/addons-onestein
000e3b96f6fa77cc9d6e60af67ec98ecc0d2497e
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup import request setup( name='django-request', version='%s' % request.__version__, description='django-request is a statistics module for django. It stores requests in a database for admins to see, it can also be used to get statistics on who is online e...
#!/usr/bin/env python from distutils.core import setup import request setup( name='django-request', version='%s' % request.__version__, description='django-request is a statistics module for django. It stores requests in a database for admins to see, it can also be used to get statistics on who is online e...
Copy the templates when installed.
Copy the templates when installed.
Python
bsd-2-clause
kylef/django-request,kylef/django-request,gnublade/django-request,gnublade/django-request,gnublade/django-request,kylef/django-request
2d1ef22d384cb04d86946572599f2040b798e6d6
setup.py
setup.py
#!/usr/bin/env python def configuration(parent_package='',top_path=None): import numpy import os from distutils.errors import DistutilsError if numpy.__dict__.get('quaternion') is not None: raise DistutilsError('The target NumPy already has a quaternion type') from numpy.distutils.misc_util ...
#!/usr/bin/env python def configuration(parent_package='',top_path=None): import numpy import os from distutils.errors import DistutilsError if numpy.__dict__.get('quaternion') is not None: raise DistutilsError('The target NumPy already has a quaternion type') from numpy.distutils.misc_util ...
Remove --ffast-math for all builds
Remove --ffast-math for all builds Due to a bug in anaconda's libm support for linux, fast-math is unusable. And I don't want to try to hack a way to decide if it's usable on things other than linux, because it's just one more thing to break.
Python
mit
moble/quaternion,moble/quaternion
08f633cdf0f5dcd1940da46e91c175e81b39ad3f
setup.py
setup.py
#!/usr/bin/env python """ Setup script. Created on Oct 10, 2011 @author: tmetsch """ from distutils.core import setup from distutils.extension import Extension try: from Cython.Build import build_ext, cythonize BUILD_EXTENSION = {'build_ext': build_ext} EXT_MODULES = cythonize([Extension("dtrace", ["dt...
#!/usr/bin/env python """ Setup script. Created on Oct 10, 2011 @author: tmetsch """ from distutils.core import setup from distutils.extension import Extension import sys try: from Cython.Build import build_ext, cythonize BUILD_EXTENSION = {'build_ext': build_ext} EXT_MODULES = cythonize([Extension("dt...
Set Cython language_level to 3 when compiling for python3
Set Cython language_level to 3 when compiling for python3
Python
mit
tmetsch/python-dtrace,tmetsch/python-dtrace
6a5c9ccf0bd2582cf42577712309b8fd6e912966
blo/__init__.py
blo/__init__.py
import configparser from blo.BloArticle import BloArticle from blo.DBControl import DBControl class Blo: def __init__(self, config_file_path): config = configparser.ConfigParser() config.read(config_file_path) self._db_file_path = config['DB']['DB_PATH'] self._template_dir = config...
import configparser from blo.BloArticle import BloArticle from blo.DBControl import DBControl class Blo: def __init__(self, config_file_path): config = configparser.ConfigParser() config.read(config_file_path) self._db_file_path = config['DB']['DB_PATH'].replace('"', '') self._temp...
Add replace double quotation mark from configuration file parameters.
Add replace double quotation mark from configuration file parameters.
Python
mit
10nin/blo,10nin/blo
06b536db7ed82a68a3c1627769364b80dd85e259
alexandria/__init__.py
alexandria/__init__.py
import logging log = logging.getLogger(__name__) from pyramid.config import Configurator from sqlalchemy import engine_from_config from .models import DBSession required_settings = [ 'pyramid.secret.session', 'pyramid.secret.auth', ] def main(global_config, **settings): """ This function...
import logging log = logging.getLogger(__name__) from pyramid.config import Configurator from sqlalchemy import engine_from_config from .models import DBSession required_settings = [ 'pyramid.secret.session', 'pyramid.secret.auth', ] def main(global_config, **settings): """ This function...
Make sure to return the wsgi app
Make sure to return the wsgi app
Python
isc
cdunklau/alexandria,cdunklau/alexandria,bertjwregeer/alexandria,cdunklau/alexandria,bertjwregeer/alexandria
1fffdb60aa4eb875bfbd961773d0cf5066dc38e2
django_website/views.py
django_website/views.py
""" Misc. views. """ from __future__ import absolute_import from django.contrib.comments.models import Comment from django.contrib.sitemaps import views as sitemap_views from django.shortcuts import render from django.views.decorators.cache import cache_page from django.views.decorators.csrf import requires_csrf_token...
from django.shortcuts import render from django.views.decorators.csrf import requires_csrf_token @requires_csrf_token def server_error(request, template_name='500.html'): """ Custom 500 error handler for static stuff. """ return render(request, template_name)
Remove dead code. This isn't wired in any URLconf.
Remove dead code. This isn't wired in any URLconf.
Python
bsd-3-clause
nanuxbe/django,xavierdutreilh/djangoproject.com,vxvinh1511/djangoproject.com,rmoorman/djangoproject.com,gnarf/djangoproject.com,django/djangoproject.com,rmoorman/djangoproject.com,relekang/djangoproject.com,hassanabidpk/djangoproject.com,alawnchen/djangoproject.com,alawnchen/djangoproject.com,khkaminska/djangoproject.c...