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
0a5e2134fda46269626b6fac367a28218734b256
conf_site/accounts/tests/__init__.py
conf_site/accounts/tests/__init__.py
from factory import fuzzy from django.contrib.auth import get_user_model from django.test import TestCase class AccountsTestCase(TestCase): def setUp(self): super(AccountsTestCase, self).setUp() self.password = fuzzy.FuzzyText(length=16) self.new_password = fuzzy.FuzzyText(length=16) ...
from factory import fuzzy from django.contrib.auth import get_user_model from django.test import TestCase class AccountsTestCase(TestCase): def setUp(self): super(AccountsTestCase, self).setUp() self.password = fuzzy.FuzzyText(length=16) self.new_password = fuzzy.FuzzyText(length=16) ...
Add `_become_staff` method to AccountsTestCase.
Add `_become_staff` method to AccountsTestCase.
Python
mit
pydata/conf_site,pydata/conf_site,pydata/conf_site
76e436daef154bdf6acd1b0569f6fa2baa61addd
pyxform/tests_v1/test_audit.py
pyxform/tests_v1/test_audit.py
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase class AuditTest(PyxformTestCase): def test_audit(self): self.assertPyxformXform( name="meta_audit", md=""" | survey | | | | | | type | name | label | ...
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase class AuditTest(PyxformTestCase): def test_audit(self): self.assertPyxformXform( name="meta_audit", md=""" | survey | | | | | | type | name | label | ...
Add test for blank audit name.
Add test for blank audit name.
Python
bsd-2-clause
XLSForm/pyxform,XLSForm/pyxform
fb25fa04cf553b1084425a1f2af6a9315266ffaf
salt/renderers/yaml_jinja.py
salt/renderers/yaml_jinja.py
''' The default rendering engine, process yaml with the jinja2 templating engine This renderer will take a yaml file with the jinja2 template and render it to a high data format for salt states. ''' # Import Python Modules import os # Import thirt party modules import yaml try: yaml.Loader = yaml.CLoader yam...
''' The default rendering engine, process yaml with the jinja2 templating engine This renderer will take a yaml file with the jinja2 template and render it to a high data format for salt states. ''' # Import Python Modules import os # Import thirt party modules import yaml try: yaml.Loader = yaml.CLoader yam...
Add pillar data to default renderer
Add pillar data to default renderer
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
d63e792815b9bfe485e4127bdcb088374d8e983e
salvus/scripts/first_boot.py
salvus/scripts/first_boot.py
#!/usr/bin/env python # This script is run by /etc/rc.local when booting up. It does special configuration # depending on what images are mounted, etc. import os if os.path.exists('/mnt/home/'): # Compute machine if not os.path.exists('/mnt/home/aquota.group'): os.system("quotacheck -cug /mnt/home")...
#!/usr/bin/env python # This script is run by /etc/rc.local when booting up. It does special configuration # depending on what images are mounted, etc. import os if os.path.exists('/mnt/home/'): # Compute machine if not os.path.exists('/mnt/home/aquota.group'): os.system("quotacheck -cug /mnt/home")...
Remove .ssh keys on compute node from /mnt/home/salvus account, since this is a security risk (in case compute node is r00ted).
Remove .ssh keys on compute node from /mnt/home/salvus account, since this is a security risk (in case compute node is r00ted).
Python
agpl-3.0
tscholl2/smc,sagemathinc/smc,sagemathinc/smc,sagemathinc/smc,DrXyzzy/smc,tscholl2/smc,tscholl2/smc,DrXyzzy/smc,DrXyzzy/smc,DrXyzzy/smc,tscholl2/smc,tscholl2/smc,sagemathinc/smc
e645104656fda22f4c0c2b3d9841ed792b1e7103
conftest.py
conftest.py
import sys pytest_plugins = 'setuptools.tests.fixtures' def pytest_addoption(parser): parser.addoption( "--package_name", action="append", default=[], help="list of package_name to pass to test functions", ) collect_ignore = [ 'tests/manual_test.py', 'setuptools/tests/mod_with_cons...
import sys import pytest pytest_plugins = 'setuptools.tests.fixtures' def pytest_addoption(parser): parser.addoption( "--package_name", action="append", default=[], help="list of package_name to pass to test functions", ) parser.addoption( "--integration", action="store_true", d...
Configure pytest to enable/disable integration tests
Configure pytest to enable/disable integration tests
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
84d9a421b33660f4ad17432fef8604a55b0e2302
calvin/runtime/south/plugins/io/sensors/environmental/platform/raspberry_pi/sensehat_impl/environmental.py
calvin/runtime/south/plugins/io/sensors/environmental/platform/raspberry_pi/sensehat_impl/environmental.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
Allow use of sensors from more than one actor concurrenctly
Sensehat: Allow use of sensors from more than one actor concurrenctly
Python
apache-2.0
EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base
98aa2b25c63ec5bd6384a9d398a70996799b135e
mygpoauth/urls.py
mygpoauth/urls.py
from django.conf.urls import include, url from django.contrib import admin from django.views.generic.base import RedirectView from mygpoauth import oauth2 urlpatterns = [ # Examples: # url(r'^$', 'mygpoauth.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', RedirectView.as...
from django.conf.urls import include, url from django.contrib import admin from django.views.generic.base import RedirectView from mygpoauth import oauth2 urlpatterns = [ # Examples: # url(r'^$', 'mygpoauth.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', RedirectView.as...
Make "/" a non-permanent redirect
Make "/" a non-permanent redirect
Python
agpl-3.0
gpodder/mygpo-auth,gpodder/mygpo-auth
b706c1a949b10a7dd4b3206c02de8d4abda088a9
pytac/mini_project.py
pytac/mini_project.py
import pytac.load_csv import pytac.epics def main(): lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem()) bpms = lattice.get_elements('BPM') bpms_n = 0 try: for bpm in bpms: bpm.get_pv_name('y') bpms_n += 1 print 'There exist {0} BPMy elements i...
import pytac.load_csv import pytac.epics def main(): # First task: print the number of bpm y elements in the ring. lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem()) bpms = lattice.get_elements('BPM') bpms_n = 0 try: for bpm in bpms: bpm.get_pv_name('y') ...
Print each bpmx pv name along with the associated value to stdout
Print each bpmx pv name along with the associated value to stdout
Python
apache-2.0
razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects
0b8b32a044e92f4e996af734d44a2d93d1492684
project_code/bulk_fitting.py
project_code/bulk_fitting.py
''' Bulk spectral line fitting with SDSS galaxy spectra ''' import os from astropy.io import fits from pandas import concat # Bring in the package funcs from specfit import do_specfit from download_spectra import download_spectra def bulk_fit(obs_file, output_file, keep_spectra=False): ''' Downloads files ...
''' Bulk spectral line fitting with SDSS galaxy spectra ''' import os from astropy.io import fits from pandas import DataFrame # Bring in the package funcs from specfit import do_specfit from download_spectra import download_spectra def bulk_fit(obs_file, output_file, keep_spectra=False): ''' Downloads fil...
Correct names, concat dataframes properly
Correct names, concat dataframes properly
Python
mit
e-koch/Phys-595
ba4953423450c3bf2924aa76f37694b405c8ee85
parse-zmmailbox-ids.py
parse-zmmailbox-ids.py
import re import sys # $ zmmailbox -z -m username@domain.tld search -l 200 "in:/inbox (before:today)" # num: 200, more: true # # Id Type From Subject Date # ------- ---- -------------------- -------------------------------------------------...
import re import sys # $ zmmailbox -z -m username@domain.tld search -l 200 "in:/inbox (before:today)" # num: 200, more: true # # Id Type From Subject Date # ------- ---- -------------------- -------------------------------------------------...
Include '-' in ID, print IDs separated by ','
Include '-' in ID, print IDs separated by ','
Python
apache-2.0
hgdeoro/zimbra7-to-zimbra8-password-migrator
62297b3c937d386b759ec14a078cee36f2550d44
src/aiy/_drivers/_alsa.py
src/aiy/_drivers/_alsa.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Return None with invalid sample_width from sample_width_to_string.
Return None with invalid sample_width from sample_width_to_string.
Python
apache-2.0
google/aiyprojects-raspbian,t1m0thyj/aiyprojects-raspbian,google/aiyprojects-raspbian,t1m0thyj/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian
ec07e139b5585a8ed9bed14426dac987267ebf05
sbtsettings.py
sbtsettings.py
import sublime class SBTSettings(object): def __init__(self, window): self.window = window self._plugin_settings = sublime.load_settings('SublimeSBT.sublime-settings') def sbt_command(self): return self._view_settings().get('sbt_command', self._plugin_settings.get('sbt_command')) ...
import sublime from util import maybe class SBTSettings(object): def __init__(self, window): self.window = window self._plugin_settings = sublime.load_settings('SublimeSBT.sublime-settings') def sbt_command(self): return self._view_settings().get('sbt_command', self._plugin_settings...
Fix AttributeError getting project settings when no active view
Fix AttributeError getting project settings when no active view
Python
mit
jarhart/SublimeSBT
e1b23cdc089b3a05ae4959c9859e16e5e21b5c91
apps/careeropportunity/views.py
apps/careeropportunity/views.py
#-*- coding: utf-8 -*- from django.shortcuts import render_to_response from django.shortcuts import get_object_or_404 from django.template import RequestContext from apps.careeropportunity.models import CareerOpportunity import datetime def index(request): opportunities = CareerOpportunity.objects.all() ...
#-*- coding: utf-8 -*- from datetime import datetime from django.shortcuts import render_to_response from django.shortcuts import get_object_or_404 from django.template import RequestContext from apps.careeropportunity.models import CareerOpportunity def index(request): opportunities = CareerOpportunity.objects.f...
Make careerop only display active ops
Make careerop only display active ops
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
fe167bfd25c0c86b3c6fb5ef76eb24036ad2b6da
tests/ne_np/__init__.py
tests/ne_np/__init__.py
from __future__ import unicode_literals import unittest import re from faker import Factory from faker.utils import text from .. import string_types class ne_NP_FactoryTestCase(unittest.TestCase): def setUp(self): self.factory = Factory.create('ne_NP') def test_address(self): from fa...
from __future__ import unicode_literals import unittest from faker import Factory from .. import string_types class NeNPFactoryTestCase(unittest.TestCase): def setUp(self): self.factory = Factory.create('ne_NP') def test_address(self): from faker.providers.address.ne_NP import Prov...
Fix incorrect ne_NP locale tests
Fix incorrect ne_NP locale tests This test incorrectly assumes a call to name() will yield only a first/last name, which isn't always true for this locale. I suspect it hasn't been uncovered yet because the tests are seeded the same at the beginning of every run. It only becomes a problem when you start moving tests a...
Python
mit
trtd/faker,joke2k/faker,joke2k/faker,danhuss/faker
6b9d9c33b4d68a008bb992b9a11ab2f02a4d5cbd
shelltest/tests/test_runner.py
shelltest/tests/test_runner.py
import tempfile import StringIO import pytest from shelltest.shelltest import ShellTest, ShellTestSource, ShellTestRunner @pytest.fixture def tests(): return [ShellTest('echo hello', 'hello\n', ShellTestSource('', 0)), ShellTest('echo $?', '0\n', ShellTestSource('', 2))] def test_run(tests): r...
import tempfile import StringIO import pytest from shelltest.shelltest import ShellTest, ShellTestSource, ShellTestRunner def runner(tests): tests = [ShellTest(cmd, output, ShellTestSource('', 0)) for cmd, output in tests] return ShellTestRunner(tests) @pytest.mark.parametrize("cmd,output,ret_code,success...
Update runner tests to use parameters
Update runner tests to use parameters
Python
mit
jthacker/shelltest,jthacker/shelltest
82f8861df01d67335499682743f69b1763cc3c35
uberlogs/handlers/kill_process.py
uberlogs/handlers/kill_process.py
import sys import os from logging import Handler as LoggingHandler class KillProcessHandler(LoggingHandler): def emit(self, record): if record.levelno != self.level: return try: # flush text before exiting for fd in [sys.stdout, sys.stderr]: fd...
import sys import os from logging import Handler as LoggingHandler class KillProcessHandler(LoggingHandler): def emit(self, record): if record.levelno != self.level: return # flush text before exiting for fd in [sys.stdout, sys.stderr]: fd.flush() # Twist...
Remove redundant try/catch block in kill process handler
Remove redundant try/catch block in kill process handler
Python
mit
odedlaz/uberlogs,odedlaz/uberlogs
6a531ebe5e097d277a7b07e142e98009d622253f
tests/registryd/test_root_accessible.py
tests/registryd/test_root_accessible.py
# Pytest will pick up this module automatically when running just "pytest". # # Each test_*() function gets passed test fixtures, which are defined # in conftest.py. So, a function "def test_foo(bar)" will get a bar() # fixture created for it. PROPERTIES_IFACE = 'org.freedesktop.DBus.Properties' ACCESSIBLE_IFACE = 'o...
# Pytest will pick up this module automatically when running just "pytest". # # Each test_*() function gets passed test fixtures, which are defined # in conftest.py. So, a function "def test_foo(bar)" will get a bar() # fixture created for it. PROPERTIES_IFACE = 'org.freedesktop.DBus.Properties' ACCESSIBLE_IFACE = 'o...
Put all the Accessibility property tests in a single function
Put all the Accessibility property tests in a single function We already had machinery for that, anyway.
Python
lgpl-2.1
GNOME/at-spi2-core,GNOME/at-spi2-core,GNOME/at-spi2-core
4aeb85126cf5f75d89cc466c3f7fea2f53702a13
bluebottle/votes/serializers.py
bluebottle/votes/serializers.py
from bluebottle.votes.models import Vote from bluebottle.bb_accounts.serializers import UserPreviewSerializer from rest_framework import serializers class VoteSerializer(serializers.ModelSerializer): voter = UserPreviewSerializer(read_only=True) project = serializers.SlugRelatedField(source='project', slug_fi...
from bluebottle.votes.models import Vote from bluebottle.bb_accounts.serializers import UserPreviewSerializer from rest_framework import serializers class VoteSerializer(serializers.ModelSerializer): voter = UserPreviewSerializer(read_only=True) project = serializers.SlugRelatedField(source='project', slug_fi...
Add created to votes api serializer
Add created to votes api serializer
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle
83036bf711dd5047ef87a56ea9d8def604923882
ts3observer/features.py
ts3observer/features.py
''' Created on Nov 10, 2014 @author: fechnert ''' import logging class Feature(object): ''' Represents a abstract Feature ''' def __init__(self, config, clients, channels): ''' Initialize the Object ''' self.config = config self.clients = clients self.channels = channels ...
''' Created on Nov 10, 2014 @author: fechnert ''' import logging class Feature(object): ''' Represents a abstract Feature ''' def __init__(self, config, clients, channels): ''' Initialize the Object ''' self.config = config self.clients = clients self.channels = channels ...
Change Feature classes to match the new config
Change Feature classes to match the new config
Python
mit
HWDexperte/ts3observer
aa1bbbe1d4b463be8cedaaf445fa44612592513f
minette/test/helper.py
minette/test/helper.py
from time import time from ..core import Minette from ..models import Message class MinetteForTest(Minette): def __init__(self, **kwargs): super().__init__(**kwargs) self.default_channel = kwargs.get("default_channel", "") self.case_id = str(int(time() * 10000000)) def chat(self, req...
from time import time from ..core import Minette from ..models import Message class MinetteForTest(Minette): def __init__(self, **kwargs): super().__init__(**kwargs) self.default_channel = kwargs.get("default_channel", "") self.case_id = str(int(time() * 10000000)) def chat(self, req...
Add `text` attribute to response from `chat`
Add `text` attribute to response from `chat`
Python
apache-2.0
uezo/minette-python
1d043a9fa2140992435bc5d6583601464d96f5b0
wafer/schedule/renderers.py
wafer/schedule/renderers.py
from django_medusa.renderers import StaticSiteRenderer class ScheduleRenderer(StaticSiteRenderer): def get_paths(self): paths = ["/schedule/", ] return paths renderers = [ScheduleRenderer, ]
from django_medusa.renderers import StaticSiteRenderer from wafer.schedule.models import Venue class ScheduleRenderer(StaticSiteRenderer): def get_paths(self): paths = ["/schedule/", ] # Add the venues items = Venue.objects.all() for item in items: paths.append(item.ge...
Add venues to site export
Add venues to site export
Python
isc
CarlFK/wafer,CarlFK/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer
93474c192516864b2c609f2225a0f6c1fa8ca9a8
Cauldron/ext/commandkeywords/__init__.py
Cauldron/ext/commandkeywords/__init__.py
# -*- coding: utf-8 -*- """ An extension for a command-based keyword. """ from __future__ import absolute_import from Cauldron.types import Boolean, DispatcherKeywordType from Cauldron.exc import NoWriteNecessary class CommandKeyword(Boolean, DispatcherKeywordType): """This keyword will receive boolean writes as ...
# -*- coding: utf-8 -*- """ An extension for a command-based keyword. """ from __future__ import absolute_import from Cauldron.types import Boolean, DispatcherKeywordType from Cauldron.exc import NoWriteNecessary from Cauldron.utils.callbacks import Callbacks class CommandKeyword(Boolean, DispatcherKeywordType): ...
Make command-keyword compatible with DFW implementation
Make command-keyword compatible with DFW implementation
Python
bsd-3-clause
alexrudy/Cauldron
6cf2a3966e12af5f86781a5d20c0810953722811
tests/basics/scope.py
tests/basics/scope.py
# test scoping rules # explicit global variable a = 1 def f(): global a global a, a # should be able to redefine as global a = 2 f() print(a) # explicit nonlocal variable def f(): a = 1 def g(): nonlocal a nonlocal a, a # should be able to redefine as nonlocal a = 2 g()...
# test scoping rules # explicit global variable a = 1 def f(): global a global a, a # should be able to redefine as global a = 2 f() print(a) # explicit nonlocal variable def f(): a = 1 def g(): nonlocal a nonlocal a, a # should be able to redefine as nonlocal a = 2 g()...
Add further tests for nonlocal scoping and closures.
tests/basics: Add further tests for nonlocal scoping and closures.
Python
mit
lowRISC/micropython,ryannathans/micropython,tralamazza/micropython,micropython/micropython-esp32,cwyark/micropython,deshipu/micropython,lowRISC/micropython,alex-march/micropython,adafruit/micropython,Peetz0r/micropython-esp32,SHA2017-badge/micropython-esp32,turbinenreiter/micropython,deshipu/micropython,ryannathans/mic...
63ee6f971b99c2f030e0347c37bc9577ba9ee7cd
getMenu.py
getMenu.py
#!/usr/bin/env python import json, os, requests from awsauth import S3Auth key = os.environ.get('UWOPENDATA_APIKEY') service = 'FoodMenu' # output = 'json' # callback = 'None' request = 'http://api.uwaterloo.ca/public/v1/' def getMenu(): url = request + '?' + 'key=' + key + '&' + 'service=' + service r = requests...
#!/usr/bin/env python import json, os, requests from awsauth import S3Auth key = os.environ.get('UWOPENDATA_APIKEY') service = 'FoodMenu' def getMenu(): payload = {'key': key, 'service': service} r = requests.get('http://api.uwaterloo.ca/public/v1/', params=payload) return r.text menu = getMenu() ACCESS_KEY = os....
Allow requests module to correctly encode query parameters.
Allow requests module to correctly encode query parameters.
Python
mit
alykhank/FoodMenu,alykhank/FoodMenu,alykhank/FoodMenu
98a05257eaf4ca6555ffc179a9250a7cfb3a903c
scripts/lib/check-database-compatibility.py
scripts/lib/check-database-compatibility.py
#!/usr/bin/env python3 import logging import os import sys ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, ZULIP_PATH) from scripts.lib.setup_path import setup_path from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, assert_not_running_as_root, parse_versio...
#!/usr/bin/env python3 import logging import os import sys ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, ZULIP_PATH) from scripts.lib.setup_path import setup_path from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, assert_not_running_as_root, parse_versio...
Print names of missing migrations in compatibility check.
scripts: Print names of missing migrations in compatibility check. This will make it much easier to debug any situations where this happens.
Python
apache-2.0
rht/zulip,rht/zulip,rht/zulip,andersk/zulip,zulip/zulip,zulip/zulip,andersk/zulip,kou/zulip,andersk/zulip,kou/zulip,zulip/zulip,rht/zulip,kou/zulip,andersk/zulip,rht/zulip,kou/zulip,andersk/zulip,rht/zulip,zulip/zulip,kou/zulip,kou/zulip,zulip/zulip,kou/zulip,andersk/zulip,zulip/zulip,andersk/zulip,rht/zulip,zulip/zuli...
cbafc968343cd2b001bcee354d418c9886fe94b4
tests/test_network.py
tests/test_network.py
from nose.tools import eq_, ok_ import unittest import openxc.measurements from openxc.sources import NetworkDataSource from openxc.sources import DataSourceError class NetworkDataSourceTests(unittest.TestCase): def setUp(self): super(NetworkDataSourceTests, self).setUp() def test_create(self): ...
from nose.tools import eq_, ok_ import unittest import openxc.measurements from openxc.sources import NetworkDataSource from openxc.sources import DataSourceError class NetworkDataSourceTests(unittest.TestCase): def setUp(self): super(NetworkDataSourceTests, self).setUp() def test_create(self): ...
Use localhost for network source tests to avoid waiting for DNS.
Use localhost for network source tests to avoid waiting for DNS.
Python
bsd-3-clause
openxc/openxc-python,openxc/openxc-python,openxc/openxc-python
86d12c7d13bd7a11a93deccf42f93df4328e70fd
admin_honeypot/urls.py
admin_honeypot/urls.py
from admin_honeypot import views from django.conf.urls import url app_name = 'admin_honeypot' urlpatterns = [ url(r'^login/$', views.AdminHoneypot.as_view(), name='login'), url(r'^.*$', views.AdminHoneypot.as_view(), name='index'), ]
from admin_honeypot import views from django.urls import path, re_path app_name = 'admin_honeypot' urlpatterns = [ path('login/', views.AdminHoneypot.as_view(), name='login'), re_path(r'^.*$', views.AdminHoneypot.as_view(), name='index'), ]
Update url() to path() in the urlconf.
Update url() to path() in the urlconf.
Python
mit
dmpayton/django-admin-honeypot,dmpayton/django-admin-honeypot
1726a73b81c8a7dfc3610690fe9272776e930f0f
aero/adapters/bower.py
aero/adapters/bower.py
# -*- coding: utf-8 -*- __author__ = 'oliveiraev' __all__ = ['Bower'] from re import sub from re import split from aero.__version__ import enc from .base import BaseAdapter class Bower(BaseAdapter): """ Twitter Bower - Browser package manager - Adapter """ def search(self, query): return {} ...
# -*- coding: utf-8 -*- __author__ = 'oliveiraev' __all__ = ['Bower'] from re import sub from re import split from aero.__version__ import enc from .base import BaseAdapter class Bower(BaseAdapter): """ Twitter Bower - Browser package manager - Adapter """ def search(self, query): response = ...
Simplify return while we're at it
Simplify return while we're at it
Python
bsd-3-clause
Aeronautics/aero
19964dc65cecbbb043da3fe85bf355423cf9ce3c
shop/products/admin/forms.py
shop/products/admin/forms.py
from django.apps import apps from django import forms from suit.sortables import SortableTabularInline from multiupload.fields import MultiFileField class ProductForm(forms.ModelForm): images = MultiFileField(max_num=100, min_num=1, required=False) class Meta: model = apps.get_model('products', '...
from django.apps import apps from django import forms from suit.sortables import SortableTabularInline from multiupload.fields import MultiFileField class ProductForm(forms.ModelForm): images = MultiFileField(max_num=100, min_num=1, required=False) def save(self, commit=True): product = super(Pro...
Clear attr values on category change.
Clear attr values on category change.
Python
isc
pmaigutyak/mp-shop,pmaigutyak/mp-shop,pmaigutyak/mp-shop
bd7c6e22146604183412657e68457db7ae7766ed
script/jsonify-book.py
script/jsonify-book.py
import sys from glob import glob from os.path import basename import json book_dir, out_dir = sys.argv[1:3] files = [basename(x).rstrip(".xhtml") for x in glob(f"{book_dir}/*.xhtml")] json_data = {} for path in files: with open(f"{book_dir}/{path}.xhtml", "r") as book_part: content = book_part.read() ...
import sys from glob import glob from os.path import basename import json book_dir, out_dir = sys.argv[1:3] files = [basename(x).rstrip(".xhtml") for x in glob(f"{book_dir}/*.xhtml")] json_data = {} for path in files: with open(f"{book_dir}/{path}.json", "r") as meta_part: json_data = json.load(meta_par...
Add metadata to jsonify output
Add metadata to jsonify output
Python
lgpl-2.1
Connexions/cte,Connexions/cnx-recipes,Connexions/cnx-rulesets,Connexions/cnx-recipes,Connexions/cnx-rulesets,Connexions/cnx-rulesets,Connexions/cnx-rulesets,Connexions/cnx-recipes,Connexions/cnx-recipes,Connexions/cte,Connexions/cnx-recipes
b9e3485030ef7acf5b3d312b8e9d9fc54367eded
tests/ext/argcomplete_tests.py
tests/ext/argcomplete_tests.py
"""Tests for cement.ext.ext_argcomplete.""" import os from cement.ext import ext_argcomplete from cement.ext.ext_argparse import ArgparseController, expose from cement.utils import test from cement.utils.misc import rando APP = rando()[:12] class MyBaseController(ArgparseController): class Meta: label = ...
"""Tests for cement.ext.ext_argcomplete.""" import os from cement.ext import ext_argcomplete from cement.ext.ext_argparse import ArgparseController, expose from cement.utils import test from cement.utils.misc import rando APP = rando()[:12] class MyBaseController(ArgparseController): class Meta: label = ...
Fix Argcomplete Tests on Python <3.2
Fix Argcomplete Tests on Python <3.2
Python
bsd-3-clause
akhilman/cement,fxstein/cement,datafolklabs/cement,akhilman/cement,akhilman/cement,fxstein/cement,fxstein/cement,datafolklabs/cement,datafolklabs/cement
11b16c26c182636016e7d86cd0f94963eec42556
project/settings/ci.py
project/settings/ci.py
# Local from .base import * # JWT Settings def jwt_get_username_from_payload_handler(payload): return payload.get('email') JWT_AUTH = { # 'JWT_SECRET_KEY': AUTH0_CLIENT_SECRET, 'JWT_AUDIENCE': AUTH0_CLIENT_ID, 'JWT_PAYLOAD_GET_USERNAME_HANDLER': jwt_get_username_from_payload_handler, 'JWT_AUTH_HE...
# Local from .base import * # JWT Settings def jwt_get_username_from_payload_handler(payload): return payload.get('email') JWT_AUTH = { # 'JWT_SECRET_KEY': AUTH0_CLIENT_SECRET, 'JWT_AUDIENCE': AUTH0_CLIENT_ID, 'JWT_PAYLOAD_GET_USERNAME_HANDLER': jwt_get_username_from_payload_handler, 'JWT_AUTH_HE...
Revert "Attempt to bypass test database"
Revert "Attempt to bypass test database" This reverts commit 889713c8c4c7151ba06448a3993778a91d2abfd6.
Python
bsd-2-clause
barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,dbinetti/barberscore
77f99f4862ded1b8493b5895e4f9d88a3bbf722b
source/globals/fieldtests.py
source/globals/fieldtests.py
# -*- coding: utf-8 -*- ## \package globals.fieldtests # MIT licensing # See: LICENSE.txt import wx ## Tests if a wx control/instance is enabled # # Function for compatibility between wx versions # \param enabled # \b \e bool : Check if enabled or disabled def FieldEnabled(field, enabled=True): if wx.M...
# -*- coding: utf-8 -*- ## \package globals.fieldtests # MIT licensing # See: LICENSE.txt import wx ## Tests if a wx control/instance is enabled/disabled # # Function for compatibility between wx versions # \param field # \b \e wx.Window : the wx control to check # \param enabled # \b \e bool : Check i...
Add function FieldDisabled to test for disabled controls
Add function FieldDisabled to test for disabled controls
Python
mit
AntumDeluge/desktop_recorder,AntumDeluge/desktop_recorder
6a2fb450eb51d46fe4ab53dd4095527ecdcc9266
tests/laundry_test.py
tests/laundry_test.py
import unittest from penn import Laundry class TestLaundry(unittest.TestCase): def setUp(self): self.laundry = Laundry() def test_all(self): data = self.laundry.all_status() self.assertEquals('Class of 1925 House', data[0]['name']) self.assertEquals(55, len(data)) def te...
from nose.tools import ok_, eq_ from penn import Laundry class TestLaundry(): def setUp(self): self.laundry = Laundry() def test_all(self): data = self.laundry.all_status() eq_(55, len(data)) eq_('Class of 1925 House', data[0]['name']) # Check all halls have appropria...
Add more rigorous laundry tests
Add more rigorous laundry tests
Python
mit
pennlabs/penn-sdk-python,pennlabs/penn-sdk-python
589dac7bf0305ec1289b2f81fe8c03cb61260238
tools/boilerplate_data/init.py
tools/boilerplate_data/init.py
<%inherit file="layout.py"/> from .backend import ${r.name}Backend __all__ = ['${r.name}Backend']
<%inherit file="layout.py"/> from .backend import ${r.classname}Backend __all__ = ['${r.classname}Backend']
Fix missing use of the class name
boilerplate: Fix missing use of the class name
Python
agpl-3.0
sputnick-dev/weboob,RouxRC/weboob,sputnick-dev/weboob,willprice/weboob,laurent-george/weboob,Konubinix/weboob,RouxRC/weboob,Boussadia/weboob,RouxRC/weboob,yannrouillard/weboob,frankrousseau/weboob,yannrouillard/weboob,franek/weboob,Boussadia/weboob,laurent-george/weboob,Konubinix/weboob,Boussadia/weboob,laurent-george/...
9bb19e21ed7f3b10af9a218cf55ea3a19ee4393c
tests/test_command.py
tests/test_command.py
"""Unittest of command entry point.""" # Copyright 2015 Masayuki Yamamoto # # 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 r...
"""Unittest of command entry point.""" # Copyright 2015 Masayuki Yamamoto # # 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 r...
Add command test for '--help' option
Add command test for '--help' option Check calling 'print_help' method.
Python
apache-2.0
ma8ma/yanico
01920b5dcced36e72a5623bf9c08c5cecfa38753
src/scrapy_redis/dupefilter.py
src/scrapy_redis/dupefilter.py
import time from scrapy.dupefilters import BaseDupeFilter from scrapy.utils.request import request_fingerprint from . import connection class RFPDupeFilter(BaseDupeFilter): """Redis-based request duplication filter""" def __init__(self, server, key): """Initialize duplication filter Parame...
import time from scrapy.dupefilters import BaseDupeFilter from scrapy.utils.request import request_fingerprint from . import connection class RFPDupeFilter(BaseDupeFilter): """Redis-based request duplication filter""" def __init__(self, server, key): """Initialize duplication filter Parame...
Allow to override request fingerprint call.
Allow to override request fingerprint call.
Python
mit
darkrho/scrapy-redis,rolando/scrapy-redis
333afea8d8a548948f24745490c700c98500e22f
mlab-ns-simulator/mlabsim/lookup.py
mlab-ns-simulator/mlabsim/lookup.py
""" This simulates the mlab-ns lookup request, whose code lives here: https://code.google.com/p/m-lab/source/browse/server/mlabns/handlers/lookup.py?repo=ns The difference in this module is that we don't support features which ooni-support does not use and we augment features which ooni-support would rely on if mlab-...
""" This simulates the mlab-ns lookup request, whose code lives here: https://code.google.com/p/m-lab/source/browse/server/mlabns/handlers/lookup.py?repo=ns The difference in this module is that we don't support features which ooni-support does not use and we augment features which ooni-support would rely on if mlab-...
Implement the current ``GET /ooni`` api.
Implement the current ``GET /ooni`` api.
Python
apache-2.0
hellais/ooni-support,m-lab/ooni-support,m-lab/ooni-support,hellais/ooni-support
a057798f3e54e8d74005df10ba1f7d9b93270787
odbc2csv.py
odbc2csv.py
import pypyodbc import csv conn = pypyodbc.connect("DSN=HOSS_DB") cur = conn.cursor() tables = [] cur.execute("select * from sys.tables") for row in cur.fetchall(): tables.append(row[0]) for table in tables: print(table) cur.execute("select * from {}".format(table)) column_names = [] for d i...
import pypyodbc import csv conn = pypyodbc.connect("DSN=HOSS_DB") cur = conn.cursor() tables = [] cur.execute("select * from sys.tables") for row in cur.fetchall(): tables.append(row[0]) for table in tables: print(table) cur.execute("select * from {}".format(table)) column_names = [] for d i...
Use just newline for file terminator.
Use just newline for file terminator.
Python
isc
wablair/misc_scripts,wablair/misc_scripts,wablair/misc_scripts,wablair/misc_scripts
9f5418e5b755232e12ea18e85b131dbd04c74587
benchmarks_sphere/paper_jrn_parco_rexi_nonlinear/postprocessing_pickle.py
benchmarks_sphere/paper_jrn_parco_rexi_nonlinear/postprocessing_pickle.py
#! /usr/bin/env python3 import sys import math import glob from sweet.postprocessing.pickle_SphereDataPhysicalDiff import * p = pickle_SphereDataPhysicalDiff("_t00000000120.00000000.csv")
#! /usr/bin/env python3 import sys import math import glob from sweet.postprocessing.pickle_SphereDataPhysicalDiff import * from mule.exec_program import * # Ugly hack! #output, retval = exec_program('ls *benchref*/*prog_h* | sort | tail -n 1 | sed "s/.*prog_h//"') #if retval != 0: # print(output) # raise Exception(...
Make postprocess pickling generic to various reference files
Make postprocess pickling generic to various reference files
Python
mit
schreiberx/sweet,schreiberx/sweet,schreiberx/sweet,schreiberx/sweet
36ea5e58ce97b69bfd0bf3701cbc5936bc59d100
install_dotfiles.py
install_dotfiles.py
#!/usr/bin/python # install_dotfiles # This script will build platform-specific dotfiles and create the appropriate symlinks in ~ import platform import os sysName = platform.system() os.remove('bashrc') bashrc = open('bashrc','a') def writeSection(fileName, allowComments): f = open(fileName,'r') for line in f...
#!/usr/bin/python # install_dotfiles # This script will build platform-specific dotfiles and create the appropriate symlinks in ~ import platform import os sysName = platform.system() os.remove('bashrc') bashrc = open('bashrc','a') bashrc.write("#!/bin/bash\n") bashrc.write("# This file was generated by a script. D...
Reorder writing of bashrc body sections.
Reorder writing of bashrc body sections.
Python
mit
rucker/dotfiles-manager
3661edd55553ff2dff27cb102a83d4751e033f2a
painter/management/commands/import_cards.py
painter/management/commands/import_cards.py
import tablib from django.core.management.base import BaseCommand from painter.models import Card class Command(BaseCommand): def handle(self, *args, **options): dataset = tablib.Dataset()
import tablib from django.core.management.base import BaseCommand from painter.models import Card class Command(BaseCommand): help = ('Clears the database of cards, then fills it with the contents of one or' + ' more specified CSV files.') def add_arguments(self, parser): parser.add_argu...
Add help text and a 'filenames' argument.
Add help text and a 'filenames' argument. * Make it print the filenames it's receiving for the sake of good testing output.
Python
mit
adam-incuna/imperial-painter,adam-thomas/imperial-painter,adam-thomas/imperial-painter,adam-incuna/imperial-painter
6889946ebb1c1559e0e1c7b83e1d7b1d6896e0b0
tests/test_train_dictionary.py
tests/test_train_dictionary.py
import unittest import zstd class TestTrainDictionary(unittest.TestCase): def test_no_args(self): with self.assertRaises(TypeError): zstd.train_dictionary() def test_bad_args(self): with self.assertRaises(TypeError): zstd.train_dictionary(8192, u'foo') with s...
import sys import unittest import zstd if sys.version_info[0] >= 3: int_type = int else: int_type = long class TestTrainDictionary(unittest.TestCase): def test_no_args(self): with self.assertRaises(TypeError): zstd.train_dictionary() def test_bad_args(self): with self.a...
Check for appropriate long type on Python 2
Check for appropriate long type on Python 2 The extension always returns a long, which is not an "int" on Python 2. Fix the test.
Python
bsd-3-clause
terrelln/python-zstandard,terrelln/python-zstandard,terrelln/python-zstandard,indygreg/python-zstandard,terrelln/python-zstandard,indygreg/python-zstandard,indygreg/python-zstandard,indygreg/python-zstandard
47fe1412857dbc251ff89004798d5507b0e70b25
boundary/plugin_get.py
boundary/plugin_get.py
# # Copyright 2014-2015 Boundary, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
# # Copyright 2014-2015 Boundary, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
Reformat code to PEP-8 standards
Reformat code to PEP-8 standards
Python
apache-2.0
wcainboundary/boundary-api-cli,boundary/pulse-api-cli,jdgwartney/pulse-api-cli,wcainboundary/boundary-api-cli,jdgwartney/boundary-api-cli,boundary/boundary-api-cli,jdgwartney/boundary-api-cli,boundary/pulse-api-cli,jdgwartney/pulse-api-cli,boundary/boundary-api-cli
27d2cd57337497abb9d106fdb033c26771e481e4
rmgpy/data/__init__.py
rmgpy/data/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ # # RMG - Reaction Mechanism Generator # # Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the # RMG Team (rmg_dev@mit.edu) # # Permission is hereby granted, free ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ # # RMG - Reaction Mechanism Generator # # Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the # RMG Team (rmg_dev@mit.edu) # # Permission is hereby granted, free ...
Remove getDatabaseDirectory() function from rmgpy.data
Remove getDatabaseDirectory() function from rmgpy.data This function is not being used anywhere, and also has been replaced by the settings in rmgpy, which searches for and saves a database directory
Python
mit
pierrelb/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py,nickvandewiele/RMG-Py,nyee/RMG-Py,nyee/RMG-Py,chatelak/RMG-Py,chatelak/RMG-Py
f188f2eb81c1310b9862b435a492b4ce6d0fac2d
python3/aniso8601/resolution.py
python3/aniso8601/resolution.py
# -*- coding: utf-8 -*- # This software may be modified and distributed under the terms # of the BSD license. See the LICENSE file for details. from enum import Enum class DateResolution(Enum): Year, Month, Week, Weekday, Day, Ordinal = range(6) class TimeResolution(Enum): Seconds, Minutes, Hours = range(3...
# -*- coding: utf-8 -*- # This software may be modified and distributed under the terms # of the BSD license. See the LICENSE file for details. class DateResolution(object): Year, Month, Week, Weekday, Day, Ordinal = list(range(6)) class TimeResolution(object): Seconds, Minutes, Hours = list(range(3))
Remove use of enum in Python3
Remove use of enum in Python3
Python
bsd-3-clause
3stack-software/python-aniso8601-relativedelta
4b5a39c6bbc82572f67ea03236490e52049adf52
tests/query_test/test_scan_range_lengths.py
tests/query_test/test_scan_range_lengths.py
#!/usr/bin/env python # Copyright (c) 2012 Cloudera, Inc. All rights reserved. # Validates running with different scan range length values # import pytest from copy import copy from tests.common.test_vector import TestDimension from tests.common.impala_test_suite import ImpalaTestSuite, ALL_NODES_ONLY # We use very sm...
#!/usr/bin/env python # Copyright (c) 2012 Cloudera, Inc. All rights reserved. # Validates running with different scan range length values # import pytest from copy import copy from tests.common.test_vector import TestDimension from tests.common.impala_test_suite import ImpalaTestSuite, ALL_NODES_ONLY # We use very sm...
Fix IMPALA-122: Lzo scanner with small scan ranges.
Fix IMPALA-122: Lzo scanner with small scan ranges. Change-Id: I5226fd1a1aa368f5b291b78ad371363057ef574e Reviewed-on: http://gerrit.ent.cloudera.com:8080/140 Reviewed-by: Skye Wanderman-Milne <6d4b168ab637b0a20cc9dbf96abb2537f372f946@cloudera.com> Reviewed-by: Nong Li <99a5e5f8f5911755b88e0b536d46aafa102bed41@cloudera...
Python
apache-2.0
tempbottle/Impala,cchanning/Impala,kapilrastogi/Impala,cgvarela/Impala,brightchen/Impala,mapr/impala,caseyching/Impala,rampage644/impala-cut,mapr/impala,caseyching/Impala,rampage644/impala-cut,lirui-intel/Impala,mapr/impala,ibmsoe/ImpalaPPC,cchanning/Impala,gistic/PublicSpatialImpala,gerashegalov/Impala,lnliuxing/Impal...
b34634c0c9a8db389ed48b50ca4b2e4b92105f93
node/dictionary.py
node/dictionary.py
#!/usr/bin/env python from nodes import Node import json class Dictionary(Node): char = ".d" args = 0 results = 1 def __init__(self, word_ids:Node.IntList): if not hasattr(Dictionary, "word_list"): Dictionary.word_list = init_words() self.words = " ".join(Dictionary.wo...
#!/usr/bin/env python from nodes import Node import json class Dictionary(Node): char = ".d" args = 0 results = 1 def __init__(self, word_ids:Node.IntList): if not hasattr(Dictionary, "word_list"): Dictionary.word_list = init_words() self.words = " ".join(Dictionary.wo...
Add some exception handling for dict
Add some exception handling for dict
Python
mit
muddyfish/PYKE,muddyfish/PYKE
efe06967b4896c7d2d4c88fbda96a0504959594b
opps/core/admin.py
opps/core/admin.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib import admin class PublishableAdmin(admin.ModelAdmin): """ Overrides standard admin.ModelAdmin save_model method It sets user (author) based on data from requet. """ def save_model(self, request, obj, form, change): if getat...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib import admin class PublishableAdmin(admin.ModelAdmin): """ Overrides standard admin.ModelAdmin save_model method It sets user (author) based on data from requet. """ list_display = ['title', 'channel', 'date_available', 'published']...
Add basic attr on PublishableAdmin
Add basic attr on PublishableAdmin
Python
mit
williamroot/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,jeanmask/opps,opps/opps,opps/opps
eac54b3080c37d2530077f23b0c022ed818ca9a4
util/fixedpoint-qtcreator.py
util/fixedpoint-qtcreator.py
from dumper import * def qdump__FixedPoint(d, value): d.putNumChild(3) raw = [ value["v"]["s"][i].integer() for i in range( value["v"]["numWords"].integer() ) ] ss = value["v"]["storageSize"].integer() exp = [raw[i] * 2**(i * ss) for i in range(len(raw)) ] d.putValue(sum(exp) * 2**-value["fractiona...
from dumper import * def qdump__FixedPoint(d, value): d.putNumChild(3) raw = [ value["v"]["s"][i].integer() for i in range( value["v"]["numWords"].integer() ) ] ss = value["v"]["storageSize"].integer() exp = [raw[i] * 2**(i * ss) for i in range(len(raw)) ] if raw[-1] >= 2**(ss-1): exp += [ ...
Support negative numbers in qtcreator debugging
Support negative numbers in qtcreator debugging
Python
mit
Cat-Ion/FixedPoint,Cat-Ion/FixedPoint
218b0f9a42c8d3421f80a3b2b77c9f7f3334722d
test_publisher.py
test_publisher.py
import publisher test_pdf_filename = "test/test.pdf" test_css_filename = "test/test.css" test_md_filename = "test/test.md" test_html_filename = "test/test.html" test_md = "# Test heading\n\n- test item 1\n- test item 2" def from_html_file(): print publisher.md_to_html(publisher.from_file(test_md_filename)) def ...
import publisher test_pdf_filename = "test/test.pdf" test_css_filename = "test/test.css" test_md_filename = "test/test.md" test_html_filename = "test/test.html" test_sender = "cpg@yakko.cs.wmich.edu" test_recipient = "cpgillem@gmail.com" test_md = "# Test heading\n\n- test item 1\n- test item 2" def from_html_file()...
Add test case for HTML email messages.
Add test case for HTML email messages.
Python
mit
cpgillem/markdown_publisher,cpgillem/markdown_publisher
348c28bacececb787ab73c9716dc515d0fabbe4b
armstrong/hatband/widgets/visualsearch.py
armstrong/hatband/widgets/visualsearch.py
from django.forms import Widget from django.template.loader import render_to_string from ..utils import static_url class GenericKeyWidget(Widget): template = "admin/hatband/widgets/generickey.html" class Media: js = (static_url("visualsearch/dependencies.js"), static_url("visualsearch/...
from django.forms import Widget from django.template.loader import render_to_string from ..utils import static_url class GenericKeyWidget(Widget): template = "admin/hatband/widgets/generickey.html" class Media: js = (static_url("visualsearch/dependencies.js"), static_url("visualsearch/...
Clean up this code a bit (no functional change)
Clean up this code a bit (no functional change)
Python
apache-2.0
armstrong/armstrong.hatband,texastribune/armstrong.hatband,armstrong/armstrong.hatband,armstrong/armstrong.hatband,texastribune/armstrong.hatband,texastribune/armstrong.hatband
6b5c32960565775d8b94825087c503e58f5eed27
openslides/users/migrations/0003_group.py
openslides/users/migrations/0003_group.py
# Generated by Django 1.10.5 on 2017-01-11 21:45 from __future__ import unicode_literals import django.db.models.deletion from django.db import migrations, models import openslides.users.models import openslides.utils.models class Migration(migrations.Migration): dependencies = [ ('auth', '0008_alter_u...
# Generated by Django 1.10.5 on 2017-01-11 21:45 from __future__ import unicode_literals import django.db.models.deletion from django.db import migrations, models import openslides.users.models import openslides.utils.models def create_openslides_groups(apps, schema_editor): """ Creates the users.models.Gro...
Fix the migration of the groups.
Fix the migration of the groups. Fixes #2915
Python
mit
tsiegleauq/OpenSlides,normanjaeckel/OpenSlides,normanjaeckel/OpenSlides,ostcar/OpenSlides,emanuelschuetze/OpenSlides,boehlke/OpenSlides,ostcar/OpenSlides,tsiegleauq/OpenSlides,CatoTH/OpenSlides,emanuelschuetze/OpenSlides,FinnStutzenstein/OpenSlides,OpenSlides/OpenSlides,normanjaeckel/OpenSlides,boehlke/OpenSlides,jwinz...
8d7f3320a9d3fd3b7365cad7631835a0a46f374e
planner/signals.py
planner/signals.py
from django.db.models.signals import m2m_changed from django.dispatch import receiver from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from .models import Step @receiver(m2m_changed, sender=Step.passengers.through) def check_passengers(sender, **kwargs): s...
from django.db.models.signals import m2m_changed from django.dispatch import receiver from .models import Step @receiver(m2m_changed, sender=Step.passengers.through) def check_passengers(sender, **kwargs): step = kwargs['instance'] if kwargs['action'] == 'post_add': if step.passengers.count() >= step....
Make is_joinable automatic based of passenger number
Make is_joinable automatic based of passenger number
Python
mit
livingsilver94/getaride,livingsilver94/getaride,livingsilver94/getaride
2247162e277f8d09cc951442673d71cd0a8ece65
active_link/templatetags/active_link_tags.py
active_link/templatetags/active_link_tags.py
from django import VERSION as DJANGO_VERSION from django import template from django.conf import settings if DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] <= 9: from django.core.urlresolvers import reverse else: from django.urls import reverse register = template.Library() @register.simple_tag(takes_context=T...
from django import VERSION as DJANGO_VERSION from django import template from django.conf import settings if DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] <= 9: from django.core.urlresolvers import reverse else: from django.urls import reverse register = template.Library() @register.simple_tag(takes_context=T...
Add ability to reverse views with args and kwargs
Add ability to reverse views with args and kwargs
Python
bsd-3-clause
valerymelou/django-active-link
1bad824786204353ff4f5b955ae687f088f80837
employees/tests.py
employees/tests.py
from django.test import TestCase # Create your tests here.
from .models import Employee from .serializers import EmployeeSerializer, EmployeeAvatarSerializer, EmployeeListSerializer from categories.serializers import CategorySerializer from django.core.urlresolvers import reverse from django.core.paginator import Paginator from rest_framework import status from rest_framework....
Add draft testcases for employees views
Add draft testcases for employees views
Python
apache-2.0
belatrix/BackendAllStars
eac90ef4d470923bb823f99dc85984faac733f08
pysuru/services.py
pysuru/services.py
# coding: utf-8 import json from collections import namedtuple from pysuru.base import BaseAPI, ObjectMixin SERVICE_INSTANCE_ATTRS = ( 'name', 'description', 'type', 'plan', 'teamOwner', ) _ServiceInstance = namedtuple('ServiceInstance', SERVICE_INSTANCE_ATTRS) class ServiceInstance(_ServiceI...
# coding: utf-8 import json from collections import namedtuple from pysuru.base import BaseAPI, ObjectMixin SERVICE_INSTANCE_ATTRS = ( 'name', 'description', 'type', 'plan', ) _ServiceInstance = namedtuple('ServiceInstance', SERVICE_INSTANCE_ATTRS) class ServiceInstance(_ServiceInstance, ObjectMi...
Remove (currently) unused service instance field
Remove (currently) unused service instance field
Python
mit
rcmachado/pysuru
487897e4b515a4c514fa0c91dec80d981c3bb98b
tools/telemetry/telemetry/core/profile_types.py
tools/telemetry/telemetry/core/profile_types.py
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os PROFILE_TYPE_MAPPING = { 'typical_user': 'chrome/test/data/extensions/profiles/content_scripts1', 'power_user': 'chrome/test/data/extensio...
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os PROFILE_TYPE_MAPPING = { 'typical_user': 'chrome/test/data/extensions/profiles/content_scripts1', 'power_user': 'chrome/test/data/extensio...
Use correct profile for power_user.
[Telemetry] Use correct profile for power_user. TEST=None BUG=None NOTRY=True Review URL: https://chromiumcodereview.appspot.com/12775015 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@188294 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
patrickm/chromium.src,mohamed--abdel-maksoud/chromium.src,M4sse/chromium.src,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,krieger-od/nwjs_chromium.src,TheTypoMaster/chromium-crosswalk,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,dednal/chromium.src,chuan9/chromium-crosswalk,timo...
761e74feac34c198da75f17b6145b6ca37d7afed
tests/__init__.py
tests/__init__.py
import threading import time DEFAULT_SLEEP = 0.01 class CustomError(Exception): pass def defer(callback, *args, **kwargs): sleep = kwargs.pop('sleep', DEFAULT_SLEEP) expected_return = kwargs.pop('expected_return', None) call = kwargs.pop('call', True) def func(): time.sleep(sleep) ...
import threading import time DEFAULT_SLEEP = 0.01 class CustomError(Exception): pass def defer(callback, *args, **kwargs): sleep = kwargs.pop('sleep', DEFAULT_SLEEP) expected_return = kwargs.pop('expected_return', None) call = kwargs.pop('call', True) def func(): time.sleep(sleep) ...
Fix test case being unable to fail
Fix test case being unable to fail
Python
mit
FichteFoll/resumeback
d14a34bff8e0462ebc2b8da9bc021f9c6f8f432d
libclang_samples/kernel-sigs.py
libclang_samples/kernel-sigs.py
import pprint import sys import clang.cindex from clang.cindex import CursorKind def handle_function_decl(fdecl_cursor): children = list(fdecl_cursor.get_children()) # Only interested in functions that have a CUDAGLOBAL_ATTR attached. if not any(c.kind == CursorKind.CUDAGLOBAL_ATTR for c in children): ...
import pprint import sys import clang.cindex from clang.cindex import CursorKind def handle_function_decl(fdecl_cursor): children = list(fdecl_cursor.get_children()) # Only interested in functions that have a CUDAGLOBAL_ATTR attached. if not any(c.kind == CursorKind.CUDAGLOBAL_ATTR for c in children): ...
Use walk_preorder instead of manual visiting
Use walk_preorder instead of manual visiting
Python
unlicense
eliben/llvm-clang-samples,eliben/llvm-clang-samples,eliben/llvm-clang-samples,eliben/llvm-clang-samples,eliben/llvm-clang-samples,eliben/llvm-clang-samples
dda9904a756e309047bebcbfecd2120383a257cc
django_countries/settings.py
django_countries/settings.py
from django.conf import settings def _build_flag_url(): if hasattr(settings, 'COUNTRIES_FLAG_URL'): url = settings.COUNTRIES_FLAG_URL else: url = 'flags/%(code)s.gif' prefix = getattr(settings, 'STATIC_URL', '') or settings.MEDIA_URL if not prefix.endswith('/'): prefix = '%s/' ...
from django.conf import settings def _build_flag_url(): if hasattr(settings, 'COUNTRIES_FLAG_URL'): url = settings.COUNTRIES_FLAG_URL else: url = 'flags/%(code)s.gif' prefix = getattr(settings, 'STATIC_URL', '') or \ getattr(settings, 'STATICFILES_URL', '') or \ settings.M...
Add django 1.3 staticfiles compatibility
Add django 1.3 staticfiles compatibility
Python
mit
degenhard/django-countries
4b65ab0fbc5839be9a49dd235549a13996a56108
tests/tabular_output/test_tabulate_adapter.py
tests/tabular_output/test_tabulate_adapter.py
# -*- coding: utf-8 -*- """Test the tabulate output adapter.""" from __future__ import unicode_literals from textwrap import dedent from cli_helpers.tabular_output import tabulate_adapter def test_tabulate_wrapper(): """Test the *output_formatter.tabulate_wrapper()* function.""" data = [['abc', 1], ['d', 45...
# -*- coding: utf-8 -*- """Test the tabulate output adapter.""" from __future__ import unicode_literals from textwrap import dedent from cli_helpers.tabular_output import tabulate_adapter def test_tabulate_wrapper(): """Test the *output_formatter.tabulate_wrapper()* function.""" data = [['abc', 1], ['d', 45...
Fix tabulate adapter test with numparse on.
Fix tabulate adapter test with numparse on.
Python
bsd-3-clause
dbcli/cli_helpers,dbcli/cli_helpers
d67099ce7d30e31b98251f7386b33caaa5199a01
censusreporter/config/prod/wsgi.py
censusreporter/config/prod/wsgi.py
import os from django.core.wsgi import get_wsgi_application import newrelic.agent newrelic.agent.initialize('/var/www-data/censusreporter/conf/newrelic.ini') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.prod.settings") application = get_wsgi_application()
import os from django.core.wsgi import get_wsgi_application import newrelic.agent newrelic.agent.initialize(os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../../conf/newrelic.ini')) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.prod.settings") application = get_wsgi_application()
Correct location of newrelic config
Correct location of newrelic config
Python
mit
sseguku/simplecensusug,Code4SA/censusreporter,Code4SA/censusreporter,Code4SA/censusreporter,sseguku/simplecensusug,4bic/censusreporter,sseguku/simplecensusug,4bic/censusreporter,Code4SA/censusreporter,4bic/censusreporter
f69e6555387d4cb6828baaac3ce1a17217577b48
faddsdata/format_definitions/__init__.py
faddsdata/format_definitions/__init__.py
from apt import APT_RECORDS, ATT_RECORDS, RWY_RECORDS, RMK_RECORDS, APT_RECORD_MAP from arb import ARB_RECORDS from awos import AWOS_RECORDS
from apt import APT_RECORDS, ATT_RECORDS, RWY_RECORDS, RMK_RECORDS, APT_RECORD_MAP from awos import AWOS_RECORDS
Remove import for lib not commited yet.
Remove import for lib not commited yet.
Python
bsd-3-clause
adamfast/faddsdata
5550217c028c422e7dc2d54c3b8b61ea43cfc26f
dosagelib/__pyinstaller/hook-dosagelib.py
dosagelib/__pyinstaller/hook-dosagelib.py
# SPDX-License-Identifier: MIT # Copyright (C) 2016-2020 Tobias Gruetzmacher from PyInstaller.utils.hooks import collect_submodules, copy_metadata hiddenimports = collect_submodules('dosagelib.plugins') datas = copy_metadata('dosage')
# SPDX-License-Identifier: MIT # Copyright (C) 2016-2022 Tobias Gruetzmacher from PyInstaller.utils.hooks import collect_data_files, collect_submodules, copy_metadata hiddenimports = collect_submodules('dosagelib.plugins') datas = copy_metadata('dosage') + collect_data_files('dosagelib')
Make sure data files are included
PyInstaller: Make sure data files are included
Python
mit
webcomics/dosage,webcomics/dosage
ae1a2b73d0c571c49726528f9b8730c9e02ce35f
tests/integration/test_webui.py
tests/integration/test_webui.py
import requests import pytest class TestWebUI(object): def get_page(self, page): return requests.get('http://nginx' + page) pages = [ { 'page': '/', 'matching_text': 'Diamond', }, { 'page': '/scoreboard', }, { 'pa...
import requests import pytest class TestWebUI(object): def get_page(self, page): return requests.get('https://nginx/{0}'.format(page), verify=False) pages = [ { 'page': '', 'matching_text': 'Diamond', }, { 'page': 'scoreboard', }, ...
Fix webui integration tests to use https
Fix webui integration tests to use https
Python
mit
pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine
afb8aadcc1dbea109c7882c1a1d65fc328372a74
resources/Dependencies/DecoraterBotCore/Core.py
resources/Dependencies/DecoraterBotCore/Core.py
# coding=utf-8 """ DecoraterBotCore ~~~~~~~~~~~~~~~~~~~ Core to DecoraterBot :copyright: (c) 2015-2018 AraHaan :license: MIT, see LICENSE for more details. """ from DecoraterBotUtils.utils import BaseClient, config __all__ = ['main', 'BotClient'] class BotClient(BaseClient): """ Bot Main client Class. ...
# coding=utf-8 """ DecoraterBotCore ~~~~~~~~~~~~~~~~~~~ Core to DecoraterBot :copyright: (c) 2015-2018 AraHaan :license: MIT, see LICENSE for more details. """ from DecoraterBotUtils.utils import BotClient, config __all__ = ['main'] def main(): """ EntryPoint to DecoraterBot. """ BotClient(comman...
Update to use new client class name on the DecoraterBotUtils.utils module.
Update to use new client class name on the DecoraterBotUtils.utils module.
Python
mit
DecoraterBot-devs/DecoraterBot
958426d43a5aa8e153e0999417377b54be67f04b
ctypeslib/experimental/byref_at.py
ctypeslib/experimental/byref_at.py
# hack a byref_at function from ctypes import * try: set except NameError: from sets import Set as set def _determine_layout(): result = set() for obj in (c_int(), c_longlong(), c_float(), c_double(), (c_int * 32)()): ref = byref(obj) result.add((c_void_p * 32).from_address(id(ref))[:...
from ctypes import * """ struct tagPyCArgObject { PyObject_HEAD ffi_type *pffi_type; char tag; union { char c; char b; short h; int i; long l; #ifdef HAVE_LONG_LONG PY_LONG_LONG q; #endif double d; float f; void *p; } value; PyObject *obj; int size; /* for the 'V' tag */ }; """ class value(Un...
Define the structure of PyCArgObject in ctypes.
Define the structure of PyCArgObject in ctypes. git-svn-id: ac2c3632cb6543e7ab5fafd132c7fe15057a1882@52772 6015fed2-1504-0410-9fe1-9d1591cc4771
Python
mit
trolldbois/ctypeslib,luzfcb/ctypeslib,luzfcb/ctypeslib,trolldbois/ctypeslib,trolldbois/ctypeslib,luzfcb/ctypeslib
db537ab80444b9e4cc22f332577c2cba640fca0a
tasks/factory_utils.py
tasks/factory_utils.py
from factory import enums from collections import namedtuple import gc # Factoryboy uses "__" and Salesforce uses "__". Luckily Factoryboy makes # theirs easy to override! enums.SPLITTER = "____" # More flexible than FactoryBoy's sequences because you can create and # destroy them where-ever you want. class Adde...
from factory import enums from collections import namedtuple import gc # Factoryboy uses "__" and Salesforce uses "__". Luckily Factoryboy makes # theirs easy to override! enums.SPLITTER = "____" # More flexible than FactoryBoy's sequences because you can create and # destroy them where-ever you want. class Adde...
Make it easy to get a single item.
Make it easy to get a single item.
Python
bsd-3-clause
SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus
180062c4d1159185ab113e98f41bb219d52086e8
test.py
test.py
from pyserializable import serialize, deserialize, autoserialized from pyserializable.util import repr_func @autoserialized class Color: serial_format = 'r=uint:8, g=uint:8, b=uint:8, a=uint:8' serial_attr_converters = {'r': [int, str]} __repr__ = repr_func('r', 'g', 'b', 'a') @autoserialized class Tile...
from pyserializable import serialize, deserialize, autoserialized from pyserializable.util import repr_func @autoserialized class Color(object): serial_format = 'r=uint:8, g=uint:8, b=uint:8, a=uint:8' serial_attr_converters = {'r': [int, str]} __repr__ = repr_func('r', 'g', 'b', 'a') @autoserialized cl...
Fix base class for python 2.x
Fix base class for python 2.x
Python
mit
numberoverzero/origami
42f67bdbf94a1a186518788f9685786b5c767eec
performance/web.py
performance/web.py
import requests from time import time class Client: def __init__(self, host, requests, do_requests_counter): self.host = host self.requests = requests self.counter = do_requests_counter class Request: GET = 'get' POST = 'post' def __init__(self, url, type=GET, data=None): ...
import requests from time import time class Client: def __init__(self, host, requests, do_requests_counter): self.host = host self.requests = requests self.counter = do_requests_counter class Request: GET = 'get' POST = 'post' def __init__(self, url, type=GET, data=None): ...
Update Request, only return response time
Update Request, only return response time Request: remove status_code and get_response_time() and only return the response time on do() function
Python
mit
BakeCode/performance-testing,BakeCode/performance-testing
24fa27e05e0ed58e955ed6365de101b2e9653a7b
cli.py
cli.py
#!/usr/bin/env python import sys,os from copy import deepcopy from scrabble import make_board,top_moves,read_dictionary def show_board(board,play=None): if not play: for row in board: print ''.join(row) else: b = deepcopy(board) for x,r,c in play: b[r][c] = x.lower() show_board(b) if _...
#!/usr/bin/env python import os from copy import deepcopy from optparse import OptionParser from scrabble import make_board,top_moves,read_dictionary def show_board(board, play=None): if not play: for row in board: print ''.join(row) else: b = deepcopy(board) for x,r,c in play: b[r][c] = x...
Use optparse instead of hand-rolled options
Use optparse instead of hand-rolled options
Python
mit
perimosocordiae/wwf,perimosocordiae/wwf
1bd540f43c25dec125085acee7bbe0904363c204
test.py
test.py
import unittest from enigma import Enigma, Steckerbrett, Umkehrwalze, Walzen class RotorTestCase(unittest.TestCase): def test_rotor_encoding(self): rotor = Walzen(wiring='EKMFLGDQVZNTOWYHXUSPAIBRCJ', notch='Q') self.assertEqual('E', rotor.encode('A')) def test_rotor_reverse_encoding(self): ...
import unittest from enigma import Enigma, Steckerbrett, Umkehrwalze, Walzen class RotorTestCase(unittest.TestCase): def test_rotor_encoding(self): rotor = Walzen(wiring='EKMFLGDQVZNTOWYHXUSPAIBRCJ', notch='Q') self.assertEqual('E', rotor.encode('A')) def test_rotor_reverse_encoding(self): ...
Test if rotor encodes with different setting properly
Test if rotor encodes with different setting properly
Python
mit
ranisalt/enigma
bb7de7e76302fbd3eeeeb740d00c234faadef4ef
tests/test_nonsensefilter.py
tests/test_nonsensefilter.py
from unittest import TestCase from spicedham.nonsensefilter import NonsenseFilter class TestNonsenseFilter(TestCase): # TODO: This test will likely fail spectacularly because of a lack of # training. def test_classify(self): nonsense = NonsenseFilter() nonsense.filter_match = 1 ...
from tests.test_classifierbase import TestClassifierBase from spicedham.backend import load_backend from spicedham.nonsensefilter import NonsenseFilter class TestNonsenseFilter(TestClassifierBase): def test_train(self): backend = load_backend() nonsense = NonsenseFilter() alphabet = map(c...
Add a base class and a test_train function
Add a base class and a test_train function Overall, fix a very incomplete test.
Python
mpl-2.0
mozilla/spicedham,mozilla/spicedham
4672e447617e754d6b4d229ce775fbf9ee0b35aa
tests/test_requesthandler.py
tests/test_requesthandler.py
from unittest import TestCase from ppp_datamodel.communication import Request from ppp_datamodel import Triple, Resource, Missing from ppp_libmodule.tests import PPPTestCase from ppp_spell_checker import app class RequestHandlerTest(PPPTestCase(app)): def testCorrectSentence(self): original = 'What is the...
from unittest import TestCase from ppp_datamodel.communication import Request from ppp_datamodel import Triple, Resource, Missing from ppp_libmodule.tests import PPPTestCase from ppp_spell_checker import app class RequestHandlerTest(PPPTestCase(app)): def testCorrectSentence(self): original = 'What is the...
Add test for irrelevant input.
Add test for irrelevant input.
Python
mit
ProjetPP/PPP-Spell-Checker,ProjetPP/PPP-Spell-Checker
978dd0161552458331870af0b524cdcff25fd71d
furious/handlers/__init__.py
furious/handlers/__init__.py
# # Copyright 2012 WebFilings, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
# # Copyright 2012 WebFilings, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
Adjust async run handler to use the JobContext manager.
Adjust async run handler to use the JobContext manager.
Python
apache-2.0
mattsanders-wf/furious,beaulyddon-wf/furious,Workiva/furious,andreleblanc-wf/furious,rosshendrickson-wf/furious,andreleblanc-wf/furious,beaulyddon-wf/furious,robertkluin/furious,rosshendrickson-wf/furious,Workiva/furious,mattsanders-wf/furious
713b91c4d7dc3737223bc70aa329ec9de2c48fb8
mycli/packages/special/utils.py
mycli/packages/special/utils.py
import os import subprocess def handle_cd_command(arg): """Handles a `cd` shell command by calling python's os.chdir.""" CD_CMD = 'cd' directory = '' error = False tokens = arg.split(CD_CMD + ' ') directory = tokens[-1] try: os.chdir(directory) subprocess.call(['pwd']) ...
import os import subprocess def handle_cd_command(arg): """Handles a `cd` shell command by calling python's os.chdir.""" CD_CMD = 'cd' tokens = arg.split(CD_CMD + ' ') directory = tokens[-1] if len(tokens) > 1 else None if not directory: return False, "No folder name was provided." try:...
Add validation for 'cd' command argument
Add validation for 'cd' command argument
Python
bsd-3-clause
mdsrosa/mycli,mdsrosa/mycli
75b1fdc9f290c85b4d469cdce5e5d1154aed4881
indra/tests/test_util.py
indra/tests/test_util.py
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str import xml.etree.ElementTree as ET from indra.util import UnicodeXMLTreeBuilder as UTB from indra.util import unicode_strs from io import BytesIO def test_unicode_tree_builder(): xml = u'<html><bar>asdf</bar></h...
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str import json import xml.etree.ElementTree as ET from indra.util import UnicodeXMLTreeBuilder as UTB, kappy_json_to_graph from indra.util import unicode_strs from io import BytesIO def test_unicode_tree_builder(): ...
Implement test for basic graph.
Implement test for basic graph.
Python
bsd-2-clause
pvtodorov/indra,johnbachman/indra,sorgerlab/belpy,pvtodorov/indra,sorgerlab/indra,sorgerlab/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,bgyori/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/belpy,johnbachman/belpy,bgyori/indra,johnbachman/indra
052367e1239e918cdcb9106b4494a48e34e92643
pychecker2/File.py
pychecker2/File.py
from pychecker2.util import type_filter from compiler import ast class File: def __init__(self, name): self.name = name self.parseTree = None self.scopes = {} self.root_scope = None self.warnings = [] def __cmp__(self, other): return cmp(self.name, other.name) ...
from pychecker2.util import parents from compiler import ast class File: def __init__(self, name): self.name = name self.parseTree = None self.scopes = {} self.root_scope = None self.warnings = [] def __cmp__(self, other): return cmp(self.name, other.name) ...
Add more ways to suck line numbers from nodes
Add more ways to suck line numbers from nodes
Python
bsd-3-clause
akaihola/PyChecker,thomasvs/pychecker,akaihola/PyChecker,thomasvs/pychecker
381bb4e11cf6951d819fa2cf298e2cc558464fc9
utils/nflc-get-categories.py
utils/nflc-get-categories.py
#!/usr/bin/env python3 import argparse import json from urllib.request import urlopen def get_data(domain): response = urlopen('http://{}/media/nflc-playlist-video.json'.format(domain)).read() return json.loads(response.decode('utf-8')) def main(): parser = argparse.ArgumentParser(description='Get the ...
#!/usr/bin/env python3 import argparse import json from urllib.request import urlopen def get_data(domain): response = urlopen('http://{}/media/nflc-playlist-video.json'.format(domain)).read() return json.loads(response.decode('utf-8')) def main(): parser = argparse.ArgumentParser(description='Get the ...
Simplify NFLC utils script stripping and sort categories case-insensitive
Simplify NFLC utils script stripping and sort categories case-insensitive
Python
mit
Tenzer/plugin.video.nfl-teams
a0c2e64c92d89276d73b5e4ca31e10a352ab37f1
analyser/api.py
analyser/api.py
import os import requests from flask import Blueprint from utils.decorators import validate, require from utils.validators import validate_url from .parser import Parser endpoint = Blueprint('analyse_url', __name__) @endpoint.route('analyse/', methods=['POST']) @require('url') @validate({ 'url': validate_url ...
import os import json import requests import rethinkdb as r from flask import Blueprint, current_app from utils.decorators import validate, require from utils.validators import validate_url from krunchr.vendors.rethinkdb import db from .parser import Parser from .tasks import get_file endpoint = Blueprint('analys...
Put job id in rethink db
Put job id in rethink db
Python
apache-2.0
vtemian/kruncher
de69c4048fe8533185a4eca6f98c7d74967618bf
opentreemap/opentreemap/util.py
opentreemap/opentreemap/util.py
from django.views.decorators.csrf import csrf_exempt import json def route(**kwargs): @csrf_exempt def routed(request, *args2, **kwargs2): method = request.method req_method = kwargs[method] return req_method(request, *args2, **kwargs2) return routed def json_from_request(request...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division import json from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse, HttpResponseRedirect, Http404 def route(**kwargs): @csrf_exempt def rou...
Return a 404, not a 500 on a verb mismatch
Return a 404, not a 500 on a verb mismatch Fixes #1101
Python
agpl-3.0
maurizi/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,RickMohr/otm-core,recklessromeo/otm-core,recklessromeo/otm-core,maurizi/otm-core,RickMohr/otm-core,RickMohr/otm-core,clever-crow-consulting/otm-core,RickMohr/otm-core,clever-cr...
ee33022db50a66b6e2db12972a2ed107276cc666
apps/common/tests/python/mediawords/key_value_store/test_cached_amazon_s3.py
apps/common/tests/python/mediawords/key_value_store/test_cached_amazon_s3.py
from mediawords.key_value_store.cached_amazon_s3 import CachedAmazonS3Store from .amazon_s3_credentials import ( TestAmazonS3CredentialsTestCase, get_test_s3_credentials, ) test_credentials = get_test_s3_credentials() class TestCachedAmazonS3StoreTestCase(TestAmazonS3CredentialsTestCase): def _initialize...
from mediawords.key_value_store.cached_amazon_s3 import CachedAmazonS3Store from mediawords.util.text import random_string from .amazon_s3_credentials import ( TestAmazonS3CredentialsTestCase, get_test_s3_credentials, ) test_credentials = get_test_s3_credentials() class TestCachedAmazonS3StoreTestCase(TestAm...
Append random string to S3 test directory name to be able to run parallel tests
Append random string to S3 test directory name to be able to run parallel tests
Python
agpl-3.0
berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud
94197717719b580aa9b8bf7a6cbe28f95000a2dc
gcouchbase/tests/test_api.py
gcouchbase/tests/test_api.py
from couchbase.tests.base import ApiImplementationMixin, SkipTest try: import gevent except ImportError as e: raise SkipTest(e) from gcouchbase.bucket import Bucket, GView from couchbase.tests.importer import get_configured_classes class GEventImplMixin(ApiImplementationMixin): factory = Bucket viewfa...
from couchbase.tests.base import ApiImplementationMixin, SkipTest try: import gevent except ImportError as e: raise SkipTest(e) from gcouchbase.bucket import Bucket, GView from couchbase.tests.importer import get_configured_classes class GEventImplMixin(ApiImplementationMixin): factory = Bucket viewfa...
Disable include_docs test for GCouchbase
Disable include_docs test for GCouchbase The gevent api cannot cleanly use include_docs here; previously we relied on the server to retrieve this, but the server no longer supports this. Perhaps in some future time we can implement this within libcouchbase itself, but until then, it's left unimplemented. Change-Id: I...
Python
apache-2.0
couchbase/couchbase-python-client,couchbase/couchbase-python-client,mnunberg/couchbase-python-client,mnunberg/couchbase-python-client
53780b6d16d631a3c0e8859ff9771a1379de16f1
calaccess_raw/admin/tracking.py
calaccess_raw/admin/tracking.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Custom administration panels for tracking models. """ from django.contrib import admin from calaccess_raw import models from .base import BaseAdmin @admin.register(models.RawDataVersion) class RawDataVersionAdmin(BaseAdmin): """ Custom admin for the RawDataVer...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Custom administration panels for tracking models. """ from django.contrib import admin from calaccess_raw import models from .base import BaseAdmin @admin.register(models.RawDataVersion) class RawDataVersionAdmin(BaseAdmin): """ Custom admin for the RawDataVer...
Cut dupe admin display fields
Cut dupe admin display fields
Python
mit
california-civic-data-coalition/django-calaccess-raw-data
7fc4e7382665cf9eac4d19efcf9641ad57271e87
organizer/models.py
organizer/models.py
from django.db import models # Model Field Reference # https://docs.djangoproject.com/en/1.8/ref/models/fields/ class Tag(models.Model): name = models.CharField( max_length=31, unique=True) slug = models.SlugField( max_length=31, unique=True, help_text='A label for URL config...
from django.db import models # Model Field Reference # https://docs.djangoproject.com/en/1.8/ref/models/fields/ class Tag(models.Model): name = models.CharField( max_length=31, unique=True) slug = models.SlugField( max_length=31, unique=True, help_text='A label for URL config...
Declare Meta class in Startup model.
Ch03: Declare Meta class in Startup model. [skip ci]
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
bcb4d14e7be413a08ca9c3f98656ff7b2bcb3d7d
test/test_wikilinks.py
test/test_wikilinks.py
from tiddlywebplugins.markdown import render from tiddlyweb.model.tiddler import Tiddler sample = """# Hello This is WikiLink * List * List """ sample_linked = """ This is WikiLink and this is not: [NotLink](http://example.com). This forthcoming in camel case but actually a link [label](http://example.org/Ca...
from tiddlywebplugins.markdown import render from tiddlyweb.model.tiddler import Tiddler sample = """# Hello This is WikiLink * List * List """ sample_linked = """ This is WikiLink and this is not: [NotLink](http://example.com). This forthcoming in camel case but actually a link [label](http://example.org/Ca...
Write forgotten test replace debugging output.
Write forgotten test replace debugging output.
Python
bsd-2-clause
tiddlyweb/tiddlywebplugins.markdown
8d50846847852741410463d98de2c4f9e5fea844
zaqar_ui/content/queues/urls.py
zaqar_ui/content/queues/urls.py
# Copyright 2015 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
# Copyright 2015 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
Update URLs to Django 1.8 style
Update URLs to Django 1.8 style django.conf.urls.patterns() is deprecated since 1.8. We should not use patterns(), so this patch updates URLs to 1.8 style. Change-Id: I6f2b6f44d843ca5e0cdb5db9828df94fa4df5f88 Closes-Bug: #1539354
Python
apache-2.0
openstack/zaqar-ui,openstack/zaqar-ui,openstack/zaqar-ui,openstack/zaqar-ui
1d2a62b87b98513bd84a0ae1433781157cb45f70
admin.py
admin.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib import admin from djurk.models import HIT class HIT_Admin(admin.ModelAdmin): list_display = ( 'creation_time', 'hit_id', 'hit_type_id', 'title', 'reward' ) list_filter = ( 'creation_time', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib import admin from djurk.models import HIT class HIT_Admin(admin.ModelAdmin): date_hierarchy = 'creation_time' fieldsets = ( (None, { 'fields': (('hit_id','hit_type_id'), ('creation_time', ...
Customize HIT Admin to "fit your brain"
Customize HIT Admin to "fit your brain"
Python
bsd-3-clause
glenjarvis/djurk
053bfa79b54a95d405d6401c86dcce3c6065bf32
appium/conftest.py
appium/conftest.py
import os import pytest from appium import webdriver @pytest.fixture(scope='function') def driver(request): return get_driver(request, default_capabilities()) @pytest.fixture(scope='function') def no_reset_driver(request): desired_caps = default_capabilities() desired_caps['noReset'] = True return g...
import os import pytest from appium import webdriver @pytest.fixture(scope='function') def driver(request): return get_driver(request, default_capabilities()) @pytest.fixture(scope='function') def no_reset_driver(request): desired_caps = default_capabilities() desired_caps['noReset'] = (runs_on_aws() ==...
Remove no reset for devicefarm
Remove no reset for devicefarm
Python
mit
getsentry/react-native-sentry,getsentry/react-native-sentry,getsentry/react-native-sentry,getsentry/react-native-sentry,getsentry/react-native-sentry,getsentry/react-native-sentry
8b8e206c21d08fee74fd43dc4b7e4d1d95a93060
sconsole/cmdbar.py
sconsole/cmdbar.py
''' Define the command bar ''' # Import third party libs import urwid class CommandBar(object): ''' The object to manage the command bar ''' def __init__(self, opts): self.opts = opts self.tgt_txt = urwid.Text('Target') self.tgt_edit = urwid.Edit() self.fun_txt = urwid....
''' Define the command bar ''' # Import third party libs import urwid # Import salt libs import salt.client class CommandBar(object): ''' The object to manage the command bar ''' def __init__(self, opts): self.opts = opts self.local = salt.client.LocalClient(mopts=opts) self.t...
Add functionality to the go button
Add functionality to the go button
Python
apache-2.0
saltstack/salt-console
f4170ec0cff71e8bcce834bbf8f4336410d45e76
klab/cluster/__init__.py
klab/cluster/__init__.py
#!/usr/bin/env python2 def is_this_chef(): from socket import gethostname return gethostname() == 'chef.compbio.ucsf.edu' def require_chef(): if not is_this_chef(): raise SystemExit("This script must be run on chef.") def require_qsub(): import os, subprocess try: command = 'qsub...
#!/usr/bin/env python2 def is_this_chef(): from socket import gethostname return gethostname() == 'chef.compbio.ucsf.edu' def require_chef(): if not is_this_chef(): raise SystemExit("This script must be run on chef.") def require_qsub(): import os, subprocess try: command = 'qsub...
Make require_qsub() crash if qsub isn't found.
Make require_qsub() crash if qsub isn't found.
Python
mit
Kortemme-Lab/klab,Kortemme-Lab/klab,Kortemme-Lab/klab,Kortemme-Lab/klab
0cc89fe31729a485a0e055b343acfde3d71745d7
apps/metricsmanager/api.py
apps/metricsmanager/api.py
from rest_framework.views import APIView from rest_framework.reverse import reverse from rest_framework.response import Response from rest_framework import generics, status from django.core.exceptions import ValidationError from .models import * from .serializers import * from .formula import validate_formula class Me...
from rest_framework.views import APIView from rest_framework.reverse import reverse from rest_framework.response import Response from rest_framework import generics, status from django.core.exceptions import ValidationError from .models import * from .serializers import * from .formula import validate_formula class Me...
Fix error format of check formula endpoint
Fix error format of check formula endpoint
Python
agpl-3.0
mmilaprat/policycompass-services,almey/policycompass-services,mmilaprat/policycompass-services,policycompass/policycompass-services,almey/policycompass-services,policycompass/policycompass-services,almey/policycompass-services,mmilaprat/policycompass-services,policycompass/policycompass-services
a8601d8a17c9ba8e87b8336870e0d52f79e0ffa2
indra/tests/test_omnipath.py
indra/tests/test_omnipath.py
from __future__ import unicode_literals from builtins import dict, str from indra.statements import Phosphorylation from indra.databases import omnipath as op def test_query_ptms(): stmts = op.get_ptms(['Q13873']) assert len(stmts) == 1 assert isinstance(stmts[0], Phosphorylation) assert stmts[0].enz.n...
import requests from indra.sources.omnipath import OmniPathModificationProcessor,\ OmniPathLiganReceptorProcessor from indra.sources.omnipath.api import op_url from indra.statements import Agent, Phosphorylation from indra.preassembler.grounding_mapper import GroundingMapper BRAF_UPID = 'P15056' JAK2_UPID = 'O6067...
Update imports, test general web api
Update imports, test general web api
Python
bsd-2-clause
johnbachman/indra,johnbachman/indra,johnbachman/belpy,johnbachman/indra,johnbachman/belpy,sorgerlab/belpy,sorgerlab/indra,sorgerlab/indra,bgyori/indra,johnbachman/belpy,bgyori/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/indra,sorgerlab/belpy
2083c0079a70783deff54a7acd6f3ef6bba25302
tests/test_pyglmnet.py
tests/test_pyglmnet.py
import numpy as np import scipy.sparse as sps from sklearn.preprocessing import StandardScaler from numpy.testing import assert_allclose from pyglmnet import GLM def test_glmnet(): """Test glmnet.""" glm = GLM(distr='poisson') scaler = StandardScaler() n_samples, n_features = 10000, 100 density ...
import numpy as np import scipy.sparse as sps from sklearn.preprocessing import StandardScaler from numpy.testing import assert_allclose from pyglmnet import GLM def test_glmnet(): """Test glmnet.""" glm = GLM(distr='poisson') scaler = StandardScaler() n_samples, n_features = 10000, 100 density ...
Fix glmnet test and add multinomial gradient test
Fix glmnet test and add multinomial gradient test
Python
mit
the872/pyglmnet,glm-tools/pyglmnet,pavanramkumar/pyglmnet
2296ef02345f51666ff6653abe372e7965ef361c
categories_i18n/admin.py
categories_i18n/admin.py
from django.contrib import admin from mptt.admin import MPTTModelAdmin from mptt.forms import MPTTAdminForm from parler.admin import TranslatableAdmin from .models import Category from parler.forms import TranslatableModelForm class CategoryAdminForm(MPTTAdminForm, TranslatableModelForm): """ Form for categor...
from django.contrib import admin from mptt.admin import MPTTModelAdmin from mptt.forms import MPTTAdminForm from parler.admin import TranslatableAdmin from .models import Category from parler.forms import TranslatableModelForm class CategoryAdminForm(MPTTAdminForm, TranslatableModelForm): """ Form for categor...
Set `mptt_indent_field` explicitly for proper MPTT list columns
Set `mptt_indent_field` explicitly for proper MPTT list columns
Python
apache-2.0
edoburu/django-categories-i18n,edoburu/django-categories-i18n
c0dc0c644fd8912d58deb416955e85259d22618e
tests/github_controller/test_request_parsing.py
tests/github_controller/test_request_parsing.py
import pytest from app.controllers.github_controller import GithubController pytestmark = pytest.mark.asyncio async def test_get_req_json(gh_sut: GithubController, mock_request): assert await gh_sut.get_request_json(mock_request) == 'json' async def test_get_req_event_header(gh_sut: GithubController, mock_req...
import pytest from app.controllers.github_controller import GithubController pytestmark = pytest.mark.asyncio async def test_get_req_json(gh_sut: GithubController, mock_request): assert await gh_sut.get_request_json(mock_request) == {'json': 'json'} async def test_get_req_event_header(gh_sut: GithubController...
Fix test in request parsing
Fix test in request parsing
Python
mit
futuresimple/triggear
8982d3f5ea40b688ec7e1da18403d89ab2994a95
comics/comics/yamac.py
comics/comics/yamac.py
from comics.aggregator.crawler import CrawlerBase from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "you and me and cats" language = "en" url = "http://strawberry-pie.net/SA/" start_date = "2009-07-01" rights = "bubble" active = False class Crawler(Crawl...
from comics.aggregator.crawler import CrawlerBase from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "you and me and cats" language = "en" url = "http://strawberry-pie.net/SA/" start_date = "2009-07-01" rights = "bubble" active = False class Crawler(Crawl...
Remove history capable date for "you and me and cats"
Remove history capable date for "you and me and cats"
Python
agpl-3.0
jodal/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,jodal/comics,datagutten/comics,datagutten/comics
26861b183085e8fe2c7c21f4e3631ddd7d30e5e8
csibe.py
csibe.py
#!/usr/bin/env python import os import subprocess import unittest csibe_path = os.path.dirname(os.path.realpath(__file__)) build_directory = "build" if not os.path.isdir(build_directory): os.makedirs(build_directory) os.chdir(build_directory) subprocess.call(["cmake", csibe_path])
#!/usr/bin/env python import argparse import os import subprocess import sys parser = argparse.ArgumentParser() parser.add_argument("-j", "--jobs", type=int, default=1, help="number of jobs for make") args = parser.parse_args() make_jobs = args.jobs csibe_path = os.path.dirname(os.path.realpath(__file__)) build_dir...
Add logic and error-handling for CMake and make invocations
Add logic and error-handling for CMake and make invocations
Python
bsd-3-clause
szeged/csibe,bgabor666/csibe,szeged/csibe,szeged/csibe,bgabor666/csibe,bgabor666/csibe,bgabor666/csibe,loki04/csibe,loki04/csibe,loki04/csibe,szeged/csibe,bgabor666/csibe,bgabor666/csibe,bgabor666/csibe,loki04/csibe,loki04/csibe,szeged/csibe,szeged/csibe,loki04/csibe,loki04/csibe,szeged/csibe
f87bab8a808e4bda3b3b7482633eaca069682b9e
build.py
build.py
# -*- coding: utf-8 -*- import sys from cx_Freeze import setup, Executable base = None if sys.platform == "win32": base = "Win32GUI" executables = [ Executable('blockcheck.py', base=base) ] setup(name='blockcheck', version='0.1', description='BlockCheck', executables=executables, opti...
# -*- coding: utf-8 -*- import sys from cx_Freeze import setup, Executable base = None if sys.platform == "win32": base = "Win32GUI" executables = [ Executable('blockcheck.py', base=base) ] setup(name='blockcheck', version='0.0.5', description='BlockCheck', executables=executables, op...
Include all the files from dns module and bump version
Include all the files from dns module and bump version
Python
mit
Acharvak/blockcheck,Renji/blockcheck,ValdikSS/blockcheck