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
77122e472c3688f96e77b4f39e9767fed0fb53ae
generate_from_template.py
generate_from_template.py
#! /usr/bin/env python from __future__ import print_function import os.path import sys import json import uuid root = sys.path[0] template_path = os.path.join(root, 'templates', 'simple.json') with open(template_path) as template: oyster = json.load(template) new_id = str(uuid.uuid4()) new_filename = new_id + '....
#! /usr/bin/env python import os.path import sys import json import uuid root = sys.path[0] template_path = os.path.join(root, 'templates', 'simple.json') with open(template_path) as template: oyster = json.load(template) new_id = str(uuid.uuid4()) new_filename = new_id + '.json' new_filepath = os.path.join(root...
Make output terse and parseable.
Make output terse and parseable.
Python
mit
nbeaver/cmd-oysters,nbeaver/cmd-oysters
54cdfe437c5382bde19f5d63086ce54c3d991e8b
ibmcnx/doc/DataSources.py
ibmcnx/doc/DataSources.py
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
Create documentation of DataSource Settings
: Create documentation of DataSource Settings Task-Url:
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
b04e7afbd56518ba0e825d70b11a0c88e2d6e29d
astm/tests/utils.py
astm/tests/utils.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # class DummyMixIn(object): _input_buffer = '' def flush(self): pass def close(sel...
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # class DummyMixIn(object): _input_buffer = '' addr = ('localhost', '15200') def flush(self...
Set dummy address info for tests.
Set dummy address info for tests.
Python
bsd-3-clause
asingla87/python-astm,andrexmd/python-astm,pombreda/python-astm,mhaulo/python-astm,MarcosHaenisch/python-astm,briankip/python-astm,kxepal/python-astm,123412345/python-astm,tinoshot/python-astm,eddiep1101/python-astm,LogicalKnight/python-astm,Iskander1b/python-astm,AlanZatarain/python-astm,kxepal/python-astm,tectronics/...
4cd96824e2903397751a738cd1736ad2809b6c04
cypher/cypher.py
cypher/cypher.py
import argparse from .util import identify parser = argparse.ArgumentParser( prog="cypher", description="A source code identification tool." ) parser.add_argument( "src", nargs=1, help="Path to unknown source code." ) parser.add_argument( "-v", "--verbose", action="store_true", help...
import argparse from .util import identify parser = argparse.ArgumentParser( prog="cypher", description="A source code identification tool." ) parser.add_argument( "src", nargs=1, help="Path to unknown source code." ) parser.add_argument( "-v", "--verbose", action="store_true", help...
Print "Language not recognized." on failure
Print "Language not recognized." on failure
Python
mit
jdkato/codetype,jdkato/codetype
b589fd212b8cbeeb64d41f0276c17278b9b4bba4
st2client/st2client/models/datastore.py
st2client/st2client/models/datastore.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Fix it so it still works with a setter.
Fix it so it still works with a setter.
Python
apache-2.0
tonybaloney/st2,StackStorm/st2,StackStorm/st2,punalpatel/st2,punalpatel/st2,Plexxi/st2,Plexxi/st2,grengojbo/st2,pixelrebel/st2,pinterb/st2,pixelrebel/st2,dennybaa/st2,alfasin/st2,alfasin/st2,tonybaloney/st2,Itxaka/st2,nzlosh/st2,nzlosh/st2,armab/st2,pinterb/st2,peak6/st2,dennybaa/st2,jtopjian/st2,lakshmi-kannan/st2,ton...
bc7bf2a09fe430bb2048842626ecbb476bc6b40c
script/generate_amalgamation.py
script/generate_amalgamation.py
#!/usr/bin/env python import sys from os.path import basename, dirname, join import re INCLUDE_PATTERN = re.compile(r'^\s*#include "([\w.]+)"') seen_files = set() out = sys.stdout def add_file(filename): bname = basename(filename) # Only include each file at most once. if bname in seen_files: return see...
#!/usr/bin/env python import sys from os.path import basename, dirname, join import re INCLUDE_PATTERN = re.compile(r'^\s*#include "([\w.]+)"') WREN_DIR = dirname(dirname(realpath(__file__))) seen_files = set() out = sys.stdout # Prints a plain text file, adding comment markers. def add_comment_file(filename): wi...
Print LICENSE on top of the amalgamation
Print LICENSE on top of the amalgamation
Python
mit
Rohansi/wren,Nelarius/wren,minirop/wren,foresterre/wren,munificent/wren,Nave-Neel/wren,foresterre/wren,Nave-Neel/wren,Nelarius/wren,minirop/wren,Nelarius/wren,Nelarius/wren,foresterre/wren,foresterre/wren,bigdimboom/wren,minirop/wren,bigdimboom/wren,munificent/wren,Rohansi/wren,munificent/wren,bigdimboom/wren,munificen...
fc3589210e7244239acbc053d7788dc0cd264b88
app/models.py
app/models.py
from app import db class Sprinkler(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.Text(25)) status = db.Column(db.Text(25)) flow = db.Column(db.Integer) moisture = db.Column(db.Integer) def __init__(self, name, status, flow, moisture): self.name = name ...
from app import db class Sprinkler(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(25)) status = db.Column(db.String(25)) flow = db.Column(db.Integer) moisture = db.Column(db.Integer) def __init__(self, name, status, flow, moisture): self.name = name ...
Fix bug with SQLAlchemy, change TEXT to STRING
Fix bug with SQLAlchemy, change TEXT to STRING
Python
mit
jaredculp/sprinkler-flask-server,jaredculp/sprinkler-flask-server
4c949cd171d50211ec8ebb95be423293ccb6f917
blog/admin.py
blog/admin.py
from django.contrib import admin from .models import Post @admin.register(Post) class PostAdmin(admin.ModelAdmin): # list view date_hierarchy = 'pub_date' list_display = ( 'title', 'pub_date', 'tag_count') list_filter = ('pub_date',) search_fields = ('title', 'text') # form view f...
from django.contrib import admin from django.db.models import Count from .models import Post @admin.register(Post) class PostAdmin(admin.ModelAdmin): # list view date_hierarchy = 'pub_date' list_display = ( 'title', 'pub_date', 'tag_count') list_filter = ('pub_date',) search_fields = ('ti...
Enable sorting of number of Post tags.
Ch23: Enable sorting of number of Post tags.
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
661040496ebb67cb0f8d8e49d734cfa96f14b0c4
setup.py
setup.py
from distutils.core import setup import os, glob, string, shutil # Packages packages = ['neuroimaging', 'neuroimaging.statistics', 'neuroimaging.image', 'neuroimaging.reference', 'neuroimaging.data', 'neuroimaging.image.formats', 'neuroimaging.image.formats.analyze', 'neuroimaging.fmri', 'neuroimaging.fmri.fmristat',...
import os, glob, string, shutil from distutils.core import setup # Packages packages = ['neuroimaging', 'neuroimaging.statistics', 'neuroimaging.image', 'neuroimaging.reference', 'neuroimaging.data', 'neuroimaging.image.formats', 'neuroimaging.image.formats.analyze', 'neuroimaging.fmri', 'neuroimaging.fmri.fmristat',...
Test edit - to check svn email hook
Test edit - to check svn email hook
Python
bsd-3-clause
bthirion/nipy,alexis-roche/nireg,alexis-roche/niseg,arokem/nipy,alexis-roche/nipy,bthirion/nipy,bthirion/nipy,arokem/nipy,nipy/nireg,alexis-roche/nipy,arokem/nipy,bthirion/nipy,alexis-roche/nipy,nipy/nipy-labs,alexis-roche/nireg,alexis-roche/niseg,alexis-roche/register,nipy/nireg,nipy/nipy-labs,alexis-roche/register,al...
fad6bf214e3b148fc37a154ccf2f56f347e686a4
setup.py
setup.py
# coding=utf-8 from distutils.core import setup __version__ = 'unknown' with open('po_localization/version.py') as version_file: exec(version_file.read()) setup( name='po_localization', packages=['po_localization'], version=__version__, description='Localize Django applications without compiling ...
# coding=utf-8 from distutils.core import setup __version__ = 'unknown' with open('po_localization/version.py') as version_file: exec(version_file.read()) setup( name='po_localization', packages=['po_localization', 'po_localization.tests'], version=__version__, description='Localize Django applic...
Install tests along with the rest of the code
Install tests along with the rest of the code
Python
mit
kmichel/po-localization
6524d4711e5fa03b1f11979fd3d0319cd268d116
setup.py
setup.py
# -*- coding: utf-8 -*- from distutils.core import setup import refmanage setup(name="refmanage", version=refmanage.__version__, author="Joshua Ryan Smith", author_email="joshua.r.smith@gmail.com", packages=["refmanage"], url="https://github.com/jrsmith3/refmanage", description="Man...
# -*- coding: utf-8 -*- from distutils.core import setup import refmanage setup(name="refmanage", version=refmanage.__version__, author="Joshua Ryan Smith", author_email="joshua.r.smith@gmail.com", packages=["refmanage"], url="https://github.com/jrsmith3/refmanage", description="Man...
Add entry_point for command-line application
Add entry_point for command-line application Closes #31.
Python
mit
jrsmith3/refmanage
2dfd4021a705811cb1047914318a727aef4ac5ac
setup.py
setup.py
# # setup.py # # Copyright (c) 2013 Luis Garcia. # This source file is subject to terms of the MIT License. (See file LICENSE) # """Setup script for the scope library.""" from distutils.core import setup NAME = 'scope' VERSION = '0.1.1' DESCRIPTION = 'Template library for multi-language code generation' AUTHOR = 'Lu...
# # setup.py # # Copyright (c) 2013 Luis Garcia. # This source file is subject to terms of the MIT License. (See file LICENSE) # """Setup script for the scope library.""" from distutils.core import setup NAME = 'scope' VERSION = '0.1.1' DESCRIPTION = 'Template library for multi-language code generation' AUTHOR = 'Lu...
Add classifiers for Python 2 and 3
Add classifiers for Python 2 and 3
Python
mit
lrgar/scope
6daef6533c1cc830aead7d7334f8baf78e8624d1
froide/foirequest/file_utils.py
froide/foirequest/file_utils.py
import os import tempfile import subprocess import logging def convert_to_pdf(filepath, binary_name=None, construct_call=None): if binary_name is None and construct_call is None: return outpath = tempfile.mkdtemp() path, filename = os.path.split(filepath) name, extension = filename.rsplit('.',...
import os import tempfile import subprocess import logging try: TimeoutExpired = subprocess.TimeoutExpired HAS_TIMEOUT = True except AttributeError: TimeoutExpired = Exception HAS_TIMEOUT = False def convert_to_pdf(filepath, binary_name=None, construct_call=None, timeout=50): if binary_name is No...
Add better timeout killing to file conversion
Add better timeout killing to file conversion
Python
mit
stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,fin/froide,fin/froide
556e6ba4d9bc32384526501acbbc4c0c2b6f983e
mopidy/frontends/mpd/__init__.py
mopidy/frontends/mpd/__init__.py
import logging from mopidy.frontends.mpd.dispatcher import MpdDispatcher from mopidy.frontends.mpd.process import MpdProcess from mopidy.utils.process import unpickle_connection logger = logging.getLogger('mopidy.frontends.mpd') class MpdFrontend(object): """ The MPD frontend. **Settings:** - :attr...
import logging from mopidy.frontends.base import BaseFrontend from mopidy.frontends.mpd.dispatcher import MpdDispatcher from mopidy.frontends.mpd.process import MpdProcess from mopidy.utils.process import unpickle_connection logger = logging.getLogger('mopidy.frontends.mpd') class MpdFrontend(BaseFrontend): """ ...
Make MpdFrontend a subclass of BaseFrontend
Make MpdFrontend a subclass of BaseFrontend
Python
apache-2.0
kingosticks/mopidy,SuperStarPL/mopidy,rawdlite/mopidy,tkem/mopidy,rawdlite/mopidy,diandiankan/mopidy,ZenithDK/mopidy,jcass77/mopidy,jodal/mopidy,SuperStarPL/mopidy,hkariti/mopidy,mokieyue/mopidy,rawdlite/mopidy,bacontext/mopidy,quartz55/mopidy,diandiankan/mopidy,tkem/mopidy,woutervanwijk/mopidy,adamcik/mopidy,swak/mopi...
2d6f0d419b2bd40f4e44b0cb193e2f0f93cfb4e0
panoptes_cli/scripts/panoptes.py
panoptes_cli/scripts/panoptes.py
import click from panoptes_client.panoptes import Panoptes panoptes = Panoptes('https://panoptes.zooniverse.org/api') @click.group() def cli(): pass @cli.command() @click.option('--id', help='Project ID', required=False, type=int) @click.option('--display-name') @click.argument('slug', required=False) def projec...
import click from panoptes_client.panoptes import Panoptes panoptes = Panoptes('https://panoptes.zooniverse.org/api') @click.group() def cli(): pass @cli.command() @click.option('--id', help='Project ID', required=False, type=int) @click.option('--display-name') @click.argument('slug', required=False) def projec...
Set type for subject ID
Set type for subject ID
Python
apache-2.0
zooniverse/panoptes-cli
13b96626a35bc7a430352cf21d6c9a5d206bd910
simplesqlite/loader/formatter.py
simplesqlite/loader/formatter.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import abc import six from .acceptor import LoaderAcceptor from .error import InvalidDataError @six.add_metaclass(abc.ABCMeta) class TableFormatterInterface(object): """ Abstract class ...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import abc import six from .acceptor import LoaderAcceptor from .error import InvalidDataError @six.add_metaclass(abc.ABCMeta) class TableFormatterInterface(object): """ Abstract class ...
Delete a private method from interface
Delete a private method from interface
Python
mit
thombashi/SimpleSQLite,thombashi/SimpleSQLite
eca0f263e8a944a144a08f130e06aeb651e645b4
social/apps/django_app/urls.py
social/apps/django_app/urls.py
"""URLs module""" from django.conf import settings try: from django.conf.urls import patterns, url except ImportError: # Django < 1.4 from django.conf.urls.defaults import patterns, url from social.utils import setting_name extra = getattr(settings, setting_name('TRAILING_SLASH'), True) and '/' or '' ...
"""URLs module""" from django.conf import settings try: from django.conf.urls import url except ImportError: # Django < 1.4 from django.conf.urls.defaults import url from social.utils import setting_name from social.apps.django_app import views extra = getattr(settings, setting_name('TRAILING_SLASH'), T...
Fix Django 1.10 deprecation warnings
Fix Django 1.10 deprecation warnings In django_app/urls.py: * Use a list instead of `patterns` * Use view callables instead of strings Fixes #804, #754
Python
bsd-3-clause
tkajtoch/python-social-auth,cjltsod/python-social-auth,python-social-auth/social-core,S01780/python-social-auth,tobias47n9e/social-core,fearlessspider/python-social-auth,tkajtoch/python-social-auth,python-social-auth/social-app-cherrypy,python-social-auth/social-app-django,fearlessspider/python-social-auth,python-socia...
6ec35a123f6156001f779ccb5ff3bbda2b1f4477
src/json_to_csv.py
src/json_to_csv.py
# -*- coding: utf-8 -*- import json, os, sys from utils.file import load_json # Parse a json-formatted input instance and produce a csv file with # all involved coordinates. def coord_to_csv(array): return str(array[0]) + ',' + str(array[1]) + '\n' def write_to_csv(input_file): input = load_json(input_file) l...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json, os, sys from utils.file import load_json # Parse a json-formatted input instance and produce a csv file with # all involved coordinates in Lat,Lng order. def coord_to_csv(array): return str(array[1]) + ',' + str(array[0]) + '\n' def write_to_csv(input_file...
Change coordinates order to Lat,Lng to match the frontend geocoding.
Change coordinates order to Lat,Lng to match the frontend geocoding.
Python
bsd-2-clause
VROOM-Project/vroom-scripts,VROOM-Project/vroom-scripts
ae6967c20d68c497147abbea7495ef874fa08599
src/akllt/tests/test_z2loader.py
src/akllt/tests/test_z2loader.py
# coding: utf-8 from __future__ import unicode_literals import unittest import pkg_resources import pathlib from akllt.z2loader import load_metadata class Z2LoaderTests(unittest.TestCase): def test_z2loader(self): path = pkg_resources.resource_filename( 'akllt', 'tests/fixtures/naujienos/.z2...
# coding: utf-8 from __future__ import unicode_literals import unittest import pkg_resources import pathlib from akllt.dataimport.z2loader import load_metadata class Z2LoaderTests(unittest.TestCase): def test_z2loader(self): path = pkg_resources.resource_filename( 'akllt', 'tests/fixtures/na...
Fix z2loader import path in tests.
Fix z2loader import path in tests.
Python
agpl-3.0
python-dirbtuves/akl.lt,python-dirbtuves/akl.lt,python-dirbtuves/akl.lt,python-dirbtuves/akl.lt,python-dirbtuves/akl.lt
94c98ad923f1a136bcf14b81d559f634c1bc262e
populous/generators/select.py
populous/generators/select.py
from .base import Generator class Select(Generator): def get_arguments(self, table=None, where=None, pk='id', **kwargs): super(Select, self).get_arguments(**kwargs) self.table = table self.where = where self.pk = pk def generate(self): backend = self.blueprint.backen...
from .base import Generator from .vars import parse_vars class Select(Generator): def get_arguments(self, table=None, where=None, pk='id', **kwargs): super(Select, self).get_arguments(**kwargs) self.table = table self.where = parse_vars(where) self.pk = pk def generate(self)...
Handle where with variables in Select generator
Handle where with variables in Select generator
Python
mit
novafloss/populous
b61769bec41a93366eae3030eec5d8fcaedcedd6
chainerrl/explorers/additive_gaussian.py
chainerrl/explorers/additive_gaussian.py
from __future__ import division from __future__ import unicode_literals from __future__ import print_function from __future__ import absolute_import from builtins import * # NOQA from future import standard_library standard_library.install_aliases() import numpy as np from chainerrl import explorer class AdditiveG...
from __future__ import division from __future__ import unicode_literals from __future__ import print_function from __future__ import absolute_import from builtins import * # NOQA from future import standard_library standard_library.install_aliases() import numpy as np from chainerrl import explorer class AdditiveG...
Improve the docstring of AdditiveGaussian
Improve the docstring of AdditiveGaussian
Python
mit
toslunar/chainerrl,toslunar/chainerrl
e4d06cf4121bc9e1a1f9635e159187b8bed1b2ee
pyalysis/analysers/raw.py
pyalysis/analysers/raw.py
# coding: utf-8 """ pyalysis.analysers.raw ~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2014 by Daniel Neuhäuser and Contributors :license: BSD, see LICENSE.rst for details """ import codecs from blinker import Signal from pyalysis.utils import detect_encoding, Location from pyalysis.warnings import LineTooLon...
# coding: utf-8 """ pyalysis.analysers.raw ~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2014 by Daniel Neuhäuser and Contributors :license: BSD, see LICENSE.rst for details """ import codecs from blinker import Signal from pyalysis.utils import detect_encoding, Location from pyalysis.warnings import LineTooLon...
Fix location of line length check
Fix location of line length check
Python
bsd-3-clause
DasIch/pyalysis,DasIch/pyalysis
347545cc7ece8c0763ef194654fbaa34d16efe54
styleguide/views.py
styleguide/views.py
from django.shortcuts import get_object_or_404, render from django import forms class ExampleForm(forms.Form): text = forms.CharField() disabled_text = forms.CharField(disabled=True) readonly_text = forms.CharField( widget=forms.TextInput(attrs={'readonly':'readonly'}) ) checkbox1 = forms....
from django.shortcuts import get_object_or_404, render from django import forms class ExampleForm(forms.Form): text = forms.CharField() disabled_text = forms.CharField(disabled=True) readonly_text = forms.CharField( widget=forms.TextInput(attrs={'readonly':'readonly'}) ) checkbox1 = forms....
Add readonly text to form
Add readonly text to form
Python
bsd-3-clause
caktus/django-styleguide,caktus/django-styleguide,caktus/django-styleguide
54cf69b4c105038f896ceaf8af10c82fd3772bf9
pyethapp/tests/test_export.py
pyethapp/tests/test_export.py
from StringIO import StringIO import subprocess from pyethapp.app import app from click.testing import CliRunner from ethereum.blocks import BlockHeader import rlp def test_export(): # requires a chain with at least 5 blocks assert subprocess.call('pyethapp export', shell=True) != 0 assert subprocess.call...
from StringIO import StringIO import subprocess from pyethapp.app import app from click.testing import CliRunner from ethereum.blocks import BlockHeader import rlp import pytest @pytest.mark.xfail # can not work without mock-up chain def test_export(): # requires a chain with at least 5 blocks assert subproc...
Mark export test XFAIL since no chain mockup exists
Mark export test XFAIL since no chain mockup exists
Python
mit
gsalgado/pyethapp,changwu-tw/pyethapp,RomanZacharia/pyethapp,ethereum/pyethapp,gsalgado/pyethapp,ethereum/pyethapp,changwu-tw/pyethapp,vaporry/pyethapp,RomanZacharia/pyethapp,d-das/pyethapp
27e573d55b37869e09b8cf9809ea41e9b2ce1567
tests/data_test.py
tests/data_test.py
from pork.data import Data from mock import Mock, patch from StringIO import StringIO patch.TEST_PREFIX = 'it' class TestData: def it_sets_and_gets_keys(self): with patch("__builtin__.open", side_effect=IOError): data = Data() with patch("__builtin__.open"): data.set('foo'...
from pork.data import Data from mock import Mock, patch, mock_open from StringIO import StringIO patch.TEST_PREFIX = 'it' class TestData: def it_loads_json_data_from_file(self): with patch("__builtin__.open", mock_open(read_data='{"foo":"bar"}'), create=True) as m: data = Data() ...
Use mock_open and remove unnecessary stubbing of open.
Use mock_open and remove unnecessary stubbing of open.
Python
mit
jimmycuadra/pork,jimmycuadra/pork
0b7e957fea7bbd08c79c2b2b4d9b8edfced38496
tests/providers.py
tests/providers.py
import unittest import foauth.providers class ProviderTests(unittest.TestCase): def setUp(self): class Example(foauth.providers.OAuth): provider_url = 'http://example.com' api_domain = 'api.example.com' self.provider = Example def test_auto_name(self): self.as...
import unittest import foauth.providers import urllib class ProviderTests(unittest.TestCase): def setUp(self): class Example(foauth.providers.OAuth): provider_url = 'http://example.com' api_domain = 'api.example.com' self.provider = Example def test_auto_name(self): ...
Fix favicon tests to match the new scheme
Fix favicon tests to match the new scheme
Python
bsd-3-clause
foauth/foauth.org,foauth/foauth.org,foauth/foauth.org
c75c1764e276d1cbda61e1258eb6e09298bce3ce
tests/test_bulk.py
tests/test_bulk.py
import json from django.db import models from django.conf import settings from django.test import TestCase from localized_fields.fields import LocalizedField, LocalizedUniqueSlugField from .data import get_init_values from .fake_model import get_fake_model class LocalizedBulkTestCase(TestCase): """Tests bulk o...
from django.db import models from django.test import TestCase from localized_fields.fields import LocalizedField, LocalizedUniqueSlugField from .fake_model import get_fake_model class LocalizedBulkTestCase(TestCase): """Tests bulk operations with data structures provided by the django-localized-fields libra...
Improve test case for bulk_create
Improve test case for bulk_create
Python
mit
SectorLabs/django-localized-fields,SectorLabs/django-localized-fields,SectorLabs/django-localized-fields
84dea9ec30135e193789bc81c982070f4389427e
api/serializers.py
api/serializers.py
from django.forms import widgets from rest_framework import serializers from api.models import Reading from django.contrib.auth.models import User class ReadingSerializer(serializers.ModelSerializer): owner = serializers.Field(source='owner.username') class Meta: model = Reading fields = ('crea...
from rest_framework import serializers from api.models import Reading from django.contrib.auth.models import User import datetime class ReadingSerializer(serializers.HyperlinkedModelSerializer): owner = serializers.ReadOnlyField(source='owner.username') class Meta: model = Reading fields = ('...
Add User Serializer to be able to create users from REST API
Add User Serializer to be able to create users from REST API
Python
bsd-3-clause
developmentseed/dustduino-server,codefornigeria/dustduino-server,developmentseed/dustduino-server,codefornigeria/dustduino-server,codefornigeria/dustduino-server,developmentseed/dustduino-server
3b9d15fcedd5edbe6dcf8ad58e9dbee0cecb6a04
sentry/core/processors.py
sentry/core/processors.py
""" sentry.core.processors ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ class Processor(object): def process(self, data): resp = self.get_data(data) if resp: data['extra'].update(resp) ...
""" sentry.core.processors ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ class Processor(object): def process(self, data): resp = self.get_data(data) if resp: data['extra'].update(resp) ...
Remove print statement and change mask to use a fixed length
Remove print statement and change mask to use a fixed length
Python
bsd-3-clause
dcramer/sentry-old,dcramer/sentry-old,dcramer/sentry-old
a3b9a98265c56f2a687e618ca1851f3a70ead34c
thetis/__init__.py
thetis/__init__.py
from __future__ import absolute_import from thetis.utility import * from thetis.log import * import thetis.timeintegrator as timeintegrator # NOQA import thetis.solver as solver # NOQA import thetis.solver2d as solver2d # NOQA from thetis.callback import DiagnosticCallback # NOQA import thetis.limiter as limiter ...
from __future__ import absolute_import from thetis.utility import * # NOQA from thetis.log import * # NOQA import thetis.timeintegrator as timeintegrator # NOQA import thetis.solver as solver # NOQA import thetis.solver2d as solver2d # NOQA from thetis.callback import DiagnosticCallback # NOQA import thetis.limiter...
Remove no longer existing assembly cache option.
Remove no longer existing assembly cache option.
Python
mit
tkarna/cofs
d391f6fe8371b045cd684841da59984e5b28b1b3
plata/product/producer/models.py
plata/product/producer/models.py
from datetime import datetime from django.db import models from django.db.models import Sum, signals from django.utils.translation import ugettext_lazy as _ from plata.product.models import Product class ProducerManager(models.Manager): def active(self): return self.filter(is_active=True) class Produc...
from datetime import datetime from django.db import models from django.db.models import Sum, signals from django.utils.translation import ugettext_lazy as _ from plata.product.models import Product class ProducerManager(models.Manager): def active(self): return self.filter(is_active=True) class Produc...
Revert "It shouldn't be that hard to define a producer, really"
Revert "It shouldn't be that hard to define a producer, really" Sometimes it is. This reverts commit 883c518d8844bd006d6abc783b315aea01d59b69.
Python
bsd-3-clause
allink/plata,armicron/plata,stefanklug/plata,armicron/plata,armicron/plata
64a1bb661f7ff1beb2e65b8f87a7528787e27b06
test/use_lldb_suite.py
test/use_lldb_suite.py
import inspect import os import sys def find_lldb_root(): lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe())) while True: lldb_root = os.path.dirname(lldb_root) if lldb_root is None: return None test_path = os.path.join(lldb_root, "use_lldb_suite_root.py")...
import inspect import os import sys def find_lldb_root(): lldb_root = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe())) ) while True: lldb_root = os.path.dirname(lldb_root) if lldb_root is None: return None test_path = os.path.join(lldb_...
Modify lldb_suite.py to enable python debugging
Modify lldb_suite.py to enable python debugging Summary: pudb and pdb interfere with the behavior of the inspect module. calling `inspect.getfile(inspect.currentframe())` returns a different result depending on whether or not you're in a debugger. Calling `os.path.abspath` on the result of `inspect.getfile(...)` norma...
Python
apache-2.0
llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb
a15c8bce9c59dcba3e7143903d95feb85ee7abe5
tests/ex12_tests.py
tests/ex12_tests.py
from nose.tools import * from exercises import ex12 def test_histogram(): ''' Test our histogram output is correct ''' test_histogram = ex12.histogram([1, 2, 3]) # assert_equal(test_histogram, '*\n**\n***\n')
from nose.tools import * from exercises import ex12 try: from io import StringIO except: from StringIO import StringIO import sys def test_histogram(): ''' Test our histogram output is correct ''' std_out = sys.stdout result = StringIO() sys.stdout = result test_histogram = ex12.h...
Update ex12 test so it actually reads output.
Update ex12 test so it actually reads output.
Python
mit
gravyboat/python-exercises
943d575749d34a985b4bb9bdde40a8c3fe1cd911
spritecss/css/__init__.py
spritecss/css/__init__.py
"""Pure-Python CSS parser - no dependencies!""" # Copyright held by Yo Studios AB <opensource@yo.se>, 2011 # # Some kind of BSD license, contact above e-mail for more information on # matters of licensing. from .parser import CSSParser, print_css from itertools import ifilter, imap __all__ = ["CSSParser", "iter_eve...
"""Pure-Python CSS parser - no dependencies!""" # Copyright held by Yo Studios AB <opensource@yo.se>, 2011 # # Part of Spritemapper (https://github.com/yostudios/Spritemapper) # Released under a MIT/X11 license from .parser import CSSParser, print_css from itertools import ifilter, imap __all__ = ["CSSParser", "ite...
Modify licensing info for css parser
Modify licensing info for css parser
Python
mit
wpj-cz/Spritemapper,wpj-cz/Spritemapper,wpj-cz/Spritemapper,yostudios/Spritemapper,wpj-cz/Spritemapper,yostudios/Spritemapper,yostudios/Spritemapper
1a67e28fe3b5eaa6d640f0bb82b5a18ebdefa0ba
src/pytest_django_lite/plugin.py
src/pytest_django_lite/plugin.py
import os import pytest try: from django.conf import settings except ImportError: settings = None # NOQA def is_configured(): if settings is None: return False return settings.configured or os.environ.get('DJANGO_SETTINGS_MODULE') @pytest.fixture(autouse=True, scope='session') def _django_...
import os import pytest try: from django.conf import settings except ImportError: settings = None # NOQA def is_configured(): if settings is None: return False return settings.configured or os.environ.get('DJANGO_SETTINGS_MODULE') @pytest.fixture(autouse=True, scope='session') def _django_...
Use hasattr instead of try/except to call django setup.
Use hasattr instead of try/except to call django setup.
Python
apache-2.0
pombredanne/pytest-django-lite,dcramer/pytest-django-lite
888fb12572defbfba1998f2f208cad43ae0c74d4
tests/test_RI_CC.py
tests/test_RI_CC.py
from addons import * from utils import * tdir = 'Coupled-Cluster' def test_CCSD_DIIS(workspace): exe_py(workspace, tdir, 'CCSD_DIIS') def test_CCSD(workspace): exe_py(workspace, tdir, 'CCSD') def test_CCSD_T(workspace): exe_py(workspace, tdir, 'CCSD_T') #def test_TD_CCSD(workspace): # exe_py(wo...
from addons import * from utils import * tdir = 'Coupled-Cluster' def test_CCSD_DIIS(workspace): exe_py(workspace, tdir, 'CCSD_DIIS') def test_CCSD(workspace): exe_py(workspace, tdir, 'CCSD') def test_CCSD_T(workspace): exe_py(workspace, tdir, 'CCSD_T') def test_EOM_CCSD(workspace): exe_py(wor...
Add EOM_CCSD ref imp to tests
[EOM] Add EOM_CCSD ref imp to tests
Python
bsd-3-clause
psi4/psi4numpy,dsirianni/psi4numpy
15f45c0fedab40f486085a3f4158cc2af2374bf5
applications/views.py
applications/views.py
from django.shortcuts import render from applications.forms import ApplicationForm from datetime import datetime from django.views.generic.edit import FormView APPLICATION_START_DATE = datetime(2018, 8, 13) APPLICATION_END_DATE = datetime(2018, 9, 2, 1, 0, 0) class ApplicationView(FormView): template_name = 'ap...
from django.shortcuts import render from applications.forms import ApplicationForm from datetime import datetime from django.views.generic.edit import FormView APPLICATION_START_DATE = datetime(2018, 8, 13) APPLICATION_END_DATE = datetime(2018, 9, 3) class ApplicationView(FormView): template_name = 'application...
Fix so that application is due to 24:00 the 2.
Fix so that application is due to 24:00 the 2.
Python
mit
hackerspace-ntnu/website,hackerspace-ntnu/website,hackerspace-ntnu/website
56a2a873bb23631779eebb0dc35359ccf67f04e7
source/bark/logger/dynamic.py
source/bark/logger/dynamic.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. from .base import Logger class Dynamic(Logger): '''Dynamic logger allowing delayed computation of values.''' def __getitem__(self, key): '''Return value referenced by *key*. If the value ...
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import collections from .base import Logger class Dynamic(Logger): '''Dynamic logger allowing delayed computation of values.''' def __getitem__(self, key): '''Return value referenced by *key*. ...
Use collections.Callable test for future compatibility.
Use collections.Callable test for future compatibility.
Python
apache-2.0
4degrees/mill,4degrees/sawmill
b1f9ef9422010c5398852377946969ab98bc17e1
changes/artifacts/manifest_json.py
changes/artifacts/manifest_json.py
from __future__ import absolute_import import json from changes.config import db from changes.constants import Result from changes.models import FailureReason from .base import ArtifactHandler class ManifestJsonHandler(ArtifactHandler): """ Artifact handler for manifest.json files. Makes sure their contents...
from __future__ import absolute_import import json from changes.config import db from changes.constants import Result from changes.models import FailureReason from .base import ArtifactHandler class ManifestJsonHandler(ArtifactHandler): """ Artifact handler for manifest.json files. Makes sure their contents...
Make malformed/mismatched manifest.json an infra failure
Make malformed/mismatched manifest.json an infra failure Summary: - This was disabled for a while due to problems with phased jobsteps, but Sentry shows that these errors occasionally still happen, but seem to be "real" errors now. Should almost certainly be marked infra failures. - Also make malformed manifest a ...
Python
apache-2.0
dropbox/changes,dropbox/changes,dropbox/changes,dropbox/changes
95139aaf8dc551a4a5d42c23e417520fa2d131ff
api_tests/utils.py
api_tests/utils.py
from blinker import ANY from urlparse import urlparse from contextlib import contextmanager from addons.osfstorage import settings as osfstorage_settings def create_test_file(node, user, filename='test_file', create_guid=True): osfstorage = node.get_addon('osfstorage') root_node = osfstorage.get_root() te...
from blinker import ANY from urlparse import urlparse from contextlib import contextmanager from addons.osfstorage import settings as osfstorage_settings def create_test_file(target, user, filename='test_file', create_guid=True): osfstorage = target.get_addon('osfstorage') root_node = osfstorage.get_root() ...
Update api test util to create files to use target name instead
Update api test util to create files to use target name instead
Python
apache-2.0
mfraezz/osf.io,cslzchen/osf.io,aaxelb/osf.io,HalcyonChimera/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,mfraezz/osf.io,felliott/osf.io,saradbowman/osf.io,adlius/osf.io,brianjgeiger/osf.io,pattisdr/osf.io,Johnetordoff/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,caseyrollin...
037796d721cd0eec3ea779c2901ec8c62aaa5fc7
cmt/utils/run_dir.py
cmt/utils/run_dir.py
import os class RunDir(object): def __init__(self, dir, create=False): self._run_dir = dir self._create = create def __enter__(self): self._starting_dir = os.path.abspath(os.getcwd()) if self._create and not os.path.isdir(self._run_dir): os.makedirs(self._run_dir) ...
import os class RunDir(object): def __init__(self, directory, create=False): self._run_dir = directory self._create = create def __enter__(self): self._starting_dir = os.path.abspath(os.getcwd()) if self._create and not os.path.isdir(self._run_dir): os.makedirs(sel...
Rename dir variable to directory.
Rename dir variable to directory.
Python
mit
csdms/coupling,csdms/coupling,csdms/pymt
fe4bc023d207f219e487badc668f81ce7485ba5a
sympy/utilities/source.py
sympy/utilities/source.py
""" This module adds several functions for interactive source code inspection. """ from __future__ import print_function, division import inspect def source(object): """ Prints the source code of a given object. """ print('In file: %s' % inspect.getsourcefile(object)) print(inspect.getsource(obj...
""" This module adds several functions for interactive source code inspection. """ from __future__ import print_function, division import inspect def source(object): """ Prints the source code of a given object. """ print('In file: %s' % inspect.getsourcefile(object)) print(inspect.getsource(obj...
Remove a redundant line from get_class
Remove a redundant line from get_class
Python
bsd-3-clause
emon10005/sympy,ahhda/sympy,kaichogami/sympy,mafiya69/sympy,Designist/sympy,aktech/sympy,Titan-C/sympy,jerli/sympy,Davidjohnwilson/sympy,sampadsaha5/sympy,hargup/sympy,drufat/sympy,Vishluck/sympy,maniteja123/sympy,wanglongqi/sympy,jaimahajan1997/sympy,yukoba/sympy,AkademieOlympia/sympy,ChristinaZografou/sympy,Titan-C/s...
bb9e15a2415cba3dfcc871ea64aeaa14199fd293
plantcv/plantcv/color_palette.py
plantcv/plantcv/color_palette.py
# Color palette returns an array of colors (rainbow) from matplotlib import pyplot as plt import numpy as np from plantcv.plantcv import params def color_palette(num): """color_palette: Returns a list of colors length num Inputs: num = number of colors to return. Returns: colors = a ...
# Color palette returns an array of colors (rainbow) import numpy as np from plantcv.plantcv import params def color_palette(num): """color_palette: Returns a list of colors length num Inputs: num = number of colors to return. Returns: colors = a list of color lists (RGB values) ...
Move matplotlib import into function
Move matplotlib import into function I think importing it at the top-level causes a conflict with our global matplotlib backend settings
Python
mit
stiphyMT/plantcv,danforthcenter/plantcv,danforthcenter/plantcv,stiphyMT/plantcv,stiphyMT/plantcv,danforthcenter/plantcv
7a2132cfff0524bd5cefc579a4561e492c884955
wikked/wsgiutil.py
wikked/wsgiutil.py
import os import sys import logging import logging.handlers from wikked.wiki import WikiParameters def get_wsgi_app(wiki_root, log_file=None): os.chdir(wiki_root) logging.basicConfig(stream=sys.stderr) from wikked.web import app app.set_wiki_params(WikiParameters(wiki_root)) if log_file is not N...
import os import sys import logging import logging.handlers from wikked.wiki import WikiParameters def get_wsgi_app(wiki_root, log_file=None, async_update=True): os.chdir(wiki_root) logging.basicConfig(stream=sys.stderr) if async_update: import wikked.settings wikked.settings.WIKI_ASYNC_U...
Enable async update by default when using a WSGI application.
Enable async update by default when using a WSGI application.
Python
apache-2.0
ludovicchabant/Wikked,ludovicchabant/Wikked,ludovicchabant/Wikked
b466e0c41629575e0661aff1ba37c7056a732e0a
magicbot/__init__.py
magicbot/__init__.py
from .magicrobot import MagicRobot from .magic_tunable import tunable from .magic_reset import will_reset_to from .state_machine import AutonomousStateMachine, StateMachine, state, timed_state
from .magicrobot import MagicRobot from .magic_tunable import tunable from .magic_reset import will_reset_to from .state_machine import AutonomousStateMachine, StateMachine, default_state, state, timed_state
Add default_state to the magicbot exports
Add default_state to the magicbot exports
Python
bsd-3-clause
Twinters007/robotpy-wpilib-utilities,Twinters007/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities
f81909490eae5f4216cb3895f68261c4c2cab367
api/BucketListAPI.py
api/BucketListAPI.py
from flask import Flask, jsonify, request from modals.modals import User, Bucket, Item from api import create_app, db from validate_email import validate_email app = create_app('DevelopmentEnv') @app.route('/') def index(): response = jsonify({'Welcome Message': 'Hello'}) response.status_code = 201 return...
from flask import Flask, jsonify, request from modals.modals import User, Bucket, Item from api import create_app, db from validate_email import validate_email app = create_app('DevelopmentEnv') @app.route('/') def index(): response = jsonify({'Welcome Message': 'Hello'}) response.status_code = 201 retur...
Add chech for short passwords
Add chech for short passwords
Python
mit
patlub/BucketListAPI,patlub/BucketListAPI
3cf942c5cf7f791cbbd04bf1d092c2c8061b69ac
prjxray/site_type.py
prjxray/site_type.py
""" Description of a site type """ from collections import namedtuple import enum class SitePinDirection(enum.Enum): IN = "IN" OUT = "OUT" SiteTypePin = namedtuple('SiteTypePin', 'name direction') class SiteType(object): def __init__(self, site_type): self.type = site_type['type'] sel...
""" Description of a site type """ from collections import namedtuple import enum class SitePinDirection(enum.Enum): IN = "IN" OUT = "OUT" INOUT = "INOUT" SiteTypePin = namedtuple('SiteTypePin', 'name direction') class SiteType(object): def __init__(self, site_type): self.type = site_type...
Add INOUT to direction enum.
prjxray: Add INOUT to direction enum. INOUT is found on the PS7 interface on the Zynq. Signed-off-by: Tim 'mithro' Ansell <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@mith.ro>
Python
isc
SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray
8aea526176592511581ddbeb6f3bb96ce072cc91
wukong/__init__.py
wukong/__init__.py
# Set up a null roothandler for our logging system import logging try: # Python 2.7+ from logging import NullHandler except ImportError: class NullHandler(logging.Handler): def emit(self, record): pass logging.getLogger(__name__).addHandler(NullHandler())
# Set up a null roothandler for our logging system import logging from logging import NullHandler logging.getLogger(__name__).addHandler(NullHandler())
Remove the NullHandler patch because we don't support any python versions that need it
Remove the NullHandler patch because we don't support any python versions that need it
Python
mit
SurveyMonkey/wukong
554cbefe43ce94af4f1858c534cdb0d1e5ba965c
floyd/cli/auth.py
floyd/cli/auth.py
import click import webbrowser import floyd from floyd.client.auth import AuthClient from floyd.manager.auth_config import AuthConfigManager from floyd.model.access_token import AccessToken from floyd.log import logger as floyd_logger @click.command() def login(): """ Log into Floyd via Auth0. """ cl...
import click import webbrowser import floyd from floyd.client.auth import AuthClient from floyd.manager.auth_config import AuthConfigManager from floyd.model.access_token import AccessToken from floyd.log import logger as floyd_logger @click.command() @click.option('--token', is_flag=True, default=False, help='Just ...
Add support for --token in login command
Add support for --token in login command This can be used when you already have the token and do not want to open the browser.
Python
apache-2.0
mckayward/floyd-cli,mckayward/floyd-cli,houqp/floyd-cli,houqp/floyd-cli
0197521691b34ee102a97e72c589c2ce93e9255b
sparkback/__init__.py
sparkback/__init__.py
# -*- coding: utf-8 -*- from __future__ import division import argparse ticks = ('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█') def scale_data(data): m = min(data) n = (max(data) - m) / (len(ticks) - 1) return [ ticks[int((t - m) / n)] for t in data ] def print_ansi_spark(d): print ''.join(d) if __name_...
# -*- coding: utf-8 -*- from __future__ import division import argparse ticks = ('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█') def scale_data(data): m = min(data) n = (max(data) - m) / (len(ticks) - 1) # if every element is the same height return all lower ticks, else compute # the tick height if n == ...
Fix bug where all data points are same height
Fix bug where all data points are same height
Python
mit
mmichie/sparkback
8baa86cb381aaf52b16c7e0647a0b50cdbbd677a
st2common/st2common/util/db.py
st2common/st2common/util/db.py
# Copyright 2019 Extreme Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
# Copyright 2019 Extreme Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
Use if-elif instead of multiple if statements to check types
Use if-elif instead of multiple if statements to check types Use if-elif instead of multiple if statements to check types when converting from MongoDB BaseDict and BaseList to python dict and list types. Once the value is converted, use another if-elif block to recursively evaluate and convert the values of dict and l...
Python
apache-2.0
nzlosh/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,Plexxi/st2
ce032e4bc64db2c19caf39d9f7c4e8dba7a3f4da
flask_aggregator.py
flask_aggregator.py
import json from flask import request, Response from werkzeug.exceptions import BadRequest from werkzeug.test import EnvironBuilder class Aggregator(object): def __init__(self, app=None, endpoint=None): self.url_map = {} self.endpoint = endpoint or "/aggregate" if app: self.i...
import json from flask import request, Response from werkzeug.exceptions import BadRequest from werkzeug.test import EnvironBuilder class Aggregator(object): def __init__(self, app=None, endpoint=None): self.url_map = {} self.endpoint = endpoint or "/aggregate" if app: self.i...
Support multiple Flask apps on the same Aggregator instance
Support multiple Flask apps on the same Aggregator instance
Python
mit
ramnes/flask-aggregator
fe007309b1c2e8f0cc594a1faec9d35076244108
troposphere/workspaces.py
troposphere/workspaces.py
# Copyright (c) 2015, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, AWSProperty, Tags from .validators import boolean, integer class WorkspaceProperties(AWSProperty): props = { 'ComputeTypeName': (basestring, False), 'RootVolumeSi...
# Copyright (c) 2012-2020, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 18.6.0 from . import AWSObject from . import AWSProperty from troposphere import Tags from .validators import bool...
Add WorkSpaces::ConnectionAlias per 2020-10-01 changes
Add WorkSpaces::ConnectionAlias per 2020-10-01 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
229f8f22a71044dc2c39a52ff36458720958c5b9
cpnest/__init__.py
cpnest/__init__.py
from .cpnest import CPNest __version__ = '0.9.8' __all__ = ['model', 'NestedSampling', 'parameter', 'sampler', 'cpnest', 'nest2pos', 'proposal', 'plot']
import logging from .logger import CPNestLogger from .cpnest import CPNest logging.setLoggerClass(CPNestLogger) __version__ = '0.9.8' __all__ = ['model', 'NestedSampling', 'parameter', 'sampler', 'cpnest', 'nest2pos', 'proposal', 'plot', ...
Set logger class in init
Set logger class in init
Python
mit
johnveitch/cpnest
9ebaac20779d78bb0c276249ac5c578339ba95ee
py/maximum-binary-tree.py
py/maximum-binary-tree.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def constructMaximumBinaryTree(self, nums, start=None, end=None): """ :type nums: List[int] :rtyp...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def findMax(self, start, end): bit_length = (end - start).bit_length() - 1 d = 1 << bit_length re...
Add py solution for 654. Maximum Binary Tree
Add py solution for 654. Maximum Binary Tree 654. Maximum Binary Tree: https://leetcode.com/problems/maximum-binary-tree/ Approach 2: 1. Use [Sparse Table](https://wcipeg.com/wiki/Range_minimum_query#Sparse_table) to quickly lookup maximum and its index 2. However, approach 1 is already O(nlogn) (aver...
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
d6bff0a4e632f0bda9a143acede58c0765066ada
attest/tests/hook.py
attest/tests/hook.py
from attest import Tests, assert_hook from attest.hook import ExpressionEvaluator suite = Tests() @suite.test def eval(): value = 1 + 1 valgen = (v for v in [value]) samples = { 'isinstance(value, int)': 'True', 'value == int("2")': "(2 == 2)", 'value.denominator': '1', '...
from attest import Tests, assert_hook from attest.hook import ExpressionEvaluator suite = Tests() @suite.test def eval(): value = 1 + 1 valgen = (v for v in [value]) samples = { 'isinstance(value, int)': 'True', 'value == int("2")': "(2 == 2)", 'type(value).__name__': "'int'", ...
Fix tests for visit_Attribute on 2.5/PyPy
Fix tests for visit_Attribute on 2.5/PyPy
Python
bsd-2-clause
dag/attest
8c6ff33c8a034c2eecf5f2244811c86acf96120a
tools/apollo/list_organisms.py
tools/apollo/list_organisms.py
#!/usr/bin/env python from __future__ import print_function import argparse import json from webapollo import AssertUser, WAAuth, WebApolloInstance, accessible_organisms, PasswordGenerator if __name__ == '__main__': parser = argparse.ArgumentParser(description='List all organisms available in an Apollo instance'...
#!/usr/bin/env python from __future__ import print_function import argparse import json from webapollo import AssertUser, WAAuth, WebApolloInstance, accessible_organisms, PasswordGenerator if __name__ == '__main__': parser = argparse.ArgumentParser(description='List all organisms available in an Apollo instance'...
Add try-catch if no organism allowed
Add try-catch if no organism allowed
Python
mit
galaxy-genome-annotation/galaxy-tools,galaxy-genome-annotation/galaxy-tools
724338c55d0af6d38a949b58a90ae200849247f4
cyinterval/test/test_interval_set.py
cyinterval/test/test_interval_set.py
from cyinterval.cyinterval import Interval, IntervalSet from nose.tools import assert_equal def test_interval_set_construction(): interval_set = IntervalSet(Interval(0.,1.), Interval(2.,3.)) assert_equal(interval_set.intervals[0], Interval(0.,1.)) assert_equal(interval_set.intervals[1], Interval(2.,3.)) i...
from cyinterval.cyinterval import Interval, IntervalSet, FloatIntervalSet from nose.tools import assert_equal, assert_is def test_float_interval_set_construction(): interval_set = IntervalSet(Interval(0.,1.), Interval(2.,3.)) assert_equal(interval_set.intervals[0], Interval(0.,1.)) assert_equal(interval_se...
Test type of IntervalSet factory output
Test type of IntervalSet factory output
Python
mit
jcrudy/cyinterval
5fe7e1e1cdccd8b54d6db2a64509923d8596a5f4
test_connector/__manifest__.py
test_connector/__manifest__.py
# -*- coding: utf-8 -*- # Copyright 2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) {'name': 'Connector Tests', 'summary': 'Automated tests for Connector, do not install.', 'version': '10.0.1.0.0', 'author': 'Camptocamp,Odoo Community Association (OCA)', 'license': 'AGPL-3', ...
# -*- coding: utf-8 -*- # Copyright 2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) {'name': 'Connector Tests', 'summary': 'Automated tests for Connector, do not install.', 'description': 'Automated tests for Connector, do not install.', 'version': '10.0.1.0.0', 'author': 'Ca...
Add description in test addons to make pylint happier
Add description in test addons to make pylint happier
Python
agpl-3.0
OCA/connector,OCA/connector
a21a4f46c79f6531f2a305f58dacce12f46d27fb
tests/languages/docker_test.py
tests/languages/docker_test.py
from __future__ import absolute_import from __future__ import unicode_literals import mock from pre_commit.languages import docker from pre_commit.util import CalledProcessError def test_docker_is_running_process_error(): with mock.patch( 'pre_commit.languages.docker.cmd_output', side_effect=Cal...
from __future__ import absolute_import from __future__ import unicode_literals import mock from pre_commit.languages import docker from pre_commit.util import CalledProcessError def test_docker_is_running_process_error(): with mock.patch( 'pre_commit.languages.docker.cmd_output', side_effect=Cal...
Fix missing create=True attribute in docker tests
Fix missing create=True attribute in docker tests
Python
mit
pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit,pre-commit/pre-commit
6d645d5b58043d0668721727bbfdcc7ee021b504
rwt/tests/test_scripts.py
rwt/tests/test_scripts.py
import textwrap import sys import subprocess def test_pkg_imported(tmpdir): """ Create a script that loads cython and ensure it runs. """ body = textwrap.dedent(""" import cython print("Successfully imported cython") """).lstrip() script_file = tmpdir / 'script' script_file.write_text(body, 'utf-8') pip_...
from __future__ import unicode_literals import textwrap import sys import subprocess def test_pkg_imported(tmpdir): """ Create a script that loads cython and ensure it runs. """ body = textwrap.dedent(""" import cython print("Successfully imported cython") """).lstrip() script_file = tmpdir / 'script' sc...
Add support for Python 2.7
Add support for Python 2.7
Python
mit
jaraco/rwt
9d54e23d87c28fa22b6a537d198c0caa66803116
leagues/forms.py
leagues/forms.py
from django import forms class LeagueForm(forms.Form): league_name = forms.CharField(label = "Group name", max_length = 30) max_size = forms.IntegerField(label = "Maximum participants", min_value = 0, max_value = 9999) points_for_exact_guess = forms.IntegerField(label = "Points for exact guess", min_value ...
from django import forms class LeagueForm(forms.Form): league_name = forms.CharField(label = "Group name", max_length = 30) max_size = forms.IntegerField(label = "Maximum participants", min_value = 0, max_value = 9999) points_for_exact_guess = forms.IntegerField(label = "Points for exact guess", min_value ...
Make private checkbox not required
Make private checkbox not required
Python
mit
leventebakos/football-ech,leventebakos/football-ech
8c23ad1877a0af91e1b9a8512aa7476852de205c
kombu_fernet/serializers/__init__.py
kombu_fernet/serializers/__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import import os from cryptography.fernet import Fernet, InvalidToken fernet = Fernet(os.environ['KOMBU_FERNET_KEY']) fallback_fernet = None try: fallback_fernet = Fernet(os.environ['OLD_KOMBU_FERNET_KEY']) except KeyError: pass def f...
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import import os from cryptography.fernet import Fernet, MultiFernet fernet = Fernet(os.environ['KOMBU_FERNET_KEY']) fallback_fernet = None try: fallback_fernet = Fernet(os.environ['OLD_KOMBU_FERNET_KEY']) except KeyError: pass else: ...
Use MultiFernet provided by cryptography lib
Use MultiFernet provided by cryptography lib Closes #9
Python
mit
heroku/kombu-fernet-serializers
0b8b438a0c8b204d05bab41dbe0d493a409cb809
examples/flask_example/manage.py
examples/flask_example/manage.py
#!/usr/bin/env python from flask.ext.script import Server, Manager, Shell from flask.ext.evolution import Evolution from example import app, db, models evolution = Evolution(app) manager = Manager(app) manager.add_command('runserver', Server()) manager.add_command('shell', Shell(make_context=lambda: { 'app': ap...
#!/usr/bin/env python from flask.ext.script import Server, Manager, Shell from flask.ext.evolution import Evolution from example import app, db, models evolution = Evolution(app) manager = Manager(app) manager.add_command('runserver', Server()) manager.add_command('shell', Shell(make_context=lambda: { 'app': ap...
Comment on how to run migrations
Comment on how to run migrations
Python
bsd-3-clause
python-social-auth/social-storage-sqlalchemy,mathspace/python-social-auth,clef/python-social-auth,falcon1kr/python-social-auth,fearlessspider/python-social-auth,imsparsh/python-social-auth,mark-adams/python-social-auth,mathspace/python-social-auth,python-social-auth/social-core,duoduo369/python-social-auth,mark-adams/p...
f0ac78b3bfc0f81f142e66030e1e822dacfafe14
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='ansi', version='0.3.0', description='ANSI cursor movement and graphics', author='Wijnand Modderman-Lenstra', author_email='maze@pyth0n.org', url='https://github.com/tehmaze/ansi/', packages = ['ansi', 'ansi.colour']...
#!/usr/bin/env python from distutils.core import setup setup(name='ansi', version='0.3.0', description='ANSI cursor movement and graphics', author='Wijnand Modderman-Lenstra', author_email='maze@pyth0n.org', url='https://github.com/tehmaze/ansi/', packages = ['ansi', 'ansi.colour']...
Include py.typed marker in package
Include py.typed marker in package
Python
mit
tehmaze/ansi
fc6a0edca3ae42cb3570ddf62c841282bb0229aa
integration/util.py
integration/util.py
from fabric.api import env class Integration(object): def setup(self): env.host_string = "127.0.0.1"
from fabric.api import env class Integration(object): def setup(self): if not env.host_string: # Allow runtime selection env.host_string = "127.0.0.1"
Allow easy local exec of integration suite via eg -H
Allow easy local exec of integration suite via eg -H
Python
bsd-2-clause
kmonsoor/fabric,haridsv/fabric,kxxoling/fabric,cgvarela/fabric,rane-hs/fabric-py3,tolbkni/fabric,jaraco/fabric,TarasRudnyk/fabric,cmattoon/fabric,raimon49/fabric,itoed/fabric,pashinin/fabric,ploxiln/fabric,elijah513/fabric,opavader/fabric,xLegoz/fabric,rbramwell/fabric,qinrong/fabric,bspink/fabric,hrubi/fabric,StackSto...
78bb3ecb5fe36b2964223a17e927d208b2087777
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup( name='vertigo', version='0.1.2', license='BSD', author="Daniel Lepage", author_email="dplepage@gmail.com", packages=['vertigo',], long_description=open('README.rst').read(), url='https://github.com/dplepage/vertigo', cla...
#!/usr/bin/env python from distutils.core import setup setup( name='vertigo', version='0.1.2', license='BSD', author="Daniel Lepage", author_email="dplepage@gmail.com", packages=['vertigo',], long_description=""" ========================================= Vertigo: Some really simple graph ...
Add pypi description that's shorter than README.rst.
Add pypi description that's shorter than README.rst.
Python
bsd-3-clause
dplepage/vertigo
1ee442e79df7c7a79076460dea930bbd7d87b00a
setup.py
setup.py
from distutils.core import setup # Keeping all Python code for package in src directory setup(name='quantitation', url='http://www.awblocker.com', version='0.1', description='Absolute quantitation for LC/MSMS proteomics via MCMC', author='Alexander W Blocker', author_email='ablocker@gmai...
from distutils.core import setup # Keeping all Python code for package in src directory setup(name='quantitation', url='http://www.awblocker.com', version='0.1', description='Absolute quantitation for LC/MSMS proteomics via MCMC', author='Alexander W Blocker', author_email='ablocker@gmai...
Add requires for development use, at least
Add requires for development use, at least
Python
bsd-3-clause
awblocker/quantitation,awblocker/quantitation,awblocker/quantitation
7f20f67d70ef4351d838621191b3447893b604d3
simplemooc/courses/decorators.py
simplemooc/courses/decorators.py
from django.shortcuts import redirect, get_object_or_404 from django.contrib import messages from .models import Course, Enrollment def enrollment_required(view_func): def _wrapper(request, *args, **kwargs): slug = kwargs['slug'] course = get_object_or_404(Course, slug=slug) has_permissio...
from django.shortcuts import redirect from django.contrib import messages from django.contrib.contenttypes.models import ContentType from .models import Course, CourseTRB, Enrollment from .utils import get_course_by_instance def enrollment_required(view_func): def _wrapper(request, *args, **kwargs): slug...
Update decorator to work with content_type relation
Update decorator to work with content_type relation
Python
mit
mazulo/simplemooc,mazulo/simplemooc
7c4b19fee9a50804921fc1084655d05ea3b7e89b
setup.py
setup.py
from distutils.core import setup setup( name='django-robots', version=__import__('robots').__version__, description='Robots exclusion application for Django, complementing Sitemaps.', long_description=open('docs/overview.txt').read(), author='Jannis Leidel', author_email='jannis@leidel.info', ...
from distutils.core import setup setup( name='django-robots', version=__import__('robots').__version__, description='Robots exclusion application for Django, complementing Sitemaps.', long_description=open('docs/overview.txt').read(), author='Jannis Leidel', author_email='jannis@leidel.info', ...
Remove download URL since Github doesn't get his act together. Damnit
Remove download URL since Github doesn't get his act together. Damnit committer: Jannis Leidel <jannis@leidel.info> --HG-- extra : convert_revision : 410200249f2c4981c9e0e8e5cf9334b0e17ec3d4
Python
bsd-3-clause
amitu/django-robots,amitu/django-robots,jscott1971/django-robots,jazzband/django-robots,freakboy3742/django-robots,philippeowagner/django-robots,freakboy3742/django-robots,pbs/django-robots,pbs/django-robots,jscott1971/django-robots,pbs/django-robots,jezdez/django-robots,philippeowagner/django-robots,jezdez/django-robo...
9a5c17781178e8c97a4749e49374c3b4449c7387
tests/test_models.py
tests/test_models.py
from unittest import TestCase import unittest.mock from molecupy.structures import Model, AtomicStructure, SmallMolecule class ModelTest(TestCase): def setUp(self): self.small_molecule1 = unittest.mock.Mock(spec=SmallMolecule) self.small_molecule2 = unittest.mock.Mock(spec=SmallMolecule) class ...
from unittest import TestCase import unittest.mock from molecupy.structures import Model, AtomicStructure, SmallMolecule class ModelTest(TestCase): def setUp(self): self.small_molecule1 = unittest.mock.Mock(spec=SmallMolecule) self.small_molecule2 = unittest.mock.Mock(spec=SmallMolecule) class ...
Make small molecules read only
Make small molecules read only
Python
mit
samirelanduk/atomium,samirelanduk/atomium,samirelanduk/molecupy
2eca3cd6e0065a65ed65b3ce13fc7f7d9caf1717
AAA.py
AAA.py
import os import sys try: # ST3 from .Lib.sublime_lib.path import get_package_name, get_package_path PLUGIN_NAME = get_package_name() libpath = os.path.join(get_package_path(), "Lib") except ValueError: # ST2 # For some reason the import does only work when RELOADING the plugin, not # ...
import os import sys try: # ST3 from .Lib.sublime_lib.path import get_package_name PLUGIN_NAME = get_package_name() path = os.path.dirname(__file__) libpath = os.path.join(path, "Lib") except ValueError: # ST2 # For some reason the import does only work when RELOADING the plugin, not ...
Make imports work when in .sublime-package
Make imports work when in .sublime-package
Python
mit
SublimeText/AAAPackageDev,SublimeText/AAAPackageDev,SublimeText/PackageDev
4f9bb7a81f52b5ee46be338e5c699411286f1401
tasks.py
tasks.py
from invocations import docs from invocations.testing import test from invocations.packaging import release from invoke import Collection from invoke import run from invoke import task @task(help={ 'pty': "Whether to run tests under a pseudo-tty", }) def integration_tests(pty=True): """Runs integration tests...
from invocations import docs from invocations.testing import test from invocations.packaging import release from invoke import Collection from invoke import run from invoke import task @task(help={ 'pty': "Whether to run tests under a pseudo-tty", }) def integration(pty=True): """Runs integration tests.""" ...
Rename integration tests task for consistency w/ other projs
Rename integration tests task for consistency w/ other projs
Python
bsd-2-clause
bitprophet/releases
3ca0007970056e665b28c62d39ed6073309a97cd
kovfig.py
kovfig.py
#! /usr/bin/env python # coding:utf-8 # the number of loop for train IBM Model 2 loop_count = 10 phrase_model_file = "./phrase.model" bigram_model_file = "./bigram.model" if __name__ == '__main__': pass
#! /usr/bin/env python # coding:utf-8 from os import path # the number of loop for train IBM Model 2 loop_count = 10 phrase_model_file = path.join( path.abspath(path.dirname(__file__)), "phrase.model" ) bigram_model_file = path.join( path.abspath(path.dirname(__file__)), "bigram.model" ) if __name__...
Modify path to use __file__
Modify path to use __file__
Python
mit
kenkov/kovlive
e9eb29d300d4072a32d824d4f588ff76a905bb89
gunicorn_settings.py
gunicorn_settings.py
bind = '127.0.0.1:8001' workers = 2 worker_class = 'gevent' timeout = 30 keepalive = 2 errorlog = '-'
workers = 2 worker_class = 'gevent' timeout = 30 keepalive = 2 errorlog = '-'
Use IP and PORT environment variables if set
Use IP and PORT environment variables if set
Python
apache-2.0
notapresent/rbm2m,notapresent/rbm2m
1aa8344177a6e336075134ea802b14e14b8e2f03
utils.py
utils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- def fix_str(value): try: return unicode(value) except UnicodeDecodeError: return unicode(value.decode('latin1')) def pandas_to_dict(df): return [{colname: (fix_str(row[i]) if type(row[i]) is str else row[i]) for i, colname in enume...
#!/usr/bin/env python # -*- coding: utf-8 -*- from pandas import tslib def fix_render(value): if type(value) is str: try: return unicode(value) except UnicodeDecodeError: return unicode(value.decode('latin1')) elif type(value) is tslib.Timestamp: return value.strf...
Fix date format on fix render
Fix date format on fix render
Python
mit
mlgruby/mining,chrisdamba/mining,mining/mining,jgabriellima/mining,AndrzejR/mining,chrisdamba/mining,mlgruby/mining,seagoat/mining,AndrzejR/mining,mining/mining,jgabriellima/mining,seagoat/mining,avelino/mining,avelino/mining,mlgruby/mining
b7f3ee836cb73d274bfd7dc415bb43e2fa743e12
httpserverhandler.py
httpserverhandler.py
#!/usr/bin/python # -*-coding: utf8 -*- from BaseHTTPServer import BaseHTTPRequestHandler import mimetypes from os import curdir, sep import os class HttpServerHandler(BaseHTTPRequestHandler): allowed_extensions = ['.html', '.jpg', '.gif', '.js', '.css', '.tff', '.woff'] def has_permission_to_reply(self, f...
#!/usr/bin/python # -*-coding: utf8 -*- from BaseHTTPServer import BaseHTTPRequestHandler import mimetypes from os import curdir, sep import os class HttpServerHandler(BaseHTTPRequestHandler): allowed_extensions = ['.html', '.jpg', '.gif', '.ico', '.js', '.css', '.tff', '.woff'] def has_permission_to_reply...
Add .ico to the allowed extension list.
Add .ico to the allowed extension list.
Python
apache-2.0
gearlles/planb-client,gearlles/planb-client,gearlles/planb-client
1a4994e86c01b33878d022574782df88b2f4016a
fuzzinator/call/file_reader_decorator.py
fuzzinator/call/file_reader_decorator.py
# Copyright (c) 2017 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. import os from . import CallableDecorator class FileReaderDecorator(...
# Copyright (c) 2017-2018 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. import os from . import CallableDecorator class FileReaderDecor...
Fix test extraction in FileReaderDecorator.
Fix test extraction in FileReaderDecorator.
Python
bsd-3-clause
renatahodovan/fuzzinator,akosthekiss/fuzzinator,renatahodovan/fuzzinator,akosthekiss/fuzzinator,akosthekiss/fuzzinator,renatahodovan/fuzzinator,akosthekiss/fuzzinator,renatahodovan/fuzzinator
2fbd90a9995e8552e818e53d3b213e4cfef470de
molly/installer/dbcreate.py
molly/installer/dbcreate.py
""" Creates a database for Molly, and appropriate users, once given login information as super user, or by running as root. """ from molly.installer.utils import quiet_exec, CommandFailed def create(dba_user, dba_pass, username, password, database): creds = [] if dba_user: creds += ['-U', dba_use...
""" Creates a database for Molly, and appropriate users, once given login information as super user, or by running as root. """ import os from molly.installer.utils import quiet_exec, CommandFailed def create(dba_user, dba_pass, username, password, database): creds = [] if dba_user: creds += ['-...
Fix broken setting of postgres password
Fix broken setting of postgres password
Python
apache-2.0
mollyproject/mollyproject,mollyproject/mollyproject,mollyproject/mollyproject
dcbc6c0579871ce3f9b813b0d92f3b7642c750a1
linter.py
linter.py
from SublimeLinter.lint import Linter, util class CSSLint(Linter): cmd = 'csslint --format=compact' regex = r'''(?xi) ^.+:\s* # filename # csslint emits errors that pertain to the code as a whole, # in which case there is no line/col information, so that # part is optional. ...
from SublimeLinter.lint import Linter, util class CSSLint(Linter): cmd = 'csslint --format=compact ${temp_file}' regex = r'''(?xi) ^.+:\s* # filename # csslint emits errors that pertain to the code as a whole, # in which case there is no line/col information, so that # part ...
Add `${temp_file}` marker to `cmd`
Add `${temp_file}` marker to `cmd` Implicit adding of the `${temp_file}` by the framework has been deprecated and SublimeLinter also logs about it.
Python
mit
SublimeLinter/SublimeLinter-csslint
64f2720507067d10f298aa50245fa3b7b57a5bd4
dabuildsys/srcname.py
dabuildsys/srcname.py
#!/usr/bin/python """ Code to normalize the source package name specifier into the actual packages. Returns the package checkouts. """ from common import BuildError import apt import config import checkout def expand_srcname_spec(spec): """Parse a list of source packages on which the operation is to be performed...
#!/usr/bin/python """ Code to normalize the source package name specifier into the actual packages. Returns the package checkouts. """ from common import BuildError import apt import config import checkout def expand_srcname_spec(spec): """Parse a list of source packages on which the operation is to be performed...
Implement '*' package for all packages in Git
Implement '*' package for all packages in Git
Python
mit
mit-athena/build-system
98f26daf7c2c062d3bd72352413641e0df111871
src/ansible/forms.py
src/ansible/forms.py
from django import forms from django.conf import settings from django.forms import ModelForm from ansible.models import Playbook class AnsibleForm1(ModelForm): class Meta: model = Playbook fields = ['repository', 'username'] class AnsibleForm2(ModelForm): class Meta: model = Playbook ...
from django import forms from django.core.validators import ValidationError from django.conf import settings from django.forms import ModelForm from ansible.models import Playbook import utils.playbook as playbook_utils import os class AnsibleForm1(ModelForm): class Meta: model = Playbook fields = ...
Use clean_filename to validate if filename is already used
Use clean_filename to validate if filename is already used
Python
bsd-3-clause
lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin
9fed4624f457f7643ff2aa83921409cb7e580039
moviealert/forms.py
moviealert/forms.py
from django import forms from django.conf import settings from moviealert.base.widgets import CalendarWidget from .models import TaskList, RegionData class MovieForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(MovieForm, self).__init__(*args, **kwargs) self.fields['movie_date'] =...
from django import forms from django.conf import settings from moviealert.base.widgets import CalendarWidget from .models import TaskList, RegionData class MovieForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(MovieForm, self).__init__(*args, **kwargs) self.fields['movie_date'] =...
Disable manual input of date.
Disable manual input of date. Made the input field read-only to prevent input of date manually.
Python
mit
iAmMrinal0/django_moviealert,iAmMrinal0/django_moviealert,iAmMrinal0/django_moviealert
ddb3665a1450e8a1eeee57bbe4b5c0eb7f3f05b1
molly/utils/management/commands/generate_cache_manifest.py
molly/utils/management/commands/generate_cache_manifest.py
import os import os.path from django.core.management.base import NoArgsCommand from django.conf import settings class Command(NoArgsCommand): can_import_settings = True def handle_noargs(self, **options): cache_manifest_path = os.path.join(settings.STATIC_ROOT, ...
import os import os.path from django.core.management.base import NoArgsCommand from django.conf import settings class Command(NoArgsCommand): can_import_settings = True def handle_noargs(self, **options): cache_manifest_path = os.path.join(settings.STATIC_ROOT, ...
Fix cache.manifest generation when desktop app isn't loaded, also don't include unnecessary touchmaplite files (MOLLY-113)
Fix cache.manifest generation when desktop app isn't loaded, also don't include unnecessary touchmaplite files (MOLLY-113)
Python
apache-2.0
mollyproject/mollyproject,mollyproject/mollyproject,mollyproject/mollyproject
e50682cfd285c5de42118245ba8a30f559ef1f20
rst2pdf/utils.py
rst2pdf/utils.py
#$HeadURL$ #$LastChangedDate$ #$LastChangedRevision$ import sys from reportlab.platypus import PageBreak, Spacer from flowables import * import shlex from log import log def parseRaw (data): '''Parse and process a simple DSL to handle creation of flowables. Supported (can add others on request): ...
# -*- coding: utf-8 -*- #$HeadURL$ #$LastChangedDate$ #$LastChangedRevision$ import sys from reportlab.platypus import PageBreak, Spacer from flowables import * import shlex from log import log def parseRaw (data): '''Parse and process a simple DSL to handle creation of flowables. Supported (can...
Fix encoding (thanks to Yasushi Masuda)
Fix encoding (thanks to Yasushi Masuda)
Python
mit
thomaspurchas/rst2pdf,thomaspurchas/rst2pdf
5111a3ec4822598d5c2bf009e26bb0eec49b7743
sample_config.py
sample_config.py
# Database connection config # The URI most scrapers will use to access the DB DB_URI = 'sqlite:///db/data.sqlite' # The read-only URI the server will use to access the DB DB_URI_READ_ONLY = 'file:db/data.sqlite?mode=ro' # Server performance config # Max time an SQL query can take before it's killed QUERY_TIMEOUT_SECS...
# Database connection config # The URI most scrapers will use to access the DB DB_URI = 'sqlite:///db/data.sqlite' # The read-only URI the server will use to access the DB DB_URI_READ_ONLY = 'file:db/data.sqlite?mode=ro' # Server performance config # Max time an SQL query can take before it's killed QUERY_TIMEOUT_SECS...
Add server port to sample config
Add server port to sample config
Python
mit
mplewis/narcissa
ba3c7e6e2c7fff7ed0c2b51a129b9d7c85eefc6f
helios/__init__.py
helios/__init__.py
from django.conf import settings from django.core.urlresolvers import reverse from helios.views import election_shortcut TEMPLATE_BASE = settings.HELIOS_TEMPLATE_BASE or "helios/templates/base.html" # a setting to ensure that only admins can create an election ADMIN_ONLY = settings.HELIOS_ADMIN_ONLY # allow upload ...
from django.conf import settings from django.core.urlresolvers import reverse TEMPLATE_BASE = settings.HELIOS_TEMPLATE_BASE or "helios/templates/base.html" # a setting to ensure that only admins can create an election ADMIN_ONLY = settings.HELIOS_ADMIN_ONLY # allow upload of voters via CSV? VOTERS_UPLOAD = settings....
Remove unused import causing deprecation warning
Remove unused import causing deprecation warning Warning in the form: RemovedInDjango19Warning: "ModelXYZ" doesn't declare an explicit app_label Apparently this happens because it tries to import models before app configuration runs
Python
apache-2.0
shirlei/helios-server,benadida/helios-server,shirlei/helios-server,benadida/helios-server,shirlei/helios-server,benadida/helios-server,benadida/helios-server,benadida/helios-server,shirlei/helios-server,shirlei/helios-server
146e6caf7d47e7ea0bedf057ec9c129818942c07
mixmind/__init__.py
mixmind/__init__.py
# mixmind/__init__.py import logging log = logging.getLogger(__name__) from flask import Flask from flask_uploads import UploadSet, DATA, configure_uploads app = Flask(__name__, instance_relative_config=True) app.config.from_object('config') app.config.from_pyfile('config.py') with open('local_secret') as fp: # TO...
# mixmind/__init__.py import logging log = logging.getLogger(__name__) from flask import Flask from flask_uploads import UploadSet, DATA, configure_uploads app = Flask(__name__, instance_relative_config=True) app.config.from_object('config') app.config.from_pyfile('config.py') # flask-uploads app.config['UPLOADS_D...
Remove other secret lookups from init
Remove other secret lookups from init
Python
apache-2.0
twschum/mix-mind,twschum/mix-mind,twschum/mix-mind,twschum/mix-mind
0696e73342e994093b887c731eedc20a6d7a82ac
concurrency/test_get_websites.py
concurrency/test_get_websites.py
import unittest from requests import Request from unittest.mock import patch, MagicMock from concurrency.get_websites import load_url as load_url class MockResponse(): def __init__(self): self.text = "foo" self.status_code = 200 class TestGetWebsites(unittest.TestCase): @patch('concurrency.g...
import unittest from requests import Request from unittest.mock import patch, MagicMock from concurrency.get_websites import load_url as load_url class MockResponse(): def __init__(self): self.text = "foo" self.status_code = 200 class TestGetWebsites(unittest.TestCase): @patch('concurrency.g...
Fix some typos in concurrency test
Fix some typos in concurrency test
Python
mit
b-ritter/python-notes,b-ritter/python-notes
899882be398f8a31e706a590c0a7e297c1589c25
threat_intel/util/error_messages.py
threat_intel/util/error_messages.py
# -*- coding: utf-8 -*- # # A set of simple methods for writing messages to stderr # import sys from traceback import extract_tb from traceback import format_list def write_exception(e): exc_type, __, exc_traceback = sys.exc_info() sys.stderr.write('[ERROR] {0} {1}\n'.format(exc_type.__name__, e.message if e....
# -*- coding: utf-8 -*- # # A set of simple methods for writing messages to stderr # import sys from traceback import extract_tb from traceback import format_list def write_exception(e): exc_type, __, exc_traceback = sys.exc_info() sys.stderr.write('[ERROR] {0} {1}\n'.format(exc_type.__name__, str(e))) fo...
Fix deprecation warning interfering with tests
Fix deprecation warning interfering with tests
Python
mit
Yelp/threat_intel,megancarney/threat_intel,SYNchroACK/threat_intel
8e41709078885313b12f3b6e619573851a21be19
scripts/check_env.py
scripts/check_env.py
#!/usr/bin/env python """Computational environment check script for 2014 SciPy Conference Tutorial: Reproducible Research: Walking the Walk. https://github.com/reproducible-research/scipy-tutorial-2014 """ import sys import subprocess return_value = 0 required_packages = ['numpy', 'scipy', 'matplotlib', 'SimpleIT...
#!/usr/bin/env python """Computational environment check script for 2014 SciPy Conference Tutorial: Reproducible Research: Walking the Walk. https://github.com/reproducible-research/scipy-tutorial-2014 """ import sys import subprocess return_value = 0 required_packages = ['numpy', 'scipy', 'matplotlib', 'SimpleIT...
Add ffmpeg to the required environment.
Add ffmpeg to the required environment.
Python
apache-2.0
5x5x5x5/ReproTutorial,5x5x5x5/ReproTutorial,reproducible-research/scipy-tutorial-2014,reproducible-research/scipy-tutorial-2014,5x5x5x5/ReproTutorial,reproducible-research/scipy-tutorial-2014
b7514ff97118f3bd0a22d620659d307226e0d1fd
apps/domain/src/main/core/node.py
apps/domain/src/main/core/node.py
from syft.core.node.domain.domain import Domain node = Domain(name="om-domain")
from syft.grid.grid_client import connect from syft.core.node.domain.domain import Domain from syft.core.node.device.client import DeviceClient from syft.grid.connections.http_connection import HTTPConnection from syft.grid.services.worker_management_service import CreateWorkerService node = Domain(name="om-domain") n...
ADD a new worker connection
ADD a new worker connection
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
2fc65f543ba1b2d0bd52152ddaf78feb5e7594c4
test/test_product.py
test/test_product.py
from polypy.base import x def test_call(): f = 2 * x assert f(2) == 4 f = 3 * x ** 2 assert f(3) == 27 def test_str(): f = 2 * x assert str(f) == "2x" f = x * 2 assert str(f) == "2x" def test_square(): f = x assert f * x == x ** 2 f = 3 * x assert f ** 2 == 9 * x...
from polypy.base import x def test_call(): f = 2 * x assert f(2) == 4 f = 3 * x ** 2 assert f(3) == 27 def test_str(): f = 2 * x assert str(f) == "2x" f = x * 2 assert str(f) == "2x" def test_square(): f = x assert f * x == x ** 2 f = 3 * x assert f ** 2 == 9 * x...
Add test for multiplying linear terms
Add test for multiplying linear terms
Python
mit
LordDarkula/polypy
974cd48f1954f78be4b1766445ed9b91d391cd64
slackclient/_util.py
slackclient/_util.py
class SearchList(list): def find(self, name): items = [] for child in self: if child.__class__ == self.__class__: items += child.find(name) else: if child == name: items.append(child) if len(items) == 1: ...
class SearchList(list): def find(self, name): items = [] for child in self: if child.__class__ == self.__class__: items += child.find(name) else: if child == name: items.append(child) if len(items) == 1: ...
Simplify expression, add explicit return value
Simplify expression, add explicit return value
Python
mit
slackhq/python-slackclient,slackapi/python-slackclient,slackapi/python-slackclient,slackapi/python-slackclient
19c1e83d3de979495fe12d3034fe4853a181039c
spacy/it/__init__.py
spacy/it/__init__.py
from __future__ import unicode_literals, print_function from os import path from ..language import Language class Italian(Language): pass
from __future__ import unicode_literals, print_function from os import path from ..language import Language from ..attrs import LANG from . import language_data class German(Language): lang = 'it' class Defaults(Language.Defaults): tokenizer_exceptions = dict(language_data.TOKENIZER_EXCEPTIONS)...
Work on draft Italian tokenizer
Work on draft Italian tokenizer
Python
mit
explosion/spaCy,banglakit/spaCy,aikramer2/spaCy,raphael0202/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,oroszgy/spaCy.hu,oroszgy/spaCy.hu,aikramer2/spaCy,spacy-io/spaCy,raphael0202/spaCy,Gregory-Howard/spaCy,recognai/spaCy,Gregory-Howard/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,recognai/spaCy,...
72f4dc35375ba001c2b1dbaca4d0914dc2c4de9d
tests/test_compat.py
tests/test_compat.py
import pytest from django.test import TestCase from rest_framework.request import Request from rest_framework.test import APIRequestFactory from rest_framework.parsers import JSONParser from rest_framework.exceptions import ParseError from rest_framework_jwt.compat import get_request_data class CompatTests(TestCase)...
import pytest from django.test import TestCase from rest_framework.request import Request from rest_framework.test import APIRequestFactory from rest_framework.parsers import JSONParser from rest_framework.exceptions import ParseError from rest_framework_jwt.compat import get_request_data class CompatTests(TestCase)...
Add test empty json post data
Add test empty json post data
Python
mit
shanemgrey/django-rest-framework-jwt,GetBlimp/django-rest-framework-jwt,ArabellaTech/django-rest-framework-jwt,orf/django-rest-framework-jwt,blaklites/django-rest-framework-jwt,plentific/django-rest-framework-jwt
a2084c42850a29c417f2a9caf9dc1c56a7945e6b
backend/scripts/create_training_demos.py
backend/scripts/create_training_demos.py
#!/usr/bin/env python import rethinkdb as r import os if __name__ == "__main__": conn = r.connect('localhost', 30815, db='materialscommons') apikeys = r.table('users').pluck('apikey', 'id').run(conn) for k in apikeys: command = "curl -XPUT http://mctest.localhost/api/v2/users/%s/create_demo_project...
#!/usr/bin/env python import rethinkdb as r import os if __name__ == "__main__": conn = r.connect('localhost', 30815, db='materialscommons') apikeys = r.table('users').pluck('apikey', 'id').run(conn) for k in apikeys: command = "curl -k -XPUT https://test.materialscommons.org/api/v2/users/%s/create...
Change url to test and add -k flag to ignore certificate
Change url to test and add -k flag to ignore certificate
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
0ae513c9ea37e04deb3c72d0c61ca480a8c62266
lpthw/ex24.py
lpthw/ex24.py
print "Let's practice everything." print "You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs." poem = """ \t the lovely world wtih logic so firmly planted cannot discern \n the needs of love nor comprehend passion from intuition and requires an explanation \n\t\twhere there is none. """ print ...
print "Let's practice everything." print "You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs." poem = """ \t the lovely world wtih logic so firmly planted cannot discern \n the needs of love nor comprehend passion from intuition and requires an explanation \n\t\twhere there is none. """ print ...
Comment for a slick little trick.
Comment for a slick little trick.
Python
mit
jaredmanning/learning,jaredmanning/learning
fcc4546a736fd6adacf6f7fe0261a1c6304c931c
src/ipf/ipfblock/connection.py
src/ipf/ipfblock/connection.py
# -*- coding: utf-8 -*- import ioport class Connection(object): """ Connection class for IPFBlock Connection binding OPort and IPort of some IPFBlocks """ def __init__(self, oport, iport): # Check port compatibility and free of input port if ioport.is_connect_allowed(oport,...
# -*- coding: utf-8 -*- import ioport import weakref class Connection(object): """ Connection class for IPFBlock Connection binding OPort and IPort of some IPFBlocks """ def __init__(self, oport, iport): # Check port compatibility and free of input port if ioport.is_connect...
Change _oport and _iport to weakref for prevention of loop references
Change _oport and _iport to weakref for prevention of loop references
Python
lgpl-2.1
anton-golubkov/Garland,anton-golubkov/Garland
a4a5ca393ffc553202b266bdea790768a119f8f8
django_pin_auth/auth_backend.py
django_pin_auth/auth_backend.py
from django.contrib.auth import get_user_model from .models import SingleUseToken class PinBackend(object): """Authentication backend based on pin value.""" def authenticate(self, request, email=None, pin=None): """Authenticate user based on valid pin.""" user_model = get_user_model() ...
from django.contrib.auth import get_user_model from .models import SingleUseToken class PinBackend(object): """Authentication backend based on pin value.""" def authenticate(self, request, email=None, pin=None): """Authenticate user based on valid pin.""" try: token = self._get_tok...
Refactor to query straight for user
refactor(verification): Refactor to query straight for user - Implement get_user - Change to make a single query to find the token, using a join to the user's email
Python
mit
redapesolutions/django-pin-auth,redapesolutions/django-pin-auth,redapesolutions/django-pin-auth