commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
8fef64af916766a6db90c3e220e6d6d6ee598533 | Fix hasty manual merge | hnarayanan/cheeper,hnarayanan/cheeper | api/cheeper/urls.py | api/cheeper/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import ObtainJSONWebToken
from users.serializers import AuthSerializer
from users.views import UserViewSet
from cheeps.views import CheepViewSet
router ... | from django.conf import settings
from django.conf.urls import patterns, include, url
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import ObtainJSONWebToken
from users.serializers import AuthSerializer
from users.views import UserViewSet
from cheeps.views import CheepViewSet
router ... | agpl-3.0 | Python |
789c4251210df1610deca9e817cbb39736421af7 | Make 0 an invalid municipio identifier | poliquin/brazilnum | brazilnum/muni.py | brazilnum/muni.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
from __future__ import absolute_import
from .util import clean_id
"""
Functions for working with Brazilian municipality (municipio) codes.
"""
MUNI_WEIGHTS = [1, 2, 1, 2, 1, 2]
# there are 9 IBGE municipal codes with invalid check digits;
# see, http://www.sefaz.al.gov... | #!/usr/bin/env python
# -*- coding: utf8 -*-
from __future__ import absolute_import
from .util import clean_id
"""
Functions for working with Brazilian municipality (municipio) codes.
"""
MUNI_WEIGHTS = [1, 2, 1, 2, 1, 2]
# there are 9 IBGE municipal codes with invalid check digits;
# see, http://www.sefaz.al.gov... | mit | Python |
7604fd737f88a0d02254632f77f72cbbeb743989 | refactor islington import script to remove ffs code | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_islington.py | polling_stations/apps/data_collection/management/commands/import_islington.py | """
Import Islington
"""
import os
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseShpImporter, CsvHelper
class Command(BaseShpImporter):
"""
Imports the Polling Station data from Islington Council
"""
council_id = 'E09000019'
districts_name = 'POLLING_... | """
Import Islington
"""
from django.contrib.gis.geos import Point
import ffs
from data_collection.management.commands import BaseShpImporter
class Command(BaseShpImporter):
"""
Imports the Polling Station data from Islington Council
"""
council_id = 'E09000019'
districts_name = 'POLLING_AREA'
... | bsd-3-clause | Python |
adef0ab2e1c4e2cad4da988884eebd0e9f5b376b | Test init | ilayn/harold | harold/__init__.py | harold/__init__.py | from .harold import * | | mit | Python |
0ee1b0b5d9712b6cf2f22429db98549e1a0c8cb8 | remove test relying on Werkzeug Local internals | drewja/flask,pallets/flask,fkazimierczak/flask,mitsuhiko/flask,drewja/flask,fkazimierczak/flask,fkazimierczak/flask,pallets/flask,pallets/flask,mitsuhiko/flask,drewja/flask | tests/test_regression.py | tests/test_regression.py | import flask
def test_aborting(app):
class Foo(Exception):
whatever = 42
@app.errorhandler(Foo)
def handle_foo(e):
return str(e.whatever)
@app.route("/")
def index():
raise flask.abort(flask.redirect(flask.url_for("test")))
@app.route("/test")
def test():
... | import gc
import platform
import threading
import pytest
import flask
_gc_lock = threading.Lock()
class assert_no_leak:
def __enter__(self):
gc.disable()
_gc_lock.acquire()
loc = flask._request_ctx_stack._local
# Force Python to track this dictionary at all times.
# Thi... | bsd-3-clause | Python |
20fb71e2f9bdee89b1c82480ab3ed45cec09d8a5 | Add TODO note | Dih5/duat | tests/TestOsirisConfig.py | tests/TestOsirisConfig.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
TestOsirisConfig.py: Tests for the `osiris.config` module.
"""
import unittest
import re
from duat import config
import numpy as np
def _remove_comments(s):
"""Remove fortran comments from string"""
return "\n".join(filter(lambda s2: not re.match("!--.*",... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
TestOsirisConfig.py: Tests for the `osiris.config` module.
"""
import unittest
import re
from duat import config
import numpy as np
def _remove_comments(s):
"""Remove fortran comments from string"""
return "\n".join(filter(lambda s2: not re.match("!--.*",... | mit | Python |
3f1afcbe67d7fd03332de4976b4a1b38ef8c1355 | Set min_foreground higher | white-lab/pyproteome | tests/phosphosite_test.py | tests/phosphosite_test.py |
from unittest import TestCase
# import pylab
from pyproteome import phosphosite
class PhosphositeTest(TestCase):
# def setUp(self):
# pylab.rcParams['figure.max_open_warning'] = 0
def test_generate_logos(self):
for species in ["Human", "Mouse"]:
phosphosite.generate_logos(
... |
from unittest import TestCase
# import pylab
from pyproteome import phosphosite
class PhosphositeTest(TestCase):
# def setUp(self):
# pylab.rcParams['figure.max_open_warning'] = 0
def test_generate_logos(self):
for species in ["Human", "Mouse"]:
phosphosite.generate_logos(speci... | bsd-2-clause | Python |
f09f942be9c4c8af1abf0d78c0cf5fa64ec7db9d | Edit entry test | techbureau/zaifbot,techbureau/zaifbot | tests/rules/test_entry.py | tests/rules/test_entry.py | import unittest
from unittest.mock import Mock
from zaifbot.rules.entry.base import Entry
class TradeForEntryTest:
def entry(self):
pass
class TestEntry(unittest.TestCase):
def setUp(self):
self._entry = Entry(
currency_pair='btc_jpy',
amount=1,
action='bi... | import unittest
from unittest.mock import Mock
from zaifbot.rules import Entry
class EntryForTest(Entry):
def can_entry(self):
return True
class TradeForEntryTest:
def entry(self):
pass
class TestEntry(unittest.TestCase):
def test_entry(self):
entry = EntryForTest(currency_pair... | mit | Python |
c3d7f8a2c5a23736cf518e8909e8bcd81a6c2312 | delete sample data before test | mjirik/imtools,mjirik/imtools | tests/sample_data_test.py | tests/sample_data_test.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
import os
import os.path
from nose.plugins.attrib import attr
path_to_script = os.path.dirname(os.path.abspath(__file__))
import unittest
import shutil
import numpy as np
# from imtools import qmisc
# from imtools import misc
import imt... | #! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
import os
import os.path
from nose.plugins.attrib import attr
path_to_script = os.path.dirname(os.path.abspath(__file__))
import unittest
import shutil
import numpy as np
# from imtools import qmisc
# from imtools import misc
import imt... | mit | Python |
89f4947a1d0743eee5c24a9a5c11a0e64301a5b2 | Fix APS2Pattern test | BBN-Q/QGL,BBN-Q/QGL | tests/test_APS2Pattern.py | tests/test_APS2Pattern.py | import h5py
import unittest
import numpy as np
from copy import copy
from QGL import *
from QGL.drivers import APS2Pattern
class APSPatternUtils(unittest.TestCase):
def setUp(self):
self.q1gate = Channels.LogicalMarkerChannel(label='q1-gate')
self.q1 = Qubit(label='q1', gate_chan=self.q1gate)
... | import h5py
import unittest
import numpy as np
from copy import copy
from QGL import *
from QGL.drivers import APS2Pattern
class APSPatternUtils(unittest.TestCase):
def setUp(self):
self.q1gate = Channels.LogicalMarkerChannel(label='q1-gate')
self.q1 = Qubit(label='q1', gate_chan=self.q1gate)
... | apache-2.0 | Python |
67bab860e7cc4df1375a5890c93011edd01fe50a | Trim errant run_payday call in no_payday test | mccolgst/www.gittip.com,gratipay/gratipay.com,studio666/gratipay.com,mccolgst/www.gittip.com,gratipay/gratipay.com,eXcomm/gratipay.com,eXcomm/gratipay.com,mccolgst/www.gittip.com,eXcomm/gratipay.com,gratipay/gratipay.com,studio666/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,eXcomm/gratipay.com,studio666... | tests/test_charts_json.py | tests/test_charts_json.py | from __future__ import print_function, unicode_literals
import datetime
import json
from gittip.billing.payday import Payday
from gittip.testing import Harness
from gittip.testing.client import TestClient
class Tests(Harness):
def make_participants_and_tips(self):
alice = self.make_participant('alice',... | from __future__ import print_function, unicode_literals
import datetime
import json
from gittip.billing.payday import Payday
from gittip.testing import Harness
from gittip.testing.client import TestClient
class Tests(Harness):
def make_participants_and_tips(self):
alice = self.make_participant('alice',... | mit | Python |
da715e33bbba0428f0be25e8cc3ff4e88ec72bbb | Fix mongoengine connection. | QuantumGhost/factory_boy,rrauenza/factory_boy,adamchainz/factory_boy,yograterol/factory_boy,FactoryBoy/factory_boy,fizista/factory_boy,dpausp/factory_boy,rbarrois/factory_boy,kamotos/factory_boy,muhammad-ammar/factory_boy,mapleoin/factory_boy | tests/test_mongoengine.py | tests/test_mongoengine.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Romain Command&
#
# 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 restriction, including without limitation the rights
# to use, copy, mod... | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Romain Command&
#
# 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 restriction, including without limitation the rights
# to use, copy, mod... | mit | Python |
683a8467ec696c32a2d404c2aa7b48147b6941fe | Fix up function doc | cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot,cornell-cup/cs-minibot | tests/test_virtual8bot.py | tests/test_virtual8bot.py | """
Unit test for the Virtual Figure 8 Bot.
Ensure the the Figure 8 Bot hits certain checkpoints in its loop.
"""
import math
import unittest
from tests.virtual8bot import Virtual8Bot
def dist(x1, y1, x2, y2):
"""
Returns:
float: The Euclidean distance between two points.
"""
return math.sqrt... | """
Unit test for the Virtual Figure 8 Bot.
Ensure the the Figure 8 Bot hits certain checkpoints in its loop.
"""
import math
import unittest
from tests.virtual8bot import Virtual8Bot
def dist(x1, y1, x2, y2):
"""
Return the Euclidean distance between two points.
"""
return math.sqrt((x2 - x1) * (x2 ... | apache-2.0 | Python |
84509c3352118aaffe9cbaddd78b579ae22465db | use dictionary for thumbs parameter | infinityxxx/django-thumbnail-maker,infinityxxx/django-thumbnail-maker,infinityxxx/django-thumbnail-maker | thumbnail_maker/fields.py | thumbnail_maker/fields.py | from PIL import Image
from django.db.models.fields.files import ImageFieldFile
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.fields import ImageField
class ImageWithThumbnailsFieldFile(ImageFieldFile):
def save(self, name, content, save=True):
super(ImageWithThumbnailsFieldFile, self).save... | from PIL import Image
from django.db.models.fields.files import ImageFieldFile
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.fields import ImageField
class ImageWithThumbnailsFieldFile(ImageFieldFile):
def save(self, name, content, save=True):
super(ImageWithThumbnailsFieldFile, self).save... | bsd-3-clause | Python |
12587a6d35c1802b3286e82ba15b8903f5c3b242 | Improve module name | njeudy/partner-contact,komsas/partner-contact,idncom/partner-contact,charbeljc/partner-contact,diagramsoftware/partner-contact,Therp/partner-contact,NL66278/partner-contact,open-synergy/partner-contact,vrenaville/partner-contact,raycarnes/partner-contact,numerigraphe/partner-contact,guewen/partner-contact,gurneyalex/pa... | partner-address-street3/__openerp__.py | partner-address-street3/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... | agpl-3.0 | Python |
095b4c23f76e48a566c505f25668c5385242b2fd | Add state_equals convenience method to WorkflowBase | zzgvh/django-workflows | workflows/__init__.py | workflows/__init__.py | # workflows imports
import workflows.utils
from workflows.models import State
class WorkflowBase(object):
"""Mixin class to make objects workflow aware.
"""
def get_workflow(self):
"""Returns the current workflow of the object.
"""
return workflows.utils.get_workflow(self)
def ... | # workflows imports
import workflows.utils
class WorkflowBase(object):
"""Mixin class to make objects workflow aware.
"""
def get_workflow(self):
"""Returns the current workflow of the object.
"""
return workflows.utils.get_workflow(self)
def remove_workflow(self):
"""R... | bsd-3-clause | Python |
8c32cb308f6118e39d5fbdc9ba6aa4c20665b3c5 | Bump version | beerfactory/hbmqtt | hbmqtt/__init__.py | hbmqtt/__init__.py | # Copyright (c) 2015 Nicolas JOUANIN
#
# See the file license.txt for copying permission.
VERSION = (0, 6, 2, 'final', 0)
| # Copyright (c) 2015 Nicolas JOUANIN
#
# See the file license.txt for copying permission.
VERSION = (0, 7, 0, 'alpha', 0)
| mit | Python |
ea8d084a96e9f8faad8d2d0f18957cadd49fed74 | Update patternMatch.py | christieewen/Algorithms,christieewen/Algorithms | TechInterviews/Python/patternMatch.py | TechInterviews/Python/patternMatch.py | import sys
import re
def findBestMatch(pattern, path):
re.findall(r+pattern, path)
#['foot', 'fell', 'fastest']
# Example to call this program: python34 patternMatch.py <input_file> output_file
def main(args):
input_file = open(args[1], 'r')
output_file = open(args[2], 'w')
pattern_list = []
... | import sys
import re
def findBestMatch(pattern, path):
re.findall(r+pattern, path)
#['foot', 'fell', 'fastest']
# Example to call this program: python34 patternMatch.py <input_file> output_file
def main(args):
input_file = open(args[1], 'r')
output_file = open(args[2], 'w')
N = input_file.readline()
... | mit | Python |
28e049b3999ade7ef55fc04dc5d6889cf4d6903a | Update hospitals/admin.py | moodpulse/l2,moodpulse/l2,moodpulse/l2,moodpulse/l2,moodpulse/l2 | hospitals/admin.py | hospitals/admin.py | from django.contrib import admin
from hospitals import models
class RefHospitals(admin.ModelAdmin):
list_display = (
'title',
'short_title',
'code_tfoms',
'is_default',
)
list_display_links = (
'title',
'short_title',
'code_tfoms',
'is_defaul... | from django.contrib import admin
from hospitals import models
class RefHospitals(admin.ModelAdmin):
list_display = (
'title',
'short_title',
'code_tfoms',
'is_default',
)
list_display_links = (
'title',
'short_title',
'code_tfoms',
'is_defau... | mit | Python |
73db850c31ac591a38196891ccda6c6b9edb2fec | Fix migration down version | NejcZupec/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,prasannav7/ggrc-core,VinnieJohns/ggrc-core,prasannav7/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,Nej... | src/ggrc/migrations/versions/20160223152916_204540106539_assessment_titles.py | src/ggrc/migrations/versions/20160223152916_204540106539_assessment_titles.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: ivan@reciprocitylabs.com
# Maintained By: ivan@reciprocitylabs.com
"""Assessment titles
Revision ID: 204540106539
Revises: 1839dabd2357
Create Dat... | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: ivan@reciprocitylabs.com
# Maintained By: ivan@reciprocitylabs.com
"""Assessment titles
Revision ID: 204540106539
Revises: 4e989ef86619
Create Dat... | apache-2.0 | Python |
ee42207c0d8df664e5524cf42f6bc806832776f2 | Optimize the LBP implementation | timvandermeij/lbp.py | lbp.py | lbp.py | import sys
import os.path
import numpy as np
from PIL import Image
class LBP:
def __init__(self, filename):
self.filename = filename
def process(self):
# Open the image and convert to grayscale
image = Image.open(self.filename).convert('L')
# Make pixels accessible like a 2D a... | import sys
import os.path
import numpy as np
from PIL import Image
class LBP:
def __init__(self, filename):
self.filename = filename
def process(self):
# Open the image and convert to grayscale
image = Image.open(self.filename).convert('L')
# Make pixels accessible like a 2D a... | mit | Python |
a4c0b528832a037ccc0c398c81157ba996cdfcc6 | remove possibly broken 'near' match in lua linter | lunixbochs/linters | lua.py | lua.py | from lint import Linter
class Lua(Linter):
language = ('coronasdklua', 'lua')
cmd = ('luac', '-p')
regex = '^luac: [^:]+:(?P<line>\d+): (?P<error>.+)'
def run(self, cmd, code):
return self.tmpfile(cmd, code, suffix='.lua')
| from lint import Linter
class Lua(Linter):
language = ('coronasdklua', 'lua')
cmd = ('luac', '-p')
regex = '^luac: [^:]+:(?P<line>\d+): (?P<error>.+?)(?P<near> near .+)?'
def run(self, cmd, code):
return self.tmpfile(cmd, code, suffix='.lua')
| mit | Python |
5bd969572b57796bd836796eb97ffbc6cee72b8c | Fix typo. | tettoon/vgmplayer-rpi-re | m3u.py | m3u.py | from __future__ import division, print_function, unicode_literals
import os
import re
import sys
class M3U:
def __init__(self, filename):
self.extm3u = False
self.dir = os.path.dirname(filename)
self.files = []
with open(filename, 'r') as f:
blank_pattern = re.compile... | from __future__ import abstract_import, division, print_function, unicode_literals
import os
import re
import sys
class M3U:
def __init__(self, filename):
self.extm3u = False
self.dir = os.path.dirname(filename)
self.files = []
with open(filename, 'r') as f:
blank_pat... | apache-2.0 | Python |
be99e6cfe8da6f6603ef5b83d623995dbd00f3da | fix NameError in Tag viewset | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | api/v2/views/tag.py | api/v2/views/tag.py | from core.models import Tag
from api.permissions import CloudAdminRequired
from api.v2.serializers.summaries import TagSummarySerializer
from api.v2.views.base import AuthReadOnlyViewSet
class TagViewSet(AuthReadOnlyViewSet):
"""
API endpoint that allows tags to be viewed or edited.
"""
queryset = T... | from core.models import Tag
from api.permissions import CloudAdminRequired
from api.v2.serializers.summaries import TagSummarySerializer
from api.v2.views.base import AuthReadOnlyViewSet
class TagViewSet(AuthReadOnlyViewSet):
"""
API endpoint that allows tags to be viewed or edited.
"""
queryset = T... | apache-2.0 | Python |
c5683cb2bf8635c6ad26aac807f47c8f1fb4c68a | Fix incomplete URL from command line | eliangcs/http-prompt,Yegorov/http-prompt | http_prompt/cli.py | http_prompt/cli.py | import click
from prompt_toolkit import prompt
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit.layout.lexers import PygmentsLexer
from prompt_toolkit.styles.from_pygments import style_from_pygments
from pygments.styles import get_style_by_name
from .completer import HttpPromptCompleter
from .co... | import click
from prompt_toolkit import prompt
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit.layout.lexers import PygmentsLexer
from prompt_toolkit.styles.from_pygments import style_from_pygments
from pygments.styles import get_style_by_name
from .completer import HttpPromptCompleter
from .co... | mit | Python |
514f9f8a06c1cb6f32e9de12e3b03172b86bdba6 | Support __all__ = ast.Tuple | Suor/flaws | flaws/asttools.py | flaws/asttools.py | import ast
def is_write(node):
return isinstance(node, (ast.Import, ast.ImportFrom,
ast.FunctionDef, ast.ClassDef, ast.arguments)) \
or isinstance(node.ctx, (ast.Store, ast.Del, ast.Param))
def is_use(node):
return isinstance(node, ast.Name) \
and isinstance(node.... | import ast
def is_write(node):
return isinstance(node, (ast.Import, ast.ImportFrom,
ast.FunctionDef, ast.ClassDef, ast.arguments)) \
or isinstance(node.ctx, (ast.Store, ast.Del, ast.Param))
def is_use(node):
return isinstance(node, ast.Name) \
and isinstance(node.... | bsd-2-clause | Python |
b2ae2b359b5765270fd464301e5912d54147f88b | use less stupid words in tests | internetarchive/warctools,internetarchive/warctools,tef/warctools,tef/warctools | hanzo/httptools/tests/parse_test.py | hanzo/httptools/tests/parse_test.py | import unittest2
from StringIO import StringIO
from hanzo.httptools.messaging import RequestParser, ResponseParser
get_request = "\r\n".join( [
"GET / HTTP/1.1",
"Host: example.org",
"",
"",
])
get_response = "\r\n".join( [
"HTTP/1.1 200 OK",
"Host: example.org",
"Content-Length:5",
... | import unittest2
from StringIO import StringIO
from hanzo.httptools.messaging import RequestParser, ResponseParser
get_request = "\r\n".join( [
"GET / HTTP/1.1",
"Host: example.org",
"",
"",
])
get_response = "\r\n".join( [
"HTTP/1.1 200 OK",
"Host: example.org",
"Content-Length:5",
... | mit | Python |
3055fa16010a1b855142c2e5b866d76daee17c8f | Add test for bold and italic text | LukasWoodtli/PyMarkdownGen | markdown_gen/test/attributes_test.py | markdown_gen/test/attributes_test.py |
import unittest
import markdown_gen.MardownGen as md
class AttributesTests(unittest.TestCase):
def test_italic(self):
expected = "*italic text*"
self.assertEqual(expected, md.gen_italic("italic text"))
expected = "_italic text alternative_"
self.assertEqual(expected, md.gen_it... |
import unittest
import markdown_gen.MardownGen as md
class AttributesTests(unittest.TestCase):
def test_italic(self):
expected = "*italic text*"
self.assertEqual(expected, md.gen_italic("italic text"))
expected = "_italic text alternative_"
self.assertEqual(expected, md.gen_it... | epl-1.0 | Python |
8c763b1ae725266ae04289db9534eb69da6a827e | Use published_parsed instead of updated_parsed to work with newer feedparser without deprecation warnings | datagutten/comics,datagutten/comics,datagutten/comics,datagutten/comics,jodal/comics,jodal/comics,jodal/comics,jodal/comics | comics/aggregator/feedparser.py | comics/aggregator/feedparser.py | from __future__ import absolute_import
import datetime
import feedparser
from comics.aggregator.lxmlparser import LxmlParser
class FeedParser(object):
def __init__(self, url):
self.raw_feed = feedparser.parse(url)
self.encoding = self.raw_feed.encoding or None
def for_date(self, date):
... | from __future__ import absolute_import
import datetime
import feedparser
from comics.aggregator.lxmlparser import LxmlParser
class FeedParser(object):
def __init__(self, url):
self.raw_feed = feedparser.parse(url)
self.encoding = self.raw_feed.encoding or None
def for_date(self, date):
... | agpl-3.0 | Python |
d1e3bdf40809a44f557a3437d245c6040beed15d | Fix typo in run_tests.py | freedomofpress/fingerprint-securedrop,freedomofpress/fingerprint-securedrop,freedomofpress/fingerprint-securedrop,freedomofpress/FingerprintSecureDrop,freedomofpress/FingerprintSecureDrop | fpsd/run_tests.py | fpsd/run_tests.py | #!/usr/bin/env python3.5
from subprocess import call
from os.path import dirname, abspath, join
# Run all the tests using py.test
call(["python3.5", "-m", "unittest", "-f", "-v", "test.test_sketchy_sites"])
| #!/usr/bin/env python3.5
from subprocess import call
from os.path import dirname, abspath, join
# Run all the tests using py.test
call(["python3.5", "-m", "unittest", "-f", "-v", "test.test_bad_site_set"])
| agpl-3.0 | Python |
ac2b57c893d04b2241bf061fc8c1ad7b14d27e37 | Fix ruby client generating bug and support Python 3.x | jubatus/jubatus,rimms/jubatus_core,rimms/jubatus,kumagi/jubatus_core,roselleebarle04/jubatus,gintenlabo/jubatus,roselleebarle04/jubatus,Asuka52/jubatus,gintenlabo/jubatus_core,kmaehashi/jubatus_core,jubatus/jubatus,kumagi/jubatus_core,jubatus/jubatus,gintenlabo/jubatus_core,rimms/jubatus,kmaehashi/jubatus_core,kumagi/j... | tools/generate_clients.py | tools/generate_clients.py | import subprocess
import sys
import os
import tarfile
import shutil
def generate(idl, lang, indir, outdir0):
outdir = outdir0 + '/' + lang
try:
os.mkdir(outdir)
except:
pass
print("generating {0}.{1}".format(idl, lang))
idlfile = idl+".idl"
options = []
if lang == "cpp":
... | import subprocess
import sys
import os
import tarfile
import shutil
def generate(idl, lang, indir, outdir0):
outdir = outdir0 + '/' + lang
try: os.mkdir(outdir)
except: pass
print "generating %s.%s" % (idl, lang)
idlfile = idl+".idl"
options = []
if lang == "cpp":
options.append("-p... | lgpl-2.1 | Python |
12925619bd479d537fb722f9db531df3c0979452 | add user login code | free-free/pyblog,free-free/pyblog,free-free/pyblog,free-free/pyblog | app/user_handler.py | app/user_handler.py | #-*- coding:utf-8 -*-
from tools.httptools import Route
from models import User
@Route.get('/{username}')
def get_user_handler(app,username):
print(username)
app.render("admin.html")
@Route.get('/login')
def get_login_handler(app):
app.render("signin.html")
@Route.post('/login')
def post_login_handler(app):
print... | #-*- coding:utf-8 -*-
from tools.httptools import Route
from models import User
@Route.get('/{username}')
def get_user_handler(app,username):
print(username)
app.render("admin.html")
| mit | Python |
835044391a86df33cf6d071911107d76a5963c26 | fix coding style | buildtimetrend/python-lib | generate_trend.py | generate_trend.py | #!/usr/bin/env python
# vim: set expandtab sw=4 ts=4:
#
# Generates a trend (graph) from the buildtimes in buildtimes.xml
#
# usage : generate_trend.py -h --trend=native
#
# Copyright (C) 2014 Dieter Adriaenssens <ruleant@users.sourceforge.net>
#
# This file is part of buildtime-trend
# <https://github.com/ruleant/buil... | #!/usr/bin/env python
# vim: set expandtab sw=4 ts=4:
#
# Generates a trend (graph) from the buildtimes in buildtimes.xml
#
# usage : generate_trend.py -h --trend=native
#
# Copyright (C) 2014 Dieter Adriaenssens <ruleant@users.sourceforge.net>
#
# This file is part of buildtime-trend
# <https://github.com/ruleant/buil... | agpl-3.0 | Python |
247797d0db15acdbe915e2b72f284180c4c78d1d | Fix gtk3 / twisted import | MichalPokorny/ldtp2,ldtp/ldtp2,freedesktop-unofficial-mirror/ldtp__ldtp2,freedesktop-unofficial-mirror/ldtp__ldtp2,ldtp/ldtp2,MichalPokorny/ldtp2,ldtp/ldtp2,ldtp/ldtp2,MichalPokorny/ldtp2,freedesktop-unofficial-mirror/ldtp__ldtp2,freedesktop-unofficial-mirror/ldtp__ldtp2,freedesktop-unofficial-mirror/ldtp__ldtp2,ldtp/l... | ldtpd/__init__.py | ldtpd/__init__.py | """
LDTP v2 init file
@author: Eitan Isaacson <eitan@ascender.com>
@author: Nagappan Alagappan <nagappan@gmail.com>
@copyright: Copyright (c) 2009 Eitan Isaacson
@copyright: Copyright (c) 2009-11 Nagappan Alagappan
@license: LGPL
http://ldtp.freedesktop.org
This file may be distributed and/or modified under the term... | """
LDTP v2 init file
@author: Eitan Isaacson <eitan@ascender.com>
@author: Nagappan Alagappan <nagappan@gmail.com>
@copyright: Copyright (c) 2009 Eitan Isaacson
@copyright: Copyright (c) 2009-11 Nagappan Alagappan
@license: LGPL
http://ldtp.freedesktop.org
This file may be distributed and/or modified under the term... | lgpl-2.1 | Python |
9c119ec89b79d27b284bb89f2507cc93f32d8d68 | Use unique names for twiggy emitters. | jiffyclub/ipythonblocks.org,jiffyclub/ipythonblocks.org | app/twiggy_setup.py | app/twiggy_setup.py | import tornado.options
from twiggy import *
def twiggy_setup():
fout = outputs.FileOutput(
tornado.options.options.app_log_file, format=formats.line_format)
sout = outputs.StreamOutput(format=formats.line_format)
addEmitters(
('ipborg.file', levels.DEBUG, None, fout),
('ipborg.std... | import tornado.options
from twiggy import *
def twiggy_setup():
fout = outputs.FileOutput(
tornado.options.options.app_log_file, format=formats.line_format)
sout = outputs.StreamOutput(format=formats.line_format)
addEmitters(
('ipborg', levels.DEBUG, None, fout),
('ipborg', levels... | mit | Python |
e8b137582affa0b2bc8b4b6479e2c846a46a831d | move declaration of leave approval group to the front of the list so it's available to the other data files | bwrsandman/openerp-hr,bwrsandman/openerp-hr | hr_holidays_extension/__openerp__.py | hr_holidays_extension/__openerp__.py | #-*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero G... | #-*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero G... | agpl-3.0 | Python |
765d82b430a810507b81d0ccfaa0b680a1aa662c | set ignore property | pombreda/pyamg,pombreda/pyamg,pombreda/pyamg,pombreda/pyamg | pyamg/relaxation/info.py | pyamg/relaxation/info.py | """
Relaxation methods
------------------
The multigrid cycle is formed by two complementary procedures: relaxation and
coarse-grid correction. The role of relaxation is to rapidly damp oscillatory
(high-frequency) errors out of the approximate solution. When the error is
smooth, it can then be accurately represent... | """
Relaxation methods
------------------
The multigrid cycle is formed by two complementary procedures: relaxation and
coarse-grid correction. The role of relaxation is to rapidly damp oscillatory
(high-frequency) errors out of the approximate solution. When the error is
smooth, it can then be accurately represent... | bsd-3-clause | Python |
a9c9a8c5ec5ca3058afbb55362aa73feda5132e9 | increment version | albertfxwang/grizli | grizli/version.py | grizli/version.py | # Should be one commit behind latest
__version__ = "0.2.1-16-gc7c75f2"
| # Should be one commit behind latest
__version__ = "0.2.1-12-ga4fcc42"
| mit | Python |
e5c675295c98a65108d707575be4ca0d1d117de6 | Create new environment | bertjwregeer/vrun | src/vrun/cli.py | src/vrun/cli.py | from __future__ import print_function
import os
import sys
def main():
prefix = sys.prefix
binpath = os.path.join(prefix, 'bin')
PATH = os.environ.get('PATH', '')
if PATH:
PATH = binpath + os.pathsep + PATH
else:
PATH = binpath
newenv = os.environ
newenv['PATH'] = PATH
... | from __future__ import print_function
import os
import sys
def main():
prefix = sys.prefix
binpath = os.path.join(prefix, 'bin')
PATH = os.environ.get('PATH', '')
if PATH:
PATH = binpath + os.pathsep + PATH
else:
PATH = binpath
os.putenv('PATH', PATH)
os.putenv('VRUN_ACTI... | isc | Python |
7ba2dfc5181e94c2f395e9cf32b00b32eb7359e2 | Add license text and update model | rijkstofberg/pyramid.payment | pyramidpayment/models.py | pyramidpayment/models.py | ##############################################################################
#
# Copyright (c) 2013 Rijk Stofberg
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License (MIT),
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and ass... | from sqlalchemy import (
Column,
Sequence,
Integer,
Text,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
)
from zope.sqlalchemy import ZopeTransactionExtension
DBSession = scoped_session(sessionmaker(extension=Zope... | mit | Python |
11f698532fa24b7236cf42013cf4a276d97088ad | Improve error message | OCA/geospatial,OCA/geospatial,OCA/geospatial | base_geoengine/geo_db.py | base_geoengine/geo_db.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | agpl-3.0 | Python |
68284a04393fccb3c408ecac1413456e659fc750 | Update create_project.py | Omicia/omicia_api_examples,Omicia/omicia_api_examples,Omicia/omicia_api_examples | python/create_project.py | python/create_project.py | """Create a new project.
"""
import argparse
import os
import requests
from requests.auth import HTTPBasicAuth
import sys
# Load environment variables for request authentication parameters
if "OMICIA_API_PASSWORD" not in os.environ:
sys.exit("OMICIA_API_PASSWORD environment variable missing")
if "OMICIA_API_LOGI... | """Create a new project.
"""
import argparse
import os
import requests
from requests.auth import HTTPBasicAuth
import sys
# Load environment variables for request authentication parameters
if "OMICIA_API_PASSWORD" not in os.environ:
sys.exit("OMICIA_API_PASSWORD environment variable missing")
if "OMICIA_API_LOGI... | mit | Python |
53df56630e6b97bfe7b7478b2ca11d34772fbdc7 | fix regression that made imports longer. | jonhadfield/python-hosts | python_hosts/__init__.py | python_hosts/__init__.py | # -*- coding: utf-8 -*-
"""
This package contains all of the modules utilised by the python-hosts library.
hosts: Contains the Hosts and HostsEntry classes that represent instances of a hosts file and it's individual lines/entries
utils: Contains helper functions to check the available operations on a hosts file and ... | # -*- coding: utf-8 -*-
"""
This package contains all of the modules utilised by the python-hosts library.
hosts: Contains the Hosts and HostsEntry classes that represent instances of a hosts file and it's individual lines/entries
utils: Contains helper functions to check the available operations on a hosts file and ... | mit | Python |
0e4c986d2e77774c93e2af8cd660ea3e28d0044d | Fix undefined var error with start web-browser commit 407cad235a356fbbb62bbab18a627595b20b1a88 | yCanta/yCanta,yCanta/yCanta,yCanta/yCanta,yCanta/yCanta | start-webapp.py | start-webapp.py | #!/usr/bin/python
import pkg_resources
pkg_resources.require("TurboGears")
import turbogears
import cherrypy
cherrypy.lowercase_api = True
from os.path import *
import os
import sys
start_browser = False
for i in range(len(sys.argv)):
if sys.argv[i] == '--start-browser':
del sys.argv[i]
start_browser = Tru... | #!/usr/bin/python
import pkg_resources
pkg_resources.require("TurboGears")
import turbogears
import cherrypy
cherrypy.lowercase_api = True
from os.path import *
import os
import sys
for i in range(len(sys.argv)):
if sys.argv[i] == '--start-browser':
del sys.argv[i]
start_browser = True
# first look on the... | unlicense | Python |
984bcd419b7e07b97ca132375ac78ccebd144112 | add AUTH_USER_MODEL setting | joealcorn/berth.cc,joealcorn/berth.cc | berth/settings/common.py | berth/settings/common.py | """
Django settings for berth project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | """
Django settings for berth project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | mit | Python |
111298e847473cb3e8e2466096a373de631ad51b | fix indentation issue | dhhxu/LBNL-lucid | run.py | run.py | #!/usr/bin/env python
"""
Main script to get data from Lucid's website and upload it to a sMAP server.
The process is as follows:
1. Get data query from user input
2. Send query to Lucid and get resulting data dump
3. Extract dumped .zip files and split them if necessary
4. Upload .csv files into sMAP server.
"""
... | #!/usr/bin/env python
"""
Main script to get data from Lucid's website and upload it to a sMAP server.
The process is as follows:
1. Get data query from user input
2. Send query to Lucid and get resulting data dump
3. Extract dumped .zip files and split them if necessary
4. Upload .csv files into sMAP server.
"""
... | mit | Python |
70eb7008ebacd1d77524403737a15d7b1359378e | set port | atlefren/beercalc,atlefren/beercalc,atlefren/beercalc | run.py | run.py | ##!venv/bin/python
import os
from app import app
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port) | #!venv/bin/python
from app import app
app.run(debug = True) | mit | Python |
0c752c090902d1fa85abc2d030c1066366be7f30 | Create run.py | stan-cap/bt_rssi,stan-cap/bt_rssi | run.py | run.py | import main
import datetime
import time
f = open("records.txt", "a+") # open text file for editting
f.write("RSSI, sec_elapsed" + '\n') # add headers to text file
f.close()
time.sleep(45) # sleep for 45 seconds to allow Bluetooth Services to start
start_time = datetime.datetime.now() # ... | import main
import datetime
import time
f = open("records.txt", "a+") # open text file for editting
f.write("RSSI, sec_elapsed" + '\n') # add headers to text file
f.close()
time.sleep(10) # sleep for 10 seconds to allow Bluetooth Services to start
start_time = datetime.datetime.now() # ... | mit | Python |
8903804408063f074470fbabeac3eecfee5c7b9f | Embed app.run into __main__ namespace | iosonofabio/hivwholeweb,iosonofabio/hivwholeweb,iosonofabio/hivwholeweb,iosonofabio/hivwholeweb | run.py | run.py | #/usr/bin/env python
from hiv import hiv as app
# Script
if __name__ == '__main__':
app.run(debug=True)
| #/usr/bin/env python
from hiv import hiv
hiv.run(debug=True)
| mit | Python |
e33477a7232d5bffb9f7f163271c846e20d94dfa | Add created_date and modified_date to patients | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | api/radar_api/serializers/patients.py | api/radar_api/serializers/patients.py | from radar_api.serializers.cohort_patients import CohortPatientSerializer
from radar_api.serializers.cohorts import CohortReferenceField
from radar_api.serializers.meta import MetaSerializerMixin
from radar_api.serializers.organisation_patients import OrganisationPatientSerializer
from radar_api.serializers.organisatio... | from radar_api.serializers.cohort_patients import CohortPatientSerializer
from radar_api.serializers.cohorts import CohortReferenceField
from radar_api.serializers.meta import MetaSerializerMixin
from radar_api.serializers.organisation_patients import OrganisationPatientSerializer
from radar_api.serializers.organisatio... | agpl-3.0 | Python |
e053515f9e3443ae9f6fd6ed4e1fdfaa90cbeecb | update software name | cytomine/Cytomine-python-datamining,cytomine/Cytomine-python-datamining | cytomine-datamining/algorithms/sldc/examples/with_pyxit/add_software.py | cytomine-datamining/algorithms/sldc/examples/with_pyxit/add_software.py | import os
import tempfile
if __name__ == "__main__":
import cytomine
# Connect to cytomine, edit connection values
cytomine_host = "demo.cytomine.be"
cytomine_public_key = "XXX" # to complete
cytomine_private_key = "XXX" # to complete
id_project = -1 # to complete
# Connection to Cytom... | import os
import tempfile
if __name__ == "__main__":
import cytomine
# Connect to cytomine, edit connection values
cytomine_host = "demo.cytomine.be"
cytomine_public_key = "XXX" # to complete
cytomine_private_key = "XXX" # to complete
id_project = 0x0 # to complete
# Connection to Cyto... | apache-2.0 | Python |
d2bc4709027d59387d3d981c7903cfb8c5497c24 | add function is_object_exists and is_size_differ_and_newer | gahoo/SNAP,gahoo/SNAP,gahoo/SNAP | core/ali/oss.py | core/ali/oss.py | import oss2
import os
import time
from . import ALI_CONF
from oss2.exceptions import NoSuchKey
from ..colorMessage import dyeWARNING, dyeFAIL
def oss2key(destination):
prefix = os.path.join('oss://', BUCKET.bucket_name)
key = destination.replace(prefix, '').strip('/')
return key
class OSSkeys(object):
... | import oss2
import os
from . import ALI_CONF
from oss2.exceptions import NoSuchKey
from ..colorMessage import dyeWARNING
def oss2key(destination):
prefix = os.path.join('oss://', BUCKET.bucket_name)
key = destination.replace(prefix, '').strip('/')
return key
class OSSkeys(object):
def __init__(self, a... | mit | Python |
7cdb05bbb3f7b6719aba275b2fbf779bfd31a0e8 | Remove testing code | CactusDev/CactusBot | cactusbot/commands/magic/repeat.py | cactusbot/commands/magic/repeat.py | """Manage repeats."""
from . import Command
@Command.command()
class Repeat(Command):
"""Manage repeats."""
COMMAND = "repeat"
@Command.command()
async def add(self, period: r"[1-9]\d*", command: r"!?\w{1,32}", *args: False):
"""Add a repeat."""
response = await self.api.add_repeat(... | """Manage repeats."""
from . import Command
@Command.command()
class Repeat(Command):
"""Manage repeats."""
COMMAND = "repeat"
@Command.command()
async def add(self, period: r"[1-9]\d*", command: r"!?\w{1,32}", *args: False):
"""Add a repeat."""
response = await self.api.add_repeat(... | mit | Python |
44ce004e072746d58a57493d05b4bc6d757ac6bf | improve crowdfunding admin | jeromecc/doctoctocbot | src/crowdfunding/admin.py | src/crowdfunding/admin.py | from django.contrib import admin
from .models import Project, ProjectInvestment, Tier
class ProjectInvestmentAdmin(admin.ModelAdmin):
list_display = ('id', 'user', 'name', 'email', 'pledged', 'paid', 'datetime', 'public',)
search_fields = ['user', 'name', 'email',]
list_filter = ['paid', 'datetime', 'publ... | from django.contrib import admin
from .models import Project, ProjectInvestment, Tier
class ProjectInvestmentAdmin(admin.ModelAdmin):
list_display = ('id', 'user', 'name', 'email', 'pledged', 'paid', 'datetime', 'public',)
class TierAdmin(admin.ModelAdmin):
list_display = ('id', 'project', 'title', 'descript... | mpl-2.0 | Python |
78dcd376a0d94db71513c2bb920c6d08974f8dfa | remove unused import | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/cla_butler/management/commands/housekeeping.py | cla_backend/apps/cla_butler/management/commands/housekeeping.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from ...tasks import DeleteOldData
class Command(BaseCommand):
help = 'Deletes public diagnosis that are more than a day old'
def handle(self, *args, **options):
DeleteOldData().run()
| # -*- coding: utf-8 -*-
import datetime
from django.core.management.base import BaseCommand
from ...tasks import DeleteOldData
class Command(BaseCommand):
help = 'Deletes public diagnosis that are more than a day old'
def handle(self, *args, **options):
DeleteOldData().run()
| mit | Python |
1d5176e2323bc48dfb8d189e254f58fee13e83f8 | update counter to use new api | rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy | apps/counter/app.py | apps/counter/app.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import rapidsms
class App(rapidsms.app.App):
def start(self):
self.counters = {}
def parse(self, msg):
if not msg.connection.identity in self.counters:
self.counters[msg.connection.identity] = 0
def handle(self, ... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import rapidsms
class App(rapidsms.app.App):
def start(self):
self.counters = {}
def parse(self, msg):
if not msg.caller in self.counters:
self.counters[msg.caller] = 0
def handle(self, msg):
self.counter... | bsd-3-clause | Python |
ed228a71436ff312b7a2745d608c329a8cd7337f | add phonetic | guojing0/terminal-dict | terminaldict.py | terminaldict.py | #!/usr/bin/env python
from urllib import urlopen
from bs4 import BeautifulSoup as bs
def look_up(word):
url = 'http://dict.youdao.com/search?q='
text = urlopen(url+word).read()
soup = bs(text)
ph = soup.find('div', {'class': 'baav'}).get_text()
mean = soup.find('div', {'class': 'trans-container'})... | #!/usr/bin/env python
from urllib import urlopen
from bs4 import BeautifulSoup as bs
def look_up(word):
url = 'http://dict.youdao.com/search?q='
text = urlopen(url+word).read()
soup = bs(text)
return soup.find('div', {'class': 'trans-container'}).find('ul').get_text()
def run(prompt='> '):
print ... | mit | Python |
567185b33a99074cbacba85edf8491790952baf4 | make Hosts and HostsEntry available from package level. | jonhadfield/python-hosts | hosts/__init__.py | hosts/__init__.py | # -*- coding: utf-8 -*-
from hosts import Hosts, HostsEntry
| # -*- coding: utf-8 -*-
| mit | Python |
941608a665d061bd3c939b343968b2501e2f5fe0 | Remove denorm items task | openbudgets/openbudgets,moshe742/openbudgets,pwalsh/openbudgets,shaib/openbudgets,openbudgets/openbudgets,shaib/openbudgets,pwalsh/openbudgets,openbudgets/openbudgets,moshe742/openbudgets,pwalsh/openbudgets | openbudget/apps/transport/tasks.py | openbudget/apps/transport/tasks.py | from django.conf import settings
from django.core.mail import send_mail
from django.utils.translation import ugettext as _
from celery.task import task
from openbudget.apps.transport.incoming.parsers import get_parser
@task(name='tasks.save_import')
def save_import(deferred, email):
from openbudget.apps.transpor... | from django.conf import settings
from django.core.mail import send_mail
from django.utils.translation import ugettext as _
from celery.task import task
from openbudget.apps.transport.incoming.parsers import get_parser
@task(name='tasks.denormalize_sheet')
def denormalize_sheet(sheet_id):
from openbudget.apps.shee... | bsd-3-clause | Python |
c6502d01ebd49efde815c5481126af500d7dd7cf | Update test_availing_service_form_ucr.py | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/icds_reports/ucr/tests/test_availing_service_form_ucr.py | custom/icds_reports/ucr/tests/test_availing_service_form_ucr.py | import datetime
from mock import patch
from custom.icds_reports.ucr.tests.test_base_form_ucr import BaseFormsTest
@patch('custom.icds_reports.ucr.expressions._get_user_location_id',
lambda user_id: 'qwe56poiuytr4xcvbnmkjfghwerffdaa')
@patch('corehq.apps.locations.ucr_expressions._get_location_type_name',
... | import datetime
from mock import patch
from custom.icds_reports.ucr.tests.test_base_form_ucr import BaseFormsTest
@patch('custom.icds_reports.ucr.expressions._get_user_location_id',
lambda user_id: 'qwe56poiuytr4xcvbnmkjfghwerffdaa')
@patch('corehq.apps.locations.ucr_expressions._get_location_type_name',
... | bsd-3-clause | Python |
de3c824915f8d4962466d7a246f45fa7a0647896 | Add travis helpers | OCA/maintainer-quality-tools,Ehtaga/maintainer-quality-tools,ERP-Ukraine/maintainer-quality-tools,OCA/maintainer-quality-tools,kittiu/maintainer-quality-tools,yvaucher/maintainer-quality-tools,Endika/maintainer-quality-tools,suvit/maintainer-quality-tools,OCA/maintainer-quality-tools,ERP-Ukraine/maintainer-quality-tool... | travis/travis_helpers.py | travis/travis_helpers.py | # coding: utf-8
"""
helpers shared by the various QA tools
"""
RED = "\033[1;31m"
GREEN = "\033[1;32m"
YELLOW = "\033[1;33m"
YELLOW_LIGHT = "\033[33m"
CLEAR = "\033[0;m"
def green(string):
return GREEN + string + CLEAR
def yellow(string):
return YELLOW + string + CLEAR
def red(string):
return RED + ... | # coding: utf-8
"""
helpers shared by the various QA tools
"""
RED = "\033[1;31m"
GREEN = "\033[1;32m"
CLEAR = "\033[0;m"
fail_msg = RED + "FAIL" + CLEAR
success_msg = GREEN + "Success" + CLEAR
| agpl-3.0 | Python |
0801907d47645d1c75e32e86a5b8bccf36bd70a1 | include application views inside application blueprint | varnish/zipnish,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/zipnish,varnish/varnish-microservice-monitor,varnish/varnish-microservice-monitor,varnish/zipnish | ui/app/public/__init__.py | ui/app/public/__init__.py | from flask import Blueprint
public = Blueprint('public', __name__)
from . import views
| from flask import Blueprint
public = Blueprint('public', __name__)
| bsd-2-clause | Python |
0d6e86c1f3fea8258642c6a6e45d4c563ea6d324 | fix settings | mrkeng/alerta,mrkeng/alerta,guardian/alerta,guardian/alerta,skob/alerta,skob/alerta,guardian/alerta,mrkeng/alerta,skob/alerta,guardian/alerta,skob/alerta,mrkeng/alerta | alerta/settings.py | alerta/settings.py | #
# ***** ALERTA SERVER DEFAULT SETTINGS -- DO NOT MODIFY THIS FILE *****
#
# To override these settings use /etc/alertad.conf or the contents of the
# configuration file set by the environment variable ALERTA_SVR_CONF_FILE.
#
# Further information on settings can be found at http://docs.alerta.io
DEBUG = False
SECRE... | #
# ***** ALERTA SERVER DEFAULT SETTINGS -- DO NOT MODIFY THIS FILE *****
#
# To override these settings use /etc/alertad.conf or the contents of the
# configuration file set by the environment variable ALERTA_SVR_CONF_FILE.
#
# Further information on settings can be found at http://docs.alerta.io
DEBUG = False
SECRE... | apache-2.0 | Python |
faee884baee3583d943e718749e56edd0021635c | Update version to 1.2.1 for release. | jakevdp/altair,ellisonbg/altair,altair-viz/altair | altair/__init__.py | altair/__init__.py | __version__ = '1.2.1'
from .v1 import *
| __version__ = '1.2.1.dev0'
from .v1 import *
| bsd-3-clause | Python |
29d2bf223e717edea776d5abde6c5895786eaab6 | Add initial solution | CubicComet/exercism-python-solutions | anagram/anagram.py | anagram/anagram.py | def detect_anagrams(s, array):
return [cand for cand in array if is_anagram(cand, s)]
def is_anagram(s1, s2):
s1 = s1.lower()
s2 = s2.lower()
return s1 != s2 and sorted(s1) == sorted(s2)
| def detect_anagrams(string, array):
pass
| agpl-3.0 | Python |
dbf2afd3519adbb5f73489ce5cca1f1f295563ab | Increment to version 0.3.0 | beiko-lab/ananke | ananke/__init__.py | ananke/__init__.py | #!/usr/bin/env python
import sys
__version__ = "0.3.0"
| #!/usr/bin/env python
import sys
__version__ = "0.2.1"
| mit | Python |
5c4bfcc3ccb79b1d0c481914db9ed22e4f5baf2b | Add more unit tests | Videonauth/passgen | test_passgen.py | test_passgen.py | #!/usr/bin/env python3
import argparse
from passgen import make_parser, sanitize_input
import unittest
class PassGenTestCase(unittest.TestCase):
def setUp(self):
self.parse_args = make_parser().parse_args
def test_duplicate_flags(self):
with self.assertRaises(ValueError):
for du... | #!/usr/bin/env python3
import argparse
from passgen import make_parser, sanitize_input
import unittest
class PassGenTestCase(unittest.TestCase):
def setUp(self):
self.parse_args = make_parser().parse_args
def test_duplicate_flags(self):
for duplicate_flag in ['dd', 'll', 'uu', 'pp', 'ss']:
... | mit | Python |
832aef5fc7dd6d8ebfb313f45d42cbd6654fe248 | add tests to ensure expected exceptions are triggered | alubbock/pysb,johnbachman/pysb,alubbock/pysb-legacy,spgarbet/pysb,LoLab-VU/pysb,neurord/pysb,jmuhlich/pysb,alubbock/pysb-legacy,johnbachman/pysb,neurord/pysb,alubbock/pysb-legacy,neurord/pysb,d-fan/pysb,alubbock/pysb-legacy,spgarbet/pysb,pysb/pysb,d-fan/pysb,d-fan/pysb,spgarbet/pysb,LoLab-VU/pysb | test_pymodel.py | test_pymodel.py | from Pysb import *
egf = Monomer('egf', 'L')
egfr = Monomer('egfr', ['R', 'D', 'C'])
mp1 = egf.m(L=None)
mp2 = egfr.m(R=None)
mp3 = egfr.m(R=egf, D=[egfr,egfr], C=None)
egfr.m(R=1)
print egf
print egfr
print
print mp1
print mp2
print mp3
print "\ntesting error checking..."
fail = False
try:
Monomer('M', ['a',... | from Pysb import *
egf = Monomer('egf', ['L'])
egfr = Monomer('egfr', ['R', 'D', 'C'])
mp1 = egf.m(L=None)
mp2 = egfr.m(R=None)
mp3 = egfr.m(R=egf, D=egfr, C=None)
print egf
print egfr
print
print mp1
print mp2
print mp3
| bsd-2-clause | Python |
4be0cbe203039de1853d7856c292932cade8eabf | change debug log | ZhangBohan/KoalaAPI,ZhangBohan/KoalaAPI,ZhangBohan/KoalaAPI | KoalaAPI/views/auth.py | KoalaAPI/views/auth.py | from . import main_view
from flask import render_template, request, abort, current_app, redirect, url_for, session
from leancloud import User, LeanCloudError
import requests
__author__ = 'bohan'
@main_view.route('/auth/login')
def login():
return render_template('login.html')
@main_view.route('/auth/logout')
d... | from . import main_view
from flask import render_template, request, abort, current_app, redirect, url_for, session
from leancloud import User, LeanCloudError
import requests
__author__ = 'bohan'
@main_view.route('/auth/login')
def login():
return render_template('login.html')
@main_view.route('/auth/logout')
d... | mit | Python |
95d6a6680099482213bcff82dcffe5ebe2ec1767 | add 'continous' column to csv export | gooofy/zamia-ai,gooofy/zamia-ai | audio-export-csv.py | audio-export-csv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013, 2014 Guenter Bartsch
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013, 2014 Guenter Bartsch
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | apache-2.0 | Python |
061f95ac85500c0a532acd4b2abf0a4fc0ba29b1 | Add Boost.System to setup.py. | kmdouglass/Micro-Manager,kmdouglass/Micro-Manager | MMCorePy_wrap/setup.py | MMCorePy_wrap/setup.py | #!/usr/bin/env python
"""
This setup.py is intended for use from the Autoconf/Automake build system.
It makes a number of assumtions, including that the SWIG sources have already
been generated. Yet it also ignores settings detected by the configure script -
so it should probably be replaced with rules in the Makefile... | #!/usr/bin/env python
"""
This setup.py is intended for use from the Autoconf/Automake build system.
It makes a number of assumtions, including that the SWIG sources have already
been generated.
"""
from distutils.core import setup, Extension
import numpy.distutils.misc_util
import os
os.environ['CC'] = 'g++'
#os.en... | mit | Python |
1786e00df3a6cd43a0e01964f67b16bfd282861e | fix spelling of kaleidoscope | amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint | proselint/checks/garner/mondegreens.py | proselint/checks/garner/mondegreens.py | # -*- coding: utf-8 -*-
"""Mondegreens.
---
layout: post
source: Garner's Modern American Usage
source_url: http://bit.ly/1T4alrY
title: mondegreens
date: 2014-06-10 12:31:19
categories: writing
---
Points out preferred form.
"""
from proselint.tools import memoize, preferred_forms_check
@memoiz... | # -*- coding: utf-8 -*-
"""Mondegreens.
---
layout: post
source: Garner's Modern American Usage
source_url: http://bit.ly/1T4alrY
title: mondegreens
date: 2014-06-10 12:31:19
categories: writing
---
Points out preferred form.
"""
from proselint.tools import memoize, preferred_forms_check
@memoiz... | bsd-3-clause | Python |
251e795fde5f60affd9718faa43b7c3939ebb445 | Update P2_decryptPDFparanoia.py added docstring and wrapped in main function | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | pythontutorials/books/AutomateTheBoringStuff/Ch13/Projects/P2_decryptPDFparanoia.py | pythontutorials/books/AutomateTheBoringStuff/Ch13/Projects/P2_decryptPDFparanoia.py | """Decrypt PDF paranoia
Write a program that finds all encrypted PDFs in a folder (and its subfolders)
and creates a decrypted copy of the PDF using a provided password. If the
password is incorrect, the program should print a message to the user and
continue to the next PDF.
Note:
* Default input folder is paren... | # Write a program that finds all encrypted PDFs in a folder (and its subfolders)
# and creates a decrypted copy of the PDF using a provided password. If the
# password is incorrect, the program should print a message to the user and
# continue to the next PDF.
import PyPDF4, os
from PyPDF4.utils import PdfReadError
F... | mit | Python |
00ea1020d8ee7e62f510600e1e7cd522b51e3ded | clean up | chimney37/ml-snippets,chimney37/ml-snippets | cust_regress.py | cust_regress.py | # coding:utf-8
import numpy as np
import matplotlib.pyplot as plt
import random
from statistics import mean
from matplotlib import style
style.use('ggplot')
xs = np.array([1,2,3,4,5], dtype=np.float64)
ys = np.array([5,4,6,5,6], dtype=np.float64)
# regression model
def best_fit_slope_and_intercept(xs, ys):
m = ... | # coding:utf-8
import numpy as np
import matplotlib.pyplot as plt
import random
from statistics import mean
from matplotlib import style
style.use('ggplot')
xs = np.array([1,2,3,4,5], dtype=np.float64)
ys = np.array([5,4,6,5,6], dtype=np.float64)
# regression model
def best_fit_slope_and_intercept(xs, ys):
m = ... | mit | Python |
6edee9feaa45c25a92ea2651d055ffd9ad1466c9 | add additional dirent flag checks | reneme/python-cvmfsutils,reneme/python-cvmfsutils | cvmfs/dirent.py | cvmfs/dirent.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by René Meusel
This file is part of the CernVM File System auxiliary tools.
"""
class _Flags:
""" Definition of used dirent flags (see cvmfs/catalog_sql.h) """
Directory = 1
NestedCatalogMountpoint = 2
NestedCatalogRoot = 32
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by René Meusel
This file is part of the CernVM File System auxiliary tools.
"""
class DirectoryEntry:
""" Thin wrapper around a DirectoryEntry as it is saved in the Catalogs """
def __init__(self):
self.md5path_1 = 0
self.md5path_2 = 0... | bsd-3-clause | Python |
6cc1040f490ed6184507c90e6f40399203aad867 | add integration test description | ooici/marine-integrations | sa/data_acquisition_management/test/test_int_data_acquisition_management_service.py | sa/data_acquisition_management/test/test_int_data_acquisition_management_service.py | #!/usr/bin/env python
'''
@file ion/services/sa/instrument_management/test/test_int_data_acquisition_management_service.py
@author Maurice Manning
@test ion.services.sa.data_acquisition_management.DataAcquisitionManagementService integration test
'''
from nose.plugins.attrib import attr
from pyon.util.int_test import... | #!/usr/bin/env python
'''
@file ion/services/sa/instrument_management/test/test_int_data_acquisition_management_service.py
@author Maurice Manning
@test ion.services.sa.data_acquisition_management.DataAcquisitionManagementService integration test
'''
from nose.plugins.attrib import attr
from pyon.util.int_test import... | bsd-2-clause | Python |
d2caecba08d4e9961dc38074a4e1b4881f990808 | Update latitude sample. | google/oauth2client,googleapis/oauth2client,googleapis/google-api-python-client,jonparrott/oauth2client,clancychilds/oauth2client,googleapis/oauth2client,google/oauth2client,googleapis/google-api-python-client,jonparrott/oauth2client,clancychilds/oauth2client | samples/latitude/latitude.py | samples/latitude/latitude.py | #!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Google 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 ... | #!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Google 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 ... | apache-2.0 | Python |
d9ef3c899777e2fda7a355c5cde78beded1dc723 | delete contributors tag and update authors in manifest file | Eficent/purchase-workflow,Eficent/purchase-workflow | purchase_request_to_rfq/__openerp__.py | purchase_request_to_rfq/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
{
"name": "Purchase Request to RFQ",
"author": "Eficent Business and IT Consulting Services S.L., "
"Odoo Community Association (OCA)",
... | # -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
{
"name": "Purchase Request to RFQ",
"author": "Eficent,"
"Odoo Community Association (OCA)",
"version": "9.0.1.0.0",
"contributors... | agpl-3.0 | Python |
04796e0a6732739fc772572a2f279022a5a5159c | add max_digits and decimal_places to DecimalFractionFields in test model | jmichalicek/django-fractions,jmichalicek/django-fractions | tests/models.py | tests/models.py | from django.db import models
from djfractions.models import DecimalFractionField
class TestModel(models.Model):
"""
A test model to use for testing custom fields. This technique is based on core django code
such as at https://github.com/django/django/blob/stable/1.8.x/tests/field_subclassing/models.py
... | from django.db import models
from djfractions.models import DecimalFractionField
class TestModel(models.Model):
"""
A test model to use for testing custom fields. This technique is based on core django code
such as at https://github.com/django/django/blob/stable/1.8.x/tests/field_subclassing/models.py
... | bsd-3-clause | Python |
8633b82b5d62f572b10cd8e2ecce8563630a7820 | remove num of authentications | lmzintgraf/MultiMAuS | authenticators/abstract_authenticator.py | authenticators/abstract_authenticator.py | from abc import ABCMeta, abstractmethod
class AbstractAuthenticator(metaclass=ABCMeta):
@abstractmethod
def authorise_transaction(self, customer):
"""
Decide whether to authorise transaction.
Note that all relevant information can be obtained from the customer.
:param customer... | from abc import ABCMeta, abstractmethod
class AbstractAuthenticator(metaclass=ABCMeta):
@abstractmethod
def authorise_transaction(self, model, customer):
"""
Decide whether to authorise transaction.
Note that all relevant information can be obtained from the customer.
:param c... | mit | Python |
8ed4d09a9e0c0e16f179185cd3d0e6f2dece360d | Fix for rerunning intro tutorial on previously used database. | HazyResearch/snorkel,HazyResearch/snorkel,jasontlam/snorkel,jasontlam/snorkel,jasontlam/snorkel,HazyResearch/snorkel | tutorials/intro/utils.py | tutorials/intro/utils.py | from snorkel.models import Span, Label
from sqlalchemy.orm.exc import NoResultFound
def add_spouse_label(session, key, cls, person1, person2, value):
try:
person1 = session.query(Span).filter(Span.stable_id == person1).one()
person2 = session.query(Span).filter(Span.stable_id == person2).one()
... | from snorkel.models import Span, Label
from sqlalchemy.orm.exc import NoResultFound
def add_spouse_label(session, key, cls, person1, person2, value):
try:
person1 = session.query(Span).filter(Span.stable_id == person1).one()
person2 = session.query(Span).filter(Span.stable_id == person2).one()
... | apache-2.0 | Python |
23c29c4964286fc2ca8fb3a957a6e7810edb9d17 | Fix AttributeError: 'AnonymousUser' object has no attribute 'membership_set' | Inter-Actief/alexia,Inter-Actief/alexia,Inter-Actief/alexia,Inter-Actief/alexia | alexia/template/context_processors.py | alexia/template/context_processors.py | from __future__ import unicode_literals
from alexia.apps.organization.models import Organization
def organization(request):
return {
'organizations': Organization.objects.all(),
'current_organization': request.organization,
}
def permissions(request):
if request.user.is_superuser:
... | from __future__ import unicode_literals
from alexia.apps.organization.models import Organization
def organization(request):
return {
'organizations': Organization.objects.all(),
'current_organization': request.organization,
}
def permissions(request):
if request.user.is_superuser:
... | bsd-3-clause | Python |
178d3f60124f6ad02c8c1f4daf99ad3d7b06ac06 | Complete morse dictionary | OiNutter/microbit-scripts | morse/morse.py | morse/morse.py | # Import modules
from microbit import *
# define morse code dictionary
morse = {
"a": ".-",
"b": "-...",
"c": "-.-.",
"d": "-..",
"e": ".",
"f": "..-.",
"g": "--.",
"h": "....",
"i": "..",
"j": ".---",
"k": "-.-",
"l": ".-..",
"m": "--",
"n": "-.",
"o": "---"... | # Import modules
from microbit import *
# define morse code dictionary
morse = {
"a": ".-",
"b": "-...",
"c": "-.-.",
"d": "-..",
"e": ".",
"f": "..-.",
"s": "...",
"o": "---",
"m": "--",
"1": ".----",
"2": "..---",
"3": ".... | mit | Python |
bc5223619535e78254c6fe6dce1b1f756045889f | fix tests | rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,rdmorganiser/rdmo | apps/core/testing/mixins.py | apps/core/testing/mixins.py | from django.core.urlresolvers import reverse
from django.core.management import call_command
from django.utils.six import StringIO
from test_generator.core import TestMixin
class TestExportViewMixin(TestMixin):
export_formats = ('xml', 'html', 'rtf')
def _test_export_list(self, username):
for form... | from django.core.urlresolvers import reverse
from django.core.management import call_command
from django.utils.six import StringIO
from test_mixins.core import TestMixin
class TestExportViewMixin(TestMixin):
export_formats = ('xml', 'html', 'rtf')
def _test_export_list(self, username):
for format ... | apache-2.0 | Python |
7eac0ef1a0858c14d7ebbf2d33f4c20143b75688 | move periods parameter out of _mavg | dschmaryl/golf-flask,dschmaryl/golf-flask,dschmaryl/golf-flask | app/models/user.py | app/models/user.py | from app import bcrypt, db
from pandas import Series
from .golf_round import GolfRound
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column('username', db.String(32), unique=True, index=True)
password = db.Column('password', db.Binary(128))
default_tees = db.Colum... | from app import bcrypt, db
from pandas import Series
from .golf_round import GolfRound
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column('username', db.String(32), unique=True, index=True)
password = db.Column('password', db.Binary(128))
default_tees = db.Colum... | mit | Python |
8b78425315e11b2af880b0529df05eaba924f1d0 | Update the ProfileFactory to assign a fb_id | sbuss/voteswap,sbuss/voteswap,sbuss/voteswap,sbuss/voteswap | users/tests/factories.py | users/tests/factories.py | import random
from django.contrib.auth import get_user_model
import factory
from social.apps.django_app.default.models import UserSocialAuth
from polling.models import CANDIDATES_ADVOCATED
from polling.models import STATES
from users.models import Profile
class ProfileFactory(factory.DjangoModelFactory):
class ... | import random
from django.contrib.auth import get_user_model
import factory
from social.apps.django_app.default.models import UserSocialAuth
from polling.models import CANDIDATES_ADVOCATED
from polling.models import STATES
from users.models import Profile
class ProfileFactory(factory.DjangoModelFactory):
class ... | mit | Python |
e6ac4f746cd8094243050651e70d71a89f58dca7 | Test providing a non-existant directory as a exclude-dir | kgrandis/nose-exclude,mat128/nose-exclude | tests.py | tests.py | import os
import unittest
from nose.plugins import PluginTester
from nose_exclude import NoseExclude
class TestNoseExcludeDirs_Relative_Args(PluginTester, unittest.TestCase):
"""Test nose-exclude directories using relative paths passed
on the commandline via --exclude-dir
"""
activate = "--exclude-dir... | import os
import unittest
from nose.plugins import PluginTester
from nose_exclude import NoseExclude
class TestNoseExcludeDirs_Relative_Args(PluginTester, unittest.TestCase):
"""Test nose-exclude directories using relative paths passed
on the commandline via --exclude-dir
"""
activate = "--exclude-dir... | lgpl-2.1 | Python |
41923e40ac6c982e90eef14c64ffd139f6492a26 | Remove bad param from import calls | ni/nixnet-python,epage/nixnet-python | nixnet/_lib.py | nixnet/_lib.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import ctypes
import sys
from nixnet import errors
class PlatformUnsupportedError(errors.Error):
def __init__(self, platform):
message = '{0} is unsuppor... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import ctypes
import sys
from nixnet import errors
class PlatformUnsupportedError(errors.Error):
def __init__(self, platform):
message = '{0} is unsuppor... | mit | Python |
cca1b6bfc66023233de3e05c65bddbf445bf8c4f | add exception name | legnaleurc/wcpan.worker | wcpan/worker/__init__.py | wcpan/worker/__init__.py | from .worker import AsyncWorker, WorkerError
from .pool import AsyncWorkerPool
from .task import Task
| from .worker import AsyncWorker
from .pool import AsyncWorkerPool
from .task import Task
| mit | Python |
c010bef91e079660332160f50c9e16c1c88f9654 | Add Elena-Irina to admins | bazelbuild/continuous-integration,bazelbuild/continuous-integration,bazelbuild/continuous-integration,bazelbuild/continuous-integration,bazelbuild/continuous-integration,bazelbuild/continuous-integration,bazelbuild/continuous-integration,bazelbuild/continuous-integration | jenkins/config.bzl | jenkins/config.bzl | ADMIN_USERS = [
"dmarting@google.com",
"dslomov@google.com",
"kchodorow@google.com",
"laszlocsomor@google.com",
"lberki@google.com",
"pcloudy@google.com",
"yueg@google.com",
"jcater@google.com",
"aehlig@google.com",
"elenairina@google.com",
]
| ADMIN_USERS = [
"dmarting@google.com",
"dslomov@google.com",
"kchodorow@google.com",
"laszlocsomor@google.com",
"lberki@google.com",
"pcloudy@google.com",
"yueg@google.com",
"jcater@google.com",
"aehlig@google.com",
]
| apache-2.0 | Python |
540bffe17ede75bc6afd9b2d45e343e0eac4552b | Add an exception based version | CubicComet/exercism-python-solutions | rna-transcription/rna_transcription.py | rna-transcription/rna_transcription.py | TRANS = {"G": "C", "C":"G", "T":"A", "A":"U"}
def to_rna(dna):
try:
return "".join([TRANS[n] for n in dna])
except KeyError:
return ""
# Old version: it's slightly slower for valid DNA, but slightly faster for invalid DNA
DNA = {"A", "C", "T", "G"}
TRANS = {"G": "C", "C":"G", "T":"A", "A":"... | DNA = {"A", "C", "T", "G"}
TRANS = {"G": "C", "C":"G", "T":"A", "A":"U"}
def to_rna(dna):
# Check validity - `difference` returns elements in dna not in DNA
if set(dna).difference(DNA):
return ""
return "".join([TRANS[n] for n in dna])
| agpl-3.0 | Python |
e69a9fd2376b52259a54463487858d0f2307e94b | Make filename optional positional arg | gregoiresage/pebble-tool,pebble/pebble-tool,pebble/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool,pebble/pebble-tool | pebble_tool/commands/screenshot.py | pebble_tool/commands/screenshot.py | from __future__ import absolute_import, print_function
__author__ = 'katharine'
import datetime
import png
import os.path
from progressbar import ProgressBar, Bar, ReverseBar, FileTransferSpeed, Timer, Percentage
import subprocess
import sys
from libpebble2.services.screenshot import Screenshot
from .base import Bas... | from __future__ import absolute_import, print_function
__author__ = 'katharine'
import datetime
import png
import os.path
from progressbar import ProgressBar, Bar, ReverseBar, FileTransferSpeed, Timer, Percentage
import subprocess
import sys
from libpebble2.services.screenshot import Screenshot
from .base import Bas... | mit | Python |
451d79f5bc55d228eb20bb0672480373dfeeb29d | Fix mappings for risk objects | kr41/ggrc-core,AleksNeStu/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,hasanalom/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,AleksNeStu/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core,prasannav7/ggrc-core,AleksNeStu/ggrc-core,jmakov/ggrc-core,AleksNeStu/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-... | src/ggrc_risk_assessment_v2/models/risk.py | src/ggrc_risk_assessment_v2/models/risk.py | # Copyright (C) 2014 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: silas@reciprocitylabs.com
# Maintained By: silas@reciprocitylabs.com
from sqlalchemy.ext.declarative import declared_attr
from ggrc import db
from... | # Copyright (C) 2014 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: silas@reciprocitylabs.com
# Maintained By: silas@reciprocitylabs.com
from sqlalchemy.ext.declarative import declared_attr
from ggrc import db
from... | apache-2.0 | Python |
b7b67a0327feddc977a404178aae03e47947dd20 | Make it possible to send a page_size parameter to all paged endpoints. | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/bluebottle_drf2/pagination.py | bluebottle/bluebottle_drf2/pagination.py | from rest_framework.pagination import PageNumberPagination
class BluebottlePagination(PageNumberPagination):
page_size = 10
page_size_query_param = 'page_size'
| from rest_framework.pagination import PageNumberPagination
class BluebottlePagination(PageNumberPagination):
page_size = 10
| bsd-3-clause | Python |
0d16bb71ae5a51bf36495d50b94924f22584c6ee | Add new fields to factories | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/time_based/tests/factories.py | bluebottle/time_based/tests/factories.py | from datetime import timedelta
import factory.fuzzy
from django.utils.timezone import now
from bluebottle.time_based.models import OnADateActivity, WithADeadlineActivity, OngoingActivity
from bluebottle.initiatives.tests.factories import InitiativeFactory
from bluebottle.test.factory_models.accounts import BlueBottle... | from datetime import timedelta
import factory.fuzzy
from django.utils.timezone import now
from bluebottle.time_based.models import OnADateActivity, WithADeadlineActivity, OngoingActivity
from bluebottle.initiatives.tests.factories import InitiativeFactory
from bluebottle.test.factory_models.accounts import BlueBottle... | bsd-3-clause | Python |
b080656866603ebf4020ea2b49618cc29533a77b | Set DEBUG to False | ardinor/mojibake,ardinor/mojibake,ardinor/mojibake | mojibake/settings.py | mojibake/settings.py | # -*- coding: utf-8 -*-
import os
VERSION = 1.0
PORT = 8000
LOGGER_NAME = 'mojibake'
DEBUG = False
POSTS_PER_PAGE = 3
# Assumes the app is located in the same directory
# where this file resides
APP_DIR = os.path.dirname(os.path.abspath(__file__))
LOG_DIR = '/opt/mojibake/logs/current'
LANGUAGES = {
'en': ... | # -*- coding: utf-8 -*-
import os
VERSION = 1.0
PORT = 8000
LOGGER_NAME = 'mojibake'
DEBUG = True
POSTS_PER_PAGE = 3
# Assumes the app is located in the same directory
# where this file resides
APP_DIR = os.path.dirname(os.path.abspath(__file__))
LOG_DIR = '/opt/mojibake/logs/current'
LANGUAGES = {
'en': '... | mit | Python |
d4485df463ed8b12d02719b21c73b172d3c2614c | Fix get_url () using unicode/replace bug | makhidkarun/traveller_pyroute | PyRoute/downloadsec.py | PyRoute/downloadsec.py | '''
Created on Jun 3, 2014
@author: tjoneslo
'''
import urllib2
import urllib
import codecs
import string
import time
import os
import argparse
def get_url (url, sector, suffix):
f = urllib2.urlopen(url)
encoding=f.headers['content-type'].split('charset=')[-1]
content = f.read()
if encoding == 't... | '''
Created on Jun 3, 2014
@author: tjoneslo
'''
import urllib2
import urllib
import codecs
import string
import time
import os
import argparse
def get_url (url, sector, suffix):
f = urllib2.urlopen(url)
encoding=f.headers['content-type'].split('charset=')[-1]
content = f.read()
if encoding == 't... | mit | Python |
4c55ed0e2fd2addb7e5f594664da42fe332a8906 | Update import. | eyalev/jsonapp | jsonapp/jsonapp_cli.py | jsonapp/jsonapp_cli.py | # -*- coding: utf-8 -*-
import click
from jsonapp.core.jsonapp_main import json_app, user_output, script_output
@click.group()
def cli():
pass
@cli.command('format')
@click.option('--clipboard', is_flag=True, default=False,
help='Get JSON input from clipboard. Set formatted JSON result to clipboa... | # -*- coding: utf-8 -*-
import click
from core.jsonapp_main import json_app, user_output, script_output
@click.group()
def cli():
pass
@cli.command('format')
@click.option('--clipboard', is_flag=True, default=False,
help='Get JSON input from clipboard. Set formatted JSON result to clipboard.')
@c... | mit | Python |
8f95de6639d99e5b7329bbaff9b0c5cd12edc56a | FIX additional_b2s_translation binary field causing big database | CompassionCH/compassion-modules,CompassionCH/compassion-modules,CompassionCH/compassion-modules,CompassionCH/compassion-modules | sbc_compassion/wizards/sbc_settings.py | sbc_compassion/wizards/sbc_settings.py | ##############################################################################
#
# Copyright (C) 2019 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | ##############################################################################
#
# Copyright (C) 2019 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | agpl-3.0 | Python |
dae0bcde2e7c93d51c02d40292f2993aa35e96c4 | Remove user's avatar selection on deletion | m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps | scripts/generate_sql_to_delete_user.py | scripts/generate_sql_to_delete_user.py | #!/usr/bin/env python
"""Generate the SQL statements to remove one or more users and they
various traces from the database.
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.util.system import get_config_filename_from_env_or_exit
from _util imp... | #!/usr/bin/env python
"""Generate the SQL statements to remove one or more users and they
various traces from the database.
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.util.system import get_config_filename_from_env_or_exit
from _util imp... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.