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
caf90dce76e361531077840f570602a625c22ccb
argus/backends/base.py
argus/backends/base.py
import abc import six @six.add_metaclass(abc.ABCMeta) class BaseBackend(object): @abc.abstractmethod def setup_instance(self): """Called by setUpClass to setup an instance""" @abc.abstractmethod def cleanup(self): """Needs to cleanup the resources created in ``setup_instance``"""
# Copyright 2015 Cloudbase Solutions Srl # 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 r...
Add the license header where it's missing.
Add the license header where it's missing.
Python
apache-2.0
PCManticore/argus-ci,cmin764/argus-ci,AlexandruTudose/cloudbase-init-ci,micumatei/cloudbase-init-ci,stefan-caraiman/cloudbase-init-ci,cloudbase/cloudbase-init-ci
73d7377d0ba6c5ac768d547aaa957b48a6b1d46a
menu_generator/utils.py
menu_generator/utils.py
from importlib import import_module from django.apps import apps from django.core.exceptions import ImproperlyConfigured def get_callable(func_or_path): """ Receives a dotted path or a callable, Returns a callable or None """ if callable(func_or_path): return func_or_path module_name = '...
from importlib import import_module from django.apps import apps from django.core.exceptions import ImproperlyConfigured def get_callable(func_or_path): """ Receives a dotted path or a callable, Returns a callable or None """ if callable(func_or_path): return func_or_path module_name = '...
Fix exception message if app path is invalid
Fix exception message if app path is invalid
Python
mit
yamijuan/django-menu-generator
e73bb8cecf516f4379dd7d90282ef2412d348ac8
autotranslate/utils.py
autotranslate/utils.py
import six from autotranslate.compat import importlib from django.conf import settings def perform_import(val, setting_name): """ If the given setting is a string import notation, then perform the necessary import or imports. Credits: https://github.com/tomchristie/django-rest-framework/blob/master/r...
import six from autotranslate.compat import importlib from django.conf import settings def perform_import(val, setting_name): """ If the given setting is a string import notation, then perform the necessary import or imports. Credits: https://github.com/tomchristie/django-rest-framework/blob/master/r...
Make sure we don't expose translator as global
Make sure we don't expose translator as global
Python
mit
ankitpopli1891/django-autotranslate
79edc5861e37de0970d2af46ba45e07b47d30837
test/test_retriever.py
test/test_retriever.py
"""Tests for the EcoData Retriever""" from StringIO import StringIO from engine import Engine def test_escape_single_quotes(): """Test escaping of single quotes""" test_engine = Engine() assert test_engine.escape_single_quotes("1,2,3,'a'") == "1,2,3,\\'a\\'" def test_escape_double_quotes(): """Test e...
"""Tests for the EcoData Retriever""" from StringIO import StringIO from engine import Engine from table import Table def test_escape_single_quotes(): """Test escaping of single quotes""" test_engine = Engine() assert test_engine.escape_single_quotes("1,2,3,'a'") == "1,2,3,\\'a\\'" def test_escape_double...
Add tests of automated identification of the delimiter
Add tests of automated identification of the delimiter
Python
mit
bendmorris/retriever,embaldridge/retriever,davharris/retriever,goelakash/retriever,embaldridge/retriever,henrykironde/deletedret,davharris/retriever,bendmorris/retriever,davharris/retriever,bendmorris/retriever,embaldridge/retriever,goelakash/retriever,henrykironde/deletedret
719777a0b2e3eed4f14355974c6673d20904ac83
models/shopping_item.py
models/shopping_item.py
""" This is the sqlalchemy class for communicating with the shopping item table """ from sqlalchemy import Column, Integer, Unicode, ForeignKey import base class ShoppingItem(base.Base): """Sqlalchemy deals model""" __tablename__ = "shopping_item" catId = 'shopping_category.id' visitId = 'visits.id...
""" This is the sqlalchemy class for communicating with the shopping item table """ from sqlalchemy import Column, Integer, Unicode, ForeignKey import base class ShoppingItem(base.Base): """Sqlalchemy deals model""" __tablename__ = "shopping_item" catId = 'shopping_category.id' visitId = 'visits.id...
Add quantity to shopping item model
Add quantity to shopping item model
Python
mit
jlutz777/FreeStore,jlutz777/FreeStore,jlutz777/FreeStore
a52fe667125d9fd126b050cd32f694b9c3a97cdf
nlppln/save_ner_data.py
nlppln/save_ner_data.py
#!/usr/bin/env python import click import os import codecs import json import pandas as pd @click.command() @click.argument('input_files', nargs=-1, type=click.Path(exists=True)) @click.argument('output_file', nargs=1, type=click.Path()) def nerstats(input_files, output_file): output_dir = os.path.dirname(output_...
#!/usr/bin/env python import click import os import codecs import json import pandas as pd @click.command() @click.argument('input_files', nargs=-1, type=click.Path(exists=True)) @click.argument('output_file', nargs=1, type=click.Path()) def nerstats(input_files, output_file): output_dir = os.path.dirname(output_...
Update script to store the basename instead of the complete path
Update script to store the basename instead of the complete path
Python
apache-2.0
WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln
00fd5643e94cbe5543a22e804c050e979776ac6b
opps/flatpages/views.py
opps/flatpages/views.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.views.generic.detail import DetailView from django.contrib.sites.models import get_current_site from django import template from django.utils import timezone from .models import FlatPage class PageDetail(DetailView): model = FlatPage context_object_n...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.views.generic.detail import DetailView from django.contrib.sites.models import get_current_site from django.utils import timezone from .models import FlatPage class PageDetail(DetailView): model = FlatPage context_object_name = "context" type = '...
Fix template load on PageDetail flatpages app
Fix template load on PageDetail flatpages app
Python
mit
opps/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,opps/opps,williamroot/opps
9bd09a225a1899d8cd4f8565986f23a8c3b44131
api/migrations/0001_create_application.py
api/migrations/0001_create_application.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-26 20:29 from __future__ import unicode_literals from django.db import migrations from oauth2_provider.models import Application class Migration(migrations.Migration): def add_default_application(apps, schema_editor): Application.objects.cre...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-26 20:29 from __future__ import unicode_literals from django.db import migrations from oauth2_provider.models import Application class Migration(migrations.Migration): def add_default_application(apps, schema_editor): Application.objects.cre...
Include webpack-dev-server URL as a valid redirect
Include webpack-dev-server URL as a valid redirect
Python
bsd-3-clause
hotosm/osm-export-tool2,hotosm/osm-export-tool2,hotosm/osm-export-tool2,hotosm/osm-export-tool2
a6a646dec44b2eb613cac9c143cf6c7770f738e8
tests/test_metadata.py
tests/test_metadata.py
""" Tests for BSE metadata """ import os import hashlib import bse from bse import curate data_dir = bse.default_data_dir def test_get_metadata(): bse.get_metadata() def test_metadata_uptodate(): old_metadata = os.path.join(data_dir, 'METADATA.json') new_metadata = os.path.join(data_dir, 'METADATA.json...
""" Tests for BSE metadata """ import os import bse import json from bse import curate data_dir = bse.default_data_dir def test_get_metadata(): bse.get_metadata() def test_metadata_uptodate(): old_metadata = os.path.join(data_dir, 'METADATA.json') new_metadata = os.path.join(data_dir, 'METADATA.json.ne...
Fix testing of metadata - hashing is too strict
Fix testing of metadata - hashing is too strict
Python
bsd-3-clause
MOLSSI-BSE/basis_set_exchange
9aa48fa2a3a693c7cd5a74712b9a63ac15f32a94
tests/test_settings.py
tests/test_settings.py
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } SECRET_KEY = 'fake-key' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'csv_export', 'tests', ] MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMi...
import django DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } SECRET_KEY = 'fake-key' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'csv_export', 'tests', ] MIDDLEWARE = [ 'django.contrib.sessions.middl...
Fix tests on Django 1.8.
Fix tests on Django 1.8.
Python
bsd-3-clause
benkonrath/django-csv-export-view
b0c3ef9a162109aa654de28d15f47d103ddbbf58
fireplace/cards/brawl/gift_exchange.py
fireplace/cards/brawl/gift_exchange.py
""" Gift Exchange """ from ..utils import * # Hardpacked Snowballs class TB_GiftExchange_Snowball: play = Bounce(RANDOM_ENEMY_MINION) * 3 # Winter's Veil Gift class TB_GiftExchange_Treasure: deathrattle = Give(CURRENT_PLAYER, "TB_GiftExchange_Treasure_Spell") # Stolen Winter's Veil Gift class TB_GiftExchange_T...
""" Gift Exchange """ from ..utils import * # Hardpacked Snowballs class TB_GiftExchange_Snowball: play = Bounce(RANDOM_ENEMY_MINION) * 3 # Winter's Veil Gift class TB_GiftExchange_Treasure: deathrattle = Give(CURRENT_PLAYER, "TB_GiftExchange_Treasure_Spell") # Stolen Winter's Veil Gift class TB_GiftExchange_T...
Drop cost filtering from TB_GiftExchange_Treasure_Spell
Drop cost filtering from TB_GiftExchange_Treasure_Spell It doesn't work, and makes things harder than they need to be.
Python
agpl-3.0
Ragowit/fireplace,beheh/fireplace,smallnamespace/fireplace,NightKev/fireplace,smallnamespace/fireplace,Ragowit/fireplace,jleclanche/fireplace
b75e19bcc20f4b35a1712633fe941fdab1fd1029
test_classy/test_route_base.py
test_classy/test_route_base.py
from flask import Flask from .view_classes import BasicView, RouteBaseView from nose.tools import * app = Flask('route_base') BasicView.register(app, route_base="/rb_test/") BasicView.register(app) RouteBaseView.register(app, route_base="/rb_test2/") RouteBaseView.register(app) def test_registered_route_base(): ...
from flask import Flask from .view_classes import BasicView, RouteBaseView from nose.tools import * app = Flask('route_base') RouteBaseView.register(app, route_base="/rb_test2/") def test_route_base_override(): client = app.test_client() resp = client.get('/rb_test2/') eq_(b"Index", resp.data)
Remove some route_base tests that are no longer valid with Flask 0.10
Remove some route_base tests that are no longer valid with Flask 0.10
Python
bsd-3-clause
ei-grad/muffin-classy,apiguy/flask-classy,mapleoin/flask-classy,apiguy/flask-classy,apiguy/flask-classy,ei-grad/muffin-classy,teracyhq/flask-classy,hoatle/flask-classy,stas/flask-classy,teracyhq/flask-classy
81a0239812d01e9e876989d2334afe746e09f5da
chartflo/tests.py
chartflo/tests.py
from django.test import TestCase # Create your tests here.
from django.test import TestCase from .views import ChartsView # Create your tests here. class TestVegaLiteChartsView(TestCase): def setUpTestCase(self): self.chart_view = ChartsView() # Set Vega Lite as template engine self.chart_view.engine = "vegalite" def test_vega_lite_template(s...
Add Vega Lite template test
Add Vega Lite template test
Python
mit
synw/django-chartflo,synw/django-chartflo,synw/django-chartflo
68b5484cfb0910b3ed68e99520decc6aca08bb2d
flask_webapi/__init__.py
flask_webapi/__init__.py
# Make marshmallow's functions and classes importable from flask-io from marshmallow import pre_load, pre_dump, post_load, post_dump, Schema, ValidationError, validates_schema from marshmallow.utils import missing from .api import WebAPI from .decorators import authenticator, permissions, content_negotiator, renderer,...
# Make marshmallow's functions and classes importable from flask-io from marshmallow import pre_load, pre_dump, post_load, post_dump, Schema, ValidationError, validates_schema from marshmallow.utils import missing from .api import WebAPI from .errors import APIError from .decorators import authenticator, permissions, ...
Add import for APIError to make it easy to import by users
Add import for APIError to make it easy to import by users
Python
mit
viniciuschiele/flask-webapi
4c6f40f3d1394fff9ed9a4c6fe3ffd0ae5cb6230
jsondb/file_writer.py
jsondb/file_writer.py
from .compat import decode, encode def read_data(path): """ Reads a file and returns a json encoded representation of the file. """ db = open(path, "r+") content = db.read() obj = decode(content) db.close() return obj def write_data(path, obj): """ Writes to a file and retu...
from .compat import decode, encode def read_data(file_path): """ Reads a file and returns a json encoded representation of the file. """ if not is_valid(file_path): write_data(file_path, {}) db = open(file_path, "r+") content = db.read() obj = decode(content) db.close() ...
Create a new file if the path is invalid.
Create a new file if the path is invalid.
Python
bsd-3-clause
gunthercox/jsondb
0a4aceb87eae57188c5f61bb93d78d5cc9f1779f
lava_scheduler_app/templatetags/utils.py
lava_scheduler_app/templatetags/utils.py
from django import template from django.utils.safestring import mark_safe from lava_scheduler_app.models import TestJob register = template.Library() @register.filter def get_priority_select(current): select = "" val = TestJob.PRIORITY_CHOICES for priority, label in val: check = " checked" if pri...
from django import template from django.utils.safestring import mark_safe from lava_scheduler_app.models import TestJob register = template.Library() @register.filter def get_priority_select(current): select = "" val = TestJob.PRIORITY_CHOICES for priority, label in val: check = " checked" if pri...
Use inline radio buttons for priority changes.
Use inline radio buttons for priority changes. Change-Id: Ifb9a685bca654c5139aef3ca78e800b66ce77eb9
Python
agpl-3.0
Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server
c9e90de4730050e4ab41fc6b42a4a51018262db7
sergey/management/commands/fix_speaker_slugs.py
sergey/management/commands/fix_speaker_slugs.py
# coding: utf-8 from django.core.management import BaseCommand from django.template.defaultfilters import slugify from unidecode import unidecode from richard.videos.models import Speaker class Command(BaseCommand): help = 'Fixes speaker slugs' def handle(self, *args, **options): for speaker in Spe...
# coding: utf-8 from django.core.management import BaseCommand from django.template.defaultfilters import slugify from unidecode import unidecode from richard.videos.models import Speaker class Command(BaseCommand): help = 'Fixes speaker slugs' def handle(self, *args, **options): for speaker in Spe...
Fix management command for fixing slugs
Fix management command for fixing slugs
Python
bsd-3-clause
WarmongeR1/pyvideo.ru,coagulant/pyvideo.ru,coagulant/pyvideo.ru,WarmongeR1/pyvideo.ru,WarmongeR1/pyvideo.ru,coagulant/pyvideo.ru
9e73de0014b3f88b9e94ead11a878c6bc3819782
selenium_testcase/tests/test_navigation.py
selenium_testcase/tests/test_navigation.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from ..testcases import SeleniumLiveTestCase class NavigationTestCase(SeleniumLiveTestCase): test_templates = [ (r'^nav_1/$', 'nav_1.html'), (r'^nav_1/nav_2/$', 'nav_2.html') ] def test_get_page(self): """ Test tha...
# -*- coding: utf-8 -*- from __future__ import absolute_import from ..testcases import SeleniumLiveTestCase class NavigationTestCase(SeleniumLiveTestCase): test_templates = [ (r'^nav_1/$', 'nav_1.html'), (r'^nav_1/nav_2/$', 'nav_2.html') ] def test_get_page(self): """ Test tha...
Test missing content and failed navigation tests.
Test missing content and failed navigation tests. This commit adds unit tests outside of the happy path where a url does not exist or the test is looking for conten that doesn't exist on the page. Since testing for missing informaion requires timeouts to be sure, some of these tests take several seconds to execute.
Python
bsd-3-clause
nimbis/django-selenium-testcase,nimbis/django-selenium-testcase
1b27133a182204a44a8ee3cd73c832777fa3723b
tests/unit/test_metric_timer.py
tests/unit/test_metric_timer.py
""" Contains tests for the timer metric. """ from statsite.metrics import Timer class TestTimerMetric(object): def test_fold_sum(self): """ Tests that folding generates a sum of the timers. """ now = 10 metrics = [Timer("k", 10), Timer("k", 15), ...
""" Contains tests for the timer metric. """ from statsite.metrics import Timer class TestTimerMetric(object): def test_fold_sum(self): """ Tests that folding generates a sum of the timers. """ now = 10 metrics = [Timer("k", 10), Timer("k", 15), ...
Fix typo with expected metric
Fix typo with expected metric
Python
bsd-3-clause
kiip/statsite
5a1ad6a2fdd0586517899b3f2ec3d27a00a5d2b1
databroker/intake_xarray_core/__init__.py
databroker/intake_xarray_core/__init__.py
from ._version import get_versions __version__ = get_versions()['version'] del get_versions import intake # Import this first to avoid circular imports during discovery. from .netcdf import NetCDFSource from .opendap import OpenDapSource from .raster import RasterIOSource from .xzarr import ZarrSource from .xarray_co...
import intake # Import this first to avoid circular imports during discovery. from .xarray_container import RemoteXarray import intake.container intake.registry['remote-xarray'] = RemoteXarray intake.container.container_map['xarray'] = RemoteXarray
Remove imports of omitted modules.
Remove imports of omitted modules.
Python
bsd-3-clause
ericdill/databroker,ericdill/databroker
68c256ef51f0e622dcfc92cb63bf4b0503fb61a8
common/templatetags/lutris.py
common/templatetags/lutris.py
import copy from django import template from django.conf import settings from games import models register = template.Library() def get_links(user_agent): systems = ['ubuntu', 'fedora', 'linux'] downloads = copy.copy(settings.DOWNLOADS) main_download = None for system in systems: if system ...
import copy from django import template from django.conf import settings from games import models register = template.Library() def get_links(user_agent): systems = ['ubuntu', 'fedora', 'linux'] downloads = copy.copy(settings.DOWNLOADS) main_download = None for system in systems: if system ...
Make code compatible with no user agent
Make code compatible with no user agent
Python
agpl-3.0
lutris/website,Turupawn/website,Turupawn/website,lutris/website,lutris/website,Turupawn/website,Turupawn/website,lutris/website
ed542ea8979882e7cc245aee7e3c4a6cb6235a5f
HARK/tests/test_validators.py
HARK/tests/test_validators.py
import unittest, sys from HARK.validators import non_empty class ValidatorsTests(unittest.TestCase): ''' Tests for validator decorators which validate function arguments ''' def test_non_empty(self): @non_empty('list_a') def foo(list_a, list_b): pass try: ...
import unittest, sys from HARK.validators import non_empty class ValidatorsTests(unittest.TestCase): ''' Tests for validator decorators which validate function arguments ''' def test_non_empty(self): @non_empty('list_a') def foo(list_a, list_b): pass try: ...
Fix other tests with same regexp issue
Fix other tests with same regexp issue
Python
apache-2.0
econ-ark/HARK,econ-ark/HARK
7623966ac3962dfe871638b6804e056fa794ea60
api/webscripts/show_summary.py
api/webscripts/show_summary.py
from django import forms from webscript import WebScript from django.template.loader import render_to_string import amcat.scripts.forms import amcat.forms from amcat.tools import keywordsearch from amcat.scripts import script #from amcat.scripts.searchscripts.articlelist import ArticleListScript, ArticleListSpecific...
from webscript import WebScript from amcat.tools import keywordsearch from amcat.scripts.searchscripts.articlelist import ArticleListScript from amcat.scripts.forms import SelectionForm class ShowSummary(WebScript): name = "Summary" form_template = None form = None def run(self): se...
Clean user data before passing it to keywordsearch.get_total_n()
Clean user data before passing it to keywordsearch.get_total_n()
Python
agpl-3.0
amcat/amcat,tschmorleiz/amcat,tschmorleiz/amcat,tschmorleiz/amcat,amcat/amcat,amcat/amcat,tschmorleiz/amcat,amcat/amcat,tschmorleiz/amcat,amcat/amcat,amcat/amcat
b7fd2af25423847236b5d382aeb829b00c556485
alertaclient/auth/oidc.py
alertaclient/auth/oidc.py
import webbrowser from uuid import uuid4 from alertaclient.auth.token import TokenHandler def login(client, oidc_auth_url, client_id): xsrf_token = str(uuid4()) redirect_uri = 'http://127.0.0.1:9004' url = ( '{oidc_auth_url}?' 'response_type=code' '&client_id={client_id}' ...
import webbrowser from uuid import uuid4 from alertaclient.auth.token import TokenHandler def login(client, oidc_auth_url, client_id): xsrf_token = str(uuid4()) redirect_uri = 'http://localhost:9004' # azure only supports 'localhost' url = ( '{oidc_auth_url}?' 'response_type=code' ...
Use localhost instead of 127.0.0.1
Use localhost instead of 127.0.0.1
Python
apache-2.0
alerta/python-alerta,alerta/python-alerta-client,alerta/python-alerta-client
77beb7f5a1503481e28179f1ea84531e1ece99ed
test/test_urlification.py
test/test_urlification.py
from tiddlywebplugins.markdown import render from tiddlyweb.model.tiddler import Tiddler def test_urlification(): tiddler = Tiddler('blah') tiddler.text = """ lorem ipsum http://example.org dolor sit amet ... http://www.example.com/foo/bar ... """ environ = {'tiddlyweb.config...
from tiddlywebplugins.markdown import render from tiddlyweb.model.tiddler import Tiddler def test_urlification(): tiddler = Tiddler('blah') tiddler.text = """ lorem ipsum http://example.org dolor sit amet ... http://www.example.com/foo/bar ... """ environ = {'tiddlyweb.config': {'markdown.wiki_link_...
Make work with modern markdown2
Make work with modern markdown2 Within a pre block, links don't link, which is good.
Python
bsd-2-clause
tiddlyweb/tiddlywebplugins.markdown
2a6f0f7fbb655c568a42493e1181aeef9fa1ead1
test_setup.py
test_setup.py
"""Test setup.py.""" import os import subprocess import sys def test_setup(): """Run setup.py check.""" command = [sys.executable, 'setup.py', 'check', '--metadata', '--strict'] assert subprocess.run(command).returncode == 0 def test_console_scripts(): """Ensure console scripts were installed corr...
"""Test setup.py.""" import os import subprocess import sys def test_setup(): """Run setup.py check.""" command = [sys.executable, 'setup.py', 'check', '--metadata', '--strict'] assert subprocess.run(command).returncode == 0 def test_console_scripts(): """Ensure console scripts were installed corr...
Use $PATH instead of sys.path
Use $PATH instead of sys.path
Python
lgpl-2.1
dmtucker/backlog
a4507b7dcd5d2dfc1e56497040cfca6607b6de71
edpwd/random_string.py
edpwd/random_string.py
# -*- coding: utf-8 from random import choice import string def random_string(length, letters=True, digits=True, punctuation=False, whitespace=False): """ Returns a random string """ chars = '' if letters: chars += string.ascii_letters if digits: chars +...
# -*- coding: utf-8 import random, string def random_string(length, letters=True, digits=True, punctuation=False, whitespace=False): """ Returns a random string """ chars = '' if letters: chars += string.ascii_letters if digits: chars += string.digits ...
Use random.sample() rather than reinventing it.
Use random.sample() rather than reinventing it.
Python
bsd-2-clause
tampakrap/edpwd
166a78061059ad57189365d1cf56c81b513b7d9e
tests/test_ultrametric.py
tests/test_ultrametric.py
from viridis import tree from six.moves import range import pytest @pytest.fixture def base_tree(): t = tree.Ultrametric(list(range(6))) t.merge(0, 1, 0.1) # 6 t.merge(6, 2, 0.2) # 7 t.merge(3, 4, 0.3) # 8 t.merge(8, 5, 0.4) # 9 t.merge(7, 9, 0.5) # 10 return t def test_split(base_t...
from viridis import tree from six.moves import range import pytest @pytest.fixture def base_tree(): t = tree.Ultrametric(list(range(6))) t.merge(0, 1, 0.1) # 6 t.merge(6, 2, 0.2) # 7 t.merge(3, 4, 0.3) # 8 t.merge(8, 5, 0.4) # 9 t.merge(7, 9, 0.5) # 10 return t def test_split(base_t...
Add test for highest_ancestor function
Add test for highest_ancestor function
Python
mit
jni/viridis
3c95ba7e4eda0762d735503b718119e361eb7295
tests/basics/try-finally-return.py
tests/basics/try-finally-return.py
def func1(): try: return "it worked" finally: print("finally 1") print(func1())
def func1(): try: return "it worked" finally: print("finally 1") print(func1()) def func2(): try: return "it worked" finally: print("finally 2") def func3(): try: s = func2() return s + ", did this work?" finally: print("finally 3") pr...
Add additional testcase for finally/return.
Add additional testcase for finally/return.
Python
mit
heisewangluo/micropython,noahchense/micropython,henriknelson/micropython,alex-robbins/micropython,aethaniel/micropython,pramasoul/micropython,jlillest/micropython,noahwilliamsson/micropython,henriknelson/micropython,warner83/micropython,ruffy91/micropython,adafruit/circuitpython,mianos/micropython,dhylands/micropython,...
cf6034fc62cc97a5655b371fdef4a4728707fdea
changes/utils/locking.py
changes/utils/locking.py
from flask import current_app from functools import wraps from hashlib import md5 from changes.ext.redis import UnableToGetLock from changes.config import redis def lock(func): @wraps(func) def wrapped(**kwargs): key = '{0}:{1}'.format( func.__name__, md5( '&'....
from flask import current_app from functools import wraps from hashlib import md5 from changes.ext.redis import UnableToGetLock from changes.config import redis def lock(func): @wraps(func) def wrapped(**kwargs): key = '{0}:{1}:{2}'.format( func.__module__, func.__name__, ...
Use __module__ to make @lock unique
Use __module__ to make @lock unique Summary: Fixes T49428. Test Plan: Hard to test on changes_dev because it can't run both handlers (no place to send notifications to), but this seems simple enough... Reviewers: armooo, kylec Reviewed By: kylec Subscribers: changesbot, mkedia, jukka, vishal Maniphest Tasks: T494...
Python
apache-2.0
bowlofstew/changes,dropbox/changes,wfxiang08/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,bowlofstew/changes
2963909063e434936ba095ba9532782e7e3fd518
tests/QtDeclarative/qdeclarativeview_test.py
tests/QtDeclarative/qdeclarativeview_test.py
'''Test cases for QDeclarativeView''' import unittest from PySide.QtCore import QUrl, QStringList, QVariant from PySide.QtGui import QPushButton from PySide.QtDeclarative import QDeclarativeView from helper import adjust_filename, TimedQApplication class TestQDeclarativeView(TimedQApplication): def testQDecla...
'''Test cases for QDeclarativeView''' import unittest from PySide.QtCore import QUrl from PySide.QtDeclarative import QDeclarativeView from helper import adjust_filename, TimedQApplication class TestQDeclarativeView(TimedQApplication): def testQDeclarativeViewList(self): view = QDeclarativeView() ...
Remove use of deprecated types.
Remove use of deprecated types. Reviewer: Hugo Parente Lima <e250cbdf6b5a11059e9d944a6e5e9282be80d14c@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Python
lgpl-2.1
RobinD42/pyside,pankajp/pyside,RobinD42/pyside,BadSingleton/pyside2,IronManMark20/pyside2,M4rtinK/pyside-android,enthought/pyside,PySide/PySide,PySide/PySide,PySide/PySide,pankajp/pyside,PySide/PySide,M4rtinK/pyside-bb10,M4rtinK/pyside-android,M4rtinK/pyside-bb10,M4rtinK/pyside-bb10,RobinD42/pyside,IronManMark20/pyside...
164b860e4a44a22a1686cf6133fac6258fc97db6
nbgrader/tests/apps/test_nbgrader_fetch.py
nbgrader/tests/apps/test_nbgrader_fetch.py
from nbgrader.tests import run_command from nbgrader.tests.apps.base import BaseTestApp class TestNbGraderFetch(BaseTestApp): def test_help(self): """Does the help display without error?""" run_command("nbgrader fetch --help-all")
import os from nbgrader.tests import run_command from nbgrader.tests.apps.base import BaseTestApp class TestNbGraderFetch(BaseTestApp): def _fetch(self, assignment, exchange, flags="", retcode=0): run_command( 'nbgrader fetch abc101 {} ' '--TransferApp.exchange_directory={} ' ...
Add some basic tests for nbgrader fetch
Add some basic tests for nbgrader fetch
Python
bsd-3-clause
modulexcite/nbgrader,jupyter/nbgrader,MatKallada/nbgrader,alope107/nbgrader,modulexcite/nbgrader,dementrock/nbgrader,alope107/nbgrader,EdwardJKim/nbgrader,jhamrick/nbgrader,jhamrick/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,EdwardJKim/nbgrader,ellisonbg/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,EdwardJKim/nbgrader,...
2a0958455799601068db054c130fa9573e7c1e22
tensorflow/python/ops/parallel_for/__init__.py
tensorflow/python/ops/parallel_for/__init__.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Remove usage of remove_undocumented from core parallel_for.
Remove usage of remove_undocumented from core parallel_for. remove_undocumented is causing issues with our pip tests. remove_undocumented is not used anywhere else in core TF code and we have a new mechanism for annotating the public TF API.
Python
apache-2.0
chemelnucfin/tensorflow,ppwwyyxx/tensorflow,annarev/tensorflow,jhseu/tensorflow,alshedivat/tensorflow,kobejean/tensorflow,Bismarrck/tensorflow,chemelnucfin/tensorflow,davidzchen/tensorflow,Intel-tensorflow/tensorflow,aselle/tensorflow,kobejean/tensorflow,Bismarrck/tensorflow,girving/tensorflow,petewarden/tensorflow,hfp...
23343f0040f319f59991192636cadfd74af187af
oslo_concurrency/_i18n.py
oslo_concurrency/_i18n.py
# Copyright 2014 Mirantis Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
# Copyright 2014 Mirantis Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
Drop use of namespaced oslo.i18n
Drop use of namespaced oslo.i18n Related-blueprint: drop-namespace-packages Change-Id: Ic8247cb896ba6337932d7a74618debd698584fa0
Python
apache-2.0
varunarya10/oslo.concurrency,JioCloud/oslo.concurrency
447f19638c43cf273b6922796a203d33407bc29e
test/util.py
test/util.py
'''Helper code for theanets unit tests.''' import numpy as np class MNIST(object): NUM_DIGITS = 100 DIGIT_SIZE = 784 def setUp(self): # we just create some random "mnist digit" data of the right shape. np.random.seed(3) self.images = np.random.randn(NUM_DIGITS, DIGIT_SIZE).astype...
'''Helper code for theanets unit tests.''' import numpy as np class MNIST(object): NUM_DIGITS = 100 DIGIT_SIZE = 784 def setUp(self): # we just create some random "mnist digit" data of the right shape. np.random.seed(3) self.images = np.random.randn(MNIST.NUM_DIGITS, MNIST.DIGIT_...
Use proper namespace for constants.
Use proper namespace for constants.
Python
mit
chrinide/theanets,devdoer/theanets,lmjohns3/theanets
b595e1be84159c27b9d9bb81bbd66b78e5c084ce
pyoommf/small_example.py
pyoommf/small_example.py
from sim import Sim from mesh import Mesh from exchange import Exchange from demag import Demag from zeeman import Zeeman # Mesh specification. lx = ly = lz = 50e-9 # x, y, and z dimensions (m) dx = dy = dz = 5e-9 # x, y, and z cell dimensions (m) Ms = 8e5 # saturation magnetisation (A/m) A = 1e-11 # exchange ene...
from sim import Sim from mesh import Mesh from exchange import Exchange from demag import Demag from zeeman import Zeeman # Mesh specification. lx = ly = lz = 50e-9 # x, y, and z dimensions (m) dx = dy = dz = 5e-9 # x, y, and z cell dimensions (m) Ms = 8e5 # saturation magnetisation (A/m) A = 1e-11 # exchange ene...
Remove separate execute mif command.
Remove separate execute mif command.
Python
bsd-2-clause
ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python
345581aa5ba2fe3b0e4288f47489b668cebfc162
tests/cli/test_repair.py
tests/cli/test_repair.py
from vdirsyncer.cli.utils import repair_storage from vdirsyncer.storage.memory import MemoryStorage from vdirsyncer.utils.vobject import Item def test_repair_uids(): s = MemoryStorage() s.upload(Item(u'BEGIN:VCARD\nEND:VCARD')) repair_storage(s) uid, = [s.get(href)[0].uid for href, etag in s.list()]...
from textwrap import dedent from vdirsyncer.cli.utils import repair_storage from vdirsyncer.storage.memory import MemoryStorage from vdirsyncer.utils.vobject import Item def test_repair_uids(): s = MemoryStorage() s.upload(Item(u'BEGIN:VCARD\nEND:VCARD')) repair_storage(s) uid, = [s.get(href)[0].ui...
Add another test for full repair command
Add another test for full repair command
Python
mit
tribut/vdirsyncer,credativUK/vdirsyncer,untitaker/vdirsyncer,hobarrera/vdirsyncer,hobarrera/vdirsyncer,tribut/vdirsyncer,untitaker/vdirsyncer,credativUK/vdirsyncer,untitaker/vdirsyncer
142f14dd5cdf68d56216a44f4687f2f61d26a05a
erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
from __future__ import unicode_literals import frappe def execute(): if frappe.db.table_exists("Time Log"): timesheet = frappe.db.sql("""select tl.employee as employee, ts.name as name, tl.modified as modified, tl.modified_by as modified_by, tl.creation as creation, tl.owner as owner from `tabTimesheet`...
from __future__ import unicode_literals import frappe def execute(): if frappe.db.table_exists("Time Log") and "employee" in frappe.db.get_table_columns("Time Log"): timesheet = frappe.db.sql("""select tl.employee as employee, ts.name as name, tl.modified as modified, tl.modified_by as modified_by, tl.creation ...
Migrate employee field to timesheet only if it exists in time log
Migrate employee field to timesheet only if it exists in time log
Python
agpl-3.0
indictranstech/erpnext,njmube/erpnext,indictranstech/erpnext,indictranstech/erpnext,Aptitudetech/ERPNext,gsnbng/erpnext,indictranstech/erpnext,njmube/erpnext,geekroot/erpnext,gsnbng/erpnext,gsnbng/erpnext,geekroot/erpnext,njmube/erpnext,geekroot/erpnext,gsnbng/erpnext,njmube/erpnext,geekroot/erpnext
7ed12facca2f94eb8bba721e9b11882ea24726fe
crmapp/subscribers/views.py
crmapp/subscribers/views.py
from django.shortcuts import render from django.contrib.auth.models import User from django.http import HttpResponseRedirect from .forms import SubscriberForm def subscriber_new(request, template='subscribers/subscriber_new.html'): if request.method == 'POST': form = SubscriberForm(request.POST) i...
from django.shortcuts import render from django.contrib.auth.models import User from django.http import HttpResponseRedirect from .forms import SubscriberForm from .models import Subscriber def subscriber_new(request, template='subscribers/subscriber_new.html'): if request.method == 'POST': form = Subscri...
Create the Subscriber Form - Part II > Update the View
Create the Subscriber Form - Part II > Update the View
Python
mit
deenaariff/Django,tabdon/crmeasyapp,tabdon/crmeasyapp
2fedb73b2c83fc7bb1b354d8b1ebd8dfe8497995
dataportal/tests/test_examples.py
dataportal/tests/test_examples.py
import unittest from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document class CommonSampleDataTests(object): def setUp(self): pass def test_basic_usage(self): events = self.example.run...
from nose.tools import assert_true from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document def run_example(example): events = example.run() assert_true(isinstance(events, list)) assert_true(isinsta...
Use generator test for examples.
REF: Use generator test for examples.
Python
bsd-3-clause
ericdill/datamuxer,danielballan/datamuxer,NSLS-II/dataportal,tacaswell/dataportal,danielballan/dataportal,ericdill/databroker,NSLS-II/datamuxer,danielballan/datamuxer,NSLS-II/dataportal,danielballan/dataportal,ericdill/databroker,tacaswell/dataportal,ericdill/datamuxer
a997a84d2a3f1f485eeab24558a62aac15530999
src/sentry/runner/commands/repair.py
src/sentry/runner/commands/repair.py
""" sentry.runner.commands.repair ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import os import click from sentry.runner.decorators import configuration @cl...
""" sentry.runner.commands.repair ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import os import click from sentry.runner.decorators import configuration @cl...
Clarify error condition when failing to sync docs
Clarify error condition when failing to sync docs
Python
bsd-3-clause
mitsuhiko/sentry,daevaorn/sentry,jean/sentry,fotinakis/sentry,gencer/sentry,nicholasserra/sentry,daevaorn/sentry,looker/sentry,zenefits/sentry,nicholasserra/sentry,jean/sentry,looker/sentry,mvaled/sentry,JamesMura/sentry,zenefits/sentry,jean/sentry,mvaled/sentry,JackDanger/sentry,mvaled/sentry,zenefits/sentry,mvaled/se...
573878b5609fb6badae40e4a1bdef944b9d340dc
tools/telemetry/telemetry/core/platform/profiler/android_screen_recorder_profiler.py
tools/telemetry/telemetry/core/platform/profiler/android_screen_recorder_profiler.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import subprocess from telemetry.core import util from telemetry.core.backends.chrome import android_browser_finder from telemetry.core.platform i...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import subprocess from telemetry.core import util from telemetry.core.backends.chrome import android_browser_finder from telemetry.core.platform i...
Fix screen recording with multiple connected devices
telemetry: Fix screen recording with multiple connected devices Make it possible to use the Android screen recording profiler with multiple connected devices. Only the screen on the device that is actually running the telemetry test will get recorded. BUG=331435 TEST=tools/perf/run_benchmark smoothness.key_mobile_sit...
Python
bsd-3-clause
markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,ChromiumWebApps/chromium,patrickm/chromium.src,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,dushu1203/chromium.src,krieger-od/nwjs_chromium.src,Pluto-tv/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromi...
530d1d75872df47a1dbd90b2b6cfd5ebac0fe4c8
badgecheck/server/app.py
badgecheck/server/app.py
from flask import Flask, redirect, render_template, request import json import six from badgecheck.verifier import verify app = Flask(__name__) app.config['MAX_CONTENT_LENGTH'] = 4 * 1024 * 1024 # 4mb file upload limit @app.route("/") def home(): return render_template('index.html') @app.route("/results", m...
from flask import Flask, redirect, render_template, request import json import six from badgecheck.verifier import verify app = Flask(__name__) app.config['MAX_CONTENT_LENGTH'] = 4 * 1024 * 1024 # 4mb file upload limit def request_wants_json(): best = request.accept_mimetypes.best_match(['application/json', '...
Establish basic JSON API capability.
Establish basic JSON API capability.
Python
apache-2.0
concentricsky/badgecheck,openbadges/badgecheck,IMSGlobal/openbadges-validator-core,IMSGlobal/openbadges-validator-core,concentricsky/badgecheck,openbadges/badgecheck
5ae10de8c33b3388c0e593187be9fb62ac1f2c2c
django/setup.py
django/setup.py
import subprocess import sys import setup_util import os from os.path import expanduser home = expanduser("~") def start(args): setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'") setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu"...
import subprocess import sys import setup_util import os from os.path import expanduser home = expanduser("~") def start(args): setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'") setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu"...
Use more gunicorn threads when pooling database connector isn't available.
Use more gunicorn threads when pooling database connector isn't available. When using postgres with meinheld, the best you can do so far (as far as I know) is up the number of threads.
Python
bsd-3-clause
jetty-project/FrameworkBenchmarks,Eyepea/FrameworkBenchmarks,testn/FrameworkBenchmarks,k-r-g/FrameworkBenchmarks,PermeAgility/FrameworkBenchmarks,jeevatkm/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,saturday06/FrameworkBenchmarks,mfirry/FrameworkBenchmarks,grob/FrameworkBenchmarks...
3cbd840a96628282e8ab99c2dc2cf4e7e711fa82
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py
from django.contrib import messages from django.contrib.auth import get_user_model from django.contrib.auth.mixins import LoginRequiredMixin from django.urls import reverse from django.utils.translation import gettext_lazy as _ from django.views.generic import DetailView, RedirectView, UpdateView User = get_user_model...
from django.contrib import messages from django.contrib.auth import get_user_model from django.contrib.auth.mixins import LoginRequiredMixin from django.urls import reverse from django.utils.translation import gettext_lazy as _ from django.views.generic import DetailView, RedirectView, UpdateView User = get_user_model...
Use self.request.user instead of second query
Use self.request.user instead of second query
Python
bsd-3-clause
trungdong/cookiecutter-django,pydanny/cookiecutter-django,trungdong/cookiecutter-django,pydanny/cookiecutter-django,pydanny/cookiecutter-django,ryankanno/cookiecutter-django,pydanny/cookiecutter-django,ryankanno/cookiecutter-django,ryankanno/cookiecutter-django,ryankanno/cookiecutter-django,trungdong/cookiecutter-djang...
da71a95586f17de48cb1067a8809da1e583b42cf
other/wrapping-cpp/swig/cpointerproblem/test_examples.py
other/wrapping-cpp/swig/cpointerproblem/test_examples.py
""" The code this example is all based on is from http://tinyurl.com/pmmnbxv Some notes on this in the oommf-devnotes repo """ import os os.system('make all') import example1 def test_f(): assert example1.f(1) - 1 <= 10 ** -7 def test_myfun(): assert example1.myfun(example1.f, 2.0) - 4.0 <= 10 ** -7 os.sys...
""" The code this example is all based on is from http://tinyurl.com/pmmnbxv Some notes on this in the oommf-devnotes repo """ import os import pytest #print("pwd:") #os.system('pwd') #import subprocess #subprocess.check_output('pwd') os.system('make all') import example1 def test_f(): assert example1.f(1) -...
Add pytest.raises for test that fails on purpose.
Add pytest.raises for test that fails on purpose.
Python
bsd-2-clause
ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python
417196332246474b306e81c8d7d2f3a7a5065eb5
senic_hub/backend/subprocess_run.py
senic_hub/backend/subprocess_run.py
"""Provides `subprocess.run()` from Python 3.5+ if available. Otherwise falls back to `subprocess.check_output()`.""" try: from subprocess import run except ImportError: from collections import namedtuple from subprocess import check_output def run(args, *, stdin=None, input=None, stdout=None, stderr=...
"""Provides `subprocess.run()` from Python 3.5+ if available. Otherwise falls back to `subprocess.check_output()`.""" try: from subprocess import run except ImportError: from collections import namedtuple from subprocess import check_output, CalledProcessError def run(args, *, stdin=None, input=None, ...
Fix throwing error although check arg is false
Fix throwing error although check arg is false
Python
mit
grunskis/senic-hub,grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/senic-hub,grunskis/senic-hub,grunskis/senic-hub,grunskis/nuimo-hub-backend,getsenic/senic-hub,grunskis/nuimo-hub-backend,grunskis/nuimo-hub-backend,grunskis/senic-hub,getsenic/senic-hub,grunskis/nuimo-hub-backend
7350422a1364f996b7ac362e8457e2a5e04afc7c
sympy/interactive/tests/test_ipythonprinting.py
sympy/interactive/tests/test_ipythonprinting.py
"""Tests that the IPython printing module is properly loaded. """ from sympy.interactive.session import init_ipython_session from sympy.external import import_module ipython = import_module("IPython", min_module_version="0.11") # disable tests if ipython is not present if not ipython: disabled = True def test_i...
"""Tests that the IPython printing module is properly loaded. """ from sympy.interactive.session import init_ipython_session from sympy.external import import_module ipython = import_module("IPython", min_module_version="0.11") # disable tests if ipython is not present if not ipython: disabled = True def test_i...
Make ipythonprinting test more robust
Make ipythonprinting test more robust
Python
bsd-3-clause
Vishluck/sympy,Mitchkoens/sympy,Davidjohnwilson/sympy,pandeyadarsh/sympy,hrashk/sympy,Davidjohnwilson/sympy,sahmed95/sympy,yukoba/sympy,Sumith1896/sympy,jamesblunt/sympy,moble/sympy,chaffra/sympy,Mitchkoens/sympy,Shaswat27/sympy,saurabhjn76/sympy,abhiii5459/sympy,jerli/sympy,jaimahajan1997/sympy,ahhda/sympy,sunny94/tem...
a30fb24754fad371178207180bb064fcc5d5ca9d
patterns/factory.py
patterns/factory.py
""" Factory Pattern Definition: pass Also Known As: pass Problem: pass Wrong Solution: pass Correct Solution: pass Sources: Title: Head First Design Patterns Author(s): Eric Freeman & Elisabeth Freeman Pages: 109-168 Title: Design Patterns Author(s): Erich Gamma, Richard H...
""" Factory Pattern Definition: This pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. Also Known As: Virtual Constructor Problem: pass Wrong Solution: pass Correct Solut...
Add some info to Factory pattern
Add some info to Factory pattern
Python
mit
jdavis/rust-design-patterns,ianlet/rust-design-patterns,beni55/rust-design-patterns,ianlet/rust-design-patterns,jdavis/rust-design-patterns,beni55/rust-design-patterns,ianlet/rust-design-patterns,beni55/rust-design-patterns,jdavis/rust-design-patterns,jdavis/rust-design-patterns
e6d28d55309cdf7c25062d469646e0671e877607
nose2/tests/functional/support/scenario/tests_in_package/pkg1/test/test_things.py
nose2/tests/functional/support/scenario/tests_in_package/pkg1/test/test_things.py
import unittest class SomeTests(unittest.TestCase): def test_ok(self): pass def test_typeerr(self): raise TypeError("oops") def test_failed(self): print("Hello stdout") assert False, "I failed" def test_skippy(self): raise unittest.SkipTest("I wanted to skip"...
import unittest class SomeTests(unittest.TestCase): def test_ok(self): pass def test_typeerr(self): raise TypeError("oops") def test_failed(self): print("Hello stdout") assert False, "I failed" def test_skippy(self): raise unittest.SkipTest("I wanted to skip...
Add param test cases to func test target project
Add param test cases to func test target project
Python
bsd-2-clause
ojengwa/nose2,ezigman/nose2,ezigman/nose2,leth/nose2,leth/nose2,little-dude/nose2,ptthiem/nose2,ptthiem/nose2,little-dude/nose2,ojengwa/nose2
e4401ba44a5faea7efcd262fde1b5bf1085fbe30
wagtail/wagtailimages/utils.py
wagtail/wagtailimages/utils.py
import os from PIL import Image from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from django.conf import settings def validate_image_format(f): # Check file extension extension = os.path.splitext(f.name)[1].lower()[1:] if extension == 'jpg': ...
import os from PIL import Image from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ def validate_image_format(f): # Check file extension extension = os.path.splitext(f.name)[1].lower()[1:] if extension == 'jpg': extension = 'jpeg' if ...
Revert "Reopen images for validation if they are closed"
Revert "Reopen images for validation if they are closed" This reverts commit 7d43b1cf6eda74c86209a4cae0d71557ce9bdbc0.
Python
bsd-3-clause
benemery/wagtail,serzans/wagtail,davecranwell/wagtail,hamsterbacke23/wagtail,takeshineshiro/wagtail,mjec/wagtail,nealtodd/wagtail,kurtrwall/wagtail,gasman/wagtail,stevenewey/wagtail,WQuanfeng/wagtail,100Shapes/wagtail,chimeno/wagtail,nutztherookie/wagtail,wagtail/wagtail,chimeno/wagtail,iansprice/wagtail,rv816/wagtail,...
79d1ab43d187d8ba1350965673b930fa0b3879b6
rosbridge_suite/rosbridge_library/src/rosbridge_library/internal/pngcompression.py
rosbridge_suite/rosbridge_library/src/rosbridge_library/internal/pngcompression.py
from pypng.code import png from base64 import standard_b64encode, standard_b64decode from StringIO import StringIO def encode(string): """ PNG-compress the string, return the b64 encoded bytes """ bytes = list(bytearray(string)) png_image = png.from_array([bytes], 'L') buff = StringIO() png_image....
from pypng.code import png from PIL import Image from base64 import standard_b64encode, standard_b64decode from StringIO import StringIO def encode(string): """ PNG-compress the string, return the b64 encoded bytes """ i = Image.fromstring('L', (len(string), 1), string) buff = StringIO() i.save(buff, ...
Use python imaging library to encode PNG instead of pypng
Use python imaging library to encode PNG instead of pypng
Python
bsd-3-clause
WangRobo/rosbridge_suite,vladrotea/rosbridge_suite,kbendick/rosbridge_suite,vladrotea/rosbridge_suite,RobotWebTools/rosbridge_suite,DLu/rosbridge_suite,SNU-Sigma/rosbridge_suite,DLu/rosbridge_suite,DLu/rosbridge_suite,mayfieldrobotics/rosbridge_suite,mayfieldrobotics/rosbridge_suite,WangRobo/rosbridge_suite,SNU-Sigma/r...
68878c516c497103586cb4de38b371f02ab6bee2
oneflow/profiles/api.py
oneflow/profiles/api.py
# -*- coding: utf-8 -*- import logging from django.contrib.auth import get_user_model from tastypie.resources import ModelResource from tastypie import fields from ..base.api import common_authentication, UserObjectsOnlyAuthorization from .models import UserProfile LOGGER = logging.getLogger(__name__) User = get_u...
# -*- coding: utf-8 -*- import logging from django.contrib.auth import get_user_model from tastypie.resources import ModelResource from tastypie import fields from ..base.api import common_authentication, UserObjectsOnlyAuthorization from .models import UserProfile LOGGER = logging.getLogger(__name__) User = get_u...
Fix the `User` not being loaded client side.
Fix the `User` not being loaded client side.
Python
agpl-3.0
WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow
68273e1826ca19e508b616713093c37e4e18381c
test/geocoders/openmapquest.py
test/geocoders/openmapquest.py
from geopy.compat import u from geopy.geocoders import OpenMapQuest from test.geocoders.util import GeocoderTestBase class OpenMapQuestTestCase(GeocoderTestBase): # pylint: disable=R0904,C0111 @classmethod def setUpClass(cls): cls.geocoder = OpenMapQuest(scheme='http', timeout=3) cls.delta =...
from geopy.compat import u from geopy.geocoders import OpenMapQuest from test.geocoders.util import GeocoderTestBase, env import unittest @unittest.skipUnless( # pylint: disable=R0904,C0111 bool(env.get('OPENMAPQUEST_APIKEY')), "No OPENMAPQUEST_APIKEY env variable set" ) class OpenMapQuestTestCase(GeocoderT...
Make OpenMapQuest tests conditional on environment variable
Make OpenMapQuest tests conditional on environment variable
Python
mit
geopy/geopy,Vimos/geopy,mthh/geopy,magnushiie/geopy,Vimos/geopy,magnushiie/geopy,jmb/geopy,mthh/geopy
9877879c9a8d22a658f6c5f41b79930ff5385f05
plugins/parking.py
plugins/parking.py
from irc3.plugins.command import command from bytebot_config import BYTEBOT_PLUGIN_CONFIG from irc3 import asyncio import aiohttp import xml.etree.ElementTree as ET @command(permission="view") @asyncio.coroutine def parking(bot, mask, target, args): """Show the current parking lot status %%parking ...
from irc3.plugins.command import command from bytebot_config import BYTEBOT_PLUGIN_CONFIG from irc3 import asyncio import aiohttp import xml.etree.ElementTree as ET @command(permission="view") @asyncio.coroutine def parking(bot, mask, target, args): """Show the current parking lot status %%parking ...
Sort by name, fix vacancy (values in api are occupancy)
Sort by name, fix vacancy (values in api are occupancy)
Python
mit
mape2k/Bytebot,Bytespeicher/Bytebot
ea0f9f97f4a0a8338bed30724ab92a8acc4b6efa
tests/panels/test_cache.py
tests/panels/test_cache.py
# coding: utf-8 from __future__ import absolute_import, unicode_literals import django from django.core import cache from django.utils.unittest import skipIf from ..base import BaseTestCase class CachePanelTestCase(BaseTestCase): def setUp(self): super(CachePanelTestCase, self).setUp() self.pa...
# coding: utf-8 from __future__ import absolute_import, unicode_literals import django from django.core import cache from django.utils.unittest import skipIf from ..base import BaseTestCase class CachePanelTestCase(BaseTestCase): def setUp(self): super(CachePanelTestCase, self).setUp() self.pa...
Add a test that verifies the cache has a clear method.
Add a test that verifies the cache has a clear method.
Python
bsd-3-clause
peap/django-debug-toolbar,seperman/django-debug-toolbar,stored/django-debug-toolbar,megcunningham/django-debug-toolbar,calvinpy/django-debug-toolbar,spookylukey/django-debug-toolbar,guilhermetavares/django-debug-toolbar,megcunningham/django-debug-toolbar,tim-schilling/django-debug-toolbar,jazzband/django-debug-toolbar,...
e2b5df2501571b51e4a37ee5b7c7f16ededd5995
astm/constants.py
astm/constants.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # #: :mod:`astm.protocol` base encoding. ENCODING = 'latin-1' #: Message start token. STX = b'\x02' #: M...
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # #: ASTM specification base encoding. ENCODING = 'latin-1' #: Message start token. STX = b'\x02' #: Mes...
Fix description about global ENCODING.
Fix description about global ENCODING.
Python
bsd-3-clause
tectronics/python-astm,Iskander1b/python-astm,eddiep1101/python-astm,andrexmd/python-astm,pombreda/python-astm,kxepal/python-astm,LogicalKnight/python-astm,123412345/python-astm,tinoshot/python-astm,MarcosHaenisch/python-astm,Alwnikrotikz/python-astm,asingla87/python-astm,mhaulo/python-astm,AlanZatarain/python-astm,bri...
8f8caf50f51225964e09f25224bb2782bce479a1
src/sentry/receivers/users.py
src/sentry/receivers/users.py
from __future__ import absolute_import, print_function from django.db.models.signals import post_syncdb from sentry.models import User def create_first_user(app, created_models, verbosity, db, **kwargs): if User not in created_models: return if not kwargs.get('interactive', True): return ...
from __future__ import absolute_import, print_function from django.db import router from django.db.models.signals import post_syncdb from sentry.models import User def create_first_user(app, created_models, verbosity, db, **kwargs): if User not in created_models: return if not router.allow_syncdb(db...
Support multi-db for user creation signal
Support multi-db for user creation signal
Python
bsd-3-clause
BuildingLink/sentry,jean/sentry,beeftornado/sentry,BuildingLink/sentry,jean/sentry,nicholasserra/sentry,ifduyue/sentry,jean/sentry,JamesMura/sentry,ifduyue/sentry,looker/sentry,fotinakis/sentry,looker/sentry,fotinakis/sentry,JamesMura/sentry,mitsuhiko/sentry,gencer/sentry,beeftornado/sentry,nicholasserra/sentry,looker/...
e4e13c5be054707ea08cf18da36f5b01f745c818
mezzanine/twitter/__init__.py
mezzanine/twitter/__init__.py
""" Provides models and utilities for displaying different types of Twitter feeds. """ from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from mezzanine import __version__ # Constants/choices for the different query types. QUERY_TYPE_USER = "user" QUERY_TYPE_LIST = "lis...
""" Provides models and utilities for displaying different types of Twitter feeds. """ from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from mezzanine import __version__ # Constants/choices for the different query types. QUERY_TYPE_USER = "user" QUERY_TYPE_LIST = "lis...
Fix error raised when twitter lib is installed, but mezzanine.twitter is removed from INSTALLED_APPS.
Fix error raised when twitter lib is installed, but mezzanine.twitter is removed from INSTALLED_APPS.
Python
bsd-2-clause
damnfine/mezzanine,frankchin/mezzanine,mush42/mezzanine,promil23/mezzanine,ZeroXn/mezzanine,Kniyl/mezzanine,viaregio/mezzanine,damnfine/mezzanine,douglaskastle/mezzanine,nikolas/mezzanine,ZeroXn/mezzanine,readevalprint/mezzanine,promil23/mezzanine,Skytorn86/mezzanine,webounty/mezzanine,frankier/mezzanine,frankier/mezza...
76ae560be419ac350d79db08772d6b7f5722754b
python/sparktestingbase/test/simple_streaming_test.py
python/sparktestingbase/test/simple_streaming_test.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
Add a second trivial streaming test to make sure our re-useing the spark context is ok
Add a second trivial streaming test to make sure our re-useing the spark context is ok
Python
apache-2.0
holdenk/spark-testing-base,holdenk/spark-testing-base,ponkin/spark-testing-base,joychugh/spark-testing-base,MiguelPeralvo/spark-testing-base,snithish/spark-testing-base,samklr/spark-testing-base,ghl3/spark-testing-base,MiguelPeralvo/spark-testing-base,MiguelPeralvo/spark-testing-base,jnadler/spark-testing-base,eyeem/sp...
d2a25e14c9f09139f7d7279465afc34f321902c6
smartpy/__init__.py
smartpy/__init__.py
from .interfaces.model import Model from .interfaces.dataset import Dataset from .trainer import Trainer import tasks.tasks as tasks
from .interfaces.model import Model from .interfaces.dataset import Dataset from .trainer import Trainer from .tasks import tasks
Use relative import to import tasks
Use relative import to import tasks
Python
bsd-3-clause
MarcCote/smartlearner,SMART-Lab/smartlearner,SMART-Lab/smartpy,havaeimo/smartlearner,ASalvail/smartlearner
c603dc219d47ef255ef30447526e9c8dff82a5db
blues/python.py
blues/python.py
""" Python Blueprint ================ Does not install python itself, only develop and setup tools. Contains pip helper for other blueprints to use. **Fabric environment:** .. code-block:: yaml blueprints: - blues.python """ from fabric.decorators import task from refabric.api import run, info from refa...
""" Python Blueprint ================ Does not install python itself, only develop and setup tools. Contains pip helper for other blueprints to use. **Fabric environment:** .. code-block:: yaml blueprints: - blues.python """ from fabric.decorators import task from refabric.api import run, info from refa...
Make pip log world writable
Make pip log world writable
Python
mit
adisbladis/blues,jocke-l/blues,gelbander/blues,jocke-l/blues,Sportamore/blues,gelbander/blues,chrippa/blues,andreif/blues,gelbander/blues,5monkeys/blues,Sportamore/blues,chrippa/blues,adisbladis/blues,andreif/blues,adisbladis/blues,5monkeys/blues,jocke-l/blues,Sportamore/blues,andreif/blues,5monkeys/blues,chrippa/blues
2a343aa13fb000ffb56173e77207fe14c3bbe85c
mezzanine/accounts/models.py
mezzanine/accounts/models.py
from django.db import DatabaseError, connection from django.db.models.signals import post_save from mezzanine.accounts import get_profile_user_fieldname from mezzanine.conf import settings from mezzanine.utils.models import lazy_model_ops __all__ = () if getattr(settings, "AUTH_PROFILE_MODULE", None): # This w...
from django.db import DatabaseError, connection from django.db.models.signals import post_save from mezzanine.accounts import get_profile_user_fieldname, get_profile_for_user from mezzanine.conf import settings from mezzanine.utils.models import lazy_model_ops __all__ = () if getattr(settings, "AUTH_PROFILE_MODULE"...
Use get_profile_for_user() in profile signal handler
Use get_profile_for_user() in profile signal handler
Python
bsd-2-clause
joshcartme/mezzanine,vladir/mezzanine,industrydive/mezzanine,SoLoHiC/mezzanine,sjdines/mezzanine,dustinrb/mezzanine,spookylukey/mezzanine,damnfine/mezzanine,sjdines/mezzanine,frankchin/mezzanine,dsanders11/mezzanine,biomassives/mezzanine,frankchin/mezzanine,agepoly/mezzanine,wyzex/mezzanine,dsanders11/mezzanine,emile20...
a893223d4964f946d9413a17e62871e2660843a8
flexget/plugins/input_listdir.py
flexget/plugins/input_listdir.py
import logging from flexget.plugin import * log = logging.getLogger('listdir') class InputListdir: """ Uses local path content as an input. Example: listdir: /storage/movies/ """ def validator(self): from flexget import validator root = valid...
import logging from flexget.plugin import register_plugin log = logging.getLogger('listdir') class InputListdir: """ Uses local path content as an input. Example: listdir: /storage/movies/ """ def validator(self): from flexget import validator root = validator.f...
Fix url of entries made by listdir on Windows.
Fix url of entries made by listdir on Windows. git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1586 3942dd89-8c5d-46d7-aeed-044bccf3e60c
Python
mit
LynxyssCZ/Flexget,thalamus/Flexget,tvcsantos/Flexget,ibrahimkarahan/Flexget,patsissons/Flexget,oxc/Flexget,dsemi/Flexget,qvazzler/Flexget,poulpito/Flexget,crawln45/Flexget,Flexget/Flexget,ZefQ/Flexget,malkavi/Flexget,malkavi/Flexget,oxc/Flexget,JorisDeRieck/Flexget,crawln45/Flexget,sean797/Flexget,jawilson/Flexget,dsem...
ba84af2586e5d0cc70ffd95f8899d28659c36d9f
mopidy/frontends/mpd/__init__.py
mopidy/frontends/mpd/__init__.py
"""The MPD server frontend. MPD stands for Music Player Daemon. MPD is an independent project and server. Mopidy implements the MPD protocol, and is thus compatible with clients for the original MPD server. **Dependencies:** - None **Settings:** - :attr:`mopidy.settings.MPD_SERVER_HOSTNAME` - :attr:`mopidy.setting...
"""The MPD server frontend. MPD stands for Music Player Daemon. MPD is an independent project and server. Mopidy implements the MPD protocol, and is thus compatible with clients for the original MPD server. **Dependencies:** - None **Settings:** - :attr:`mopidy.settings.MPD_SERVER_HOSTNAME` - :attr:`mopidy.setting...
Add list of unsupported MPD features
mpd: Add list of unsupported MPD features
Python
apache-2.0
woutervanwijk/mopidy,rawdlite/mopidy,diandiankan/mopidy,ZenithDK/mopidy,dbrgn/mopidy,SuperStarPL/mopidy,diandiankan/mopidy,mokieyue/mopidy,dbrgn/mopidy,abarisain/mopidy,jmarsik/mopidy,pacificIT/mopidy,abarisain/mopidy,rawdlite/mopidy,vrs01/mopidy,swak/mopidy,liamw9534/mopidy,mokieyue/mopidy,kingosticks/mopidy,glogiotat...
03329897f8730702eee03114eeb4b529c5067b53
crmapp/urls.py
crmapp/urls.py
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() from marketing.views import HomePage urlpatterns = patterns('', # Marketing pages url(r'^$', HomePage.as_view(), name="home"), # Subscriber related URLs url(r'^signup/$', 'crmapp.subscr...
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() from marketing.views import HomePage from accounts.views import AccountList urlpatterns = patterns('', # Marketing pages url(r'^$', HomePage.as_view(), name="home"), # Subscriber related URLs u...
Create the Account List > List Accounts - Create URL
Create the Account List > List Accounts - Create URL
Python
mit
deenaariff/Django,tabdon/crmeasyapp,tabdon/crmeasyapp
0a1dbf4d891feda44b1fd45beb7bf59a5737f797
dataportal/__init__.py
dataportal/__init__.py
import sys import logging from .sources import * logger = logging.getLogger(__name__) __version__ = 'v0.0.5.post0'
import sys import logging from .sources import * logger = logging.getLogger(__name__) __version__ = 'v0.0.5.post0' from .broker import DataBroker from .muxer import DataMuxer
Make DataBroker and DataMuxer top-level.
API: Make DataBroker and DataMuxer top-level.
Python
bsd-3-clause
ericdill/databroker,danielballan/dataportal,ericdill/datamuxer,tacaswell/dataportal,NSLS-II/datamuxer,NSLS-II/dataportal,danielballan/datamuxer,danielballan/datamuxer,tacaswell/dataportal,danielballan/dataportal,ericdill/datamuxer,NSLS-II/dataportal,ericdill/databroker
3090f80fb75e28d76a2a9f5e25c507d095a695c8
middleware/python/test_auth_middleware.py
middleware/python/test_auth_middleware.py
from tyk.decorators import * from gateway import TykGateway as tyk @CustomKeyCheck def MyKeyCheck(request, session, metadata, spec): print("Running MyKeyCheck?") print("request:", request) print("session:", session) print("spec:", spec) valid_token = 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d' ...
from tyk.decorators import * from gateway import TykGateway as tyk @CustomKeyCheck def MyKeyCheck(request, session, metadata, spec): print("Running MyKeyCheck?") print("request:", request) print("session:", session) print("spec:", spec) valid_token = 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d' ...
Use float in session fields
Use float in session fields
Python
mpl-2.0
nebolsin/tyk,nebolsin/tyk,mvdan/tyk,lonelycode/tyk,mvdan/tyk,lonelycode/tyk,nebolsin/tyk,nebolsin/tyk,mvdan/tyk,mvdan/tyk,mvdan/tyk,mvdan/tyk,lonelycode/tyk,nebolsin/tyk,mvdan/tyk,nebolsin/tyk,nebolsin/tyk,nebolsin/tyk,mvdan/tyk
d921af5066fff0ec7b623bdd7f563b69152f27eb
filter_plugins/custom_plugins.py
filter_plugins/custom_plugins.py
# # Usage: {{ foo | vault }} # def vault(encrypted, env): method = """ from keyczar import keyczar import os.path import sys keydir = '.vault' if not os.path.isdir(keydir): keydir = os.path.expanduser('~/.decrypted_openconext_keystore_{env}') crypter = keyczar.Crypter.Read(keydir) sys.stdout.write(crypter.Decrypt(...
# # Usage: {{ foo | vault }} # def vault(encrypted, env): method = """ from keyczar import keyczar import os.path import sys keydir = '.vault' if not os.path.isdir(keydir): keydir = os.path.expanduser('~/.decrypted_openconext_keystore_{env}') crypter = keyczar.Crypter.Read(keydir) sys.stdout.write(crypter.Decrypt(...
Use Popen which is available on RHEL6, but do check exit code
Use Popen which is available on RHEL6, but do check exit code
Python
apache-2.0
OpenConext/OpenConext-deploy,remold/OpenConext-deploy,OpenConext/OpenConext-deploy,remold/OpenConext-deploy,baszoetekouw/OpenConext-deploy,baszoetekouw/OpenConext-deploy,baszoetekouw/OpenConext-deploy,baszoetekouw/OpenConext-deploy,OpenConext/OpenConext-deploy,OpenConext/OpenConext-deploy,baszoetekouw/OpenConext-deploy...
380a86134a62265eb944d717cad002bbc4197be4
cjdata/views.py
cjdata/views.py
from django.views.generic import DetailView, ListView from django.shortcuts import get_object_or_404 from cjdata.models import Dataset, Category from cjdata.search.query import sqs class DatasetDetailView(DetailView): model = Dataset slug_field = 'uuid' slug_url_kwarg = 'uuid' def get_context_data(se...
from django.views.generic import DetailView, ListView from django.shortcuts import get_object_or_404 from cjdata.models import Dataset, Category from cjdata.search.query import sqs class DatasetDetailView(DetailView): model = Dataset slug_field = 'uuid' slug_url_kwarg = 'uuid' def get_context_data(se...
Correct category lookup on url kwarg to use case insensitive.
Correct category lookup on url kwarg to use case insensitive.
Python
bsd-3-clause
dmc2015/hall-of-justice,dmc2015/hall-of-justice,dmc2015/hall-of-justice,sunlightlabs/hall-of-justice,sunlightlabs/hall-of-justice,sunlightlabs/hall-of-justice
c7621bd5c5e48c8d45ae70836b681b715348d0ba
modules/module_oraakkeli.py
modules/module_oraakkeli.py
import urllib def command_oraakkeli(bot, user, channel, args): """Asks a question from the oracle (http://www.lintukoto.net/viihde/oraakkeli/)""" if not args: return args = urllib.quote_plus(args) answer = getUrl("http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys=%s&html=0" % args).getCon...
import urllib def command_oraakkeli(bot, user, channel, args): """Asks a question from the oracle (http://www.lintukoto.net/viihde/oraakkeli/)""" if not args: return args = urllib.quote_plus(args) answer = getUrl("http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys=%s&html=0" % args).getCon...
Update oracle module for UTF-8
Update oracle module for UTF-8 git-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@99 dda364a1-ef19-0410-af65-756c83048fb2
Python
bsd-3-clause
EArmour/pyfibot,nigeljonez/newpyfibot,huqa/pyfibot,aapa/pyfibot,EArmour/pyfibot,rnyberg/pyfibot,rnyberg/pyfibot,lepinkainen/pyfibot,aapa/pyfibot,lepinkainen/pyfibot,huqa/pyfibot
7fa9fb24262c5ced8d09a2de34fd412cc5aa3758
private/realclearpolitics-scraper/realclearpolitics/spiders/spider.py
private/realclearpolitics-scraper/realclearpolitics/spiders/spider.py
import scrapy from realclearpolitics.items import TableItem class RcpSpider(scrapy.Spider): name = "realclearpoliticsSpider" start_urls = [] def __init__(self, url, state_code): self.url = url self.state_code = state_code def start_requests(self): return [scrapy.FormRequest(se...
import scrapy from realclearpolitics.items import TableItem class RcpSpider(scrapy.Spider): name = "realclearpoliticsSpider" start_urls = [] columns = ['Poll','Date', 'Sample', 'Spread'] def __init__(self, url, state_code): self.url = url self.state_code = state_code def start_req...
Put candidate score in field object
Put candidate score in field object
Python
mit
dpxxdp/berniemetrics,Rumel/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,fpagnoux/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,Rumel/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,Rumel/berniemetrics,Rumel/berniemetrics
41c6a71e2a9e013966df06e3b5f458aa9a902bc8
tests/test_core.py
tests/test_core.py
import pytest from mock import Mock from saleor.core.utils import ( Country, get_country_by_ip, get_currency_for_country) @pytest.mark.parametrize('ip_data, expected_country', [ ({'country': {'iso_code': 'PL'}}, Country('PL')), ({'country': {'iso_code': 'UNKNOWN'}}, None), (None, None), ({}, None...
import pytest from mock import Mock from saleor.core.utils import ( Country, get_country_by_ip, get_currency_for_country, create_superuser) from saleor.userprofile.models import User @pytest.mark.parametrize('ip_data, expected_country', [ ({'country': {'iso_code': 'PL'}}, Country('PL')), ({'country': {'i...
Add populatedb admin creation test
Add populatedb admin creation test
Python
bsd-3-clause
car3oon/saleor,mociepka/saleor,jreigel/saleor,mociepka/saleor,tfroehlich82/saleor,maferelo/saleor,itbabu/saleor,itbabu/saleor,HyperManTT/ECommerceSaleor,KenMutemi/saleor,UITools/saleor,tfroehlich82/saleor,KenMutemi/saleor,maferelo/saleor,maferelo/saleor,UITools/saleor,mociepka/saleor,jreigel/saleor,jreigel/saleor,UIToo...
c2592b39fde98ac8ba46c165deb4a1245954f3a1
tests/test_crawler.py
tests/test_crawler.py
import warnings import unittest from scrapy.crawler import Crawler from scrapy.settings import Settings from scrapy.utils.spider import DefaultSpider from scrapy.utils.misc import load_object class CrawlerTestCase(unittest.TestCase): def setUp(self): self.crawler = Crawler(DefaultSpider, Settings()) ...
import warnings import unittest from twisted.internet import defer from scrapy.crawler import Crawler, CrawlerRunner from scrapy.settings import Settings from scrapy.utils.spider import DefaultSpider from scrapy.utils.misc import load_object class CrawlerTestCase(unittest.TestCase): def setUp(self): se...
Test verifying that CrawlerRunner populates spider class settings
Test verifying that CrawlerRunner populates spider class settings
Python
bsd-3-clause
elijah513/scrapy,darkrho/scrapy-scrapy,hansenDise/scrapy,dracony/scrapy,eliasdorneles/scrapy,URXtech/scrapy,olorz/scrapy,dgillis/scrapy,nguyenhongson03/scrapy,crasker/scrapy,heamon7/scrapy,kimimj/scrapy,Djlavoy/scrapy,nikgr95/scrapy,Timeship/scrapy,eLRuLL/scrapy,jdemaeyer/scrapy,finfish/scrapy,github-account-because-th...
bd79e93b12f2d0563492a2c89813927d18c06ac1
tensorflow/python/tpu/__init__.py
tensorflow/python/tpu/__init__.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Initialize TPU_ML_PLATFORM env variable with `Tensorflow`.
Initialize TPU_ML_PLATFORM env variable with `Tensorflow`. PiperOrigin-RevId: 474832980
Python
apache-2.0
paolodedios/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/...
bb0e8faf73298d3b5ce78853b9a70cb8c34b9965
trace_viewer/trace_viewer_project.py
trace_viewer/trace_viewer_project.py
# Copyright (c) 2014 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 sys import os from tvcm import project as project_module class TraceViewerProject(project_module.Project): trace_viewer_path = os.path.abspat...
# Copyright (c) 2014 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 sys import os from tvcm import project as project_module class TraceViewerProject(project_module.Project): trace_viewer_path = os.path.abspat...
Allow other_paths to be passed into TraceViewerProject
Allow other_paths to be passed into TraceViewerProject This allows external embedders to subclass TraceViewerProject and thus use trace viewer.
Python
bsd-3-clause
catapult-project/catapult-csm,sahiljain/catapult,catapult-project/catapult-csm,sahiljain/catapult,catapult-project/catapult-csm,dstockwell/catapult,danbeam/catapult,catapult-project/catapult-csm,0x90sled/catapult,dstockwell/catapult,catapult-project/catapult,scottmcmaster/catapult,sahiljain/catapult,sahiljain/catapult,...
1d2dcd5a777119cbfb98274d73ee14c9190f1c24
tests/test_scraper.py
tests/test_scraper.py
# -*- coding: iso-8859-1 -*- # Copyright (C) 2013 Bastian Kleineidam from unittest import TestCase from dosagelib import scraper class ScraperTester(TestCase): """Test scraper module functions.""" def test_get_scraperclasses(self): for scraperclass in scraper.get_scraperclasses(): scraper...
# -*- coding: iso-8859-1 -*- # Copyright (C) 2013 Bastian Kleineidam from unittest import TestCase from dosagelib import scraper class ScraperTester(TestCase): """Test scraper module functions.""" def test_get_scraperclasses(self): for scraperclass in scraper.get_scraperclasses(): scraper...
Test for URL in every scraper.
Test for URL in every scraper.
Python
mit
peterjanes/dosage,webcomics/dosage,Freestila/dosage,mbrandis/dosage,blade2005/dosage,webcomics/dosage,peterjanes/dosage,mbrandis/dosage,Freestila/dosage,wummel/dosage,wummel/dosage,blade2005/dosage
9858c56188f4d6c81daf6535e7cd58ff23e20712
application/senic/nuimo_hub/tests/test_setup_wifi.py
application/senic/nuimo_hub/tests/test_setup_wifi.py
import pytest from mock import patch @pytest.fixture def url(route_url): return route_url('wifi_setup') def test_get_scanned_wifi(browser, url): assert browser.get_json(url).json == ['grandpausethisnetwork'] @pytest.fixture def no_such_wifi(settings): settings['wifi_networks_path'] = '/no/such/file' ...
import pytest from mock import patch @pytest.fixture def setup_url(route_url): return route_url('wifi_setup') def test_get_scanned_wifi(browser, setup_url): assert browser.get_json(setup_url).json == ['grandpausethisnetwork'] @pytest.fixture def no_such_wifi(settings): settings['wifi_networks_path'] =...
Make `url` fixture less generic
Make `url` fixture less generic in preparation for additional endpoints
Python
mit
grunskis/nuimo-hub-backend,grunskis/nuimo-hub-backend,getsenic/senic-hub,grunskis/senic-hub,grunskis/senic-hub,grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/senic-hub,getsenic/senic-hub,grunskis/senic-hub,grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/nuimo-hub-backend
08293b3c679e7079e80fcb1afc1f8b26570a6f2c
mrp_subcontracting/models/mrp_routing_workcenter.py
mrp_subcontracting/models/mrp_routing_workcenter.py
# -*- encoding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the...
# -*- encoding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the...
Allow to select any type of subcontracting product
[FIX] mrp_subcontracting: Allow to select any type of subcontracting product
Python
agpl-3.0
diagramsoftware/odoomrp-wip,agaldona/odoomrp-wip-1,raycarnes/odoomrp-wip,alhashash/odoomrp-wip,esthermm/odoomrp-wip,odoocn/odoomrp-wip,esthermm/odoomrp-wip,oihane/odoomrp-wip,factorlibre/odoomrp-wip,xpansa/odoomrp-wip,maljac/odoomrp-wip,diagramsoftware/odoomrp-wip,dvitme/odoomrp-wip,windedge/odoomrp-wip,odoomrp/odoomrp...
ee54f0ca3317b6f2119f15d42a7dd8d42d4f8059
standup/test_settings.py
standup/test_settings.py
from standup.settings import * DATABASE_URL = 'sqlite://'
from standup.settings import * # This looks wrong, but actually, it's an in-memory db uri # and it causes our tests to run super fast! DATABASE_URL = 'sqlite://'
Add comment of vital importance
Add comment of vital importance This bumps me up another shade of green! Yay!
Python
bsd-3-clause
safwanrahman/standup,rehandalal/standup,willkg/standup,rlr/standup,rehandalal/standup,rlr/standup,mozilla/standup,rlr/standup,safwanrahman/standup,mozilla/standup,willkg/standup,willkg/standup,safwanrahman/standup,willkg/standup,safwanrahman/standup,mozilla/standup,rehandalal/standup,mozilla/standup
11bad7dcf3fa4d9fdf40eee49505fa55dc0243e8
src/collectors/users/users.py
src/collectors/users/users.py
# coding=utf-8 """ Collects the number of users logged in and shells per user #### Dependencies * [pyutmp](http://software.clapper.org/pyutmp/) """ import diamond.collector from pyutmp import UtmpFile class UsersCollector(diamond.collector.Collector): def get_default_config_help(self): """ ...
# coding=utf-8 """ Collects the number of users logged in and shells per user #### Dependencies * [pyutmp](http://software.clapper.org/pyutmp/) """ import diamond.collector from pyutmp import UtmpFile class UsersCollector(diamond.collector.Collector): def get_default_config_help(self): """ ...
Add in a way to specify the utmp file path for unit testing
Add in a way to specify the utmp file path for unit testing
Python
mit
EzyInsights/Diamond,jumping/Diamond,acquia/Diamond,datafiniti/Diamond,thardie/Diamond,hvnsweeting/Diamond,thardie/Diamond,Basis/Diamond,saucelabs/Diamond,mfriedenhagen/Diamond,Ensighten/Diamond,ceph/Diamond,Slach/Diamond,h00dy/Diamond,ceph/Diamond,saucelabs/Diamond,Clever/Diamond,Netuitive/Diamond,sebbrandt87/Diamond,z...
704d92ae4a371681254704757a01ab3c57b6b92a
oscar/templatetags/currency_filters.py
oscar/templatetags/currency_filters.py
import locale from django import template from django.conf import settings register = template.Library() @register.filter(name='currency') def currency(value): """ Return value converted to a locale currency """ try: locale.setlocale(locale.LC_ALL, settings.LOCALE) except AttributeError:...
import locale from django import template from django.conf import settings register = template.Library() @register.filter(name='currency') def currency(value): """ Format decimal value as currency """ try: locale.setlocale(locale.LC_ALL, settings.LOCALE) except AttributeError: lo...
Enhance currency filter to allow format string to be specified
Enhance currency filter to allow format string to be specified This allows the positioning of the currency symbol to be controlled. Fixes #311
Python
bsd-3-clause
nfletton/django-oscar,Idematica/django-oscar,manevant/django-oscar,nickpack/django-oscar,WillisXChen/django-oscar,ahmetdaglarbas/e-commerce,jinnykoo/christmas,bnprk/django-oscar,makielab/django-oscar,monikasulik/django-oscar,eddiep1101/django-oscar,pdonadeo/django-oscar,jinnykoo/christmas,bnprk/django-oscar,josesanch/d...
ff9d6bc72673843fcdf6f7e0d866beec5bdb45f0
mezzanine/accounts/models.py
mezzanine/accounts/models.py
from django.db.models.signals import post_save from django.dispatch import receiver from mezzanine.utils.models import get_user_model from mezzanine.accounts import get_profile_model, get_profile_user_fieldname # Signal for ensuring users have a profile instance. Profile = get_profile_model() User = get_user_model()...
from django.db import connection from django.db.models.signals import post_save from django.db.utils import DatabaseError from django.dispatch import receiver from mezzanine.utils.models import get_user_model from mezzanine.accounts import get_profile_model, get_profile_user_fieldname # Signal for ensuring users ha...
Allow initial user creation in syncdb when a profile model is managed by migrations and doesn't yet exist.
Allow initial user creation in syncdb when a profile model is managed by migrations and doesn't yet exist.
Python
bsd-2-clause
jjz/mezzanine,cccs-web/mezzanine,stephenmcd/mezzanine,Kniyl/mezzanine,gradel/mezzanine,mush42/mezzanine,dekomote/mezzanine-modeltranslation-backport,eino-makitalo/mezzanine,dsanders11/mezzanine,cccs-web/mezzanine,christianwgd/mezzanine,scarcry/snm-mezzanine,theclanks/mezzanine,webounty/mezzanine,dovydas/mezzanine,nikol...
83b290b8d3da89d371ae88057472b838c5433471
cura/Settings/MaterialSettingsVisibilityHandler.py
cura/Settings/MaterialSettingsVisibilityHandler.py
# Copyright (c) 2017 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler class MaterialSettingsVisibilityHandler(SettingVisibilityHandler): def __init__(self, parent = None, *args, **kwargs): super()...
# Copyright (c) 2017 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. import UM.Settings.Models.SettingVisibilityHandler class MaterialSettingsVisibilityHandler(UM.Settings.Models.SettingVisibilityHandler.SettingVisibilityHandler): def __init__(self, parent = None, *args, **kwargs): ...
Use full import path for parent class
Use full import path for parent class Something seems off with the build for some reason. I'm trying to fix it this way.
Python
agpl-3.0
hmflash/Cura,ynotstartups/Wanhao,ynotstartups/Wanhao,hmflash/Cura,Curahelper/Cura,fieldOfView/Cura,fieldOfView/Cura,Curahelper/Cura
beb3882b89b41ca104dbb9f2fb97f609f45ce106
corehq/apps/users/decorators.py
corehq/apps/users/decorators.py
from django.http import HttpResponseForbidden from corehq.apps.domain.decorators import login_and_domain_required def require_permission(permission, data=None, login_decorator=login_and_domain_required): try: permission = permission.name except AttributeError: try: permission = perm...
from django.http import HttpResponseForbidden from corehq.apps.domain.decorators import login_and_domain_required def require_permission(permission, data=None, login_decorator=login_and_domain_required): try: permission = permission.name except AttributeError: try: permission = perm...
Apply login decorator before permissions check; less 403s, more 302s
Apply login decorator before permissions check; less 403s, more 302s
Python
bsd-3-clause
puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftwar...
07867356f110026a2249d49fe5e583c42fc2a048
tests/test_singleton.py
tests/test_singleton.py
import unittest from nose.tools import * import mock from gargoyle.settings import manager import gargoyle.models class TestGargoyle(unittest.TestCase): def test_gargoyle_global_is_a_switch_manager(self): reload(gargoyle.singleton) self.assertIsInstance(gargoyle.singleton.gargoyle, ...
import unittest from nose.tools import * import mock from gargoyle.settings import manager import gargoyle.models class TestGargoyle(unittest.TestCase): other_engine = dict() def test_gargoyle_global_is_a_switch_manager(self): reload(gargoyle.singleton) self.assertIsInstance(gargoyle.single...
Add another test to make sure you can import settings and change them before importing the singleton
Add another test to make sure you can import settings and change them before importing the singleton
Python
apache-2.0
kalail/gutter,disqus/gutter,kalail/gutter,kalail/gutter,disqus/gutter
4631a2192b24675f61f4eec5ab68e273ea47cca8
sklearn/svm/sparse/base.py
sklearn/svm/sparse/base.py
import numpy as np import scipy.sparse from abc import ABCMeta, abstractmethod from ..base import BaseLibSVM class SparseBaseLibSVM(BaseLibSVM): __metaclass__ = ABCMeta @abstractmethod def __init__(self, impl, kernel, degree, gamma, coef0, tol, C, nu, epsilon, shrinking, probability, ca...
import numpy as np import scipy.sparse from abc import ABCMeta, abstractmethod from ..base import BaseLibSVM class SparseBaseLibSVM(BaseLibSVM): __metaclass__ = ABCMeta @abstractmethod def __init__(self, impl, kernel, degree, gamma, coef0, tol, C, nu, epsilon, shrinking, probability, ca...
FIX sparse OneClassSVM was using the wrong parameter
FIX sparse OneClassSVM was using the wrong parameter
Python
bsd-3-clause
rishikksh20/scikit-learn,kmike/scikit-learn,JPFrancoia/scikit-learn,B3AU/waveTree,themrmax/scikit-learn,vybstat/scikit-learn,kaichogami/scikit-learn,IndraVikas/scikit-learn,walterreade/scikit-learn,tosolveit/scikit-learn,macks22/scikit-learn,AlexRobson/scikit-learn,heli522/scikit-learn,robbymeals/scikit-learn,xuewei4d/...
213708504447c8858ed3ba86324acaff98dbefdf
seahub/profile/models.py
seahub/profile/models.py
from django.db import models class Profile(models.Model): user = models.EmailField(unique=True) nickname = models.CharField(max_length=64, blank=True) intro = models.TextField(max_length=256, blank=True)
from django.db import models from django.core.cache import cache from django.dispatch import receiver from settings import EMAIL_ID_CACHE_PREFIX, EMAIL_ID_CACHE_TIMEOUT from registration.signals import user_registered class Profile(models.Model): user = models.EmailField(unique=True) nickname = models.CharFie...
Update email_id cache when user has registered
Update email_id cache when user has registered
Python
apache-2.0
madflow/seahub,cloudcopy/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,madflow/seahub,madflow/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub,madflow/seahub,madflow/seahub,Chilledheart/seahub,Chilledheart/seahub,miurahr/seahub
e1c5891650eaf3934a082e52934a1c4dd113fee7
doc/quickstart/testlibs/LoginLibrary.py
doc/quickstart/testlibs/LoginLibrary.py
import os import sys class LoginLibrary: def __init__(self): self._sut_path = os.path.join(os.path.dirname(__file__), '..', 'sut', 'login.py') self._status = '' def create_user(self, username, password): self._run_command('create', username, pass...
import os import sys import subprocess class LoginLibrary: def __init__(self): self._sut_path = os.path.join(os.path.dirname(__file__), '..', 'sut', 'login.py') self._status = '' def create_user(self, username, password): self._run_command('creat...
Use subprocess isntead of popen to get Jython working too
Use subprocess isntead of popen to get Jython working too
Python
apache-2.0
ChrisHirsch/robotframework,alexandrul-ci/robotframework,yonglehou/robotframework,JackNokia/robotframework,edbrannin/robotframework,jaloren/robotframework,un33k/robotframework,Colorfulstan/robotframework,kyle1986/robortframe,synsun/robotframework,userzimmermann/robotframework,userzimmermann/robotframework,un33k/robotfra...
48944ae9625cf36457b053508eff1e189c64f2c4
libraries/verification.py
libraries/verification.py
from django.contrib.sites.models import Site from django.core.mail import send_mail from okupy.libraries.encryption import random_string from okupy.libraries.exception import OkupyException, log_extra_data import logging logger = logging.getLogger('okupy') def sendConfirmationEmail(request, form, model): ''' ...
from django.contrib.sites.models import Site from django.core.mail import send_mail from okupy.libraries.encryption import random_string from okupy.libraries.exception import OkupyException, log_extra_data import logging logger = logging.getLogger('okupy') def sendConfirmationEmail(request, form, model): ''' ...
Fix bug in checkConfirmationKey, call the model directly instead of eval(arg)
Fix bug in checkConfirmationKey, call the model directly instead of eval(arg)
Python
agpl-3.0
gentoo/identity.gentoo.org,dastergon/identity.gentoo.org,dastergon/identity.gentoo.org,gentoo/identity.gentoo.org
abc46027b8af2d21debe8a23968b964ab6cb5c6b
CSP-Browser/CSPBrowser.py
CSP-Browser/CSPBrowser.py
#!/usr/bin/python from pyvirtualdisplay import Display from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import selenium.webdriver.support.ui as ui import re import atexit disp = Display(visible=0, size=(800,600)) atexit.regist...
#!/usr/bin/python from pyvirtualdisplay import Display from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import selenium.webdriver.support.ui as ui import re import atexit disp = Display(visible=0, size=(800,600)) atexit.regist...
Make Selenium shut down after it's done
Make Selenium shut down after it's done
Python
mit
reedox/CSPTools,Kennysan/CSPTools
29e8cf3a1ecd3ce24a1d4473f7817da6df815c77
salad/terrains/browser.py
salad/terrains/browser.py
from lettuce import before, world, after from splinter.browser import Browser from salad.logger import logger @before.all def setup_master_browser(): world.master_browser = setup_browser(world.drivers[0], world.remote_url) world.browser = world.master_browser def setup_browser(browser, url=None): logger...
from lettuce import before, world, after from splinter.browser import Browser from salad.logger import logger @before.all def setup_master_browser(): try: browser = world.drivers[0] remote_url = world.remote_url except AttributeError, IndexError: browser = 'firefox' remote_url ...
Make sure executing lettuce still results in something sane
Make sure executing lettuce still results in something sane
Python
bsd-3-clause
salad/salad,adw0rd/salad-py3,beanqueen/salad,adw0rd/salad-py3,beanqueen/salad,salad/salad
8803f6058255237dff39549426ca6a513a25193c
website_product_supplier/__openerp__.py
website_product_supplier/__openerp__.py
# -*- coding: utf-8 -*- # (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel # (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': "Website Product Supplier", 'category': 'Website', 'version': '8.0.1.0.0', 'depends': [ 'website...
# -*- coding: utf-8 -*- # (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel # (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': "Website Product Supplier", 'category': 'Website', 'version': '8.0.1.0.0', 'depends': [ 'website...
Add images key in manifest file
[FIX] website_product_supplier: Add images key in manifest file
Python
agpl-3.0
nuobit/website,open-synergy/website,gfcapalbo/website,LasLabs/website,acsone/website,nuobit/website,LasLabs/website,Yajo/website,LasLabs/website,gfcapalbo/website,kaerdsar/website,Yajo/website,nuobit/website,nuobit/website,Yajo/website,gfcapalbo/website,acsone/website,kaerdsar/website,LasLabs/website,open-synergy/websi...
2c6cb6b869726fbac859b5e3e1ab3d3a76d4908b
tools/telemetry/telemetry/page/page_test_results.py
tools/telemetry/telemetry/page/page_test_results.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 traceback import unittest class PageTestResults(unittest.TestResult): def __init__(self): super(PageTestResults, self).__init__() self....
# 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 traceback import unittest class PageTestResults(unittest.TestResult): def __init__(self): super(PageTestResults, self).__init__() self....
Add skipped and addSkip() to PageTestResults, for Python < 2.7.
[telemetry] Add skipped and addSkip() to PageTestResults, for Python < 2.7. Fixing bots after https://chromiumcodereview.appspot.com/15153003/ Also fix typo in addSuccess(). successes is only used by record_wpr, so that mistake had no effect on the bots. TBR=tonyg@chromium.org BUG=None. TEST=None. Review URL: https:...
Python
bsd-3-clause
ondra-novak/chromium.src,dushu1203/chromium.src,hgl888/chromium-crosswalk,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,Just-D/chromium-1,ondra-novak/chromium.src,hgl888/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,Chilledheart/chromium,patrickm/chromium.sr...
867c53c6457a24bc89f87cf2362d02d8542cf66e
books/views.py
books/views.py
from django.shortcuts import render from django.views.generic import TemplateView from rest_framework import viewsets, filters from books.models import Book, Category, SubCategory from books.serializers import BookSerializer, CategorySerializer, SubCategorySerializer class HomeTemplateView(TemplateView, ): templat...
from django.shortcuts import render from django.views.generic import TemplateView from rest_framework import viewsets, filters from books.models import Book, Category, SubCategory from books.serializers import BookSerializer, CategorySerializer, SubCategorySerializer class HomeTemplateView(TemplateView, ): templat...
Add category id filtering to subcategories
Add category id filtering to subcategories
Python
unlicense
spapas/react-tutorial,tbeg/react-tutorial,d0ntg0m0ng/react-tutorial-1,d0ntg0m0ng/react-tutorial-1,tbeg/react-tutorial,spapas/react-tutorial,d0ntg0m0ng/react-tutorial-1,spapas/react-tutorial,tbeg/react-tutorial,spapas/react-tutorial
9cb4cabe997590977b9002f731aa07734130d2d6
scikits/learn/glm/benchmarks/lars.py
scikits/learn/glm/benchmarks/lars.py
""" Benchmark for the LARS algorithm. Work in progress """ from datetime import datetime import numpy as np from scikits.learn import glm n, m = 100, 50000 X = np.random.randn(n, m) y = np.random.randn(n) print "Computing regularization path using the LARS ..." start = datetime.now() alphas, active, path = glm.lar...
""" Benchmark for the LARS algorithm. Work in progress """ from datetime import datetime import numpy as np from scikits.learn import glm n, m = 100, 50000 X = np.random.randn(n, m) y = np.random.randn(n) if __name__ == '__main__': print "Computing regularization path using the LARS ..." start = datetime.n...
Make sure computations do not get executed at import time, so that the tests still run.
BUG: Make sure computations do not get executed at import time, so that the tests still run.
Python
bsd-3-clause
hrjn/scikit-learn,arahuja/scikit-learn,hrjn/scikit-learn,glouppe/scikit-learn,betatim/scikit-learn,Titan-C/scikit-learn,rajat1994/scikit-learn,xavierwu/scikit-learn,amueller/scikit-learn,lucidfrontier45/scikit-learn,PrashntS/scikit-learn,raghavrv/scikit-learn,kylerbrown/scikit-learn,jzt5132/scikit-learn,ndingwall/sciki...
d3fd0d4f2220cee440f0af1a9ed3efd5cfd9444c
sale_exception_nostock_by_line/__init__.py
sale_exception_nostock_by_line/__init__.py
# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier # Copyright 2013 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pu...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Joel Grand-Guillaume # Copyright 2013 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # ...
Correct author (../trunk-generic/ rev 29.1.22)
[FIX] Correct author (../trunk-generic/ rev 29.1.22)
Python
agpl-3.0
jabibi/sale-workflow,anas-taji/sale-workflow,brain-tec/sale-workflow,alexsandrohaag/sale-workflow,richard-willowit/sale-workflow,kittiu/sale-workflow,BT-fgarbely/sale-workflow,jjscarafia/sale-workflow,Endika/sale-workflow,BT-jmichaud/sale-workflow,luistorresm/sale-workflow,fevxie/sale-workflow,adhoc-dev/sale-workflow,E...
c22fde851dc4e8f3c9c930e1f0151b677eeadb52
tensorflow/python/platform/remote_utils.py
tensorflow/python/platform/remote_utils.py
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Add `args` and `kwargs` to cloud-tpu version of `coordination_service_type()` function
Add `args` and `kwargs` to cloud-tpu version of `coordination_service_type()` function PiperOrigin-RevId: 470776162
Python
apache-2.0
tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,yongtang/tensorflow,tensorflow/tensor...
daa3504942e088fb6cd23eaccff78e613460f517
mezzanine/accounts/admin.py
mezzanine/accounts/admin.py
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from mezzanine.accounts.models import get_profile_model Profile = get_profile_model() class ProfileInline(admin.StackedInline): model = Profile can_delete = False template = "ad...
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from mezzanine.accounts.models import get_profile_model from mezzanine.core.admin import AdminProfileInline Profile = get_profile_model() class ProfileInline(admin.StackedInline): model...
Include AdminProfileInline so that it is not lost if the user enables Mezzanine accounts.
Include AdminProfileInline so that it is not lost if the user enables Mezzanine accounts. --HG-- branch : admin_site_permissions
Python
bsd-2-clause
spookylukey/mezzanine,christianwgd/mezzanine,molokov/mezzanine,frankier/mezzanine,SoLoHiC/mezzanine,ZeroXn/mezzanine,readevalprint/mezzanine,eino-makitalo/mezzanine,stbarnabas/mezzanine,theclanks/mezzanine,scarcry/snm-mezzanine,Cajoline/mezzanine,molokov/mezzanine,sjdines/mezzanine,joshcartme/mezzanine,frankchin/mezzan...
e46e512fad9bc92c1725711e2800e44bb699d281
deploy/mirrors/greasyfork.py
deploy/mirrors/greasyfork.py
from mechanize import Browser def exec_(config, summary, script): USERNAME = config['USERNAME'] PASSWORD = config['PASSWORD'] SCRIPT_ID = config['SCRIPT_ID'] LOGIN_URL = 'https://greasyfork.org/users/sign_in' EDIT_URL = 'https://greasyfork.org/scripts/{0}/versions/new'.format(SCRIPT_ID) b = ...
from mechanize import Browser def exec_(config, summary, script): USERNAME = config['USERNAME'] PASSWORD = config['PASSWORD'] SCRIPT_ID = config['SCRIPT_ID'] LOGIN_URL = 'https://greasyfork.org/users/sign_in' EDIT_URL = 'https://greasyfork.org/scripts/{0}/versions/new'.format(SCRIPT_ID) b = ...
Fix Greasy Fork deploy script.
Fix Greasy Fork deploy script.
Python
bsd-2-clause
MNBuyskih/adsbypasser,tablesmit/adsbypasser,xor10/adsbypasser,kehugter/adsbypasser,tosunkaya/adsbypasser,xor10/adsbypasser,MNBuyskih/adsbypasser,tablesmit/adsbypasser,kehugter/adsbypasser,kehugter/adsbypasser,tablesmit/adsbypasser,xor10/adsbypasser,tosunkaya/adsbypasser,MNBuyskih/adsbypasser,tosunkaya/adsbypasser