commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
ad6b7fe871be502220de5bcb6c2a65f4e7999294 | etcd3/client.py | etcd3/client.py | import grpc
from etcd3.etcdrpc import rpc_pb2 as etcdrpc
import etcd3.exceptions as exceptions
class Etcd3Client(object):
def __init__(self, host='localhost', port=2379):
self.channel = grpc.insecure_channel('{host}:{port}'.format(
host=host, port=port)
)
self.kvstub = etcdrpc... | import grpc
from etcd3.etcdrpc import rpc_pb2 as etcdrpc
import etcd3.exceptions as exceptions
class Etcd3Client(object):
def __init__(self, host='localhost', port=2379):
self.channel = grpc.insecure_channel('{host}:{port}'.format(
host=host, port=port)
)
self.kvstub = etcdrpc... | Add compact and delete stubs | Add compact and delete stubs
| Python | apache-2.0 | kragniz/python-etcd3 |
5e61515eb6d07004ae2d3eb8f8d7ffe59b351a8c | migrations/versions/0003_create_tokens.py | migrations/versions/0003_create_tokens.py | """empty message
Revision ID: 0003_create_tokens
Revises: 0001_initialise_data
Create Date: 2016-01-13 17:07:49.061776
"""
# revision identifiers, used by Alembic.
revision = '0003_create_tokens'
down_revision = '0001_initialise_data'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands ... | """empty message
Revision ID: 0003_create_tokens
Revises: 0001_initialise_data
Create Date: 2016-01-13 17:07:49.061776
"""
# revision identifiers, used by Alembic.
revision = '0003_create_tokens'
down_revision = '0002_add_templates'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands au... | Fix the migration script so that the down revision is pointing to the migration scripts in the merge | Fix the migration script so that the down revision is pointing to the migration scripts in the merge
| Python | mit | alphagov/notifications-api,alphagov/notifications-api |
6ae61fe99c6ab98b866a8ecf28a5503febc697d6 | pypuppetdbquery/__init__.py | pypuppetdbquery/__init__.py | # -*- coding: utf-8 -*-
#
# This file is part of pypuppetdbquery.
# Copyright © 2016 Chris Boot <bootc@bootc.net>
#
# 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.or... | # -*- coding: utf-8 -*-
#
# This file is part of pypuppetdbquery.
# Copyright © 2016 Chris Boot <bootc@bootc.net>
#
# 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.or... | Return JSON from pypuppetdbquery.parse() by default | Return JSON from pypuppetdbquery.parse() by default
This will be the most useful mode of operation when combined with
pypuppetdb, so make life easy for people.
| Python | apache-2.0 | bootc/pypuppetdbquery |
4c240f17571b5e63805a2632e5e8a6c1d3695d54 | examples/00-load/create-tri-surface.py | examples/00-load/create-tri-surface.py | """
Create Triangulated Surface
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create a surface from a set of points through a Delaunay triangulation.
"""
# sphinx_gallery_thumbnail_number = 2
import vtki
import numpy as np
################################################################################
# First, create some points fo... | """
Create Triangulated Surface
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create a surface from a set of points through a Delaunay triangulation.
"""
# sphinx_gallery_thumbnail_number = 2
import vtki
import numpy as np
################################################################################
# First, create some points fo... | Increase point size in example | Increase point size in example
| Python | mit | akaszynski/vtkInterface |
5437d5135213fec4390d208174cda1e5c1a57674 | manager/context_processor.py | manager/context_processor.py | # This file is part of Workout Manager.
#
# Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Workout Manage... | # This file is part of Workout Manager.
#
# Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Workout Manage... | Set a default if the browser doesn't send the DNT header | Set a default if the browser doesn't send the DNT header
| Python | agpl-3.0 | wger-project/wger,wger-project/wger,DeveloperMal/wger,kjagoo/wger_stark,wger-project/wger,rolandgeider/wger,DeveloperMal/wger,petervanderdoes/wger,DeveloperMal/wger,DeveloperMal/wger,kjagoo/wger_stark,rolandgeider/wger,rolandgeider/wger,wger-project/wger,petervanderdoes/wger,rolandgeider/wger,petervanderdoes/wger,peter... |
d8d3f01bf9fdbae8b5eed05d44b5e811c1af3de4 | billjobs/urls.py | billjobs/urls.py | from django.conf.urls import url, include
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
urlpatterns = [
url(r'^generate_pdf/(?P<bill_id>\d+)$', views.generate_pdf,
name='generate-pdf'),
url(r'^', include(router.urls... | from django.conf.urls import url, include
from . import views
urlpatterns = [
url(r'^generate_pdf/(?P<bill_id>\d+)$', views.generate_pdf,
name='generate-pdf'),
url(r'^users/$', views.UserAdmin.as_view(), name='users'),
url(r'^users/(?P<pk>[0-9]+)/$', views.UserAdminDetail.as_view(), name='user-deta... | Remove rest_framework routers, add urlpattern for users api | Remove rest_framework routers, add urlpattern for users api
| Python | mit | ioO/billjobs |
88fa9a0841f7f7774b57b9d8731fb7334d799259 | formidable/json_migrations/__init__.py | formidable/json_migrations/__init__.py | import os
import sys
from glob import glob
from importlib import import_module
__all__ = ['migrate', 'get_migrations']
HERE = os.path.dirname(__file__)
package = sys.modules[__name__].__name__
def get_migrations():
for module in sorted(glob(os.path.join(HERE, '[0-9]*.py'))):
module_name, _ = os.path.ba... | import os
import sys
from glob import glob
from importlib import import_module
__all__ = ['migrate', 'get_migrations']
HERE = os.path.dirname(__file__)
package = sys.modules[__name__].__name__
def get_migrations():
"""
Return a generator with all JSON migrations sorted.
Each item is a tuple with:
... | Add docstrings to JSON migrations functions | Add docstrings to JSON migrations functions
| Python | mit | novafloss/django-formidable |
35b5215cd16493fea00c7ebb2106c633ce4c6a9b | qutebrowser/config.py | qutebrowser/config.py | config.load_autoconfig()
c.tabs.background = True
c.new_instance_open_target = 'window'
c.downloads.position = 'bottom'
c.spellcheck.languages = ['en-US']
config.bind(',ce', 'config-edit')
config.bind(',p', 'config-cycle -p content.plugins ;; reload')
config.bind(',rta', 'open {url}top/?sort=top&t=all')
config.bind(... | config.load_autoconfig()
c.tabs.background = True
c.new_instance_open_target = 'window'
c.downloads.position = 'bottom'
c.spellcheck.languages = ['en-US']
config.bind(',ce', 'config-edit')
config.bind(',p', 'config-cycle -p content.plugins ;; reload')
config.bind(',rta', 'open {url}top/?sort=top&t=all')
config.bind(... | Use Arial as Fantasy font | qutebrowser: Use Arial as Fantasy font
| Python | mit | The-Compiler/dotfiles,The-Compiler/dotfiles,The-Compiler/dotfiles |
ebe1fed581c7a2eeab6dc7c4f6304e7aa634e942 | regenesis/database.py | regenesis/database.py | import logging
import sqlaload as sl
from regenesis.core import app, engine
log = logging.getLogger(__name__)
def load_cube(cube):
cube_table = sl.get_table(engine, 'cube')
sl.upsert(engine, cube_table, cube.to_row(), ['name'])
statistic_table = sl.get_table(engine, 'statistic')
sl.upsert(engine... | import logging
import sqlaload as sl
from regenesis.core import app, engine
log = logging.getLogger(__name__)
def load_cube(cube):
cube_table = sl.get_table(engine, 'cube')
if sl.find_one(engine, cube_table, name=cube.name):
return
sl.upsert(engine, cube_table, cube.to_row(), ['name'])
... | Speed up loading, don't update for now. | Speed up loading, don't update for now. | Python | mit | pudo/regenesis,pudo/regenesis |
9c848315eba6580249d1f9fc5b598a08ec818fed | tests/test_functions.py | tests/test_functions.py | """This module tests the TimeFunction class"""
import pytest
import pandas as pd
from tssim.functions import TimeFunction
@pytest.fixture
def ts():
"""Setup test data.
"""
periods = 10
index = pd.date_range("2017-04-12", periods=periods)
return pd.Series(range(periods), index)
def test_... | """This module tests the TimeFunction class"""
import pandas as pd
import pytest
import tssim
@pytest.fixture
def ts():
"""Setup test data.
"""
periods = 10
index = pd.date_range("2017-04-12", periods=periods)
return pd.Series(range(periods), index)
def test_vectorized_no_condition(ts):
... | Update reference in TimeFunction test. | Update reference in TimeFunction test.
| Python | mit | mansenfranzen/tssim |
5b2f835f377481c6c217dd886f28c1bb400db553 | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by ckaznocha
# Copyright (c) 2014 ckaznocha
#
# License: MIT
#
"""This module exports the CFLint plugin class."""
from SublimeLinter.lint import Linter, util
class CFLint(Linter):
"""Provides an i... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by ckaznocha
# Copyright (c) 2014 ckaznocha
#
# License: MIT
#
"""This module exports the CFLint plugin class."""
from SublimeLinter.lint import Linter, util
class CFLint(Linter):
"""Provides an i... | Update cmd to allow args | Update cmd to allow args
Change the cmd string so that the "args" argument can be used in linter settings. The way it was any args would be inserted between the '-file' and the filename which broke the '-file' argument.
For this config,
"cflint": {
"@disable": false,
"args": ['-configfile c:\cflintrc.xml... | Python | mit | ckaznocha/SublimeLinter-contrib-CFLint |
e3780b2751aac7a1a0c261b4b058aaff855b8e8b | docido_sdk/toolbox/contextlib_ext.py | docido_sdk/toolbox/contextlib_ext.py |
from contextlib import contextmanager
import copy
@contextmanager
def restore(obj, copy_func=copy.deepcopy):
"""Backup an object in a with context and restore it when leaving
the scope.
:param obj: object to backup
:param copy_func: callbable object used to create an object copy.
default is `cop... |
from contextlib import contextmanager
import copy
@contextmanager
def restore_dict_kv(a_dict, key, copy_func=copy.deepcopy):
"""Backup an object in a with context and restore it when leaving
the scope.
:param a_dict:
associative table
:param: key
key whose value has to be backed up
:... | Apply `restore' utility to dictionary only | Apply `restore' utility to dictionary only
| Python | apache-2.0 | cogniteev/docido-python-sdk,LilliJane/docido-python-sdk |
0f5b08e8aa0a0ad1106e217064f8e11da98ebc0d | linter.py | linter.py | from SublimeLinter.lint import Linter, util
class Govet(Linter):
cmd = ('go', 'tool', 'vet')
regex = r'.+?:(?P<line>\d+):((?P<col>\d+):)?\s+(?P<message>.+)'
tempfile_suffix = 'go'
error_stream = util.STREAM_STDERR
defaults = {
'selector': 'source.go'
}
| from SublimeLinter.lint import Linter, util
class Govet(Linter):
cmd = ('go', 'vet', '${file_path}')
regex = r'(?P<filename>^.+?):(?P<line>\d+):((?P<col>\d+):)?\s+(?P<message>(.|\n\t)+)'
tempfile_suffix = '-'
multiline = True
error_stream = util.STREAM_STDERR
defaults = {
'selector':... | Handle multiline go vet messages. | Handle multiline go vet messages.
| Python | mit | sirreal/SublimeLinter-contrib-govet |
8dbd39a1e1d1f17da40d6a032f1b5d5b125fd025 | IPython/parallel/tests/test_mongodb.py | IPython/parallel/tests/test_mongodb.py | """Tests for mongodb backend
Authors:
* Min RK
"""
#-------------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this softwar... | """Tests for mongodb backend
Authors:
* Min RK
"""
#-------------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this softwar... | Use username and password for MongoDB on ShiningPanda. | Use username and password for MongoDB on ShiningPanda.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython |
cec76801dc870ae3e1f8682e84126ee69a2a25a2 | spacy/__main__.py | spacy/__main__.py | # coding: utf8
from __future__ import print_function
# NB! This breaks in plac on Python 2!!
#from __future__ import unicode_literals
if __name__ == '__main__':
import plac
import sys
from spacy.cli import download, link, info, package, train, convert, model
from spacy.util import prints
commands ... | # coding: utf8
from __future__ import print_function
# NB! This breaks in plac on Python 2!!
#from __future__ import unicode_literals
if __name__ == '__main__':
import plac
import sys
from spacy.cli import download, link, info, package, train, convert, model
from spacy.cli import profile
from spacy... | Add profile command to CLI | Add profile command to CLI
| Python | mit | spacy-io/spaCy,explosion/spaCy,aikramer2/spaCy,honnibal/spaCy,explosion/spaCy,recognai/spaCy,honnibal/spaCy,aikramer2/spaCy,spacy-io/spaCy,recognai/spaCy,spacy-io/spaCy,recognai/spaCy,recognai/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,aikramer2/spaCy,honnibal/sp... |
76b52c988f6b3a23bf52e8c1c2a8993e6f9112c8 | nightreads/user_manager/forms.py | nightreads/user_manager/forms.py | from django.contrib.auth.models import User
from django.core.signing import BadSignature, SignatureExpired
from django import forms
from . import user_service
class SubscribeForm(forms.Form):
email = forms.EmailField()
tags = forms.CharField()
def clean_tags(self):
tags = self.cleaned_data['tags... | from django.contrib.auth.models import User
from django.core.signing import BadSignature, SignatureExpired
from django import forms
from nightreads.posts.models import Tag
from . import user_service
class SubscribeForm(forms.Form):
email = forms.EmailField()
tags = forms.MultipleChoiceField(choices=[(
... | Use `MultipleChoiceField` for `tags` field | Use `MultipleChoiceField` for `tags` field
| Python | mit | avinassh/nightreads,avinassh/nightreads |
061c83bce03b1ae0261ae345f72f82625f12ff0a | ovp_organizations/serializers.py | ovp_organizations/serializers.py | from django.core.exceptions import ValidationError
from ovp_core import validators as core_validators
from ovp_core.serializers import GoogleAddressSerializer
from ovp_organizations import models
from rest_framework import serializers
from rest_framework import permissions
class OrganizationCreateSerializer(seriali... | from django.core.exceptions import ValidationError
from ovp_core import validators as core_validators
from ovp_core.serializers import GoogleAddressSerializer, GoogleAddressCityStateSerializer
from ovp_organizations import models
from rest_framework import serializers
from rest_framework import permissions
class Or... | Return GoogleAddressCityStateSerializer on address field instead of pk in OrganizationSearchSerializer | Return GoogleAddressCityStateSerializer on address field instead of pk in OrganizationSearchSerializer
| Python | agpl-3.0 | OpenVolunteeringPlatform/django-ovp-organizations,OpenVolunteeringPlatform/django-ovp-organizations |
9d058688986838459edf9f6ec40fac04867e0c2c | knights/compat/django.py | knights/compat/django.py | import ast
from django.core.urlresolvers import reverse
from django.utils.encoding import iri_to_uri
import datetime
from knights.library import Library
register = Library()
@register.tag
def static(parser, token):
src = parser.parse_expression(token)
return ast.Yield(value=ast.BinOp(
left=ast.Str... | import ast
from django.core.urlresolvers import reverse
from django.utils.encoding import iri_to_uri
import datetime
from knights.library import Library
register = Library()
@register.helper
def now(fmt):
return datetime.datetime.now().strftime(fmt)
@register.helper
def url(name, *args, **kwargs):
try:
... | Remove bodgy static tag Remove duplicate capfirst helper | Remove bodgy static tag
Remove duplicate capfirst helper
| Python | mit | funkybob/knights-templater,funkybob/knights-templater |
f96d26e8686cb2d1a15860414b90e48418e41f38 | tests/integration/conftest.py | tests/integration/conftest.py | import pytest
import io
import contextlib
import tempfile
import shutil
import os
from xd.docker.client import *
DOCKER_HOST = os.environ.get('DOCKER_HOST', None)
@pytest.fixture(scope="module")
def docker(request):
return DockerClient(host=DOCKER_HOST)
class StreamRedirector(object):
def __init__(self)... | import pytest
import io
import contextlib
import tempfile
import shutil
import os
from xd.docker.client import *
DOCKER_HOST = os.environ.get('DOCKER_HOST', None)
@pytest.fixture(scope="function")
def docker(request):
os.system("for c in `docker ps -a -q`;do docker rm $c;done")
os.system("for i in `docker ... | Purge images and containers before each test | tests: Purge images and containers before each test
Signed-off-by: Esben Haabendal <da90c138e4a9573086862393cde34fa33d74f6e5@haabendal.dk>
| Python | mit | XD-embedded/xd-docker,XD-embedded/xd-docker,esben/xd-docker,esben/xd-docker |
e4e4e8d5c3acf5851d33700f8b55aa2e1f9c33f2 | server/app/migrations/0003_region.py | server/app/migrations/0003_region.py | import os
import json
from django.db import migrations
from django.conf import settings
def dfs(apps, root, deep, superset=None, leaf=True):
Region = apps.get_model('app', 'Region')
if isinstance(root, dict):
for k, v in root.items():
s = dfs(apps, k, deep, superset, not v)
df... | import os
import json
from collections import OrderedDict
from django.db import migrations
from django.conf import settings
def dfs(apps, root, deep, superset=None, leaf=True):
Region = apps.get_model('app', 'Region')
if isinstance(root, dict):
for k, v in root.items():
s = dfs(apps, k, d... | Make ID of regions be definite. | SERVER-242: Make ID of regions be definite.
| Python | mit | malaonline/Server,malaonline/iOS,malaonline/Android,malaonline/Android,malaonline/iOS,malaonline/Android,malaonline/Server,malaonline/Server,malaonline/iOS,malaonline/Server |
e2ecc6968eb4108a3c15d16898e60e0962eba9f8 | invocations/checks.py | invocations/checks.py | """
Shortcuts for common development check tasks
"""
from __future__ import unicode_literals
from invoke import task
@task(name='blacken', iterable=['folder'])
def blacken(c, line_length=79, folder=None):
"""Run black on the current source"""
default_folders = ["."]
configured_folders = c.config.get("bl... | """
Shortcuts for common development check tasks
"""
from __future__ import unicode_literals
from invoke import task
@task(name="blacken", iterable=["folder"])
def blacken(c, line_length=79, folder=None, check=False):
"""Run black on the current source"""
default_folders = ["."]
configured_folders = c.... | Add --check support to the invocations.blacken task | Add --check support to the invocations.blacken task
| Python | bsd-2-clause | pyinvoke/invocations |
cd827059f9c500603d5c6b1d1bdf1621dc87a6a2 | pyaem/handlers.py | pyaem/handlers.py | from BeautifulSoup import *
import exception
def auth_fail(response, **kwargs):
code = response['http_code']
message = 'Authentication failed - incorrect username and/or password'
raise exception.PyAemException(code, message)
def method_not_allowed(response, **kwargs):
code = response['http_code']
soup... | from BeautifulSoup import *
import exception
def auth_fail(response, **kwargs):
code = response['http_code']
message = 'Authentication failed - incorrect username and/or password'
raise exception.PyAemException(code, message)
def method_not_allowed(response, **kwargs):
code = response['http_code']
soup... | Update unexpected handler message, with http code and body. | Update unexpected handler message, with http code and body.
| Python | mit | wildone/pyaem,Sensis/pyaem |
eabe9c25d73a2644b8697f0e9304e61dee5be198 | src/smdba/roller.py | src/smdba/roller.py | # coding: utf-8
"""
Visual console "toys".
"""
import time
import sys
import threading
class Roller(threading.Thread):
"""
Roller of some fun sequences while waiting.
"""
def __init__(self):
threading.Thread.__init__(self)
self.__sequence = ['-', '\\', '|', '/',]
self.__freq ... | # coding: utf-8
"""
Visual console "toys".
"""
import time
import sys
import threading
import typing
class Roller(threading.Thread):
"""
Roller of some fun sequences while waiting.
"""
def __init__(self) -> None:
threading.Thread.__init__(self)
self.__sequence = ['-', '\\', '|', '/',... | Add annotations to the methods | Add annotations to the methods
| Python | mit | SUSE/smdba,SUSE/smdba |
f87e5d37609b075abd2c7adb0a8b97294b205cb2 | src/info_retrieval/info_retrieval.py | src/info_retrieval/info_retrieval.py | # LING 573 Question Answering System
# Code last updated 4/17/14 by Clara Gordon
# This code implements an InfoRetriever for the question answering system.
from pymur import *
from general_classes import *
class InfoRetriever:
# builds a QueryEnvironment associated with the indexed document collection
def... | # LING 573 Question Answering System
# Code last updated 4/17/14 by Clara Gordon
# This code implements an InfoRetriever for the question answering system.
from pymur import *
from general_classes import *
class InfoRetriever:
# builds a QueryEnvironment associated with the indexed document collection
def... | Join word tokens into space-delimited string in InfoRetriever | Join word tokens into space-delimited string in InfoRetriever
| Python | mit | amkahn/question-answering,amkahn/question-answering |
36c7fab4939bbf15c3023883aafdf5f302600018 | usingnamespace/management/traversal/__init__.py | usingnamespace/management/traversal/__init__.py | class Root(object):
"""ManagementRoot
The main root object for any management traversal
"""
__name__ = None
__parent__ = None
def __init__(self, request):
"""Create the default root object
:request: The Pyramid request object
"""
self._request = request
... | class Root(object):
"""ManagementRoot
The main root object for any management traversal
"""
__name__ = None
__parent__ = None
def __init__(self, request):
"""Create the default root object
:request: The Pyramid request object
"""
self._request = request
... | Add API traversal to the management app | Add API traversal to the management app
| Python | isc | usingnamespace/usingnamespace |
3ffb34257acdd58ec8929bf7ec7d5bd2567be334 | nvchecker_source/git.py | nvchecker_source/git.py | # MIT licensed
# Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al.
from .cmd import run_cmd # type: ignore
async def get_version(
name, conf, *, cache, keymanager=None
):
git = conf['git']
cmd = f"git ls-remote -t --refs {git}"
data = await cache.get(cmd, run_cmd)
versions = list(map(lambda l... | # MIT licensed
# Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al.
from .cmd import run_cmd # type: ignore
async def get_version(
name, conf, *, cache, keymanager=None
):
git = conf['git']
cmd = f"git ls-remote -t --refs {git}"
data = await cache.get(cmd, run_cmd)
versions = [line.split("refs... | Use list comprehension instead of map lambda | Use list comprehension instead of map lambda
| Python | mit | lilydjwg/nvchecker |
d2456f280fd1d1bff44475b870bf067d2694fc9d | chainerrl/functions/arctanh.py | chainerrl/functions/arctanh.py | from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
class Arctanh(function_node.FunctionNode):
"""Elementwise inverse hyperbolic tangent function."""
def check_type_forward(self, in_types):
type_check._argname(in_types, (... | from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
class Arctanh(function_node.FunctionNode):
"""Elementwise inverse hyperbolic tangent function."""
def check_type_forward(self, in_types):
if hasattr(type_check, '_argnam... | Fix chainer v4 error about type_check._argname | Fix chainer v4 error about type_check._argname
| Python | mit | toslunar/chainerrl,toslunar/chainerrl |
3c264c4ddf3e21c3b0e495d663e78dc3c80ce949 | python/saliweb/test/MySQLdb/cursors.py | python/saliweb/test/MySQLdb/cursors.py | import datetime
class DictCursor(object):
def __init__(self, conn):
self.conn = conn
def execute(self, sql, args=()):
self.sql, self.args = sql, args
def fetchone(self):
if self.sql == 'SELECT * FROM jobs WHERE name=%s AND passwd=%s':
# Check completed jobs
... | import datetime
class DictCursor(object):
def __init__(self, conn):
self.conn = conn
def execute(self, sql, args=()):
self.sql, self.args = sql, args
def fetchone(self):
if self.sql == 'SELECT * FROM jobs WHERE name=%s AND passwd=%s':
# Check completed jobs
... | Add support for completed-job email to mocks | Add support for completed-job email to mocks
| Python | lgpl-2.1 | salilab/saliweb,salilab/saliweb,salilab/saliweb,salilab/saliweb,salilab/saliweb |
0c56e276aa1963ec35d744f61cecbb9368f115be | admin_tools/theming/templatetags/theming_tags.py | admin_tools/theming/templatetags/theming_tags.py | """
Theming template tags.
To load the theming tags just do: ``{% load theming_tags %}``.
"""
from django import template
from django.conf import settings
from admin_tools.utils import get_media_url
register = template.Library()
def render_theming_css():
"""
Template tag that renders the needed css files fo... | """
Theming template tags.
To load the theming tags just do: ``{% load theming_tags %}``.
"""
from django import template
from django.conf import settings
from admin_tools.utils import get_media_url
register = template.Library()
def render_theming_css():
"""
Template tag that renders the needed css files fo... | Enable not loading theming CSS by explicitely setting ADMIN_TOOLS_THEMING_CSS to None | Enable not loading theming CSS by explicitely setting ADMIN_TOOLS_THEMING_CSS to None
| Python | mit | liberation/django-admin-tools,liberation/django-admin-tools,liberation/django-admin-tools,liberation/django-admin-tools |
5785323d0a83c1f8b3b4e1cd17a22ff5222114fe | mistraldashboard/test/tests/error_handle.py | mistraldashboard/test/tests/error_handle.py | # Copyright 2015 ASD Technologies Co.
#
# 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 ... | # Copyright 2015 ASD Technologies Co.
#
# 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 ... | Remove the test cases for handle_errors to fix the py27 gate issue | Remove the test cases for handle_errors to fix the py27 gate issue
As we just change the exceptions handle method in horizon, now the
test cases have some issues, so disable them first to fix all py27
gate fails.
Change-Id: Ic369434a40ff209b06de9481884637d46ee588f7
| Python | apache-2.0 | openstack/mistral-dashboard,openstack/mistral-dashboard,openstack/mistral-dashboard |
1454ae817862fc446ad5948cbefe2825ceb46fc8 | queue.py | queue.py | #!/usr/bin/env python
'''Implementation of a simple queue data structure.
The queue has `enqueue`, `dequeue`, and `peek` methods.
Items in the queue have `value` and `behind` attributes.
The queue has a `front` attribute.
'''
class Item(object):
def __init__(self, value, behind=None):
self.value = value
... | #!/usr/bin/env python
'''Implementation of a simple queue data structure.
The queue has `enqueue`, `dequeue`, and `peek` methods.
Items in the queue have `value` and `behind` attributes.
The queue has a `front` attribute.
'''
class Item(object):
def __init__(self, value, behind=None):
self.value = value
... | Add peek function to Queue class | Add peek function to Queue class
| Python | mit | jwarren116/data-structures-deux |
dc4a16a663e718e07815d810313d36fcc6039878 | sequere/backends/redis/query.py | sequere/backends/redis/query.py | from collections import OrderedDict
from sequere.query import QuerySetTransformer
from sequere import utils
class RedisQuerySetTransformer(QuerySetTransformer):
def __init__(self, client, count, key, prefix, manager):
super(RedisQuerySetTransformer, self).__init__(client, count)
self.keys = [key... | try:
from collections import OrderedDict
except ImportError:
from django.utils.datastructures import SortedDict as OrderedDict
from sequere.query import QuerySetTransformer
from sequere import utils
class RedisQuerySetTransformer(QuerySetTransformer):
def __init__(self, client, count, key, prefix, manage... | Fix compat for python 2.6 | Fix compat for python 2.6
| Python | mit | thoas/django-sequere |
c324a640893a4a6b36bb8edfe0515fad55d1df2d | efm2riot/patches.py | efm2riot/patches.py | EXTERN_START = "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n"
EXTERN_STOP = "#ifdef __cplusplus\n}\n#endif\n\n"
EXTERN_FIND1 = "extern \"C\" {\n"
EXTERN_FIND2 = " *****************************************************************************/\n" # noqa
def add_extern_c(source_file, source):
"""
Add 'Exte... | EXTERN_START = "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n"
EXTERN_STOP = "#ifdef __cplusplus\n}\n#endif\n\n"
EXTERN_FIND1 = "extern \"C\" {\n"
EXTERN_FIND2 = " *****************************************************************************/\n" # noqa
def add_extern_c(source_file, source):
"""
Add 'Exte... | Make sure that Linux line endings are used. | Make sure that Linux line endings are used.
| Python | mit | basilfx/EFM2Riot,basilfx/EFM2Riot,basilfx/EFM2Riot,basilfx/EFM2Riot,basilfx/EFM2Riot |
0805fd05006d3efba6b6fa52b5921ed01120988b | wagtail_pgsearchbackend/migrations/0002_add_gin_index.py | wagtail_pgsearchbackend/migrations/0002_add_gin_index.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-03-22 14:53
from __future__ import unicode_literals
from django.db import migrations
from ..models import IndexEntry
table = IndexEntry._meta.db_table
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtail_pgs... | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-03-22 14:53
from __future__ import unicode_literals
from django.db import migrations
from ..models import IndexEntry
table = IndexEntry._meta.db_table
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtail_pgs... | Fix migration for Postgres < 9.5 | Fix migration for Postgres < 9.5
| Python | mit | wagtail/wagtail-pg-search-backend |
974160117e2f36b12b52df13d4a35726a4ff0907 | boxsdk/object/api_json_object.py | boxsdk/object/api_json_object.py | # coding: utf-8
from __future__ import unicode_literals, absolute_import
from collections import Mapping
from abc import ABCMeta
from .base_api_json_object import BaseAPIJSONObject, BaseAPIJSONObjectMeta
from ..util.compat import with_metaclass
class APIJSONObjectMeta(BaseAPIJSONObjectMeta, ABCMeta):
"""
A... | # coding: utf-8
from __future__ import unicode_literals, absolute_import
from collections import Mapping
from abc import ABCMeta
from .base_api_json_object import BaseAPIJSONObject, BaseAPIJSONObjectMeta
from ..util.compat import with_metaclass
class APIJSONObjectMeta(BaseAPIJSONObjectMeta, ABCMeta):
"""
A... | Remove redundant __iter__ from APIJsonObject base class | Remove redundant __iter__ from APIJsonObject base class
| Python | apache-2.0 | box/box-python-sdk |
1ec0f5267119874244474072dfb32f952ae4a8f1 | setup.py | setup.py | from distutils.core import setup
setup(
name='cardscript',
version='0.6',
description="A scriptable card game processing engine.",
author="Charles Nelson",
author_email="cnelsonsic@gmail.com",
url="https://github.com/cnelsonsic/cardscript",
packages=['cardscript', 'cardscript.cards'],
l... | from distutils.core import setup
from sh import pandoc
setup(
name='cardscript',
version='0.6',
description="A scriptable card game processing engine.",
author="Charles Nelson",
author_email="cnelsonsic@gmail.com",
url="https://github.com/cnelsonsic/cardscript",
packages=['cardscript', 'car... | Use pandoc to convert the markdown readme to rst. | Use pandoc to convert the markdown readme to rst.
| Python | agpl-3.0 | cnelsonsic/cardscript |
9bf70db96d8ae5204b20e1e214cb92e195ab5928 | changes/api/build_flaky_tests.py | changes/api/build_flaky_tests.py | from __future__ import absolute_import
from changes.api.base import APIView
from changes.config import db
from changes.constants import Result
from changes.models import Build, Job, TestCase
class BuildFlakyTestsAPIView(APIView):
def get(self, build_id):
build = Build.query.get(build_id)
if build... | from __future__ import absolute_import
from changes.api.base import APIView
from changes.config import db
from changes.constants import Result
from changes.models import Build, Job, TestCase
class BuildFlakyTestsAPIView(APIView):
def get(self, build_id):
build = Build.query.get(build_id)
if build... | Add projectSlug to build flaky tests API response | Add projectSlug to build flaky tests API response
Summary: We will use it in the test quarantine service to whitelist projects which support quarantine.
Test Plan:
Tested locally.
{
"projectSlug": "changesjenkins",
"repositoryUrl": "https://github.com/dropbox/changes.git",
"flakyTests": {
"count": 1,
"... | Python | apache-2.0 | dropbox/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes,bowlofstew/changes |
ca470bc87dc8aceda0295f79864a47b208bf1a19 | setup.py | setup.py | #!/usr/bin/env python
# -----------------------------------------------------------------------------
# FreeType high-level python API - copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
# -----------------------------------------------------------------------------
from distutil... | #!/usr/bin/env python
# -----------------------------------------------------------------------------
# FreeType high-level python API - copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
# -----------------------------------------------------------------------------
from distutil... | Set classifiers to indicate this project supoorts both Python 2 and 3 | Set classifiers to indicate this project supoorts both Python 2 and 3
| Python | bsd-3-clause | daltonmaag/freetype-py,bitforks/freetype-py |
2c696d7182bf6f857842e2ae95efa5eaa4fb2594 | setup.py | setup.py | from distutils.core import Extension, setup
from Cython.Build import cythonize
extensions = [
Extension('*', ['mathix/*.pyx']),
]
setup(
name='mathix',
author='Peith Vergil',
version='0.1',
ext_modules=cythonize(extensions)
)
| from distutils.core import Extension, setup
from Cython.Build import cythonize
try:
from Cython.Distutils import build_ext
except ImportError:
use_cython = False
else:
use_cython = True
if use_cython:
extensions = [
Extension('mathix.vector', ['mathix/vector.pyx']),
]
cmdclass = {
... | Add more classifiers. Check if Cython compilation is available or not. | Add more classifiers. Check if Cython compilation is available or not.
| Python | mit | PeithVergil/cython-example |
d18703237300f0e6b7d2a1ca88fbfa884e77c1b5 | partner_event/models/res_partner.py | partner_event/models/res_partner.py | # -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api
class ResPartn... | # -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api
class ResPartn... | Use only one method to recalculate event counters | Use only one method to recalculate event counters
| Python | agpl-3.0 | open-synergy/event,Endika/event,Antiun/event,open-synergy/event |
834b7ff81d6e2777d3952bb588a53f12f5ace5f5 | setup.py | setup.py | #
# This is the regobj setuptools script.
# Originally developed by Ryan Kelly, 2009.
#
# This script is placed in the public domain.
#
from distutils.core import setup
# If we did a straight `import regobj` here we wouldn't be able
# to build on non-win32 machines.
regobj = {}
try:
execfile("regobj.py",rego... | #
# This is the regobj setuptools script.
# Originally developed by Ryan Kelly, 2009.
#
# This script is placed in the public domain.
#
from distutils.core import setup
# If we did a straight `import regobj` here we wouldn't be able
# to build on non-win32 machines.
regobj = {}
try:
execfile("regobj.py",rego... | Add a Python 3 classifier recommended by community | Add a Python 3 classifier recommended by community
| Python | mit | rfk/regobj |
3c2e19c99afbb6f0fc1eace6c29adea0cab7ebdc | irclogview/views.py | irclogview/views.py | from django.http import HttpResponse
def index(request):
return HttpResponse('index')
def channel(request, name):
return HttpResponse('channel: %s' % name)
def show(request, name, year, month, day):
return HttpResponse('show: %s - %s/%s/%s' % (name, year, month, day))
| from datetime import datetime
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from annoying.decorators import render_to
from .models import Channel, Log
def index(request):
return HttpResponse('index')
def channel_index(request, name):
channel = get_object_or_404(Channel... | Add view to show log of a channel on a day | Add view to show log of a channel on a day
| Python | agpl-3.0 | fajran/irclogview,BlankOn/irclogview,fajran/irclogview,BlankOn/irclogview |
cab360d14a6b02cc1cf4649823acd2e2c683d240 | utils/swift_build_support/swift_build_support/products/swift.py | utils/swift_build_support/swift_build_support/products/swift.py | # swift_build_support/products/swift.py -------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt... | # swift_build_support/products/swift.py -------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt... | Change method _compute_runtime_use_sanitizer => property _runtime_sanitizer_flags. NFC. | [vacation-gardening] Change method _compute_runtime_use_sanitizer => property _runtime_sanitizer_flags. NFC.
| Python | apache-2.0 | parkera/swift,huonw/swift,CodaFi/swift,parkera/swift,codestergit/swift,austinzheng/swift,bitjammer/swift,glessard/swift,djwbrown/swift,bitjammer/swift,gottesmm/swift,lorentey/swift,tkremenek/swift,OscarSwanros/swift,milseman/swift,airspeedswift/swift,arvedviehweger/swift,CodaFi/swift,IngmarStein/swift,JaSpa/swift,atric... |
d4c7648b5f77531f821b0a2a728098ae352ce0cb | saleor/product/management/commands/populatedb.py | saleor/product/management/commands/populatedb.py | from django.core.management.base import BaseCommand
from utils.create_random_data import create_items, create_users, create_orders
from saleor.userprofile.models import User
class Command(BaseCommand):
help = 'Populate database with test objects'
placeholders_dir = r'saleor/static/placeholders/'
def ad... | from django.core.management.base import BaseCommand
from utils.create_random_data import create_items, create_users, create_orders
from saleor.userprofile.models import User
class Command(BaseCommand):
help = 'Populate database with test objects'
placeholders_dir = r'saleor/static/placeholders/'
def ad... | Check existence of the user with appropriate email address | Check existence of the user with appropriate email address
| Python | bsd-3-clause | laosunhust/saleor,KenMutemi/saleor,rchav/vinerack,maferelo/saleor,UITools/saleor,HyperManTT/ECommerceSaleor,laosunhust/saleor,spartonia/saleor,car3oon/saleor,spartonia/saleor,car3oon/saleor,tfroehlich82/saleor,UITools/saleor,spartonia/saleor,tfroehlich82/saleor,car3oon/saleor,rodrigozn/CW-Shop,jreigel/saleor,itbabu/sal... |
d2fffc5e206a3305f98c0c9a4f2527b868e93eb3 | lexicon/__init__.py | lexicon/__init__.py | from attribute_dict import AttributeDict
from alias_dict import AliasDict
__version__ = "0.1.0"
class Lexicon(AttributeDict, AliasDict):
def __init__(self, *args, **kwargs):
# Need to avoid combining AliasDict's initial attribute write on
# self.aliases, with AttributeDict's __setattr__. Doing s... | from attribute_dict import AttributeDict
from alias_dict import AliasDict
__version__ = "0.1.0"
class Lexicon(AttributeDict, AliasDict):
def __init__(self, *args, **kwargs):
# Need to avoid combining AliasDict's initial attribute write on
# self.aliases, with AttributeDict's __setattr__. Doing s... | Fix problems using Lexicons in deepcopy'd objects. | Fix problems using Lexicons in deepcopy'd objects.
Said problems actually only manifest as 'ignored'
RuntimeErrors, but those are really annoying and hard
to hide. This seems to be the right fix.
| Python | bsd-2-clause | mindw/lexicon,bitprophet/lexicon |
aa8fb3c94dbbb7cae9b13d4441c59a7607b84583 | cloudshell/networking/networking_resource_driver_interface.py | cloudshell/networking/networking_resource_driver_interface.py | from abc import ABCMeta
from abc import abstractmethod
class NetworkingResourceDriverInterface(object):
__metaclass__ = ABCMeta
@abstractmethod
def ApplyConnectivityChanges(self, context, request):
pass
@abstractmethod
def run_custom_command(self, context, custom_command):
pass
... | from abc import ABCMeta
from abc import abstractmethod
class NetworkingResourceDriverInterface(object):
__metaclass__ = ABCMeta
@abstractmethod
def ApplyConnectivityChanges(self, context, request):
pass
@abstractmethod
def run_custom_command(self, context, custom_command):
pass
... | Modify networking resource driver interface according to the latest networking standard | Modify networking resource driver interface according to the latest networking standard
| Python | apache-2.0 | QualiSystems/cloudshell-networking,QualiSystems/CloudShell-Networking-Core |
1ea27e8989657bb35dd37b6ee2e038e1358fbc96 | social_core/backends/globus.py | social_core/backends/globus.py | """
Globus Auth OpenID Connect backend, docs at:
https://docs.globus.org/api/auth
http://globus-integration-examples.readthedocs.io
"""
from social_core.backends.open_id_connect import OpenIdConnectAuth
class GlobusOpenIdConnect(OpenIdConnectAuth):
name = 'globus'
OIDC_ENDPOINT = 'https://auth.globus... | """
Globus Auth OpenID Connect backend, docs at:
https://docs.globus.org/api/auth
http://globus-integration-examples.readthedocs.io
"""
from social_core.backends.open_id_connect import OpenIdConnectAuth
class GlobusOpenIdConnect(OpenIdConnectAuth):
name = 'globus'
OIDC_ENDPOINT = 'https://auth.globus... | Set a JWT signature algorithm for the Globus backend to RS512 | Set a JWT signature algorithm for the Globus backend to RS512
| Python | bsd-3-clause | python-social-auth/social-core,python-social-auth/social-core |
1ba67d0288fbe2800e5aed685580bdc37383a61c | knowledge_repo/postprocessors/format_checks.py | knowledge_repo/postprocessors/format_checks.py | from ..constants import FORMAT_CHECKS
from ..post import HEADER_OPTIONAL_FIELD_TYPES, HEADER_REQUIRED_FIELD_TYPES
from ..postprocessor import KnowledgePostProcessor
class FormatChecks(KnowledgePostProcessor):
_registry_keys = [FORMAT_CHECKS]
def process(self, kp):
headers = kp.headers
for fie... | from ..constants import FORMAT_CHECKS
from ..post import HEADER_OPTIONAL_FIELD_TYPES, HEADER_REQUIRED_FIELD_TYPES
from ..postprocessor import KnowledgePostProcessor
class FormatChecks(KnowledgePostProcessor):
_registry_keys = [FORMAT_CHECKS]
def process(self, kp):
headers = kp.headers
for fie... | Revert the latest changes due to CI build failure | Revert the latest changes due to CI build failure
| Python | apache-2.0 | airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo |
0c1caf49a18bcd862247cdca7a4efe2f6fc02d93 | wafer/management/commands/wafer_talk_video_reviewers.py | wafer/management/commands/wafer_talk_video_reviewers.py | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... | Drop python2-era manual encode dance | Drop python2-era manual encode dance
| Python | isc | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer |
3b105973a6aad7885fd56182ad32e2731de9a432 | django_evolution/compat/patches/sqlite_legacy_alter_table.py | django_evolution/compat/patches/sqlite_legacy_alter_table.py | """Patch to enable SQLite Legacy Alter Table support."""
from __future__ import unicode_literals
import sqlite3
import django
from django.db.backends.sqlite3.base import DatabaseWrapper
def needs_patch():
"""Return whether the SQLite backend needs patching.
It will need patching if using Django 1.11 throu... | """Patch to enable SQLite Legacy Alter Table support."""
from __future__ import unicode_literals
import sqlite3
import django
def needs_patch():
"""Return whether the SQLite backend needs patching.
It will need patching if using Django 1.11 through 2.1.4 while using
SQLite3 v2.26.
Returns:
... | Fix a premature import when patching SQLite compatibility. | Fix a premature import when patching SQLite compatibility.
We provide a compatibility patch that fixes certain versions of SQLite
with Django prior to 2.1.5.
This patch made the assumption that it could import the Django SQLite
backend at the module level, since SQLite is built into Python. However,
on modern version... | Python | bsd-3-clause | beanbaginc/django-evolution |
8b125544a49b6ea0c4e54d934f390a96e1efe105 | pywaw/misc/context_processors.py | pywaw/misc/context_processors.py | import functools
import subprocess
import django
import platform
from django.conf import settings
from django.contrib.sites.models import get_current_site
def system_info(request):
return {
'system': {
'django': django.get_version(),
'python': platform.python_version(),
... | import functools
import subprocess
import django
import platform
from django.conf import settings
from django.contrib.sites.models import get_current_site
def system_info(request):
return {
'system': {
'django': django.get_version(),
'python': platform.python_version(),
... | Change from hg to git. | Change from hg to git.
| Python | mit | PyWaw/pywaw.org,PyWaw/pywaw.org,PyWaw/pywaw.org |
e9df5070abcea31907479630810a64a007ff1f06 | quotes_page/urls.py | quotes_page/urls.py | from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'qi.views.home', name='home'),
# url(r'^qi/', include('qi.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.... | from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'qi.views.home', name='home'),
# url(r'^qi/', include('qi.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.... | Disable init view for now, add extra url for specific quotes page | Disable init view for now, add extra url for specific quotes page
| Python | mit | kirberich/qicrawler,kirberich/qicrawler |
fbbf141331c27dfe88d5877cbd1b5bbd54356e0b | pidman/pid/migrations/0002_pid_sequence_initial_value.py | pidman/pid/migrations/0002_pid_sequence_initial_value.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from pidman.pid.noid import decode_noid
from pidman.pid import models as pid_models
def pid_sequence_lastvalue(apps, schema_editor):
# if the database has existing pids, update the sequence last value
# s... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from pidman.pid.noid import decode_noid, encode_noid
from pidman.pid import models as pid_models
def pid_sequence_lastvalue(apps, schema_editor):
# if the database has existing pids, update the sequence last ... | Update 1.0 release with latest version of pid sequence migration | Update 1.0 release with latest version of pid sequence migration
| Python | apache-2.0 | emory-libraries/pidman,emory-libraries/pidman |
609fcedf1aa90e0022c72121865452b3cbdd0ba3 | icekit/plugins/content_listing/forms.py | icekit/plugins/content_listing/forms.py | from fluent_contents.forms import ContentItemForm
#from icekit.content_collections.abstract_models import AbstractCollectedContent
from .models import ContentListingItem
class ContentListingAdminForm(ContentItemForm):
class Meta:
model = ContentListingItem
fields = '__all__'
# def __init__... | from django.forms import ModelChoiceField
from django.contrib.contenttypes.models import ContentType
from fluent_contents.forms import ContentItemForm
from .models import ContentListingItem
class ContentTypeModelChoiceField(ModelChoiceField):
def label_from_instance(self, content_type):
return u".".joi... | Improve content listing plugin's admin form | Improve content listing plugin's admin form
- show natural key of content types in select field to disambiguate
the SELECT field listing in the admin
- add `filter_content_types` method to form to simplify filtering the
selectable content types in derived plugins.
| Python | mit | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit |
b1bfd9630ef049070b0cd6ae215470d3d1facd40 | django/contrib/messages/views.py | django/contrib/messages/views.py | from django.views.generic.edit import FormMixin
from django.contrib import messages
class SuccessMessageMixin(FormMixin):
"""
Adds a success message on successful form submission.
"""
success_message = ''
def form_valid(self, form):
response = super(SuccessMessageMixin, self).form_valid(f... | from django.contrib import messages
class SuccessMessageMixin(object):
"""
Adds a success message on successful form submission.
"""
success_message = ''
def form_valid(self, form):
response = super(SuccessMessageMixin, self).form_valid(form)
success_message = self.get_success_mes... | Remove unnecessary and problematic parent class from SuccessMessageMixin | Remove unnecessary and problematic parent class from SuccessMessageMixin
refs #16319, thanks to bmispelon for the catch | Python | bsd-3-clause | xadahiya/django,anant-dev/django,AltSchool/django,huang4fstudio/django,ryanahall/django,gunchleoc/django,andreif/django,vmarkovtsev/django,avneesh91/django,makinacorpus/django,ArnossArnossi/django,mitchelljkotler/django,avanov/django,sdcooke/django,denis-pitul/django,chyeh727/django,jhoos/django,ataylor32/django,piquad... |
efb98ffae0a92d9a0facc76cd43bb51dca3b2820 | nibble_aes/find_dist/find_ids.py | nibble_aes/find_dist/find_ids.py | """
Derive a list of impossible differentials.
"""
import ast
import sys
def parse(line):
return ast.literal_eval(line)
def main():
if len(sys.argv) != 3:
print("usage: ./find_ids.py [forward differentials file] [backward differentials file]", file=sys.stderr)
sys.exit(1)
forward_diffs =... | """
Derive a list of impossible differentials.
"""
import ast
import sys
def parse(line):
i, rounds, xss = ast.literal_eval(line)
yss = [set(xs) for xs in xss]
return (i, rounds, yss)
def main():
if len(sys.argv) != 3:
print("usage: ./find_ids.py [forward differentials file] [backward differe... | Revert "Trade memory for time." | Revert "Trade memory for time."
This reverts commit f4c13756eef0dc6b7231e37d5f5d9029dea1fb62.
| Python | mit | wei2912/aes-idc,wei2912/idc,wei2912/idc,wei2912/idc,wei2912/idc,wei2912/aes-idc |
10bfa701f352e0f916b1edd9913bee788f09568f | oscar/apps/catalogue/managers.py | oscar/apps/catalogue/managers.py | from django.db import models
class ProductManager(models.Manager):
def base_queryset(self):
"""
Return ``QuerySet`` with related content pre-loaded.
"""
return self.get_query_set().select_related('product_class')\
.prefetch_related('variants',
... | from django.db import models
class ProductQuerySet(models.query.QuerySet):
def base_queryset(self):
"""
Applies select_related and prefetch_related for commonly related
models to save on queries
"""
return self.select_related('product_class')\
.prefetch_related... | Allow chaining of Product's custom querysets | Allow chaining of Product's custom querysets
This aligns the implementation of Oscar specific QuerySet Methods with
the implementation in current django core[1].
While this is not DRY, it does deliver on chainability and can be seen
as preparation to take advantage of the improvements coming to this part
of django in ... | Python | bsd-3-clause | thechampanurag/django-oscar,mexeniz/django-oscar,jinnykoo/wuyisj,monikasulik/django-oscar,dongguangming/django-oscar,QLGu/django-oscar,WadeYuChen/django-oscar,josesanch/django-oscar,vovanbo/django-oscar,sonofatailor/django-oscar,ahmetdaglarbas/e-commerce,itbabu/django-oscar,WadeYuChen/django-oscar,anentropic/django-osc... |
03db6c12584652230fe0cd1f982f2a70a7c1630b | test/test_ticket.py | test/test_ticket.py | import unittest
from mock import Mock
import sys
import os
from pytrac import Ticket
class TestTicket(unittest.TestCase):
def setUp(self):
server = Mock()
self.ticket = Ticket(server)
def testSearchWithAllParams(self):
self.ticket.search(summary='test_summary', owner='someowner', st... | import unittest
from mock import Mock
import sys
import os
import datetime
from pytrac import Ticket
class TestTicket(unittest.TestCase):
def setUp(self):
server = Mock()
self.ticket = Ticket(server)
def testSearchWithAllParams(self):
self.ticket.search(summary='test_summary', owner... | Add test for comment api | Add test for comment api
| Python | apache-2.0 | Jimdo/pytrac,Jimdo/pytrac |
900ab180a8e255cc46e0583d251c5a71fc27f5d6 | src/waldur_mastermind/marketplace_rancher/processors.py | src/waldur_mastermind/marketplace_rancher/processors.py | from waldur_mastermind.marketplace import processors
from waldur_rancher import views as rancher_views
class RancherCreateProcessor(processors.BaseCreateResourceProcessor):
viewset = rancher_views.ClusterViewSet
fields = (
'name',
'description',
'nodes',
'tenant_settings',
... | from waldur_mastermind.marketplace import processors
from waldur_rancher import views as rancher_views
class RancherCreateProcessor(processors.BaseCreateResourceProcessor):
viewset = rancher_views.ClusterViewSet
fields = (
'name',
'description',
'nodes',
'tenant_settings',
... | Add new field to Processor | Add new field to Processor
| Python | mit | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur |
987b45af9ec719ce2ded8615bb7177979e688184 | tests/functional/test_warning.py | tests/functional/test_warning.py | import textwrap
def test_environ(script, tmpdir):
"""$PYTHONWARNINGS was added in python2.7"""
demo = tmpdir.joinpath('warnings_demo.py')
demo.write_text(textwrap.dedent('''
from logging import basicConfig
from pip._internal.utils import deprecation
deprecation.install_warning_log... | import textwrap
def test_environ(script, tmpdir):
demo = tmpdir.joinpath('warnings_demo.py')
demo.write_text(textwrap.dedent('''
from logging import basicConfig
from pip._internal.utils import deprecation
deprecation.install_warning_logger()
basicConfig()
deprecation.... | Move docstring to appropriately placed comment | Move docstring to appropriately placed comment
| Python | mit | pfmoore/pip,pradyunsg/pip,xavfernandez/pip,rouge8/pip,pfmoore/pip,rouge8/pip,pradyunsg/pip,xavfernandez/pip,pypa/pip,sbidoul/pip,sbidoul/pip,xavfernandez/pip,pypa/pip,rouge8/pip |
41f244171011a1bbb4a2a77e779979ba8cc9ecb5 | zeus/api/resources/auth_index.py | zeus/api/resources/auth_index.py | import json
from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity
from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema
emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(ma... | import json
from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity
from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema
emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(ma... | Fix auth API usage (this is why we wait for CI) | Fix auth API usage (this is why we wait for CI)
| Python | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus |
de9c5235d379fcebbfc801fb23c3b9aa2f1fe4e8 | benchmark/datasets/musicbrainz/extract-random-queries.py | benchmark/datasets/musicbrainz/extract-random-queries.py | #!/usr/bin/env python
"""
Script to extract and then generate random queries for fuzzy searching.
Usage:
./extract-random-queries.py <infile> <outfile>
"""
import os
from random import choice, randint, random
import string
from subprocess import call
import sys
from tempfile import mkstemp
__author__ = "Uwe L. K... | #!/usr/bin/env python
"""
Script to extract and then generate random queries for fuzzy searching.
Usage:
./extract-random-queries.py <infile> <outfile>
"""
import codecs
import os
from random import choice, randint, random
import string
from subprocess import call
import sys
from tempfile import mkstemp
__author... | Fix query extractor UTF-8 handling | Fix query extractor UTF-8 handling | Python | mit | xhochy/libfuzzymatch,xhochy/libfuzzymatch |
7d50ca9b29a71a9cda2a5b78a0cb392108b217d5 | roche/scripts/xml-server-load.py | roche/scripts/xml-server-load.py | # coding=utf-8
#
# Must be called in roche root dir
#
import os
from os import walk
from eulexistdb.db import ExistDB
#
# Timeout higher?
#
xmldb = ExistDB('http://54.220.97.75:8080/exist')
xmldb.createCollection('docker', True)
xmldb.createCollection('docker/texts', True)
os.chdir('../dublin-store')
for (dirpa... | # coding=utf-8
#
# Must be called in roche root dir
#
import os
from os import walk
from eulexistdb.db import ExistDB
#
# Timeout higher?
#
#
# http://username:password@54.220.97.75:8080/exist
#
xmldb = ExistDB('http://54.220.97.75:8080/exist')
xmldb.createCollection('docker', True)
xmldb.createCollection('docke... | Add comment for full url with non guest user | Add comment for full url with non guest user
| Python | mit | beijingren/roche-website,beijingren/roche-website,beijingren/roche-website,beijingren/roche-website |
12352c1f7c9751727b8bd98ece576f9d690b520e | corehq/apps/export/migrations/0008_auto_20190906_2008.py | corehq/apps/export/migrations/0008_auto_20190906_2008.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-09-06 20:08
from __future__ import unicode_literals
from django.db import migrations
from corehq.apps.es.aggregations import (
AggregationTerm,
NestedTermAggregationsHelper,
)
from corehq.apps.es.ledgers import LedgerES
from corehq.apps.export.mode... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-09-06 20:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
"""
This migration used to contain some initialization for LedgerSectionEntry.
At the time it was run, this model was ... | Remove data migration from migration file | Remove data migration from migration file
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq |
281e686d9599b06b718f2bf653921d51750fc00f | purchase_supplier_minimum_order/models/__init__.py | purchase_supplier_minimum_order/models/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Set minimum order on suppliers
# Copyright (C) 2016 OpusVL (<http://opusvl.com/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | # -*- coding: utf-8 -*-
##############################################################################
#
# Set minimum order on suppliers
# Copyright (C) 2016 OpusVL (<http://opusvl.com/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | Add mode switch to res.company | Add mode switch to res.company
| Python | agpl-3.0 | OpusVL/odoo-purchase-min-order |
41eff3cfcbf6e7615353e0e5126b729f956a89aa | pajbot/migration_revisions/db/0002_create_index_on_user_points.py | pajbot/migration_revisions/db/0002_create_index_on_user_points.py | def up(cursor, context):
cursor.execute("CREATE INDEX ON \"user\"(points)")
| def up(cursor, context):
# the index on user(points) caches/indexes the table, ordered by points
# so queries like the top 30 point farmers can skip sorting the entire
# user table by points, and just instead use the sorting given by the
# user(points) index.
# e.g. compare (before and after creati... | Comment on the create index revision | Comment on the create index revision
| Python | mit | pajlada/tyggbot,pajlada/tyggbot,pajlada/pajbot,pajlada/pajbot,pajlada/tyggbot,pajlada/pajbot,pajlada/pajbot,pajlada/tyggbot |
0683e4fb0431563758d93b39d102d1c634a4535b | run.py | run.py | #!/usr/bin/env python
import importlib
import mongoengine
from eve import Eve
from eve_mongoengine import EveMongoengine
from qiprofile_rest import models
# The application.
app = Eve()
# The MongoEngine ORM extension.
ext = EveMongoengine(app)
# Register the model non-embedded documdent classes.
ext.add_model(mode... | #!/usr/bin/env python
import importlib
import mongoengine
from eve import Eve
from eve_mongoengine import EveMongoengine
from qiprofile_rest import models
# The application.
app = Eve()
# The MongoEngine ORM extension.
ext = EveMongoengine(app)
# Register the model non-embedded documdent classes.
ext.add_model(mode... | Change the subject url from /quip/subjects to /quip/subject. | Change the subject url from /quip/subjects to /quip/subject.
| Python | bsd-2-clause | ohsu-qin/qiprofile-rest,ohsu-qin/qirest |
11fde526c9d25c0fb9ef678d4264a52e4845a518 | pidman/pid/migrations/0002_pid_sequence_initial_value.py | pidman/pid/migrations/0002_pid_sequence_initial_value.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from pidman.pid.noid import decode_noid
from pidman.pid import models as pid_models
def pid_sequence_lastvalue(apps, schema_editor):
# if the database has existing pids, update the sequence last value
# s... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from pidman.pid.noid import decode_noid
from pidman.pid import models as pid_models
def pid_sequence_lastvalue(apps, schema_editor):
# if the database has existing pids, update the sequence last value
# s... | Update pid sequence so it will work even if sequence already exists | Update pid sequence so it will work even if sequence already exists
| Python | apache-2.0 | emory-libraries/pidman,emory-libraries/pidman |
abe6f3430efb7291054d96a51cc4a290e0bd7a59 | osf/migrations/0224_population_registration_subscription_notifications.py | osf/migrations/0224_population_registration_subscription_notifications.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-10-26 18:43
from __future__ import unicode_literals
from django.db import migrations, models
from osf.management.commands.add_notification_subscription import add_reviews_notification_setting
from osf.management.commands.populate_registration_provider_noti... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-10-26 18:43
from __future__ import unicode_literals
from django.db import migrations, models
from osf.management.commands.add_notification_subscription import add_reviews_notification_setting
from osf.management.commands.populate_registration_provider_noti... | Remove call to run management commands that we didn't use during migration | Remove call to run management commands that we didn't use during migration
| Python | apache-2.0 | brianjgeiger/osf.io,mfraezz/osf.io,baylee-d/osf.io,brianjgeiger/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,mfraezz/osf.io,Johnetordoff/osf.io,mfraezz/osf.io,mfraezz/osf.io,adlius/osf.io,felliott/osf.io,adlius/osf.io,brianjgeiger/osf.io,brianjgeiger/osf.io,fellio... |
78f049ce9713dabd3eec544494dadcab7ff93d4c | sui_hei/templatetags/markdown.py | sui_hei/templatetags/markdown.py | import re
from bs4 import BeautifulSoup
from django import template
from django.template.defaultfilters import stringfilter
from markdown import markdown as md
register = template.Library()
@stringfilter
@register.filter(is_safe=True)
def text2md(value):
'''
convert markdown-like text to html.
strip hea... | import re
from bs4 import BeautifulSoup
from django import template
from django.template.defaultfilters import stringfilter
from markdown import markdown as md
from markdown.extensions.headerid import HeaderIdExtension
register = template.Library()
@stringfilter
@register.filter(is_safe=True)
def text2md(value):
... | Add header id extension for github preferences | Add header id extension for github preferences
| Python | mit | heyrict/cindy,heyrict/cindy,heyrict/cindy |
c258b1995bdb870b3818a3dca402b86f2bb85fe9 | chmvh_website/gallery/management/commands/generatethumbnails.py | chmvh_website/gallery/management/commands/generatethumbnails.py | from django.core.management.base import BaseCommand
from gallery import models
from gallery.tasks import create_thumbnail
class Command(BaseCommand):
help = 'Generates thumbnails for the gallery images'
def handle(self, *args, **kwargs):
patients = models.Patient.objects.filter(thumbnail=None)
... | from django.core.management.base import BaseCommand
from gallery import models
from gallery.tasks import create_thumbnail
class Command(BaseCommand):
help = 'Generates thumbnails for gallery images without thumbnails'
def add_arguments(self, parser):
parser.add_argument(
'--overwrite',
... | Add option to overwrite existing thumbnails. | Add option to overwrite existing thumbnails.
| Python | mit | cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website |
4c88da91221899c22cfe9030f40cbb4e0b3e904d | {{project.repo_name}}/tests/test_{{project.repo_name}}.py | {{project.repo_name}}/tests/test_{{project.repo_name}}.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_{{ project.repo_name }}
------------
Tests for `{{ project.repo_name }}` module.
"""
import os
import shutil
import unittest
from {{ project.repo_name }} import {{ project.repo_name }}
class TestComplexity(unittest.TestCase):
def setUp(self):
pas... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_{{ project.repo_name }}
------------
Tests for `{{ project.repo_name }}` module.
"""
import os
import shutil
import unittest
from {{ project.repo_name }} import {{ project.repo_name }}
class Test{{ project.repo_name|capitalize }}(unittest.TestCase):
def ... | Remove hardcoded name of TestCase. | Remove hardcoded name of TestCase.
| Python | bsd-2-clause | rockymeza/cookiecutter-djangoapp,aeroaks/cookiecutter-pyqt4,rockymeza/cookiecutter-djangoapp |
404f300b9e8ce33149324888a42ce22fb5c00dc0 | api/bioguide/management/commands/import_bioguide.py | api/bioguide/management/commands/import_bioguide.py | import csv
import sys
from django.core.management.base import BaseCommand, CommandError
from bioguide.models import Legislator
import name_tools
class Command(BaseCommand):
def handle(self, *args, **options):
fields = ['bioguide_id', 'name', 'birth_death', 'position', 'party', 'state', 'congress', ]
... | import csv
import sys
import urllib2
from django.core.management.base import BaseCommand, CommandError
from bioguide.models import Legislator
import name_tools
from lxml.html import document_fromstring
class Command(BaseCommand):
def handle(self, *args, **options):
fields = ['bioguide_id', 'name', 'bir... | Update bioguide importer to scrape data from bioguide.congress.gov | Update bioguide importer to scrape data from bioguide.congress.gov
| Python | bsd-3-clause | sunlightlabs/Capitol-Words,sunlightlabs/Capitol-Words,sunlightlabs/Capitol-Words,sunlightlabs/Capitol-Words,propublica/Capitol-Words,sunlightlabs/Capitol-Words,propublica/Capitol-Words,sunlightlabs/Capitol-Words,propublica/Capitol-Words,sunlightlabs/Capitol-Words,propublica/Capitol-Words |
c23c70dd10797a162efb137a53eec53c6ce554c7 | deflect/management/commands/checkurls.py | deflect/management/commands/checkurls.py | from django.core.management.base import NoArgsCommand
from django.core.urlresolvers import reverse
import requests
from deflect.models import ShortURL
class Command(NoArgsCommand):
help = "Validate short URL redirect targets"
def handle_noargs(self, *args, **options):
for url in ShortURL.objects.al... | from django.contrib.sites.models import Site
from django.core.management.base import NoArgsCommand
from django.core.urlresolvers import reverse
import requests
from deflect.models import ShortURL
class Command(NoArgsCommand):
help = "Validate short URL redirect targets"
def handle_noargs(self, *args, **opt... | Print full URL for admin edit link | Print full URL for admin edit link
| Python | bsd-3-clause | jbittel/django-deflect |
d58fa915665c3a2c99588bb19bfaf14e6728371f | channels/__init__.py | channels/__init__.py | import django
__version__ = "2.4.0"
if django.VERSION < (3, 2):
default_app_config = "channels.apps.ChannelsConfig"
DEFAULT_CHANNEL_LAYER = "default"
| __version__ = "2.4.0"
try:
import django
if django.VERSION < (3, 2):
default_app_config = "channels.apps.ChannelsConfig"
except ModuleNotFoundError:
pass
DEFAULT_CHANNEL_LAYER = "default"
| Fix RTD build for missing Django dependency. | Fix RTD build for missing Django dependency.
| Python | bsd-3-clause | andrewgodwin/channels,django/channels,andrewgodwin/django-channels |
dbc526d43b6a69c0bd120f3a0abb519f8bf353a8 | dbimport/csv_util.py | dbimport/csv_util.py | import csv
import re
def read_csv(path):
with open(path, 'rU') as data:
reader = csv.DictReader(data)
for row in reader:
yield row
def remove_commas_and_apostrophes(value):
"""Remove commas and single quotes from all values in row.
Sqlite can't handle them."""
return re.... | import csv
import re
def read_csv(path):
with open(path, 'rU') as data:
reader = csv.DictReader(data)
for row in reader:
yield row
def remove_commas_and_apostrophes(value):
"""Remove commas and single quotes from all values in row.
Sqlite can't handle them."""
return re.... | Add scrub_row() to pre-process all fields in incoming csv row | Add scrub_row() to pre-process all fields in incoming csv row
| Python | mit | KatrinaE/importlite |
2ce3b7bb5207fcdbedd731bb9cbc928393654507 | functional_tests/test_homepage.py | functional_tests/test_homepage.py | import unittest
from selenium import webdriver
class HomePageRecipeTests(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.close()
def test_django_working(self):
self.browser.get('http://localhost:8000')
self.assertIn(... | import unittest
from selenium import webdriver
class HomePageRecipeTests(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.close()
def test_can_see_todays_recipe(self):
# Alice goes to our website
self.browser.get('htt... | Add functional test to test the home page | Add functional test to test the home page
| Python | agpl-3.0 | XeryusTC/rotd,XeryusTC/rotd,XeryusTC/rotd |
66379ee0118446759fa9709f45406f607245deb2 | honeybadger/utils.py | honeybadger/utils.py | import json
class StringReprJSONEncoder(json.JSONEncoder):
def default(self, o):
try:
return repr(o)
except:
return '[unserializable]'
def filter_dict(data, filter_keys):
# filter_keys = set(data.keys())
for key in filter_keys:
if data.has_key(key):
... | import json
class StringReprJSONEncoder(json.JSONEncoder):
def default(self, o):
try:
return repr(o)
except:
return '[unserializable]'
def filter_dict(data, filter_keys):
# filter_keys = set(data.keys())
for key in filter_keys:
if key in data:
d... | Remove has_key to ensure python3 compatibility | Remove has_key to ensure python3 compatibility
| Python | mit | honeybadger-io/honeybadger-python,honeybadger-io/honeybadger-python |
4298cb6ccaac055a4a8db250dc6143b37870edd6 | openacademy/model/openacademy_session.py | openacademy/model/openacademy_session.py | from openerp import fields, models
class Session(models.Model):
_name = 'openacademy.session'
name = fields.Char(required=True)
start_date = fields.Date()
duration = fields.Float(digits=(6, 2), help="Duration in days")
seats = fields.Integer(string="Number of seats")
instructor_id = fields.Ma... | from openerp import fields, models
class Session(models.Model):
_name = 'openacademy.session'
name = fields.Char(required=True)
start_date = fields.Date()
duration = fields.Float(digits=(6, 2), help="Duration in days")
seats = fields.Integer(string="Number of seats")
instructor_id = fiel... | Add domain or and ilike | [REF] openacademy: Add domain or and ilike
| Python | apache-2.0 | Hiregui92/openacademy-project |
e68cb906810a26d93e0d15e0357a75a2b49d8784 | boundary/plugin_get_components.py | boundary/plugin_get_components.py | #
# Copyright 2014-2015 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | #
# Copyright 2014-2015 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Reformat code to PEP-8 standards | Reformat code to PEP-8 standards
| Python | apache-2.0 | jdgwartney/boundary-api-cli,boundary/pulse-api-cli,wcainboundary/boundary-api-cli,jdgwartney/pulse-api-cli,jdgwartney/boundary-api-cli,boundary/boundary-api-cli,boundary/pulse-api-cli,boundary/boundary-api-cli,wcainboundary/boundary-api-cli,jdgwartney/pulse-api-cli |
f7341acf0717d238073a688c6047e18b524efab1 | qmpy/configuration/resources/__init__.py | qmpy/configuration/resources/__init__.py | import yaml
import os, os.path
loc = os.path.dirname(os.path.abspath(__file__))
hosts = yaml.load(open(loc+'/hosts.yml'))
projects = yaml.load(open(loc+'/projects.yml'))
allocations = yaml.load(open(loc+'/allocations.yml'))
users = yaml.load(open(loc+'/users.yml'))
| import yaml
import os
loc = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(loc, 'hosts.yml'), 'r') as fr:
hosts = yaml.load(fr)
with open(os.path.join(loc, 'projects.yml'), 'r') as fr:
projects = yaml.load(fr)
with open(os.path.join(loc, 'allocations.yml'), 'r') as fr:
allocations = ya... | Use OS-agnostic path joining operations | Use OS-agnostic path joining operations
| Python | mit | wolverton-research-group/qmpy,wolverton-research-group/qmpy,wolverton-research-group/qmpy,wolverton-research-group/qmpy,wolverton-research-group/qmpy |
6ca50d8b5c208a2063910832df5d9a07301b6893 | homeassistant/components/device_tracker/owntracks.py | homeassistant/components/device_tracker/owntracks.py | """
homeassistant.components.device_tracker.owntracks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OwnTracks platform for the device tracker.
device_tracker:
platform: owntracks
"""
import json
import logging
import homeassistant.components.mqtt as mqtt
DEPENDENCIES = ['mqtt']
LOCATION_TOPIC = 'owntracks/+/... | """
homeassistant.components.device_tracker.owntracks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OwnTracks platform for the device tracker.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.owntracks.html
"""
import json
import logging... | Move configuration details to docs | Move configuration details to docs
| Python | mit | MungoRae/home-assistant,varunr047/homefile,LinuxChristian/home-assistant,srcLurker/home-assistant,molobrakos/home-assistant,sffjunkie/home-assistant,sfam/home-assistant,Zac-HD/home-assistant,tboyce021/home-assistant,aoakeson/home-assistant,caiuspb/home-assistant,Zyell/home-assistant,bdfoster/blumate,nnic/home-assistant... |
19783c164910cec1d0d9e68a3ce62cb8874fa605 | salt/ext/__init__.py | salt/ext/__init__.py | # coding: utf-8 -*-
| # coding: utf-8 -*-
'''
This directory contains external modules shipping with Salt. They are governed
under their respective licenses. See the COPYING file included with this
distribution for more information.
'''
| Add a note explaining salt/ext | Add a note explaining salt/ext
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
3cc2dd83b44979c2dee3946e3d01ca236d3339ff | src/trusted/service_runtime/linux/nacl_bootstrap_munge_phdr.py | src/trusted/service_runtime/linux/nacl_bootstrap_munge_phdr.py | #!/usr/bin/python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This takes three command-line arguments:
# MUNGE-PHDR-PROGRAM file name of program built from
# ... | #!/usr/bin/env python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This takes three command-line arguments:
MUNGE-PHDR-PROGRAM file name of program built from
... | Move over tweaks to munge-phdr script from chromium repo | Move over tweaks to munge-phdr script from chromium repo
Some cosmetic changes were made on the chromium side since we copied it.
Catch up to those, still preparing to remove the chromium copy ASAP.
BUG= none
TEST= trybots
R=bradchen@google.com
Review URL: http://codereview.chromium.org/8728008
git-svn-id: 721b910... | Python | bsd-3-clause | nacl-webkit/native_client,sbc100/native_client,sbc100/native_client,nacl-webkit/native_client,nacl-webkit/native_client,sbc100/native_client,sbc100/native_client,sbc100/native_client,nacl-webkit/native_client,sbc100/native_client,nacl-webkit/native_client |
eb9d9196155e90c4949380c66ff8876f41bccc01 | tomviz/python/tomviz/io/formats/numpy.py | tomviz/python/tomviz/io/formats/numpy.py | # -*- coding: utf-8 -*-
###############################################################################
# This source file is part of the Tomviz project, https://tomviz.org/.
# It is released under the 3-Clause BSD License, see "LICENSE".
###############################################################################
... | # -*- coding: utf-8 -*-
###############################################################################
# This source file is part of the Tomviz project, https://tomviz.org/.
# It is released under the 3-Clause BSD License, see "LICENSE".
###############################################################################
... | Use C ordering for npy format | Use C ordering for npy format
This appears to save and and load files correctly, but when
loading, it prints this message:
Warning, array does not have Fortran order,
making deep copy and fixing...
...done.
I'm looking into this...
Signed-off-by: Patrick Avery <743342299f279e7a8c3ff5eb40671fce3e95f13a@kitware.com>
| Python | bsd-3-clause | OpenChemistry/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz |
4647526dd416a7e9e3b3d6b2b0b1876e86266743 | django_hosts/tests/urls/simple.py | django_hosts/tests/urls/simple.py | from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('django.views.generic.simple',
url(r'^simple/$', 'direct_to_template', name='simple-direct'),
)
| from django.conf.urls.defaults import patterns, url
from django.views.generic import TemplateView
urlpatterns = patterns('django.views.generic.simple',
url(r'^simple/$', TemplateView.as_view(), name='simple-direct'),
)
| Change direct_to_template view to TemplateView.as_view() | Change direct_to_template view to TemplateView.as_view()
Required for Django 1.5 compatibility during tests
| Python | bsd-3-clause | jezdez/django-hosts |
73c616cc9e3d5351e0f4e41d60ff03bd58b85967 | scrapi/harvesters/scholarsbank.py | scrapi/harvesters/scholarsbank.py | """
Harvester for Scholars Bank University of Oregon for the SHARE project
Example API call: http://scholarsbank.uoregon.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc
"""
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
from scrapi.base.helpers import updated_schema
class Scho... | """
Harvester for Scholars Bank University of Oregon for the SHARE project
Example API call: http://scholarsbank.uoregon.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc
"""
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
from scrapi.base.schemas import OAISCHEMA
from scrapi.base.... | Update schoalrsbank to grab second description if there are two | Update schoalrsbank to grab second description if there are two
| Python | apache-2.0 | fabianvf/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,icereval/scrapi,alexgarciac/scrapi,CenterForOpenScience/scrapi,ostwald/scrapi,felliott/scrapi,mehanig/scrapi,erinspace/scrapi,mehanig/scrapi,fabianvf/scrapi |
150aa84158bab89e3700114038fab78504bed960 | zou/app/blueprints/export/csv/persons.py | zou/app/blueprints/export/csv/persons.py | from zou.app.blueprints.export.csv.base import BaseCsvExport
from zou.app.models.person import Person
class PersonsCsvExport(BaseCsvExport):
def __init__(self):
BaseCsvExport.__init__(self, Person)
self.file_name = "people_export"
def build_headers(self):
return ["Last Name", "First ... | from zou.app.blueprints.export.csv.base import BaseCsvExport
from zou.app.models.person import Person
class PersonsCsvExport(BaseCsvExport):
def __init__(self):
BaseCsvExport.__init__(self, Person)
self.file_name = "people_export"
def build_headers(self):
return ["Last Name", "First ... | Add active column to person csv export | Add active column to person csv export
| Python | agpl-3.0 | cgwire/zou |
69d15ec69330828da7eb96591ca674b06c6f9017 | fiware-region-sanity-tests/tests/regions/test_waterford.py | fiware-region-sanity-tests/tests/regions/test_waterford.py | # -*- coding: utf-8 -*-
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FIWARE project.
#
# 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://w... | # -*- coding: utf-8 -*-
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FIWARE project.
#
# 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://w... | Disable the Object Storage tests in Waterford | Disable the Object Storage tests in Waterford
| Python | apache-2.0 | Fiware/ops.Health,telefonicaid/fiware-health,Fiware/ops.Health,telefonicaid/fiware-health,telefonicaid/fiware-health,telefonicaid/fiware-health,Fiware/ops.Health,telefonicaid/fiware-health,Fiware/ops.Health,Fiware/ops.Health |
72f23c104a28fe4c91d5d36d3f939e110c6f16e3 | exercises/chapter_04/exercise_04_01/exercise_04_01.py | exercises/chapter_04/exercise_04_01/exercise_04_01.py | # 4-1. Pizzas
favorite_pizzas = ["Columpus", "Marco Polo", "Amerikana"]
for pizza in favorite_pizzas:
print("I like " + pizza + " pizza.")
| # 4-1. Pizzas
favorite_pizzas = ["Columpus", "Marco Polo", "Amerikana"]
for pizza in favorite_pizzas:
print("I like " + pizza + " pizza.")
print("I really like pizza!")
| Add final version of exercise 4.1. | Add final version of exercise 4.1.
| Python | mit | HenrikSamuelsson/python-crash-course |
1af3cc43ae482549ee058e801b4f65e2af78653c | grow/testing/testdata/pod/extensions/preprocessors.py | grow/testing/testdata/pod/extensions/preprocessors.py | from grow import Preprocessor
from protorpc import messages
class CustomPreprocessor(Preprocessor):
KIND = 'custom_preprocessor'
class Config(messages.Message):
value = messages.StringField(1)
def run(self, **kwargs):
# To allow the test to check the result
self.pod._custom_prepr... | import grow
from protorpc import messages
class CustomPreprocessor(grow.Preprocessor):
KIND = 'custom_preprocessor'
class Config(messages.Message):
value = messages.StringField(1)
def run(self, **kwargs):
# To allow the test to check the result
self.pod._custom_preprocessor_value... | Update preprocessor testdata to use grow.Preprocessor. | Update preprocessor testdata to use grow.Preprocessor.
| Python | mit | grow/pygrow,denmojo/pygrow,grow/grow,grow/grow,grow/pygrow,denmojo/pygrow,denmojo/pygrow,grow/grow,denmojo/pygrow,grow/grow,grow/pygrow |
666622968cddc5f9f62e044da8a4f1b779c1532b | gn/find_msvc.py | gn/find_msvc.py | #!/usr/bin/env python
# Copyright 2019 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import subprocess
'''
Look for the first match in the format
C:\\Program Files (x86)\\Microsoft Visual Studio\\${RELEASE}\\${VERSION}\\VC
''... | #!/usr/bin/env python
# Copyright 2019 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import subprocess
'''
Look for the first match in the format
C:\\Program Files (x86)\\Microsoft Visual Studio\\${RELEASE}\\${VERSION}\\VC
''... | Add Preview to list of possible MSVC versions. | Add Preview to list of possible MSVC versions.
Needed to test a Preview version of MSVC and adding it to the list here
makes it a bit easier and the list more complete.
Change-Id: I419636722303816f0cd961408229fcef0773e8e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286496
Reviewed-by: Mike Klein <14574... | Python | bsd-3-clause | google/skia,google/skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,goo... |
7f8455c9687e8c7750fe1cfcbfdf4fd720888012 | iis/__init__.py | iis/__init__.py | import logging.config
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_mail import Mail
from flask_user import UserManager, SQLAlchemyAdapter
from flask_bootstrap import Bootstrap
def create_app(config: object) -> Flask:
"""Create the flask app. Can be ... | import logging.config
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_mail import Mail
from flask_user import UserManager, SQLAlchemyAdapter
from flask_bootstrap import Bootstrap
import iis.jobs
def create_app(config: object) -> Flask:
"""Create the f... | Use '"' for string delimeter | Use '"' for string delimeter
| Python | agpl-3.0 | interactomix/iis,interactomix/iis |
bbfdbc4b5b6a35105a65910a878be85040cf5263 | VMEncryption/main/oscrypto/encryptstates/OSEncryptionState.py | VMEncryption/main/oscrypto/encryptstates/OSEncryptionState.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft Corporation
#
# 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
#
# U... | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft Corporation
#
# 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
#
# U... | Remove var declaration from abstract base class | Remove var declaration from abstract base class
| Python | apache-2.0 | soumyanishan/azure-linux-extensions,bpramod/azure-linux-extensions,Azure/azure-linux-extensions,Azure/azure-linux-extensions,vityagi/azure-linux-extensions,Azure/azure-linux-extensions,Azure/azure-linux-extensions,andyliuliming/azure-linux-extensions,andyliuliming/azure-linux-extensions,jasonzio/azure-linux-extensions,... |
a248ac96a04cccc31f881496e45db3212ad46118 | core/components/security/factor.py | core/components/security/factor.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
from u2flib_server.u2f import (begin_registration,
begin_authentication,
complete_registration,
complete_authentication)
from components.eternity import config
facet... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
from u2flib_server.u2f import (begin_registration,
begin_authentication,
complete_registration,
complete_authentication)
from components.eternity import config
facet... | Fix server error when login with u2f | Fix server error when login with u2f
| Python | mit | chiaki64/Windless,chiaki64/Windless |
cc27883cd84794f29d9fddab174bb41fc305cdb7 | test_fallback.py | test_fallback.py |
import platform
import sys
platform.python_implementation = lambda:'PyPy'
def unimport():
del sys.modules['pylibscrypt']
sys.modules.pop('pylibscrypt.common', None)
sys.modules.pop('pylibscrypt.mcf', None)
sys.modules['pylibscrypt.pylibscrypt'] = None
import pylibscrypt
unimport()
sys.modules['pylibscr... |
import platform
import sys
platform.python_implementation = lambda:'PyPy'
def unimport():
del sys.modules['pylibscrypt']
sys.modules.pop('pylibscrypt.common', None)
sys.modules.pop('pylibscrypt.mcf', None)
sys.modules['pylibscrypt.pylibscrypt'] = None
import pylibscrypt
unimport()
sys.modules['pylibscr... | Test both branches of pylibsodium_salsa choice | Test both branches of pylibsodium_salsa choice
| Python | isc | jvarho/pylibscrypt,jvarho/pylibscrypt |
480525b10dcac543a34a09b00051bd3dca1609f0 | src/ggrc/migrations/versions/20151204135707_504f541411a5_comment_assignee_type.py | src/ggrc/migrations/versions/20151204135707_504f541411a5_comment_assignee_type.py |
"""Comment assignee type
Revision ID: 504f541411a5
Revises: 18cbdd3a7fd9
Create Date: 2015-12-04 13:57:07.047217
"""
# revision identifiers, used by Alembic.
revision = '504f541411a5'
down_revision = '18cbdd3a7fd9'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
"comments",
... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: ivan@reciprocitylabs.com
# Maintained By: ivan@reciprocitylabs.com
"""Comment assignee type
Revision ID: 504f541411a5
Revises: 18cbdd3a7fd9
Create... | Add licence header to migration | Add licence header to migration
| Python | apache-2.0 | jmakov/ggrc-core,kr41/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,NejcZupec/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,prasannav7/ggrc-core... |
e692ea935713b21dbaefb8cf270831413b5f7bd2 | mzalendo/core/management/commands/core_fix_ward_names.py | mzalendo/core/management/commands/core_fix_ward_names.py | import re
from django.core.management.base import NoArgsCommand, CommandError
from django.template.defaultfilters import slugify
from optparse import make_option
from core.models import PlaceKind, Place
class Command(NoArgsCommand):
help = 'Standardize the form of ward names with regard to / and - separators'
... | import re
from django.core.management.base import NoArgsCommand, CommandError
from django.template.defaultfilters import slugify
from optparse import make_option
from core.models import PlaceKind, Place
def slugify_place_name(place_name):
return 'ward-' + slugify(place_name)
class Command(NoArgsCommand):
... | Update ward names even if just the slug would have changed | Update ward names even if just the slug would have changed
| Python | agpl-3.0 | mysociety/pombola,geoffkilpin/pombola,geoffkilpin/pombola,patricmutwiri/pombola,ken-muturi/pombola,geoffkilpin/pombola,patricmutwiri/pombola,ken-muturi/pombola,mysociety/pombola,patricmutwiri/pombola,hzj123/56th,patricmutwiri/pombola,mysociety/pombola,patricmutwiri/pombola,hzj123/56th,ken-muturi/pombola,geoffkilpin/pom... |
d144e30d557ea2f4b03a2f0b7fb68f1cee54a602 | cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py | cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db.models import Q
def migrate_contact_for_research_via_field_data(apps, schema_editor):
ContactResearchMethod = apps.get_model("legalaid", "ContactResearchMethod")
research_methods = {method.method: ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def migrate_contact_for_research_via_field_data(apps, schema_editor):
ContactResearchMethod = apps.get_model("legalaid", "ContactResearchMethod")
PersonalDetails = apps.get_model("legalaid", "PersonalDetails")
... | Simplify data migration and make it safe to rerun | Simplify data migration and make it safe to rerun
| Python | mit | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend |
7d993541b9097062d922bdd8030f7ef1bcbb0129 | apps/package/handlers/launchpad.py | apps/package/handlers/launchpad.py | import os
from django.conf import settings
from launchpadlib.launchpad import Launchpad
def pull(package):
cachedir = getattr(settings, 'LAUNCHPAD_CACHE_DIR', os.path.join(settings.PROJECT_ROOT, 'lp-cache'))
launchpad = Launchpad.login_anonymously('djangopackages.com', 'production', cachedir)
repo_... | import os
from django.conf import settings
from launchpadlib.launchpad import Launchpad
from package.handlers.base_handler import BaseHandler
class LaunchpadHandler(BaseHandler):
title = 'Launchpad'
url = 'https://code.launchpad.net'
user_url = 'https://launchpad.net/~%s'
repo_regex = r'https://code... | Refactor Launchpad handler to use BaseHandler. | Refactor Launchpad handler to use BaseHandler.
| Python | mit | QLGu/djangopackages,pydanny/djangopackages,audreyr/opencomparison,nanuxbe/djangopackages,QLGu/djangopackages,miketheman/opencomparison,audreyr/opencomparison,QLGu/djangopackages,pydanny/djangopackages,cartwheelweb/packaginator,benracine/opencomparison,cartwheelweb/packaginator,nanuxbe/djangopackages,nanuxbe/djangopacka... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.