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
ebaca4f2572d7db9d9bc912f209cd9027750b3a7
tingbot/__init__.py
tingbot/__init__.py
try: import pygame except ImportError: print 'Failed to import pygame' print '-----------------------' print '' print 'tingbot-python requires pygame. Please download and install pygame 1.9.1' print 'or later from http://www.pygame.org/download.shtml' print '' print "If you're using a vi...
try: import pygame except ImportError: print 'Failed to import pygame' print '-----------------------' print '' print 'tingbot-python requires pygame. Please download and install pygame 1.9.1' print 'or later from http://www.pygame.org/download.shtml' print '' print "If you're using a vi...
Create reference to app in module
Create reference to app in module
Python
bsd-2-clause
furbrain/tingbot-python
a7d010d591761a459320e904045140ec21670439
src/oscar/templatetags/currency_filters.py
src/oscar/templatetags/currency_filters.py
from decimal import Decimal as D from decimal import InvalidOperation from babel.numbers import format_currency from django import template from django.conf import settings from django.utils.translation import get_language, to_locale register = template.Library() @register.filter(name='currency') def currency(value...
from decimal import Decimal as D from decimal import InvalidOperation from babel.numbers import format_currency from django import template from django.conf import settings from django.utils.translation import get_language, to_locale register = template.Library() @register.filter(name='currency') def currency(value...
Support currency digits and currency suffix.
Support currency digits and currency suffix.
Python
bsd-3-clause
michaelkuty/django-oscar,michaelkuty/django-oscar,michaelkuty/django-oscar,michaelkuty/django-oscar
6dbefe8a62ae375b487c7e21340aba5b81eaeb7f
django_git/management/commands/pull_oldest.py
django_git/management/commands/pull_oldest.py
import os import traceback from django.utils import timezone from django_git.management.commands.git_pull_utils.git_folder_enum import enum_git_repo from django_git.management.commands.git_pull_utils.git_synchronizer import GitSynchronizer from djangoautoconf.cmd_handler_base.msg_process_cmd_base import DjangoCmdBase...
import os import traceback from django.utils import timezone from django_git.management.commands.git_pull_utils.git_folder_enum import enum_git_repo from django_git.management.commands.git_pull_utils.git_synchronizer import GitSynchronizer from djangoautoconf.cmd_handler_base.msg_process_cmd_base import DjangoCmdBase...
Print message for pull success.
Print message for pull success.
Python
bsd-3-clause
weijia/django-git,weijia/django-git
fcf52a1d427d2e89031480f747374860f64c45ff
constant_listener/pyspeechTest.py
constant_listener/pyspeechTest.py
from pyspeech import best_speech_result import unittest from pyaudio import PyAudio import Queue class PyspeechTest(unittest.TestCase): def setUp(self): self.p = PyAudio() def test_google_stt(self): good_morning = open('example_wavs/good_morning.wav', 'rb') output = best_speech_result(self.p, good_mor...
from pyspeech import best_speech_result import unittest from pyaudio import PyAudio import Queue class PyspeechTest(unittest.TestCase): def setUp(self): self.p = PyAudio() def test_google_stt(self): good_morning = open('example_wavs/good_morning.wav', 'rb') output = best_speech_result(self.p, good_mor...
Add tests for Wit STT
Add tests for Wit STT
Python
mit
MattWis/constant_listener
5a1edb15cac470f392ccb4447b81cc99e8af2a68
robinette/server.py
robinette/server.py
#!/usr/bin/env python from irc import irc from xmlrpc.server import AsyncXMLRPCServer if __name__ == '__main__': server = AsyncXMLRPCServer(('localhost', 8000), allow_none=True) server.add_handler(irc) try: server.serve_forever() except KeyboardInterrupt: print 'Exiting'
#!/usr/bin/env python from irc import irc from xmlrpc.server import AsyncXMLRPCServer if __name__ == '__main__': server = AsyncXMLRPCServer(('localhost', 8000), allow_none=True) server.add_handler(irc) print 'Running on %s:%s' % map(str, server.server_address) try: server.serve_forever() ...
Print where we're running at
Print where we're running at
Python
mit
mgracik/robinette
bd78472c14ce9ed487a563a958082b356e0b7c79
src/epiweb/apps/reminder/admin.py
src/epiweb/apps/reminder/admin.py
from django.contrib import admin from epiweb.apps.reminder.models import Reminder class ReminderAdmin(admin.ModelAdmin): list_display = ('user', 'wday', 'active', 'last_reminder', 'next_reminder') admin.site.register(Reminder, ReminderAdmin)
from django.contrib import admin from epiweb.apps.reminder.models import Reminder def make_active(modeladmin, request, queryset): queryset.update(active=True) make_active.short_description = 'Make selected reminders active' def make_inactive(modeladmin, request, queryset): queryset.update(active=False) make_...
Add actions to make reminders active or inactive
Add actions to make reminders active or inactive
Python
agpl-3.0
ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website
65428583f066c887d99f885a4fc516f6a5f83f17
src/livestreamer/plugins/rtlxl.py
src/livestreamer/plugins/rtlxl.py
import re from livestreamer.plugin import Plugin from livestreamer.plugin.api import http, validate from livestreamer.stream import HDSStream, HLSStream, RTMPStream _url_re = re.compile("""http(?:s)?://(?:\w+\.)?rtlxl.nl/#!/(?:.*)/(?P<uuid>.*?)\Z""", re.IGNORECASE) class rtlxl(Plugin): @classmethod ...
import re from livestreamer.plugin import Plugin from livestreamer.plugin.api import http, validate from livestreamer.stream import HDSStream, HLSStream, RTMPStream _url_re = re.compile("""http(?:s)?://(?:\w+\.)?rtlxl.nl/#!/(?:.*)/(?P<uuid>.*?)\Z""", re.IGNORECASE) class rtlxl(Plugin): @classmethod ...
Remove spurious print statement that made the plugin incompatible with python 3.
Remove spurious print statement that made the plugin incompatible with python 3.
Python
bsd-2-clause
sbstp/streamlink,mmetak/streamlink,wlerin/streamlink,sbstp/streamlink,bastimeyer/streamlink,chhe/streamlink,ethanhlc/streamlink,gravyboat/streamlink,back-to/streamlink,mmetak/streamlink,streamlink/streamlink,fishscene/streamlink,back-to/streamlink,melmorabity/streamlink,gravyboat/streamlink,fishscene/streamlink,chhe/st...
9be7deeaf400858dc00118d274b4cf4d19c60858
stdnum/cr/__init__.py
stdnum/cr/__init__.py
# __init__.py - collection of Costa Rican numbers # coding: utf-8 # # Copyright (C) 2019 Leandro Regueiro # # This library 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 2.1 of the Lic...
# __init__.py - collection of Costa Rican numbers # coding: utf-8 # # Copyright (C) 2019 Leandro Regueiro # # This library 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 2.1 of the Lic...
Add missing vat alias for Costa Rica
Add missing vat alias for Costa Rica
Python
lgpl-2.1
arthurdejong/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum
12c2c7f20e46dce54990d5cf4c0e51ab02d549c4
adder/__init__.py
adder/__init__.py
"""adder is an amazing module which adds things""" def add(first, second): """The power of add is that it adds its arguments""" return first + second
"""A mighty module to add things to each other""" def add(first, second): """The power of add is that it adds its arguments""" return first + second
Make the docstring match the github description
Make the docstring match the github description
Python
mit
jamesmcdonald/adder
cfeaf5b01b6c822b2351a556e48a1a68aa2bce88
glue_vispy_viewers/volume/tests/test_glue_viewer.py
glue_vispy_viewers/volume/tests/test_glue_viewer.py
import operator import numpy as np from glue.qt import get_qapp from glue.core.data import Data from glue.core.data_collection import DataCollection from glue.app.qt.application import GlueApplication from glue.core.subset import InequalitySubsetState # from glue.core.tests.util import simple_session from ..vol_glue_vi...
import operator import numpy as np from glue.qt import get_qapp from glue.core.data import Data from glue.core.data_collection import DataCollection try: from glue.app.qt.application import GlueApplication except: from glue.qt.glue_application import GlueApplication from glue.core.subset import InequalitySubs...
Fix compatibility with latest stable glue version
Fix compatibility with latest stable glue version
Python
bsd-2-clause
PennyQ/astro-vispy,PennyQ/glue-3d-viewer,astrofrog/glue-vispy-viewers,glue-viz/glue-3d-viewer,glue-viz/glue-vispy-viewers,astrofrog/glue-3d-viewer
b5bfa67c87c7043f521cde32e7212c0fffdbacd9
Solutions/problem67.py
Solutions/problem67.py
# Project Euler Problem 67 # Created on: 2012-06-18 # Created by: William McDonald def importTri(): t = [] f = open("problem67.txt") for line in f: t.append(map(int, line.split(" "))) return t def getMax(lm, cur): l = len(cur) - 1 maxL = [lm[0] + cur[0]] i = 1 wh...
# Project Euler Problem 67 def import_triangle(): with open('problem67.txt') as f: # Split each line by spaces and convert to integers return [list(map(int, line.split(' '))) for line in f] # The max of this row is the maximum sum up to its parent items plus the value # in this row. But no...
Update problem 67 to be legible
Update problem 67 to be legible
Python
mit
WalrusCow/euler
715987e85b61807a7ba5a3ae8ead8a44fff425cb
src/sentry/tasks/base.py
src/sentry/tasks/base.py
""" sentry.tasks.base ~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from celery.task import current from functools import wraps from sentry.celery import app from sentry.utils impor...
""" sentry.tasks.base ~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from celery.task import current from raven.contrib.django.models import client as Raven from functools import wrap...
Clear context for celery tasks
Clear context for celery tasks
Python
bsd-3-clause
jean/sentry,ifduyue/sentry,mitsuhiko/sentry,gencer/sentry,mvaled/sentry,jean/sentry,zenefits/sentry,alexm92/sentry,looker/sentry,fotinakis/sentry,jean/sentry,beeftornado/sentry,beeftornado/sentry,looker/sentry,daevaorn/sentry,JamesMura/sentry,alexm92/sentry,JackDanger/sentry,ifduyue/sentry,JackDanger/sentry,looker/sent...
ac11d7e7f90a2ee6a240be5fd95093f98c7d42dc
db/create_db.py
db/create_db.py
from models import Base, engine, MetricType from sqlalchemy.orm import Session import uuid import os # Create all tables in the engine. This is equivalent to "Create Table" # statements in raw SQL. Base.metadata.create_all(engine) session = Session(engine) def initialize_metric_types(): metric_types = [None] * 2...
from models import Base, engine, MetricType from sqlalchemy.orm import Session import uuid import os try: os.remove('station_db.db') except Exception as ex: pass # Create all tables in the engine. This is equivalent to "Create Table" # statements in raw SQL. Base.metadata.create_all(engine) session = Session...
Fix for lack of file.
Fix for lack of file. Signed-off-by: Maciej Szankin <33c1fdf481c8e628d4c6db7ea8dc77f49f2fa5d7@szankin.pl>
Python
mit
joannarozes/ddb,joannarozes/ddb,joannarozes/ddb,joannarozes/ddb
6dbb40b2ca23d90b439fb08a2931b6a43b6c9e61
update.py
update.py
import os os.system("git add *") os.system("git commit -m 'first commit'") os.system("git push origin master")
import os print "Enter commit message:" commit = raw_input(); os.system("git add *") os.system("git commit -m '"+commit+"'") os.system("git push origin master")
Set up git push script. ;)
Set up git push script. ;)
Python
mit
connornishijima/electropi2,connornishijima/electropi2
62e4f4b8262c78a20c26de7b9b23a89d2c2e1e90
examples/wsgi_app.py
examples/wsgi_app.py
import guv guv.monkey_patch() import guv.wsgi import logger logger.configure() def app(environ, start_response): status = '200 OK' output = [b'Hello World!'] content_length = str(len(b''.join(output))) response_headers = [('Content-type', 'text/plain'), ('Content-Length', co...
import guv guv.monkey_patch() import guv.wsgi import logger logger.configure() def app(environ, start_response): """ This is very basic WSGI app useful for testing the performance of guv and guv.wsgi without the overhead of a framework such as Flask. However, it can just as easily be any other WSGI app ...
Add docstring to WSGI example
Add docstring to WSGI example
Python
mit
veegee/guv,veegee/guv
1ec9e85604eb8c69771a06d69681e7d7dbb00de7
node/delta.py
node/delta.py
#!/usr/bin/env python import datetime from nodes import Node class Delta(Node): char = "$" args = 1 results = 1 @Node.test_func([[1, 2, 3, 5]], [[1, 1, 2]]) def delta(self, seq: Node.sequence): """Return the difference in terms in the input sequence. Returns a sequence of the same t...
#!/usr/bin/env python import datetime from nodes import Node class Delta(Node): char = "$" args = 1 results = 1 contents = ["PADDING", "January", "February", "March", "April", "May", "June", ...
Update month names of year
Update month names of year
Python
mit
muddyfish/PYKE,muddyfish/PYKE
a035798ed00df2483a32e76a913cbc4cc8bf8df2
api/middleware.py
api/middleware.py
class AddResponseHeader: def process_response(self, req, resp, resource): resp.set_header('Access-Control-Allow-Origin', 'http://localhost:8000') components = [AddResponseHeader()]
class AddResponseHeader: def process_response(self, req, resp, resource): resp.set_header('Access-Control-Allow-Origin', 'http://localhost:8000') resp.set_header('Access-Control-Allow-Methods', 'GET, POST, PUT') resp.set_header('Access-Control-Allow-Headers', 'Content-Type') components = [A...
Fix API access control headers
Fix API access control headers
Python
mit
thepoly/Pipeline,thepoly/Pipeline,thepoly/Pipeline,thepoly/Pipeline,thepoly/Pipeline
183bd0005b71a587021c21b095961a0760e12f23
swampdragon/file_upload_handler.py
swampdragon/file_upload_handler.py
from os.path import join from os import makedirs from django.conf import settings def make_file_id(file_data): return str(abs(hash(file_data))) def get_file_location(file_name, file_id): path = join(settings.MEDIA_ROOT, 'tmp') path = join(path, str(file_id)) try: makedirs(path) except: ...
from os.path import join from os import makedirs from django.conf import settings from datetime import datetime import time def make_file_id(file_data): timestamp = datetime.now() timestamp = time.mktime(timestamp.timetuple()) * 1e3 + timestamp.microsecond / 1e3 timestamp = '{}'.format(timestamp).encode()...
Improve the file id hash
Improve the file id hash
Python
bsd-3-clause
sahlinet/swampdragon,denizs/swampdragon,sahlinet/swampdragon,aexeagmbh/swampdragon,bastianh/swampdragon,faulkner/swampdragon,faulkner/swampdragon,bastianh/swampdragon,boris-savic/swampdragon,d9pouces/swampdragon,seclinch/swampdragon,aexeagmbh/swampdragon,Manuel4131/swampdragon,seclinch/swampdragon,Manuel4131/swampdrago...
16a951a119f37927f4f023051e25968c60d4511a
python/crypto-square/crypto_square.py
python/crypto-square/crypto_square.py
import string import math import itertools class CryptoSquare: @classmethod def encode(cls, msg): if len(cls.normalize(msg)) == 0: return '' return ' '.join(cls.transpose_square(cls.squarify(cls.normalize(msg)))) @classmethod def squarify(cls, msg): return [msg[i:...
import string import math import itertools class CryptoSquare: @classmethod def encode(cls, msg): if len(cls.normalize(msg)) == 0: return '' return ' '.join(cls.transpose_square(cls.squarify(cls.normalize(msg)))) @classmethod def squarify(cls, msg): return [msg[i:...
Refactor filter out none to method
Refactor filter out none to method
Python
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
e01ec3b6c877bc76ffa2e93d97d706036a90405c
test/on_yubikey/cli_piv/test_misc.py
test/on_yubikey/cli_piv/test_misc.py
import unittest from ..framework import cli_test_suite from .util import DEFAULT_MANAGEMENT_KEY @cli_test_suite def additional_tests(ykman_cli): class Misc(unittest.TestCase): def setUp(self): ykman_cli('piv', 'reset', '-f') def test_info(self): output = ykman_cli('piv',...
import unittest from ..framework import cli_test_suite from .util import DEFAULT_MANAGEMENT_KEY @cli_test_suite def additional_tests(ykman_cli): class Misc(unittest.TestCase): def setUp(self): ykman_cli('piv', 'reset', '-f') def test_info(self): output = ykman_cli('piv',...
Test that repeated read/write-object cycles do not change the data
Test that repeated read/write-object cycles do not change the data
Python
bsd-2-clause
Yubico/yubikey-manager,Yubico/yubikey-manager
979b521a037b44b300e02d66fa0dbd967e078575
troposphere/kms.py
troposphere/kms.py
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, Tags from .compat import policytypes from .validators import boolean, integer_range, key_usage_type class Alias(AWSObject): resource_type = "AWS::KMS::Alias" props = {"...
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, Tags from .compat import policytypes from .validators import boolean, integer, integer_range, key_usage_type class Alias(AWSObject): resource_type = "AWS::KMS::Alias" p...
Update KMS per 2021-06-17 changes
Update KMS per 2021-06-17 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
d49ef15aca8b9955e02b8719f238cc3a4ea26602
dev/__init__.py
dev/__init__.py
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import os package_name = "ocspbuilder" other_packages = [] requires_oscrypto = True has_tests_package = False package_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) build_root = os.path.abspat...
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import os package_name = "ocspbuilder" other_packages = [] task_keyword_args = [] requires_oscrypto = True has_tests_package = False package_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) bui...
Add missing dev config variable
Add missing dev config variable
Python
mit
wbond/ocspbuilder
d80a92cfe45907b9f91fd212a3b06fa0b2321364
wagtail/tests/routablepage/models.py
wagtail/tests/routablepage/models.py
from django.db import models from django.http import HttpResponse from django.conf.urls import url from wagtail.contrib.wagtailroutablepage.models import RoutablePage def routable_page_external_view(request, arg): return HttpResponse("EXTERNAL VIEW: " + arg) class RoutablePageTest(RoutablePage): subpage_url...
from django.db import models from django.http import HttpResponse from django.conf.urls import url from wagtail.contrib.wagtailroutablepage.models import RoutablePage def routable_page_external_view(request, arg): return HttpResponse("EXTERNAL VIEW: " + arg) class RoutablePageTest(RoutablePage): @property ...
Make subpage_urls a property on RoutablePageTest
Make subpage_urls a property on RoutablePageTest
Python
bsd-3-clause
JoshBarr/wagtail,mikedingjan/wagtail,gasman/wagtail,takeflight/wagtail,kurtw/wagtail,jorge-marques/wagtail,Pennebaker/wagtail,zerolab/wagtail,kurtw/wagtail,bjesus/wagtail,nilnvoid/wagtail,mayapurmedia/wagtail,chrxr/wagtail,nilnvoid/wagtail,zerolab/wagtail,Klaudit/wagtail,iho/wagtail,serzans/wagtail,Tivix/wagtail,wagtai...
e4e8c4e3b98e122e5cf4c9c349c4fb2abfe00ab1
api/bioguide/models.py
api/bioguide/models.py
from django.db import models class Legislator(models.Model): """Model representing a legislator in a session of congress. """ bioguide_id = models.CharField(max_length=7, db_index=True) prefix = models.CharField(max_length=16) first = models.CharField(max_length=64) last = models.CharField(max_...
from django.db import models class Legislator(models.Model): """Model representing a legislator in a session of congress. """ bioguide_id = models.CharField(max_length=7, db_index=True) prefix = models.CharField(max_length=16) first = models.CharField(max_length=64) last = models.CharField(max_...
Add 'position' to unique_together constraint, to account for members who serve in both houses during a Congress (h/t @derekwillis)
Add 'position' to unique_together constraint, to account for members who serve in both houses during a Congress (h/t @derekwillis)
Python
bsd-3-clause
propublica/Capitol-Words,sunlightlabs/Capitol-Words,sunlightlabs/Capitol-Words,sunlightlabs/Capitol-Words,propublica/Capitol-Words,sunlightlabs/Capitol-Words,propublica/Capitol-Words,sunlightlabs/Capitol-Words,sunlightlabs/Capitol-Words,propublica/Capitol-Words,sunlightlabs/Capitol-Words
ee09661f7a40bcecc0dc4d378800a6725a800255
GPyOpt/experiment_design/latin_design.py
GPyOpt/experiment_design/latin_design.py
import numpy as np from ..core.errors import InvalidConfigError from .base import ExperimentDesign from .random_design import RandomDesign class LatinDesign(ExperimentDesign): """ Latin experiment design. Uses random design for non-continuous variables, and latin hypercube for continuous ones """ ...
import numpy as np from ..core.errors import InvalidConfigError from .base import ExperimentDesign from .random_design import RandomDesign class LatinDesign(ExperimentDesign): """ Latin experiment design. Uses random design for non-continuous variables, and latin hypercube for continuous ones """ ...
Allow users to choose lhs sampling criteria
Allow users to choose lhs sampling criteria
Python
bsd-3-clause
SheffieldML/GPyOpt
5a6399e8c25e5c4bb71a6fa4914b38ea6c66a3eb
forms/iforms.py
forms/iforms.py
from nevow.compy import Interface class IType(Interface): def validate(self, value): pass class IStructure(Interface): pass class IWidget(Interface): def render(self, ctx, key, args, errors): pass def processInput(self, ctx, key, args): pass clas...
from nevow.compy import Interface class IType(Interface): def validate(self, value): pass class IStructure(Interface): pass class IWidget(Interface): def render(self, ctx, key, args, errors): pass def renderImmutable(self, ctx, key, args, errors): ...
Add missing method to interface
Add missing method to interface
Python
mit
emgee/formal,emgee/formal,emgee/formal
c16edd2f00a45829563dad1a8072bc65418bd528
test/validate_test.py
test/validate_test.py
#! /usr/bin/python import jsonschema import json import sys import os import glob vm_schema = json.loads(open("vm.schema.json").read()); def validate_vm_spec(filename): # Load and parse as JSON try: vm_spec = json.loads(open(filename).read()) except: raise Exception("JSON load / parse Error for " + file...
#! /usr/bin/python import jsonschema import json import sys import os import glob vm_schema = None jsons = [] valid_vms = [] def load_schema(filename): global vm_schema vm_schema = json.loads(open(filename).read()); def validate_vm_spec(filename): global valid_vms vm_spec = None # Load and parse as JSON ...
Test validator can now be used as a module
Test validator can now be used as a module
Python
apache-2.0
alfred-bratterud/IncludeOS,AndreasAakesson/IncludeOS,AndreasAakesson/IncludeOS,alfred-bratterud/IncludeOS,mnordsletten/IncludeOS,alfred-bratterud/IncludeOS,ingve/IncludeOS,hioa-cs/IncludeOS,AndreasAakesson/IncludeOS,hioa-cs/IncludeOS,AndreasAakesson/IncludeOS,AnnikaH/IncludeOS,AndreasAakesson/IncludeOS,mnordsletten/Inc...
81bd740e60ce850d1617d2323b6e65960129ef0f
herana/forms.py
herana/forms.py
from django.contrib.auth.models import User from django import forms from models import ProjectDetail class ProjectDetailForm(forms.ModelForm): class Meta: model = ProjectDetail exclude = ('record_status', 'reporting_period') def _clean_fields(self): # If we are saving a draft, only t...
from django.contrib.auth.models import User from django import forms from models import ProjectDetail class ProjectDetailForm(forms.ModelForm): class Meta: model = ProjectDetail exclude = ('record_status', 'reporting_period') def _clean_fields(self): # If we are saving a draft, only t...
Fix check for _draft key in request object
Fix check for _draft key in request object
Python
mit
Code4SA/herana,Code4SA/herana,Code4SA/herana,Code4SA/herana
9e85483d7baef82e7081639e2df746ed80c38418
tests/test_wheeler.py
tests/test_wheeler.py
# coding=utf-8 import os.path as path import unittest from devpi_builder import wheeler class WheelTest(unittest.TestCase): def test_build(self): with wheeler.Builder() as builder: wheel_file = builder('progressbar', '2.2') self.assertRegexpMatches(wheel_file, '\.whl$') ...
# coding=utf-8 import os.path as path import unittest from devpi_builder import wheeler class WheelTest(unittest.TestCase): def test_build(self): with wheeler.Builder() as builder: wheel_file = builder('progressbar', '2.2') self.assertRegexpMatches(wheel_file, '\.whl$') ...
Cover the line that handles the pip<=1.5.2 error case.
Cover the line that handles the pip<=1.5.2 error case.
Python
bsd-3-clause
tylerdave/devpi-builder
d4d409e52ce62053dd2ed40c1c5ee3ec7bce3ef3
src/hiss/handler/gntp/sync.py
src/hiss/handler/gntp/sync.py
import socket from hiss.handler.gntp.message import Response class GNTPHandler(): def register(self, notifier, target, **kwargs): pass def notify(self, notification, target): pass def unregister(self, notifier, target): pass def send_request(request, target, wait_for_response=Tru...
import socket from hiss.handler.gntp.message import Response class GNTPHandler(): def register(self, notifier, target, **kwargs): pass def notify(self, notification, target): pass def unregister(self, notifier, target): pass def send_request(request, target, wait_for_response=Tru...
Make sure we close the socket
Make sure we close the socket
Python
apache-2.0
sffjunkie/hiss
0cd94ef9c5454ef79544d902fa5397bad5f17d54
dashboard/src/configuration.py
dashboard/src/configuration.py
from server_configuration import * from s3_configuration import * class Configuration(): def __init__(self): self.stage = ServerConfiguration('STAGE') self.prod = ServerConfiguration('PROD') self.s3 = S3Configuration() def __repr__(self): return "Stage: {s}\nProd: {p}\nS3: {d...
"""Configuration for the Dashboard.""" from server_configuration import * from s3_configuration import * class Configuration(): """Class representing configuration for the Dashboard.""" def __init__(self): """Construct the configuration structure.""" self.stage = ServerConfiguration('STAGE') ...
Remove excessive parenthesis + add docstrings to module, class, and all public methods
Remove excessive parenthesis + add docstrings to module, class, and all public methods
Python
apache-2.0
tisnik/fabric8-analytics-common,tisnik/fabric8-analytics-common,jpopelka/fabric8-analytics-common,tisnik/fabric8-analytics-common,jpopelka/fabric8-analytics-common,jpopelka/fabric8-analytics-common
1f6ba483902c59dc70d15ea1e33957ac6a874f01
freesound_datasets/local_settings.example.py
freesound_datasets/local_settings.example.py
# Freesound keys for download script # Get credentials at http://www.freesound.org/apiv2/apply # Set callback url to https://www.freesound.org/home/app_permissions/permission_granted/ FS_CLIENT_ID = 'FREESOUND_KEY' FS_CLIENT_SECRET = 'FREESOUND_SECRET' # Freesound keys for "login with" functionality # Get credentials ...
# Freesound keys for download script # Get credentials at http://www.freesound.org/apiv2/apply # Set callback url to https://www.freesound.org/home/app_permissions/permission_granted/ FS_CLIENT_ID = 'FREESOUND_KEY' FS_CLIENT_SECRET = 'FREESOUND_SECRET' # Freesound keys for "login with" functionality # Get credentials ...
Remove unused social auth keys
Remove unused social auth keys
Python
agpl-3.0
MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets
d8fb1906a66c5be2fb1289196bc07caaccfff0dd
php/apache_modules.py
php/apache_modules.py
import os import yaml def load_modules(data): result = yaml.load(data) if result: apache = result.get('apache', {}) if apache: return apache.get('modules', []) return [] def install_modules(modules): installed = 0 for module in modules: print " Installing A...
import os import yaml def load_modules(data): result = yaml.load(data) if result: apache = result.get('apache', {}) if apache: return apache.get('modules', []) return [] def install_modules(modules): installed = 0 for module in modules: print " Installing A...
Remove output when restarting apache after module enable
Remove output when restarting apache after module enable
Python
bsd-3-clause
jusbrasil/basebuilder,axelerant/basebuilder,axelerant/basebuilder,leandrosouza/basebuilder,keymon/basebuilder,actionjack/basebuilder,emerleite/basebuilder,keymon/basebuilder,axelerant/basebuilder,marcuskara/basebuilder,keymon/basebuilder,jusbrasil/basebuilder,marcuskara/basebuilder,ChangjunZhao/basebuilder,emerleite/ba...
efc857403d3c67589c1046d60e7f91132c844393
picdescbot/twitter.py
picdescbot/twitter.py
# coding=utf-8 # picdescbot: a tiny twitter/tumblr bot that tweets random pictures from wikipedia and their descriptions # this file implements twitter-related functionality # Copyright (C) 2016 Elad Alfassa <elad@fedoraproject.org> import time import tweepy from . import logger class Client(object): name = "twi...
# coding=utf-8 # picdescbot: a tiny twitter/tumblr bot that tweets random pictures from wikipedia and their descriptions # this file implements twitter-related functionality # Copyright (C) 2016 Elad Alfassa <elad@fedoraproject.org> import time import tweepy from . import logger class Client(object): name = "twi...
Add source links for tweets
Add source links for tweets
Python
mit
elad661/picdescbot
e40a8ce30f574a8e2745fdf2c1a74e4f1c00bc0d
cached_counts/tests.py
cached_counts/tests.py
import unittest from django.test import TestCase from candidates.tests.test_create_person import mock_create_person from .models import CachedCount class CachedCountTechCase(TestCase): def setUp(self): initial_counts = ( { 'count_type': 'constituency', 'name':...
import unittest from django.test import TestCase from candidates.tests.test_create_person import mock_create_person from .models import CachedCount def create_initial_counts(extra=()): initial_counts = ( { 'count_type': 'constituency', 'name': 'Dulwich and West Norwood', ...
Create initial counts outside the test class
Create initial counts outside the test class
Python
agpl-3.0
mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,openstate/yournextrepresentative,openstate/yournextrepresentative,YoQuieroSaber/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,openstate/yournextrepresentative,mysociety/yournextmp-popit,neavouli/yournextreprese...
df57dacf8f5ec7f697247fed39ce86d3cde45615
tests/tests_plotting/test_misc.py
tests/tests_plotting/test_misc.py
import pytest from matplotlib import pyplot as plt from poliastro.plotting import OrbitPlotter2D, OrbitPlotter3D from poliastro.plotting.misc import plot_solar_system @pytest.mark.parametrize("outer,expected", [(True, 8), (False, 4)]) def test_plot_solar_system_has_expected_number_of_orbits(outer, expected): ass...
import pytest from matplotlib import pyplot as plt from poliastro.plotting import OrbitPlotter2D, OrbitPlotter3D from poliastro.plotting.misc import plot_solar_system @pytest.mark.parametrize("outer,expected", [(True, 8), (False, 4)]) def test_plot_solar_system_has_expected_number_of_orbits(outer, expected): ass...
Check for error if use_3D and non-interactive
Check for error if use_3D and non-interactive
Python
mit
poliastro/poliastro
fae9990c2cd12ebc65abb9cbabe1b53fde9b4eec
wtforms/ext/i18n/form.py
wtforms/ext/i18n/form.py
import warnings from wtforms import form from wtforms.ext.i18n.utils import get_translations translations_cache = {} class Form(form.Form): """ Base form for a simple localized WTForms form. This will use the stdlib gettext library to retrieve an appropriate translations object for the language, by ...
import warnings from wtforms import form from wtforms.ext.i18n.utils import get_translations translations_cache = {} class Form(form.Form): """ Base form for a simple localized WTForms form. **NOTE** this class is now un-necessary as the i18n features have been moved into the core of WTForms, but it...
Make documentation more explicit for WTForms deprecation.
Make documentation more explicit for WTForms deprecation.
Python
bsd-3-clause
cklein/wtforms,jmagnusson/wtforms,crast/wtforms,pawl/wtforms,subyraman/wtforms,Aaron1992/wtforms,hsum/wtforms,wtforms/wtforms,Xender/wtforms,skytreader/wtforms,pawl/wtforms,Aaron1992/wtforms
eb15105976fd054878e0fb16a8ee6e884496b2db
dmoj/executors/RKT.py
dmoj/executors/RKT.py
from dmoj.executors.base_executor import CompiledExecutor from dmoj.executors.mixins import ScriptDirectoryMixin class Executor(ScriptDirectoryMixin, CompiledExecutor): ext = '.rkt' name = 'RKT' fs = ['/etc/nsswitch.conf$', '/etc/passwd$'] command = 'racket' syscalls = ['epoll_create', 'epoll_wa...
from dmoj.executors.base_executor import CompiledExecutor from dmoj.executors.mixins import ScriptDirectoryMixin import os class Executor(ScriptDirectoryMixin, CompiledExecutor): ext = '.rkt' name = 'RKT' fs = ['/etc/nsswitch.conf$', '/etc/passwd$', os.path.expanduser('~/\.racket/.*?')] command = 'rac...
Fix Racket on FreeBSD after openat changes
Fix Racket on FreeBSD after openat changes @quantum5 this feels iffy, but I think it's (marginally) better than allowing all .racket folders to be read
Python
agpl-3.0
DMOJ/judge,DMOJ/judge,DMOJ/judge
ae2dd4b9fe3686aca44a21ff72a4226c6110f2ee
presentation/views.py
presentation/views.py
from django.views.generic import DetailView from django.views.generic import ListView from django.shortcuts import redirect, render from .forms import PresentationCreateForm from .models import Presentation, Slide class PresentationList(ListView): model = Presentation paginate_by = 9 context_object_name ...
from django.views.generic import DetailView from django.views.generic import ListView from django.shortcuts import redirect, render from pure_pagination import PaginationMixin from .forms import PresentationCreateForm from .models import Presentation, Slide class PresentationList(PaginationMixin, ListView): mod...
Add Ordering and PaginationMixin on Listview
Add Ordering and PaginationMixin on Listview
Python
mit
SaturDJang/warp,SaturDJang/warp,SaturDJang/warp,SaturDJang/warp
4d3d00559dbb3a5aed2b58053f0d7471ef538a1c
src/python/condor/examples/squares.py
src/python/condor/examples/squares.py
import condor def square(x): return x**2 def main(): jobs = [(square, [x]) for x in range(16)] def finished(task, result): print task.args, result condor.do(jobs, 4, finished) if __name__ == "__main__": condor.enable_default_logging() # XXX main()
import condor def square(x): return x**2 def main(): jobs = [(square, [x]) for x in range(16)] def done(task, result): print task.args, result condor.do(jobs, 4, done) if __name__ == "__main__": main()
Remove logging setup from example.
Remove logging setup from example.
Python
mit
borg-project/utcondor,borg-project/utcondor
be17c81115549f0f7ec69b0cf023165d88fea6d4
sql/tests/__init__.py
sql/tests/__init__.py
#This file is part of python-sql. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. import sys import os import unittest import doctest import sql here = os.path.dirname(__file__) def test_suite(): suite = additional_tests() loader = unittest.Tes...
#This file is part of python-sql. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. import sys import os import unittest import doctest import sql here = os.path.dirname(__file__) readme = os.path.normpath(os.path.join(here, '..', '..', 'README')) def te...
Add README to test suite
Add README to test suite
Python
bsd-3-clause
vmuriart/python-sql
185e8db639f7f74702f9d741f7c01eeebce73d50
comics/aggregator/feedparser.py
comics/aggregator/feedparser.py
from __future__ import absolute_import import datetime as dt import feedparser from types import StringTypes from comics.aggregator.lxmlparser import LxmlParser class FeedParser(object): def __init__(self, url): self.raw_feed = feedparser.parse(url) def for_date(self, date): return [Entry(e)...
from __future__ import absolute_import import datetime as dt import feedparser from types import StringTypes from comics.aggregator.lxmlparser import LxmlParser class FeedParser(object): def __init__(self, url): self.raw_feed = feedparser.parse(url) def for_date(self, date): return [Entry(e)...
Replace inner function with lambda in FeedParser.has_tag()
Replace inner function with lambda in FeedParser.has_tag()
Python
agpl-3.0
datagutten/comics,klette/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,klette/comics,klette/comics,jodal/comics,datagutten/comics,jodal/comics
bdec8d649863d09e04f763038dde0230c715abfe
bot/action/core/command/usagemessage.py
bot/action/core/command/usagemessage.py
from bot.action.util.textformat import FormattedText class CommandUsageMessage: @classmethod def get_formatted_usage_text(cls, command, args=None, description=""): text = FormattedText().bold("Usage").newline() if type(args) is list: text.concat(FormattedText().newline().join((cls....
from bot.action.util.textformat import FormattedText, FormattedTextFactory class CommandUsageMessage: @classmethod def get_formatted_usage_text(cls, command, args=None, description=""): text = FormattedTextFactory.get_new_markdown().bold("Usage").newline() if type(args) is list: te...
Fix CommandUsageMessage to allow backward compatibility with already existing raw Markdown formatted text
Fix CommandUsageMessage to allow backward compatibility with already existing raw Markdown formatted text
Python
agpl-3.0
alvarogzp/telegram-bot,alvarogzp/telegram-bot
bfe4d4e5c9952f8064789ebf48d0ed28bb27c152
vpython/gs_version.py
vpython/gs_version.py
from __future__ import print_function import os import re def glowscript_version(): """ Extract the Glowscript version from the javascript in the data directory. """ data_name = 'data' glowscript_name = 'glow.2.1.min.js' this_dir = os.path.dirname(os.path.abspath(__file__)) data_dir = os....
from __future__ import print_function import os from glob import glob import re def glowscript_version(): """ Extract the Glowscript version from the javascript in the data directory. """ data_name = 'data' this_dir = os.path.dirname(os.path.abspath(__file__)) data_dir = os.path.join(this_di...
Determine glowscript version from file name
Determine glowscript version from file name
Python
mit
BruceSherwood/vpython-jupyter,BruceSherwood/vpython-jupyter,mwcraig/vpython-jupyter,mwcraig/vpython-jupyter,mwcraig/vpython-jupyter,mwcraig/vpython-jupyter,BruceSherwood/vpython-jupyter,BruceSherwood/vpython-jupyter
66c07964112aab37d56cf61e0a12c9ab3c9bd54e
wcontrol/src/forms.py
wcontrol/src/forms.py
from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, DecimalField from wtforms.validators import DataRequired from app.models import User class EditForm(FlaskForm): nickname = StringField('nickname', validators=[DataRequired()]) name = StringField('name', validators=[DataRequired(...
from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, DecimalField from wtforms.validators import DataRequired from app.models import User class EditForm(FlaskForm): nickname = StringField('nickname', validators=[DataRequired()]) name = StringField('name', validators=[DataRequired()])...
Modify to fit with PEP8 standard
Modify to fit with PEP8 standard
Python
mit
pahumadad/weight-control,pahumadad/weight-control,pahumadad/weight-control,pahumadad/weight-control
216a9176ecf395a7461c6f8ec926d48fa1634bad
manager/__init__.py
manager/__init__.py
import os from flask import Flask from flask.ext.assets import Bundle, Environment app = Flask(__name__) # Load the app config app.config.from_object("config.Config") assets = Environment(app) assets.load_path = [ os.path.join(os.path.dirname(__file__), 'static'), os.path.join(os.path.dirname(__file__), 's...
import os from flask import Flask from flask.ext.assets import Bundle, Environment app = Flask(__name__) # Load the app config app.config.from_object("config.Config") assets = Environment(app) assets.load_path = [ os.path.join(os.path.dirname(__file__), 'static'), os.path.join(os.path.dirname(__file__), 's...
Change theme to sandstone (bootswatch)
Change theme to sandstone (bootswatch)
Python
mit
hreeder/ignition,hreeder/ignition,hreeder/ignition
8eaaab332616469bec567ad159b315cc0d1e35fc
vumi/persist/tests/test_fields.py
vumi/persist/tests/test_fields.py
# -*- coding: utf-8 -*- """Tests for vumi.persist.fields.""" from twisted.trial.unittest import TestCase from vumi.persist.fields import Field, ValidationError, Integer, Unicode class TestInteger(TestCase): def test_unbounded(self): i = Integer() i.validate(5) i.validate(-3) sel...
# -*- coding: utf-8 -*- """Tests for vumi.persist.fields.""" from twisted.trial.unittest import TestCase from vumi.persist.fields import ( ValidationError, Field, FieldDescriptor, Integer, Unicode, ForeignKey, ForeignKeyDescriptor) class TestBaseField(TestCase): def test_validate(self): f = Fie...
Add tests for the Field class.
Add tests for the Field class.
Python
bsd-3-clause
TouK/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix
2d27e06d0f70921093b1a4629128ec456a47423d
euler/solutions/solution_19.py
euler/solutions/solution_19.py
"""Counting Sundays You are given the following information, but you may prefer to do some research for yourself. - 1 Jan 1900 was a Monday. - Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, t...
"""Counting Sundays You are given the following information, but you may prefer to do some research for yourself. - 1 Jan 1900 was a Monday. - Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, t...
Add solution for problem 19
Add solution for problem 19 Counting Sundays
Python
mit
rlucioni/project-euler
8b30f787d3dabb9072ee0517cf0e5e92daa1038f
l10n_ch_dta_base_transaction_id/wizard/create_dta.py
l10n_ch_dta_base_transaction_id/wizard/create_dta.py
# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier # 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 # pu...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier # 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 # pu...
Fix TypeError: _set_bank_data() takes at least 7 arguments (7 given)
Fix TypeError: _set_bank_data() takes at least 7 arguments (7 given)
Python
agpl-3.0
open-net-sarl/l10n-switzerland,open-net-sarl/l10n-switzerland,BT-ojossen/l10n-switzerland,BT-ojossen/l10n-switzerland
18261acd87a2e9c6735d9081eff50e2a09277605
src/pyshark/config.py
src/pyshark/config.py
from pathlib import Path from configparser import ConfigParser import pyshark fp_config_path = Path.cwd() / 'config.ini' # get config from the current directory pyshark_config_path = Path(pyshark.__file__).parent / 'config.ini' def get_config(): if Path.exists(fp_config_path): config_path = fp_config...
from pathlib import Path from configparser import ConfigParser import pyshark fp_config_path = Path.cwd() / 'config.ini' # get config from the current directory pyshark_config_path = Path(pyshark.__file__).parent / 'config.ini' def get_config(): if fp_config_path.exists(): config_path = fp_config_pat...
Use `x_path.exists()` instead of `Path.exists(x)`.
Use `x_path.exists()` instead of `Path.exists(x)`.
Python
mit
KimiNewt/pyshark
cf8f3dc4d2cde04a1f822627db522c1b021c3359
dataset/__init__.py
dataset/__init__.py
# shut up useless SA warning: import warnings warnings.filterwarnings( 'ignore', 'Unicode type received non-unicode bind param value.') from dataset.persistence.database import Database from dataset.persistence.table import Table from dataset.freeze.app import freeze __all__ = ['Database', 'Table', 'freeze', 'con...
import os # shut up useless SA warning: import warnings warnings.filterwarnings( 'ignore', 'Unicode type received non-unicode bind param value.') from dataset.persistence.database import Database from dataset.persistence.table import Table from dataset.freeze.app import freeze __all__ = ['Database', 'Table', 'fre...
Allow to use `url` defined as env variable.
Allow to use `url` defined as env variable.
Python
mit
pudo/dataset,askebos/dataset,twds/dataset,vguzmanp/dataset,stefanw/dataset,saimn/dataset,reubano/dataset
d5765d0d961aa32f783f6c2a61c86a6adf282b62
dipy/core/histeq.py
dipy/core/histeq.py
import numpy as np def histeq(im, num_bins=256): """ Performs an histogram equalization on ``img``. This was taken from: http://www.janeriksolem.net/2009/06/histogram-equalization-with-python-and.html Parameters ---------- im : ndarray Image on which to perform histogram equalizat...
import numpy as np def histeq(arr, num_bins=256): """ Performs an histogram equalization on ``arr``. This was taken from: http://www.janeriksolem.net/2009/06/histogram-equalization-with-python-and.html Parameters ---------- arr : ndarray Image on which to perform histogram equalizatio...
Fix comment format and input var name.
Fix comment format and input var name.
Python
bsd-3-clause
JohnGriffiths/dipy,demianw/dipy,oesteban/dipy,jyeatman/dipy,nilgoyyou/dipy,sinkpoint/dipy,matthieudumont/dipy,FrancoisRheaultUS/dipy,rfdougherty/dipy,mdesco/dipy,beni55/dipy,StongeEtienne/dipy,rfdougherty/dipy,samuelstjean/dipy,nilgoyyou/dipy,beni55/dipy,StongeEtienne/dipy,villalonreina/dipy,demianw/dipy,matthieudumont...
8a4165f2d7a252e6f3de3fd82b215e46d532a237
lms/djangoapps/grades/migrations/0005_multiple_course_flags.py
lms/djangoapps/grades/migrations/0005_multiple_course_flags.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): dependencies = [ ('grades', '0004_visibleblocks_course_id'), ] operations = [ ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from openedx.core.djangoapps.xmodule_django.models import CourseKeyField class Migration(migrations.Migration): dependencies = [ ('grades', '0004_visibleblocks_course_id'), ] operations = [ ...
Allow grades app to be zero-migrated
Allow grades app to be zero-migrated
Python
agpl-3.0
ahmedaljazzar/edx-platform,gymnasium/edx-platform,gsehub/edx-platform,jzoldak/edx-platform,pabloborrego93/edx-platform,fintech-circle/edx-platform,ESOedX/edx-platform,stvstnfrd/edx-platform,philanthropy-u/edx-platform,kmoocdev2/edx-platform,appsembler/edx-platform,amir-qayyum-khan/edx-platform,pepeportela/edx-platform,...
d7b7f157fd5758c1de22810d871642768f4eac68
trunk/metpy/__init__.py
trunk/metpy/__init__.py
import bl import readers import vis import tools import constants from calc import * import version __version__ = version.get_version()
import bl import readers import vis import tools import constants #What do we want to pull into the top-level namespace from calc import * from readers.mesonet import * import version __version__ = version.get_version()
Add mesonet readers to top level namespace.
Add mesonet readers to top level namespace. git-svn-id: acf0ef94bfce630b1a882387fc03ab8593ec6522@150 150532fb-1d5b-0410-a8ab-efec50f980d4
Python
bsd-3-clause
dopplershift/MetPy,deeplycloudy/MetPy,dopplershift/MetPy,Unidata/MetPy,Unidata/MetPy,ahaberlie/MetPy,ahaberlie/MetPy,jrleeman/MetPy,jrleeman/MetPy,ShawnMurd/MetPy,ahill818/MetPy
20c121d218de2663186f2e5898aa643194902829
thumbor/detectors/queued_detector/__init__.py
thumbor/detectors/queued_detector/__init__.py
from remotecv import pyres_tasks from remotecv.unique_queue import UniqueQueue from thumbor.detectors import BaseDetector class QueuedDetector(BaseDetector): queue = UniqueQueue() def detect(self, callback): engine = self.context.modules.engine self.queue.enqueue_unique(pyres_tasks.DetectTask...
from remotecv.unique_queue import UniqueQueue from thumbor.detectors import BaseDetector class QueuedDetector(BaseDetector): queue = UniqueQueue() def detect(self, callback): engine = self.context.modules.engine self.queue.enqueue_unique_from_string('remotecv.pyres_tasks.DetectTask', 'Detect'...
Remove dependency from remotecv worker on queued detector
Remove dependency from remotecv worker on queued detector
Python
mit
Jimdo/thumbor,abaldwin1/thumbor,okor/thumbor,voxmedia/thumbor,wking/thumbor,gi11es/thumbor,figarocms/thumbor,jdunaravich/thumbor,thumbor/thumbor,grevutiu-gabriel/thumbor,suwaji/thumbor,marcelometal/thumbor,2947721120/thumbor,food52/thumbor,thumbor/thumbor,kkopachev/thumbor,dhardy92/thumbor,davduran/thumbor,scorphus/thu...
f02ce3a2e94bc40cde87a39ba5b133599d729f9c
mpltools/widgets/__init__.py
mpltools/widgets/__init__.py
import matplotlib.widgets as mwidgets if not hasattr(mwidgets, 'AxesWidget'): branch = "<https://github.com/tonysyu/matplotlib/tree/base-widget>" msg = "mpltools.widgets requires a branch of Matplotlib: %s" % branch raise ImportError(msg) from .rectangle_selector import RectangleSelector from .slider imp...
import matplotlib.widgets as mwidgets if not hasattr(mwidgets, 'AxesWidget'): version = "(github master; after March 16, 2012)" msg = "mpltools.widgets requires recent version of Matplotlib %s" % version raise ImportError(msg) from .rectangle_selector import RectangleSelector from .slider import Slider ...
Update MPL version requirement for `widgets`.
Update MPL version requirement for `widgets`.
Python
bsd-3-clause
tonysyu/mpltools,matteoicardi/mpltools
7ddb5b9ab579c58fc1fc8be7760f7f0963d02c3a
CodeFights/chessBoardCellColor.py
CodeFights/chessBoardCellColor.py
#!/usr/local/bin/python # Code Fights Chess Board Cell Color Problem def chessBoardCellColor(cell1, cell2): pass def main(): tests = [ ["A1", "C3", True], ["A1", "H3", False], ["A1", "A2", False], ["A1", "B2", True], ["B3", "H8", False], ["C3", "B5", False], ...
#!/usr/local/bin/python # Code Fights Chess Board Cell Color Problem def chessBoardCellColor(cell1, cell2): ''' Determine if the two given cells on chess board are same color A, C, E, G odd cells are same color as B, D, F, H even cells ''' def get_color(cell): return ("DARK" if (cell[0] in...
Solve chess board cell color problem
Solve chess board cell color problem
Python
mit
HKuz/Test_Code
f4c5bb0a77108f340533736c52f01c861146a6b6
byceps/util/money.py
byceps/util/money.py
""" byceps.util.money ~~~~~~~~~~~~~~~~~ Handle monetary amounts. :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from decimal import Decimal import locale TWO_PLACES = Decimal('.00') def format_euro_amount(x: Decimal) -> str: """Return a textual representation ...
""" byceps.util.money ~~~~~~~~~~~~~~~~~ Handle monetary amounts. :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from decimal import Decimal import locale TWO_PLACES = Decimal('.00') def format_euro_amount(x: Decimal) -> str: """Return a textual representation ...
Remove usage of `monetary` keyword argument again as it is not available on Python 3.6
Remove usage of `monetary` keyword argument again as it is not available on Python 3.6
Python
bsd-3-clause
m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps
58236d8bc6a23477d83c244fc117f493aa2651a6
thinglang/parser/tokens/arithmetic.py
thinglang/parser/tokens/arithmetic.py
from thinglang.common import ObtainableValue from thinglang.parser.tokens import BaseToken class ArithmeticOperation(BaseToken, ObtainableValue): OPERATIONS = { "+": lambda rhs, lhs: rhs + lhs, "*": lambda rhs, lhs: rhs * lhs, "-": lambda rhs, lhs: rhs - lhs, "/": lambda rhs, lhs: ...
from thinglang.common import ObtainableValue from thinglang.parser.tokens import BaseToken class ArithmeticOperation(BaseToken, ObtainableValue): OPERATIONS = { "+": lambda rhs, lhs: rhs + lhs, "*": lambda rhs, lhs: rhs * lhs, "-": lambda rhs, lhs: rhs - lhs, "/": lambda rhs, lhs: ...
Add replace method to Arithmetic operation
Add replace method to Arithmetic operation
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
bfafb5c3fd2de6f2a87439553b3a55465f07d24c
django_medusa/renderers/__init__.py
django_medusa/renderers/__init__.py
from django.conf import settings import importlib from .base import BaseStaticSiteRenderer from .disk import DiskStaticSiteRenderer from .appengine import GAEStaticSiteRenderer from .s3 import S3StaticSiteRenderer __all__ = ('BaseStaticSiteRenderer', 'DiskStaticSiteRenderer', 'S3StaticSiteRenderer', 'GAESta...
from django.conf import settings from django.utils import importlib from .base import BaseStaticSiteRenderer from .disk import DiskStaticSiteRenderer from .appengine import GAEStaticSiteRenderer from .s3 import S3StaticSiteRenderer __all__ = ('BaseStaticSiteRenderer', 'DiskStaticSiteRenderer', 'S3StaticSite...
Remove importlib dependency, add django's own importlib
Remove importlib dependency, add django's own importlib
Python
mit
alsoicode/django-medusa,mtigas/django-medusa,hyperair/django-medusa,botify-labs/django-medusa
c734fbbcb8680f704cfcc5b8ee605c4d0557526d
Brownian/view/utils/plugins.py
Brownian/view/utils/plugins.py
import subprocess import string class Plugin: def __init__(self, command, allowedChars): # We replace the characters we do allow with empty strings, to get a string of all the characters we don't allow. self.notAllowedCharMap = string.maketrans(allowedChars, " "*len(allowedChars)) self.comm...
import subprocess import string import shlex class Plugin: def __init__(self, command, allowedChars, insertInitialNewline=False): # We replace the characters we do allow with empty strings, to get a string of all the characters we don't allow. self.notAllowedCharMap = str(string.maketrans(allowedCh...
Use the Team Cymru whois server by default, make it easier to use complex commands, and optionally insert a new line before the output.
Use the Team Cymru whois server by default, make it easier to use complex commands, and optionally insert a new line before the output.
Python
bsd-2-clause
jpressnell/Brownian,grigorescu/Brownian,ruslux/Brownian,grigorescu/Brownian,grigorescu/Brownian,jpressnell/Brownian,jpressnell/Brownian,ruslux/Brownian,ruslux/Brownian
57444bdd253e428174c7a5475ef205063ac95ef3
lms/djangoapps/heartbeat/views.py
lms/djangoapps/heartbeat/views.py
import json from datetime import datetime from django.http import HttpResponse def heartbeat(request): """ Simple view that a loadbalancer can check to verify that the app is up """ output = { 'date': datetime.now().isoformat() } return HttpResponse(json.dumps(output, indent=4))
import json from datetime import datetime from django.http import HttpResponse from xmodule.modulestore.django import modulestore def heartbeat(request): """ Simple view that a loadbalancer can check to verify that the app is up """ output = { 'date': datetime.now().isoformat(), 'cours...
Make heartbeat url wait for courses to be loaded
Make heartbeat url wait for courses to be loaded
Python
agpl-3.0
benpatterson/edx-platform,bigdatauniversity/edx-platform,Softmotions/edx-platform,shashank971/edx-platform,shabab12/edx-platform,ampax/edx-platform,mcgachey/edx-platform,yokose-ks/edx-platform,Livit/Livit.Learn.EdX,DefyVentures/edx-platform,pdehaye/theming-edx-platform,jruiperezv/ANALYSE,carsongee/edx-platform,jjmirand...
59b920d3c5d699c180be4dafec86f50a0c636028
work/print-traceback.py
work/print-traceback.py
#!/usr/bin/python3 from pprint import pprint import json import sys if __name__ == '__main__': if len(sys.argv) >= 2: path = sys.argv[1].split('.') else: path = ['error', 'stack'] obj = json.load(sys.stdin) try: for part in path: obj = obj[part] except KeyErro...
#!/usr/bin/python3 from pprint import pprint import json import sys def get(obj, path): try: for part in path: obj = obj[part] return obj except KeyError: return None if __name__ == '__main__': if len(sys.argv) >= 2: paths = [sys.argv[1].split('.')] else: ...
Improve stacktrace print for traceback.
Improve stacktrace print for traceback.
Python
mit
ammongit/scripts,ammongit/scripts,ammongit/scripts,ammongit/scripts
4922d53f95b3f7c055afe1d0af0088b505cbc0d2
addons/bestja_configuration_ucw/__openerp__.py
addons/bestja_configuration_ucw/__openerp__.py
# -*- coding: utf-8 -*- { 'name': "Bestja: UCW", 'summary': "Installation configuration for UCW", 'description': "Installation configuration for Uniwersyteckie Centrum Wolontariatu", 'author': "Laboratorium EE", 'website': "http://www.laboratorium.ee", 'version': '0.1', 'category': 'Specific...
# -*- coding: utf-8 -*- { 'name': "Bestja: UCW", 'summary': "Installation configuration for UCW", 'description': "Installation configuration for Uniwersyteckie Centrum Wolontariatu", 'author': "Laboratorium EE", 'website': "http://www.laboratorium.ee", 'version': '0.1', 'category': 'Specific...
Enable Odoo blog for UCW
Enable Odoo blog for UCW
Python
agpl-3.0
EE/bestja,EE/bestja,KamilWo/bestja,KamilWo/bestja,KrzysiekJ/bestja,ludwiktrammer/bestja,EE/bestja,ludwiktrammer/bestja,KamilWo/bestja,KrzysiekJ/bestja,ludwiktrammer/bestja,KrzysiekJ/bestja
343524ddeac29e59d7c214a62a721c2065583503
setuptools_extversion/__init__.py
setuptools_extversion/__init__.py
""" setuptools_extversion Allows getting distribution version from external sources (e.g.: shell command, Python function) """ VERSION_PROVIDER_KEY = 'extversion' def version_calc(dist, attr, value): """ Handler for parameter to setup(extversion=value) """ if attr == VERSION_PROVIDER_KEY: e...
""" setuptools_extversion Allows getting distribution version from external sources (e.g.: shell command, Python function) """ import subprocess VERSION_PROVIDER_KEY = 'extversion' def version_calc(dist, attr, value): """ Handler for parameter to setup(extversion=value) """ if attr == VERSION_PRO...
Add support for providing command string
Add support for providing command string User can provide a command string in a 'command' key -- e.g.: setup( ... setup_requires='setuptools_extversion', extversion={ 'command': 'git describe --tags --dirty', } ... )
Python
mit
msabramo/python_setuptools_extversion
e61e633e122953774ee4246ad61b23d9b7d264f3
semillas_backend/users/serializers.py
semillas_backend/users/serializers.py
from rest_framework import serializers from .models import User class UserSerializer(serializers.ModelSerializer): """ Usage: from rest_framework.renderers import JSONRenderer from semillas_backend.users.serializers import UserSerializer JSONRenderer().render(UserSerializer(user_instanc...
from rest_framework import serializers from .models import User class UserSerializer(serializers.ModelSerializer): """ Usage: from rest_framework.renderers import JSONRenderer from semillas_backend.users.serializers import UserSerializer JSONRenderer().render(UserSerializer(user_instance...
Add location, email, username and last_login to user serializer
Add location, email, username and last_login to user serializer
Python
mit
Semillas/semillas_backend,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_platform,Semillas/semillas_platform,Semillas/semillas_backend
5d652eacf793dc3aa1873279708f88e16e1c0dfd
eloqua/endpoints_v2.py
eloqua/endpoints_v2.py
""" API MAPPING FOR Eloqua API V2 """ mapping_table = { 'content_type': 'application/json', 'path_prefix': '/API/REST/2.0', # Campaigns 'get_campaign': { 'method': 'GET', 'path': '/assets/campaign/{{campaign_id}}', 'valid_params': ['depth'] }, 'list_campaigns': { ...
""" API MAPPING FOR Eloqua API V2 """ mapping_table = { 'content_type': 'application/json', 'path_prefix': '/API/REST/2.0', # Campaigns 'get_campaign': { 'method': 'GET', 'path': '/assets/campaign/{{campaign_id}}', 'valid_params': ['depth'] }, 'list_campaigns': { ...
Add operation to activate campaign.
Add operation to activate campaign.
Python
mit
alexcchan/eloqua
1e218ba94c774372929d890780ab12efbfaae181
core/management/commands/heroku.py
core/management/commands/heroku.py
from django.core.management.base import BaseCommand from django.contrib.auth.models import User from django.core.management import call_command class Command(BaseCommand): help = 'Creates a superuser for Heroku' def handle(self, *args, **kwargs): verbosity = kwargs['verbosity'] call_command(...
from django.core.management.base import BaseCommand from django.contrib.auth.models import User from django.core.management import call_command class Command(BaseCommand): help = 'Runs migrations for Heroku' def handle(self, *args, **kwargs): verbosity = kwargs['verbosity'] call_command('mig...
Remove Heroku createsuperuser command. Migrate now creates a default user.
Remove Heroku createsuperuser command. Migrate now creates a default user.
Python
bsd-2-clause
cdubz/timestrap,muhleder/timestrap,muhleder/timestrap,muhleder/timestrap,overshard/timestrap,cdubz/timestrap,overshard/timestrap,overshard/timestrap,cdubz/timestrap
2d55cf766baeb6c9f3ad0c1925b049464680cf7e
saleor/integrations/utils.py
saleor/integrations/utils.py
import gzip import csv from django.core.files.storage import default_storage def update_feed(feed): with default_storage.open(feed.file_path, 'w') as output_file: if feed.compression: output = gzip.GzipFile(fileobj=output_file) else: output = output_file writer = ...
from __future__ import unicode_literals import gzip import csv from django.core.files.storage import default_storage def update_feed(feed): with default_storage.open(feed.file_path, 'wb') as output_file: if feed.compression: try: output = gzip.open(output_file, 'wt') ...
Fix compressed feeds in python3
Fix compressed feeds in python3
Python
bsd-3-clause
KenMutemi/saleor,tfroehlich82/saleor,itbabu/saleor,itbabu/saleor,car3oon/saleor,UITools/saleor,tfroehlich82/saleor,UITools/saleor,HyperManTT/ECommerceSaleor,UITools/saleor,jreigel/saleor,KenMutemi/saleor,itbabu/saleor,car3oon/saleor,mociepka/saleor,maferelo/saleor,maferelo/saleor,UITools/saleor,HyperManTT/ECommerceSale...
2d2fb47e321faa032c98e92d34e6215b6026f1f0
keras/applications/__init__.py
keras/applications/__init__.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from .. import backend from .. import layers from .. import models from .. import utils import keras_applications if not hasattr(keras_applications, 'get_submodules_from_kwargs'): keras_applications.set_k...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from .. import backend from .. import layers from .. import models from .. import utils import keras_applications def keras_modules_injection(base_fun): def wrapper(*args, **kwargs): kwargs['bac...
Remove deprecated applications adapter code
Remove deprecated applications adapter code
Python
apache-2.0
keras-team/keras,keras-team/keras
3899893177f6d149d638ad5ae32c2135f0bfdcf2
startServers.py
startServers.py
import sys import time import subprocess def main(baseCommand, startingPort, count): procs = [] for i in range(1,count + 1): command = baseCommand + ' ' + str(startingPort + i) if sys.platform.startswith('win'): process = subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_CONSOLE) else: linux...
import sys import time import subprocess import psutil def startServer(command): if sys.platform.startswith('win'): return psutil.Popen(command, creationflags=subprocess.CREATE_NEW_CONSOLE) else: linuxCommand = 'xterm -hold -e "%s"' % command return psutil.Popen(linuxCommand, shell=True) def main(baseCommand...
Revert "Revert "keep servers running for fun and profit""
Revert "Revert "keep servers running for fun and profit"" This reverts commit cc7253020251bc96d7d7f22a991b094a60bbc104.
Python
mit
IngenuityEngine/coren_proxy,IngenuityEngine/coren_proxy
d52b47eaad73f818974b7feec83fa3b15ddb5aac
form_utils_bootstrap3/tests/__init__.py
form_utils_bootstrap3/tests/__init__.py
import os import django from django.conf import settings if not settings.configured: settings_dict = dict( INSTALLED_APPS=[ 'django.contrib.contenttypes', 'django.contrib.auth', 'bootstrap3', 'form_utils', ], DATABASES={ "default...
import os import django from django.conf import settings if not settings.configured: settings_dict = dict( INSTALLED_APPS=[ 'django.contrib.contenttypes', 'django.contrib.auth', 'bootstrap3', 'form_utils', ], DATABASES={ "default...
Fix tests for Django trunk
Fix tests for Django trunk
Python
mit
federicobond/django-form-utils-bootstrap3
c0cc820b933913a3d5967d377f557a26ff21dcf7
tests/test_utils.py
tests/test_utils.py
from io import UnsupportedOperation from pilkit.exceptions import UnknownFormat, UnknownExtension from pilkit.utils import extension_to_format, format_to_extension, FileWrapper from nose.tools import eq_, raises def test_extension_to_format(): eq_(extension_to_format('.jpeg'), 'JPEG') eq_(extension_to_format(...
from io import UnsupportedOperation from pilkit.exceptions import UnknownFormat, UnknownExtension from pilkit.utils import (extension_to_format, format_to_extension, FileWrapper, save_image) from nose.tools import eq_, raises from tempfile import NamedTemporaryFile from .utils import create_im...
Test that filename string can be used with save_image
Test that filename string can be used with save_image
Python
bsd-3-clause
kezabelle/pilkit,fladi/pilkit
99d0f754b39bdddf58e44e669d24157227a43107
heliotron/__init__.py
heliotron/__init__.py
#from requests import get from heliotron.bridge import Bridge from heliotron.light import Light import heliotron.presets __all__ = ['Bridge', 'Light', 'presets']
#from requests import get from heliotron.bridge import Bridge from heliotron.light import Light from heliotron import presets __all__ = ['Bridge', 'Light', 'presets']
Change module import to squash a code smell
Change module import to squash a code smell
Python
mit
briancline/heliotron
20506c1463c1be9639bceae1168ba97178280796
mrburns/main/tests.py
mrburns/main/tests.py
from django.test import TestCase from nose.tools import ok_ from mrburns.main import views class TestViewHelpers(TestCase): def test_twitter_share_url_fn(self): """Should return a proper and endoded twitter share url.""" url = views.get_tw_share_url(url='http://example.com', text='The Dude abide...
from django.test import TestCase from nose.tools import ok_ from mrburns.main import views class TestViewHelpers(TestCase): def test_twitter_share_url_fn(self): """Should return a proper and endoded twitter share url.""" url = views.get_tw_share_url(url='http://example.com', text='The Dude abide...
Fix twitter url helper test.
Fix twitter url helper test.
Python
mpl-2.0
almossawi/mrburns,almossawi/mrburns,mozilla/mrburns,mozilla/mrburns,mozilla/mrburns,almossawi/mrburns,almossawi/mrburns
8f31a87ace324c519eac8d883cf0327d08f48df0
lib/ansiblelint/rules/VariableHasSpacesRule.py
lib/ansiblelint/rules/VariableHasSpacesRule.py
# Copyright (c) 2016, Will Thames and contributors # Copyright (c) 2018, Ansible Project from ansiblelint import AnsibleLintRule import re class VariableHasSpacesRule(AnsibleLintRule): id = '206' shortdesc = 'Variables should have spaces before and after: {{ var_name }}' description = 'Variables should h...
# Copyright (c) 2016, Will Thames and contributors # Copyright (c) 2018, Ansible Project from ansiblelint import AnsibleLintRule import re class VariableHasSpacesRule(AnsibleLintRule): id = '206' shortdesc = 'Variables should have spaces before and after: {{ var_name }}' description = 'Variables should h...
Fix nested JSON obj false positive
var-space-rule: Fix nested JSON obj false positive When using compact form nested JSON object within a Jinja2 context as shown in the following example: set_fact:"{{ {'test': {'subtest': variable}} }}" 'variable}}' will raise a false positive [206] error. This commit adds an intermediate step within 206 (VariableH...
Python
mit
willthames/ansible-lint
8fc4713375c4eadd83ec376c3e839d921c39b5dc
src/encoded/predicates.py
src/encoded/predicates.py
from pyramid.security import has_permission def includeme(config): config.add_view_predicate('subpath_segments', SubpathSegmentsPredicate) config.add_view_predicate('additional_permission', AdditionalPermissionPredicate) class SubpathSegmentsPredicate(object): def __init__(self, val, config): se...
from pyramid.security import has_permission def includeme(config): config.add_view_predicate('subpath_segments', SubpathSegmentsPredicate) config.add_view_predicate('additional_permission', AdditionalPermissionPredicate) class SubpathSegmentsPredicate(object): def __init__(self, val, config): if...
Allow specification of multiple subpath_segments
Allow specification of multiple subpath_segments
Python
mit
4dn-dcic/fourfront,ClinGen/clincoded,kidaa/encoded,T2DREAM/t2dream-portal,philiptzou/clincoded,hms-dbmi/fourfront,philiptzou/clincoded,4dn-dcic/fourfront,4dn-dcic/fourfront,ENCODE-DCC/encoded,ENCODE-DCC/encoded,ClinGen/clincoded,T2DREAM/t2dream-portal,kidaa/encoded,ENCODE-DCC/snovault,ENCODE-DCC/snovault,ClinGen/clinco...
f014538a79facc32bdc726f0d7fe5d9a10d24189
project/settings.py
project/settings.py
# -*- coding: utf-8 -*- TENHOU_HOST = '133.242.10.78' TENHOU_PORT = 10080 USER_ID = 'NoName' LOBBY = '0' WAITING_GAME_TIMEOUT_MINUTES = 10 # in tournament mode bot is not trying to search the game # it just sitting in the lobby and waiting for the game start IS_TOURNAMENT = False STAT_SERVER_URL = '' STAT_TOKEN = ...
# -*- coding: utf-8 -*- TENHOU_HOST = '133.242.10.78' TENHOU_PORT = 10080 USER_ID = 'NoName' LOBBY = '0' WAITING_GAME_TIMEOUT_MINUTES = 10 # in tournament mode bot is not trying to search the game # it just sitting in the lobby and waiting for the game start IS_TOURNAMENT = False STAT_SERVER_URL = '' STAT_TOKEN = ...
Update description for game types
Update description for game types
Python
mit
huangenyan/Lattish,MahjongRepository/tenhou-python-bot,huangenyan/Lattish,MahjongRepository/tenhou-python-bot
f5234462c3bdacf91aad84df78bf750bf2035493
alfred_db/migrations/versions/4fdf1059c4ba_add_organizations_us.py
alfred_db/migrations/versions/4fdf1059c4ba_add_organizations_us.py
"""Add organizations-users association table Revision ID: 4fdf1059c4ba Revises: 393a48ab5fc7 Create Date: 2012-09-02 12:37:11.785052 """ # revision identifiers, used by Alembic. revision = '4fdf1059c4ba' down_revision = '393a48ab5fc7' from alembic import op import sqlalchemy as sa def upgrade(): op.create_tab...
"""Add organizations-users association table Revision ID: 4fdf1059c4ba Revises: 393a48ab5fc7 Create Date: 2012-09-02 12:37:11.785052 """ # revision identifiers, used by Alembic. revision = '4fdf1059c4ba' down_revision = '393a48ab5fc7' from alembic import op import sqlalchemy as sa def upgrade(): op.create_tab...
Fix memebership table creation migration
Fix memebership table creation migration
Python
isc
alfredhq/alfred-db
d208407fb71ccb2d09eae7af41e486caae65a45e
openquake/__init__.py
openquake/__init__.py
__import__('pkg_resources').declare_namespace(__name__)
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2010-2016 GEM Foundation # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the Licen...
Make the openquake namespace compatible with old setuptools
Make the openquake namespace compatible with old setuptools
Python
agpl-3.0
gem/oq-engine,gem/oq-engine,rcgee/oq-hazardlib,gem/oq-hazardlib,gem/oq-hazardlib,gem/oq-engine,gem/oq-engine,rcgee/oq-hazardlib,gem/oq-hazardlib,gem/oq-engine
5ad869909e95fa8e5e0b6a489d361c42006023a5
openstack/__init__.py
openstack/__init__.py
# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Use project name to retrieve version info
Use project name to retrieve version info Change-Id: Iaef93bde5183263f900166b8ec90eefb7bfdc99b
Python
apache-2.0
openstack/python-openstacksdk,dudymas/python-openstacksdk,dudymas/python-openstacksdk,mtougeron/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-ope...
a6581409971a8670a5195924feb27fb890d297c5
plugins/PerObjectSettingsTool/PerObjectSettingsTool.py
plugins/PerObjectSettingsTool/PerObjectSettingsTool.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Tool import Tool from UM.Scene.Selection import Selection from UM.Application import Application from . import PerObjectSettingsModel class PerObjectSettingsTool(Tool): def __init__(self): super()._...
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Tool import Tool from UM.Scene.Selection import Selection from UM.Application import Application from . import PerObjectSettingsModel class PerObjectSettingsTool(Tool): def __init__(self): super()._...
Remove more remnants of print sequence message
Remove more remnants of print sequence message I found this other place that was helping to display the message that warns that print sequcence is set per-object. Since the latter is no longer possible, this message shouldn't be displayed any more. Contributes to issue CURA-458.
Python
agpl-3.0
hmflash/Cura,Curahelper/Cura,senttech/Cura,Curahelper/Cura,hmflash/Cura,ynotstartups/Wanhao,totalretribution/Cura,fieldOfView/Cura,senttech/Cura,totalretribution/Cura,ynotstartups/Wanhao,fieldOfView/Cura
e0164d906c791d0b00077ae5353a07a07f4cd30d
labs/04_conv_nets/solutions/strides_padding.py
labs/04_conv_nets/solutions/strides_padding.py
def my_init(shape, dtype=None): array = np.zeros(shape=(5,5,3,3)) array[2,2] = np.eye(3) return array inp = Input((None, None, 3), dtype="float32") x = Conv2D(kernel_size=(5,5), filters=3, strides=2, padding="same", kernel_initializer=my_init)(inp) conv_strides_same = Model(inputs=inp, output...
def my_init(shape=(5, 5, 3, 3), dtype=None): array = np.zeros(shape=shape) array[2, 2] = np.eye(3) return array conv_strides_same = Sequential([ Conv2D(filters=3, kernel_size=5, strides=2, padding="same", kernel_initializer=my_init, input_shape=(None, None, 3)) ]) conv_strides_va...
Update solution to be consistent
Update solution to be consistent
Python
mit
m2dsupsdlclass/lectures-labs,m2dsupsdlclass/lectures-labs
72b9ff43daaf88f43ec4397cfed8fb860d4ad850
rest-api/test/client_test/base.py
rest-api/test/client_test/base.py
import copy import json import os import unittest from client.client import Client # To run the tests against the test instance instead, # set environment variable PMI_DRC_RDR_INSTANCE. _DEFAULT_INSTANCE = 'http://localhost:8080' _OFFLINE_BASE_PATH = 'offline' class BaseClientTest(unittest.TestCase): def setUp(s...
import copy import json import os import unittest from client.client import Client from tools.main_util import configure_logging # To run the tests against the test instance instead, # set environment variable PMI_DRC_RDR_INSTANCE. _DEFAULT_INSTANCE = 'http://localhost:8080' _OFFLINE_BASE_PATH = 'offline' class Ba...
Configure logging in client tests, so client logs show up.
Configure logging in client tests, so client logs show up.
Python
bsd-3-clause
all-of-us/raw-data-repository,all-of-us/raw-data-repository,all-of-us/raw-data-repository
b5d3425ae0a4a42e85748e494c3ddfaa7511f7b7
ocradmin/lib/nodetree/cache.py
ocradmin/lib/nodetree/cache.py
""" Classes for customising node caching. """ class BasicCacher(object): """ Basic in-memory caching. """ def __init__(self, logger=None): self._cache = {} self.logger = logger def set_cache(self, node, data): """ Store some data on the object. """ ...
""" Classes for customising node caching. """ class BasicCacher(object): """ Basic in-memory caching. """ def __init__(self, logger=None): self._cache = {} self.logger = logger def set_cache(self, node, data): """ Store some data on the object. """ ...
Test for existence of node before clearing it
Test for existence of node before clearing it
Python
apache-2.0
vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium
1934229ace3bd35b98e3eaa9b8ec75a1000dea78
djkombu/transport.py
djkombu/transport.py
from Queue import Empty from anyjson import serialize, deserialize from kombu.transport import virtual from django.conf import settings from django.core import exceptions as errors from djkombu.models import Queue POLLING_INTERVAL = getattr(settings, "DJKOMBU_POLLING_INTERVAL", 5.0) class Channel(virtual.Channel)...
from Queue import Empty from anyjson import serialize, deserialize from kombu.transport import virtual from django.conf import settings from django.core import exceptions as errors from djkombu.models import Queue POLLING_INTERVAL = getattr(settings, "DJKOMBU_POLLING_INTERVAL", 5.0) class Channel(virtual.Channel)...
Work with new and *older* kombu versions
Work with new and *older* kombu versions
Python
bsd-3-clause
ask/django-kombu
54dbc3638ba376f29aa619e897c9b87238559ac3
billjobs/tests/tests_export_account_email.py
billjobs/tests/tests_export_account_email.py
from django.test import TestCase from django.http import HttpResponse from django.contrib.admin.sites import AdminSite from django.contrib.auth.models import User from billjobs.admin import UserAdmin class EmailExportTestCase(TestCase): """ Tests for email account export """ def test_method_is_avaible(self): ...
from django.test import TestCase from django.http import HttpResponse from django.contrib.admin.sites import AdminSite from django.contrib.auth.models import User from billjobs.admin import UserAdmin class MockRequest(object): pass class EmailExportTestCase(TestCase): """ Tests for email account expor...
Refactor test, test export email return text/csv content type
Refactor test, test export email return text/csv content type
Python
mit
ioO/billjobs
2c449a27be2e9e9ec57cc6f8e31825064195290d
modules/weather_module/weather_module.py
modules/weather_module/weather_module.py
import juliet_module from pygame import Rect from time import time from os import getcwd class weather_module(juliet_module.module): mod_name = "weather_module" __last_update = time() __api = None def __init__(self, _id, _keyfile): print("Initializing Weather Module") self.mod_id = _...
import juliet_module from pygame import Rect from time import time import forecastio class weather_module(juliet_module.module): mod_name = "weather_module" __last_update = time() __api = None __forecast = None def __init__(self, _id, _keyfile): print("Initializing Weather Module") ...
Add test forecast.io API call
Add test forecast.io API call
Python
bsd-2-clause
halfbro/juliet
4c18d98b456d8a9f231a7009079f9b00f732c92e
comics/crawler/crawlers/ctrlaltdelsillies.py
comics/crawler/crawlers/ctrlaltdelsillies.py
from comics.crawler.base import BaseComicCrawler from comics.crawler.meta import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Ctrl+Alt+Del Sillies' language = 'en' url = 'http://www.ctrlaltdel-online.com/' start_date = '2008-06-27' history_capable_date = '2008-06-27' schedule = 'Mo,Tu,...
from comics.crawler.base import BaseComicCrawler from comics.crawler.meta import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Ctrl+Alt+Del Sillies' language = 'en' url = 'http://www.ctrlaltdel-online.com/' start_date = '2008-06-27' history_capable_date = '2008-06-27' schedule = 'Mo,Tu,...
Update Ctrl+Alt+Del Sillies crawler with new URL
Update Ctrl+Alt+Del Sillies crawler with new URL
Python
agpl-3.0
klette/comics,datagutten/comics,klette/comics,datagutten/comics,jodal/comics,jodal/comics,jodal/comics,datagutten/comics,jodal/comics,klette/comics,datagutten/comics
8ce6a6144fee1c9ec6a5f1a083eabbb653d8514b
virtool/postgres.py
virtool/postgres.py
import logging import sys from sqlalchemy import text from sqlalchemy.ext.asyncio import AsyncConnection, create_async_engine logger = logging.getLogger(__name__) async def connect(postgres_connection_string: str) -> AsyncConnection: """ Create a connection of Postgres. :param postgres_connection_strin...
import logging import sys from sqlalchemy import text from sqlalchemy.ext.asyncio import AsyncConnection, create_async_engine import virtool.models logger = logging.getLogger(__name__) async def connect(postgres_connection_string: str) -> AsyncConnection: """ Create a connection of Postgres. :param pos...
Create tables on application start
Create tables on application start
Python
mit
virtool/virtool,virtool/virtool,igboyes/virtool,igboyes/virtool
49990a967471f615936025c17ac1411e2976f159
neuroimaging/utils/tests/test_odict.py
neuroimaging/utils/tests/test_odict.py
"""Test file for the ordered dictionary module, odict.py.""" from neuroimaging.externals.scipy.testing import * from neuroimaging.utils.odict import odict class TestOdict(TestCase): def setUp(self): print 'setUp' self.thedict = odict((('one', 1.0), ('two', 2.0), ('three', 3.0))) def test_cop...
"""Test file for the ordered dictionary module, odict.py.""" from neuroimaging.externals.scipy.testing import * from neuroimaging.utils.odict import odict class TestOdict(TestCase): def setUp(self): print 'setUp' self.thedict = odict((('one', 1.0), ('two', 2.0), ('three', 3.0))) def test_cop...
Fix nose call so tests run in __main__.
BUG: Fix nose call so tests run in __main__.
Python
bsd-3-clause
yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD
1dd06e1be96beb0088e58e06e9e775063e14b6ec
moksha/hub/reactor.py
moksha/hub/reactor.py
# This file is part of Moksha. # # Moksha is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Moksha is distributed in the hope that it...
# This file is part of Moksha. # # Moksha is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Moksha is distributed in the hope that it...
Fix a bug on platform detection on Mac OSX
Fix a bug on platform detection on Mac OSX
Python
apache-2.0
pombredanne/moksha,lmacken/moksha,ralphbean/moksha,pombredanne/moksha,mokshaproject/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha,lmacken/moksha,mokshaproject/moksha,pombredanne/moksha,ralphbean/moksha,mokshaproject/moksha
5c70751806c69bded77821b87d728821e37152c8
web/server.py
web/server.py
from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, jsonify, make_response import json from decorators import Monitor app = Flask(__name__) #app.wsgi_app = WSGIApplication(app.config['APPINSIGHTS_INSTRUMENTATION_KEY'], app.wsgi_app) @app.route('/') @Monitor.api() def index...
import os from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, jsonify, make_response import json from google.cloud import language from decorators import Monitor from blob_storage import BlobStorage app = Flask(__name__) #app.wsgi_app = WSGIApplication(app.config['APPINSIG...
Fix bugs in sentiment analysis code so entity sentiment is returned
Fix bugs in sentiment analysis code so entity sentiment is returned
Python
mit
harigov/newsalyzer,harigov/newsalyzer,harigov/newsalyzer
707fb2cabcfa9886c968e81964b59995c0b0f2b6
python/convert_line_endings.py
python/convert_line_endings.py
#!/usr/bin/python import os import sys def convert_line_endings(file): if '\r\n' in open(file, 'rb').read(): print '%s contains DOS line endings. Converting' % file with open(file, 'rb') as infile: text = infile.read() text = text.replace('\r\n', '\n') with open(file, 'wb') as outfile: ...
#!/usr/bin/python import os import sys def convert_line_endings(file): if '\r\n' in open(file, 'rb').read(): print '%s contains DOS line endings. Converting' % file with open(file, 'rb') as infile: text = infile.read() text = text.replace('\r\n', '\n') with open(file, 'wb') as outfile: ...
Convert line endings for .h, .c and .cpp files as well as .cs
[trunk] Convert line endings for .h, .c and .cpp files as well as .cs
Python
bsd-3-clause
markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation
ef0a6968dedad74ddd40bd4ae81595be6092f24f
wrapper/__init__.py
wrapper/__init__.py
__version__ = '2.2.0' from libsbol import * import unit_tests
from __future__ import absolute_import __version__ = '2.2.0' from sbol.libsbol import * import sbol.unit_tests
Fix import issue with Python 3.6/Support future Python by forcing absolute import
Fix import issue with Python 3.6/Support future Python by forcing absolute import
Python
apache-2.0
SynBioDex/libSBOL,SynBioDex/libSBOL,SynBioDex/libSBOL,SynBioDex/libSBOL
1403882c74850804e2c87cb359e21715610c64ef
pywinauto/controls/__init__.py
pywinauto/controls/__init__.py
# GUI Application automation and testing library # Copyright (C) 2015 Intel Corporation # Copyright (C) 2009 Mark Mc Mahon # # This library 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 v...
# GUI Application automation and testing library # Copyright (C) 2015 Intel Corporation # Copyright (C) 2009 Mark Mc Mahon # # This library 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 v...
Fix uia_controls registration only when UIA is supported
Fix uia_controls registration only when UIA is supported
Python
bsd-3-clause
MagazinnikIvan/pywinauto,vasily-v-ryabov/pywinauto,moden-py/pywinauto,cetygamer/pywinauto,airelil/pywinauto,drinkertea/pywinauto,pywinauto/pywinauto,moden-py/pywinauto
c2d1621e089b10418785e173145fb16b0759df1a
lib/jasy/core/Info.py
lib/jasy/core/Info.py
# # Jasy - JavaScript Tooling Refined # Copyright 2010 Sebastian Werner # import os, sys def root(): """ Returns the root path of Jasy """ return os.path.normpath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir)) def cldrData(what): return os.path.join(root(), "data", "c...
# # Jasy - JavaScript Tooling Refined # Copyright 2010 Sebastian Werner # import os, sys def root(): """ Returns the root path of Jasy """ return os.path.relpath(os.path.normpath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir))) return os.path.normpath(os.path.join(os.path.dirnam...
Reduce path to shortest possible from current dir.
Reduce path to shortest possible from current dir.
Python
mit
zynga/jasy,sebastian-software/jasy,zynga/jasy,sebastian-software/jasy
8d85db01b7582aa93c3b9871cb199277fae87d53
remote-scripts/BVT-VERIFY-HOSTNAME.py
remote-scripts/BVT-VERIFY-HOSTNAME.py
#!/usr/bin/python from azuremodules import * import argparse import sys import time #for error checking parser = argparse.ArgumentParser() parser.add_argument('-e', '--expected', help='specify expected hostname', required=True) args = parser.parse_args() #if no value specified then stop exp...
#!/usr/bin/python from azuremodules import * import argparse import sys import time import re #for error checking parser = argparse.ArgumentParser() parser.add_argument('-e', '--expected', help='specify expected hostname', required=True) args = parser.parse_args() #if no value specified the...
Add fqdn verification to BVT
Add fqdn verification to BVT
Python
apache-2.0
FreeBSDonHyper-V/azure-freebsd-automation,v-sirebb/azure-linux-automation,konkasoftci/azure-linux-automation,Nidylei/azure-linux-automation,Nidylei/azure-linux-automation,hglkrijger/azure-linux-automation,v-sirebb/azure-linux-automation,v-sirebb/azure-linux-automation,iamshital/azure-linux-automation,konkasoftci/azure-...
862f877cdcdef7aa4a853b2cce8eed2d7ba95fdc
providers/org/cogprints/apps.py
providers/org/cogprints/apps.py
from share.provider import OAIProviderAppConfig class AppConfig(OAIProviderAppConfig): name = 'providers.org.cogprints' version = '0.0.1' title = 'cogprints' long_title = 'Cognitive Sciences ePrint Archive' home_page = 'http://www.cogprints.org/' url = 'http://cogprints.org/cgi/oai2'
from share.provider import OAIProviderAppConfig class AppConfig(OAIProviderAppConfig): name = 'providers.org.cogprints' version = '0.0.1' title = 'cogprints' long_title = 'Cognitive Sciences ePrint Archive' home_page = 'http://www.cogprints.org/' url = 'http://cogprints.org/cgi/oai2' emitt...
Update cogprints to emit preprints
Update cogprints to emit preprints
Python
apache-2.0
aaxelb/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,zamattiac/SHARE,laurenbarker/SHARE,laurenbarker/SHARE,aaxelb/SHARE,zamattiac/SHARE,aaxelb/SHARE,zamattiac/SHARE,laurenbarker/SHARE,CenterForOpenScience/SHARE
55fd840b06c5481ff5e3171dba1ef98d973f0747
nlppln/wfgenerator.py
nlppln/wfgenerator.py
from scriptcwl import WorkflowGenerator as WFGenerator from .utils import CWL_PATH class WorkflowGenerator(WFGenerator): def __init__(self): WFGenerator.__init__(self, steps_dir=CWL_PATH) def save(self, fname, inline=True, relative=False, validate=True, encoding='utf-8'): """Sav...
from scriptcwl import WorkflowGenerator as WFGenerator from .utils import CWL_PATH class WorkflowGenerator(WFGenerator): def __init__(self, working_dir=None, copy_steps=True): WFGenerator.__init__(self, steps_dir=CWL_PATH, working_dir=working_dir, copy_steps=copy_steps) ...
Add working_dir and copy_steps options
Add working_dir and copy_steps options
Python
apache-2.0
WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln