commit stringlengths 40 40 | old_file stringlengths 5 117 | new_file stringlengths 5 117 | old_contents stringlengths 0 1.93k | new_contents stringlengths 19 3.3k | subject stringlengths 17 320 | message stringlengths 18 3.28k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 7 42.4k | completion stringlengths 19 3.3k | prompt stringlengths 21 3.65k |
|---|---|---|---|---|---|---|---|---|---|---|---|
84ded02cba3caee164e848c1200e46b08011f93f | setup.py | setup.py | from setuptools import setup, find_packages
version = '1.0.17'
requires = [
'neo4j-driver<1.2.0',
'six>=1.10.0',
]
testing_requires = [
'nose',
'coverage',
'nosexcover',
]
setup(
name='norduniclient',
version=version,
url='https://github.com/NORDUnet/python-norduniclient',
licens... | from setuptools import setup, find_packages
version = '1.0.17'
requires = [
'neo4j-driver<1.5,0',
'six>=1.10.0',
]
testing_requires = [
'nose',
'coverage',
'nosexcover',
]
setup(
name='norduniclient',
version=version,
url='https://github.com/NORDUnet/python-norduniclient',
licens... | Update requirement neo4j-driver to <1.5.0 | Update requirement neo4j-driver to <1.5.0
| Python | apache-2.0 | NORDUnet/python-norduniclient,NORDUnet/python-norduniclient | from setuptools import setup, find_packages
version = '1.0.17'
requires = [
'neo4j-driver<1.5,0',
'six>=1.10.0',
]
testing_requires = [
'nose',
'coverage',
'nosexcover',
]
setup(
name='norduniclient',
version=version,
url='https://github.com/NORDUnet/python-norduniclient',
licens... | Update requirement neo4j-driver to <1.5.0
from setuptools import setup, find_packages
version = '1.0.17'
requires = [
'neo4j-driver<1.2.0',
'six>=1.10.0',
]
testing_requires = [
'nose',
'coverage',
'nosexcover',
]
setup(
name='norduniclient',
version=version,
url='https://github.com... |
4c8990d2e5a872da6083f2027e9c0d91e021bafd | samples/python/queue_create_alias.py | samples/python/queue_create_alias.py | '''
This sample will create a new alias queue.
MQWeb runs on localhost and is listening on port 8081.
'''
import sys
import json
import httplib
import socket
import argparse
parser = argparse.ArgumentParser(
description='MQWeb - Python sample - Create alias queue',
epilog="For more information: http://www.mqweb.or... | Add create alias queue sample | Add create alias queue sample
| Python | mit | fbraem/mqweb,fbraem/mqweb,fbraem/mqweb | '''
This sample will create a new alias queue.
MQWeb runs on localhost and is listening on port 8081.
'''
import sys
import json
import httplib
import socket
import argparse
parser = argparse.ArgumentParser(
description='MQWeb - Python sample - Create alias queue',
epilog="For more information: http://www.mqweb.or... | Add create alias queue sample
| |
a817afa1580aeb59fcbe837893c9ec8c5e7e0667 | anygit/clisetup.py | anygit/clisetup.py | import logging.config
import os
from paste.deploy import loadapp
import sys
DIR = os.path.abspath(os.path.dirname(__file__))
conf = os.path.join(DIR, '../conf/anygit.ini')
application = loadapp('config:%s' % conf, relative_to='/')
app = loadapp('config:%s' % conf,relative_to=os.getcwd())
logging.config.fileConfig(conf... | import logging.config
import os
from paste.deploy import loadapp
import sys
DIR = os.path.abspath(os.path.dirname(__file__))
conf = os.path.join(DIR, '../conf/anygit.ini')
logging.config.fileConfig(conf)
application = loadapp('config:%s' % conf, relative_to='/')
app = loadapp('config:%s' % conf,relative_to=os.getcwd()... | Load the logging config right away so it actually works | Load the logging config right away so it actually works
| Python | mit | ebroder/anygit,ebroder/anygit | import logging.config
import os
from paste.deploy import loadapp
import sys
DIR = os.path.abspath(os.path.dirname(__file__))
conf = os.path.join(DIR, '../conf/anygit.ini')
logging.config.fileConfig(conf)
application = loadapp('config:%s' % conf, relative_to='/')
app = loadapp('config:%s' % conf,relative_to=os.getcwd()... | Load the logging config right away so it actually works
import logging.config
import os
from paste.deploy import loadapp
import sys
DIR = os.path.abspath(os.path.dirname(__file__))
conf = os.path.join(DIR, '../conf/anygit.ini')
application = loadapp('config:%s' % conf, relative_to='/')
app = loadapp('config:%s' % con... |
9600746e27e8cd10cdb9ede05d1b341be903597f | gevent_tasks/utils.py | gevent_tasks/utils.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# >>
# gevent-tasks, 2017
# <<
import random
import string
ch_choices = string.ascii_letters + string.digits
def gen_uuid(length=4):
# type: (int) -> str
""" Generate a random ID of a given length. """
return ''.join(map(lambda c: random.choice(ch_choic... | Add simple uuid generator based on length and ASCII chars | Add simple uuid generator based on length and ASCII chars
| Python | mit | blakev/gevent-tasks | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# >>
# gevent-tasks, 2017
# <<
import random
import string
ch_choices = string.ascii_letters + string.digits
def gen_uuid(length=4):
# type: (int) -> str
""" Generate a random ID of a given length. """
return ''.join(map(lambda c: random.choice(ch_choic... | Add simple uuid generator based on length and ASCII chars
| |
6fd16f646712d3648b52c7b1c3ca3380e29d87fd | setup.py | setup.py | #!/usr/bin/python
from setuptools import setup
setup(name='libhxl',
version='2.7',
description='Python support for the Humanitarian Exchange Language (HXL).',
author='David Megginson',
author_email='contact@megginson.com',
url='http://hxlproject.org',
install_requires=['python-date... | #!/usr/bin/python
from setuptools import setup
setup(name='libhxl',
version='2.7.1',
description='Python support for the Humanitarian Exchange Language (HXL).',
author='David Megginson',
author_email='contact@megginson.com',
url='http://hxlproject.org',
install_requires=['python-da... | Make sure we install the csv file, still. | Make sure we install the csv file, still.
| Python | unlicense | HXLStandard/libhxl-python,HXLStandard/libhxl-python | #!/usr/bin/python
from setuptools import setup
setup(name='libhxl',
version='2.7.1',
description='Python support for the Humanitarian Exchange Language (HXL).',
author='David Megginson',
author_email='contact@megginson.com',
url='http://hxlproject.org',
install_requires=['python-da... | Make sure we install the csv file, still.
#!/usr/bin/python
from setuptools import setup
setup(name='libhxl',
version='2.7',
description='Python support for the Humanitarian Exchange Language (HXL).',
author='David Megginson',
author_email='contact@megginson.com',
url='http://hxlproject... |
b1b8c9b4e392d4865756ece6528e6668e2bc8975 | wafw00f/plugins/expressionengine.py | wafw00f/plugins/expressionengine.py | #!/usr/bin/env python
NAME = 'Expression Engine (EllisLab)'
def is_waf(self):
for attack in self.attacks:
r = attack(self)
if r is None:
return
response, page = r
# There are traces found where cookie is returning values like:
# Set-Cookie: exp_last_query=834y... | #!/usr/bin/env python
NAME = 'Expression Engine (EllisLab)'
def is_waf(self):
for attack in self.attacks:
r = attack(self)
if r is None:
return
response, page = r
# There are traces found where cookie is returning values like:
# Set-Cookie: exp_last_query=834y... | Fix to avoid NoneType bugs | Fix to avoid NoneType bugs
| Python | bsd-3-clause | EnableSecurity/wafw00f | #!/usr/bin/env python
NAME = 'Expression Engine (EllisLab)'
def is_waf(self):
for attack in self.attacks:
r = attack(self)
if r is None:
return
response, page = r
# There are traces found where cookie is returning values like:
# Set-Cookie: exp_last_query=834y... | Fix to avoid NoneType bugs
#!/usr/bin/env python
NAME = 'Expression Engine (EllisLab)'
def is_waf(self):
for attack in self.attacks:
r = attack(self)
if r is None:
return
response, page = r
# There are traces found where cookie is returning values like:
# Set... |
b435bc206bfa6dc6654c5a904363faedc856835d | tests/test_flask_get.py | tests/test_flask_get.py | import unittest
from flask import Flask
from flask.ext.autodoc import Autodoc
class TestAutodocWithFlask(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
self.autodoc = Autodoc(self.app)
@self.app.route('/')
@self.autodoc.doc()
def index():
"""R... | import unittest
from flask import Flask
from flask.ext.autodoc import Autodoc
class TestAutodocWithFlask(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
self.autodoc = Autodoc(self.app)
@self.app.route('/')
@self.autodoc.doc()
def index():
"""R... | Add a test for json retrieval. | Add a test for json retrieval.
| Python | mit | jwg4/flask-autodoc,jwg4/flask-autodoc | import unittest
from flask import Flask
from flask.ext.autodoc import Autodoc
class TestAutodocWithFlask(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
self.autodoc = Autodoc(self.app)
@self.app.route('/')
@self.autodoc.doc()
def index():
"""R... | Add a test for json retrieval.
import unittest
from flask import Flask
from flask.ext.autodoc import Autodoc
class TestAutodocWithFlask(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
self.autodoc = Autodoc(self.app)
@self.app.route('/')
@self.autodoc.doc()
... |
51029137cddaebeb3d84b7fa766c5e3914a02504 | multilingual_model/admin.py | multilingual_model/admin.py | import warnings
from django.contrib import admin
from .forms import TranslationFormSet
from . import settings
class TranslationStackedInline(admin.StackedInline):
def __init__(self, *args, **kwargs):
super(TranslationStackedInline, self).__init__(*args, **kwargs)
if settings.AUTO_HIDE_LANGUAGE:... | import warnings
from django.contrib import admin
from .forms import TranslationFormSet
from . import settings
class TranslationInlineMixin(object):
def __init__(self, *args, **kwargs):
super(TranslationInlineMixin, self).__init__(*args, **kwargs)
if settings.AUTO_HIDE_LANGUAGE:
self... | Use a Mixin for Admin inlines; less code duplication. | Use a Mixin for Admin inlines; less code duplication.
| Python | agpl-3.0 | dokterbob/django-multilingual-model | import warnings
from django.contrib import admin
from .forms import TranslationFormSet
from . import settings
class TranslationInlineMixin(object):
def __init__(self, *args, **kwargs):
super(TranslationInlineMixin, self).__init__(*args, **kwargs)
if settings.AUTO_HIDE_LANGUAGE:
self... | Use a Mixin for Admin inlines; less code duplication.
import warnings
from django.contrib import admin
from .forms import TranslationFormSet
from . import settings
class TranslationStackedInline(admin.StackedInline):
def __init__(self, *args, **kwargs):
super(TranslationStackedInline, self).__init__(*a... |
8befea283830f76dfa41cfd10d7eb916c68f7ef9 | intern/views.py | intern/views.py | # -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from filer.models import File
from filer.models import Folder
@login_required
def documents(request):
files = File.objects.all()
folders = Folder.objects.all()
#print(files[0])
return... | # -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from filer.models import File
from filer.models import Folder
@login_required
def documents(request):
files = File.objects.all().order_by("-modified_at")
folders = Folder.objects.all()
#p... | Sort files by last modification | Sort files by last modification
| Python | mit | n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb | # -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from filer.models import File
from filer.models import Folder
@login_required
def documents(request):
files = File.objects.all().order_by("-modified_at")
folders = Folder.objects.all()
#p... | Sort files by last modification
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from filer.models import File
from filer.models import Folder
@login_required
def documents(request):
files = File.objects.all()
folders = Folder.objects.all(... |
48dd9e5de783297a99278a347f20914a4e4053a8 | efs_cache_cleaner/cache_cleaner.py | efs_cache_cleaner/cache_cleaner.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import os
import time
import sys
def delete(path):
print(path)
try:
os.unlink(path)
except PermissionError as err:
print(f"Failed to delete {path}: {err}", file=sys.stderr)
def delete_directory_if_empty(path):
try:
os.rmdir(pa... | Remove old files and empty directories | Remove old files and empty directories
| Python | mit | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import os
import time
import sys
def delete(path):
print(path)
try:
os.unlink(path)
except PermissionError as err:
print(f"Failed to delete {path}: {err}", file=sys.stderr)
def delete_directory_if_empty(path):
try:
os.rmdir(pa... | Remove old files and empty directories
| |
0d8888ef1bfa056b9fd440b227a3e3d84b10d541 | src/suit_dashboard/layout.py | src/suit_dashboard/layout.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from suit_dashboard.box import Box
class Grid(object):
def __init__(self, *rows, **kwargs):
if not all([isinstance(r, Row) for r in rows]):
raise TypeError('All elements of Grid must be Row instances')
self.type = 'grid'
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from suit_dashboard.box import Box
class Grid(object):
def __init__(self, *rows, **kwargs):
if not all([isinstance(r, Row) for r in rows]):
raise TypeError('All elements of Grid must be Row instances')
self.type = 'grid'
... | Fix type check of column elements | Fix type check of column elements
| Python | isc | Pawamoy/django-suit-dashboard,Pawamoy/django-suit-dashboard,Pawamoy/django-suit-dashboard,Pawamoy/django-suit-dashboard | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from suit_dashboard.box import Box
class Grid(object):
def __init__(self, *rows, **kwargs):
if not all([isinstance(r, Row) for r in rows]):
raise TypeError('All elements of Grid must be Row instances')
self.type = 'grid'
... | Fix type check of column elements
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from suit_dashboard.box import Box
class Grid(object):
def __init__(self, *rows, **kwargs):
if not all([isinstance(r, Row) for r in rows]):
raise TypeError('All elements of Grid must be Row inst... |
716091f26af29f308c830c172398ff1c6815accf | scripts/status_consistency.py | scripts/status_consistency.py | from app import geo
from app.firebase import db
from app.constants import locationsTable, venuesTable, GPS_LOCATIONS
# The casing of tripadvisor is not consistent across our Firebase scripts
TA_PROVIDER = "tripadvisor"
TA_DETAILS = "tripAdvisor"
dryRun = True
"""
Script to fix error states in the status table (e.g.... | Add script for making status consistent. | Add script for making status consistent.
| Python | mpl-2.0 | liuche/prox-server | from app import geo
from app.firebase import db
from app.constants import locationsTable, venuesTable, GPS_LOCATIONS
# The casing of tripadvisor is not consistent across our Firebase scripts
TA_PROVIDER = "tripadvisor"
TA_DETAILS = "tripAdvisor"
dryRun = True
"""
Script to fix error states in the status table (e.g.... | Add script for making status consistent.
| |
b046ee48f6a9276ed4cd5a17c5accf383a7f5cc5 | tests/sentry/runner/commands/test_init.py | tests/sentry/runner/commands/test_init.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from sentry.testutils import CliTestCase
from sentry.runner.commands.init import init
class InitTest(CliTestCase):
def test_simple(self):
with self.runner.isolated_filesystem():
rv = self.runner.invoke(init, ['config'],... | Add tests for init command | Add tests for init command
| Python | bsd-3-clause | alexm92/sentry,zenefits/sentry,jean/sentry,nicholasserra/sentry,ifduyue/sentry,fotinakis/sentry,jean/sentry,jean/sentry,fotinakis/sentry,JamesMura/sentry,zenefits/sentry,JackDanger/sentry,looker/sentry,nicholasserra/sentry,gencer/sentry,daevaorn/sentry,mitsuhiko/sentry,alexm92/sentry,looker/sentry,daevaorn/sentry,ifduy... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from sentry.testutils import CliTestCase
from sentry.runner.commands.init import init
class InitTest(CliTestCase):
def test_simple(self):
with self.runner.isolated_filesystem():
rv = self.runner.invoke(init, ['config'],... | Add tests for init command
| |
ab1e27b3b28e0463f6dd182037a265c9f69fb94f | src/azure/cli/commands/resourcegroup.py | src/azure/cli/commands/resourcegroup.py | from msrest import Serializer
from ..commands import command, description
from .._profile import Profile
@command('resource group list')
@description('List resource groups')
# TODO: waiting on Python Azure SDK bug fixes
# @option('--tag-name -g <tagName>', L('the resource group's tag name'))
# @option('--tag-value -g ... | from msrest import Serializer
from ..commands import command, description
from ._command_creation import get_service_client
from .._profile import Profile
@command('resource group list')
@description('List resource groups')
# TODO: waiting on Python Azure SDK bug fixes
# @option('--tag-name -g <tagName>', L('the resou... | Use service client factory method for resource group command | Use service client factory method for resource group command
| Python | mit | samedder/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,QingChenmsft/azure-cli,QingChenmsft/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,BurtBiel/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli,BurtBiel/azure... | from msrest import Serializer
from ..commands import command, description
from ._command_creation import get_service_client
from .._profile import Profile
@command('resource group list')
@description('List resource groups')
# TODO: waiting on Python Azure SDK bug fixes
# @option('--tag-name -g <tagName>', L('the resou... | Use service client factory method for resource group command
from msrest import Serializer
from ..commands import command, description
from .._profile import Profile
@command('resource group list')
@description('List resource groups')
# TODO: waiting on Python Azure SDK bug fixes
# @option('--tag-name -g <tagName>', ... |
9a32463bd0ee5f90b004fac3cb53a0adfd9b4534 | src/ggrc/migrations/versions/20160414223705_7a9b715ec504_add_slug_to_assessment_template.py | src/ggrc/migrations/versions/20160414223705_7a9b715ec504_add_slug_to_assessment_template.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""
Add slug to assessment template
Create Date: 2016-04-14 22:37:05.135072
"""... | Add slug column to assessment template table | Add slug column to assessment template table
| Python | apache-2.0 | NejcZupec/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,kr41/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core... | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""
Add slug to assessment template
Create Date: 2016-04-14 22:37:05.135072
"""... | Add slug column to assessment template table
| |
478afbc2178850d209d5d5d4c0626581b601f208 | cutepaste/tests/conftest.py | cutepaste/tests/conftest.py | import os
import pytest
from pyvirtualdisplay import Display
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
REPORTS_DIR = "reports"
@pytest.fixture(scope='function')
def webdriver(request):
display = Display(visible=0, size=(800, 600), use_xauth=True)
display.sta... | import os
import pytest
from pyvirtualdisplay import Display
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
REPORTS_DIR = "reports"
@pytest.fixture(scope='function')
def webdriver(request):
display = Display(visible=0, size=(800, 600), use_xauth=True)
display.sta... | Add an implicit wait of 1 second | Add an implicit wait of 1 second
| Python | apache-2.0 | msurdi/cutepaste,msurdi/cutepaste,msurdi/cutepaste | import os
import pytest
from pyvirtualdisplay import Display
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
REPORTS_DIR = "reports"
@pytest.fixture(scope='function')
def webdriver(request):
display = Display(visible=0, size=(800, 600), use_xauth=True)
display.sta... | Add an implicit wait of 1 second
import os
import pytest
from pyvirtualdisplay import Display
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
REPORTS_DIR = "reports"
@pytest.fixture(scope='function')
def webdriver(request):
display = Display(visible=0, size=(800, 600... |
77c245240fcccf1c7c6f3251168801de45182b8d | klaxer/__init__.py | klaxer/__init__.py | """Entry point for all things Klaxer"""
__author__ = 'Aru Sahni, Kevin Dwyer, Justin Shelton, Dylan Bernard, Will Schneider, et al'
__version__ = '0.0.1'
__license__ = 'MIT'
APP_NAME = 'Klaxer'
| """Entry point for all things Klaxer"""
__author__ = 'Aru Sahni, Kevin Dwyer, Justin Shelton, Dylan Bernard, et al'
__version__ = '0.0.1'
__license__ = 'MIT'
APP_NAME = 'Klaxer'
| Adjust author list to only include contributors. | Adjust author list to only include contributors.
| Python | mit | klaxer/klaxer | """Entry point for all things Klaxer"""
__author__ = 'Aru Sahni, Kevin Dwyer, Justin Shelton, Dylan Bernard, et al'
__version__ = '0.0.1'
__license__ = 'MIT'
APP_NAME = 'Klaxer'
| Adjust author list to only include contributors.
"""Entry point for all things Klaxer"""
__author__ = 'Aru Sahni, Kevin Dwyer, Justin Shelton, Dylan Bernard, Will Schneider, et al'
__version__ = '0.0.1'
__license__ = 'MIT'
APP_NAME = 'Klaxer'
|
cde4bc1112f2ceb45f42de21c45d46d96097d5bc | app/forms.py | app/forms.py | from flask_wtf import Form
from wtforms import TextField
from wtforms.validators import InputRequired, Length, Regexp
class SignupForm(Form):
username = TextField(validators=[InputRequired(), Length(min=1, max=30), Regexp("^[a-zA-Z0-9]+$")])
publicKey = TextField(validators=[InputRequired()]) # Add Length and ... | from flask_wtf import Form
from wtforms import TextField, DateTimeField
from wtforms.validators import InputRequired, Length, Regexp
class SignupForm(Form):
username = TextField(validators=[InputRequired(), Length(min=1, max=30), Regexp("^[a-zA-Z0-9]+$")])
publicKey = TextField(validators=[InputRequired()]) # ... | Add basic AddEvent form with datetime conversion. | Add basic AddEvent form with datetime conversion.
| Python | agpl-3.0 | mitclap/backend | from flask_wtf import Form
from wtforms import TextField, DateTimeField
from wtforms.validators import InputRequired, Length, Regexp
class SignupForm(Form):
username = TextField(validators=[InputRequired(), Length(min=1, max=30), Regexp("^[a-zA-Z0-9]+$")])
publicKey = TextField(validators=[InputRequired()]) # ... | Add basic AddEvent form with datetime conversion.
from flask_wtf import Form
from wtforms import TextField
from wtforms.validators import InputRequired, Length, Regexp
class SignupForm(Form):
username = TextField(validators=[InputRequired(), Length(min=1, max=30), Regexp("^[a-zA-Z0-9]+$")])
publicKey = TextFi... |
e3845e03ea1f3dd393cd077f7c2b3d2ce31b86a9 | mysite/scripts/remove_numbers_from_locations.py | mysite/scripts/remove_numbers_from_locations.py | import re
import mysite
Person = mysite.profile.models.Person
people_with_weird_locations = Person.objects.filter(location_display_name__regex=', [0-9][0-9],')
for p in people_with_weird_locations:
location_pieces = re.split(r', \d\d', p.location_display_name)
unweirded_location = "".join(location_pieces)
... | Add script to remove unnecessary numbers from people's locations. | Add script to remove unnecessary numbers from people's locations.
| Python | agpl-3.0 | SnappleCap/oh-mainline,ehashman/oh-mainline,mzdaniel/oh-mainline,jledbetter/openhatch,sudheesh001/oh-mainline,openhatch/oh-mainline,jledbetter/openhatch,SnappleCap/oh-mainline,openhatch/oh-mainline,ehashman/oh-mainline,waseem18/oh-mainline,vipul-sharma20/oh-mainline,jledbetter/openhatch,ojengwa/oh-mainline,waseem18/oh-... | import re
import mysite
Person = mysite.profile.models.Person
people_with_weird_locations = Person.objects.filter(location_display_name__regex=', [0-9][0-9],')
for p in people_with_weird_locations:
location_pieces = re.split(r', \d\d', p.location_display_name)
unweirded_location = "".join(location_pieces)
... | Add script to remove unnecessary numbers from people's locations.
| |
e778a2da7938dcf565282635e395dc410ef989d6 | terraform-gce/worker/generate-certs.py | terraform-gce/worker/generate-certs.py | #!/usr/bin/env python
import os.path
import subprocess
import argparse
import shutil
cl_parser = argparse.ArgumentParser()
args = cl_parser.parse_args()
os.chdir(os.path.abspath(os.path.dirname(__file__)))
if not os.path.exists('assets/certificates'):
os.makedirs('assets/certificates')
os.chdir('assets/certific... | #!/usr/bin/env python
import os.path
import subprocess
import argparse
import shutil
cl_parser = argparse.ArgumentParser()
args = cl_parser.parse_args()
os.chdir(os.path.abspath(os.path.dirname(__file__)))
if not os.path.exists('assets/certificates'):
os.makedirs('assets/certificates')
os.chdir('assets/certific... | Copy cert auth from master | Copy cert auth from master
| Python | apache-2.0 | aknuds1/contrib,aknuds1/contrib,aknuds1/contrib,aknuds1/contrib,aknuds1/contrib,aknuds1/contrib | #!/usr/bin/env python
import os.path
import subprocess
import argparse
import shutil
cl_parser = argparse.ArgumentParser()
args = cl_parser.parse_args()
os.chdir(os.path.abspath(os.path.dirname(__file__)))
if not os.path.exists('assets/certificates'):
os.makedirs('assets/certificates')
os.chdir('assets/certific... | Copy cert auth from master
#!/usr/bin/env python
import os.path
import subprocess
import argparse
import shutil
cl_parser = argparse.ArgumentParser()
args = cl_parser.parse_args()
os.chdir(os.path.abspath(os.path.dirname(__file__)))
if not os.path.exists('assets/certificates'):
os.makedirs('assets/certificates... |
a029c6f4fce36693a9dee53ff8bc797890cfe71e | plugins/basic_info_plugin.py | plugins/basic_info_plugin.py | import string
import textwrap
from plugins import BasePlugin
__author__ = 'peter'
class BasicInfoPlugin(BasePlugin):
name = 'BasicInfoPlugin'
short_description = 'Basic info:'
default = True
description = textwrap.dedent('''
This plugin provides some basic info about the string such as:
- Len... | import string
import textwrap
from veryprettytable import VeryPrettyTable
from plugins import BasePlugin
__author__ = 'peter'
class BasicInfoPlugin(BasePlugin):
name = 'BasicInfoPlugin'
short_description = 'Basic info:'
default = True
description = textwrap.dedent('''
This plugin provides some ba... | Use table instead of separate lines | Use table instead of separate lines
| Python | mit | Sakartu/stringinfo | import string
import textwrap
from veryprettytable import VeryPrettyTable
from plugins import BasePlugin
__author__ = 'peter'
class BasicInfoPlugin(BasePlugin):
name = 'BasicInfoPlugin'
short_description = 'Basic info:'
default = True
description = textwrap.dedent('''
This plugin provides some ba... | Use table instead of separate lines
import string
import textwrap
from plugins import BasePlugin
__author__ = 'peter'
class BasicInfoPlugin(BasePlugin):
name = 'BasicInfoPlugin'
short_description = 'Basic info:'
default = True
description = textwrap.dedent('''
This plugin provides some basic inf... |
630c823706e28e66306828d6c3001b6e3773ce90 | ui/players/models.py | ui/players/models.py | from django.db import models
from django.contrib.auth.models import User
class Player(models.Model):
user = models.OneToOneField(User)
class Avatar(models.Model):
player = models.ForeignKey(User)
code = models.TextField() | from django.db import models
from django.contrib.auth.models import User
class Player(models.Model):
user = models.OneToOneField(User)
code = models.TextField()
class Avatar(models.Model):
player = models.ForeignKey(User)
| Move code into player (if only for now) | Move code into player (if only for now)
| Python | agpl-3.0 | Spycho/aimmo,Spycho/aimmo,Spycho/aimmo,Spycho/aimmo | from django.db import models
from django.contrib.auth.models import User
class Player(models.Model):
user = models.OneToOneField(User)
code = models.TextField()
class Avatar(models.Model):
player = models.ForeignKey(User)
| Move code into player (if only for now)
from django.db import models
from django.contrib.auth.models import User
class Player(models.Model):
user = models.OneToOneField(User)
class Avatar(models.Model):
player = models.ForeignKey(User)
code = models.TextField() |
3219a925ecddbacb39e4adc484d94eaed6bddd0b | yolk/__init__.py | yolk/__init__.py | """yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.8.6'
| """yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.8.7'
| Increment patch version to 0.8.7 | Increment patch version to 0.8.7
| Python | bsd-3-clause | myint/yolk,myint/yolk | """yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.8.7'
| Increment patch version to 0.8.7
"""yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.8.6'
|
6663f7baefd68a059c963d464afaf3fcbfbdf2db | tests/markdown/MarkdownBearTest.py | tests/markdown/MarkdownBearTest.py | from bears.markdown.MarkdownBear import MarkdownBear
from coalib.testing.LocalBearTestHelper import verify_local_bear
test_file1 = """1. abc
1. def
"""
test_file2 = """1. abc
2. def
"""
test_file3 = """1. abcdefghijklm
2. nopqrstuvwxyz
"""
MarkdownBearTest = verify_local_bear(MarkdownBear,
... | import unittest
from queue import Queue
from bears.markdown.MarkdownBear import MarkdownBear
from coalib.testing.BearTestHelper import generate_skip_decorator
from coalib.testing.LocalBearTestHelper import verify_local_bear, execute_bear
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.settings.S... | Add test to check message for error | MarkdownBear: Add test to check message for error
A better test for MarkdownBear to check the exact message
of the result for a maximum line length error.
Related to https://github.com/coala/coala-bears/issues/1235
| Python | agpl-3.0 | Asnelchristian/coala-bears,damngamerz/coala-bears,aptrishu/coala-bears,srisankethu/coala-bears,incorrectusername/coala-bears,yash-nisar/coala-bears,Shade5/coala-bears,madhukar01/coala-bears,naveentata/coala-bears,shreyans800755/coala-bears,damngamerz/coala-bears,Vamshi99/coala-bears,shreyans800755/coala-bears,horczech/... | import unittest
from queue import Queue
from bears.markdown.MarkdownBear import MarkdownBear
from coalib.testing.BearTestHelper import generate_skip_decorator
from coalib.testing.LocalBearTestHelper import verify_local_bear, execute_bear
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.settings.S... | MarkdownBear: Add test to check message for error
A better test for MarkdownBear to check the exact message
of the result for a maximum line length error.
Related to https://github.com/coala/coala-bears/issues/1235
from bears.markdown.MarkdownBear import MarkdownBear
from coalib.testing.LocalBearTestHelper import ve... |
84a6465b5b36989091245e2039912867a27c2773 | migrations/versions/760_brief_response_submitted_at.py | migrations/versions/760_brief_response_submitted_at.py | """brief response submitted at
Revision ID: 760
Revises: 750
Create Date: 2016-10-24 14:16:29.951023
"""
# revision identifiers, used by Alembic.
revision = '760'
down_revision = '750'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('brief_responses', sa.Column('submitted_at', sa.D... | Add `submitted_at` migration to `brief_responses` table | Add `submitted_at` migration to `brief_responses` table
Represents when a brief response has been submitted and is therefore
a complete response, as opposed to one that may be in a draft form.
Note, we choose not to use the word "published" as a brief response
is not published publicly.
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | """brief response submitted at
Revision ID: 760
Revises: 750
Create Date: 2016-10-24 14:16:29.951023
"""
# revision identifiers, used by Alembic.
revision = '760'
down_revision = '750'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('brief_responses', sa.Column('submitted_at', sa.D... | Add `submitted_at` migration to `brief_responses` table
Represents when a brief response has been submitted and is therefore
a complete response, as opposed to one that may be in a draft form.
Note, we choose not to use the word "published" as a brief response
is not published publicly.
| |
55fb9752311f79c5aa2ecd85c4264ae6821f52da | django_summernote/migrations/0002_update-help_text.py | django_summernote/migrations/0002_update-help_text.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-11 07:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_summernote', '0001_initial'),
]
operations = [
migrations.AlterField... | Add a migration for updating help_text | Add a migration for updating help_text
| Python | mit | lqez/django-summernote,summernote/django-summernote,lqez/django-summernote,summernote/django-summernote,summernote/django-summernote,lqez/django-summernote | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-11 07:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_summernote', '0001_initial'),
]
operations = [
migrations.AlterField... | Add a migration for updating help_text
| |
9dafef749aaf2fca9e865cf28b043ea22bafe3a5 | backend/django/apps/accounts/tests.py | backend/django/apps/accounts/tests.py | from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase
from rest_framework import status
import factory
import json
from .models import BaseAccount
from .serializers import WholeAccountSerializer
class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = B... | from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase
from rest_framework import status
import factory
import json
from .models import BaseAccount
from .serializers import WholeAccountSerializer
class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = B... | Create a test for Account creation | Create a test for Account creation
| Python | mit | slavpetroff/sweetshop,slavpetroff/sweetshop | from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase
from rest_framework import status
import factory
import json
from .models import BaseAccount
from .serializers import WholeAccountSerializer
class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = B... | Create a test for Account creation
from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase
from rest_framework import status
import factory
import json
from .models import BaseAccount
from .serializers import WholeAccountSerializer
class UserFactory(factory.django.DjangoModelFactory)... |
45b23c04e68e50314bddb063aecf4df63edcbc7a | setup.py | setup.py | from setuptools import setup
setup(
name='runcalc',
version='0.1.1',
description='Running pace calculator',
author='Mike Patek',
author_email='mpatek@gmail.com',
url='https://github.com/mpatek/runcalc',
download_url='https://github.com/mpatek/runcalc/tarball/0.1',
packages=['runcalc'],
... | from setuptools import setup
setup(
name='runcalc',
version='0.1.1',
description='Running pace calculator',
author='Mike Patek',
author_email='mpatek@gmail.com',
url='https://github.com/mpatek/runcalc',
download_url='https://github.com/mpatek/runcalc/tarball/0.1.1',
packages=['runcalc']... | Increment version number in tarball | Increment version number in tarball
| Python | mit | mpatek/runcalc | from setuptools import setup
setup(
name='runcalc',
version='0.1.1',
description='Running pace calculator',
author='Mike Patek',
author_email='mpatek@gmail.com',
url='https://github.com/mpatek/runcalc',
download_url='https://github.com/mpatek/runcalc/tarball/0.1.1',
packages=['runcalc']... | Increment version number in tarball
from setuptools import setup
setup(
name='runcalc',
version='0.1.1',
description='Running pace calculator',
author='Mike Patek',
author_email='mpatek@gmail.com',
url='https://github.com/mpatek/runcalc',
download_url='https://github.com/mpatek/runcalc/tar... |
2916006bf7dc9a689a9ab5678d37a858d380345e | api/migrations/0002_migrate_legacy.py | api/migrations/0002_migrate_legacy.py | from django.apps import apps as global_apps
from django.db import migrations
from django.db.utils import OperationalError
sql = '''
'''
reverse_sql = '''
'''
def forwards(app, schema_editor):
models = app.all_models['api']
try:
schema_editor.execute('alter table south_migrationhistory rename to lega... | from django.apps import apps as global_apps
from django.db import migrations
from django.db.utils import OperationalError
from django.db.backends.postgresql.schema import DatabaseSchemaEditor as PgSE
sql = '''
'''
reverse_sql = '''
'''
def forwards(app, schema_editor):
models = app.all_models['api']
if no... | Update migration to check for Postgres as target | Update migration to check for Postgres as target
| Python | bsd-2-clause | chop-dbhi/biorepo-portal,chop-dbhi/biorepo-portal,chop-dbhi/biorepo-portal,chop-dbhi/biorepo-portal | from django.apps import apps as global_apps
from django.db import migrations
from django.db.utils import OperationalError
from django.db.backends.postgresql.schema import DatabaseSchemaEditor as PgSE
sql = '''
'''
reverse_sql = '''
'''
def forwards(app, schema_editor):
models = app.all_models['api']
if no... | Update migration to check for Postgres as target
from django.apps import apps as global_apps
from django.db import migrations
from django.db.utils import OperationalError
sql = '''
'''
reverse_sql = '''
'''
def forwards(app, schema_editor):
models = app.all_models['api']
try:
schema_editor.execute(... |
f4e07b93ab81fd0a0dc59ec77fca596a2fcca738 | froide/helper/form_utils.py | froide/helper/form_utils.py | import json
from django.db import models
class DjangoJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, models.Model) and hasattr(obj, 'as_data'):
return obj.as_data()
return json.JSONEncoder.default(self, obj)
class JSONMixin(object):
def as_json(self):
... | import json
from django.db import models
class DjangoJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, models.Model) and hasattr(obj, 'as_data'):
return obj.as_data()
return json.JSONEncoder.default(self, obj)
def get_data(error):
if isinstance(error, (di... | Fix serialization of form errors | Fix serialization of form errors | Python | mit | fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide | import json
from django.db import models
class DjangoJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, models.Model) and hasattr(obj, 'as_data'):
return obj.as_data()
return json.JSONEncoder.default(self, obj)
def get_data(error):
if isinstance(error, (di... | Fix serialization of form errors
import json
from django.db import models
class DjangoJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, models.Model) and hasattr(obj, 'as_data'):
return obj.as_data()
return json.JSONEncoder.default(self, obj)
class JSONMixin(... |
9818fb927bcc096fbb6a3b075be867a5709c3d0f | simpy/__init__.py | simpy/__init__.py | # encoding: utf-8
"""
With SimPy, simulating is fun again!
"""
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from simpy.core import Simulation, Interrupt, Failure
__all__ = ['Simulation', 'Interrupt', 'Failure', 'test']
__version__ = '3.0a1'
def test():
"""Runs SimPy’s test suite ... | # encoding: utf-8
"""
With SimPy, simulating is fun again!
"""
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from simpy.core import Simulation, Process, Interrupt, Failure
__all__ = ['Simulation', 'Interrupt', 'Failure', 'test']
__version__ = '3.0a1'
def test():
"""Runs SimPy’s te... | Add Process to the simpy namespace. | Add Process to the simpy namespace.
| Python | mit | Uzere/uSim | # encoding: utf-8
"""
With SimPy, simulating is fun again!
"""
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from simpy.core import Simulation, Process, Interrupt, Failure
__all__ = ['Simulation', 'Interrupt', 'Failure', 'test']
__version__ = '3.0a1'
def test():
"""Runs SimPy’s te... | Add Process to the simpy namespace.
# encoding: utf-8
"""
With SimPy, simulating is fun again!
"""
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from simpy.core import Simulation, Interrupt, Failure
__all__ = ['Simulation', 'Interrupt', 'Failure', 'test']
__version__ = '3.0a1'
def te... |
528edba420089249bd58c0621e06225db84e223f | opps/contrib/logging/models.py | opps/contrib/logging/models.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from opps.core.models import NotUserPublishable
class Logging(NotUserPublishable):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from opps.core.models import NotUserPublishable
class Logging(NotUserPublishable):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
... | Add missing translation on logging contrib app | Add missing translation on logging contrib app
| Python | mit | jeanmask/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,opps/opps,YACOWS/opps,opps/opps,opps/opps,williamroot/opps,YACOWS/opps,opps/opps | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from opps.core.models import NotUserPublishable
class Logging(NotUserPublishable):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
... | Add missing translation on logging contrib app
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from opps.core.models import NotUserPublishable
class Logging(NotUserPublishable):
user = models.Fore... |
629553ec992c59500ef64b04b8fc9fb0500bcaee | wqflask/tests/wqflask/test_user_session.py | wqflask/tests/wqflask/test_user_session.py | """Test cases for some methods in user_session.py"""
import unittest
from wqflask.user_session import verify_cookie
class TestUserSession(unittest.TestCase):
def test_verify_cookie(self):
"""
Test cookie verification
"""
self.assertEqual(
"3f4c1dbf-5b56-4260-87d6-f3544... | Add tests for cookie verification | Add tests for cookie verification
| Python | agpl-3.0 | pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2 | """Test cases for some methods in user_session.py"""
import unittest
from wqflask.user_session import verify_cookie
class TestUserSession(unittest.TestCase):
def test_verify_cookie(self):
"""
Test cookie verification
"""
self.assertEqual(
"3f4c1dbf-5b56-4260-87d6-f3544... | Add tests for cookie verification
| |
c509ef35fb0ba77fbcb66dd968daa0a19a617867 | tests/sim/test_skills.py | tests/sim/test_skills.py | import unittest
import unittest.mock as mock
from hunting.level.map import LevelMap, LevelTile
from hunting.sim.entities import GameObject, Fighter
from hunting.sim.skills import PowerStrike
class TestPowerStrike(unittest.TestCase):
def setUp(self):
level = LevelMap()
level.set_map([[LevelTile()]... | Add test for PowerStrike ability | Add test for PowerStrike ability
| Python | mit | MoyTW/RL_Arena_Experiment | import unittest
import unittest.mock as mock
from hunting.level.map import LevelMap, LevelTile
from hunting.sim.entities import GameObject, Fighter
from hunting.sim.skills import PowerStrike
class TestPowerStrike(unittest.TestCase):
def setUp(self):
level = LevelMap()
level.set_map([[LevelTile()]... | Add test for PowerStrike ability
| |
955cb0d27ab52348b753c3edea731223e2631f50 | Climate_Police/tests/test_plot_pollutants.py | Climate_Police/tests/test_plot_pollutants.py | #run the test with default values of df, state and year
import unittest
from plot_pollutants import plot_pollutants
import pandas as pd
df = pd.read_csv("../data/pollution_us_2000_2016.csv")
year="2010"
state="Arizona"
class TestPlot(unittest.TestCase):
def testPlotPollutants(self):
result... | #run the test with default values of df, state and year
import unittest
from plot_pollutants import plot_pollutants
import pandas as pd
df = pd.read_csv("../data/pollution_us_2000_2016.csv")
year="2010"
state="Arizona"
class TestPlot(unittest.TestCase):
def testPlotPollutants(self):
fig, f... | Add flag to plot_pollutant unit test | Add flag to plot_pollutant unit test
also change assertTrue to assertEqual | Python | mit | abhisheksugam/Climate_Police | #run the test with default values of df, state and year
import unittest
from plot_pollutants import plot_pollutants
import pandas as pd
df = pd.read_csv("../data/pollution_us_2000_2016.csv")
year="2010"
state="Arizona"
class TestPlot(unittest.TestCase):
def testPlotPollutants(self):
fig, f... | Add flag to plot_pollutant unit test
also change assertTrue to assertEqual
#run the test with default values of df, state and year
import unittest
from plot_pollutants import plot_pollutants
import pandas as pd
df = pd.read_csv("../data/pollution_us_2000_2016.csv")
year="2010"
state="Arizona"
class TestPlot(unit... |
b2662ad0031d5ecbb322feb105e362f5d80f4392 | favicon/templatetags/favtags.py | favicon/templatetags/favtags.py | from django import template
from django.utils.safestring import mark_safe
from favicon.models import Favicon, config
register = template.Library()
@register.simple_tag(takes_context=True)
def placeFavicon(context):
"""
Gets Favicon-URL for the Model.
Template Syntax:
{% placeFavicon %}
""... | from django import template
from django.utils.safestring import mark_safe
from favicon.models import Favicon, config
register = template.Library()
@register.simple_tag(takes_context=True)
def placeFavicon(context):
"""
Gets Favicon-URL for the Model.
Template Syntax:
{% placeFavicon %}
""... | Set propper link attribute 'sizes' in templatetag | Set propper link attribute 'sizes' in templatetag
There seems to be a typo in the templatetag generator on lines 26 and 30.
The attribute 'sizes=' written as 'size ='. This break w3c tests as that attribute is not available in the link tag. | Python | mit | arteria/django-favicon-plus | from django import template
from django.utils.safestring import mark_safe
from favicon.models import Favicon, config
register = template.Library()
@register.simple_tag(takes_context=True)
def placeFavicon(context):
"""
Gets Favicon-URL for the Model.
Template Syntax:
{% placeFavicon %}
""... | Set propper link attribute 'sizes' in templatetag
There seems to be a typo in the templatetag generator on lines 26 and 30.
The attribute 'sizes=' written as 'size ='. This break w3c tests as that attribute is not available in the link tag.
from django import template
from django.utils.safestring import mark_safe
... |
763680e57b28a9746050206cd63450bf11c3e512 | src/ggrc_basic_permissions/migrations/versions/20131010001257_10adeac7b693_fix_programeditor_pe.py | src/ggrc_basic_permissions/migrations/versions/20131010001257_10adeac7b693_fix_programeditor_pe.py |
"""Fix ProgramEditor permissions
Revision ID: 10adeac7b693
Revises: 8f33d9bd2043
Create Date: 2013-10-10 00:12:57.391754
"""
# revision identifiers, used by Alembic.
revision = '10adeac7b693'
down_revision = '8f33d9bd2043'
import json
import sqlalchemy as sa
from alembic import op
from datetime import datetime
fro... | Fix ProgramEditor permissions to not include Program delete | Fix ProgramEditor permissions to not include Program delete
| Python | apache-2.0 | VinnieJohns/ggrc-core,prasannav7/ggrc-core,prasannav7/ggrc-core,AleksNeStu/ggrc-core,vladan-m/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,prasannav7/ggrc-core,hyperNURb/ggrc-core,selahssea/ggrc-core,hasanalom/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,andrei-karalionak/ggrc-core,uskudnik/ggrc-core,NejcZupec/... |
"""Fix ProgramEditor permissions
Revision ID: 10adeac7b693
Revises: 8f33d9bd2043
Create Date: 2013-10-10 00:12:57.391754
"""
# revision identifiers, used by Alembic.
revision = '10adeac7b693'
down_revision = '8f33d9bd2043'
import json
import sqlalchemy as sa
from alembic import op
from datetime import datetime
fro... | Fix ProgramEditor permissions to not include Program delete
| |
5b24a22fa148f4ae4e8d4403824ad7881b27e644 | setup.py | setup.py | """
trafficserver_exporter
----------------------
An Apache Traffic Server metrics exporter for Prometheus. Uses the
stats_over_http plugin to translate JSON data into Prometheus format.
"""
from setuptools import setup
setup(
name='trafficserver_exporter',
version='0.0.2',
author='Greg Dallavalle',
... | """
trafficserver_exporter
----------------------
An Apache Traffic Server metrics exporter for Prometheus. Uses the
stats_over_http plugin to translate JSON data into Prometheus format.
"""
from setuptools import setup
setup(
name='trafficserver_exporter',
version='0.0.3',
author='Greg Dallavalle',
... | Add bumpversion, sync package version | Add bumpversion, sync package version
| Python | apache-2.0 | gdvalle/trafficserver_exporter | """
trafficserver_exporter
----------------------
An Apache Traffic Server metrics exporter for Prometheus. Uses the
stats_over_http plugin to translate JSON data into Prometheus format.
"""
from setuptools import setup
setup(
name='trafficserver_exporter',
version='0.0.3',
author='Greg Dallavalle',
... | Add bumpversion, sync package version
"""
trafficserver_exporter
----------------------
An Apache Traffic Server metrics exporter for Prometheus. Uses the
stats_over_http plugin to translate JSON data into Prometheus format.
"""
from setuptools import setup
setup(
name='trafficserver_exporter',
version='0... |
bee340782a07a26a28bf89d91798d8091c42d1e1 | config.py | config.py | import os
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_TRACK_MODIFICATIONS = True
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config):
DEBUG = True
DEVELOPMENT = True
class DevelopmentConfig(... | import os
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = os.environ["DB_URL"]
SQLALCHEMY_TRACK_MODIFICATIONS = True
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config):
DEBUG = True
DEVELOPMENT = True
class DevelopmentConfig(Config... | Use DB_URL set in heroku to avoid sqlalchemy dialect issue | Use DB_URL set in heroku to avoid sqlalchemy dialect issue
| Python | mit | mdsrosa/routes_api_python | import os
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = os.environ["DB_URL"]
SQLALCHEMY_TRACK_MODIFICATIONS = True
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config):
DEBUG = True
DEVELOPMENT = True
class DevelopmentConfig(Config... | Use DB_URL set in heroku to avoid sqlalchemy dialect issue
import os
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_TRACK_MODIFICATIONS = True
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config):
DE... |
0af76c93eab508ca93228ce902427df35ff34bca | microscopes/lda/runner.py | microscopes/lda/runner.py | """Implements the Runner interface fo LDA
"""
from microscopes.common import validator
from microscopes.common.rng import rng
from microscopes.lda.kernels import lda_crp_gibbs
from microscopes.lda.kernels import lda_sample_dispersion
class runner(object):
"""The LDA runner
Parameters
----------
defn... | """Implements the Runner interface fo LDA
"""
from microscopes.common import validator
from microscopes.common.rng import rng
from microscopes.lda.kernels import lda_crp_gibbs
from microscopes.lda.kernels import lda_sample_dispersion
class runner(object):
"""The LDA runner
Parameters
----------
defn... | Disable hyperparam inference for now | Disable hyperparam inference for now
| Python | bsd-3-clause | datamicroscopes/lda,datamicroscopes/lda,datamicroscopes/lda | """Implements the Runner interface fo LDA
"""
from microscopes.common import validator
from microscopes.common.rng import rng
from microscopes.lda.kernels import lda_crp_gibbs
from microscopes.lda.kernels import lda_sample_dispersion
class runner(object):
"""The LDA runner
Parameters
----------
defn... | Disable hyperparam inference for now
"""Implements the Runner interface fo LDA
"""
from microscopes.common import validator
from microscopes.common.rng import rng
from microscopes.lda.kernels import lda_crp_gibbs
from microscopes.lda.kernels import lda_sample_dispersion
class runner(object):
"""The LDA runner
... |
fc21078f0e9327800637a74d4127c666f88c9a88 | test/global_variables/TestGlobalVariables.py | test/global_variables/TestGlobalVariables.py | """Show global variables and check that they do indeed have global scopes."""
import os, time
import lldb
import unittest
main = False
class TestClassTypes(unittest.TestCase):
def setUp(self):
global main
# Save old working directory.
self.oldcwd = os.getcwd()
# Change current w... | Add a test to show global variables and to verify that they do display as having global scopes. | Add a test to show global variables and to verify that they do display as having
global scopes.
git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@107522 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb | """Show global variables and check that they do indeed have global scopes."""
import os, time
import lldb
import unittest
main = False
class TestClassTypes(unittest.TestCase):
def setUp(self):
global main
# Save old working directory.
self.oldcwd = os.getcwd()
# Change current w... | Add a test to show global variables and to verify that they do display as having
global scopes.
git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@107522 91177308-0d34-0410-b5e6-96231b3b80d8
| |
ff5eccb59efd09cfdeb64150440de35215e1b77d | gevent_tasks/utils.py | gevent_tasks/utils.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# >>
# gevent-tasks, 2017
# <<
import random
import string
ch_choices = string.ascii_letters + string.digits
def gen_uuid(length=4):
# type: (int) -> str
""" Generate a random ID of a given length. """
return ''.join(map(lambda c: random.choice(ch_choic... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# >>
# gevent-tasks, 2017
# <<
import random
import string
ch_choices = string.ascii_letters + string.digits
def gen_uuid(length=4):
""" Generate a random ID of a given length.
Args:
length (int): length of the returned string.
Ret... | Fix `gen_uuid` logic and documentation | Fix `gen_uuid` logic and documentation
| Python | mit | blakev/gevent-tasks | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# >>
# gevent-tasks, 2017
# <<
import random
import string
ch_choices = string.ascii_letters + string.digits
def gen_uuid(length=4):
""" Generate a random ID of a given length.
Args:
length (int): length of the returned string.
Ret... | Fix `gen_uuid` logic and documentation
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# >>
# gevent-tasks, 2017
# <<
import random
import string
ch_choices = string.ascii_letters + string.digits
def gen_uuid(length=4):
# type: (int) -> str
""" Generate a random ID of a given length. """
return ''.j... |
1096d0f13ebbc5900c21626a5caf6276b36229d8 | Lib/test/test_coding.py | Lib/test/test_coding.py |
import test.test_support, unittest
import os
class CodingTest(unittest.TestCase):
def test_bad_coding(self):
module_name = 'bad_coding'
self.verify_bad_module(module_name)
def test_bad_coding2(self):
module_name = 'bad_coding2'
self.verify_bad_module(module_name)
def veri... |
import test.test_support, unittest
import os
class CodingTest(unittest.TestCase):
def test_bad_coding(self):
module_name = 'bad_coding'
self.verify_bad_module(module_name)
def test_bad_coding2(self):
module_name = 'bad_coding2'
self.verify_bad_module(module_name)
def veri... | Fix a test failure on non-UTF-8 locales: bad_coding2.py is encoded in utf-8. | Fix a test failure on non-UTF-8 locales: bad_coding2.py is encoded
in utf-8.
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator |
import test.test_support, unittest
import os
class CodingTest(unittest.TestCase):
def test_bad_coding(self):
module_name = 'bad_coding'
self.verify_bad_module(module_name)
def test_bad_coding2(self):
module_name = 'bad_coding2'
self.verify_bad_module(module_name)
def veri... | Fix a test failure on non-UTF-8 locales: bad_coding2.py is encoded
in utf-8.
import test.test_support, unittest
import os
class CodingTest(unittest.TestCase):
def test_bad_coding(self):
module_name = 'bad_coding'
self.verify_bad_module(module_name)
def test_bad_coding2(self):
module_... |
bf059b8b781c786edb4b3ca7ef838e9b4d16d3a0 | tests/commands/test_lib.py | tests/commands/test_lib.py | # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os import listdir
from os.path import isdir, isfile, join
import re
from click.testing import CliRunner
from platformio.commands.lib import cli
from platformio import util
runner = CliRunner()
def validate_output(result):
assert r... | Cover "lib" commands with tests | Cover "lib" commands with tests
| Python | apache-2.0 | awong1900/platformio,platformio/platformio,ZachMassia/platformio,mplewis/platformio,bkudria/platformio,platformio/platformio-core,jrobeson/platformio,TimJay/platformio,jrobeson/platformio,valeros/platformio,atyenoria/platformio,jrobeson/platformio,bkudria/platformio,TimJay/platformio,mcanthony/platformio,mseroczynski/p... | # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os import listdir
from os.path import isdir, isfile, join
import re
from click.testing import CliRunner
from platformio.commands.lib import cli
from platformio import util
runner = CliRunner()
def validate_output(result):
assert r... | Cover "lib" commands with tests
| |
82396b5033d1dce52e0504a3703d62cdd5bc047b | tests/functions_tests/test_copy.py | tests/functions_tests/test_copy.py | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.random.uniform(-1, 1, (10, 5)).astyp... | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
from chainer import testing
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.random.u... | Make test module for Copy runnable | Make test module for Copy runnable
| Python | mit | cupy/cupy,kuwa32/chainer,cupy/cupy,hvy/chainer,niboshi/chainer,cupy/cupy,AlpacaDB/chainer,niboshi/chainer,1986ks/chainer,ktnyt/chainer,tigerneil/chainer,t-abe/chainer,wkentaro/chainer,truongdq/chainer,jnishi/chainer,cemoody/chainer,ikasumi/chainer,aonotas/chainer,chainer/chainer,wkentaro/chainer,keisuke-umezawa/chainer... | import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
from chainer import testing
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.random.u... | Make test module for Copy runnable
import unittest
import numpy
import chainer
from chainer import functions
from chainer import gradient_check
class Copy(unittest.TestCase):
def setUp(self):
self.x_data = numpy.random.uniform(
-1, 1, (10, 5)).astype(numpy.float32)
self.gy = numpy.... |
f13f80db99ed43479336b116e38512e3566e4623 | setup.py | setup.py | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'parserutils.tests.tes... | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'parserutils.tests.tes... | Enable markdown for PyPI README | Enable markdown for PyPI README | Python | bsd-3-clause | consbio/parserutils | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'parserutils.tests.tes... | Enable markdown for PyPI README
import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'u... |
e7c5e62da700f51e69662689758ffebf70fa1494 | cms/djangoapps/contentstore/context_processors.py | cms/djangoapps/contentstore/context_processors.py | import ConfigParser
from django.conf import settings
def doc_url(request):
config_file = open(settings.REPO_ROOT / "docs" / "config.ini")
config = ConfigParser.ConfigParser()
config.readfp(config_file)
# in the future, we will detect the locale; for now, we will
# hardcode en_us, since we only ha... | import ConfigParser
from django.conf import settings
config_file = open(settings.REPO_ROOT / "docs" / "config.ini")
config = ConfigParser.ConfigParser()
config.readfp(config_file)
def doc_url(request):
# in the future, we will detect the locale; for now, we will
# hardcode en_us, since we only have English d... | Read from doc url mapping file at load time, rather than once per request | Read from doc url mapping file at load time, rather than once per request
| Python | agpl-3.0 | ampax/edx-platform,Softmotions/edx-platform,dcosentino/edx-platform,chudaol/edx-platform,prarthitm/edxplatform,cyanna/edx-platform,jazztpt/edx-platform,motion2015/a3,nikolas/edx-platform,msegado/edx-platform,hkawasaki/kawasaki-aio8-0,LearnEra/LearnEraPlaftform,pabloborrego93/edx-platform,wwj718/ANALYSE,procangroup/edx-... | import ConfigParser
from django.conf import settings
config_file = open(settings.REPO_ROOT / "docs" / "config.ini")
config = ConfigParser.ConfigParser()
config.readfp(config_file)
def doc_url(request):
# in the future, we will detect the locale; for now, we will
# hardcode en_us, since we only have English d... | Read from doc url mapping file at load time, rather than once per request
import ConfigParser
from django.conf import settings
def doc_url(request):
config_file = open(settings.REPO_ROOT / "docs" / "config.ini")
config = ConfigParser.ConfigParser()
config.readfp(config_file)
# in the future, we will... |
33e1b3e5fd5e9985f57cf83545c0b9053f8b9e4d | trex/urls.py | trex/urls.py | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf.urls import patterns, include, url
from django.contrib import admin
from trex.views.project import (
ProjectListCreateAPIView, ProjectDetailAPIView)
urlpat... | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf.urls import patterns, include, url
from django.contrib import admin
from trex.views.project import (
ProjectListCreateAPIView, ProjectDetailAPIView)
urlpat... | Use standard view name for project details | Use standard view name for project details
restframework by default user <modelname>-detail as view name for detail model
api views.
| Python | mit | bjoernricks/trex,bjoernricks/trex | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf.urls import patterns, include, url
from django.contrib import admin
from trex.views.project import (
ProjectListCreateAPIView, ProjectDetailAPIView)
urlpat... | Use standard view name for project details
restframework by default user <modelname>-detail as view name for detail model
api views.
# -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf.urls import patterns, inclu... |
f22cabf494f13535cdbb489f12e98c7358a29f74 | openstack/tests/functional/telemetry/v2/test_sample.py | openstack/tests/functional/telemetry/v2/test_sample.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Fix the telemetry sample test | Fix the telemetry sample test
This test works fine on devstack, but on the test gate not all
the meters have samples, so only iterate over them if there are
samples.
Partial-bug: #1665495
Change-Id: I8f327737a53194aeba08925391f1976f1b506aa0
| Python | apache-2.0 | dtroyer/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-openstacksdk,dtroyer/python-openstacksdk | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Fix the telemetry sample test
This test works fine on devstack, but on the test gate not all
the meters have samples, so only iterate over them if there are
samples.
Partial-bug: #1665495
Change-Id: I8f327737a53194aeba08925391f1976f1b506aa0
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... |
ab9adf12300246936618347f4523bcae8db3a9dd | src/creep/target.py | src/creep/target.py | #!/usr/bin/env python
import re
import urllib
def build (connection, options):
# FIXME: should use urllib.parse
match = re.match ('([+0-9A-Za-z]+)://(?:([^#/:@]+)(?::([^#/@]+))?@)?(?:([^#/:]+)(?::([0-9]+))?)?(?:/+([^#]*))?', connection)
if match is None:
return None
host = match.group (4)
password = match.gr... | #!/usr/bin/env python
import re
import urllib
def build (connection, options):
# FIXME: should use urllib.parse
match = re.match ('([+0-9A-Za-z]+)://(?:([^#/:@]+)(?::([^#/@]+))?@)?(?:([^#/:]+)(?::([0-9]+))?)?(?:/([^#]*))?', connection)
if match is None:
return None
host = match.group (4)
password = match.gro... | Fix connection parsing for absolute paths. | Fix connection parsing for absolute paths.
| Python | mit | r3c/Creep | #!/usr/bin/env python
import re
import urllib
def build (connection, options):
# FIXME: should use urllib.parse
match = re.match ('([+0-9A-Za-z]+)://(?:([^#/:@]+)(?::([^#/@]+))?@)?(?:([^#/:]+)(?::([0-9]+))?)?(?:/([^#]*))?', connection)
if match is None:
return None
host = match.group (4)
password = match.gro... | Fix connection parsing for absolute paths.
#!/usr/bin/env python
import re
import urllib
def build (connection, options):
# FIXME: should use urllib.parse
match = re.match ('([+0-9A-Za-z]+)://(?:([^#/:@]+)(?::([^#/@]+))?@)?(?:([^#/:]+)(?::([0-9]+))?)?(?:/+([^#]*))?', connection)
if match is None:
return None
... |
22ae576872e0cbe2c42e9ec4bddc050a22780531 | bika/lims/upgrade/to1010.py | bika/lims/upgrade/to1010.py | import logging
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName
def addBatches(tool):
"""
"""
portal = aq_parent(aq_inner(tool))
portal_catalog = getToolByName(portal, 'portal_catalog')
setup = port... | import logging
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName
def addBatches(tool):
"""
"""
portal = aq_parent(aq_inner(tool))
portal_catalog = getToolByName(portal, 'portal_catalog')
setup = port... | Fix 1010 upgrade step (setBatchID -> setBatch) | Fix 1010 upgrade step (setBatchID -> setBatch)
| Python | agpl-3.0 | DeBortoliWines/Bika-LIMS,DeBortoliWines/Bika-LIMS,DeBortoliWines/Bika-LIMS,rockfruit/bika.lims,anneline/Bika-LIMS,rockfruit/bika.lims,anneline/Bika-LIMS,veroc/Bika-LIMS,anneline/Bika-LIMS,labsanmartin/Bika-LIMS,veroc/Bika-LIMS,labsanmartin/Bika-LIMS,veroc/Bika-LIMS,labsanmartin/Bika-LIMS | import logging
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName
def addBatches(tool):
"""
"""
portal = aq_parent(aq_inner(tool))
portal_catalog = getToolByName(portal, 'portal_catalog')
setup = port... | Fix 1010 upgrade step (setBatchID -> setBatch)
import logging
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName
def addBatches(tool):
"""
"""
portal = aq_parent(aq_inner(tool))
portal_catalog = getToolB... |
c09bd08d5f46b2831dc5af94cd97f614f7ed3d59 | setup.py | setup.py | import os
from setuptools import setup, find_packages
def read(filename):
return open(os.path.join(os.path.dirname(__file__), filename)).read()
setup(
name='gears-handlebars',
version='0.1.2',
url='https://github.com/gears/gears-handlebars',
license='ISC',
author='Mike Yumatov',
author_e... | import os
from setuptools import setup, find_packages
def read(filename):
return open(os.path.join(os.path.dirname(__file__), filename)).read()
setup(
name='gears-handlebars',
version='0.1.2',
url='https://github.com/gears/gears-handlebars',
license='ISC',
author='Mike Yumatov',
author_e... | Add Python 3.2 to package classifiers | Add Python 3.2 to package classifiers
| Python | isc | gears/gears-handlebars,gears/gears-handlebars | import os
from setuptools import setup, find_packages
def read(filename):
return open(os.path.join(os.path.dirname(__file__), filename)).read()
setup(
name='gears-handlebars',
version='0.1.2',
url='https://github.com/gears/gears-handlebars',
license='ISC',
author='Mike Yumatov',
author_e... | Add Python 3.2 to package classifiers
import os
from setuptools import setup, find_packages
def read(filename):
return open(os.path.join(os.path.dirname(__file__), filename)).read()
setup(
name='gears-handlebars',
version='0.1.2',
url='https://github.com/gears/gears-handlebars',
license='ISC',
... |
d0c3906a0af504f61f39e1bc2f0fd43a71bda747 | sharedmock/asserters.py | sharedmock/asserters.py | from pprint import pformat
def assert_calls_equal(expected, actual):
"""
Check whether the given mock object (or mock method) calls are equal and
return a nicely formatted message.
"""
if not expected == actual:
raise_calls_differ_error(expected, actual)
def raise_calls_differ_error(expe... | from pprint import pformat
def assert_calls_equal(expected, actual):
"""
Check whether the given mock object (or mock method) calls are equal and
return a nicely formatted message.
"""
if not expected == actual:
raise_calls_differ_error(expected, actual)
def raise_calls_differ_error(expe... | Remove extraneous quote in asserter dockstring | Remove extraneous quote in asserter dockstring
| Python | apache-2.0 | elritsch/python-sharedmock | from pprint import pformat
def assert_calls_equal(expected, actual):
"""
Check whether the given mock object (or mock method) calls are equal and
return a nicely formatted message.
"""
if not expected == actual:
raise_calls_differ_error(expected, actual)
def raise_calls_differ_error(expe... | Remove extraneous quote in asserter dockstring
from pprint import pformat
def assert_calls_equal(expected, actual):
"""
Check whether the given mock object (or mock method) calls are equal and
return a nicely formatted message.
"""
if not expected == actual:
raise_calls_differ_error(expec... |
916d4e2860e231be0b2f602212931c32dcf72743 | migrations/versions/0287_drop_branding_domains.py | migrations/versions/0287_drop_branding_domains.py | """
Revision ID: 0287_drop_branding_domains
Revises: 0286_add_unique_email_name
Create Date: 2019-04-05 16:25:11.535816
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0287_drop_branding_domains'
down_revision = '0286_add_unique_email_name'
def upgrade():
... | Remove domain columns from branding table | Remove domain columns from branding table
This relationship is via the `Organisation` now; we don’t use this
column to fudge a relationship based on the user’s email address and the
matching something in these columns.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | """
Revision ID: 0287_drop_branding_domains
Revises: 0286_add_unique_email_name
Create Date: 2019-04-05 16:25:11.535816
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0287_drop_branding_domains'
down_revision = '0286_add_unique_email_name'
def upgrade():
... | Remove domain columns from branding table
This relationship is via the `Organisation` now; we don’t use this
column to fudge a relationship based on the user’s email address and the
matching something in these columns.
| |
b59efc07aed61880f29da88c095a2d9c13a145e4 | setup.py | setup.py | from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize
extensions = [
Extension("smartquadtree",
["smartquadtree.pyx", "quadtree.cpp", "neighbour.cpp"],
extra_compile_args=["-std=c++11"],
language="c++")
]
def get_long_d... | from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize
extensions = [
Extension("smartquadtree",
["smartquadtree.pyx", "quadtree.cpp", "neighbour.cpp"],
extra_compile_args=["-std=c++11"],
language="c++")
]
def get_long_d... | Add comments for Windows mingw compilation | Add comments for Windows mingw compilation
| Python | mit | xoolive/quadtree,xoolive/quadtree | from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize
extensions = [
Extension("smartquadtree",
["smartquadtree.pyx", "quadtree.cpp", "neighbour.cpp"],
extra_compile_args=["-std=c++11"],
language="c++")
]
def get_long_d... | Add comments for Windows mingw compilation
from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize
extensions = [
Extension("smartquadtree",
["smartquadtree.pyx", "quadtree.cpp", "neighbour.cpp"],
extra_compile_args=["-std=c++11"],
... |
8df7c4b2c008ce6c7735106c28bad1f7326f7012 | tests/smoketests/test_twisted.py | tests/smoketests/test_twisted.py | from twisted.internet import reactor, task
def test_deferred():
return task.deferLater(reactor, 0.05, lambda: None)
| from twisted.internet import reactor, task
from twisted.internet.defer import Deferred, succeed
from twisted.python.failure import Failure
def test_deferred():
return task.deferLater(reactor, 0.05, lambda: None)
def test_failure():
"""
Test that we can check for a failure in an asynchronously-called fun... | Add an example Twisted test that expects failure. | Add an example Twisted test that expects failure.
| Python | mit | CheeseLord/warts,CheeseLord/warts | from twisted.internet import reactor, task
from twisted.internet.defer import Deferred, succeed
from twisted.python.failure import Failure
def test_deferred():
return task.deferLater(reactor, 0.05, lambda: None)
def test_failure():
"""
Test that we can check for a failure in an asynchronously-called fun... | Add an example Twisted test that expects failure.
from twisted.internet import reactor, task
def test_deferred():
return task.deferLater(reactor, 0.05, lambda: None)
|
5a6759b131e4a61f9e7e4aaebb190a7e04b28b00 | create-colormaps.py | create-colormaps.py | """
Export colormaps from Python / matplotlib to JavaScript.
"""
# -----------------------------------------------------------------------------
# IMPORTS
# -----------------------------------------------------------------------------
import json
from matplotlib.colors import Colormap
import matplotlib.cm as cm
imp... | Update script to export colormaps | Update script to export colormaps
| Python | mit | derherrg/js-colormaps,derherrg/js-colormaps | """
Export colormaps from Python / matplotlib to JavaScript.
"""
# -----------------------------------------------------------------------------
# IMPORTS
# -----------------------------------------------------------------------------
import json
from matplotlib.colors import Colormap
import matplotlib.cm as cm
imp... | Update script to export colormaps
| |
17ffc13ba4a5eab56b66b8fe144cc53e8d02d961 | easyedit/TextArea.py | easyedit/TextArea.py | from PyQt5.Qsci import QsciScintilla, QsciLexerPython
class TextArea(QsciScintilla):
def __init__(self):
super().__init__()
self.filePath = "Untitled"
self.pythonLexer = QsciLexerPython(self)
self.setLexer(self.pythonLexer)
self.setMargins(1)
self.setMarginType(0,... | from PyQt5.Qsci import QsciScintilla, QsciLexerPython
class TextArea(QsciScintilla):
def __init__(self):
super().__init__()
self.filePath = "Untitled"
self.pythonLexer = QsciLexerPython(self)
self.setLexer(self.pythonLexer)
self.setMargins(1)
self.setMarginType(0,... | Remove debugging print statement from changeMarginWidth | Remove debugging print statement from changeMarginWidth
| Python | mit | msklosak/EasyEdit | from PyQt5.Qsci import QsciScintilla, QsciLexerPython
class TextArea(QsciScintilla):
def __init__(self):
super().__init__()
self.filePath = "Untitled"
self.pythonLexer = QsciLexerPython(self)
self.setLexer(self.pythonLexer)
self.setMargins(1)
self.setMarginType(0,... | Remove debugging print statement from changeMarginWidth
from PyQt5.Qsci import QsciScintilla, QsciLexerPython
class TextArea(QsciScintilla):
def __init__(self):
super().__init__()
self.filePath = "Untitled"
self.pythonLexer = QsciLexerPython(self)
self.setLexer(self.pythonLexer)... |
9834830788bf9fe594bf4a4e67de36231fcd8990 | stars/serializers.py | stars/serializers.py | from .models import Star
from rest_framework import serializers
class StarSerializer(serializers.ModelSerializer):
class Meta:
model = Star
fields = ('pk', 'date', 'text', 'from_user', 'to_user', 'category', 'subcategory')
class StarSmallSerializer(serializers.ModelSerializer):
class Meta:
... | from .models import Star
from employees.models import Employee
from rest_framework import serializers
class EmployeeSimpleSerializer(serializers.ModelSerializer):
class Meta:
model = Employee
fields = ('pk', 'username', 'first_name', 'last_name')
class StarSerializer(serializers.ModelSerializer)... | Add EmployeeSimpleSerializer in order to avoid publish sensitive user data such passwords and other related fields | Add EmployeeSimpleSerializer in order to avoid publish sensitive user data such passwords and other related fields
| Python | apache-2.0 | belatrix/BackendAllStars | from .models import Star
from employees.models import Employee
from rest_framework import serializers
class EmployeeSimpleSerializer(serializers.ModelSerializer):
class Meta:
model = Employee
fields = ('pk', 'username', 'first_name', 'last_name')
class StarSerializer(serializers.ModelSerializer)... | Add EmployeeSimpleSerializer in order to avoid publish sensitive user data such passwords and other related fields
from .models import Star
from rest_framework import serializers
class StarSerializer(serializers.ModelSerializer):
class Meta:
model = Star
fields = ('pk', 'date', 'text', 'from_user... |
a41a76b7e4cdf4a8cbc533550963921839dcd998 | mopidy_pandora/rpc.py | mopidy_pandora/rpc.py | import json
import requests
class RPCClient(object):
def __init__(self, hostname, port):
self.url = 'http://' + str(hostname) + ':' + str(port) + '/mopidy/rpc'
self.id = 0
def _do_rpc(self, method, params=None):
self.id += 1
data = { 'method': method, 'jsonrpc': '2.0', 'id'... | import json
import requests
class RPCClient(object):
def __init__(self, hostname, port):
self.url = 'http://' + str(hostname) + ':' + str(port) + '/mopidy/rpc'
self.id = 0
def _do_rpc(self, method, params=None):
self.id += 1
data = {'method': method, 'jsonrpc': '2.0', 'id':... | Fix formatting errors reported by flake8. | Fix formatting errors reported by flake8.
| Python | apache-2.0 | rectalogic/mopidy-pandora,jcass77/mopidy-pandora | import json
import requests
class RPCClient(object):
def __init__(self, hostname, port):
self.url = 'http://' + str(hostname) + ':' + str(port) + '/mopidy/rpc'
self.id = 0
def _do_rpc(self, method, params=None):
self.id += 1
data = {'method': method, 'jsonrpc': '2.0', 'id':... | Fix formatting errors reported by flake8.
import json
import requests
class RPCClient(object):
def __init__(self, hostname, port):
self.url = 'http://' + str(hostname) + ':' + str(port) + '/mopidy/rpc'
self.id = 0
def _do_rpc(self, method, params=None):
self.id += 1
data =... |
96a43f4ef5dae1cfdd8fd356bc3d22e98971dd00 | setup.py | setup.py | import sys
from setuptools import setup, find_packages
import populous
requirements = [
"click",
"cached-property",
"fake-factory",
"dateutils",
"PyYAML",
"peloton_bloomfilters"
]
if sys.version_info < (3, 2):
requirements.append('functools32')
setup(
name="populous",
version=po... | import sys
from setuptools import setup, find_packages
import populous
requirements = [
"click",
"cached-property",
"Faker",
"dateutils",
"PyYAML",
"peloton_bloomfilters"
]
if sys.version_info < (3, 2):
requirements.append('functools32')
setup(
name="populous",
version=populous.... | Use new 'Faker' package for fake-factory | Use new 'Faker' package for fake-factory
| Python | mit | novafloss/populous | import sys
from setuptools import setup, find_packages
import populous
requirements = [
"click",
"cached-property",
"Faker",
"dateutils",
"PyYAML",
"peloton_bloomfilters"
]
if sys.version_info < (3, 2):
requirements.append('functools32')
setup(
name="populous",
version=populous.... | Use new 'Faker' package for fake-factory
import sys
from setuptools import setup, find_packages
import populous
requirements = [
"click",
"cached-property",
"fake-factory",
"dateutils",
"PyYAML",
"peloton_bloomfilters"
]
if sys.version_info < (3, 2):
requirements.append('functools32')
... |
3bfaff43564c0776912213afefe2e25664f0b1c0 | server/server/urls.py | server/server/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from accounts import views as views
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'django_inventory.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^django/inventor... | from django.conf.urls import patterns, include, url
from django.contrib import admin
from accounts import views as views
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'django_inventory.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^django/inventor... | Add get and post functionality to the auth user stuff. | Add get and post functionality to the auth user stuff.
| Python | agpl-3.0 | TomDataworks/angular-inventory,TomDataworks/angular-inventory | from django.conf.urls import patterns, include, url
from django.contrib import admin
from accounts import views as views
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'django_inventory.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^django/inventor... | Add get and post functionality to the auth user stuff.
from django.conf.urls import patterns, include, url
from django.contrib import admin
from accounts import views as views
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'django_inventory.views.home', name='home'),
# url(r'^b... |
bd4e1c3f511ac1163e39d99fdc8e70f261023c44 | setup/create_player_seasons.py | setup/create_player_seasons.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import concurrent.futures
from db.common import session_scope
from db.player import Player
from utils.player_data_retriever import PlayerDataRetriever
def create_player_seasons(simulation=False):
data_retriever = PlayerDataRetriever()
with session_scope() as s... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import concurrent.futures
from db.common import session_scope
from db.player import Player
from utils.player_data_retriever import PlayerDataRetriever
def create_player_seasons(simulation=False):
data_retriever = PlayerDataRetriever()
with session_scope() as s... | Update player season retrieval function | Update player season retrieval function
| Python | mit | leaffan/pynhldb | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import concurrent.futures
from db.common import session_scope
from db.player import Player
from utils.player_data_retriever import PlayerDataRetriever
def create_player_seasons(simulation=False):
data_retriever = PlayerDataRetriever()
with session_scope() as s... | Update player season retrieval function
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import concurrent.futures
from db.common import session_scope
from db.player import Player
from utils.player_data_retriever import PlayerDataRetriever
def create_player_seasons(simulation=False):
data_retriever = PlayerDataR... |
d7a227ae5f0f53b5c620864df08c7b883402e968 | netmiko/brocade/brocade_nos_ssh.py | netmiko/brocade/brocade_nos_ssh.py | """Support for Brocade NOS/VDX."""
from __future__ import unicode_literals
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class BrocadeNosSSH(CiscoSSHConnection):
"""Support for Brocade NOS/VDX."""
def enable(self, *args, **kwargs):
"""No enable mode on Brocade VDX."""
... | """Support for Brocade NOS/VDX."""
from __future__ import unicode_literals
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class BrocadeNosSSH(CiscoSSHConnection):
"""Support for Brocade NOS/VDX."""
def enable(self, *args, **kwargs):
"""No enable mode on Brocade VDX."""
... | Add save_config for brocade VDX | Add save_config for brocade VDX
| Python | mit | ktbyers/netmiko,ktbyers/netmiko | """Support for Brocade NOS/VDX."""
from __future__ import unicode_literals
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class BrocadeNosSSH(CiscoSSHConnection):
"""Support for Brocade NOS/VDX."""
def enable(self, *args, **kwargs):
"""No enable mode on Brocade VDX."""
... | Add save_config for brocade VDX
"""Support for Brocade NOS/VDX."""
from __future__ import unicode_literals
import time
from netmiko.cisco_base_connection import CiscoSSHConnection
class BrocadeNosSSH(CiscoSSHConnection):
"""Support for Brocade NOS/VDX."""
def enable(self, *args, **kwargs):
"""No enab... |
99d0dc6a77144f39fce80b81247575d7c92ee4ac | footynews/db/models.py | footynews/db/models.py | from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Article(Base):
"""Model for Articles"""
__tablename__ = 'articles'
_id = Column(Int... | from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Article(Base):
"""Model for Articles"""
__tablename__ = 'articles'
_id = Column(Int... | Define repr for Article model | Define repr for Article model
| Python | apache-2.0 | footynews/fn_backend | from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Article(Base):
"""Model for Articles"""
__tablename__ = 'articles'
_id = Column(Int... | Define repr for Article model
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Article(Base):
"""Model for Articles"""
__tablename__ = '... |
944746bd3e6b40b5ceb8ef974df6c26e550318cb | paradrop/tools/pdlog/pdlog/main.py | paradrop/tools/pdlog/pdlog/main.py | import sys
import argparse
import json
import urllib
import subprocess
LOG_FILE = "/var/snap/paradrop-daemon/common/logs/log"
def parseLine(line):
try:
data = json.loads(line)
msg = urllib.unquote(data['message'])
print(msg)
except:
pass
def runTail(logFile):
cmd = ['tail... | import sys
import argparse
import json
import urllib
import subprocess
from time import sleep
LOG_FILE = "/var/snap/paradrop-daemon/common/logs/log"
def parseLine(line):
try:
data = json.loads(line)
msg = urllib.unquote(data['message'])
print(msg)
except:
pass
def runTail(log... | Make sure the paradrop.pdlog retry when the log file does not exist | Make sure the paradrop.pdlog retry when the log file does not exist
| Python | apache-2.0 | ParadropLabs/Paradrop,ParadropLabs/Paradrop,ParadropLabs/Paradrop | import sys
import argparse
import json
import urllib
import subprocess
from time import sleep
LOG_FILE = "/var/snap/paradrop-daemon/common/logs/log"
def parseLine(line):
try:
data = json.loads(line)
msg = urllib.unquote(data['message'])
print(msg)
except:
pass
def runTail(log... | Make sure the paradrop.pdlog retry when the log file does not exist
import sys
import argparse
import json
import urllib
import subprocess
LOG_FILE = "/var/snap/paradrop-daemon/common/logs/log"
def parseLine(line):
try:
data = json.loads(line)
msg = urllib.unquote(data['message'])
print(m... |
fdf014fb0602cbba476b0e35d451f43e86be7cdc | django_project/core/settings/test_travis.py | django_project/core/settings/test_travis.py | # -*- coding: utf-8 -*-
from .test import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'gis',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
# Set to empty string for default.
'PORT': '',
}
}
| # -*- coding: utf-8 -*-
from .test import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'test_db',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
# Set to empty string for default.
'PORT': '',
}... | Fix wrong db name for travis. | Fix wrong db name for travis.
| Python | bsd-2-clause | AIFDR/inasafe-django,timlinux/inasafe-django,timlinux/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,timlinux/inasafe-django,AIFDR/inasafe-django,timlinux/inasafe-django | # -*- coding: utf-8 -*-
from .test import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'test_db',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
# Set to empty string for default.
'PORT': '',
}... | Fix wrong db name for travis.
# -*- coding: utf-8 -*-
from .test import * # noqa
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'gis',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
# Set to empty string for default... |
8f815c41b505c01cbc1c57088ddc3a465f1ac07c | fmn/web/default_config.py | fmn/web/default_config.py | SECRET_KEY = 'changeme please'
# TODO -- May I set this to true?
FAS_OPENID_CHECK_CERT = False
#ADMIN_GROUPS = ['sysadmin-web']
| SECRET_KEY = 'changeme please'
# TODO -- May I set this to true?
FAS_OPENID_CHECK_CERT = False
#ADMIN_GROUPS = ['sysadmin-web']
FMN_FEDORA_OPENID = 'https://id.fedoraproject.org'
| Add a configuration key for the URL of the Fedora OpenID server | Add a configuration key for the URL of the Fedora OpenID server | Python | lgpl-2.1 | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | SECRET_KEY = 'changeme please'
# TODO -- May I set this to true?
FAS_OPENID_CHECK_CERT = False
#ADMIN_GROUPS = ['sysadmin-web']
FMN_FEDORA_OPENID = 'https://id.fedoraproject.org'
| Add a configuration key for the URL of the Fedora OpenID server
SECRET_KEY = 'changeme please'
# TODO -- May I set this to true?
FAS_OPENID_CHECK_CERT = False
#ADMIN_GROUPS = ['sysadmin-web']
|
cd735fe688840c94cb92562e3b96d51ec48afe44 | openstack/tests/functional/network/v2/test_security_group_rule.py | openstack/tests/functional/network/v2/test_security_group_rule.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add functional tests for security group rule | Add functional tests for security group rule
Tests:
test_find
test_get
test_list
Change-Id: If54342ec8c57b926a5217d888a43dcd98223bd69
| Python | apache-2.0 | dudymas/python-openstacksdk,dudymas/python-openstacksdk,dtroyer/python-openstacksdk,dtroyer/python-openstacksdk,mtougeron/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-opensta... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add functional tests for security group rule
Tests:
test_find
test_get
test_list
Change-Id: If54342ec8c57b926a5217d888a43dcd98223bd69
| |
ef41e90cf49856a6d0ca1b363440edb542dd2e0d | tests/test_config.py | tests/test_config.py | # Copyright 2015-2016 Masayuki Yamamoto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2015-2016 Masayuki Yamamoto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | Add test case for user path | Add test case for user path
Expect filepath joinning '.yanico.conf' under $HOME.
| Python | apache-2.0 | ma8ma/yanico | # Copyright 2015-2016 Masayuki Yamamoto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | Add test case for user path
Expect filepath joinning '.yanico.conf' under $HOME.
# Copyright 2015-2016 Masayuki Yamamoto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://... |
ed9601b2899aef7fcadfe7306dc1320ce72f232c | raven/transport/requests.py | raven/transport/requests.py | """
raven.transport.requests
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from raven.transport.http import HTTPTransport
try:
import requests
has_requests = True
exc... | """
raven.transport.requests
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from raven.conf import defaults
from raven.transport.http import HTTPTransport
try:
import requ... | Add support for the verify_ssl, ca_certs and timeout parameters for the request transport. | Add support for the verify_ssl, ca_certs and timeout parameters for the request transport.
| Python | bsd-3-clause | dbravender/raven-python,johansteffner/raven-python,ronaldevers/raven-python,lepture/raven-python,dbravender/raven-python,jbarbuto/raven-python,johansteffner/raven-python,nikolas/raven-python,jbarbuto/raven-python,recht/raven-python,lepture/raven-python,akheron/raven-python,jmp0xf/raven-python,arthurlogilab/raven-python... | """
raven.transport.requests
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from raven.conf import defaults
from raven.transport.http import HTTPTransport
try:
import requ... | Add support for the verify_ssl, ca_certs and timeout parameters for the request transport.
"""
raven.transport.requests
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from rav... |
e8dd4ca8bd51b84d5d7d5a6a1c4144475e066bf1 | zabbix.py | zabbix.py | import requests
class Api(object):
def __init__(self, server='http://localhost/zabbix'):
self.session = requests.Session()
self.session.headers.update({
'Content-Type': 'application/json'
})
self.url = server + '/api_jsonrpc.php'
self.auth = ''
self.id = ... | import requests
class ZabbixError(Exception):
pass
class Api(object):
def __init__(self, server='http://localhost/zabbix'):
self.session = requests.Session()
self.session.headers.update({
'Content-Type': 'application/json'
})
self.url = server + '/api_jsonrpc.php'
... | Create do_requestion function to be used by other methods. | Create do_requestion function to be used by other methods.
| Python | apache-2.0 | supasate/PythonZabbixApi | import requests
class ZabbixError(Exception):
pass
class Api(object):
def __init__(self, server='http://localhost/zabbix'):
self.session = requests.Session()
self.session.headers.update({
'Content-Type': 'application/json'
})
self.url = server + '/api_jsonrpc.php'
... | Create do_requestion function to be used by other methods.
import requests
class Api(object):
def __init__(self, server='http://localhost/zabbix'):
self.session = requests.Session()
self.session.headers.update({
'Content-Type': 'application/json'
})
self.url = server + ... |
71cdf03644215ec3032605e6772dc897d0d78b05 | Sensors/testMouse.py | Sensors/testMouse.py | from pymouse import PyMouse
import time
# This script demonstrates the possibility to use a mouse as an unbound sensor.
# To do that the cursor position is brought back to the middle of the screen at each step, and the distance moved by the mouse are integrated
# This script is intended to be used with a second externa... | Add a test to check if an optical mouse can be used as a course sensor | Add a test to check if an optical mouse can be used as a course sensor
| Python | mit | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | from pymouse import PyMouse
import time
# This script demonstrates the possibility to use a mouse as an unbound sensor.
# To do that the cursor position is brought back to the middle of the screen at each step, and the distance moved by the mouse are integrated
# This script is intended to be used with a second externa... | Add a test to check if an optical mouse can be used as a course sensor
| |
3b127af586ccfeb785a16ef432af8ce52c08a7e4 | web3/apps/request/urls.py | web3/apps/request/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url("^$", views.request_view, name="request_site"),
url("^approve$", views.approve_view, name="approve_site"),
url("^admin$", views.approve_admin_view, name="admin_site")
]
| from django.conf.urls import url
from . import views
urlpatterns = [
url(r"^$", views.request_view, name="request_site"),
url(r"^approve$", views.approve_view, name="approve_site"),
url(r"^admin$", views.approve_admin_view, name="admin_site")
]
| Use r-strings for URL regexes | Use r-strings for URL regexes
| Python | mit | tjcsl/director,tjcsl/director,tjcsl/director,tjcsl/director | from django.conf.urls import url
from . import views
urlpatterns = [
url(r"^$", views.request_view, name="request_site"),
url(r"^approve$", views.approve_view, name="approve_site"),
url(r"^admin$", views.approve_admin_view, name="admin_site")
]
| Use r-strings for URL regexes
from django.conf.urls import url
from . import views
urlpatterns = [
url("^$", views.request_view, name="request_site"),
url("^approve$", views.approve_view, name="approve_site"),
url("^admin$", views.approve_admin_view, name="admin_site")
]
|
6aad52505450b481d7b47e7ffe5c08cb7774e84a | python/testData/skeletons/BinaryStandardModule.py | python/testData/skeletons/BinaryStandardModule.py | import binascii
import datetime
import <error descr="No module named nonexistent">nonexistent</error>
print(binascii)
print(datetime)
print(nonexistent)
| import binascii
import datetime
import <error descr="No module named 'nonexistent'">nonexistent</error>
print(binascii)
print(datetime)
print(nonexistent)
| Fix test data in an env test on skeleton generation | i18n: Fix test data in an env test on skeleton generation
GitOrigin-RevId: 7be12c5b3b3a333e7e3afebe45fe32770bbdfa81 | Python | apache-2.0 | allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/int... | import binascii
import datetime
import <error descr="No module named 'nonexistent'">nonexistent</error>
print(binascii)
print(datetime)
print(nonexistent)
| i18n: Fix test data in an env test on skeleton generation
GitOrigin-RevId: 7be12c5b3b3a333e7e3afebe45fe32770bbdfa81
import binascii
import datetime
import <error descr="No module named nonexistent">nonexistent</error>
print(binascii)
print(datetime)
print(nonexistent)
|
0fed581409f0dfa4788964d02d066e8e30f1387f | webapp/byceps/blueprints/shop_admin/service.py | webapp/byceps/blueprints/shop_admin/service.py | # -*- coding: utf-8 -*-
"""
byceps.blueprints.shop_admin.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2014 Jochen Kupperschmidt
"""
from collections import Counter
from ..shop.models import PaymentState
def count_ordered_articles(article):
"""Count how often the article has been ordered, grou... | # -*- coding: utf-8 -*-
"""
byceps.blueprints.shop_admin.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2014 Jochen Kupperschmidt
"""
from collections import Counter
from ..shop.models import PaymentState
def count_ordered_articles(article):
"""Count how often the article has been ordered, grou... | Make sure every payment state is present in the counter. | Make sure every payment state is present in the counter.
| Python | bsd-3-clause | m-ober/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps | # -*- coding: utf-8 -*-
"""
byceps.blueprints.shop_admin.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2014 Jochen Kupperschmidt
"""
from collections import Counter
from ..shop.models import PaymentState
def count_ordered_articles(article):
"""Count how often the article has been ordered, grou... | Make sure every payment state is present in the counter.
# -*- coding: utf-8 -*-
"""
byceps.blueprints.shop_admin.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2014 Jochen Kupperschmidt
"""
from collections import Counter
from ..shop.models import PaymentState
def count_ordered_articles(article):... |
4a1d72300df95c666971c14d94bf77b693581d15 | problem_42.py | problem_42.py | from time import time
from itertools import permutations
DIGITS = '1234567890'
DIVS = [2, 3, 5, 7, 11, 13, 17]
def check_divs(pandigital):
for i in range(1, 8):
if int(pandigital[i:i+3]) % DIVS[i-1]:
return False
return True
def main():
print sum(
[int(''.join(p)) for p in p... | Add problem 42, pandigital substrings divisible by first primes | Add problem 42, pandigital substrings divisible by first primes
| Python | mit | dimkarakostas/project-euler | from time import time
from itertools import permutations
DIGITS = '1234567890'
DIVS = [2, 3, 5, 7, 11, 13, 17]
def check_divs(pandigital):
for i in range(1, 8):
if int(pandigital[i:i+3]) % DIVS[i-1]:
return False
return True
def main():
print sum(
[int(''.join(p)) for p in p... | Add problem 42, pandigital substrings divisible by first primes
| |
3131f282d6ad1a703939c91c0d7dc0b3e4e54046 | iati/versions.py | iati/versions.py | """A module containing components that describe the IATI Standard itself (rather than the parts it is made up of)."""
import iati.constants
class Version(object):
"""Representation of an IATI Standard Version Number."""
def __init__(self, version_string):
"""Initialise a Version Number."""
if... | """A module containing components that describe the IATI Standard itself (rather than the parts it is made up of)."""
import iati.constants
class Version(object):
"""Representation of an IATI Standard Version Number."""
def __init__(self, version_string):
"""Initialise a Version Number.
Args... | Document the current state of the Version class. | Document the current state of the Version class.
| Python | mit | IATI/iati.core,IATI/iati.core | """A module containing components that describe the IATI Standard itself (rather than the parts it is made up of)."""
import iati.constants
class Version(object):
"""Representation of an IATI Standard Version Number."""
def __init__(self, version_string):
"""Initialise a Version Number.
Args... | Document the current state of the Version class.
"""A module containing components that describe the IATI Standard itself (rather than the parts it is made up of)."""
import iati.constants
class Version(object):
"""Representation of an IATI Standard Version Number."""
def __init__(self, version_string):
... |
0db77c23b81f92b16464733404b4966d7a584f46 | sklearn/tests/test_kernel_ridge.py | sklearn/tests/test_kernel_ridge.py | import numpy as np
from sklearn.datasets import make_classification
from sklearn.linear_model import Ridge
from sklearn.kernel_ridge import KernelRidge
from sklearn.utils.testing import assert_array_almost_equal
X, y = make_classification(n_classes=2, random_state=0)
Y = np.array([y, y]).T
def test_kernel_ridge()... | TEST Added tests for KernelRidge based on @mblondel's code in lightning | TEST Added tests for KernelRidge based on @mblondel's code in lightning
| Python | bsd-3-clause | ky822/scikit-learn,IshankGulati/scikit-learn,ElDeveloper/scikit-learn,robin-lai/scikit-learn,nvoron23/scikit-learn,466152112/scikit-learn,loli/semisupervisedforests,sumspr/scikit-learn,pypot/scikit-learn,Sentient07/scikit-learn,jereze/scikit-learn,MohammedWasim/scikit-learn,kevin-intel/scikit-learn,ishanic/scikit-learn... | import numpy as np
from sklearn.datasets import make_classification
from sklearn.linear_model import Ridge
from sklearn.kernel_ridge import KernelRidge
from sklearn.utils.testing import assert_array_almost_equal
X, y = make_classification(n_classes=2, random_state=0)
Y = np.array([y, y]).T
def test_kernel_ridge()... | TEST Added tests for KernelRidge based on @mblondel's code in lightning
| |
6136fc2bd2d9d191df7a9e6afd3aa9e4f110d61e | numpy/core/tests/test_print.py | numpy/core/tests/test_print.py | import numpy as np
from numpy.testing import *
class TestPrint(TestCase):
def test_float_types(self) :
""" Check formatting.
This is only for the str function, and only for simple types.
The precision of np.float and np.longdouble aren't the same as the
python float pr... | import numpy as np
from numpy.testing import *
def check_float_type(tp):
for x in [0, 1,-1, 1e10, 1e20] :
assert_equal(str(tp(x)), str(float(x)))
def test_float_types():
""" Check formatting.
This is only for the str function, and only for simple types.
The precision of np.float and n... | Use parametric tests for format tests so that it is clearer which type is failing. | Use parametric tests for format tests so that it is clearer which type is failing.
| Python | bsd-3-clause | solarjoe/numpy,NextThought/pypy-numpy,musically-ut/numpy,trankmichael/numpy,ViralLeadership/numpy,b-carter/numpy,argriffing/numpy,ogrisel/numpy,mhvk/numpy,mingwpy/numpy,b-carter/numpy,ewmoore/numpy,jakirkham/numpy,ahaldane/numpy,KaelChen/numpy,mhvk/numpy,utke1/numpy,ogrisel/numpy,skymanaditya1/numpy,rmcgibbo/numpy,embr... | import numpy as np
from numpy.testing import *
def check_float_type(tp):
for x in [0, 1,-1, 1e10, 1e20] :
assert_equal(str(tp(x)), str(float(x)))
def test_float_types():
""" Check formatting.
This is only for the str function, and only for simple types.
The precision of np.float and n... | Use parametric tests for format tests so that it is clearer which type is failing.
import numpy as np
from numpy.testing import *
class TestPrint(TestCase):
def test_float_types(self) :
""" Check formatting.
This is only for the str function, and only for simple types.
The precis... |
346ddf5e26351fe1fadbed1bf06482565080a728 | stack.py | stack.py | #!/usr/bin/env python
'''Implementation of a simple stack data structure.
The stack has push, pop, and peek methods. Items in the stack have a value,
and next_item attribute. The stack has a top attribute.
'''
class Item(object):
def __init__(self, value, next_item=None):
self.value = value
self.... | #!/usr/bin/env python
'''Implementation of a simple stack data structure.
The stack has push, pop, and peek methods. Items in the stack have a value,
and next_item attribute. The stack has a top attribute.
'''
class Item(object):
def __init__(self, value, next_item=None):
self.value = value
self.... | Add pop method on Stack class | Add pop method on Stack class
| Python | mit | jwarren116/data-structures-deux | #!/usr/bin/env python
'''Implementation of a simple stack data structure.
The stack has push, pop, and peek methods. Items in the stack have a value,
and next_item attribute. The stack has a top attribute.
'''
class Item(object):
def __init__(self, value, next_item=None):
self.value = value
self.... | Add pop method on Stack class
#!/usr/bin/env python
'''Implementation of a simple stack data structure.
The stack has push, pop, and peek methods. Items in the stack have a value,
and next_item attribute. The stack has a top attribute.
'''
class Item(object):
def __init__(self, value, next_item=None):
s... |
81a90abae2545b29d04b400923725a18816bacba | test/test_github_trending.py | test/test_github_trending.py | import unittest
from githubtrending import trending as githubtrending
from . import data
class TestGithubTrending(unittest.TestCase):
def test_read_page(self):
for each in data.READ_PAGE_DATA:
url = each.get('url')
expected_status_code = each.get('status_code')
respon... | Add test case for read_page | Test: Add test case for read_page
| Python | mit | staranjeet/github-trending-cli | import unittest
from githubtrending import trending as githubtrending
from . import data
class TestGithubTrending(unittest.TestCase):
def test_read_page(self):
for each in data.READ_PAGE_DATA:
url = each.get('url')
expected_status_code = each.get('status_code')
respon... | Test: Add test case for read_page
| |
5386edbd7c88a1f53c88869abbf63c00ce212352 | pyaxiom/netcdf/utils.py | pyaxiom/netcdf/utils.py | #!python
# coding=utf-8
def cf_safe_name(name):
import re
if isinstance(name, str):
if re.match('^[0-9_]', name):
# Add a letter to the front
name = "v_{}".format(name)
return re.sub(r'[^_a-zA-Z0-9]', "_", name)
| #!python
# coding=utf-8
def isstr(s):
try:
return isinstance(s, basestring)
except NameError:
return isinstance(s, str)
def cf_safe_name(name):
import re
if isstr(name):
if re.match('^[0-9_]', name):
# Add a letter to the front
name = "v_{}".format(nam... | Fix cf_safe_name for python 2.7 | Fix cf_safe_name for python 2.7
| Python | mit | axiom-data-science/pyaxiom,axiom-data-science/pyaxiom | #!python
# coding=utf-8
def isstr(s):
try:
return isinstance(s, basestring)
except NameError:
return isinstance(s, str)
def cf_safe_name(name):
import re
if isstr(name):
if re.match('^[0-9_]', name):
# Add a letter to the front
name = "v_{}".format(nam... | Fix cf_safe_name for python 2.7
#!python
# coding=utf-8
def cf_safe_name(name):
import re
if isinstance(name, str):
if re.match('^[0-9_]', name):
# Add a letter to the front
name = "v_{}".format(name)
return re.sub(r'[^_a-zA-Z0-9]', "_", name)
|
d7b5cd3c3ef51aef5264542fae03322955bd5ca8 | appengine_config.py | appengine_config.py | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Appstats... | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Appstats... | Switch Django version from 1.0 to 1.1 | Switch Django version from 1.0 to 1.1
| Python | apache-2.0 | ligthyear/quick-check,ligthyear/quick-check | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Appstats... | Switch Django version from 1.0 to 1.1
"""Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_m... |
5c7400a2e70e5d9ee7f8a73e43abbf0f7b992152 | ibei/main.py | ibei/main.py | # -*- coding: utf-8 -*-
import numpy as np
from astropy import constants
from astropy import units
from sympy.mpmath import polylog
def uibei(order, energy_lo, temp, chem_potential):
"""
Upper incomplete Bose-Einstein integral.
"""
kT = temp * constants.k_B
reduced_energy_lo = energy_lo / kT
... | Add first draft of upper incomplete Bose-Einstein integral | Add first draft of upper incomplete Bose-Einstein integral
| Python | mit | jrsmith3/tec,jrsmith3/tec,jrsmith3/ibei | # -*- coding: utf-8 -*-
import numpy as np
from astropy import constants
from astropy import units
from sympy.mpmath import polylog
def uibei(order, energy_lo, temp, chem_potential):
"""
Upper incomplete Bose-Einstein integral.
"""
kT = temp * constants.k_B
reduced_energy_lo = energy_lo / kT
... | Add first draft of upper incomplete Bose-Einstein integral
| |
b72c421696b5714d256b7ac461833bc692ca5354 | robot/robot/src/autonomous/hot_aim_shoot.py | robot/robot/src/autonomous/hot_aim_shoot.py |
try:
import wpilib
except ImportError:
from pyfrc import wpilib
import timed_shoot
class HotShootAutonomous(timed_shoot.TimedShootAutonomous):
'''
Based on the TimedShootAutonomous mode. Modified to allow
shooting based on whether the hot goal is enabled or not.
'''
... | Add an autonomous mode to strafe and shoot. Doesn't work | Add an autonomous mode to strafe and shoot. Doesn't work
| Python | bsd-3-clause | frc1418/2014 |
try:
import wpilib
except ImportError:
from pyfrc import wpilib
import timed_shoot
class HotShootAutonomous(timed_shoot.TimedShootAutonomous):
'''
Based on the TimedShootAutonomous mode. Modified to allow
shooting based on whether the hot goal is enabled or not.
'''
... | Add an autonomous mode to strafe and shoot. Doesn't work
| |
b60f9f22703d97cfaeaa69e36fe283d1ef5d2f5d | download_data.py | download_data.py | import bz2
import urllib.request
OPEN_CORPORA_URL = 'http://opencorpora.org/files/export/annot/annot.opcorpora.no_ambig.xml.bz2'
OPEN_CORPORA_DEST_FILE = 'data/annot.opcorpora.no_ambig.xml'
CHUNK = 16 * 1024
def download_and_unbzip(url, dest_file):
source = urllib.request.urlopen(url)
decompressor ... | import bz2
import urllib.request
import os
import os.path
DATA_DIR = 'data'
OPEN_CORPORA_URL = 'http://opencorpora.org/files/export/annot/annot.opcorpora.no_ambig.xml.bz2'
OPEN_CORPORA_DEST_FILE = 'data/annot.opcorpora.no_ambig.xml'
CHUNK = 16 * 1024
def download_and_unbzip(url, dest_file):
source = ... | Create dir before data downloading | Create dir before data downloading
| Python | mit | Nizametdinov/cnn-pos-tagger | import bz2
import urllib.request
import os
import os.path
DATA_DIR = 'data'
OPEN_CORPORA_URL = 'http://opencorpora.org/files/export/annot/annot.opcorpora.no_ambig.xml.bz2'
OPEN_CORPORA_DEST_FILE = 'data/annot.opcorpora.no_ambig.xml'
CHUNK = 16 * 1024
def download_and_unbzip(url, dest_file):
source = ... | Create dir before data downloading
import bz2
import urllib.request
OPEN_CORPORA_URL = 'http://opencorpora.org/files/export/annot/annot.opcorpora.no_ambig.xml.bz2'
OPEN_CORPORA_DEST_FILE = 'data/annot.opcorpora.no_ambig.xml'
CHUNK = 16 * 1024
def download_and_unbzip(url, dest_file):
source = urllib.req... |
e0fa24595a60dd3c2ab5d1b64a76bae9ce3c05a8 | testproject/testapp/tests/test_root.py | testproject/testapp/tests/test_root.py | from djet import assertions, restframework
from rest_framework import status
import djoser.constants
import djoser.utils
import djoser.views
class RootViewTest(restframework.APIViewTestCase,
assertions.StatusCodeAssertionsMixin):
view_class = djoser.views.RootView
def test_get_should_retur... | from djet import assertions, restframework
from rest_framework import status
import djoser.constants
import djoser.utils
import djoser.views
class RootViewTest(restframework.APIViewTestCase,
assertions.StatusCodeAssertionsMixin):
view_class = djoser.views.RootView
def test_get_should_retur... | Add test for non existent url pattern | Add test for non existent url pattern
| Python | mit | akalipetis/djoser,sunscrapers/djoser,akalipetis/djoser,sunscrapers/djoser,sunscrapers/djoser | from djet import assertions, restframework
from rest_framework import status
import djoser.constants
import djoser.utils
import djoser.views
class RootViewTest(restframework.APIViewTestCase,
assertions.StatusCodeAssertionsMixin):
view_class = djoser.views.RootView
def test_get_should_retur... | Add test for non existent url pattern
from djet import assertions, restframework
from rest_framework import status
import djoser.constants
import djoser.utils
import djoser.views
class RootViewTest(restframework.APIViewTestCase,
assertions.StatusCodeAssertionsMixin):
view_class = djoser.views.... |
19cb68209252615c66cee0a1c6df1069f81f6f77 | stock_request_picking_type/models/stock_request_order.py | stock_request_picking_type/models/stock_request_order.py | # Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class StockRequestOrder(models.Model):
_inherit = 'stock.request.order'
@api.model
def _get_default_picking_type(self):
return self.env['stock.picki... | # Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class StockRequestOrder(models.Model):
_inherit = 'stock.request.order'
@api.model
def _get_default_picking_type(self):
return self.env['stock.picki... | Set Picking Type in Create | [IMP] Set Picking Type in Create
[IMP] Flake8
| Python | agpl-3.0 | Vauxoo/stock-logistics-warehouse,Vauxoo/stock-logistics-warehouse,Vauxoo/stock-logistics-warehouse | # Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class StockRequestOrder(models.Model):
_inherit = 'stock.request.order'
@api.model
def _get_default_picking_type(self):
return self.env['stock.picki... | [IMP] Set Picking Type in Create
[IMP] Flake8
# Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class StockRequestOrder(models.Model):
_inherit = 'stock.request.order'
@api.model
def _get_default_picking_... |
ba23b9845da33682f4b37eaa22b955846786d9af | views.py | views.py | from django.shortcuts import render_to_response
from django.template import RequestContext
from feincms.models import Page
def handler(request, path):
page = Page.objects.page_for_path_or_404(path)
return render_to_response(page.template.path, {
'page': page,
}, context_instance=RequestConte... | Add basic cms page handler | Add basic cms page handler
| Python | bsd-3-clause | hgrimelid/feincms,nickburlett/feincms,joshuajonah/feincms,matthiask/feincms2-content,nickburlett/feincms,hgrimelid/feincms,matthiask/feincms2-content,michaelkuty/feincms,matthiask/django-content-editor,joshuajonah/feincms,feincms/feincms,michaelkuty/feincms,pjdelport/feincms,michaelkuty/feincms,joshuajonah/feincms,mjl/... | from django.shortcuts import render_to_response
from django.template import RequestContext
from feincms.models import Page
def handler(request, path):
page = Page.objects.page_for_path_or_404(path)
return render_to_response(page.template.path, {
'page': page,
}, context_instance=RequestConte... | Add basic cms page handler
| |
c87e206d524137e9e76166faf20d5b1e10419220 | senlin/tests/tempest/api/profiles/test_profile_delete.py | senlin/tests/tempest/api/profiles/test_profile_delete.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add API tests for profile delete | Add API tests for profile delete
Add API tests for profile delete
Change-Id: I47a733ce203ba76fc57080a1b086661720e83930
| Python | apache-2.0 | openstack/senlin,openstack/senlin,stackforge/senlin,openstack/senlin,stackforge/senlin | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add API tests for profile delete
Add API tests for profile delete
Change-Id: I47a733ce203ba76fc57080a1b086661720e83930
| |
d3ac6ba3ecd754f6f996eaa9107ea1d28074e4a3 | src/python/tests/generators/transaction_generators/test_customer_transaction_parameters_generator.py | src/python/tests/generators/transaction_generators/test_customer_transaction_parameters_generator.py | import unittest
import simulation_parameters as sim_param
from generators.transaction_generator.customer_transaction_parameters_generator import CustomerTransactionParameters
from generators.transaction_generator.customer_transaction_parameters_generator import CustomerTransactionParametersGenerator
class TestCustom... | Add unit tests for customer transaction parameters generator.py | Add unit tests for customer transaction parameters generator.py
| Python | apache-2.0 | rnowling/bigpetstore-data-generator,rnowling/bigpetstore-data-generator,rnowling/bigpetstore-data-generator | import unittest
import simulation_parameters as sim_param
from generators.transaction_generator.customer_transaction_parameters_generator import CustomerTransactionParameters
from generators.transaction_generator.customer_transaction_parameters_generator import CustomerTransactionParametersGenerator
class TestCustom... | Add unit tests for customer transaction parameters generator.py
| |
99a1ce2ecee6dd761113515da5c89b8c7da5537f | Python/Algorithm.py | Python/Algorithm.py | class Algorithm:
"""
Algorithm Class
Base class for the page substitution algorithms.
"""
def __init__(self, input = []):
"""
Algorithm Constructor.
Parameters
----------
input : list
A list containing the the input page swap.
"""
if not input: #If the list is empty throw an exception.
raise... | class Algorithm:
"""
Algorithm Class
Base class for the page substitution algorithms.
"""
def __init__(self, input = []):
"""
Algorithm Constructor.
Parameters
----------
input : list
A list containing the the input page swap.
"""
if not input: #If the list is empty throw an exception.
raise... | Fix logic error under preparePageFrames | Fix logic error under preparePageFrames
| Python | mit | caiomcg/OS-PageSubstitution | class Algorithm:
"""
Algorithm Class
Base class for the page substitution algorithms.
"""
def __init__(self, input = []):
"""
Algorithm Constructor.
Parameters
----------
input : list
A list containing the the input page swap.
"""
if not input: #If the list is empty throw an exception.
raise... | Fix logic error under preparePageFrames
class Algorithm:
"""
Algorithm Class
Base class for the page substitution algorithms.
"""
def __init__(self, input = []):
"""
Algorithm Constructor.
Parameters
----------
input : list
A list containing the the input page swap.
"""
if not input: #If the l... |
ace25952c3590f2b130b064815c90658f4495cb5 | code/marv/marv/app/wsgi.py | code/marv/marv/app/wsgi.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import os
from marv_cli import setup_logging
setup_logging(os.environ.get('MARV_LOGLEVEL', 'info'))
config = os.environ['MARV_CONFIG']
app_root = os.environ['MARV_APPLICATION_ROOT']
import marv.app
import marv.site
... | # -*- coding: utf-8 -*-
#
# Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import os
from marv_cli import setup_logging
setup_logging(os.environ.get('MARV_LOGLEVEL', 'info'))
config = os.environ['MARV_CONFIG']
app_root = os.environ.get('MARV_APPLICATION_ROOT') or '/'
import marv.app
import... | Make fetching application root from env less error-prone | [marv] Make fetching application root from env less error-prone
| Python | agpl-3.0 | ternaris/marv-robotics,ternaris/marv-robotics | # -*- coding: utf-8 -*-
#
# Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import os
from marv_cli import setup_logging
setup_logging(os.environ.get('MARV_LOGLEVEL', 'info'))
config = os.environ['MARV_CONFIG']
app_root = os.environ.get('MARV_APPLICATION_ROOT') or '/'
import marv.app
import... | [marv] Make fetching application root from env less error-prone
# -*- coding: utf-8 -*-
#
# Copyright 2016 - 2018 Ternaris.
# SPDX-License-Identifier: AGPL-3.0-only
import os
from marv_cli import setup_logging
setup_logging(os.environ.get('MARV_LOGLEVEL', 'info'))
config = os.environ['MARV_CONFIG']
app_root = os.en... |
ec31a66014c00a916eb49d78557e6ddb0c4dbb50 | dakota_utils/tests/test_write.py | dakota_utils/tests/test_write.py | #!/usr/bin/env python
#
# Tests for dakota_utils.write.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper (mark.piper@colorado.edu)
from nose.tools import *
import os
import tempfile
import shutil
from dakota_utils.file import touch, remove
from dakota_utils.write import *
nonfile = 'fbwiBVBVFVBvVB.txt'
def setup_mo... | Add unit tests for write module | Add unit tests for write module
| Python | mit | mdpiper/dakota-experiments,mdpiper/dakota-experiments,mcflugen/dakota-experiments,mcflugen/dakota-experiments,mdpiper/dakota-experiments | #!/usr/bin/env python
#
# Tests for dakota_utils.write.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper (mark.piper@colorado.edu)
from nose.tools import *
import os
import tempfile
import shutil
from dakota_utils.file import touch, remove
from dakota_utils.write import *
nonfile = 'fbwiBVBVFVBvVB.txt'
def setup_mo... | Add unit tests for write module
| |
6182cc9f1b58f96479a46dea03ffe98a6244e7e0 | viewer_examples/plugins/canny_simple.py | viewer_examples/plugins/canny_simple.py | from skimage import data
from skimage.filter import canny
from skimage.viewer import ImageViewer
from skimage.viewer.widgets import Slider
from skimage.viewer.plugins.overlayplugin import OverlayPlugin
image = data.camera()
# Note: ImageViewer must be called before Plugin b/c it starts the event loop.
viewer = Image... | Add example of adding widgets to plugin | ENH: Add example of adding widgets to plugin
| Python | bsd-3-clause | bennlich/scikit-image,pratapvardhan/scikit-image,emon10005/scikit-image,juliusbierk/scikit-image,Hiyorimi/scikit-image,paalge/scikit-image,emon10005/scikit-image,SamHames/scikit-image,rjeli/scikit-image,dpshelio/scikit-image,paalge/scikit-image,chintak/scikit-image,Midafi/scikit-image,ofgulban/scikit-image,ofgulban/sci... | from skimage import data
from skimage.filter import canny
from skimage.viewer import ImageViewer
from skimage.viewer.widgets import Slider
from skimage.viewer.plugins.overlayplugin import OverlayPlugin
image = data.camera()
# Note: ImageViewer must be called before Plugin b/c it starts the event loop.
viewer = Image... | ENH: Add example of adding widgets to plugin
| |
624d6e4fc5455720badf4315e06f423eb60411ab | scripts/init_tree.py | scripts/init_tree.py | import os
import shutil
def main():
cwd = os.getcwd()
if not cwd.endswith(os.path.join('FRENSIE', 'scripts')):
print 'This script must be run in \"FRENSIE/scipts\"'
print 'Your CWD is', cwd
return 1
os.chdir('../../')
os.mkdir('frensie_build_tree')
#os.renames('FRENSIE'... | import os
import shutil
def main():
cwd = os.getcwd()
if not cwd.endswith(os.path.join('FRENSIE', 'scripts')):
print 'This script must be run in \"FRENSIE/scipts\"'
print 'Your CWD is', cwd
return 1
os.chdir('../../')
os.mkdir('frensie_build_tree')
#os.renames('FRENSIE'... | Update to copy new scripts | Update to copy new scripts
| Python | bsd-3-clause | lkersting/SCR-2123,lkersting/SCR-2123,lkersting/SCR-2123,lkersting/SCR-2123 | import os
import shutil
def main():
cwd = os.getcwd()
if not cwd.endswith(os.path.join('FRENSIE', 'scripts')):
print 'This script must be run in \"FRENSIE/scipts\"'
print 'Your CWD is', cwd
return 1
os.chdir('../../')
os.mkdir('frensie_build_tree')
#os.renames('FRENSIE'... | Update to copy new scripts
import os
import shutil
def main():
cwd = os.getcwd()
if not cwd.endswith(os.path.join('FRENSIE', 'scripts')):
print 'This script must be run in \"FRENSIE/scipts\"'
print 'Your CWD is', cwd
return 1
os.chdir('../../')
os.mkdir('frensie_build_tree... |
1823d4a41685111b8b70c28ab742b864f205b171 | 006.py | 006.py | """
Project Euler Problem 6
=======================
The sum of the squares of the first ten natural numbers is,
1^2 + 2^2 + ... + 10^2 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)^2 = 55^2 = 3025
Hence the difference between the sum of... | Add solution and unit tests for problem 6 | Add solution and unit tests for problem 6
| Python | mit | BeataBak/project-euler-problems | """
Project Euler Problem 6
=======================
The sum of the squares of the first ten natural numbers is,
1^2 + 2^2 + ... + 10^2 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)^2 = 55^2 = 3025
Hence the difference between the sum of... | Add solution and unit tests for problem 6
| |
aa5259efac8f7fbe8e2afd263198feaaa45fc4c3 | tingbot/platform_specific/__init__.py | tingbot/platform_specific/__init__.py | import platform
def is_tingbot():
"""return True if running as a tingbot. We can update this function to be more smart in future"""
return platform.machine().startswith('armv71')
if platform.system() == 'Darwin':
from osx import fixup_env, create_main_surface, register_button_callback
elif is_tingbot():
... | import platform, os
def is_tingbot():
"""
Return True if running as a tingbot.
"""
# TB_RUN_ON_LCD is an environment variable set by tbprocessd when running tingbot apps.
return 'TB_RUN_ON_LCD' in os.environ
if platform.system() == 'Darwin':
from osx import fixup_env, create_main_surface, regi... | Change test for running on Tingbot | Change test for running on Tingbot
| Python | bsd-2-clause | furbrain/tingbot-python | import platform, os
def is_tingbot():
"""
Return True if running as a tingbot.
"""
# TB_RUN_ON_LCD is an environment variable set by tbprocessd when running tingbot apps.
return 'TB_RUN_ON_LCD' in os.environ
if platform.system() == 'Darwin':
from osx import fixup_env, create_main_surface, regi... | Change test for running on Tingbot
import platform
def is_tingbot():
"""return True if running as a tingbot. We can update this function to be more smart in future"""
return platform.machine().startswith('armv71')
if platform.system() == 'Darwin':
from osx import fixup_env, create_main_surface, register_... |
f8eb09c5ffca469b72e51db783c667f83ca56237 | server/users-microservice/src/config/database.py | server/users-microservice/src/config/database.py | dbDevURI = 'mysql://usersmicroserviceuser:M@+=mm26xt22$%)(@localhost:3306/usersmicroservice'
dbURI = 'mysql://root:root@mysql:3306/usersmicroservice' | dbDevURI = 'mysql://localroot:localroot@localhost:3306/usersmicroservice'
dbURI = 'mysql://root:root@mysql:3306/usersmicroservice' | Create a local root user for users micro service | Create a local root user for users micro service
| Python | mit | Madmous/madClones,Madmous/Trello-Clone,Madmous/madClones,Madmous/Trello-Clone,Madmous/madClones,Madmous/madClones,Madmous/Trello-Clone | dbDevURI = 'mysql://localroot:localroot@localhost:3306/usersmicroservice'
dbURI = 'mysql://root:root@mysql:3306/usersmicroservice' | Create a local root user for users micro service
dbDevURI = 'mysql://usersmicroserviceuser:M@+=mm26xt22$%)(@localhost:3306/usersmicroservice'
dbURI = 'mysql://root:root@mysql:3306/usersmicroservice' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.