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
ac2b01e9177d04a6446b770639745010770cb317
nuage_neutron/plugins/nuage_ml2/nuage_subnet_ext_driver.py
nuage_neutron/plugins/nuage_ml2/nuage_subnet_ext_driver.py
# Copyright 2015 Intel Corporation. # 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 requir...
# Copyright 2015 Intel Corporation. # 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 requir...
Add 'vsd_managed' to the GET subnet response for ML2
Add 'vsd_managed' to the GET subnet response for ML2 This commit looks up the related nuage_subnet_l2dom_mapping in the database and uses the nuage_managed_subnet field to fill in 'vsd_managed'. False by default. Change-Id: I68957fe3754dc9f1ccf2b6a2b09a762fccd17a89 Closes-Bug: OPENSTACK-1504
Python
apache-2.0
nuagenetworks/nuage-openstack-neutron,naveensan1/nuage-openstack-neutron,naveensan1/nuage-openstack-neutron,nuagenetworks/nuage-openstack-neutron
4ee689a4825a93cf6b0116b6b7343028c96b5cfb
bernard/discord_notifier.py
bernard/discord_notifier.py
"""A logging handler that emits to a Discord webhook.""" import requests from logging import Handler class DiscordHandler(Handler): """A logging handler that emits to a Discord webhook.""" def __init__(self, webhook, *args, **kwargs): """Initialize the DiscordHandler class.""" super().__init_...
"""A logging handler that emits to a Discord webhook.""" import requests from logging import Handler class DiscordHandler(Handler): """A logging handler that emits to a Discord webhook.""" def __init__(self, webhook, *args, **kwargs): """Initialize the DiscordHandler class.""" super().__init_...
Fix bare 'except' in DiscordHandler
Fix bare 'except' in DiscordHandler
Python
mit
leviroth/bernard
1683cb41b5ffee4d48e8ec700382ad40e8370520
astrobin/tests/test_auth.py
astrobin/tests/test_auth.py
# Django from django.contrib.auth.models import User from django.test import TestCase class LoginTest(TestCase): def setUp(self): self.user = User.objects.create_user( 'test', 'test@test.com', 'password') def tearDown(self): self.user.delete() def test_login_view(self): ...
# Django from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase class LoginTest(TestCase): def setUp(self): self.user = User.objects.create_user( 'test', 'test@test.com', 'password') def tearDown(self): self.user.de...
Add test to check that password reset view loads fine
Add test to check that password reset view loads fine
Python
agpl-3.0
astrobin/astrobin,astrobin/astrobin,astrobin/astrobin,astrobin/astrobin
99fbf97643bdfd42b1dc8890a7cfeccc61ae973f
moderator/moderate/auth.py
moderator/moderate/auth.py
from mozilla_django_oidc.auth import OIDCAuthenticationBackend from moderator.moderate.mozillians import is_vouched, BadStatusCodeError class ModeratorAuthBackend(OIDCAuthenticationBackend): def create_user(self, email, **kwargs): try: data = is_vouched(email) except BadStatusCodeErro...
from mozilla_django_oidc.auth import OIDCAuthenticationBackend from moderator.moderate.mozillians import is_vouched, BadStatusCodeError class ModeratorAuthBackend(OIDCAuthenticationBackend): def create_user(self, claims, **kwargs): try: data = is_vouched(claims.get('email')) except Ba...
Fix claims handling on create_user
Fix claims handling on create_user
Python
agpl-3.0
akatsoulas/mozmoderator,mozilla/mozmoderator,johngian/mozmoderator,mozilla/mozmoderator,akatsoulas/mozmoderator,akatsoulas/mozmoderator,johngian/mozmoderator,johngian/mozmoderator,mozilla/mozmoderator,johngian/mozmoderator
c72d9060142fe1de1e2201fc355f2ee95f5354c7
src/waldur_mastermind/invoices/migrations/0023_invoice_current_cost.py
src/waldur_mastermind/invoices/migrations/0023_invoice_current_cost.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-06-19 08:47 from __future__ import unicode_literals from django.db import migrations, models def migrate_data(apps, schema_editor): Invoice = apps.get_model('invoices', 'Invoice') for invoice in Invoice.objects.all(): invoice.update_curren...
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-06-19 08:47 from __future__ import unicode_literals from django.db import migrations, models def migrate_data(apps, schema_editor): from waldur_mastermind.invoices.models import Invoice for invoice in Invoice.objects.all(): invoice.update_...
Fix database migration for invoices application.
Fix database migration for invoices application.
Python
mit
opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur
d4154f7cde83f3f48ff70bb7abe110e03679ff9d
aiohttp_json_api/helpers.py
aiohttp_json_api/helpers.py
""" Helpers ======= """ import inspect from collections import Mapping, Iterable def is_generator(obj): """Return True if ``obj`` is a generator """ return inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) def is_iterable_but_not_string(obj): """Return True if ``obj`` is an iterable objec...
""" Helpers ======= """ import inspect from collections import Mapping, Iterable def is_generator(obj): """Return True if ``obj`` is a generator """ return inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) def is_iterable_but_not_string(obj): """Return True if ``obj`` is an iterable objec...
Add helper to check instance and subclass
Add helper to check instance and subclass
Python
mit
vovanbo/aiohttp_json_api
677d2d4f422f9b05746fa80d63492de4ae9aced4
tests/test_examples.py
tests/test_examples.py
import pytest import examples.basic_usage import examples.basic_usage_manual import examples.dataset import examples.variant_ts_difficulties import examples.variants def test_dataset(unihan_options): examples.dataset.run() def test_variants(unihan_options): examples.variants.run(unihan_options=unihan_optio...
import importlib import importlib.util import sys import types import pytest def load_script(example: str) -> types.ModuleType: file_path = f"examples/{example}.py" module_name = "run" spec = importlib.util.spec_from_file_location(module_name, file_path) assert spec is not None module = importli...
Rework for handling of examples/
refactor(tests): Rework for handling of examples/
Python
mit
cihai/cihai,cihai/cihai
983df9ceaebb42ca31b131f437362193070eb1db
paasta_tools/clusterman.py
paasta_tools/clusterman.py
import staticconf CLUSTERMAN_YAML_FILE_PATH = '/nail/srv/configs/clusterman.yaml' CLUSTERMAN_METRICS_YAML_FILE_PATH = '/nail/srv/configs/clusterman_metrics.yaml' def get_clusterman_metrics(): try: import clusterman_metrics clusterman_yaml = CLUSTERMAN_YAML_FILE_PATH staticconf.YamlConfigu...
import staticconf CLUSTERMAN_YAML_FILE_PATH = '/nail/srv/configs/clusterman.yaml' CLUSTERMAN_METRICS_YAML_FILE_PATH = '/nail/srv/configs/clusterman_metrics.yaml' def get_clusterman_metrics(): try: import clusterman_metrics clusterman_yaml = CLUSTERMAN_YAML_FILE_PATH staticconf.YamlConfigu...
Fix regression in manpages build
Fix regression in manpages build
Python
apache-2.0
Yelp/paasta,Yelp/paasta
bf5ec5a459dc9dbe38a6806b513616aa769134a2
amqpy/tests/test_version.py
amqpy/tests/test_version.py
import re def get_field(doc: str, name: str): match = re.search(':{}: (.*)$'.format(name), doc, re.IGNORECASE | re.MULTILINE) if match: return match.group(1).strip() class TestVersion: def test_version_is_consistent(self): from .. import VERSION with open('README.rst') as f: ...
import re def get_field(doc: str, name: str): match = re.search(':{}: (.*)$'.format(name), doc, re.IGNORECASE | re.MULTILINE) if match: return match.group(1).strip() class TestVersion: def test_version_is_consistent(self): from .. import VERSION with open('README.rst') as f: ...
Use `map` to test version
Use `map` to test version
Python
mit
veegee/amqpy,gst/amqpy
5fd25b11eac4725ca7da879082d9334481fa59b8
python/default_crab_config.py
python/default_crab_config.py
__author__ = 'sbrochet' def create_config(is_mc): """ Create a default CRAB configuration suitable to run the framework :return: """ from CRABClient.UserUtilities import config, getUsernameFromSiteDB config = config() config.General.workArea = 'tasks' config.General.transferOutputs = ...
__author__ = 'sbrochet' def create_config(is_mc): """ Create a default CRAB configuration suitable to run the framework :return: """ from CRABClient.UserUtilities import config, getUsernameFromSiteDB config = config() config.General.workArea = 'tasks' config.General.transferOutputs = ...
Send `external` folder with crab jobs
Send `external` folder with crab jobs
Python
mit
cp3-llbb/GridIn,cp3-llbb/GridIn
5a889dee78335d3c7d758c1df16d774160049b12
djangoprojects/django_rest_framework/tutorial/snippets/views.py
djangoprojects/django_rest_framework/tutorial/snippets/views.py
from snippets.models import Snippet from snippets.serializers import SnippetSerializer from rest_framework import generics from rest_framework import permissions from django.contrib.auth.models import User from snippets.serializers import UserSerializer from snippets.permissions import IsOwnerOrReadOnly class UserLis...
from snippets.models import Snippet from snippets.serializers import SnippetSerializer from rest_framework import generics from rest_framework import permissions from django.contrib.auth.models import User from snippets.serializers import UserSerializer from snippets.permissions import IsOwnerOrReadOnly from rest_frame...
Add an api view for the API root
Add an api view for the API root not plugged yet
Python
unlicense
bertrandvidal/stuff,bertrandvidal/stuff,bertrandvidal/stuff,bertrandvidal/stuff
3f5149841163ab3e79fbd69990e53791281ec4a6
opps/articles/templatetags/article_tags.py
opps/articles/templatetags/article_tags.py
# -*- coding: utf-8 -*- from django import template from django.conf import settings from django.utils import timezone from opps.articles.models import ArticleBox register = template.Library() @register.simple_tag def get_articlebox(slug, channel_slug=None, template_name=None): if channel_slug: slug = s...
# -*- coding: utf-8 -*- from django import template from django.conf import settings from django.utils import timezone from opps.articles.models import ArticleBox register = template.Library() @register.simple_tag def get_articlebox(slug, channel_slug=None, template_name=None): if channel_slug: slug = s...
Add validate published on templatetag get all articlebox
Add validate published on templatetag get all articlebox
Python
mit
jeanmask/opps,opps/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,opps/opps,opps/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,williamroot/opps,williamroot/opps
54cb7685550c1c5238bb2f519306e4b5db5fc9f0
webapp-django/challenges/views.py
webapp-django/challenges/views.py
from django.core.files.storage import FileSystemStorage from django.shortcuts import render, redirect from django.http import HttpResponse from .models import Challenge # from .forms import DocumentForm def download(req): response = HttpResponse(content_type='application/zip') response['Content-Disposition']...
from django.http import HttpResponse from django.shortcuts import render from .models import Challenge def download(req): response = HttpResponse(content_type='application/zip') response['Content-Disposition'] = 'attachment; filename=myfile.zip' return response def index(request): challenges = Chal...
Comment out some useless code in challenges
Comment out some useless code in challenges
Python
mit
super1337/Super1337-CTF,super1337/Super1337-CTF,super1337/Super1337-CTF
57e04bdafd571c0b8ce2c1706fb170629dea2840
salt/grains/minion_process.py
salt/grains/minion_process.py
# -*- coding: utf-8 -*- ''' Set grains describing the minion process. ''' from __future__ import absolute_import, print_function, unicode_literals import os # Import salt libs import salt.utils.platform try: import pwd except ImportError: import getpass pwd = None try: import grp except ImportError...
# -*- coding: utf-8 -*- ''' Set grains describing the minion process. ''' from __future__ import absolute_import, print_function, unicode_literals import os # Import salt libs import salt.utils.platform try: import pwd except ImportError: import getpass pwd = None try: import grp except ImportError...
Fix gid not found bug
Fix gid not found bug
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
e5b1eeab4486d2182396a7f8e64d0a05207a3f5f
bom_data_parser/__init__.py
bom_data_parser/__init__.py
from climate_data_online import read_climate_data_online_csv from acorn_sat import read_acorn_sat_csv from hrs import read_hrs_csv from observations_json import read_obs_json
from bom_data_parser.acorn_sat import read_acorn_sat_csv from bom_data_parser.climate_data_online import read_climate_data_online_csv from bom_data_parser.hrs import read_hrs_csv from bom_data_parser.observations_json import read_obs_json
Fix up imports in package.
Fix up imports in package.
Python
bsd-3-clause
amacd31/bom_data_parser,amacd31/bom_data_parser
dfdac5764236ce9301e7997443b6de4a7a4b4473
scripts/convert_gml_to_csv.py
scripts/convert_gml_to_csv.py
import sys import os sys.path.append(os.path.abspath(os.path.curdir)) from converter import gml_to_node_edge_list if __name__ == '__main__': in_file = sys.argv[1] res = gml_to_node_edge_list(in_file, routing=True)
import sys import os sys.path.append(os.path.abspath(os.path.curdir)) from converter import gml_to_node_edge_list if __name__ == '__main__': in_file = sys.argv[1] outfile = sys.argv[2] if len(sys.argv) > 2 else None res = gml_to_node_edge_list(in_file, outfile=outfile, routing=True)
Add outfile option to conversion script
Add outfile option to conversion script
Python
mit
gaberosser/geo-network
2f34d442157f86af4fd75c48ea2cf568fbef34f6
migrations/versions/223041bb858b_message_contact_association.py
migrations/versions/223041bb858b_message_contact_association.py
"""message contact association Revision ID: 223041bb858b Revises: 2c9f3a06de09 Create Date: 2014-04-28 23:52:05.449401 """ # revision identifiers, used by Alembic. revision = '223041bb858b' down_revision = '2c9f3a06de09' # Yes, this is a terrible hack. But tools/rerank_contacts.py already contains a # script to pro...
"""message contact association Revision ID: 223041bb858b Revises: 2c9f3a06de09 Create Date: 2014-04-28 23:52:05.449401 """ # revision identifiers, used by Alembic. revision = '223041bb858b' down_revision = '2c9f3a06de09' from alembic import op import sqlalchemy as sa def upgrade(): op.create_table( '...
Rearrange imports in previous migration.
Rearrange imports in previous migration. According to mg bad things can happen if you try to do stuff outside of a migration's upgrade() function.
Python
agpl-3.0
wakermahmud/sync-engine,nylas/sync-engine,PriviPK/privipk-sync-engine,PriviPK/privipk-sync-engine,EthanBlackburn/sync-engine,rmasters/inbox,jobscore/sync-engine,closeio/nylas,Eagles2F/sync-engine,ErinCall/sync-engine,Eagles2F/sync-engine,wakermahmud/sync-engine,closeio/nylas,Eagles2F/sync-engine,wakermahmud/sync-engine...
47eac4ef8acca10023f2f43dd3fea0e0abbc1202
apps/organizations/admin.py
apps/organizations/admin.py
from apps.organizations.models import Organization, OrganizationAddress from django.contrib import admin class OrganizationAddressAdmin(admin.StackedInline): model = OrganizationAddress extra = 1 class OrganizationAdmin(admin.ModelAdmin): inlines = (OrganizationAddressAdmin,) admin.site.register(Organ...
from django.contrib import admin from apps.organizations.models import ( Organization, OrganizationAddress, OrganizationMember ) class OrganizationAddressAdmin(admin.StackedInline): model = OrganizationAddress extra = 1 class OrganizationAdmin(admin.ModelAdmin): inlines = (OrganizationAddressAdmin,...
Add Admin page for OrganizationMember.
Add Admin page for OrganizationMember.
Python
bsd-3-clause
onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site
48e04ae85c563ab6af03773535ebeed748d33572
flynn/__init__.py
flynn/__init__.py
# coding: utf-8 import flynn.decoder import flynn.encoder def dump(obj, fp): return flynn.encoder.encode(fp, obj) def dumps(obj): return flynn.encoder.encode_str(obj) def load(s): return flynn.decoder.decode(s) def loads(s): return flynn.decoder.decode(s)
# coding: utf-8 import flynn.decoder import flynn.encoder def dump(obj, fp): return flynn.encoder.encode(fp, obj) def dumps(obj): return flynn.encoder.encode_str(obj) def dumph(obj): return "".join(hex(n)[2:].rjust(2, "0") for n in dumps(obj)) def load(s): return flynn.decoder.decode(s) def loads(s): return ...
Implement dumph to generate input for cbor.me
Implement dumph to generate input for cbor.me
Python
mit
fritz0705/flynn
130b6d47e95c2e538cd5842f6f2f2a88fd9bf9dd
djangocms_forms/cms_app.py
djangocms_forms/cms_app.py
from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from cms.app_base import CMSApp from cms.apphook_pool import apphook_pool class DjangoCMSFormsApphook(CMSApp): name = _('Django CMS Forms') urls = ['djangocms_forms.urls'] apphook_pool.register(DjangoCMSFormsApp...
from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from cms.app_base import CMSApp from cms.apphook_pool import apphook_pool class DjangoCMSFormsApphook(CMSApp): name = _('Forms') urls = ['djangocms_forms.urls'] apphook_pool.register(DjangoCMSFormsApphook)
Rename `CMSApp` to Forms — make it consistent to Django verbose app name.
Rename `CMSApp` to Forms — make it consistent to Django verbose app name.
Python
bsd-3-clause
mishbahr/djangocms-forms,mishbahr/djangocms-forms,mishbahr/djangocms-forms
0aa5540cef1e3137147cd379eaffc98208b78595
copy-labels.py
copy-labels.py
#!/usr/bin/env python """Copy tags from one repo to others.""" from __future__ import print_function import json import requests import yaml from helpers import paginated_get LABELS_URL = "https://api.github.com/repos/{owner_repo}/labels" def get_labels(owner_repo): url = LABELS_URL.format(owner_repo=owner_r...
#!/usr/bin/env python """Copy tags from one repo to others.""" from __future__ import print_function import json import requests import yaml from helpers import paginated_get LABELS_URL = "https://api.github.com/repos/{owner_repo}/labels" def get_labels(owner_repo): url = LABELS_URL.format(owner_repo=owner_r...
Make copying labels less verbose when things are fine.:
Make copying labels less verbose when things are fine.:
Python
apache-2.0
edx/repo-tools,edx/repo-tools
110c362e3e8436700707c2306d115b3b2476a79d
core/models.py
core/models.py
from os import makedirs from os.path import join, exists from urllib import urlretrieve from django.conf import settings from social_auth.signals import socialauth_registered def create_profile(sender, user, response, details, **kwargs): try: # twitter photo_url = response["profile_image_url"] ...
from os import makedirs from os.path import join, exists from urllib import urlretrieve from django.conf import settings from django.contrib.auth.models import User from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver from social_auth.signals import socialau...
Add initial account balance for users.
Add initial account balance for users.
Python
bsd-2-clause
stephenmcd/gamblor,stephenmcd/gamblor
6be57a38751e42c9544e29168db05cba611acbb1
payments/management/commands/init_plans.py
payments/management/commands/init_plans.py
import decimal from django.conf import settings from django.core.management.base import BaseCommand import stripe class Command(BaseCommand): help = "Make sure your Stripe account has the plans" def handle(self, *args, **options): stripe.api_key = settings.STRIPE_SECRET_KEY for plan in set...
import decimal from django.conf import settings from django.core.management.base import BaseCommand import stripe class Command(BaseCommand): help = "Make sure your Stripe account has the plans" def handle(self, *args, **options): stripe.api_key = settings.STRIPE_SECRET_KEY for plan in set...
Add trial period days option to initial plans.
Add trial period days option to initial plans.
Python
mit
aibon/django-stripe-payments,grue/django-stripe-payments,jawed123/django-stripe-payments,grue/django-stripe-payments,wahuneke/django-stripe-payments,boxysean/django-stripe-payments,jamespacileo/django-stripe-payments,boxysean/django-stripe-payments,pinax/django-stripe-payments,ZeevG/django-stripe-payments,jawed123/djan...
2768f7ac50a7b91d984f0f872b647e647d768e93
IPython/lib/tests/test_security.py
IPython/lib/tests/test_security.py
from IPython.lib import passwd from IPython.lib.security import passwd_check, salt_len import nose.tools as nt def test_passwd_structure(): p = passwd('passphrase') algorithm, salt, hashed = p.split(':') nt.assert_equal(algorithm, 'sha1') nt.assert_equal(len(salt), salt_len) nt.assert_equal(len(has...
# coding: utf-8 from IPython.lib import passwd from IPython.lib.security import passwd_check, salt_len import nose.tools as nt def test_passwd_structure(): p = passwd('passphrase') algorithm, salt, hashed = p.split(':') nt.assert_equal(algorithm, 'sha1') nt.assert_equal(len(salt), salt_len) nt.asse...
Add failing (on Py 2) test for passwd_check with unicode arguments
Add failing (on Py 2) test for passwd_check with unicode arguments
Python
bsd-3-clause
ipython/ipython,ipython/ipython
090180470c031967f11870b7a101e1f619a17072
src/ggrc_basic_permissions/roles/ProgramAuditReader.py
src/ggrc_basic_permissions/roles/ProgramAuditReader.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> scope = "AuditImplied" description = """ A user with the ProgramReader role for a private program will also have this role in the audit context for any audit created for that program. """ permissions =...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> scope = "AuditImplied" description = """ A user with the ProgramReader role for a private program will also have this role in the audit context for any audit created for that program. """ permissions =...
Add support for reading snapshots for program audit reader
Add support for reading snapshots for program audit reader
Python
apache-2.0
VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core
7618cedbc057b2359f5bc9a1b2479c8287b2d64d
desertbot/datastore.py
desertbot/datastore.py
import json import os class DataStore(object): def __init__(self, storagePath="desertbot_data.json"): self.storagePath = storagePath self.data = {} self.load() def load(self): if not os.path.exists(self.storagePath): self.save() return with open...
import json import os class DataStore(object): def __init__(self, storagePath="desertbot_data.json"): self.storagePath = storagePath self.data = {} self.load() def load(self): if not os.path.exists(self.storagePath): self.save() return with open...
Add setitem and contains to DataStore
Add setitem and contains to DataStore Adding new things to the DataStore now actually works >_>
Python
mit
DesertBot/DesertBot
1475ae4f18094e047d0b110fe6526f044defa058
manage.py
manage.py
#!/usr/bin/env python import os import sys import dotenv dotenv.read_dotenv() if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "opencanada.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
#!/usr/bin/env python import os import sys import warnings import dotenv with warnings.catch_warnings(): warnings.simplefilter("ignore") dotenv.read_dotenv() if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "opencanada.settings") from django.core.management import execute_f...
Disable the warning about .env files not being present.
Disable the warning about .env files not being present.
Python
mit
OpenCanada/website,OpenCanada/website,OpenCanada/website,OpenCanada/website
b3bde3bf3eecaf20c7fb8ed2bcf34992a5158965
fabric_rundeck/__main__.py
fabric_rundeck/__main__.py
# # Author:: Noah Kantrowitz <noah@coderanger.net> # # Copyright 2014, Noah Kantrowitz # # 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 # # Unles...
# # Author:: Noah Kantrowitz <noah@coderanger.net> # # Copyright 2014, Noah Kantrowitz # # 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 # # Unles...
Allow passing in a path to a fabfile.
Allow passing in a path to a fabfile.
Python
apache-2.0
coderanger/fabric-rundeck
76f697cad3e5dcaeb91c10e6c5f21db23ed8e407
helpdesk/tasks.py
helpdesk/tasks.py
from celery import task from .email import process_email @task() def helpdesk_process_email(): process_email()
from celery.decorators import task from .email import process_email @task() def helpdesk_process_email(): process_email()
Fix import of celery decorator "task".
Fix import of celery decorator "task".
Python
bsd-3-clause
django-helpdesk/django-helpdesk,gwasser/django-helpdesk,rossp/django-helpdesk,rossp/django-helpdesk,rossp/django-helpdesk,rossp/django-helpdesk,gwasser/django-helpdesk,gwasser/django-helpdesk,django-helpdesk/django-helpdesk,django-helpdesk/django-helpdesk,gwasser/django-helpdesk,django-helpdesk/django-helpdesk
ac2e251f165c4d8a11fe65bbfbf1562ea2020e97
docs/dummy-settings.py
docs/dummy-settings.py
DATABASES = { "default": { "NAME": ":memory:", "ENGINE": "django.db.backends.sqlite3", } }
DATABASES = { "default": { "NAME": ":memory:", "ENGINE": "django.db.backends.sqlite3", } } SECRET_KEY = "NOT SECRET"
Fix the exception about the missing secret key when generating docs.
Fix the exception about the missing secret key when generating docs.
Python
bsd-3-clause
littleweaver/django-daguerre,mislavcimpersak/django-daguerre,Styria-Digital/django-daguerre,littleweaver/django-daguerre,mislavcimpersak/django-daguerre,Styria-Digital/django-daguerre
bef9fb7f778666e602bfc5b27a65888f7459d0f9
blog/forms.py
blog/forms.py
from .models import BlogPost, BlogComment from django.forms import ModelForm class BlogPostForm(ModelForm): class Meta: model = BlogPost exclude = ('user',) def save(self, user, commit=True): post = super(BlogPostForm, self).save(commit=False) post.user = user if commi...
from .models import BlogPost, BlogComment from django.forms import ModelForm class BlogPostForm(ModelForm): class Meta: model = BlogPost exclude = ('user',) def save(self, user, commit=True): post = super(BlogPostForm, self).save(commit=False) post.user = user if commi...
Add a custom save() method to CommentForm
Add a custom save() method to CommentForm
Python
mit
andreagrandi/bloggato,andreagrandi/bloggato
34072121b9fc6d1b0ec740cb3d22034971ef0141
comics/search/urls.py
comics/search/urls.py
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^', include('haystack.urls')), )
from django.conf.urls.defaults import * from haystack.views import SearchView from haystack.forms import SearchForm urlpatterns = patterns('', url(r'^$', SearchView(form_class=SearchForm), name='haystack_search'), )
Convert to simpler search form
Convert to simpler search form
Python
agpl-3.0
datagutten/comics,klette/comics,jodal/comics,datagutten/comics,jodal/comics,klette/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,klette/comics
09fe8731e733081fff2595b04db63b93d0f4b91b
spider.py
spider.py
from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.selector import Selector from dataset import DatasetItem class DatasetSpider(CrawlSpider): name = 'dataset' allowed_domains = ['data.gc.ca/data/en'] start_urls = ['http://data....
from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.selector import Selector from dataset import DatasetItem class DatasetSpider(CrawlSpider): name = 'dataset' allowed_domains = ['data.gc.ca/data/en'] start_urls = ['http://data....
Add url assignment to each crawled dataset item
Add url assignment to each crawled dataset item
Python
mit
MaxLikelihood/CODE
94e6443a3eeb1bf76121ab2030a90c5631f32ff8
landscapesim/serializers/regions.py
landscapesim/serializers/regions.py
import json from rest_framework import serializers from django.core.urlresolvers import reverse from landscapesim.models import Region class ReportingUnitSerializer(serializers.Serializer): type = serializers.SerializerMethodField() properties = serializers.SerializerMethodField() geometry = serializers...
import json from rest_framework import serializers from django.core.urlresolvers import reverse from landscapesim.models import Region class ReportingUnitSerializer(serializers.Serializer): type = serializers.SerializerMethodField() properties = serializers.SerializerMethodField() geometry = serializers...
Allow data to be returned on the same request.
Allow data to be returned on the same request.
Python
bsd-3-clause
consbio/landscapesim,consbio/landscapesim,consbio/landscapesim
856f2328ccae97286b621c736716b37967027be8
tests/views.py
tests/views.py
# coding: utf-8 from __future__ import absolute_import, unicode_literals from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect from django.template.response import TemplateResponse from django.shortcuts import render from django.views.decorators.cache import cache_page...
# coding: utf-8 from __future__ import absolute_import, unicode_literals from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render from django.template.response import TemplateResponse from django.views.decorators.cache import cache_page...
Fix an imports ordering problem
Fix an imports ordering problem
Python
bsd-3-clause
tim-schilling/django-debug-toolbar,spookylukey/django-debug-toolbar,tim-schilling/django-debug-toolbar,django-debug-toolbar/django-debug-toolbar,tim-schilling/django-debug-toolbar,spookylukey/django-debug-toolbar,spookylukey/django-debug-toolbar,jazzband/django-debug-toolbar,django-debug-toolbar/django-debug-toolbar,dj...
f930fc7a23ff1337260a24b54c7b3d2b3d08f0d4
src/survey_stats/state.py
src/survey_stats/state.py
from survey_stats.datasets import SurveyDataset from survey_stats import log lgr = log.getLogger(__name__) dset = {} def initialize(dbc, cache, init_des, use_feather, init_svy, init_soc): lgr.info('was summoned into being, loading up some data', dbc=dbc, cache=cache, use_feather=use_feather) dset['brfss'] =...
from survey_stats.datasets import SurveyDataset from survey_stats import log lgr = log.getLogger(__name__) dset = {} def initialize(dbc, cache, init_des, use_feather, init_svy, init_soc): lgr.info('was summoned into being, loading up some data', dbc=dbc, cache=cache, use_feather=use_feather) dset['brfss'] =...
Check if brfss data for years 2000 to 2010 available
Check if brfss data for years 2000 to 2010 available
Python
bsd-2-clause
semanticbits/survey_stats,semanticbits/survey_stats
f2066b0f3fd90583d8b80bb8b09b8168b9d29628
kiva/__init__.py
kiva/__init__.py
#------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # some parts copyright 2002 by Space Telescope Science Institute # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE....
#------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # some parts copyright 2002 by Space Telescope Science Institute # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE....
Remove the explicit .relative import since the * import does not work with Python 2.5
BUG: Remove the explicit .relative import since the * import does not work with Python 2.5
Python
bsd-3-clause
tommy-u/enable,tommy-u/enable,tommy-u/enable,tommy-u/enable
2518beaf87feb39d03164d30feff37b6dea2c2ef
tests/integration/states/test_renderers.py
tests/integration/states/test_renderers.py
# coding: utf-8 ''' Integration tests for renderer functions ''' # Import Python Libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt Testing libs from tests.support.case import ModuleCase class TestJinjaRenderer(ModuleCase): ''' Validate that ordering works correctly ...
# coding: utf-8 ''' Integration tests for renderer functions ''' # Import Python Libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.helpers import flaky class TestJinjaRenderer(ModuleCase): ''' ...
Mark renderer test as flaky for mac tests
Mark renderer test as flaky for mac tests
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
eac9585634be34bdd1fabd65c6f22eb66134b6b4
datastage/web/user/views.py
datastage/web/user/views.py
from django_conneg.views import HTMLView from django.contrib.auth.forms.PasswordChangeForm class IndexView(HTMLView): def get(self, request): return self.render(request, {}, 'user/index') class PasswordView(HTMLView): def get(self, request):
from django_conneg.views import HTMLView #from django.contrib.auth.forms.PasswordChangeForm class IndexView(HTMLView): def get(self, request): return self.render(request, {}, 'user/index') class PasswordView(HTMLView): def get(self, request): pass
Fix syntax, even if not functionality.
Fix syntax, even if not functionality.
Python
mit
dataflow/DataStage,dataflow/DataStage,dataflow/DataStage
e95deac720589eaf81dbb54cadcef9a3459f7d02
youtube/downloader.py
youtube/downloader.py
import os from youtube_dl import YoutubeDL from youtube_dl import MaxDownloadsReached def download(url, audio_only): """Downloads the youtube video from the url Args: url: The youtube URL pointing to the video to download. audio_only: True if we only want to download the best audio. Retu...
import os from youtube_dl import YoutubeDL from youtube_dl import MaxDownloadsReached def download(url, audio_only): """Downloads the youtube video from the url Args: url: The youtube URL pointing to the video to download. audio_only: True if we only want to download the best audio. Retu...
Add comment explaining why use choose bestaudio for audio downloads.
Add comment explaining why use choose bestaudio for audio downloads.
Python
mit
tpcstld/youtube,tpcstld/youtube,tpcstld/youtube
3fa7cd977d250629f0ee619b1e5088872bcb051a
activities/runkeeper/signals.py
activities/runkeeper/signals.py
from django.db.models.signals import post_save from django.dispatch import receiver from data_import.signal_helpers import task_signal from social.apps.django_app.default.models import UserSocialAuth from .models import DataFile @receiver(post_save, sender=UserSocialAuth) def post_save_cb(sender, instance, created,...
from django.db.models.signals import post_save from django.dispatch import receiver from data_import.signal_helpers import task_signal from social.apps.django_app.default.models import UserSocialAuth from .models import DataFile @receiver(post_save, sender=UserSocialAuth) def post_save_cb(sender, instance, created,...
Fix timing issue in signal
Fix timing issue in signal
Python
mit
OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans
8f2c8f6e9dec950e0ddd46f563b65f64424cadd1
erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
from frappe import _ def get_data(): return { 'fieldname': 'sales_invoice', 'non_standard_fieldnames': { 'Delivery Note': 'against_sales_invoice', 'Journal Entry': 'reference_name', 'Payment Entry': 'reference_name', 'Payment Request': 'reference_name', 'Sales Invoice': 'return_against' }, 'int...
from frappe import _ def get_data(): return { 'fieldname': 'sales_invoice', 'non_standard_fieldnames': { 'Delivery Note': 'against_sales_invoice', 'Journal Entry': 'reference_name', 'Payment Entry': 'reference_name', 'Payment Request': 'reference_name', 'Sales Invoice': 'return_against' }, 'int...
Revert sales invoice dn link issue
Revert sales invoice dn link issue
Python
agpl-3.0
gsnbng/erpnext,gsnbng/erpnext,Aptitudetech/ERPNext,geekroot/erpnext,indictranstech/erpnext,indictranstech/erpnext,indictranstech/erpnext,gsnbng/erpnext,gsnbng/erpnext,geekroot/erpnext,indictranstech/erpnext,geekroot/erpnext,geekroot/erpnext
93cefdc2c309ed0b81fe4ec7d49c0c8bead783a9
lib/path_utils.py
lib/path_utils.py
"""Originally from funfactory (funfactory/path_utils.py) on a380a54""" import os from os.path import abspath, dirname def path(*a): return os.path.join(ROOT, *a) def import_mod_by_name(target): # stolen from mock :) components = target.split('.') import_path = components.pop(0) thing = __import...
"""Originally from funfactory (funfactory/path_utils.py) on a380a54""" import os from os.path import abspath, dirname def path(*a): return os.path.join(ROOT, *a) def import_mod_by_name(target): # stolen from mock :) components = target.split('.') import_path = components.pop(0) thing = __import...
Use __file__ instead of __name__
Use __file__ instead of __name__
Python
bsd-3-clause
akeym/cyder,zeeman/cyder,murrown/cyder,murrown/cyder,OSU-Net/cyder,drkitty/cyder,OSU-Net/cyder,akeym/cyder,akeym/cyder,OSU-Net/cyder,akeym/cyder,drkitty/cyder,murrown/cyder,drkitty/cyder,zeeman/cyder,OSU-Net/cyder,zeeman/cyder,murrown/cyder,drkitty/cyder,zeeman/cyder
be6ede95d37717a65bd02969e8340afd2354dcdc
tests/basics/gen_yield_from_throw.py
tests/basics/gen_yield_from_throw.py
def gen(): try: yield 1 except ValueError as e: print("got ValueError from upstream!", repr(e.args)) yield "str1" raise TypeError def gen2(): print((yield from gen())) g = gen2() print(next(g)) print(g.throw(ValueError)) try: print(next(g)) except TypeError: print("got Type...
def gen(): try: yield 1 except ValueError as e: print("got ValueError from upstream!", repr(e.args)) yield "str1" raise TypeError def gen2(): print((yield from gen())) g = gen2() print(next(g)) print(g.throw(ValueError)) try: print(next(g)) except TypeError: print("got Type...
Add test for throw into yield-from with normal return.
tests/basics: Add test for throw into yield-from with normal return. This test was found by missing coverage of a branch in py/nativeglue.c.
Python
mit
pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython
648daddbc75ee18201cc441dcf3ec34238e4479d
astropy/coordinates/__init__.py
astropy/coordinates/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for celestial coordinates of astronomical objects. It also contains a framework for conversions between coordinate systems. """ from .errors import * from .angles import * from .baseframe import * from ....
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for celestial coordinates of astronomical objects. It also contains a framework for conversions between coordinate systems. """ from .errors import * from .angles import * from .baseframe import * from ....
Remove "experimental" state of ecliptic frames
Remove "experimental" state of ecliptic frames
Python
bsd-3-clause
lpsinger/astropy,saimn/astropy,dhomeier/astropy,saimn/astropy,astropy/astropy,MSeifert04/astropy,larrybradley/astropy,dhomeier/astropy,MSeifert04/astropy,mhvk/astropy,lpsinger/astropy,pllim/astropy,saimn/astropy,astropy/astropy,MSeifert04/astropy,bsipocz/astropy,larrybradley/astropy,bsipocz/astropy,StuartLittlefair/ast...
7980c2e38d388ec78fd94ee13272934988dfa0f7
swingtime/__init__.py
swingtime/__init__.py
from django.apps import AppConfig VERSION = (0, 3, 0, 'beta', 0) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: version = '%s %s'...
# -*- coding: utf-8 -*- from django.apps import AppConfig VERSION = (0, 3, 0, 'beta', 0) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: ...
Make calendar config show up at bottom of main admin
Make calendar config show up at bottom of main admin
Python
mit
thrive-refugee/thrive-refugee,thrive-refugee/thrive-refugee,thrive-refugee/thrive-refugee
993bab40e4df323c671c99eec63d366028818a36
rosie/chamber_of_deputies/tests/test_election_expenses_classifier.py
rosie/chamber_of_deputies/tests/test_election_expenses_classifier.py
from unittest import TestCase import numpy as np import pandas as pd from rosie.chamber_of_deputies.classifiers import ElectionExpensesClassifier class TestElectionExpensesClassifier(TestCase): def setUp(self): self.dataset = pd.read_csv('rosie/chamber_of_deputies/tests/fixtures/election_expenses_class...
from unittest import TestCase import numpy as np import pandas as pd from rosie.chamber_of_deputies.classifiers import ElectionExpensesClassifier class TestElectionExpensesClassifier(TestCase): def setUp(self): self.dataset = pd.read_csv('rosie/chamber_of_deputies/tests/fixtures/election_expenses_class...
Remove a Rails accent of use subject in favor of Zen of Python: explicit is better than implicit and readbility counts
Remove a Rails accent of use subject in favor of Zen of Python: explicit is better than implicit and readbility counts
Python
mit
marcusrehm/serenata-de-amor,marcusrehm/serenata-de-amor,datasciencebr/serenata-de-amor,marcusrehm/serenata-de-amor,marcusrehm/serenata-de-amor,datasciencebr/rosie,datasciencebr/serenata-de-amor
1b7767dbc4fbaf69a6bf83a3989d5e672e0c7488
django_countries/filters.py
django_countries/filters.py
from django.contrib import admin from django.utils.translation import ugettext_lazy as _ class CountryFilter(admin.SimpleListFilter): """ A country filter for Django admin that only returns a list of countries related to the model. """ title = _('Country') parameter_name = 'country' def lookup...
from django.contrib import admin from django.utils.encoding import force_text from django.utils.translation import ugettext as _ class CountryFilter(admin.FieldListFilter): """ A country filter for Django admin that only returns a list of countries related to the model. """ title = _('Country') ...
Change the admin filter to a FieldListFilter
Change the admin filter to a FieldListFilter
Python
mit
schinckel/django-countries,SmileyChris/django-countries,pimlie/django-countries
b992f8ca9d7e4269592dd4fe8129a7afe92634a7
libraries/exception.py
libraries/exception.py
class OkupyException(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value)
from django.contrib.sites.models import Site class OkupyException(Exception): ''' Custon exception class ''' def __init__(self, value): self.value = value def __str__(self): return repr(self.value) def log_extra_data(request = None, form = None): ''' Extra data needed by t...
Add a log_extra_data function, which returns a dictionary needed by the logging formatter Add comments in the lib
Add a log_extra_data function, which returns a dictionary needed by the logging formatter Add comments in the lib
Python
agpl-3.0
dastergon/identity.gentoo.org,dastergon/identity.gentoo.org,gentoo/identity.gentoo.org,gentoo/identity.gentoo.org
06dd6fb991a9f68eea99d5943498688daa0b09c2
tests/test_interaction.py
tests/test_interaction.py
import numpy.testing as npt import pandas as pd import pandas.util.testing as pdt import pytest from .. import interaction as inter @pytest.fixture def choosers(): return pd.DataFrame( {'var1': range(5, 10), 'thing_id': ['a', 'c', 'e', 'g', 'i']}) @pytest.fixture def alternatives(): return...
import numpy.testing as npt import pandas as pd import pandas.util.testing as pdt import pytest from .. import interaction as inter @pytest.fixture def choosers(): return pd.DataFrame( {'var1': range(5, 10), 'thing_id': ['a', 'c', 'e', 'g', 'i']}) @pytest.fixture def alternatives(): return...
Return DCM probabilities as MultiIndexed Series
Return DCM probabilities as MultiIndexed Series Instead of separately returning probabilities and alternatives information this groups them all together. The probabilities have a MultiIndex with chooser IDs on the outside and alternative IDs on the inside.
Python
bsd-3-clause
UDST/choicemodels,UDST/choicemodels
d5a3b6e1eb37883a16c7e98d2a1b7c98d8d67051
layout/tests.py
layout/tests.py
from django.core.urlresolvers import resolve from django.test import TestCase from layout.views import home class HomePageTest(TestCase): def test_root_url_resolves_to_home_page(self): found = resolve('/') self.assertEqual(found.func, home)
from django.core.urlresolvers import resolve from django.http import HttpRequest from django.template.loader import render_to_string from django.test import TestCase from layout.views import home class HomePageTest(TestCase): def test_root_url_resolves_to_home_page(self): found = resolve('/') se...
Add test for home page html content
Add test for home page html content
Python
mit
jvanbrug/scout,jvanbrug/scout
9866b33ad5ba011c911346bae701973a5878f59e
blaze/compute/hdfstore.py
blaze/compute/hdfstore.py
from __future__ import absolute_import, division, print_function from .core import pre_compute from ..expr import Expr, Field from ..dispatch import dispatch from odo import into, chunks import pandas as pd @dispatch(Expr, pd.io.pytables.AppendableFrameTable) def pre_compute(expr, data, **kwargs): return into(chu...
from __future__ import absolute_import, division, print_function from collections import namedtuple from .core import pre_compute from ..expr import Expr, Field from ..dispatch import dispatch from odo import into, chunks import pandas as pd @dispatch(Expr, pd.io.pytables.AppendableFrameTable) def pre_compute(exp...
Move namedtuple to the top of the file
Move namedtuple to the top of the file
Python
bsd-3-clause
ContinuumIO/blaze,cowlicks/blaze,ChinaQuants/blaze,dwillmer/blaze,cpcloud/blaze,maxalbert/blaze,ContinuumIO/blaze,cowlicks/blaze,ChinaQuants/blaze,caseyclements/blaze,LiaoPan/blaze,xlhtc007/blaze,jcrist/blaze,dwillmer/blaze,nkhuyu/blaze,jcrist/blaze,LiaoPan/blaze,cpcloud/blaze,nkhuyu/blaze,maxalbert/blaze,caseyclements...
7ea7545cb0d9924fd0d7f3c658e2545a41ae11f0
arcutils/test/base.py
arcutils/test/base.py
import json import django.test from .user import UserMixin class Client(django.test.Client): def patch_json(self, path, data=None, **kwargs): return self.patch(path, **self._json_kwargs(data, kwargs)) def post_json(self, path, data=None, **kwargs): return self.post(path, **self._json_kwarg...
import json import django.test from .user import UserMixin class Client(django.test.Client): def patch_json(self, path, data=None, **kwargs): return self.patch(path, **self._json_kwargs(data, kwargs)) def post_json(self, path, data=None, **kwargs): return self.post(path, **self._json_kwarg...
Revert "Add patch_json method to our test Client"
Revert "Add patch_json method to our test Client" This reverts commit deef2f98deeeaf51bd9ddda4c5a200d082e16522. Somehow, I missed that this method was already there and added it again. I'm going to blame it on burnout.
Python
mit
wylee/django-arcutils,wylee/django-arcutils,PSU-OIT-ARC/django-arcutils,PSU-OIT-ARC/django-arcutils
98682412dccf2a5e38f0f701dbfe452e4e87a8aa
wagtail/admin/urls/password_reset.py
wagtail/admin/urls/password_reset.py
from django.urls import path, re_path from wagtail.admin.views import account urlpatterns = [ path( '', account.PasswordResetView.as_view(), name='wagtailadmin_password_reset' ), path( 'done/', account.PasswordResetDoneView.as_view(), name='wagtailadmin_password_reset_done' ), re_p...
from django.urls import path from wagtail.admin.views import account urlpatterns = [ path( '', account.PasswordResetView.as_view(), name='wagtailadmin_password_reset' ), path( 'done/', account.PasswordResetDoneView.as_view(), name='wagtailadmin_password_reset_done' ), path( ...
Use new-style URL paths for password reset views
Use new-style URL paths for password reset views This matches what Django has done in the corresponding views: https://github.com/django/django/blob/5d4b9c1cab03f0d057f0c7751862df0302c65cf9/django/contrib/auth/urls.py and prevents it from breaking on Django 3.1 (because the token is now longer than the 13+20 chars all...
Python
bsd-3-clause
torchbox/wagtail,kaedroho/wagtail,thenewguy/wagtail,zerolab/wagtail,torchbox/wagtail,thenewguy/wagtail,gasman/wagtail,wagtail/wagtail,gasman/wagtail,FlipperPA/wagtail,takeflight/wagtail,takeflight/wagtail,rsalmaso/wagtail,jnns/wagtail,wagtail/wagtail,gasman/wagtail,mixxorz/wagtail,takeflight/wagtail,jnns/wagtail,rsalma...
b7c967ad0f45cc1144a8713c6513bae5bca89242
LiSE/LiSE/test_proxy.py
LiSE/LiSE/test_proxy.py
from LiSE.proxy import EngineProcessManager import allegedb.test class ProxyTest(allegedb.test.AllegedTest): def setUp(self): self.manager = EngineProcessManager() self.engine = self.manager.start('sqlite:///:memory:') self.graphmakers = (self.engine.new_character,) def tearDown(self)...
from LiSE.proxy import EngineProcessManager import allegedb.test class ProxyTest(allegedb.test.AllegedTest): def setUp(self): self.manager = EngineProcessManager() self.engine = self.manager.start('sqlite:///:memory:') self.graphmakers = (self.engine.new_character,) def tearDown(self)...
Delete BranchLineageTest, which assumes bidirectional graphs exist
Delete BranchLineageTest, which assumes bidirectional graphs exist
Python
agpl-3.0
LogicalDash/LiSE,LogicalDash/LiSE
3b9f6e41014859eecc9d6ef01ec10fed40775861
medical_prescription_us/tests/test_medical_prescription_order_line.py
medical_prescription_us/tests/test_medical_prescription_order_line.py
# -*- coding: utf-8 -*- # Copyright 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 ValidationError class TestMedicalPrescriptionOrderLine(TransactionCase): def setUp(self): super(TestM...
# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo.tests.common import TransactionCase from odoo.exceptions import ValidationError class TestMedicalPrescriptionOrderLine(TransactionCase): def setUp(self): super(TestMedical...
Upgrade test namespace * Change openerp namespace to odoo in test imports
[MIG] medical_prescription_us: Upgrade test namespace * Change openerp namespace to odoo in test imports
Python
agpl-3.0
laslabs/vertical-medical,laslabs/vertical-medical
d5a1bfbff18cf129550c2c423beb8db9302c0736
tests/redisdl_test.py
tests/redisdl_test.py
import redisdl import unittest import json import os.path class RedisdlTest(unittest.TestCase): def test_roundtrip(self): path = os.path.join(os.path.dirname(__file__), 'fixtures', 'dump.json') with open(path) as f: dump = f.read() redisdl.loads(dump) redump = redisdl....
import redisdl import unittest import json import os.path class RedisdlTest(unittest.TestCase): def setUp(self): import redis self.r = redis.Redis() for key in self.r.keys('*'): self.r.delete(key) def test_roundtrip(self): path = os.path.join(os.path.dirname(__file_...
Clear redis data store before running tests
Clear redis data store before running tests
Python
bsd-2-clause
hyunchel/redis-dump-load,p/redis-dump-load,hyunchel/redis-dump-load,p/redis-dump-load
0549a85f83bb4fb95aff3c4fc8d8a699c7e73fa9
chainer/utils/argument.py
chainer/utils/argument.py
def check_unexpected_kwargs(kwargs, **unexpected): for key, message in unexpected.items(): if key in kwargs: raise ValueError(message) def parse_kwargs(kwargs, *name_and_values): values = [kwargs.pop(name, default_value) for name, default_value in name_and_values] if kwar...
import inspect def check_unexpected_kwargs(kwargs, **unexpected): for key, message in unexpected.items(): if key in kwargs: raise ValueError(message) def parse_kwargs(kwargs, *name_and_values): values = [kwargs.pop(name, default_value) for name, default_value in name_and_va...
Put `import inspect` at the top of the file
Put `import inspect` at the top of the file
Python
mit
keisuke-umezawa/chainer,niboshi/chainer,wkentaro/chainer,chainer/chainer,rezoo/chainer,keisuke-umezawa/chainer,hvy/chainer,keisuke-umezawa/chainer,okuta/chainer,ktnyt/chainer,jnishi/chainer,niboshi/chainer,pfnet/chainer,keisuke-umezawa/chainer,anaruse/chainer,hvy/chainer,okuta/chainer,chainer/chainer,hvy/chainer,nibosh...
50072e2e2fa2f650dd1899b14aaaecb2dfe909ef
tests/test_plugins.py
tests/test_plugins.py
# -*- coding:utf-8 -*- import os from sigal.gallery import Gallery from sigal import init_plugins CURRENT_DIR = os.path.dirname(__file__) def test_plugins(settings, tmpdir): settings['destination'] = str(tmpdir) if "sigal.plugins.nomedia" not in settings["plugins"]: settings['plugins'] += ["sigal....
# -*- coding:utf-8 -*- import blinker import os from sigal.gallery import Gallery from sigal import init_plugins, signals CURRENT_DIR = os.path.dirname(__file__) def test_plugins(settings, tmpdir): settings['destination'] = str(tmpdir) if "sigal.plugins.nomedia" not in settings["plugins"]: setting...
Clear signals after testing plugins
Clear signals after testing plugins
Python
mit
xouillet/sigal,t-animal/sigal,xouillet/sigal,saimn/sigal,xouillet/sigal,jasuarez/sigal,t-animal/sigal,t-animal/sigal,jasuarez/sigal,saimn/sigal,jasuarez/sigal,saimn/sigal
2a3e0b57f8f18404d5949abfd14cea8f51bfad13
tests/test_queries.py
tests/test_queries.py
from unittest import TestCase class MongoAdapterTestCase(TestCase): def setUp(self): from chatterbot.storage.mongodb import Query self.query = Query() def test_statement_text_equals(self): query = self.query.statement_text_equals('Testing in progress') self.assertIn('text', ...
from unittest import TestCase class MongoAdapterTestCase(TestCase): def setUp(self): from chatterbot.storage.mongodb import Query self.query = Query() def test_statement_text_equals(self): query = self.query.statement_text_equals('Testing in progress') self.assertIn('text', ...
Remove test cases for query methods being removed.
Remove test cases for query methods being removed.
Python
bsd-3-clause
gunthercox/ChatterBot,vkosuri/ChatterBot
f10d2865a8f858f05e72709655d15923ea706bb3
unitTestUtils/parseXML.py
unitTestUtils/parseXML.py
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function from xml.etree.ElementTree import ParseError import xml.etree.ElementTree as ET import glob import sys def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def parse(): for infile in glob.glob('*.xml'): tr...
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function from xml.etree.ElementTree import ParseError import xml.etree.ElementTree as ET import glob import sys def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def parse(): for infile in glob.glob('*.xml'): tr...
Add more verbose error to reporte on Travis parserXML.py
Add more verbose error to reporte on Travis parserXML.py
Python
apache-2.0
alexkernphysiker/j-pet-framework,alexkernphysiker/j-pet-framework,alexkernphysiker/j-pet-framework,JPETTomography/j-pet-framework,JPETTomography/j-pet-framework,alexkernphysiker/j-pet-framework,JPETTomography/j-pet-framework,alexkernphysiker/j-pet-framework
7a070f0b7873d96b2cb5e4c54fb34b3c38d45afb
genome_designer/main/data_util.py
genome_designer/main/data_util.py
""" Common methods for getting data from the backend. These methods are intended to be used by both views.py, which should define only pages, and xhr_handlers.py, which are intended to respond to AJAX requests. """ from main.model_views import CastVariantView from main.model_views import MeltedVariantView from varian...
""" Common methods for getting data from the backend. These methods are intended to be used by both views.py, which should define only pages, and xhr_handlers.py, which are intended to respond to AJAX requests. """ from main.model_views import CastVariantView from main.model_views import MeltedVariantView from varian...
Fix bug from last commit.
Fix bug from last commit.
Python
mit
churchlab/millstone,woodymit/millstone,churchlab/millstone,woodymit/millstone,woodymit/millstone,churchlab/millstone,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,woodymit/millstone,churchlab/millstone,woodymit/millstone_accidental_source
e6c43333c3939247534ddee4c419dcdcff5eda5f
spyder_terminal/server/rest/term_rest.py
spyder_terminal/server/rest/term_rest.py
# -*- coding: iso-8859-15 -*- """Main HTTP routes request handlers.""" import tornado.web import tornado.escape from os import getcwd class MainHandler(tornado.web.RequestHandler): """Handles creation of new terminals.""" @tornado.gen.coroutine def post(self): """POST verb: Create a new termina...
# -*- coding: iso-8859-15 -*- """Main HTTP routes request handlers.""" import tornado.web import tornado.escape from os import getcwd class MainHandler(tornado.web.RequestHandler): """Handles creation of new terminals.""" @tornado.gen.coroutine def post(self): """POST verb: Create a new termina...
Change default terminal resize arguments
Change default terminal resize arguments
Python
mit
andfoy/spyder-terminal,spyder-ide/spyder-terminal,spyder-ide/spyder-terminal,andfoy/spyder-terminal,andfoy/spyder-terminal,spyder-ide/spyder-terminal,spyder-ide/spyder-terminal
00ef4db967b00c5cef5c72d5266327bbd9db5909
ibmcnx/test/loadFunction.py
ibmcnx/test/loadFunction.py
import sys from java.lang import String from java.util import HashSet from java.util import HashMap import java import lotusConnectionsCommonAdmin globdict = globals() def loadFilesService(): global globdict exec open("filesAdmin.py").read()
import sys from java.lang import String from java.util import HashSet from java.util import HashMap import java import lotusConnectionsCommonAdmin globdict = globals() locdict = locals() def loadFilesService(): global globdict global locdict execfile("filesAdmin.py",globdict,locdict)
Customize scripts to work with menu
Customize scripts to work with menu
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
2e9472e4989985ebdb770c193856a02616a3d8e4
plugoo/assets.py
plugoo/assets.py
class Asset: """ This is an ooni-probe asset. It is a python iterator object, allowing it to be efficiently looped. To create your own custom asset your should subclass this and override the next_asset method and the len method for computing the length of the asset. """ def __init__(self...
class Asset: """ This is an ooni-probe asset. It is a python iterator object, allowing it to be efficiently looped. To create your own custom asset your should subclass this and override the next_asset method and the len method for computing the length of the asset. """ def __init__(self...
Add a method for line by line asset parsing
Add a method for line by line asset parsing
Python
bsd-2-clause
0xPoly/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,hackerberry/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni...
f0a1a75e6596f16b6e708c06a6c450d9acba2299
faas/puzzleboard-pop/puzzleboard_pop.py
faas/puzzleboard-pop/puzzleboard_pop.py
import json from datetime import datetime import requests from .model.puzzleboard import pop_puzzleboard class HuntwordsPuzzleBoardPopCommand(object): '''Command class that processes puzzleboard-pop message''' def run(self, jreq): '''Command that processes puzzleboard-pop message''' req = ...
import json import logging import sys from datetime import datetime import requests from .model.puzzleboard import pop_puzzleboard class HuntwordsPuzzleBoardPopCommand(object): '''Command class that processes puzzleboard-pop message''' def __init__(self): logging.basicConfig(stream=sys.stderr) ...
Add logging as a test
Add logging as a test
Python
mit
klmcwhirter/huntwords,klmcwhirter/huntwords,klmcwhirter/huntwords,klmcwhirter/huntwords
d6940b3ff80190f87bf7d5336b9c54dc160da12a
helpers/team_manipulator.py
helpers/team_manipulator.py
from helpers.ndb_manipulator_base import NdbManipulatorBase class TeamManipulator(NdbManipulatorBase): """ Handle Team database writes. """ @classmethod def updateMerge(self, new_team, old_team): """ Given an "old" and a "new" Team object, replace the fields in the "old...
from helpers.manipulator_base import ManipulatorBase class TeamManipulator(ManipulatorBase): """ Handle Team database writes. """ @classmethod def updateMerge(self, new_team, old_team): """ Given an "old" and a "new" Team object, replace the fields in the "old" team tha...
Remove references to NdbManipulatorBase, which never really happened.
Remove references to NdbManipulatorBase, which never really happened.
Python
mit
1fish2/the-blue-alliance,synth3tk/the-blue-alliance,bvisness/the-blue-alliance,bdaroz/the-blue-alliance,verycumbersome/the-blue-alliance,nwalters512/the-blue-alliance,synth3tk/the-blue-alliance,synth3tk/the-blue-alliance,phil-lopreiato/the-blue-alliance,the-blue-alliance/the-blue-alliance,the-blue-alliance/the-blue-all...
917feadfff4d38fe9b28e9451eb2def1438789fd
Mscthesis/IO/model_report.py
Mscthesis/IO/model_report.py
""" Module used to group the functions and utils to built a report from a model application. """ from Mscthesis.Plotting.net_plotting import plot_net_distribution,\ plot_heat_net from os.path import exists, join from os import makedirs def create_model_report(net, sectors, dirname, reportname): "Creation of...
""" Module used to group the functions and utils to built a report from a model application. """ from Mscthesis.Plotting.net_plotting import plot_net_distribution,\ plot_heat_net from os.path import exists, join from os import makedirs def create_model_report(net, sectors, dirname, reportname): "Creation of...
Debug bad creation of folders.
Debug bad creation of folders.
Python
mit
tgquintela/Mscthesis
51357755abe17adede5bbf7ccb3ba94c4ea701a9
src/libmv/multiview/panography_coeffs.py
src/libmv/multiview/panography_coeffs.py
import sympy f2, a12, a1, a2, b12, b1, b2 = sympy.symbols('f2 a12 a1 a2 b12 b1 b2') # Equation 12 from the brown paper; see panography.h equation_12 = ((a12 + f2)**2 * (b1 + f2) * (b2 + f2) - (b12 + f2)**2 * (a1 + f2) * (a2 + f2)) d = equation_12.as_poly(f2).as_dict() print ' // Coefficients in asce...
# Minimal Solutions for Panoramic Stitching. M. Brown, R. Hartley and D. Nister. # International Conference on Computer Vision and Pattern Recognition # (CVPR2007). Minneapolis, June 2007. import sympy f2, a12, a1, a2, b12, b1, b2 = sympy.symbols('f2 a12 a1 a2 b12 b1 b2') # Equation 12 from the brown paper; see pan...
Add xcas source code to obtain panography shared Focal polynomial solver.
Add xcas source code to obtain panography shared Focal polynomial solver.
Python
mit
petertsoi/libmv,libmv/libmv,SoylentGraham/libmv,libmv/libmv,SoylentGraham/libmv,rgkoo/libmv-blender,Nazg-Gul/libmv,Nazg-Gul/libmv,petertsoi/libmv,SoylentGraham/libmv,keir/libmv,keir/libmv,SoylentGraham/libmv,keir/libmv,rgkoo/libmv-blender,Nazg-Gul/libmv,libmv/libmv,rgkoo/libmv-blender,rgkoo/libmv-blender,Nazg-Gul/libmv...
3fb0f567dcaf69e4fa9872702ffbfa8ab0e69eaf
lib/utilities/key_exists.py
lib/utilities/key_exists.py
def key_exists(search_key, inputed_dict): ''' Given a search key which is dot notated return wether or not that key exists in a dictionary ''' num_levels = search_key.split(".") if len(num_levels) == 0: return False current_pointer = inputed_dict for updated_key in num_levels: ...
def key_exists(search_key, inputed_dict): ''' Given a search key which is dot notated return wether or not that key exists in a dictionary ''' num_levels = search_key.split(".") if len(num_levels) == 0: return False current_pointer = inputed_dict for updated_key in num_levels: ...
Add more error handling to key exists
Add more error handling to key exists
Python
mpl-2.0
mpurzynski/MozDef,mozilla/MozDef,jeffbryner/MozDef,mozilla/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,mozilla/MozDef,mozilla/MozDef,gdestuynder/MozDef,gdestuynder/MozDef,gdestuynder/MozDef,mpurzynski/MozDe...
a3ab513306614393f901e4991886ba93b6ed26a3
cardboard/frontend/testing.py
cardboard/frontend/testing.py
""" A frontend for use when testing. """ import contextlib from twisted.python import log from zope.interface import implements from cardboard.frontend import FrontendMixin, IFrontend def mock_selector(name): selections = [()] @contextlib.contextmanager def will_return(*selection): selection...
""" A frontend for use when testing. """ import contextlib from twisted.python import log from zope.interface import implements from cardboard.frontend import FrontendMixin, IFrontend def mock_selector(name): selections = [()] @contextlib.contextmanager def will_return(*selection): selection...
Make TestingFrontend not blow up from info and move select to TestingSelector.
Make TestingFrontend not blow up from info and move select to TestingSelector.
Python
mit
Julian/cardboard,Julian/cardboard
b56c5ca12f9806ecedc531e1f00ec1d7f2162b46
src-django/authentication/urls.py
src-django/authentication/urls.py
from django.conf.urls import url from views import login, logout, signup urlpatterns = [ url(r'^login', login), url(r'^logout', logout), url(r'^signup', signup), ]
from django.conf.urls import url from views import login, logout, signup, confirm_email urlpatterns = [ url(r'^login', login), url(r'^logout', logout), url(r'^signup', signup), url(r'^confirm_email/(?P<key>\w+)', confirm_email), ]
Add an endpoint for email confirmation
Add an endpoint for email confirmation
Python
bsd-3-clause
SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder
2f71ee89ab4f268518dc772af5755cca35976c4b
winthrop/annotation/models.py
winthrop/annotation/models.py
from django.db import models from annotator_store.models import BaseAnnotation from djiffy.models import IfPage from winthrop.people.models import Person # NOTE: needs to be different name than Annotation due to reverse rel issues... class Annotation(BaseAnnotation): # NOTE: do we want to associate explicitly wit...
from urllib.parse import urlparse from django.db import models from django.urls import resolve, Resolver404 from annotator_store.models import BaseAnnotation from djiffy.models import IfPage from winthrop.people.models import Person class Annotation(BaseAnnotation): # NOTE: do we want to associate explicitly with...
Add canvas lookup by url to associate annotations with iiif canvas uri
Add canvas lookup by url to associate annotations with iiif canvas uri
Python
apache-2.0
Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django
ff4c5d14d849db72f3af92bc87ccfc6626ef8744
reporting/job.py
reporting/job.py
#!/usr/bin/env python3 from dateutil import parser class Job: def __init__(self, category, id, status, start_timestamp, finish_timestamp, duration): self.tool_id = category.tool self.type_id = category.context self.id = id self.status_bit = int(status) self.start_timestamp ...
#!/usr/bin/env python3 from dateutil import parser class Job: def __init__(self, category, id, status, start_timestamp, finish_timestamp, duration = None): self.tool_id = category.tool self.type_id = category.context self.id = id self.status_bit = int(status) self.start_tim...
Make duration optional to create a Job
Make duration optional to create a Job
Python
mit
luigiberrettini/build-deploy-stats
c162514291428f26dc78d08393455ff33fe12f12
requests_test.py
requests_test.py
import requests from requests.auth import HTTPBasicAuth import secret parameters = 'teamstats' response = requests.get('https://www.mysportsfeeds.com/api/feed/pull/nfl/2016-2017-regular/playoff_team_standings.json?teamstats', auth=HTTPBasicAuth(secret.msf_username, secret.msf_pw)) print(respo...
import requests from requests.auth import HTTPBasicAuth import secret parameters = 'teamstats' response = requests.get('https://www.mysportsfeeds.com/api/feed/pull/nfl/2016-2017-regular/playoff_team_standings.json?teamstats', auth=HTTPBasicAuth(secret.msf_username, secret.msf_pw)) print(respo...
Clean up file and remove notes now that parameters in API feed are working
Clean up file and remove notes now that parameters in API feed are working
Python
mit
prcutler/nflpool,prcutler/nflpool
0ff15389ef24862f4f1b5b8923d6ca057018ae1a
polling_stations/apps/pollingstations/migrations/0010_auto_20160417_1416.py
polling_stations/apps/pollingstations/migrations/0010_auto_20160417_1416.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('pollingstations', '0006_residentialaddress_slug'), ] operations = [ migrations.AlterUniqueTogether( name='pollin...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('pollingstations', '0009_customfinder'), ] operations = [ migrations.AlterUniqueTogether( name='pollingdistrict',...
Edit migration so it depends on 0009_customfinder
Edit migration so it depends on 0009_customfinder Ensure the migrations will apply correctly without conflcit once merged Merging this branch is now blocked on PR #240
Python
bsd-3-clause
DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations
b39bf8ba3fc3d2037a293db7d5856d02ac047a31
nbt/__init__.py
nbt/__init__.py
from nbt import * VERSION = (1, 1) def _get_version(): return ".".join(VERSION)
__all__ = ["chunk", "region", "nbt"] from . import * VERSION = (1, 1) def _get_version(): return ".".join(VERSION)
Use relative import (required for Python 3, supported in 2.6 or higher)
Use relative import (required for Python 3, supported in 2.6 or higher)
Python
mit
macfreek/NBT,twoolie/NBT,fwaggle/NBT,devmario/NBT,cburschka/NBT
e79420fc4f32ff9ef72c81646533363502cc2235
fabfile.py
fabfile.py
from fabric.api import local, run from fabric.colors import green from fabric.contrib import django from fabric.decorators import task @task def run_tests(test='src'): django.settings_module('texas_choropleth.settings.test') local('./src/manage.py test {0}'.format(test)) def build(): print(green("[ Inst...
from fabric.api import local, run from fabric.colors import green from fabric.contrib import django from fabric.decorators import task @task def run_tests(test='src'): django.settings_module('texas_choropleth.settings.test') local('./src/manage.py test {0}'.format(test)) def build(): print(green("[ Inst...
Delete commented out loaddata command.
Delete commented out loaddata command. git-svn-id: d73fdb991549f9d1a0affa567d55bb0fdbd453f3@8436 f04a3889-0f81-4131-97fb-bc517d1f583d
Python
bsd-3-clause
unt-libraries/texas-choropleth,damonkelley/texas-choropleth,unt-libraries/texas-choropleth,damonkelley/texas-choropleth,damonkelley/texas-choropleth,damonkelley/texas-choropleth,unt-libraries/texas-choropleth,unt-libraries/texas-choropleth
d99dfc16e7c14896a703da7868f26a710b3bc6f1
14B-088/HI/analysis/galaxy_params.py
14B-088/HI/analysis/galaxy_params.py
''' Use parameters from Diskfit in the Galaxy class ''' from astropy import units as u from galaxies import Galaxy from astropy.table import Table from paths import fourteenB_HI_data_path def update_galaxy_params(gal, param_table): ''' Use the fit values from fit rather than the hard-coded values in galaxi...
''' Use parameters from Diskfit in the Galaxy class ''' from galaxies import Galaxy from astropy.table import Table from cube_analysis.rotation_curves import update_galaxy_params from paths import fourteenB_HI_data_path, fourteenB_HI_data_wGBT_path # The models from the peak velocity aren't as biased, based on com...
Update galaxy params w/ new model choices
Update galaxy params w/ new model choices
Python
mit
e-koch/VLA_Lband,e-koch/VLA_Lband
dad86f0637ea94abf1cdbf6674b62696980d5589
dont_tread_on_memes/__main__.py
dont_tread_on_memes/__main__.py
import dont_tread_on_memes import click @click.command() @click.option("--message", prompt="Don't _____ me", help=("The word or phrase to substitute for 'tread' in 'don't " "tread on me'")) @click.option("--save", default=None, help="Where to save the image") def tread(message, save)...
import dont_tread_on_memes import click @click.command() @click.option("--message", prompt="Don't _____ me", help=("The word or phrase to substitute for 'tread' in 'don't " "tread on me'")) @click.option("--format/--no-format", default=True, help=("Use the provided mess...
Allow 'raw' captioning via the --no-format flag
Allow 'raw' captioning via the --no-format flag
Python
mit
controversial/dont-tread-on-memes
27abcf86612e186f00cb9b91e604a222c9666438
app/eve_proxy/tasks.py
app/eve_proxy/tasks.py
from django.conf import settings import logging from datetime import datetime, timedelta from celery.task import task from eve_proxy.models import CachedDocument, ApiAccessLog @task(ignore_result=True) def clear_stale_cache(cache_extension=0): log = clear_stale_cache.get_logger() time = datetime.utcnow() - ...
import logging from datetime import datetime, timedelta from django.conf import settings from django.utils.timezone import now from celery.task import task from eve_proxy.models import CachedDocument, ApiAccessLog @task(ignore_result=True) def clear_stale_cache(cache_extension=0): log = clear_stale_cache.get_l...
Update eve_proxy taks for Django 1.4
Update eve_proxy taks for Django 1.4
Python
bsd-3-clause
nikdoof/test-auth
1619c955c75f91b9d61c3195704f17fc88ef9e04
aybu/manager/utils/pshell.py
aybu/manager/utils/pshell.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright 2010 Asidev s.r.l. 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 app...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright 2010 Asidev s.r.l. 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 app...
Initialize session and environment in shell
Initialize session and environment in shell
Python
apache-2.0
asidev/aybu-manager
38a3712a571ea8f3f76d1559938bc07d91c87cc6
baseflask/refresh_varsnap.py
baseflask/refresh_varsnap.py
""" This script refreshes production varsnap snaps """ import os from syspath import git_root # NOQA from app import serve os.environ['ENV'] = 'production' app = serve.app.test_client() app.get('/') app.get('/health') app.get('/humans.txt') app.get('/robots.txt') app.get('/.well-known/security.txt') app.get('/asd...
""" This script refreshes production varsnap snaps """ import os from dotenv import dotenv_values from syspath import git_root # NOQA from app import serve config = dotenv_values('.env.production') base_url = 'https://' + config.get('SERVER_NAME', '') os.environ['ENV'] = 'production' serve.app.config['SERVER_NAME...
Use production server name and https for generating production snaps
Use production server name and https for generating production snaps
Python
mit
albertyw/base-flask,albertyw/base-flask,albertyw/base-flask,albertyw/base-flask
4b89a9ab88ef197394103af7dda431e01e6d9298
app/__init__.py
app/__init__.py
import datetime from flask import Flask, g from flask.ext.sqlalchemy import SQLAlchemy telomere = Flask(__name__) telomere.config.from_object('app.settings') db = SQLAlchemy(telomere) import app.database database.init_db() telomere.secret_key = telomere.config['SECRET_KEY'] @telomere.before_request def set_date():...
import datetime from flask import Flask, g from flask.ext.sqlalchemy import SQLAlchemy import logging logging.basicConfig() telomere = Flask(__name__) telomere.config.from_object('app.settings') db = SQLAlchemy(telomere) import app.database database.init_db() telomere.secret_key = telomere.config['SECRET_KEY'] @t...
Stop DB creation scripts from silently failing
Stop DB creation scripts from silently failing
Python
mit
rabramley/telomere,rabramley/telomere,rabramley/telomere
17bc3130b8b93a3569906afc494484c9ed0db677
drogher/shippers/fedex.py
drogher/shippers/fedex.py
from .base import Shipper class FedEx(Shipper): barcode_pattern = r'^96\d{20}$' shipper = 'FedEx' @property def tracking_number(self): return self.barcode[7:] @property def valid_checksum(self): sequence, check_digit = self.tracking_number[:-1], self.tracking_number[-1] ...
from .base import Shipper class FedEx(Shipper): shipper = 'FedEx' class FedExExpress(FedEx): barcode_pattern = r'^\d{34}$' @property def tracking_number(self): return self.barcode[20:].lstrip('0') @property def valid_checksum(self): sequence, check_digit = self.tracking_num...
Add FedEx Express shipper class
Add FedEx Express shipper class
Python
bsd-3-clause
jbittel/drogher
353c3f1e88c55bbb31146c32162b18e9e6ae7cfc
corehq/apps/hqwebapp/management/commands/list_waf_allow_patterns.py
corehq/apps/hqwebapp/management/commands/list_waf_allow_patterns.py
import re from django.core.management import BaseCommand from django.urls import get_resolver from corehq.apps.hqwebapp.decorators import waf_allow class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( '--compact', action='store_true', def...
import re from django.core.management import BaseCommand from django.urls import get_resolver from corehq.apps.hqwebapp.decorators import waf_allow class Command(BaseCommand): def handle(self, *args, **options): resolver = get_resolver() for kind, views in waf_allow.views.items(): p...
Move WAF regex compaction from here to commcare-cloud
Move WAF regex compaction from here to commcare-cloud
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
ff5eccb59efd09cfdeb64150440de35215e1b77d
gevent_tasks/utils.py
gevent_tasks/utils.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # >> # gevent-tasks, 2017 # << import random import string ch_choices = string.ascii_letters + string.digits def gen_uuid(length=4): # type: (int) -> str """ Generate a random ID of a given length. """ return ''.join(map(lambda c: random.choice(ch_choic...
#! /usr/bin/env python # -*- coding: utf-8 -*- # >> # gevent-tasks, 2017 # << import random import string ch_choices = string.ascii_letters + string.digits def gen_uuid(length=4): """ Generate a random ID of a given length. Args: length (int): length of the returned string. Ret...
Fix `gen_uuid` logic and documentation
Fix `gen_uuid` logic and documentation
Python
mit
blakev/gevent-tasks
69cff805c92810a4ee1d4581be8597f1aa14f78e
lib/game_launchers/steam_game_launcher.py
lib/game_launchers/steam_game_launcher.py
from lib.game_launcher import GameLauncher, GameLauncherException import sys import shlex import subprocess class SteamGameLauncher(GameLauncher): def __init__(self, **kwargs): super().__init__(**kwargs) def launch(self, **kwargs): app_id = kwargs.get("app_id") if app_id is None: ...
from lib.game_launcher import GameLauncher, GameLauncherException import sys import shlex import subprocess import webbrowser class SteamGameLauncher(GameLauncher): def __init__(self, **kwargs): super().__init__(**kwargs) def launch(self, **kwargs): app_id = kwargs.get("app_id") if...
Add support for launching Steam games on windows through the Steam protocol
Add support for launching Steam games on windows through the Steam protocol
Python
mit
SerpentAI/SerpentAI
c633112d6336c37e15577eb6d035488cc42bfd59
indra/explanation/model_checker/__init__.py
indra/explanation/model_checker/__init__.py
from .model_checker import ModelChecker, PathResult, PathMetric from .pysb import PysbModelChecker from .signed_graph import SignedGraphModelChecker from .unsigned_graph import UnsignedGraphModelChecker from .pybel import PybelModelChecker
from .model_checker import ModelChecker, PathResult, PathMetric, get_path_iter from .pysb import PysbModelChecker from .signed_graph import SignedGraphModelChecker from .unsigned_graph import UnsignedGraphModelChecker from .pybel import PybelModelChecker
Add get_path_iter to model_checker importables
Add get_path_iter to model_checker importables
Python
bsd-2-clause
sorgerlab/belpy,johnbachman/indra,johnbachman/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,bgyori/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/indra,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra
e8506331cfa5e14029e3de4ccb16c5e0267e85b3
manoseimas/votings/nodes.py
manoseimas/votings/nodes.py
from zope.component import adapts from zope.component import provideAdapter from sboard.nodes import CreateView from sboard.nodes import DetailsView from .forms import PolicyIssueForm from .interfaces import IVoting from .interfaces import IPolicyIssue class VotingView(DetailsView): adapts(IVoting) templat...
from zope.component import adapts from zope.component import provideAdapter from sboard.nodes import CreateView from sboard.nodes import DetailsView from sboard.nodes import TagListView from .forms import PolicyIssueForm from .interfaces import IVoting from .interfaces import IPolicyIssue class VotingView(DetailsVi...
Use TagListView for IPolicyIssue as default view.
Use TagListView for IPolicyIssue as default view.
Python
agpl-3.0
ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt
aa59466630fa3e39e8b0f5da40100b62e2194ab8
tests/parser/test_loop_parsing.py
tests/parser/test_loop_parsing.py
from tests.infrastructure.test_utils import parse_local, validate_types from thinglang.lexer.values.numeric import NumericValue from thinglang.lexer.values.identifier import Identifier from thinglang.parser.blocks.loop import Loop from thinglang.parser.values.binary_operation import BinaryOperation from thinglang.parse...
from tests.infrastructure.test_utils import parse_local, validate_types from thinglang.lexer.values.numeric import NumericValue from thinglang.lexer.values.identifier import Identifier from thinglang.parser.blocks.iteration_loop import IterationLoop from thinglang.parser.blocks.loop import Loop from thinglang.parser.va...
Add unit test for iteration loop parsing
Add unit test for iteration loop parsing
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
46344032e016b51e9d34b2620b72e418533374e2
hyper/http20/frame.py
hyper/http20/frame.py
# -*- coding: utf-8 -*- """ hyper/http20/frame ~~~~~~~~~~~~~~~~~~ Defines framing logic for HTTP/2.0. Provides both classes to represent framed data and logic for aiding the connection when it comes to reading from the socket. """ class Frame(object): """ The base class for all HTTP/2.0 frames. """ # T...
# -*- coding: utf-8 -*- """ hyper/http20/frame ~~~~~~~~~~~~~~~~~~ Defines framing logic for HTTP/2.0. Provides both classes to represent framed data and logic for aiding the connection when it comes to reading from the socket. """ # A map of type byte to frame class. FRAMES = { 0x00: DataFrame } class Frame(obje...
Define a mapping between byte and class.
Define a mapping between byte and class.
Python
mit
Lukasa/hyper,fredthomsen/hyper,Lukasa/hyper,masaori335/hyper,lawnmowerlatte/hyper,jdecuyper/hyper,irvind/hyper,jdecuyper/hyper,lawnmowerlatte/hyper,irvind/hyper,masaori335/hyper,plucury/hyper,plucury/hyper,fredthomsen/hyper
ac84d8743b50a00c49a8ceb81ed69661841bce70
wagtail/core/middleware.py
wagtail/core/middleware.py
import warnings from django.utils.deprecation import MiddlewareMixin from wagtail.core.models import Site from wagtail.utils.deprecation import RemovedInWagtail28Warning class SiteMiddleware(MiddlewareMixin): def process_request(self, request): """ Set request.site to contain the Site object resp...
import warnings from django.utils.deprecation import MiddlewareMixin from wagtail.core.models import Site from wagtail.utils.deprecation import RemovedInWagtail211Warning class SiteMiddleware(MiddlewareMixin): def process_request(self, request): """ Set request.site to contain the Site object res...
Revert SiteMiddleware to setting request.site
Revert SiteMiddleware to setting request.site This way, SiteMiddleware continues to support existing user / third-party code that has not yet been migrated from request.site to Site.find_for_request
Python
bsd-3-clause
takeflight/wagtail,takeflight/wagtail,thenewguy/wagtail,thenewguy/wagtail,timorieber/wagtail,wagtail/wagtail,gasman/wagtail,takeflight/wagtail,kaedroho/wagtail,mixxorz/wagtail,wagtail/wagtail,timorieber/wagtail,kaedroho/wagtail,kaedroho/wagtail,rsalmaso/wagtail,rsalmaso/wagtail,FlipperPA/wagtail,thenewguy/wagtail,mixxo...
ca1fe65c5008ddba3467b962f2a51f6c034a5006
mopidy_subsonic/__init__.py
mopidy_subsonic/__init__.py
from __future__ import unicode_literals import os from mopidy import ext, config from mopidy.exceptions import ExtensionError __doc__ = """A extension for playing music from Subsonic. This extension handles URIs starting with ``subsonic:`` and enables you to play music using a Subsonic server. See https://github.co...
from __future__ import unicode_literals import os from mopidy import ext, config from mopidy.exceptions import ExtensionError __version__ = '0.2' class SubsonicExtension(ext.Extension): dist_name = 'Mopidy-Subsonic' ext_name = 'subsonic' version = __version__ def get_default_config(self): ...
Remove module docstring copied from an old Mopidy extension
Remove module docstring copied from an old Mopidy extension
Python
mit
rattboi/mopidy-subsonic
6d72a1d3b4bd2e1a11e2fb9744353e5d2d9c8863
setup.py
setup.py
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext setup(cmdclass = {'build_ext': build_ext}, ext_modules = [Extension("lulu_base", ["lulu_base.pyx"]), Extension("ccomp", ["ccomp.pyx"])])
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import numpy def cext(name): return Extension(name, [name + ".pyx"], include_dirs=[numpy.get_include()]) setup(cmdclass = {'build_ext': build_ext}, ext_modules = [cext('lulu...
Add NumPy includes dir for Cython builds.
Add NumPy includes dir for Cython builds.
Python
bsd-3-clause
stefanv/lulu
bcda095b10a9db6ae1745ec4be45f3ee273c75aa
lms/djangoapps/philu_overrides/constants.py
lms/djangoapps/philu_overrides/constants.py
ACTIVATION_ERROR_MSG_FORMAT = '<span id="resend-activation-span"> Your account has not been activated. Please check your email to activate your account. <a id="resend-activation-link" href="{}"> Resend Activation Email </a></span>' ORG_DETAILS_UPDATE_ALERT = 'It has been more than a year since you updated these number...
ACTIVATION_ERROR_MSG_FORMAT = '<span id="resend-activation-span"> Your account has not been activated. Please check your email to activate your account. <a id="resend-activation-link" class="click-here-link" href="{}"> Resend Activation Email </a></span>' ORG_DETAILS_UPDATE_ALERT = 'It has been more than a year since ...
Add relevant css class to clickable link in banner
Add relevant css class to clickable link in banner
Python
agpl-3.0
philanthropy-u/edx-platform,philanthropy-u/edx-platform,philanthropy-u/edx-platform,philanthropy-u/edx-platform
6f4beaa772e9b8b9b1de6f6a92c0b7fd00bdd5af
mltsp/science_features/lomb_scargle_fast.py
mltsp/science_features/lomb_scargle_fast.py
import numpy as np import gatspy def lomb_scargle_fast_period(t, m, e): """Fits a simple sinuosidal model y(t) = A sin(2*pi*w*t + phi) + c and returns the estimated period 1/w. Much faster than fitting the full multi-frequency model used by `science_features.lomb_scargle`. """ opt_args =...
import numpy as np import gatspy def lomb_scargle_fast_period(t, m, e): """Fits a simple sinuosidal model y(t) = A sin(2*pi*w*t + phi) + c and returns the estimated period 1/w. Much faster than fitting the full multi-frequency model used by `science_features.lomb_scargle`. """ dt = t.max...
Use more sensible choice of period_range for `period_fast` feature
Use more sensible choice of period_range for `period_fast` feature Periods searched should depend only on the range of times, rather than the max time.
Python
bsd-3-clause
acrellin/mltsp,mltsp/mltsp,mltsp/mltsp,acrellin/mltsp,bnaul/mltsp,acrellin/mltsp,bnaul/mltsp,mltsp/mltsp,mltsp/mltsp,acrellin/mltsp,bnaul/mltsp,mltsp/mltsp,acrellin/mltsp,bnaul/mltsp,bnaul/mltsp,acrellin/mltsp,mltsp/mltsp,bnaul/mltsp
374729efac2b79d1b4459c76932d7149988f5fe3
setup.py
setup.py
from distutils.core import setup setup( name='tspapi', version='0.1.0', url="http://boundary.github.io/pulse-api-python/", author='David Gwartney', author_email='david_gwartney@bmc.com', packages=['tspapi', ], # entry_points={ # 'console_scripts': [ # 'actionhandler = bound...
from distutils.core import setup setup( name='tspapi', version='0.1.1', url="https://github.com/boundary/pulse-api-python", author='David Gwartney', author_email='david_gwartney@bmc.com', packages=['tspapi', ], # entry_points={ # 'console_scripts': [ # 'actionhandler = boun...
Add correct URL ; increment version
Add correct URL ; increment version
Python
apache-2.0
jdgwartney/pulse-api-python
9c2321585ef47634723b69bfa190719c17e3183f
roundware/rw/fields.py
roundware/rw/fields.py
from django.forms import forms from south.modelsinspector import add_introspection_rules from validatedfile.fields import ValidatedFileField import pyclamav class RWValidatedFileField(ValidatedFileField): """ Same as FileField, but you can specify: * content_types - list containing allowed content_typ...
from django.forms import forms from south.modelsinspector import add_introspection_rules from validatedfile.fields import ValidatedFileField class RWValidatedFileField(ValidatedFileField): """ Same as FileField, but you can specify: * content_types - list containing allowed content_types. Exa...
Move pyclamav import inside of clean method on RWValidatedFileField so that it doesn't get imported by streamscript or unless as needed for field validation
Move pyclamav import inside of clean method on RWValidatedFileField so that it doesn't get imported by streamscript or unless as needed for field validation
Python
agpl-3.0
IMAmuseum/roundware-server,yangjackascd/roundware-server,jslootbeek/roundware-server,probabble/roundware-server,jslootbeek/roundware-server,eosrei/roundware-server,probabble/roundware-server,yangjackascd/roundware-server,eosrei/roundware-server,eosrei/roundware-server,Karlamon/roundware-server,IMAmuseum/roundware-serve...
7f817802445bcfea9730f29a82c87f4883fda71e
apps/package/templatetags/package_tags.py
apps/package/templatetags/package_tags.py
from datetime import timedelta from datetime import datetime from django import template from github2.client import Github from package.models import Package, Commit register = template.Library() github = Github() @register.filter def commits_over_52(package): current = datetime.now() weeks = [] comm...
from datetime import timedelta from datetime import datetime from django import template from github2.client import Github from package.models import Package, Commit register = template.Library() github = Github() @register.filter def commits_over_52(package): current = datetime.now() weeks = [] comm...
Update the commit_over_52 template tag to be more efficient.
Update the commit_over_52 template tag to be more efficient. Replaced several list comprehensions with in-database operations and map calls for significantly improved performance.
Python
mit
miketheman/opencomparison,miketheman/opencomparison,benracine/opencomparison,audreyr/opencomparison,nanuxbe/djangopackages,cartwheelweb/packaginator,pydanny/djangopackages,nanuxbe/djangopackages,QLGu/djangopackages,cartwheelweb/packaginator,pydanny/djangopackages,QLGu/djangopackages,audreyr/opencomparison,nanuxbe/djang...