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 |
|---|---|---|---|---|---|---|---|---|---|
f8db46b40629cfdb145a4a000d47277f72090c5b | powerline/lib/memoize.py | powerline/lib/memoize.py | # vim:fileencoding=utf-8:noet
from functools import wraps
import time
def default_cache_key(**kwargs):
return frozenset(kwargs.items())
class memoize(object):
'''Memoization decorator with timeout.'''
def __init__(self, timeout, cache_key=default_cache_key, cache_reg_func=None):
self.timeout = timeout
self.... | # vim:fileencoding=utf-8:noet
from functools import wraps
try:
# Python>=3.3, the only valid clock source for this job
from time import monotonic as time
except ImportError:
# System time, is affected by clock updates.
from time import time
def default_cache_key(**kwargs):
return frozenset(kwargs.items())
cla... | Use proper clock if possible | Use proper clock if possible
| Python | mit | Liangjianghao/powerline,kenrachynski/powerline,darac/powerline,darac/powerline,bezhermoso/powerline,firebitsbr/powerline,bartvm/powerline,cyrixhero/powerline,junix/powerline,prvnkumar/powerline,s0undt3ch/powerline,S0lll0s/powerline,Luffin/powerline,EricSB/powerline,dragon788/powerline,prvnkumar/powerline,wfscheper/powe... |
e5e068c5fa94d68aa81dbcd3e498ba17dae37d2c | axelrod/tests/test_reflex.py | axelrod/tests/test_reflex.py | """
Test suite for Reflex Axelrod PD player.
"""
import axelrod
from test_player import TestPlayer
class Reflex_test(TestPlayer):
def test_initial_nice_strategy(self):
""" First response should always be cooperation. """
p1 = axelrod.Reflex()
p2 = axelrod.Player()
self.assertEqual... | """
Test suite for Reflex Axelrod PD player.
"""
import axelrod
from test_player import TestPlayer
class Reflex_test(TestPlayer):
name = "Reflex"
player = axelrod.Reflex
stochastic = False
def test_strategy(self):
""" First response should always be cooperation. """
p1 = axelrod.Ref... | Simplify tests to new format. | Simplify tests to new format.
| Python | mit | emmagordon/Axelrod,uglyfruitcake/Axelrod,kathryncrouch/Axelrod,emmagordon/Axelrod,mojones/Axelrod,drvinceknight/Axelrod,bootandy/Axelrod,uglyfruitcake/Axelrod,bootandy/Axelrod,risicle/Axelrod,risicle/Axelrod,mojones/Axelrod,kathryncrouch/Axelrod |
d247427d60944d529fa17865ac4e0556a9ccda3f | tools/telemetry/telemetry/page/actions/navigate.py | tools/telemetry/telemetry/page/actions/navigate.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.actions import page_action
class NavigateAction(page_action.PageAction):
def __init__(self, attributes=None):
super(NavigateAction... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.actions import page_action
class NavigateAction(page_action.PageAction):
def __init__(self, attributes=None):
super(NavigateAction... | Add a timeout attr to NavigateAction. | Add a timeout attr to NavigateAction.
BUG=320748
Review URL: https://codereview.chromium.org/202483006
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@257922 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | dushu1203/chromium.src,Just-D/chromium-1,krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,ondra-novak/chromium.src,hgl888/chromium-crosswalk,markYoungH/chromium.src,crosswalk-project/chromium-crosswalk-efl,ltilve/chromium,dednal/chromium.src,PeterWangIntel/chromium-crosswalk,Just-D/ch... |
0200c03f8f6232965f924a765c5ebb0f9c439f4d | sample_app/forms.py | sample_app/forms.py | from flask_wtf import Form
from wtforms.fields import (TextField, SubmitField, BooleanField, DateField,
DateTimeField)
from wtforms.validators import Required
class SignupForm(Form):
name = TextField(u'Your name', validators=[Required()])
birthday = DateField(u'Your birthday')
... | from flask_wtf import Form
from wtforms.fields import (TextField, SubmitField, BooleanField, DateField,
DateTimeField)
from wtforms.validators import Required, Email
class SignupForm(Form):
name = TextField(u'Your name', validators=[Required()])
email = TextField(u'Your email addre... | Add email field to sample app. | Add email field to sample app.
| Python | apache-2.0 | vishnugonela/flask-bootstrap,BeardedSteve/flask-bootstrap,livepy/flask-bootstrap,suvorom/flask-bootstrap,vishnugonela/flask-bootstrap,JingZhou0404/flask-bootstrap,vishnugonela/flask-bootstrap,BeardedSteve/flask-bootstrap,suvorom/flask-bootstrap,eshijia/flask-bootstrap,JingZhou0404/flask-bootstrap,moha24/flask-bootstrap... |
1040e17e006fef93d990a6212e8be06e0a818c2f | middleware/python/test_middleware.py | middleware/python/test_middleware.py | from tyk.decorators import *
@Pre
def AddSomeHeader(request, session):
# request['Body'] = 'tyk=python'
request['SetHeaders']['SomeHeader'] = 'python2'
return request, session
def NotARealHandler():
pass
| from tyk.decorators import *
from tyk.gateway import TykGateway as tyk
@Pre
def AddSomeHeader(request, session):
request['SetHeaders']['SomeHeader'] = 'python'
tyk.store_data( "cool_key", "cool_value", 300 )
return request, session
def NotARealHandler():
pass
| Update middleware syntax with "TykGateway" | Update middleware syntax with "TykGateway"
| Python | mpl-2.0 | mvdan/tyk,nebolsin/tyk,nebolsin/tyk,lonelycode/tyk,mvdan/tyk,mvdan/tyk,lonelycode/tyk,mvdan/tyk,nebolsin/tyk,lonelycode/tyk,mvdan/tyk,mvdan/tyk,nebolsin/tyk,mvdan/tyk,nebolsin/tyk,nebolsin/tyk,mvdan/tyk,nebolsin/tyk,nebolsin/tyk |
0da81aee8d1d1c1badee561c594e191dbbffdc9c | pyres/failure/base.py | pyres/failure/base.py | import sys
import traceback
class BaseBackend(object):
"""Provides a base class that custom backends can subclass. Also provides basic
traceback and message parsing.
The ``__init__`` takes these keyword arguments:
``exp`` -- The exception generated by your failure.
``queu... | import sys
import traceback
class BaseBackend(object):
"""Provides a base class that custom backends can subclass. Also provides basic
traceback and message parsing.
The ``__init__`` takes these keyword arguments:
``exp`` -- The exception generated by your failure.
``queue`` -- The queue... | Save our backtraces in a compatible manner with resque. | Save our backtraces in a compatible manner with resque.
| Python | mit | binarydud/pyres,guaijiao/pyres,TylerLubeck/pyres,Affectiva/pyres |
924ef1395214c2f71b96c21f41e240c88f0570a1 | addons/project/__terp__.py | addons/project/__terp__.py | {
"name" : "Project Management",
"version": "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_project.html",
"category" : "Generic Modules/Projects & Services",
"depends" : ["product", "account", 'mrp', 'sale', 'base'],
"description": "Project management module that track multi-level projects, tas... | {
"name" : "Project Management",
"version": "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_project.html",
"category" : "Generic Modules/Projects & Services",
"depends" : ["product", "account", 'mrp', 'sale', 'base'],
"description": "Project management module that track multi-level projects, tas... | Add project_security.xml file entry in update_xml section | Add project_security.xml file entry in update_xml section
bzr revid: mga@tinyerp.com-1950891d2c32d7af7c7ba38518a3abdba822b091 | Python | agpl-3.0 | gavin-feng/odoo,hip-odoo/odoo,SerpentCS/odoo,OpusVL/odoo,ecosoft-odoo/odoo,abstract-open-solutions/OCB,ojengwa/odoo,cloud9UG/odoo,spadae22/odoo,chiragjogi/odoo,rdeheele/odoo,fevxie/odoo,gavin-feng/odoo,jolevq/odoopub,alhashash/odoo,ramitalat/odoo,numerigraphe/odoo,apanju/GMIO_Odoo,blaggacao/OpenUpgrade,shivam1111/odoo,... |
c2f79200689171a49c5bd72e6354ba56ee09a6b6 | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
NODE_VERSION = 'v0.11.13'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'bb664e4665851fe923ce904e620ba43d8d010ba5'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[... | #!/usr/bin/env python
import platform
import sys
NODE_VERSION = 'v0.11.13'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '432720d4613e3aac939f127fe55b9d44fea349e5'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[... | Upgrade libchromiumcontent to contain printing headers. | Upgrade libchromiumcontent to contain printing headers.
| Python | mit | simonfork/electron,anko/electron,kazupon/electron,Faiz7412/electron,JesselJohn/electron,etiktin/electron,rajatsingla28/electron,oiledCode/electron,brave/electron,Zagorakiss/electron,voidbridge/electron,thomsonreuters/electron,pirafrank/electron,sky7sea/electron,mattdesl/electron,evgenyzinoviev/electron,yan-foto/electro... |
74bfc85ef4533e93a4edf4c16e5a7a6bb175f36b | onetime/views.py | onetime/views.py | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
from django.contrib.auth import login
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
def login(request, key, redirect_invalid_to=None, red... | from datetime import datetime
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseGone
from django.contrib import auth
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
return HttpResponse('ok', content_type='te... | Simplify the view as the validation logic has already moved to the model | Simplify the view as the validation logic has already moved to
the model
| Python | agpl-3.0 | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,fajran/django-loginurl,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,vanschelven/cmsplugin-journal,ISIFoundation/influenzanet-website,uploadcare/django-loginurl,ISIFoundation/influenzanet-web... |
0ca298f6706706637dccd4f27c56eed6e91c98ba | tests/runners.py | tests/runners.py | from spec import Spec
class Runner_(Spec):
class run:
def out_stream_defaults_to_sys_stdout(self):
"out_stream defaults to sys.stdout"
def err_stream_defaults_to_sys_stderr(self):
"err_stream defaults to sys.stderr"
def out_stream_can_be_overridden(self):
... | import sys
from spec import Spec, trap, eq_
from invoke import Local, Context
from _utils import mock_subprocess
class Local_(Spec):
class run:
@trap
@mock_subprocess(out="sup")
def out_stream_defaults_to_sys_stdout(self):
"out_stream defaults to sys.stdout"
Loca... | Rename new test class correctly and flesh out first passing tests | Rename new test class correctly and flesh out first passing tests
| Python | bsd-2-clause | mattrobenolt/invoke,pyinvoke/invoke,mattrobenolt/invoke,pyinvoke/invoke,kejbaly2/invoke,frol/invoke,tyewang/invoke,pfmoore/invoke,mkusz/invoke,mkusz/invoke,pfmoore/invoke,singingwolfboy/invoke,kejbaly2/invoke,frol/invoke |
3d1cef9e56d7fac8a1b89861b7443e4ca660e4a8 | nova/ipv6/api.py | nova/ipv6/api.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Openstack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Openstack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | Reduce indentation to avoid PEP8 failures | Reduce indentation to avoid PEP8 failures
| Python | apache-2.0 | vmturbo/nova,fnordahl/nova,cloudbau/nova,CEG-FYP-OpenStack/scheduler,vladikr/nova_drafts,yrobla/nova,bigswitch/nova,eharney/nova,KarimAllah/nova,Stavitsky/nova,TwinkleChawla/nova,zzicewind/nova,klmitch/nova,rickerc/nova_audit,belmiromoreira/nova,cloudbase/nova-virtualbox,luogangyi/bcec-nova,Yusuke1987/openstack_templat... |
4fd051fd6d048e64f574097a3ca314111087ee45 | theanets/convolution.py | theanets/convolution.py | # -*- coding: utf-8 -*-
'''This module contains convolution network structures.'''
from . import feedforward
class Regressor(feedforward.Regressor):
'''A regressor attempts to produce a target output.
A convolutional regression model takes the following inputs during training:
- ``x``: A three-dimensi... | # -*- coding: utf-8 -*-
'''This module contains convolution network structures.'''
from . import feedforward
class Regressor(feedforward.Regressor):
'''A regressor attempts to produce a target output.'''
INPUT_NDIM = 4
'''Number of dimensions for holding input data arrays.'''
class Classifier(feedfor... | Fix up conv models to match current master. | Fix up conv models to match current master.
| Python | mit | chrinide/theanets,lmjohns3/theanets |
90b92a1977c32dd660533567c0d5034b93d5c9c7 | pombola/core/management/commands/core_create_places_from_mapit_entries.py | pombola/core/management/commands/core_create_places_from_mapit_entries.py | # This script will copy areas from mapit to core.places, including creating the
# place kind if required.
# import re
# import sys
from django.core.management.base import LabelCommand
from mapit.models import Type
from pombola.core.models import Place, PlaceKind
from django.template.defaultfilters import slugify
cl... | # This script will copy areas from mapit to core.places, including creating the
# place kind if required.
# import re
# import sys
from django.core.management.base import LabelCommand
from mapit.models import Type
from pombola.core.models import Place, PlaceKind
from django.template.defaultfilters import slugify
cl... | Add smarts to cope with slug clashes with other places with the same names. | Add smarts to cope with slug clashes with other places with the same names.
| Python | agpl-3.0 | patricmutwiri/pombola,hzj123/56th,geoffkilpin/pombola,patricmutwiri/pombola,hzj123/56th,ken-muturi/pombola,hzj123/56th,hzj123/56th,mysociety/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,ken-muturi/pombola,hzj123/56th,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,patricmutwiri/pom... |
dbdb247ad03ca6b9168f193eadaf28638d718072 | scrubadub/filth/named_entity.py | scrubadub/filth/named_entity.py | from .base import Filth
class NamedEntityFilth(Filth):
"""
Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org)
"""
type = 'named_entity'
def __init__(self, *args, label: str, **kwargs):
super(NamedEntityFilth, self).__init__(*args, **kwargs)
s... | from .base import Filth
class NamedEntityFilth(Filth):
"""
Default filth type, for named entities (e.g. the ones in https://nightly.spacy.io/models/en#en_core_web_lg-labels),
except the ones represented in any other filth.
"""
type = 'named_entity'
def __init__(self, *args, label: str, **kwar... | Change docstring for NamedEntity filth | Change docstring for NamedEntity filth
| Python | mit | deanmalmgren/scrubadub,datascopeanalytics/scrubadub,datascopeanalytics/scrubadub,deanmalmgren/scrubadub |
1718926c99692fefb90627c55589990cd0e0225b | wagtail/project_template/home/migrations/0002_create_homepage.py | wagtail/project_template/home/migrations/0002_create_homepage.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
Home... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
Home... | Make migrations in project_template home app reversible | Make migrations in project_template home app reversible
| Python | bsd-3-clause | rsalmaso/wagtail,FlipperPA/wagtail,chrxr/wagtail,nutztherookie/wagtail,mikedingjan/wagtail,nimasmi/wagtail,rsalmaso/wagtail,Toshakins/wagtail,mikedingjan/wagtail,thenewguy/wagtail,mikedingjan/wagtail,iansprice/wagtail,nilnvoid/wagtail,nimasmi/wagtail,mikedingjan/wagtail,nutztherookie/wagtail,zerolab/wagtail,FlipperPA/w... |
95ceeb0af4e549e0d211b4e1ba6157d26ad5e44d | sync_scheduler.py | sync_scheduler.py | from tapiriik.database import db
from tapiriik.messagequeue import mq
from tapiriik.sync import Sync
from datetime import datetime
from pymongo.read_preferences import ReadPreference
import kombu
import time
Sync.InitializeWorkerBindings()
producer = kombu.Producer(Sync._channel, Sync._exchange)
while True:
queuein... | from tapiriik.database import db
from tapiriik.messagequeue import mq
from tapiriik.sync import Sync
from datetime import datetime
from pymongo.read_preferences import ReadPreference
import kombu
import time
from tapiriik.settings import MONGO_FULL_WRITE_CONCERN
Sync.InitializeWorkerBindings()
producer = kombu.Produc... | Fix race between MQ and mongo setting QueuedAt | Fix race between MQ and mongo setting QueuedAt | Python | apache-2.0 | cgourlay/tapiriik,cheatos101/tapiriik,cmgrote/tapiriik,abhijit86k/tapiriik,dmschreiber/tapiriik,cpfair/tapiriik,abhijit86k/tapiriik,cpfair/tapiriik,mjnbike/tapiriik,abs0/tapiriik,gavioto/tapiriik,mjnbike/tapiriik,cheatos101/tapiriik,brunoflores/tapiriik,marxin/tapiriik,brunoflores/tapiriik,dlenski/tapiriik,abs0/tapirii... |
5828823d505aae1425fd2353f898c5b18722e6e5 | src/robotide/ui/progress.py | src/robotide/ui/progress.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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 2008-2009 Nokia Siemens Networks Oyj
#
# 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... | Introduce base class and ProgressObserver for renaming occurences. | progess: Introduce base class and ProgressObserver for renaming occurences.
| Python | apache-2.0 | caio2k/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,robotframework/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,caio2k/RIDE,caio2k/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE |
f301dd2366f53a6cf4b0949942b8520502f54351 | boxsdk/__init__.py | boxsdk/__init__.py | # coding: utf-8
from __future__ import unicode_literals
from .auth.jwt_auth import JWTAuth
from .auth.oauth2 import OAuth2
from .client import Client
from .object import * # pylint:disable=wildcard-import,redefined-builtin
| # coding: utf-8
from __future__ import unicode_literals
try:
from .auth.jwt_auth import JWTAuth
except ImportError:
JWTAuth = None # If extras are not installed, JWTAuth won't be available.
from .auth.oauth2 import OAuth2
from .client import Client
from .object import * # pylint:disable=wildcard-import,rede... | Fix import error when [jwt] not installed. | Fix import error when [jwt] not installed.
| Python | apache-2.0 | Tusky/box-python-sdk,sanketdjain/box-python-sdk,sanketdjain/box-python-sdk,Frencil/box-python-sdk,samkuehn/box-python-sdk,lkabongoVC/box-python-sdk,Frencil/box-python-sdk,box/box-python-sdk,lkabongoVC/box-python-sdk,samkuehn/box-python-sdk |
0f9f4f1ee325d72d09625850ba6a153ae5616ab0 | nose2/tests/functional/test_collect_plugin.py | nose2/tests/functional/test_collect_plugin.py | import re
from nose2.tests._common import FunctionalTestCase
class CollectOnlyFunctionalTest(FunctionalTestCase):
def test_collect_tests_in_package(self):
self.assertTestRunOutputMatches(
self.runIn('scenario/tests_in_package', '-v', '--collect-only'),
stderr=EXPECT_LAYOUT1)
# e... | import re
from nose2.tests._common import FunctionalTestCase
class CollectOnlyFunctionalTest(FunctionalTestCase):
def test_collect_tests_in_package(self):
self.assertTestRunOutputMatches(
self.runIn('scenario/tests_in_package', '-v', '--collect-only',
'--plugin=nose2.plu... | Update test to load plugin | Update test to load plugin
collectonly no longer loaded by default
| Python | bsd-2-clause | ptthiem/nose2,little-dude/nose2,little-dude/nose2,leth/nose2,ojengwa/nose2,ezigman/nose2,ojengwa/nose2,ezigman/nose2,leth/nose2,ptthiem/nose2 |
f9bdf777a13404ba25e0e8cdf99a3554320529c9 | tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py | tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import benchmark
from telemetry.unittest import tab_test_case
class InspectorMemoryTest(tab_test_case.TabTestCase):
@benchmark.Enabled('h... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import benchmark
from telemetry.unittest import tab_test_case
class InspectorMemoryTest(tab_test_case.TabTestCase):
@benchmark.Enabled('h... | Add warnings to inspector DOM count unittest baselines. | Add warnings to inspector DOM count unittest baselines.
The unit test failure indicates a serious Document leak, where all
WebCore::Document loaded in Chrome is leaking.
This CL adds warning comments to the baseline to avoid regressions.
BUG=392121
NOTRY=true
Review URL: https://codereview.chromium.org/393123003
gi... | Python | bsd-3-clause | jaruba/chromium.src,Chilledheart/chromium,dednal/chromium.src,dednal/chromium.src,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Fireblend/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,dushu120... |
3dc9204c80f2f7be5f82200c059a6a62f02bf6c1 | www/pelicanconf.py | www/pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'IPython development team and Enthought, Inc.'
SITENAME = u'DistArray'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'IPython development team and Enthought, Inc.'
SITENAME = u'DistArray'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_... | Update blogroll and social links. | Update blogroll and social links.
| Python | bsd-3-clause | enthought/distarray,enthought/distarray,RaoUmer/distarray,RaoUmer/distarray |
d168599b9167ede2098aa2fe82375aa95e5ab8b3 | dockerpuller/app.py | dockerpuller/app.py | from flask import Flask
from flask import request
from flask import jsonify
import json
import subprocess
app = Flask(__name__)
config = None
@app.route('/', methods=['POST'])
def hook_listen():
if request.method == 'POST':
token = request.args.get('token')
if token == config['token']:
... | from flask import Flask
from flask import request
from flask import jsonify
import json
import subprocess
app = Flask(__name__)
config = None
@app.route('/', methods=['POST'])
def hook_listen():
if request.method == 'POST':
token = request.args.get('token')
if token == config['token']:
... | Check if hook parameter is passed to the url | Check if hook parameter is passed to the url
| Python | mit | nicocoffo/docker-puller,nicocoffo/docker-puller,glowdigitalmedia/docker-puller,glowdigitalmedia/docker-puller |
9349adb2efa5f0242cf9250d74d714a7e6aea1e9 | ordination/__init__.py | ordination/__init__.py | from .base import CA, RDA, CCA
__all__ = ['CA', 'RDA', 'CCA']
#
#from numpy.testing import Tester
#test = Tester().test
__version__ = '0.1-dev'
| from .base import CA, RDA, CCA
__all__ = ['CA', 'RDA', 'CCA']
#
#from numpy.testing import Tester
#test = Tester().test
# Compatible with PEP386
__version__ = '0.1.dev'
| Make version compatible with PEP386 | MAINT: Make version compatible with PEP386
| Python | bsd-3-clause | xguse/scikit-bio,wdwvt1/scikit-bio,johnchase/scikit-bio,xguse/scikit-bio,colinbrislawn/scikit-bio,Achuth17/scikit-bio,Achuth17/scikit-bio,jdrudolph/scikit-bio,Kleptobismol/scikit-bio,jensreeder/scikit-bio,Jorge-C/bipy,jairideout/scikit-bio,kdmurray91/scikit-bio,averagehat/scikit-bio,wdwvt1/scikit-bio,Kleptobismol/sciki... |
c5ed01ce81b1c0e459d93bf26bf96cdeb80a0344 | Lib/defconAppKit/representationFactories/__init__.py | Lib/defconAppKit/representationFactories/__init__.py | from defcon import Glyph, Image, registerRepresentationFactory
from defconAppKit.representationFactories.nsBezierPathFactory import NSBezierPathFactory
from defconAppKit.representationFactories.glyphCellFactory import GlyphCellFactory
from defconAppKit.representationFactories.glyphCellDetailFactory import GlyphCellDeta... | from defcon import Glyph, Image, registerRepresentationFactory
from defconAppKit.representationFactories.nsBezierPathFactory import NSBezierPathFactory
from defconAppKit.representationFactories.glyphCellFactory import GlyphCellFactory
from defconAppKit.representationFactories.glyphCellDetailFactory import GlyphCellDeta... | Use specific notifications when possible. | Use specific notifications when possible.
| Python | mit | typesupply/defconAppKit,typemytype/defconAppKit |
504e2321a001144d5466cb492c77f01e045c89d5 | test/tests/python-imports/container.py | test/tests/python-imports/container.py | import curses
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
if platform.python_implementation() != 'PyPy' and platform.python_version_tuple()[0] != '2':
# PyPy and Python 2 don't support lzma
import lzma
asse... | import curses
import dbm
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
if platform.python_implementation() != 'PyPy' and platform.python_version_tuple()[0] != '2':
# PyPy and Python 2 don't support lzma
import lz... | Add "dbm" to "python-imports" test | Add "dbm" to "python-imports" test
| Python | apache-2.0 | emilevauge/official-images,chorrell/official-images,docker-solr/official-images,davidl-zend/official-images,jperrin/official-images,docker-solr/official-images,davidl-zend/official-images,31z4/official-images,nodejs-docker-bot/official-images,emilevauge/official-images,davidl-zend/official-images,chorrell/official-imag... |
0f5716b10afff9ccbc17fb595cd7cc2f85b45f8f | tools/perf/page_sets/service_worker.py | tools/perf/page_sets/service_worker.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page
from telemetry.page import page_set as page_set
archive_data_file_path = 'data/service_worker.json'
class Service... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page
from telemetry.page import page_set as page_set
archive_data_file_path = 'data/service_worker.json'
class Service... | Add name attribute to each Page in ServiceWorkerPageSet | Telemetry: Add name attribute to each Page in ServiceWorkerPageSet
ServiceWorkerPerfTest loads the same page three times, but these should
have different characteristics because ServiceWorker works differently.
This patch gives each page load a name so we can track them separately.
BUG=
TEST=tools/perf/run_benchmark ... | Python | bsd-3-clause | Chilledheart/chromium,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk,Chilledheart/chromium,axinging/ch... |
574b069363f74de35b75b6b28ca66976e6af45bb | corehq/apps/smsforms/management/commands/migrate_sms_sessions_to_sql.py | corehq/apps/smsforms/management/commands/migrate_sms_sessions_to_sql.py | import logging
from django.core.management.base import BaseCommand
from corehq.apps.smsforms.models import XFormsSession, sync_sql_session_from_couch_session, SQLXFormsSession
from dimagi.utils.couch.database import iter_docs
class Command(BaseCommand):
args = ""
help = ""
def handle(self, *args, **optio... | import logging
from django.core.management.base import BaseCommand
from corehq.apps.smsforms.models import XFormsSession, sync_sql_session_from_couch_session, SQLXFormsSession
from dimagi.utils.couch.database import iter_docs
class Command(BaseCommand):
args = ""
help = ""
def handle(self, *args, **optio... | Fix situation where session id is an int | Fix situation where session id is an int
| Python | bsd-3-clause | dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq |
4a70f9ed2f19cba08208fa9f2a3cafe38ee283b6 | corehq/apps/userreports/tests/test_columns.py | corehq/apps/userreports/tests/test_columns.py | from django.test import SimpleTestCase
from jsonobject.exceptions import BadValueError
from corehq.apps.userreports.reports.specs import ReportColumn
class TestReportColumn(SimpleTestCase):
def testBadAggregation(self):
with self.assertRaises(BadValueError):
ReportColumn.wrap({
... | from django.test import SimpleTestCase
from jsonobject.exceptions import BadValueError
from sqlagg import SumWhen
from corehq.apps.userreports.sql import _expand_column
from corehq.apps.userreports.reports.specs import ReportColumn
class TestReportColumn(SimpleTestCase):
def testBadAggregation(self):
wit... | Add simple test for column expansion | Add simple test for column expansion
| Python | bsd-3-clause | qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq |
1b83a31090cd803d2eca0b9caed0f4cc9a149fbd | cubes/stores.py | cubes/stores.py | from .errors import *
from .browser import AggregationBrowser
from .extensions import get_namespace, initialize_namespace
__all__ = (
"open_store",
"Store"
)
def open_store(name, **options):
"""Gets a new instance of a model provider with name `name`."""
ns = get_namespace("s... | from .errors import *
from .browser import AggregationBrowser
from .extensions import get_namespace, initialize_namespace
__all__ = (
"open_store",
"Store"
)
def open_store(name, **options):
"""Gets a new instance of a model provider with name `name`."""
ns = get_namespace("s... | Raise ConfigurationError error that causes server to fail and dump whole stacktrace | Raise ConfigurationError error that causes server to fail and dump whole stacktrace
| Python | mit | noyeitan/cubes,jell0720/cubes,zejn/cubes,jell0720/cubes,she11c0de/cubes,cesarmarinhorj/cubes,jell0720/cubes,she11c0de/cubes,cesarmarinhorj/cubes,she11c0de/cubes,zejn/cubes,pombredanne/cubes,ubreddy/cubes,cesarmarinhorj/cubes,pombredanne/cubes,pombredanne/cubes,noyeitan/cubes,ubreddy/cubes,zejn/cubes,ubreddy/cubes,noyei... |
b9d167cf1eba2d55ab7710e78f38c3fa010d21ef | axelrod/strategies/__init__.py | axelrod/strategies/__init__.py | from cooperator import *
from defector import *
from grudger import *
from rand import *
from titfortat import *
from gobymajority import *
from alternator import *
from averagecopier import *
from grumpy import *
strategies = [
Defector,
Cooperator,
TitForTat,
Grudger,
GoByMaj... | from cooperator import *
from defector import *
from grudger import *
from rand import *
from titfortat import *
from gobymajority import *
from alternator import *
from averagecopier import *
from grumpy import *
from inverse import *
strategies = [
Defector,
Cooperator,
TitForTat,
Gr... | Change init to add inverse strategy | Change init to add inverse strategy | Python | mit | marcharper/Axelrod,ranjinidas/Axelrod,ranjinidas/Axelrod,marcharper/Axelrod |
9a9ee99129cee92c93fbc9e2cc24b7b933d51aac | confirmation/migrations/0001_initial.py | confirmation/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Confirmation',
fields... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='... | Add on_delete in foreign keys. | confirmation: Add on_delete in foreign keys.
on_delete will be a required arg for ForeignKey in Django 2.0. Set it
to models.CASCADE on models and in existing migrations if you want to
maintain the current default behavior.
See https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.ForeignKey.on_de... | Python | apache-2.0 | hackerkid/zulip,dhcrzf/zulip,Galexrt/zulip,showell/zulip,amanharitsh123/zulip,zulip/zulip,vabs22/zulip,vaidap/zulip,jackrzhang/zulip,jrowan/zulip,hackerkid/zulip,zulip/zulip,tommyip/zulip,kou/zulip,jackrzhang/zulip,brockwhittaker/zulip,brockwhittaker/zulip,tommyip/zulip,shubhamdhama/zulip,eeshangarg/zulip,shubhamdhama/... |
31f16844dd98516b1f57e3913d0fdba3e5715aa8 | logicaldelete/models.py | logicaldelete/models.py | import datetime
from django.db import models
from logicaldelete import managers
class Model(models.Model):
"""
This base model provides date fields and functionality to enable logical
delete functionality in derived models.
"""
date_created = models.DateTimeField(default=datetime.datetime.... | import datetime
from django.db import models
from logicaldelete import managers
class Model(models.Model):
"""
This base model provides date fields and functionality to enable logical
delete functionality in derived models.
"""
date_created = models.DateTimeField(default=datetime.datetime.now)
... | Delete method now softdeletep's all FK related objects | Delete method now softdeletep's all FK related objects
| Python | mit | pinax/pinax-models,angvp/django-logical-delete,Ubiwhere/pinax-models,angvp/django-logical-delete,naringas/pinax-models |
bb940826d78e44a4098023e83d788b3d915b9b1f | grip/constants.py | grip/constants.py | # The supported extensions, as defined by https://github.com/github/markup
supported_extensions = [
'.markdown', '.mdown', '.mkdn', '.md',
'.textile',
'.rdoc',
'.org',
'.creole',
'.mediawiki', '.wiki',
'.rst',
'.asciidoc', '.adoc', '.asc',
'.pod',
]
# The default filenames when no ... | # The supported extensions, as defined by https://github.com/github/markup
supported_extensions = ['.md', '.markdown']
# The default filenames when no file is provided
default_filenames = map(lambda ext: 'README' + ext, supported_extensions)
| Revert "Add the GitHub-supported format extensions." | Revert "Add the GitHub-supported format extensions."
This reverts commit 4f67141cfabe99af99434364e13fec91bef291a7.
| Python | mit | jbarreras/grip,joeyespo/grip,mgoddard-pivotal/grip,joeyespo/grip,mgoddard-pivotal/grip,ssundarraj/grip,jbarreras/grip,ssundarraj/grip |
238d031651cb74d0ca9bed9d38cda836049c9c37 | src/sentry/api/serializers/models/grouptagkey.py | src/sentry/api/serializers/models/grouptagkey.py | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagKey, TagKey
@register(GroupTagKey)
class GroupTagKeySerializer(Serializer):
def get_attrs(self, item_list, user):
tag_labels = {
t.key: t.get_label()
fo... | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagKey, TagKey
@register(GroupTagKey)
class GroupTagKeySerializer(Serializer):
def get_attrs(self, item_list, user):
tag_labels = {
t.key: t.get_label()
fo... | Correct fallback for tag name | Correct fallback for tag name
| Python | bsd-3-clause | daevaorn/sentry,gencer/sentry,zenefits/sentry,beeftornado/sentry,imankulov/sentry,BuildingLink/sentry,looker/sentry,looker/sentry,fotinakis/sentry,JamesMura/sentry,mvaled/sentry,alexm92/sentry,ifduyue/sentry,jean/sentry,beeftornado/sentry,fotinakis/sentry,BuildingLink/sentry,ifduyue/sentry,alexm92/sentry,BuildingLink/s... |
335881f4644a6bb2b5f2abb5b193f39d304dbc71 | pages_scrape.py | pages_scrape.py | import logging
import requests
def scrape(url, extractor):
"""
Function to request and parse a given URL. Returns only the "relevant"
text.
Parameters
----------
url : String.
URL to request and parse.
extractor : Goose class instance.
An instance of Goose th... | import logging
import requests
def scrape(url, extractor):
"""
Function to request and parse a given URL. Returns only the "relevant"
text.
Parameters
----------
url : String.
URL to request and parse.
extractor : Goose class instance.
An instance of Goose th... | Fix user agent for the bnn_ sites | Fix user agent for the bnn_ sites
| Python | mit | chilland/scraper,openeventdata/scraper |
2766e8797515497e5569b31696416db68641c9b4 | base/models.py | base/models.py | import os
from django.conf import settings
class MediaRemovalMixin(object):
"""
Removes all files associated with the model, as returned by the
get_media_files() method.
"""
# Models that use this mixin need to override this method
def get_media_files(self):
return
def delete(se... | import os
from django.conf import settings
class MediaRemovalMixin(object):
"""
Removes all files associated with the model, as returned by the
get_media_files() method.
"""
# Models that use this mixin need to override this method
def get_media_files(self):
return
def delete(se... | Extend MediaRemovalMixin to move media files on updates | base: Extend MediaRemovalMixin to move media files on updates
| Python | mit | matus-stehlik/roots,rtrembecky/roots,matus-stehlik/glowing-batman,tbabej/roots,rtrembecky/roots,rtrembecky/roots,matus-stehlik/roots,matus-stehlik/roots,tbabej/roots,matus-stehlik/glowing-batman,tbabej/roots |
2b380d501b80afad8c7c5ec27537bcc682ed2775 | commands/handle.py | commands/handle.py | import commands.cmds as cmds
def handle(self, chat_raw):
self.logger.info("Handling command: " + chat_raw + " (for player" + self.fquid + ")")
_atmp1 = chat_raw.split(" ")
_atmp2 = list(_atmp1[0])
del _atmp2[0]
del _atmp1[0]
cmdobj = {
"base": _atmp2,
"args_raw": _atmp1,
... | import commands.cmds as cmds
def handle(self, chat_raw):
self.logger.info("Handling command: " + chat_raw + " (for player" + self.fquid + ")")
_atmp1 = chat_raw.split(" ")
_atmp2 = list(_atmp1[0])
del _atmp2[0]
del _atmp1[0]
cmdobj = {
"base": _atmp2,
"args_raw": _atmp1,
... | Fix some scope mistakes. This fix was part of the reverted commit. | Fix some scope mistakes. This fix was part of the reverted commit.
| Python | mit | TiberiumPY/puremine,Armored-Dragon/pymineserver |
2c900f8bddc9efb40d900bf28f8c6b3188add71e | test/test_trix_parse.py | test/test_trix_parse.py | #!/usr/bin/env python
from rdflib.graph import ConjunctiveGraph
import unittest
class TestTrixParse(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testAperture(self):
g=ConjunctiveGraph()
g.parse("test/trix/aperture.trix",format="trix")
... | #!/usr/bin/env python
from rdflib.graph import ConjunctiveGraph
import unittest
class TestTrixParse(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testAperture(self):
g=ConjunctiveGraph()
g.parse("test/trix/aperture.trix",format="trix")
... | Disable trix parser tests with Jython | Disable trix parser tests with Jython
| Python | bsd-3-clause | RDFLib/rdflib,avorio/rdflib,yingerj/rdflib,ssssam/rdflib,ssssam/rdflib,marma/rdflib,armandobs14/rdflib,armandobs14/rdflib,dbs/rdflib,dbs/rdflib,RDFLib/rdflib,marma/rdflib,RDFLib/rdflib,yingerj/rdflib,avorio/rdflib,ssssam/rdflib,armandobs14/rdflib,RDFLib/rdflib,dbs/rdflib,marma/rdflib,marma/rdflib,ssssam/rdflib,armandob... |
836845abde53ee55bca93f098ece78880ab6b5c6 | examples/events/create_massive_dummy_events.py | examples/events/create_massive_dummy_events.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key, misp_verifycert
import argparse
import tools
def init(url, key):
return PyMISP(url, key, misp_verifycert, 'json')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create a give... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import url, key
import argparse
import tools
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create a given number of event containing a given number of attributes eachh.')
parser.add_argument("-l", "--... | Use same variable names as testing environment | Use same variable names as testing environment
| Python | bsd-2-clause | pombredanne/PyMISP,iglocska/PyMISP |
90d079928eaf48e370d21417e4d6e649ec0f5f6f | taskwiki/taskwiki.py | taskwiki/taskwiki.py | import sys
import re
import vim
from tasklib.task import TaskWarrior, Task
# Insert the taskwiki on the python path
sys.path.insert(0, vim.eval("s:plugin_path") + '/taskwiki')
from regexp import *
from task import VimwikiTask
from cache import TaskCache
"""
How this plugin works:
1.) On startup, it reads all t... | import sys
import re
import vim
from tasklib.task import TaskWarrior, Task
# Insert the taskwiki on the python path
sys.path.insert(0, vim.eval("s:plugin_path") + '/taskwiki')
from regexp import *
from task import VimwikiTask
from cache import TaskCache
"""
How this plugin works:
1.) On startup, it reads all t... | Update tasks and evaluate viewports on saving | Taskwiki: Update tasks and evaluate viewports on saving
| Python | mit | phha/taskwiki,Spirotot/taskwiki |
9e6a016c5a59b25199426f6825b2c83571997e68 | build/android/buildbot/tests/bb_run_bot_test.py | build/android/buildbot/tests/bb_run_bot_test.py | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
BUILDBOT_DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.append(BUILDBOT_DIR)
... | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
BUILDBOT_DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.append(BUILDBOT_DIR)
... | Refactor buildbot tests so that they can be used downstream. | [Android] Refactor buildbot tests so that they can be used downstream.
I refactored in the wrong way in r211209 (https://chromiumcodereview.appspot.com/18325030/). This CL fixes that. Note that r211209 is not broken; it is just not usable downstream.
BUG=249997
NOTRY=True
Review URL: https://chromiumcodereview.appsp... | Python | bsd-3-clause | ondra-novak/chromium.src,hgl888/chromium-crosswalk,jaruba/chromium.src,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,Pluto-tv/chromium-crosswalk,fujunwei/chromium-crosswalk,markYoungH/chromium.src,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,jaruba/chromium.src,ltilve/chromium,Ch... |
9c53e59ee0c4e5418b54d47c932454b7b907dc03 | seahub/profile/forms.py | seahub/profile/forms.py | # encoding: utf-8
from django import forms
from django.utils.html import escape
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, userna... | # encoding: utf-8
from django import forms
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, username):
nickname = self.cleaned_... | Revert escape nickname, desc, etc in user profile | Revert escape nickname, desc, etc in user profile
| Python | apache-2.0 | madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,miurahr/seahub,cloudcopy/seahub,Chilledheart/seahub,miurahr/seahub,madflow/seahub,madflow/seahub,madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub |
8affeda715b1facf12de1dab1d445bbe54616306 | oscar/core/ajax.py | oscar/core/ajax.py | import six
from django.contrib import messages
from six.moves import map
class FlashMessages(object):
"""
Intermediate container for flash messages.
This is useful as, at the time of creating the message, we don't know
whether the response is an AJAX response or not.
"""
def __init__(self):
... | import six
from django.contrib import messages
from six.moves import map
class FlashMessages(object):
"""
Intermediate container for flash messages.
This is useful as, at the time of creating the message, we don't know
whether the response is an AJAX response or not.
"""
def __init__(self):
... | Fix JSON serialisation problem with AJAX basket | Fix JSON serialisation problem with AJAX basket
six.moves.map returns itertools.imap which won't serialize to JSON.
This commit unpacks the list into a normal list of strings to circumvent
the issue.
| Python | bsd-3-clause | jmt4/django-oscar,jmt4/django-oscar,dongguangming/django-oscar,lijoantony/django-oscar,kapt/django-oscar,okfish/django-oscar,vovanbo/django-oscar,bnprk/django-oscar,Bogh/django-oscar,sasha0/django-oscar,ahmetdaglarbas/e-commerce,solarissmoke/django-oscar,bnprk/django-oscar,spartonia/django-oscar,WillisXChen/django-osca... |
e9d87a087a0f0102157d7c718a048c72f655c54a | smore/ext/marshmallow.py | smore/ext/marshmallow.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from marshmallow.compat import iteritems
from marshmallow import class_registry
from smore import swagger
from smore.apispec.core import Path
from smore.apispec.utils import load_operations_from_docstring
def schema_definition_helper(name, schema, **kwar... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from marshmallow.compat import iteritems
from marshmallow import class_registry
from smore import swagger
from smore.apispec.core import Path
from smore.apispec.utils import load_operations_from_docstring
def schema_definition_helper(spec, name, schema, ... | Store registered refs as plugin metadata | Store registered refs as plugin metadata
| Python | mit | marshmallow-code/apispec,Nobatek/apispec,marshmallow-code/smore,gorgias/apispec,jmcarp/smore |
8b9fe74976d77df32d73792f74ef4ddea1eb525f | config.py | config.py | #! /usr/bin/env python
import os
import warnings
import yaml
class Config(object):
config_fname = "configuration.yaml"
def __init__(self, config_fname=None):
config_fname = config_fname or self.config_fname
fo = open(config_fname, "r")
blob = fo.read()
fo.close()
self... | #! /usr/bin/env python
import os
import warnings
import yaml
class Config(object):
config_fname = "configuration.yaml"
def __init__(self, config_fname=None):
config_fname = config_fname or self.config_fname
fo = open(config_fname, "r")
blob = fo.read()
fo.close()
self... | Add Config.get() to skip KeyErrors | Add Config.get() to skip KeyErrors
Adds common `dict.get()` pattern to our own Config class, to enable
use of fallbacks or `None`, as appropriate. | Python | apache-2.0 | royrapoport/destalinator,TheConnMan/destalinator,royrapoport/destalinator,underarmour/destalinator,randsleadershipslack/destalinator,randsleadershipslack/destalinator,TheConnMan/destalinator |
780e4eb03420d75c18d0b21b5e616f2952aeda41 | test/test_basic_logic.py | test/test_basic_logic.py | # -*- coding: utf-8 -*-
"""
test_basic_logic
~~~~~~~~~~~~~~~~
Test the basic logic of the h2 state machines.
"""
import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
... | # -*- coding: utf-8 -*-
"""
test_basic_logic
~~~~~~~~~~~~~~~~
Test the basic logic of the h2 state machines.
"""
import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
... | Test sending headers with end stream. | Test sending headers with end stream.
| Python | mit | python-hyper/hyper-h2,bhavishyagopesh/hyper-h2,Kriechi/hyper-h2,Kriechi/hyper-h2,mhils/hyper-h2,vladmunteanu/hyper-h2,vladmunteanu/hyper-h2,python-hyper/hyper-h2 |
3709bcbd421d82f9404ab3b054989546d95c006f | sc2reader/scripts/sc2json.py | sc2reader/scripts/sc2json.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
import sc2reader
from sc2reader.plugins.replay import toJSON
def main():
import argparse
parser = argparse.ArgumentParser(description="Prints replay data to a json string.")
pa... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
import sc2reader
from sc2reader.factories.plugins.replay import toJSON
def main():
import argparse
parser = argparse.ArgumentParser(description="Prints replay data to a json string... | Fix another broken sc2reader.plugins reference. | Fix another broken sc2reader.plugins reference.
| Python | mit | ggtracker/sc2reader,GraylinKim/sc2reader,vlaufer/sc2reader,StoicLoofah/sc2reader,GraylinKim/sc2reader,StoicLoofah/sc2reader,ggtracker/sc2reader,vlaufer/sc2reader |
b1feed0ced6d1328cc39bc9bba36331ec6da7803 | pre_commit_hooks/detect_private_key.py | pre_commit_hooks/detect_private_key.py | from __future__ import print_function
import argparse
import sys
BLACKLIST = [
b'BEGIN RSA PRIVATE KEY',
b'BEGIN DSA PRIVATE KEY',
b'BEGIN EC PRIVATE KEY',
b'BEGIN OPENSSH PRIVATE KEY',
b'BEGIN PRIVATE KEY',
b'PuTTY-User-Key-File-2',
b'BEGIN SSH2 ENCRYPTED PRIVATE KEY',
]
def detect_priv... | from __future__ import print_function
import argparse
import sys
BLACKLIST = [
b'BEGIN RSA PRIVATE KEY',
b'BEGIN DSA PRIVATE KEY',
b'BEGIN EC PRIVATE KEY',
b'BEGIN OPENSSH PRIVATE KEY',
b'BEGIN PRIVATE KEY',
b'PuTTY-User-Key-File-2',
b'BEGIN SSH2 ENCRYPTED PRIVATE KEY',
b'BEGIN PGP PRI... | Add ban for pgp/gpg private key blocks | Add ban for pgp/gpg private key blocks
| Python | mit | pre-commit/pre-commit-hooks,Harwood/pre-commit-hooks |
2a106a12db2a59ccb0517a13db67b35f475b3ef5 | apps/survey/urls.py | apps/survey/urls.py | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
url(r'^main/$', views.main_index),
url(r'^group_management/$', vie... | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
url(r'^main/$', views.main_index),
url(r'^group_management/$', vie... | Add args to survey_data url | Add args to survey_data url
| Python | agpl-3.0 | chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork |
4a179825234b711a729fce5bc9ffc8de029c0999 | utest/controller/test_loading.py | utest/controller/test_loading.py | import unittest
from robot.utils.asserts import assert_true, assert_raises
from robotide.application.chiefcontroller import ChiefController
from robotide.namespace import Namespace
from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH
from robot.errors import DataError
class _FakeObserver(object):
def notify... | import unittest
from robot.utils.asserts import assert_true, assert_raises, assert_raises_with_msg
from robotide.controller import ChiefController
from robotide.namespace import Namespace
from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH, FakeLoadObserver
from robot.errors import DataError
class TestDataLoadi... | Test for invalid data when loading | Test for invalid data when loading
| Python | apache-2.0 | robotframework/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,caio2k/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,caio2k/RIDE,caio2k/RIDE |
1396ff4ab4e6664c265f97958951815a525f7823 | reddit_donate/pages.py | reddit_donate/pages.py | from r2.lib.pages import Reddit
from r2.lib.wrapped import Templated
class DonatePage(Reddit):
extra_stylesheets = Reddit.extra_stylesheets + ["donate.less"]
def __init__(self, title, content, **kwargs):
Reddit.__init__(
self,
title=title,
content=content,
... | from r2.lib.pages import Reddit
from r2.lib.wrapped import Templated
class DonatePage(Reddit):
extra_stylesheets = Reddit.extra_stylesheets + ["donate.less"]
def __init__(self, title, content, **kwargs):
Reddit.__init__(
self,
title=title,
content=content,
... | Remove confusing navigation tabs from header. | Remove confusing navigation tabs from header.
| Python | bsd-3-clause | reddit/reddit-plugin-donate,madbook/reddit-plugin-donate,reddit/reddit-plugin-donate,madbook/reddit-plugin-donate,madbook/reddit-plugin-donate,reddit/reddit-plugin-donate |
60b5948508a67cb213ca04b5faacb77e27d8f84c | samples/forms.py | samples/forms.py | import datetime #for checking renewal date range.
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .models import (Patient, AdmissionNote, FluVaccine,
CollectionType, CollectedSample,
Symptom, ObservedSymptom,
)
from fioc... | import datetime #for checking renewal date range.
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .models import (Patient, AdmissionNote, FluVaccine,
CollectionType, CollectedSample,
Symptom, ObservedSymptom,
)
from fioc... | Add fields expicitly declared in form | :art: Add fields expicitly declared in form
| Python | mit | gems-uff/labsys,gems-uff/labsys,gems-uff/labsys,gcrsaldanha/fiocruz,gcrsaldanha/fiocruz |
ea0087970b0c0adfd8942123899ff0ec231afa03 | test/selenium/src/lib/page/extended_info.py | test/selenium/src/lib/page/extended_info.py | # 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: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""A module for extended info page models (visible in LHN on hover over
obje... | # 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: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""A module for extended info page models (visible in LHN on hover over
obje... | Handle stealable element with utils | Handle stealable element with utils
| Python | apache-2.0 | AleksNeStu/ggrc-core,edofic/ggrc-core,josthkko/ggrc-core,kr41/ggrc-core,prasannav7/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,selahsse... |
0cabf3c4dae3599e2d1627ff41707cf36b4d2ddd | acoustics/__init__.py | acoustics/__init__.py | """
Acoustics
=========
The acoustics module...
"""
import acoustics.ambisonics
import acoustics.utils
import acoustics.octave
import acoustics.doppler
import acoustics.signal
import acoustics.directivity
import acoustics.building
import acoustics.room
import acoustics.standards
import acoustics.cepstrum
from acoust... | """
Acoustics
=========
The acoustics module...
"""
import acoustics.aio
import acoustics.ambisonics
import acoustics.atmosphere
import acoustics.bands
import acoustics.building
import acoustics.cepstrum
import acoustics.criterion
import acoustics.decibel
import acoustics.descriptors
import acoustics.directivity
impo... | Load all modules by default | Load all modules by default
| Python | bsd-3-clause | python-acoustics/python-acoustics,antiface/python-acoustics,FRidh/python-acoustics,felipeacsi/python-acoustics,giumas/python-acoustics |
a42a6a54f732ca7eba700b867a3025739ad6a271 | list_all_users_in_group.py | list_all_users_in_group.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import grp
import pwd
import inspect
import argparse
def list_all_users_in_group(groupname):
"""Get list of all users of group.
Get sorted list of all users of group GROUP,
including users with main group GROUP.
Ori... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import grp
import pwd
import inspect
import argparse
def list_all_users_in_group(groupname):
"""Get list of all users of group.
Get sorted list of all users of group GROUP,
including users with main group GROUP.
Ori... | Move main code to function because of pylint warning 'Invalid constant name' | Move main code to function because of pylint warning 'Invalid constant name'
| Python | cc0-1.0 | vazhnov/list_all_users_in_group |
84990a4ef20c2e0f42133ed06ade5ce2d4e98ae3 | chmvh_website/team/models.py | chmvh_website/team/models.py | from django.db import models
def team_member_image_name(instance, filename):
return 'team/{0}'.format(instance.name)
class TeamMember(models.Model):
bio = models.TextField(
verbose_name='biography')
name = models.CharField(
max_length=50,
unique=True,
verbose_name='name')... | import os
from django.db import models
def team_member_image_name(instance, filename):
_, ext = os.path.splitext(filename)
return 'team/{0}{1}'.format(instance.name, ext)
class TeamMember(models.Model):
bio = models.TextField(
verbose_name='biography')
name = models.CharField(
max_... | Save team member picture with extension. | Save team member picture with extension.
| Python | mit | cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website |
257134bdaea7c250d5956c4095adf0b917b65aa6 | database/dict_converters/event_details_converter.py | database/dict_converters/event_details_converter.py | from database.dict_converters.converter_base import ConverterBase
class EventDetailsConverter(ConverterBase):
SUBVERSIONS = { # Increment every time a change to the dict is made
3: 0,
}
@classmethod
def convert(cls, event_details, dict_version):
CONVERTERS = {
3: cls.even... | from database.dict_converters.converter_base import ConverterBase
class EventDetailsConverter(ConverterBase):
SUBVERSIONS = { # Increment every time a change to the dict is made
3: 0,
}
@classmethod
def convert(cls, event_details, dict_version):
CONVERTERS = {
3: cls.even... | Fix null case for event details | Fix null case for event details
| Python | mit | verycumbersome/the-blue-alliance,the-blue-alliance/the-blue-alliance,nwalters512/the-blue-alliance,nwalters512/the-blue-alliance,the-blue-alliance/the-blue-alliance,tsteward/the-blue-alliance,nwalters512/the-blue-alliance,phil-lopreiato/the-blue-alliance,nwalters512/the-blue-alliance,tsteward/the-blue-alliance,jaredhas... |
39b63523634801fe8ef2cca03e11b3875d84cdbd | flare/flare_io.py | flare/flare_io.py | from flare.struc import Structure
from typing import List
from json import dump, load
from flare.util import NumpyEncoder
def md_trajectory_to_file(filename, structures: List[Structure]):
"""
Take a list of structures and write them to a json file.
:param filename:
:param structures:
"""
f = open(filename, 'w')
... | from flare.struc import Structure
from typing import List
from json import dump, load
from flare.util import NumpyEncoder
def md_trajectory_to_file(filename: str, structures: List[Structure]):
"""
Take a list of structures and write them to a json file.
:param filename:
:param structures:
"""
with open(filename,... | Tweak syntax for f.close() concision, add typehints | Tweak syntax for f.close() concision, add typehints | Python | mit | mir-group/flare,mir-group/flare |
c3afc6c28530c3dfc3bd57d9a1841a60bf92ba4f | tools/perf/benchmarks/netsim_top25.py | tools/perf/benchmarks/netsim_top25.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import test
from perf_tools import page_cycler
class NetsimTop25(test.Test):
"""Measures load time of the top 25 sites under simulated cab... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import test
from perf_tools import page_cycler
class NetsimTop25(test.Test):
"""Measures load time of the top 25 sites under simulated cab... | Fix bug which caused page cyclers to always clear cache before load. | [Telemetry] Fix bug which caused page cyclers to always clear cache before load.
Previously, the cache clearing bit would apply when the netsim benchmark was
imported. This fixes it so that it only applies when it is used.
BUG=256492
NOTRY=True
TBR=dtu@chromium.org
Review URL: https://codereview.chromium.org/1855000... | Python | bsd-3-clause | mohamed--abdel-maksoud/chromium.src,patrickm/chromium.src,chuan9/chromium-crosswalk,jaruba/chromium.src,Chilledheart/chromium,littlstar/chromium.src,fujunwei/chromium-crosswalk,jaruba/chromium.src,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,hgl888/ch... |
3adcefcad4fc3ecb85aa4a22e8b3c4bf5ca4e6f5 | test/integration/ggrc/converters/test_import_update.py | test/integration/ggrc/converters/test_import_update.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from integration.ggrc.converters import TestCase
from ggrc import models
class TestImportUpdates(TestCase):
""" Test importing of already existing objects """
def setUp(self):
TestCase.setUp(sel... | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Tests for bulk updates with CSV import."""
from integration.ggrc.converters import TestCase
from ggrc import models
class TestImportUpdates(TestCase):
""" Test importing of already existing objects... | Add tests for revision updates via import | Add tests for revision updates via import
This tests checks if new revisions were added for object updated via CSV
import.
| Python | apache-2.0 | edofic/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,jo... |
58fee826ab5298f7de036bf320bbc109b853eec8 | tendrl/commons/manager/__init__.py | tendrl/commons/manager/__init__.py | import abc
import logging
import six
from tendrl.commons import jobs
LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class Manager(object):
def __init__(
self,
sds_sync_thread,
central_store_thread,
):
self._central_store_thread = central_store_... | import abc
import logging
import six
from tendrl.commons import jobs
LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class Manager(object):
def __init__(
self,
sds_sync_thread,
central_store_thread,
):
self._central_store_thread = central_store_... | Add null check for sds sync thread which can be optional | Add null check for sds sync thread which can be optional
Signed-off-by: anmolbabu <3d38fb1e9c5ff2662fc415254efcdfedb95b84d5@gmail.com>
| Python | lgpl-2.1 | Tendrl/commons,rishubhjain/commons,r0h4n/commons |
eb0772fc6c30d98b83bf1c8e7d83af21066ae45b | data_structures/Stack/Python/Stack.py | data_structures/Stack/Python/Stack.py | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = []
# Return and remove the last element of the stack array.
def pop(self):
# If the stack... | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = []
# Return and remove the last element of the stack array.
def pop(self):
# If the stack... | Add peek method and implementation | Add peek method and implementation
| Python | cc0-1.0 | Deepak345/al-go-rithms,Cnidarias/al-go-rithms,EUNIX-TRIX/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,Deepak345/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,EUNIX-TRIX/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al-go-r... |
6be70d01bdf58389db2a6adc4035f82669d02a61 | cms/plugins/googlemap/cms_plugins.py | cms/plugins/googlemap/cms_plugins.py | from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugins.googlemap.models import GoogleMap
from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY
from cms.plugins.googlemap import settings
from django.forms.widgets... | from django.conf import settings
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugins.googlemap.models import GoogleMap
from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY
from django.forms.widgets import Me... | Allow use of GoogleMaps plugin without Multilingual support | Allow use of GoogleMaps plugin without Multilingual support
| Python | bsd-3-clause | cyberintruder/django-cms,chmberl/django-cms,owers19856/django-cms,jproffitt/django-cms,vstoykov/django-cms,MagicSolutions/django-cms,isotoma/django-cms,jproffitt/django-cms,chkir/django-cms,stefanw/django-cms,jeffreylu9/django-cms,divio/django-cms,Vegasvikk/django-cms,jrief/django-cms,pbs/django-cms,farhaadila/django-c... |
c15c4a663c257cad6763cf92c50b7ad706017c74 | evesrp/views/__init__.py | evesrp/views/__init__.py | from collections import OrderedDict
from urllib.parse import urlparse
import re
from flask import render_template, redirect, url_for, request, abort, jsonify,\
flash, Markup, session
from flask.views import View
from flask.ext.login import login_user, login_required, logout_user, \
current_user
from fl... | from flask import render_template
from flask.ext.login import login_required
from .. import app
@app.route('/')
@login_required
def index():
return render_template('base.html')
| Remove extraneous imports in the base view package | Remove extraneous imports in the base view package | Python | bsd-2-clause | eskwire/evesrp,eskwire/evesrp,paxswill/evesrp,eskwire/evesrp,paxswill/evesrp,paxswill/evesrp,eskwire/evesrp |
d187c51ccd9dc1676b6f16eddecee6dce752d668 | distarray/tests/test_client.py | distarray/tests/test_client.py | import unittest
from IPython.parallel import Client
from distarray.client import DistArrayContext
class TestClient(unittest.TestCase):
def setUp(self):
self.client = Client()
self.dv = self.client[:]
def testCreateDAC(self):
'''Can we create a plain vanilla context?'''
dac = ... | import unittest
from IPython.parallel import Client
from distarray.client import DistArrayContext
class TestDistArrayContext(unittest.TestCase):
def setUp(self):
self.client = Client()
self.dv = self.client[:]
def test_create_DAC(self):
'''Can we create a plain vanilla context?'''
... | Make class test-class name more specific | Make class test-class name more specific
... to make room for more client tests. | Python | bsd-3-clause | RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray |
2611476df6f362cd59e4aad38a243fc8f6cbf8a8 | devincachu/purger.py | devincachu/purger.py | # -*- coding: utf-8 -*-
import roan
from django.contrib.flatpages import models
from palestras import models as pmodels
def connect():
flatpages = models.FlatPage.objects.all()
for f in flatpages:
roan.purge(f.url).on_save(models.FlatPage)
palestras = pmodels.Palestra.objects.all()
for p in... | # -*- coding: utf-8 -*-
import roan
from django.contrib.flatpages import models
from palestras import models as pmodels
def connect():
flatpages = models.FlatPage.objects.all()
for f in flatpages:
roan.purge(f.url).on_save(models.FlatPage)
palestras = pmodels.Palestra.objects.all()
for p in... | Purge da página de palestra quando salva palestrante | Purge da página de palestra quando salva palestrante
| Python | bsd-2-clause | devincachu/devincachu-2013,devincachu/devincachu-2013,devincachu/devincachu-2014,devincachu/devincachu-2014,devincachu/devincachu-2014,devincachu/devincachu-2013,devincachu/devincachu-2013 |
cdd1f3410b8ae304485f7992ac6048e1277cffe1 | parsedatetime/pdt_locales/__init__.py | parsedatetime/pdt_locales/__init__.py | # -*- encoding: utf-8 -*-
"""
pdt_locales
All of the included locale classes shipped with pdt.
"""
try:
import PyICU as pyicu
except:
pyicu = None
def lcase(x):
return x.lower()
from .base import pdtLocale_base, pdtLocale_icu
from .de_DE import *
from .en_AU import *
from .en_US import *
from .es im... | # -*- encoding: utf-8 -*-
"""
pdt_locales
All of the included locale classes shipped with pdt.
"""
import os
try:
import PyICU as pyicu
except:
pyicu = None
import yaml
def lcase(x):
return x.lower()
from .base import pdtLocale_base, pdtLocale_icu
from .de_DE import *
from .en_AU import *
from .en_... | Add local locale from file | Add local locale from file
| Python | apache-2.0 | phoebebright/parsedatetime,bear/parsedatetime,idpaterson/parsedatetime |
24788b106b9cdd70e7240dc3eccac82fba290c85 | tests/util/test_yaml.py | tests/util/test_yaml.py | """Test Home Assistant yaml loader."""
import io
import unittest
from homeassistant.util import yaml
class TestYaml(unittest.TestCase):
"""Test util.yaml loader."""
def test_simple_list(self):
"""Test simple list."""
conf = "config:\n - simple\n - list"
with io.StringIO(conf) as f:... | """Test Home Assistant yaml loader."""
import io
import unittest
import os
from homeassistant.util import yaml
class TestYaml(unittest.TestCase):
"""Test util.yaml loader."""
def test_simple_list(self):
"""Test simple list."""
conf = "config:\n - simple\n - list"
with io.StringIO(c... | Add test for yaml enviroment | Add test for yaml enviroment
| Python | mit | lukas-hetzenecker/home-assistant,LinuxChristian/home-assistant,molobrakos/home-assistant,sffjunkie/home-assistant,titilambert/home-assistant,ewandor/home-assistant,emilhetty/home-assistant,mikaelboman/home-assistant,nkgilley/home-assistant,robbiet480/home-assistant,jawilson/home-assistant,molobrakos/home-assistant,devd... |
b3f91806b525ddef50d541f937bed539f9bae20a | mezzanine/project_template/deploy/live_settings.py | mezzanine/project_template/deploy/live_settings.py |
DATABASES = {
"default": {
# Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
"ENGINE": "django.db.backends.postgresql_psycopg2",
# DB name or path to database file if using sqlite3.
"NAME": "%(proj_name)s",
# Not used with sqlite3.
"USER": "%(proj_na... |
DATABASES = {
"default": {
# Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
"ENGINE": "django.db.backends.postgresql_psycopg2",
# DB name or path to database file if using sqlite3.
"NAME": "%(proj_name)s",
# Not used with sqlite3.
"USER": "%(proj_na... | Use cache backend for sessions in deployed settings. | Use cache backend for sessions in deployed settings.
| Python | bsd-2-clause | Kniyl/mezzanine,webounty/mezzanine,spookylukey/mezzanine,theclanks/mezzanine,batpad/mezzanine,sjdines/mezzanine,dovydas/mezzanine,readevalprint/mezzanine,eino-makitalo/mezzanine,industrydive/mezzanine,joshcartme/mezzanine,Cajoline/mezzanine,frankier/mezzanine,PegasusWang/mezzanine,biomassives/mezzanine,Skytorn86/mezzan... |
533559e20e377ce042591709e53d7dc7031d6205 | tests/test_directives.py | tests/test_directives.py | """tests/test_directives.py.
Tests to ensure that directives interact in the etimerpected mannor
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without... | """tests/test_directives.py.
Tests to ensure that directives interact in the etimerpected mannor
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without... | Add test for timer automatically inserted due to directive | Add test for timer automatically inserted due to directive
| Python | mit | giserh/hug,STANAPO/hug,MuhammadAlkarouri/hug,janusnic/hug,MuhammadAlkarouri/hug,janusnic/hug,gbn972/hug,MuhammadAlkarouri/hug,STANAPO/hug,shaunstanislaus/hug,yasoob/hug,jean/hug,philiptzou/hug,philiptzou/hug,jean/hug,shaunstanislaus/hug,origingod/hug,giserh/hug,yasoob/hug,timothycrosley/hug,alisaifee/hug,timothycrosley... |
dab192db863fdd694bb0adbce10fa2dd6c05353b | jrnl/__init__.py | jrnl/__init__.py | #!/usr/bin/env python
# encoding: utf-8
"""
jrnl is a simple journal application for your command line.
"""
__title__ = 'jrnl'
__version__ = '1.0.3'
__author__ = 'Manuel Ebert'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2013 Manuel Ebert'
from . import Journal
from . import jrnl
| #!/usr/bin/env python
# encoding: utf-8
"""
jrnl is a simple journal application for your command line.
"""
__title__ = 'jrnl'
__version__ = '1.0.3'
__author__ = 'Manuel Ebert'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2013 Manuel Ebert'
from . import Journal
from . import jrnl
from .jrnl import cli
| Make the cli work again. | Make the cli work again.
| Python | mit | rzyns/jrnl,philipsd6/jrnl,notbalanced/jrnl,flight16/jrnl,maebert/jrnl,MSylvia/jrnl,dzeban/jrnl,nikvdp/jrnl,cloudrave/jrnl-todos,MinchinWeb/jrnl,beni55/jrnl,zdravi/jrnl,Shir0kamii/jrnl |
2c57f2143e21fa3d006d4e4e2737429fb60b4797 | tornado/setup_pg.py | tornado/setup_pg.py | from os.path import expanduser
from os import kill
import subprocess
import sys
import time
python = expanduser('~/FrameworkBenchmarks/installs/py2/bin/python')
cwd = expanduser('~/FrameworkBenchmarks/tornado')
def start(args, logfile, errfile):
subprocess.Popen(
python + " server.py --port=8080 --postg... | import os
import subprocess
import sys
import time
bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
python = os.path.expanduser(os.path.join(bin_dir, 'python'))
pip = os.path.expanduser(os.path.join(bin_dir, 'pip'))
cwd = os.path.expanduser('~/FrameworkBenchmarks/tornado')
def start(args, logf... | Call pip install before running server. | Call pip install before running server.
| Python | bsd-3-clause | knewmanTE/FrameworkBenchmarks,PermeAgility/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,raziel057/FrameworkBenchmarks,saturday06/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,sanjoydesk/FrameworkBenchmarks,ashawnbandy-te-tfb/FrameworkBenchmarks,markkolich/FrameworkBenchmarks,stefanocasazza/FrameworkB... |
c3e7b563c3eeb24aa269f23672b8f469470908b7 | onetime/views.py | onetime/views.py | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
from django.shortcuts import get_object_or_404
from django.contrib.auth import login
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
def lo... | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
from django.shortcuts import get_object_or_404
from django.contrib.auth import login
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
def lo... | Add an option to redirect user to a page if the key is already expired. | Add an option to redirect user to a page if the key is already expired.
| Python | agpl-3.0 | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,uploadcare/django-loginurl,ISIFoundation/influenzanet-website,vanschelven/cmsplugin-journal,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,fajran/django-loginurl,ISIFoundation/influenzanet-web... |
0e9e63a48c5f3e02fb49d0068363ac5442b39e37 | discussion/models.py | discussion/models.py | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | Add a body to posts | Add a body to posts
| Python | bsd-2-clause | incuna/django-discussion,lehins/lehins-discussion,lehins/lehins-discussion,incuna/django-discussion,lehins/lehins-discussion |
8ad4627973db344e228a9170aef030ab58efdeb9 | src/ggrc/converters/__init__.py | src/ggrc/converters/__init__.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc.converters.sections import SectionsConverter
all_converters = [('sectio... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc.converters.sections import SectionsConverter
from ggrc.models import (
... | Add column order and importable objects lists | Add column order and importable objects lists
| Python | apache-2.0 | edofic/ggrc-core,hasanalom/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,jmakov/ggrc-core,VinnieJohns/ggrc-core,edofic/ggrc-core,selahssea/ggrc-core,hyperNURb/ggrc-... |
353df423343688f206c0f3628092608d1a95f5c2 | mopidy/backends/__init__.py | mopidy/backends/__init__.py | import logging
import time
from mopidy.exceptions import MpdNotImplemented
from mopidy.models import Playlist
logger = logging.getLogger('backends.base')
class BaseBackend(object):
current_playlist = None
library = None
playback = None
stored_playlists = None
uri_handlers = []
class BasePlayback... | import logging
import time
from mopidy.exceptions import MpdNotImplemented
from mopidy.models import Playlist
logger = logging.getLogger('backends.base')
class BaseBackend(object):
current_playlist = None
library = None
playback = None
stored_playlists = None
uri_handlers = []
class BasePlayback... | Use textual defaults for status constants | Use textual defaults for status constants
| Python | apache-2.0 | SuperStarPL/mopidy,liamw9534/mopidy,glogiotatidis/mopidy,mopidy/mopidy,hkariti/mopidy,tkem/mopidy,hkariti/mopidy,jcass77/mopidy,bencevans/mopidy,pacificIT/mopidy,jodal/mopidy,jmarsik/mopidy,woutervanwijk/mopidy,kingosticks/mopidy,hkariti/mopidy,jodal/mopidy,mokieyue/mopidy,pacificIT/mopidy,mokieyue/mopidy,vrs01/mopidy,... |
09099ab106ae4c0695502e3632e4ac1c2f459566 | apps/teams/bulk_actions.py | apps/teams/bulk_actions.py | from django.contrib.contenttypes.models import ContentType
from subtitles.models import SubtitleLanguage
from teams.signals import api_subtitles_approved
from utils.csv_parser import UnicodeReader
from videos.tasks import video_changed_tasks
def complete_approve_tasks(tasks):
lang_ct = ContentType.objects.get_for_... | from django.contrib.contenttypes.models import ContentType
from subtitles.models import SubtitleLanguage
from subtitles.signals import subtitles_published
from teams.signals import api_subtitles_approved
from utils.csv_parser import UnicodeReader
from videos.tasks import video_changed_tasks
def complete_approve_tasks(... | Send subtitles_published signal for bulk approvals | Send subtitles_published signal for bulk approvals
This fixes pculture/amara-enterprise#608
| Python | agpl-3.0 | pculture/unisubs,pculture/unisubs,wevoice/wesub,pculture/unisubs,wevoice/wesub,wevoice/wesub,pculture/unisubs,wevoice/wesub |
f659f773b7713fab2bb02a4a26eefc9e002145ca | test/tests/python-imports/container.py | test/tests/python-imports/container.py | import curses
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import zlib
assert(zlib.decompress(zlib.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
| import curses
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
if platform.python_implementation() != 'PyPy' and platform.python_version_tuple()[0] != '2':
# PyPy and Python 2 don't support lzma
import lzma
asse... | Add "lzma" to "python-imports" test | Add "lzma" to "python-imports" test
| Python | apache-2.0 | chorrell/official-images,docker-flink/official-images,docker-library/official-images,nodejs-docker-bot/official-images,jperrin/official-images,docker-library/official-images,chorrell/official-images,pesho/docker-official-images,benbc/docker-official-images,mattrobenolt/official-images,docker-flink/official-images,31z4/... |
78ff64e41c7378200e99d26ea030ec12b70f0625 | tests/test_io.py | tests/test_io.py | from __future__ import with_statement
from nose.tools import eq_
from fabric.io import OutputLooper
from fabric.context_managers import settings
def test_request_prompts():
"""
Test valid responses from prompts
"""
def run(txt, prompts):
with settings(prompts=prompts):
# try to f... | # -*- coding: utf-8 -*-
from __future__ import with_statement
import sys
from io import BytesIO
from nose.tools import eq_
from fabric.io import OutputLooper
from fabric.context_managers import hide, settings
from utils import mock_streams
def test_request_prompts():
"""
Test valid responses from prompts
... | Add test which detects the UnicodeDecodeError from pip | Add test which detects the UnicodeDecodeError from pip
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 4095: unexpected end of data
https://github.com/mathiasertl/fabric/issues/5
| Python | bsd-2-clause | ploxiln/fabric,mathiasertl/fabric,rodrigc/fabric |
3f543f9e3a328441ae477ca3fb299fbc86ffc40f | oneflow/base/tasks.py | oneflow/base/tasks.py | # -*- coding: utf-8 -*-
import logging
#import datetime
from celery import task
from django.contrib.auth import get_user_model
LOGGER = logging.getLogger(__name__)
User = get_user_model()
#ftstamp = datetime.datetime.fromtimestamp
#now = datetime.datetime.now
@task
def celery_beat_test():
LOGGER.info(u... | # -*- coding: utf-8 -*-
import logging
#import datetime
from celery import task
from django.contrib.auth import get_user_model
LOGGER = logging.getLogger(__name__)
User = get_user_model()
#ftstamp = datetime.datetime.fromtimestamp
#now = datetime.datetime.now
@task
def celery_beat_test():
LOGGER.info(u... | Fix for missing username and clear the social_auth to force re-authentication at next login. | Fix for missing username and clear the social_auth to force re-authentication at next login. | Python | agpl-3.0 | WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow |
97c25703904a0f2508238d4268259692f9e7a665 | test/integration/ggrc/converters/test_import_automappings.py | test/integration/ggrc/converters/test_import_automappings.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from ggrc.models import Relationship
from ggrc.converters import errors
from integration.ggrc.converters import TestCase
from integration.ggrc.generator import ObjectGenerator
class TestBasicCsvImport(Test... | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from integration.ggrc.converters import TestCase
from integration.ggrc.generator import ObjectGenerator
class TestBasicCsvImport(TestCase):
def setUp(self):
TestCase.setUp(self)
self.generator =... | Clean up import auto mappings tests | Clean up import auto mappings tests
| Python | apache-2.0 | edofic/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,josthkko/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,edofi... |
ec14651411d3489e85cabc323bb6fa90eeb7041a | third_party/gpus/compress_find_cuda_config.py | third_party/gpus/compress_find_cuda_config.py | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Remove .oss from find_cuda_config in compression script. | Remove .oss from find_cuda_config in compression script.
See https://github.com/tensorflow/tensorflow/pull/40759
PiperOrigin-RevId: 318452377
Change-Id: I04f3ad1c8cf9cac5446d0a1196ebbf66660bf312
| Python | apache-2.0 | freedomtan/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,davidzchen/tensorflow,karllessard/tensorflow,Intel-Corporation/tensorflow,cxxgtxy/tensorflow,annarev/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,te... |
be70b1528f51385c8221b7337cdc8669f53fa1c6 | textblob/decorators.py | textblob/decorators.py | # -*- coding: utf-8 -*-
'''Custom decorators.'''
from __future__ import absolute_import
from textblob.exceptions import MissingCorpusException
class cached_property(object):
'''A property that is only computed once per instance and then replaces
itself with an ordinary attribute. Deleting the attribute reset... | # -*- coding: utf-8 -*-
'''Custom decorators.'''
from __future__ import absolute_import
from functools import wraps
from textblob.exceptions import MissingCorpusException
class cached_property(object):
'''A property that is only computed once per instance and then replaces
itself with an ordinary attribute. ... | Use wraps decorator for requires_nltk_corpus | Use wraps decorator for requires_nltk_corpus
| Python | mit | jcalbert/TextBlob,freakynit/TextBlob,nvoron23/TextBlob,IrisSteenhout/TextBlob,adelq/TextBlob,beni55/TextBlob,jonmcoe/TextBlob,dipeshtech/TextBlob,sargam111/python,sloria/TextBlob,Windy-Ground/TextBlob,laugustyniak/TextBlob |
eb1daa3edfaa72cad2cb39507b2db0bf95204561 | markitup/renderers.py | markitup/renderers.py | from __future__ import unicode_literals
try:
from docutils.core import publish_parts
def render_rest(markup, **docutils_settings):
parts = publish_parts(source=markup, writer_name="html4css1", settings_overrides=docutils_settings)
return parts["html_body"]
except ImportError:
pass
| from __future__ import unicode_literals
try:
from docutils.core import publish_parts
def render_rest(markup, **docutils_settings):
docutils_settings.update({
'raw_enabled': False,
'file_insertion_enabled': False,
})
parts = publish_parts(
source=mar... | Enforce better security in sample ReST renderer. | Enforce better security in sample ReST renderer.
| Python | bsd-3-clause | WimpyAnalytics/django-markitup,carljm/django-markitup,WimpyAnalytics/django-markitup,zsiciarz/django-markitup,zsiciarz/django-markitup,carljm/django-markitup,WimpyAnalytics/django-markitup,carljm/django-markitup,zsiciarz/django-markitup |
10782310cfee0d2c2938748056f6549b5918b969 | src/sentry/debug/utils/patch_context.py | src/sentry/debug/utils/patch_context.py | from __future__ import absolute_import
from sentry.utils.imports import import_string
class PatchContext(object):
def __init__(self, target, callback):
target, attr = target.rsplit('.', 1)
target = import_string(target)
self.func = getattr(target, attr)
self.target = target
... | from __future__ import absolute_import
from threading import Lock
from sentry.utils.imports import import_string
class PatchContext(object):
def __init__(self, target, callback):
target, attr = target.rsplit('.', 1)
target = import_string(target)
self.target = target
self.attr = a... | Use a thread lock to patch contexts. | Use a thread lock to patch contexts.
This fixes #3185
| Python | bsd-3-clause | looker/sentry,zenefits/sentry,mvaled/sentry,alexm92/sentry,alexm92/sentry,looker/sentry,gencer/sentry,ifduyue/sentry,jean/sentry,JackDanger/sentry,JackDanger/sentry,ifduyue/sentry,BuildingLink/sentry,gencer/sentry,beeftornado/sentry,BuildingLink/sentry,mvaled/sentry,JamesMura/sentry,jean/sentry,zenefits/sentry,zenefits... |
232c0a600946e2a679947fe638938e56d2fa7709 | vint/ast/parsing.py | vint/ast/parsing.py | import extlib.vimlparser
class Parser(object):
def __init__(self, plugins=None):
""" Initialize Parser with the specified plugins.
The plugins can add attributes to the AST.
"""
self.plugins = plugins or []
def parse(self, string):
""" Parse vim script string and retu... | import extlib.vimlparser
class Parser(object):
def __init__(self, plugins=None):
""" Initialize Parser with the specified plugins.
The plugins can add attributes to the AST.
"""
self.plugins = plugins or []
def parse(self, string):
""" Parse vim script string and retu... | Add TOPLEVEL pos to unify node pos interface | Add TOPLEVEL pos to unify node pos interface
| Python | mit | RianFuro/vint,Kuniwak/vint,RianFuro/vint,Kuniwak/vint |
12d239d62c293cdb1a3fa1a69df06bf9c8e65366 | grip/github_renderer.py | grip/github_renderer.py | from flask import abort, json
import requests
def render_content(text, gfm=False, context=None, username=None, password=None):
"""Renders the specified markup using the GitHub API."""
if gfm:
url = 'https://api.github.com/markdown'
data = {'text': text, 'mode': 'gfm', 'context': context}
... | from flask import abort, json
import requests
def render_content(text, gfm=False, context=None,
username=None, password=None):
"""Renders the specified markup using the GitHub API."""
if gfm:
url = 'https://api.github.com/markdown'
data = {'text': text, 'mode': 'gfm'}
... | Remove duplicate 'context': context in GitHub renderer. | Remove duplicate 'context': context in GitHub renderer.
| Python | mit | jbarreras/grip,ssundarraj/grip,joeyespo/grip,mgoddard-pivotal/grip,mgoddard-pivotal/grip,jbarreras/grip,joeyespo/grip,ssundarraj/grip |
b92e1548f3944465cc7ac112d4c88e9aae8f4ead | rowboat/views/webhooks.py | rowboat/views/webhooks.py | import subprocess
from flask import Blueprint, request, current_app
# from rowboat.redis import rdb
# from rowboat.util.decos import authed
from disco.types.message import MessageEmbed
from disco.types.webhook import Webhook
webhooks = Blueprint('webhooks', __name__, url_prefix='/webhooks')
@webhooks.route('/circl... | import subprocess
from flask import Blueprint, request, current_app
# from rowboat.redis import rdb
# from rowboat.util.decos import authed
from disco.types.message import MessageEmbed
from disco.types.webhook import Webhook
webhooks = Blueprint('webhooks', __name__, url_prefix='/webhooks')
@webhooks.route('/circl... | Fix invalid key (nice docs circleci) | Fix invalid key (nice docs circleci)
| Python | mit | ThaTiemsz/jetski,aliasfalse/rowboat,aliasfalse/rowboat,aliasfalse/rowboat,ThaTiemsz/jetski,b1naryth1ef/rowboat,b1naryth1ef/rowboat,aliasfalse/rowboat,b1naryth1ef/rowboat,ThaTiemsz/jetski,b1naryth1ef/rowboat,ThaTiemsz/jetski |
e1b62a5d39fd3a4adb7d783c131fd122ba09c3d5 | support/biicode-build.py | support/biicode-build.py | #!/usr/bin/env python
# Build the project with Biicode.
import bootstrap, glob, os, shutil
from download import Downloader
from subprocess import check_call
os_name = os.environ['TRAVIS_OS_NAME']
if os_name == 'linux':
# Install newer version of CMake.
bootstrap.install_cmake(
'cmake-3.1.1-Linux-i386.tar.gz',... | #!/usr/bin/env python
# Build the project with Biicode.
import bootstrap, glob, os, shutil
from download import Downloader
from subprocess import check_call
os_name = os.environ['TRAVIS_OS_NAME']
if os_name == 'linux':
# Install newer version of CMake.
bootstrap.install_cmake(
'cmake-3.1.1-Linux-i386.tar.gz',... | Install CMake in system dirs | Install CMake in system dirs | Python | bsd-2-clause | blaquee/cppformat,mojoBrendan/fmt,cppformat/cppformat,mojoBrendan/fmt,seungrye/cppformat,lightslife/cppformat,nelson4722/cppformat,alabuzhev/fmt,alabuzhev/fmt,lightslife/cppformat,lightslife/cppformat,cppformat/cppformat,alabuzhev/fmt,cppformat/cppformat,Jopie64/cppformat,blaquee/cppformat,mojoBrendan/fmt,dean0x7d/cppf... |
a121281532dc3c9da6534684da0eae0ab57b000b | nose2/tests/unit/test_config.py | nose2/tests/unit/test_config.py | from nose2 import config
from nose2.compat import unittest
class TestConfigSession(unittest.TestCase):
def test_can_create_session(self):
config.Session()
class TestConfig(unittest.TestCase):
def setUp(self):
self.conf = config.Config([('a', ' 1 '), ('b', ' x\n y ')])
def test_as_int(... | from nose2 import config
from nose2.compat import unittest
class TestConfigSession(unittest.TestCase):
def test_can_create_session(self):
config.Session()
class TestConfig(unittest.TestCase):
def setUp(self):
self.conf = config.Config([
('a', ' 1 '), ('b', ' x\n y '), ('c',... | Add test for as_bool bug | Add test for as_bool bug
| Python | bsd-2-clause | little-dude/nose2,ojengwa/nose2,ezigman/nose2,ptthiem/nose2,ptthiem/nose2,ezigman/nose2,little-dude/nose2,leth/nose2,ojengwa/nose2,leth/nose2 |
4790b1afa5d0125948bb8fdbed6f5838d470a570 | test/client/local_recognizer_test.py | test/client/local_recognizer_test.py | import unittest
import os
from speech_recognition import WavFile
from mycroft.client.speech.listener import RecognizerLoop
__author__ = 'seanfitz'
DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data")
class LocalRecognizerTest(unittest.TestCase):
def setUp(self):
self.recognizer ... | import unittest
import os
from speech_recognition import WavFile
from mycroft.client.speech.listener import RecognizerLoop
__author__ = 'seanfitz'
DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data")
class LocalRecognizerTest(unittest.TestCase):
def setUp(self):
rl = RecognizerL... | Fix init of local recognizer | Fix init of local recognizer
| Python | apache-2.0 | MycroftAI/mycroft-core,forslund/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,linuxipho/mycroft-core,MycroftAI/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core |
b3657c48b3958f57a1d71e296570566d7924d7ca | recipes/omas/run_test.py | recipes/omas/run_test.py | import omas, os
os.environ['USER'] = 'TEST_CONDA_USER'
omas.test_omas_suite()
| import omas, os
if 'USER' not in os.environ:
os.environ['USER'] = 'TEST_CONDA_USER'
if 'HOME' not in os.environ:
os.environ['HOME'] = '/tmp'
omas.test_omas_suite()
| Make test more robust to missing USER and HOME | omas: Make test more robust to missing USER and HOME
| Python | bsd-3-clause | Cashalow/staged-recipes,kwilcox/staged-recipes,patricksnape/staged-recipes,guillochon/staged-recipes,birdsarah/staged-recipes,basnijholt/staged-recipes,mariusvniekerk/staged-recipes,mcs07/staged-recipes,Juanlu001/staged-recipes,petrushy/staged-recipes,ocefpaf/staged-recipes,ceholden/staged-recipes,Juanlu001/staged-reci... |
4bec379b3cfea87f17b0d5fa5d80148afe87a470 | examples/plot_pca.py | examples/plot_pca.py | """
=========================================
PCA 2d projection of of Iris dataset
=========================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
and petal width.
Principal Component Analysis (... | """
=========================================
PCA 2d projection of of Iris dataset
=========================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
and petal width.
Principal Component Analysis (... | Remove non-necessary lines from PCA example | MISC: Remove non-necessary lines from PCA example
| Python | bsd-3-clause | mikebenfield/scikit-learn,liyu1990/sklearn,YinongLong/scikit-learn,Titan-C/scikit-learn,xwolf12/scikit-learn,massmutual/scikit-learn,siutanwong/scikit-learn,tmhm/scikit-learn,Aasmi/scikit-learn,icdishb/scikit-learn,yunfeilu/scikit-learn,quheng/scikit-learn,vibhorag/scikit-learn,kaichogami/scikit-learn,cybernet14/scikit... |
83f1dab96d5e9f82137dbe4142ed415a3e3e3f48 | biobox_cli/biobox_file.py | biobox_cli/biobox_file.py | import os
import yaml
def generate(args):
output = {"version" : "0.9.0", "arguments" : args}
return yaml.safe_dump(output, default_flow_style = False)
def get_biobox_file_contents(dir_):
with open(os.path.join(dir_, 'biobox.yaml'), 'r') as f:
return yaml.load(f.read())
def fastq_arguments(args):
... | import os
import yaml
def generate(args):
output = {"version" : "0.9.0", "arguments" : args}
return yaml.safe_dump(output, default_flow_style = False)
def get_biobox_file_contents(dir_):
with open(os.path.join(dir_, 'biobox.yaml'), 'r') as f:
return yaml.load(f.read())
def fastq_arguments(args):
... | Remove no longer needed biobox_directory function | Remove no longer needed biobox_directory function
| Python | mit | michaelbarton/command-line-interface,michaelbarton/command-line-interface,bioboxes/command-line-interface,bioboxes/command-line-interface |
342da37f14c6ac991bd3f7c904bd5b7f1196493a | src/sentry/digests/backends/dummy.py | src/sentry/digests/backends/dummy.py | from __future__ import absolute_import
from contextlib import contextmanager
from sentry.digests.backends.base import Backend
class DummyBackend(Backend):
def add(self, key, record):
pass
@contextmanager
def digest(self, key):
yield []
def schedule(self, deadline):
return
... | from __future__ import absolute_import
from contextlib import contextmanager
from sentry.digests.backends.base import Backend
class DummyBackend(Backend):
def add(self, key, record, increment_delay=None, maximum_delay=None):
pass
@contextmanager
def digest(self, key, minimum_delay=None):
... | Fix digests `DummyBackend` method signatures. | Fix digests `DummyBackend` method signatures.
This makes them consistent with the base backend API.
RIP @tkaemming, stung by dynamic typing.
| Python | bsd-3-clause | looker/sentry,mvaled/sentry,JamesMura/sentry,mvaled/sentry,zenefits/sentry,zenefits/sentry,fotinakis/sentry,alexm92/sentry,JamesMura/sentry,BuildingLink/sentry,mvaled/sentry,jean/sentry,JamesMura/sentry,BuildingLink/sentry,JackDanger/sentry,gencer/sentry,fotinakis/sentry,gencer/sentry,daevaorn/sentry,JackDanger/sentry,... |
145cf9e539d44b3996a4ab916edb7873fa5090f0 | other/wrapping-cpp/swig/c++/test_mylib.py | other/wrapping-cpp/swig/c++/test_mylib.py | import os
import pytest
@pytest.fixture
def setup(request):
def teardown():
print("Running make clean")
os.system('make clean')
print("Completed finaliser")
request.addfinalizer(teardown)
os.system('make clean')
os.system('make all')
def test_squared(setup):
import mylib
... | import os
import pytest
# Need to call Makefile in directory where this test file is
def call_make(target):
# where is this file
this_file = os.path.realpath(__file__)
this_dir = os.path.split(this_file)[0]
cd_command = "cd {}".format(this_dir)
make_command = "make {}".format(target)
command =... | Allow file to be called from other directories | Allow file to be called from other directories
| Python | bsd-2-clause | fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python |
2f976fda50e0946486383b61a996a36b0f3ff9ae | django/setup.py | django/setup.py | import subprocess
import sys
import setup_util
import os
from os.path import expanduser
home = expanduser("~")
def start(args):
setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu"... | import subprocess
import sys
import setup_util
import os
from os.path import expanduser
home = expanduser("~")
def start(args):
setup_util.replace_text("django/hello/hello/settings.py", "HOST': '.*'", "HOST': '" + args.database_host + "'")
setup_util.replace_text("django/hello/hello/settings.py", "\/home\/ubuntu"... | Use more gunicorn threads when pooling database connector isn't available. | Use more gunicorn threads when pooling database connector isn't available.
When using postgres with meinheld, the best you can do so far (as far as I know) is up the number of threads. | Python | bsd-3-clause | raziel057/FrameworkBenchmarks,zhuochenKIDD/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,denkab/FrameworkBenchmarks,doom369/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,Rayne/FrameworkBenchmarks,donovanmuller/FrameworkBenchmarks,sgml/Fram... |
42a1aaba8daa253b99f444a512f8231db47dfbb2 | helpers.py | helpers.py | import array
import numpy as np
def load_glove_vectors(filename, vocab=None):
"""
Load glove vectors from a .txt file.
Optionally limit the vocabulary to save memory. `vocab` should be a set.
"""
dct = {}
vectors = array.array('d')
current_idx = 0
with open(filename, "r", encoding="utf... | import array
import numpy as np
import pandas as pd
def load_glove_vectors(filename, vocab=None):
"""
Load glove vectors from a .txt file.
Optionally limit the vocabulary to save memory. `vocab` should be a set.
"""
dct = {}
vectors = array.array('d')
current_idx = 0
with open(filename... | Add dataset conversion helper function | Add dataset conversion helper function
| Python | mit | AotY/chatbot-retrieval,LepiorzDaniel/test2 |
a006c5f13e25d36f72e0878b4245e0edb126da68 | ckanext/requestdata/controllers/search.py | ckanext/requestdata/controllers/search.py | try:
# CKAN 2.7 and later
from ckan.common import config
except ImportError:
# CKAN 2.6 and earlier
from pylons import config
is_hdx = config.get('hdx_portal')
if is_hdx:
from ckanext.hdx_search.controllers.search_controller import HDXSearchController as PackageController
else:
from ckan.contr... | try:
# CKAN 2.7 and later
from ckan.common import config
except ImportError:
# CKAN 2.6 and earlier
from pylons import config
from paste.deploy.converters import asbool
is_hdx = asbool(config.get('hdx_portal', False))
if is_hdx:
from ckanext.hdx_search.controllers.search_controller\
impor... | Convert hdx_portal to a boolean value | Convert hdx_portal to a boolean value
| Python | agpl-3.0 | ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata |
55755871c240289238072602eefd9eed14d7e70e | bin/combine-examples.py | bin/combine-examples.py | #!/usr/bin/python
import re
import sys
def main(argv):
examples = {}
requires = set()
for filename in argv[1:]:
lines = open(filename, 'rU').readlines()
if len(lines) > 0 and lines[0].startswith('// NOCOMPILE'):
continue
requires.update(line for line in lines if line.s... | #!/usr/bin/python
import re
import sys
def main(argv):
examples = {}
requires = set()
for filename in argv[1:]:
lines = open(filename, 'rU').readlines()
if len(lines) > 0 and lines[0].startswith('// NOCOMPILE'):
continue
requires.update(line for line in lines if line.s... | Use write to avoid newline problems | Use write to avoid newline problems
| Python | bsd-2-clause | elemoine/ol3,gingerik/ol3,itayod/ol3,stweil/ol3,bill-chadwick/ol3,epointal/ol3,adube/ol3,denilsonsa/ol3,fblackburn/ol3,xiaoqqchen/ol3,bogdanvaduva/ol3,landonb/ol3,tsauerwein/ol3,klokantech/ol3,landonb/ol3,bjornharrtell/ol3,llambanna/ol3,gingerik/ol3,gingerik/ol3,Distem/ol3,bjornharrtell/ol3,Distem/ol3,richstoner/ol3,kl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.