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
9aa17b90b8f3413f0621cc25a686774dd809dc84
frigg/projects/serializers.py
frigg/projects/serializers.py
from rest_framework import serializers from frigg.builds.serializers import BuildInlineSerializer from .models import Project class ProjectSerializer(serializers.ModelSerializer): builds = BuildInlineSerializer(read_only=True, many=True) class Meta: model = Project fields = ( 'i...
from rest_framework import serializers from frigg.builds.serializers import BuildInlineSerializer from .models import Project class EnvironmentVariableSerializer(serializers.ModelSerializer): def to_representation(self, instance): representation = super().to_representation(instance) if instance...
Add drf serializer for environment variables
feat: Add drf serializer for environment variables
Python
mit
frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq
4bcf35efcfc751a1c337fdcf50d23d9d06549717
demo/apps/catalogue/models.py
demo/apps/catalogue/models.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailcore.models import Page class Category(Page): """ user oscars category as a wagtail Page. this works becuase they both use treebeard """ name = models.CharField( verbose_name=_('name')...
from django.db import models from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailcore.models import Page class Category(Page): """ The Oscars Category as a Wagtail Page This works because they both use Treebeard """ name = models.CharField( verbose_name=_('name'), ...
Fix typo in doc string
Fix typo in doc string
Python
mit
pgovers/oscar-wagtail-demo,pgovers/oscar-wagtail-demo
0a69133e44810dd0469555f62ec49eba120e6ecc
apps/storybase/utils.py
apps/storybase/utils.py
"""Shared utility functions""" from django.template.defaultfilters import slugify as django_slugify def slugify(value): """ Normalizes string, converts to lowercase, removes non-alpha characters, converts spaces to hyphens, and truncates to 50 characters. """ slug = django_slugify(value) slug ...
"""Shared utility functions""" from django.conf import settings from django.template.defaultfilters import slugify as django_slugify from django.utils.translation import ugettext as _ def get_language_name(language_code): """Convert a language code into its full (localized) name""" languages = dict(settings.L...
Add utility function to convert a language code to a its full name
Add utility function to convert a language code to a its full name
Python
mit
denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase
62b1c49c67c72c36d4177c657df49a4700586c06
djangoTemplate/urls.py
djangoTemplate/urls.py
"""djangoTemplate URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ """ from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url('', include('base.urls')), url('', ...
"""djangoTemplate URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ """ from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url('', include('base.urls')), url('', ...
Change the url patters from python_social_auth to social_django
Change the url patters from python_social_auth to social_django
Python
mit
tosp/djangoTemplate,tosp/djangoTemplate
62f4c6b7d24176284054b13c4e1e9b6d631c7b42
basicTest.py
basicTest.py
import slither, pygame, time snakey = slither.Sprite() snakey.setCostumeByName("costume0") SoExcited = slither.Sprite() SoExcited.addCostume("SoExcited.png", "avatar") SoExcited.setCostumeByNumber(0) SoExcited.goTo(300, 300) SoExcited.setScaleTo(0.33) slither.slitherStage.setColor(40, 222, 40) screen = slither.se...
import slither, pygame, time snakey = slither.Sprite() snakey.setCostumeByName("costume0") SoExcited = slither.Sprite() SoExcited.addCostume("SoExcited.png", "avatar") SoExcited.setCostumeByNumber(0) SoExcited.goTo(300, 300) SoExcited.setScaleTo(0.33) slither.slitherStage.setColor(40, 222, 40) screen = slither.se...
Update basic test Now uses the new format by @BookOwl.
Update basic test Now uses the new format by @BookOwl.
Python
mit
PySlither/Slither,PySlither/Slither
890190f40b9061f7bfa15bbd7e56abc0f1b7d44a
redmapper/__init__.py
redmapper/__init__.py
from __future__ import division, absolute_import, print_function from ._version import __version__, __version_info__ version = __version__ from .configuration import Configuration from .runcat import RunCatalog from .solver_nfw import Solver from .catalog import DataObject, Entry, Catalog from .redsequence import Re...
from __future__ import division, absolute_import, print_function from ._version import __version__, __version_info__ version = __version__ from .configuration import Configuration from .runcat import RunCatalog from .solver_nfw import Solver from .catalog import DataObject, Entry, Catalog from .redsequence import Re...
Make fitters available at main import level.
Make fitters available at main import level.
Python
apache-2.0
erykoff/redmapper,erykoff/redmapper
aa8234d1e6b4916e6945468a2bc5772df2d53e28
bot/admin.py
bot/admin.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from . import models @admin.register(models.Notification) class NotificationAdmin(admin.ModelAdmin): list_display = ('launch', 'last_net_stamp', 'last_twitter_post', 'last_notification_sent', 'las...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from . import models @admin.register(models.Notification) class NotificationAdmin(admin.ModelAdmin): list_display = ('launch', 'last_net_stamp', 'last_twitter_post', 'last_notification_sent', 'las...
Add Discord Admin for debugging.
Add Discord Admin for debugging.
Python
apache-2.0
ItsCalebJones/SpaceLaunchNow-Server,ItsCalebJones/SpaceLaunchNow-Server,ItsCalebJones/SpaceLaunchNow-Server
e9fbd541b3fcb84c6d2de9ba1de53886730a67fa
common.py
common.py
import os def get_project_path(): root_dir = os.path.abspath(os.path.dirname(__file__)) return root_dir
import os def get_project_path(): root_dir = os.path.abspath(os.path.dirname(__file__)) return root_dir def get_yourproject_path(): root_dir = os.path.abspath(os.path.dirname(__file__)) return root_dir
Add new changes to th branch
Add new changes to th branch
Python
mit
nvthanh1/Skypybot
53ad3866b8dfbd012748e4ad7d7ed7025d491bd0
src/alexa-main.py
src/alexa-main.py
import handlers.events as events APPLICATION_ID = "amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0" def lambda_handler(event, context): if event['session']['new']: events.on_session_started({'requestId': event['request']['requestId']}, event['session']) request...
import handlers.events as events APPLICATION_ID = "amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0" def lambda_handler(event, context): # Make sure only this Alexa skill can use this function if event['session']['application']['applicationId'] != APPLICATION_ID: raise ValueError("Invalid Applica...
REVERT remove application id validation
REVERT remove application id validation
Python
mit
mauriceyap/ccm-assistant
5cd674ec764be72bb3e94c0b56fdf733a4a1c885
Discord/utilities/errors.py
Discord/utilities/errors.py
from discord.ext.commands.errors import CommandError class NotServerOwner(CommandError): '''Not Server Owner''' pass class VoiceNotConnected(CommandError): '''Voice Not Connected''' pass class PermittedVoiceNotConnected(VoiceNotConnected): '''Permitted, but Voice Not Connected''' pass class NotPermittedVoice...
from discord.ext.commands.errors import CommandError class NotServerOwner(CommandError): '''Not Server Owner''' pass class VoiceNotConnected(CommandError): '''Voice Not Connected''' pass class PermittedVoiceNotConnected(VoiceNotConnected): '''Permitted, but Voice Not Connected''' pass class NotPermittedVoice...
Remove Audio Already Done error
[Discord] Remove Audio Already Done error
Python
mit
Harmon758/Harmonbot,Harmon758/Harmonbot
c97e5cf11fc21e2ef4ee04779a424e4d6a2b96ae
tools/perf/metrics/__init__.py
tools/perf/metrics/__init__.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. class Metric(object): """Base class for all the metrics that are used by telemetry measurements. The Metric class represents a way of measuring somethin...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. class Metric(object): """Base class for all the metrics that are used by telemetry measurements. The Metric class represents a way of measuring somethin...
Add CustomizeBrowserOptions method to Metric base class
Add CustomizeBrowserOptions method to Metric base class BUG=271177 Review URL: https://chromiumcodereview.appspot.com/22938004 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@217198 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
mogoweb/chromium-crosswalk,Just-D/chromium-1,M4sse/chromium.src,dushu1203/chromium.src,Jonekee/chromium.src,Just-D/chromium-1,ChromiumWebApps/chromium,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,PeterWangIntel/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,markYoungH/chromium.src,M4sse/chr...
f9c7a911411429972929bb4372b370192bd4cf8a
altair/examples/interactive_layered_crossfilter.py
altair/examples/interactive_layered_crossfilter.py
""" Interactive Crossfilter ======================= This example shows a multi-panel view of the same data, where you can interactively select a portion of the data in any of the panels to highlight that portion in any of the other panels. """ # category: interactive charts import altair as alt from vega_datasets impor...
""" Interactive Crossfilter ======================= This example shows a multi-panel view of the same data, where you can interactively select a portion of the data in any of the panels to highlight that portion in any of the other panels. """ # category: interactive charts import altair as alt from vega_datasets impor...
Update crossfilter to gray/blue scheme
Update crossfilter to gray/blue scheme Same as in https://vega.github.io/editor/#/examples/vega-lite/interactive_layered_crossfilter
Python
bsd-3-clause
altair-viz/altair,jakevdp/altair
6064db3000f2aeec66a775345d22b8a2b421497f
astropy/utils/tests/test_gzip.py
astropy/utils/tests/test_gzip.py
import io import os from ...tests.helper import pytest from .. import gzip def test_gzip(tmpdir): fd = gzip.GzipFile(str(tmpdir.join("test.gz")), 'wb') fd = io.TextIOWrapper(fd, encoding='utf8')
import io import os from ...tests.helper import pytest from .. import gzip pytestmark = pytest.mark.skipif("sys.version_info < (3,0)") def test_gzip(tmpdir): fd = gzip.GzipFile(str(tmpdir.join("test.gz")), 'wb') fd = io.TextIOWrapper(fd, encoding='utf8')
Fix gzip test for Python 2.6
Fix gzip test for Python 2.6
Python
bsd-3-clause
tbabej/astropy,bsipocz/astropy,lpsinger/astropy,MSeifert04/astropy,StuartLittlefair/astropy,larrybradley/astropy,DougBurke/astropy,stargaser/astropy,pllim/astropy,stargaser/astropy,MSeifert04/astropy,tbabej/astropy,lpsinger/astropy,joergdietrich/astropy,astropy/astropy,joergdietrich/astropy,dhomeier/astropy,kelle/astro...
853c727c472efc09df90cb016bd05f81d4cf5e8e
beetle_preview/__init__.py
beetle_preview/__init__.py
from http import server from socketserver import TCPServer import os class Server: def __init__(self, own_config, config, builder): self.directory = config.folders['output'] self.port = own_config.get('port', 5000) self.builder = builder def serve(self): os.chdir(self.director...
from http import server from socketserver import TCPServer import os class Server: def __init__(self, own_config, config, builder): self.directory = config.folders['output'] self.port = own_config.get('port', 5000) self.builder = builder def serve(self): os.chdir(self.director...
Print a line telling where the site is available at
Print a line telling where the site is available at
Python
mit
cknv/beetle-preview
b474c7368f3a8152296acf9cad7459510b71ada5
fs/opener/sshfs.py
fs/opener/sshfs.py
from ._base import Opener from ._registry import registry @registry.install class SSHOpener(Opener): protocols = ['ssh'] @staticmethod def open_fs(fs_url, parse_result, writeable, create, cwd): from ..sshfs import SSHFS ssh_host, _, dir_path = parse_result.resource.partition('/') ...
from ._base import Opener from ._registry import registry from ..subfs import ClosingSubFS @registry.install class SSHOpener(Opener): protocols = ['ssh'] @staticmethod def open_fs(fs_url, parse_result, writeable, create, cwd): from ..sshfs import SSHFS ssh_host, _, dir_path = parse_result....
Fix SSHOpener to use the new ClosingSubFS
Fix SSHOpener to use the new ClosingSubFS
Python
lgpl-2.1
althonos/fs.sshfs
f70bbbdadc044a76f7b90b2cac0191353a6a5048
depfinder.py
depfinder.py
import ast def get_imported_libs(code): tree = ast.parse(code) # ast.Import represents lines like 'import foo' and 'import foo, bar' # the extra for name in t.names is needed, because names is a list that # would be ['foo'] for the first and ['foo', 'bar'] for the second imports = [name.name.split...
import ast import os from collections import deque import sys from stdlib_list import stdlib_list conf = { 'ignore_relative_imports': True, 'ignore_builtin_modules': True, 'pyver': None, } def get_imported_libs(code): tree = ast.parse(code) imports = deque() for t in tree.body: # ast....
Rework the import finding logic
MNT: Rework the import finding logic
Python
bsd-3-clause
ericdill/depfinder
2a8c4790bd432fc4dc0fdda64c0cea4f76fac9ff
feincms/context_processors.py
feincms/context_processors.py
from feincms.module.page.models import Page def add_page_if_missing(request): # If this attribute exists, the a page object has been registered already # by some other part of the code. We let it decide, which page object it # wants to pass into the template if hasattr(request, '_feincms_page'): ...
from feincms.module.page.models import Page def add_page_if_missing(request): # If this attribute exists, the a page object has been registered already # by some other part of the code. We let it decide, which page object it # wants to pass into the template if hasattr(request, '_feincms_page'): ...
Fix add_page_if_missing context processor when no pages exist yet
Fix add_page_if_missing context processor when no pages exist yet
Python
bsd-3-clause
matthiask/feincms2-content,hgrimelid/feincms,nickburlett/feincms,michaelkuty/feincms,michaelkuty/feincms,hgrimelid/feincms,feincms/feincms,pjdelport/feincms,joshuajonah/feincms,pjdelport/feincms,michaelkuty/feincms,joshuajonah/feincms,matthiask/feincms2-content,matthiask/django-content-editor,matthiask/django-content-e...
efa36e1013e44fa75f6a77a74bd8bf21f3120976
django_facebook/models.py
django_facebook/models.py
from django.db import models from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect class FacebookProfileModel(models.Model): ''' Abstract class to add to your profile model. NOTE: If you don't use this this abstract class, make sure you copy/paste the fields in....
from django.db import models from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect class FacebookProfileModel(models.Model): ''' Abstract class to add to your profile model. NOTE: If you don't use this this abstract class, make sure you copy/paste the fields in....
Allow for a longer image path
Allow for a longer image path My profile image for example does not fit in the default VARCHAR(100)
Python
bsd-3-clause
fivejjs/Django-facebook,troygrosfield/Django-facebook,danosaure/Django-facebook,rafaelgontijo/Django-facebook-fork,abendleiter/Django-facebook,pjdelport/Django-facebook,fivejjs/Django-facebook,abendleiter/Django-facebook,abendleiter/Django-facebook,andriisoldatenko/Django-facebook,ganescoo/Django-facebook,VishvajitP/Dj...
78a03f0b0cbc948a6c9fb215e9051d099c528a82
src/app.py
src/app.py
from flask import Flask from flask import render_template, url_for import parse_data app = Flask(__name__) @app.route("/dashboard") def dashboard(): data = parse_data.load_and_format_data() title = 'Grand Bargain Monitoring' return render_template('dashboard.html', data=data, heading=title, page_title...
from flask import Flask from flask import render_template, url_for import parse_data app = Flask(__name__) @app.route("/dashboard") def dashboard(): data = parse_data.load_and_format_data() title = 'Grand Bargain Transparency Dashboard' return render_template('dashboard.html', data=data, heading=title...
Change page title and heading
Change page title and heading
Python
mit
devinit/grand-bargain-monitoring,devinit/grand-bargain-monitoring,devinit/grand-bargain-monitoring
6b7e32c98fa8a11dcd7bbbadaa2a057e4ff0ce90
f5_os_test/__init__.py
f5_os_test/__init__.py
# Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
# Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
Add function to create name strings with random characters
Add function to create name strings with random characters Issues: Fixes #48 Problem: Need a function that will generate names with random chars. Analysis: Added new function, random_name(). Tests: test_solution.py
Python
apache-2.0
F5Networks/f5-openstack-test,pjbreaux/f5-openstack-test
1a98b29293ccfab6534a48402414e89726d8e5bb
Python/pomodoro.py
Python/pomodoro.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import subprocess as spr import time def main(): start = datetime.datetime.now() spr.call(['notify-send', 'Started new pomodoro']) time.sleep(30 * 60) end = datetime.datetime.now() duration = (end - start).total_seconds() // 60 fo...
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import subprocess as spr import time def main(): start = datetime.datetime.now() start_str = start.strftime("%H:%M:%S") spr.call(['notify-send', '--app-name', 'POMODORO', '--icon', 'dialog-information', ...
Set icon, summary for notification
Set icon, summary for notification
Python
bsd-2-clause
familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG
d9a6071674857ceae566d29c7c77a31a5ed5214d
byceps/blueprints/api/decorators.py
byceps/blueprints/api/decorators.py
""" byceps.blueprints.api.decorators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from functools import wraps from typing import Optional from flask import abort, request from ...services.authentication.api import service as a...
""" byceps.blueprints.api.decorators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from functools import wraps from typing import Optional from flask import abort, request from werkzeug.datastructures import WWWAuthenticate fro...
Return proper WWW-Authenticate header if API authentication fails
Return proper WWW-Authenticate header if API authentication fails
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
ab4ae040895c50da6cb0827f6461d1733c7fe30a
tests/test_plugin_states.py
tests/test_plugin_states.py
from contextlib import contextmanager from os import path from unittest import TestCase from canaryd_packages import six from dictdiffer import diff from jsontest import JsonTest from mock import patch from canaryd.plugin import get_plugin_by_name @six.add_metaclass(JsonTest) class TestPluginStates(TestCase): j...
from contextlib import contextmanager from os import path from unittest import TestCase from dictdiffer import diff from jsontest import JsonTest from mock import patch from canaryd_packages import six from canaryd.plugin import get_plugin_by_name class TestPluginRealStates(TestCase): def run_plugin(self, plug...
Add real plugin state tests for plugins that always work (meta, containers, services).
Add real plugin state tests for plugins that always work (meta, containers, services).
Python
mit
Oxygem/canaryd,Oxygem/canaryd
26dcd1ce43864de77c1cd26065c09cc2b4c4788e
tests/fuzzer/test_random_content.py
tests/fuzzer/test_random_content.py
# Copyright (c) 2016 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. import pytest import fuzzinator @pytest.mark.parametrize('fuzzer_kwa...
# Copyright (c) 2016-2021 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. import pytest import fuzzinator @pytest.mark.parametrize('fuzze...
Make use of chained comparisons
Make use of chained comparisons
Python
bsd-3-clause
akosthekiss/fuzzinator,akosthekiss/fuzzinator,akosthekiss/fuzzinator,renatahodovan/fuzzinator,renatahodovan/fuzzinator,renatahodovan/fuzzinator,akosthekiss/fuzzinator,renatahodovan/fuzzinator
c79cedf826a3b6ee89e6186954185ef3217dd901
tomviz/python/InvertData.py
tomviz/python/InvertData.py
import tomviz.operators NUMBER_OF_CHUNKS = 10 class InvertOperator(tomviz.operators.CancelableOperator): def transform_scalars(self, dataset): from tomviz import utils import numpy as np self.progress.maximum = NUMBER_OF_CHUNKS scalars = utils.get_scalars(dataset) if sca...
import tomviz.operators NUMBER_OF_CHUNKS = 10 class InvertOperator(tomviz.operators.CancelableOperator): def transform_scalars(self, dataset): from tomviz import utils import numpy as np self.progress.maximum = NUMBER_OF_CHUNKS scalars = utils.get_scalars(dataset) if sca...
Add the minimum scalar value to the result of the InvertOperator
Add the minimum scalar value to the result of the InvertOperator Without it, all results would be shifted so the minimum was 0.
Python
bsd-3-clause
OpenChemistry/tomviz,mathturtle/tomviz,OpenChemistry/tomviz,mathturtle/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz,mathturtle/tomviz
47053a42b9053755aad052159dac845b34195297
config/test/__init__.py
config/test/__init__.py
from SCons.Script import * def run_tests(env): import shlex import subprocess import sys cmd = shlex.split(env.get('TEST_COMMAND')) print('Executing:', cmd) sys.exit(subprocess.call(cmd)) def generate(env): import os import distutils.spawn python = distutils.spawn.find_executab...
from SCons.Script import * import inspect def run_tests(env): import shlex import subprocess import sys cmd = shlex.split(env.get('TEST_COMMAND')) print('Executing:', cmd) sys.exit(subprocess.call(cmd)) def generate(env): import os import distutils.spawn python = distutils.spaw...
Use common testHarness in derived projects
Use common testHarness in derived projects
Python
lgpl-2.1
CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang,CauldronDevelopmentLLC/cbang
37831f549eddc014ab89cc7dba3616a133c774a2
api/BucketListAPI.py
api/BucketListAPI.py
from flask import Flask, jsonify from modals.modals import User, Bucket, Item from api.__init__ import app, db @app.errorhandler(404) def page_not_found(e): response = jsonify({'error': 'The request can not be completed'}) response.status_code = 404 return response if __name__ == '__main__': app.run...
from flask import Flask, jsonify from modals.modals import User, Bucket, Item from api.__init__ import create_app, db app = create_app('DevelopmentEnv') @app.errorhandler(404) def page_not_found(e): response = jsonify({'error': 'The request can not be completed'}) response.status_code = 404 return respon...
Add create_app method to __init__.py
Add create_app method to __init__.py
Python
mit
patlub/BucketListAPI,patlub/BucketListAPI
4b5dd61607c9692bb330f89545d5f76d7a1ed221
puzzle/feeds.py
puzzle/feeds.py
""" Generate an RSS feed of published crosswords from staff users. Uses the built-in feed framework. There's no attempt to send the actual crossword, it's just a message indicating that a new one is available. """ from django.contrib.syndication.views import Feed from django.urls import reverse from django.utils impo...
""" Generate an RSS feed of published crosswords from staff users. Uses the built-in feed framework. There's no attempt to send the actual crossword, it's just a message indicating that a new one is available. """ from django.contrib.syndication.views import Feed from django.urls import reverse from django.utils impo...
Fix linkage in the RSS feed
Fix linkage in the RSS feed
Python
mit
jomoore/threepins,jomoore/threepins,jomoore/threepins
a0ceb84519d1bf735979b3afdfdb8b17621d308b
froide/problem/admin.py
froide/problem/admin.py
from django.contrib import admin from django.utils.html import format_html from django.urls import reverse from django.utils.translation import gettext_lazy as _ from froide.helper.admin_utils import make_nullfilter from .models import ProblemReport class ProblemReportAdmin(admin.ModelAdmin): date_hierarchy = '...
from django.contrib import admin from django.utils.html import format_html from django.urls import reverse from django.utils.translation import gettext_lazy as _ from froide.helper.admin_utils import make_nullfilter from .models import ProblemReport class ProblemReportAdmin(admin.ModelAdmin): date_hierarchy = '...
Fix overwriting resolution with empty text
Fix overwriting resolution with empty text
Python
mit
stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide
1171ade137c54c778a284ef32fdbdcd9e5c1d828
runcommands/runners/result.py
runcommands/runners/result.py
from ..util import cached_property class Result: def __init__(self, return_code, stdout_data, stderr_data, encoding): self.return_code = return_code self.stdout_data = stdout_data self.stderr_data = stderr_data self.encoding = encoding self.succeeded = self.return_code == ...
from ..util import cached_property class Result: def __init__(self, return_code, stdout_data, stderr_data, encoding): self.return_code = return_code self.stdout_data = stdout_data self.stderr_data = stderr_data self.encoding = encoding self.succeeded = self.return_code == ...
Add __repr__() and __str__() to Result
Add __repr__() and __str__() to Result
Python
mit
wylee/runcommands,wylee/runcommands
ed45c8201977aecde226b2e9b060820a8fd677c3
test/functional/rpc_deprecated.py
test/functional/rpc_deprecated.py
#!/usr/bin/env python3 # Copyright (c) 2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test deprecation of RPC calls.""" from test_framework.test_framework import BitcoinTestFramework from test_f...
#!/usr/bin/env python3 # Copyright (c) 2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test deprecation of RPC calls.""" from test_framework.test_framework import BitcoinTestFramework class Depr...
Remove test for deprecated createmultsig option
[tests] Remove test for deprecated createmultsig option
Python
mit
guncoin/guncoin,AkioNak/bitcoin,tjps/bitcoin,myriadteam/myriadcoin,tjps/bitcoin,tecnovert/particl-core,vmp32k/litecoin,jamesob/bitcoin,achow101/bitcoin,jtimon/bitcoin,particl/particl-core,DigitalPandacoin/pandacoin,MarcoFalke/bitcoin,kazcw/bitcoin,cdecker/bitcoin,andreaskern/bitcoin,paveljanik/bitcoin,Kogser/bitcoin,an...
09c3b752154478b15a45d11f08d46a5003f174ec
giveaminute/keywords.py
giveaminute/keywords.py
""" :copyright: (c) 2011 Local Projects, all rights reserved :license: Affero GNU GPL v3, see LICENSE for more details. """ from framework.controller import log # find keywords in a string def getKeywords(db, s): """Get all matches for passed in string in keyword tables :param db: database handle ...
""" :copyright: (c) 2011 Local Projects, all rights reserved :license: Affero GNU GPL v3, see LICENSE for more details. """ # find keywords in a string def getKeywords(db, s): sql = "select keyword from keyword" data = list(db.query(sql)) words = [] for d in data: if (d.keywor...
Revert keyword optimization for current release
Revert keyword optimization for current release
Python
agpl-3.0
codeforeurope/Change-By-Us,watchcat/cbu-rotterdam,codeforeurope/Change-By-Us,codeforeurope/Change-By-Us,codeforeurope/Change-By-Us,watchcat/cbu-rotterdam,localprojects/Change-By-Us,watchcat/cbu-rotterdam,watchcat/cbu-rotterdam,watchcat/cbu-rotterdam,localprojects/Change-By-Us,localprojects/Change-By-Us,localprojects/Ch...
d7001ccab0879e17308bf2dc945b5fd3b726be27
statblock/dice.py
statblock/dice.py
from random import random class Die: """ Abstracts the random dice throw. Roll will produce the result. The die can be further parametrized by a multiplicator and/or a modifier, like 2 * Die(8) +4. """ def __init__(self, number, multiplicator=1, modifier=0): self.number = number ...
from random import random class Die: """ Abstracts the random dice throw. Roll will produce the result. The die can be further parametrized by a multiplicator and/or a modifier, like 2 * Die(8) +4. """ def __init__(self, number, multiplicator=1, modifier=0): self.number = number ...
Write the critical multiplier or the range when the damage gets converted into a String
Write the critical multiplier or the range when the damage gets converted into a String
Python
mit
bkittelmann/statblock
95f7c6cba7c4077053899e3ca01c8ffd3172873c
grouprise/core/views.py
grouprise/core/views.py
import json import django from rules.contrib.views import PermissionRequiredMixin class PermissionMixin(PermissionRequiredMixin): @property def raise_exception(self): return self.request.user.is_authenticated class AppConfig: def __init__(self): self._settings = {} self._defaul...
import json import django from django_filters.views import FilterMixin from rules.contrib.views import PermissionRequiredMixin class PermissionMixin(PermissionRequiredMixin): @property def raise_exception(self): return self.request.user.is_authenticated class TemplateFilterMixin(FilterMixin): ...
Add view mixin for working with filters in templates
Add view mixin for working with filters in templates
Python
agpl-3.0
stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten
a789e8bf574973259c0461b99fb9a486abed6e23
systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
from pprint import pprint from netaddr import * def merge(dbag, ip): added = False for dev in dbag: if dev == "id": continue for address in dbag[dev]: if address['public_ip'] == ip['public_ip']: dbag[dev].remove(address) if ip['add']: ipo = IPNet...
from pprint import pprint from netaddr import * def merge(dbag, ip): added = False for dev in dbag: if dev == "id": continue for address in dbag[dev]: if address['public_ip'] == ip['public_ip']: dbag[dev].remove(address) if ip['add']: ipo = IPNet...
Fix a bug that would add updated control ip address instead of replace
Fix a bug that would add updated control ip address instead of replace
Python
apache-2.0
jcshen007/cloudstack,resmo/cloudstack,resmo/cloudstack,GabrielBrascher/cloudstack,resmo/cloudstack,jcshen007/cloudstack,jcshen007/cloudstack,jcshen007/cloudstack,GabrielBrascher/cloudstack,resmo/cloudstack,GabrielBrascher/cloudstack,GabrielBrascher/cloudstack,wido/cloudstack,resmo/cloudstack,DaanHoogland/cloudstack,Gab...
67ebe8da58384529c49673e2314d4fc228aebe9e
python/testData/inspections/PyPackageRequirementsInspection/ImportsNotInRequirementsTxt/test1.py
python/testData/inspections/PyPackageRequirementsInspection/ImportsNotInRequirementsTxt/test1.py
import pip import <weak_warning descr="Package 'opster' is not listed in project requirements">opster</weak_warning> from <weak_warning descr="Package 'clevercss' is not listed in project requirements">clevercss</weak_warning> import convert import <weak_warning descr="Package 'django' is not listed in project requirem...
import pip import <weak_warning descr="Package containing module 'opster' is not listed in project requirements">opster</weak_warning> from <weak_warning descr="Package containing module 'clevercss' is not listed in project requirements">clevercss</weak_warning> import convert import <weak_warning descr="Package contai...
Fix test data for PyPackageRequirementsInspectionTest.testImportsNotInRequirementsTxt.
Fix test data for PyPackageRequirementsInspectionTest.testImportsNotInRequirementsTxt.
Python
apache-2.0
apixandru/intellij-community,da1z/intellij-community,mglukhikh/intellij-community,allotria/intellij-community,ibinti/intellij-community,suncycheng/intellij-community,apixandru/intellij-community,da1z/intellij-community,ibinti/intellij-community,vvv1559/intellij-community,ibinti/intellij-community,ThiagoGarciaAlves/inte...
ed91a6832d459dffa18d1b2d7b827b6aa6da2627
src/sentry/api/endpoints/team_project_index.py
src/sentry/api/endpoints/team_project_index.py
from __future__ import absolute_import from rest_framework import serializers, status from rest_framework.response import Response from sentry.api.bases.team import TeamEndpoint from sentry.api.permissions import assert_perm from sentry.api.serializers import serialize from sentry.constants import MEMBER_ADMIN from s...
from __future__ import absolute_import from rest_framework import serializers, status from rest_framework.response import Response from sentry.api.base import DocSection from sentry.api.bases.team import TeamEndpoint from sentry.api.permissions import assert_perm from sentry.api.serializers import serialize from sent...
Add team project list to docs
Add team project list to docs
Python
bsd-3-clause
BuildingLink/sentry,JamesMura/sentry,mvaled/sentry,beeftornado/sentry,JamesMura/sentry,ngonzalvez/sentry,Kryz/sentry,fuziontech/sentry,nicholasserra/sentry,TedaLIEz/sentry,JackDanger/sentry,songyi199111/sentry,BayanGroup/sentry,songyi199111/sentry,1tush/sentry,kevinlondon/sentry,gg7/sentry,jokey2k/sentry,Natim/sentry,v...
a8a0dd55a5289825aae34aa45765ea328811523e
spotpy/unittests/test_fast.py
spotpy/unittests/test_fast.py
import unittest try: import spotpy except ImportError: import sys sys.path.append(".") import spotpy from spotpy.examples.spot_setup_hymod_python import spot_setup class TestFast(unittest.TestCase): def setUp(self): self.spot_setup = spot_setup() self.rep = 200 # REP must be a...
import unittest try: import spotpy except ImportError: import sys sys.path.append(".") import spotpy from spotpy.examples.spot_setup_hymod_python import spot_setup # Test only untder Python 3 as Python >2.7.10 results in a strange fft error if sys.version_info >= (3, 5): class TestFast(unittest...
Exclude Fast test for Python 2
Exclude Fast test for Python 2
Python
mit
bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy,thouska/spotpy,bees4ever/spotpy,thouska/spotpy
5ab0c1c1323b2b12a19ef58de4c03236db84644d
cellcounter/accounts/urls.py
cellcounter/accounts/urls.py
from django.conf.urls import patterns, url from cellcounter.accounts import views urlpatterns = patterns('', url('^new/$', views.RegistrationView.as_view(), name='register'), url('^(?P<pk>[0-9]+)/$', views.UserDetailView.as_view(), name='user-detail'), url('^(?P<pk>[0-9]+)/delete/$', views.UserDeleteView....
from django.conf.urls import patterns, url from cellcounter.accounts import views urlpatterns = patterns('', url('^new/$', views.RegistrationView.as_view(), name='register'), url('^(?P<pk>[0-9]+)/$', views.UserDetailView.as_view(), name='user-detail'), url('^(?P<pk>[0-9]+)/delete/$', views.UserDeleteView....
Remove old views and replace with new PasswordResetConfirmView
Remove old views and replace with new PasswordResetConfirmView
Python
mit
haematologic/cellcounter,haematologic/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,haematologic/cellcounter,cellcounter/cellcounter
f0acf5023db56e8011a6872f230514a69ec9f311
extractor.py
extractor.py
import extractor.ui.mainapplication as ui import Tkinter as tk def main(): root = tk.Tk() root.title('SNES Wolfenstein 3D Extractor') root.minsize(400, 100) ui.MainApplication(root).pack(side="top", fill="both", expand=True) root.mainloop() main()
import extractor.ui.mainapplication as ui import Tkinter as tk def main(): ## root = tk.Tk() ## root.title('SNES Wolfenstein 3D Extractor') ## root.minsize(400, 100) ## ui.MainApplication(root).pack(side="top", fill="both", expand=True) ## root.mainloop() ui.MainApplication().mainloop() main()
Use new MainApplication Tk class.
Use new MainApplication Tk class.
Python
mit
adambiser/snes-wolf3d-extractor
ce9da309294f2520f297980d80773160f050e8bf
yubico/yubico_exceptions.py
yubico/yubico_exceptions.py
class YubicoError(Exception): """ Base class for Yubico related exceptions. """ pass class StatusCodeError(YubicoError): def __init__(self, status_code): self.status_code = status_code def __str__(self): return ('Yubico server returned the following status code: %s' % ...
__all___ = [ 'YubicoError', 'StatusCodeError', 'InvalidClientIdError', 'SignatureVerificationError' ] class YubicoError(Exception): """ Base class for Yubico related exceptions. """ pass class StatusCodeError(YubicoError): def __init__(self, status_code): self.status_code = statu...
Add __all__ in exceptions module.
Add __all__ in exceptions module.
Python
bsd-3-clause
Kami/python-yubico-client
682f45ffd222dc582ee770a0326c962540657c68
django_twilio/models.py
django_twilio/models.py
# -*- coding: utf-8 -*- from django.db import models from phonenumber_field.modelfields import PhoneNumberField class Caller(models.Model): """A caller is defined uniquely by their phone number. :param bool blacklisted: Designates whether the caller can use our services. :param char phone_number...
# -*- coding: utf-8 -*- from django.db import models from phonenumber_field.modelfields import PhoneNumberField class Caller(models.Model): """A caller is defined uniquely by their phone number. :param bool blacklisted: Designates whether the caller can use our services. :param char phone_number...
Fix an error in __unicode__
Fix an error in __unicode__ __unicode__ name displaying incorrectly - FIXED
Python
unlicense
rdegges/django-twilio,aditweb/django-twilio
69a8528801ae5c3fdde57b9766917fcf8690c54e
telephus/translate.py
telephus/translate.py
class APIMismatch(Exception): pass def translateArgs(request, api_version): args = request.args if request.method == 'system_add_keyspace' \ or request.method == 'system_update_keyspace': args = adapt_ksdef_rf(args[0]) + args[1:] return args def postProcess(results, method): if method ...
class APIMismatch(Exception): pass def translateArgs(request, api_version): args = request.args if request.method == 'system_add_keyspace' \ or request.method == 'system_update_keyspace': adapted_ksdef = adapt_ksdef_rf(args[0]) args = (adapted_ksdef,) + args[1:] return args def pos...
Fix args manipulation in when translating ksdefs
Fix args manipulation in when translating ksdefs
Python
mit
Metaswitch/Telephus,driftx/Telephus,ClearwaterCore/Telephus,driftx/Telephus,Metaswitch/Telephus,ClearwaterCore/Telephus
172768dacc224f3c14e85f8e732209efe9ce075a
app/soc/models/project_survey.py
app/soc/models/project_survey.py
#!/usr/bin/python2.5 # # Copyright 2009 the Melange authors. # # 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...
#!/usr/bin/python2.5 # # Copyright 2009 the Melange authors. # # 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...
Set the default prefix for ProjectSurveys to gsoc_program.
Set the default prefix for ProjectSurveys to gsoc_program.
Python
apache-2.0
SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange
48e15b8f99bb0714b7ec465a0131e452c67004e5
Chapter4_TheGreatestTheoremNeverTold/top_pic_comments.py
Chapter4_TheGreatestTheoremNeverTold/top_pic_comments.py
import sys import numpy as np from IPython.core.display import Image import praw reddit = praw.Reddit("BayesianMethodsForHackers") subreddit = reddit.get_subreddit( "pics" ) top_submissions = subreddit.get_top() n_pic = int( sys.argv[1] ) if sys.argv[1] else 1 i = 0 while i < n_pic: top_submission = top_su...
import sys import numpy as np from IPython.core.display import Image import praw reddit = praw.Reddit("BayesianMethodsForHackers") subreddit = reddit.get_subreddit( "pics" ) top_submissions = subreddit.get_top() n_pic = int( sys.argv[1] ) if len(sys.argv) > 1 else 1 i = 0 while i < n_pic: top_submission = ...
Fix index to list when there is no 2nd element
Fix index to list when there is no 2nd element
Python
mit
chengwliu/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers,ultinomics/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers,Fillll/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers,ifduyue/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers,jrmontag/Probabilistic-Programming-and-Bayesian-...
afd27c62049e87eaefbfb5f38c6b61b461656384
formulae/token.py
formulae/token.py
class Token: """Representation of a single Token""" def __init__(self, _type, lexeme, literal=None): self.type = _type self.lexeme = lexeme self.literal = literal def __repr__(self): string_list = [ "'type': " + str(self.type), "'lexeme': " + str(sel...
class Token: """Representation of a single Token""" def __init__(self, _type, lexeme, literal=None): self.type = _type self.lexeme = lexeme self.literal = literal def __hash__(self): return hash((self.type, self.lexeme, self.literal)) def __eq__(self, other): i...
Add hash and eq methods to Token
Add hash and eq methods to Token
Python
mit
bambinos/formulae
d012763c57450555d45385ed9b254f500388618e
automata/render.py
automata/render.py
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.animation as animation class AnimatedGif: """ Setup various rendering things """ def __init__(self, dpi=100, colors="Purples"): self.frames = [] self.fig = plt.figure(dpi=dpi) plt.axis("off")...
import matplotlib matplotlib.use('Agg') import matplotlib.colors import matplotlib.pyplot as plt import matplotlib.animation as animation class AnimatedGif: """ Setup various rendering things """ def __init__(self, dpi=100, colors="Purples"): self.frames = [] self.fig = plt.figure(dpi=dpi...
Use the same normlization for whole gif
Use the same normlization for whole gif
Python
apache-2.0
stevearm/automata
ce7c31f3dd97716051b72951c7c745dd2c63efcd
plugins/audit_logs/server/__init__.py
plugins/audit_logs/server/__init__.py
import cherrypy import logging from girder import auditLogger from girder.models.model_base import Model from girder.api.rest import getCurrentUser class Record(Model): def initialize(self): self.name = 'audit_log_record' def validate(self, doc): return doc class AuditLogHandler(logging.Han...
import cherrypy import datetime import logging from girder import auditLogger from girder.models.model_base import Model from girder.api.rest import getCurrentUser class Record(Model): def initialize(self): self.name = 'audit_log_record' def validate(self, doc): return doc class AuditLogHan...
Include timestamp in audit logs
Include timestamp in audit logs
Python
apache-2.0
RafaelPalomar/girder,data-exp-lab/girder,RafaelPalomar/girder,data-exp-lab/girder,girder/girder,kotfic/girder,RafaelPalomar/girder,Kitware/girder,manthey/girder,jbeezley/girder,manthey/girder,girder/girder,data-exp-lab/girder,kotfic/girder,RafaelPalomar/girder,Kitware/girder,Kitware/girder,data-exp-lab/girder,kotfic/gi...
b2069b2b4a07d82cc6831dde0e396d7dae79d23e
autopidact/view.py
autopidact/view.py
from gi.repository import Gtk, GdkPixbuf, GLib import cv2 class View(Gtk.Window): def __init__(self, title, camera, interval=200): Gtk.Window.__init__(self) self.set_title(title) self.cam = camera self.img = Gtk.Image() self.add(self.img) GLib.timeout_add(interval, self.update) def update(self): if se...
from gi.repository import Gtk, GdkPixbuf, GLib import cv2 class View(Gtk.Window): def __init__(self, title, camera, interval=200): Gtk.Window.__init__(self) self.set_title(title) self.set_size_request(640, 480) self.set_resizable(False) self.cam = camera self.img = Gtk.Image() self.add(self.img) GLib....
Set an initial size and disallow resizing
Set an initial size and disallow resizing
Python
mit
fkmclane/AutoPidact
fb01aa54032b7ab73dcd5a3e73d4ece5f36517e2
locations/tasks.py
locations/tasks.py
from future.standard_library import install_aliases install_aliases() # noqa from urllib.parse import urlparse from celery.task import Task from django.conf import settings from seed_services_client import IdentityStoreApiClient from .models import Parish class SyncLocations(Task): """ Has a look at all th...
from future.standard_library import install_aliases install_aliases() # noqa from urllib.parse import urlparse from celery.task import Task from django.conf import settings from seed_services_client import IdentityStoreApiClient from .models import Parish class SyncLocations(Task): """ Has a look at all th...
Add comment to explain pagination handling
Add comment to explain pagination handling
Python
bsd-3-clause
praekelt/familyconnect-registration,praekelt/familyconnect-registration
e9fc291faca8af35398b958d046e951aa8471cbf
apps/core/tests/test_factories.py
apps/core/tests/test_factories.py
from .. import factories from . import CoreFixturesTestCase class AnalysisFactoryTestCase(CoreFixturesTestCase): def test_new_factory_with_Experiments(self): experiments = factories.ExperimentFactory.create_batch(3) # build analysis = factories.AnalysisFactory.build(experiments=experime...
from .. import factories, models from . import CoreFixturesTestCase class AnalysisFactoryTestCase(CoreFixturesTestCase): def test_new_factory_with_Experiments(self): experiments = factories.ExperimentFactory.create_batch(3) # build analysis = factories.AnalysisFactory.build(experiments=...
Fix broken test since models new default ordering
Fix broken test since models new default ordering
Python
bsd-3-clause
Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel
f4e36132448a4a55bff5660b3f5a669e0095ecc5
awx/main/models/activity_stream.py
awx/main/models/activity_stream.py
# Copyright (c) 2013 AnsibleWorks, Inc. # All Rights Reserved. from django.db import models class ActivityStream(models.Model): ''' Model used to describe activity stream (audit) events ''' OPERATION_CHOICES = [ ('create', _('Entity Created')), ('update', _("Entity Updated")), ...
# Copyright (c) 2013 AnsibleWorks, Inc. # All Rights Reserved. from django.db import models from django.utils.translation import ugettext_lazy as _ class ActivityStream(models.Model): ''' Model used to describe activity stream (audit) events ''' class Meta: app_label = 'main' OPERATION_...
Fix up some issues with supporting schema migration
Fix up some issues with supporting schema migration
Python
apache-2.0
wwitzel3/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx,wwitzel3/awx
941ab0315d71fbea552b0ab12d75e4d8968adfce
cube2sphere/blender_init.py
cube2sphere/blender_init.py
__author__ = 'Xyene' import bpy import sys import math bpy.context.scene.cycles.resolution_x = int(sys.argv[-5]) bpy.context.scene.cycles.resolution_y = int(sys.argv[-4]) for i, name in enumerate(['bottom', 'top', 'left', 'right', 'back', 'front']): bpy.data.images[name].filepath = "%s" % sys.argv[-6 - i] came...
__author__ = 'Xyene' import bpy import sys import math for scene in bpy.data.scenes: scene.render.resolution_x = int(sys.argv[-5]) scene.render.resolution_y = int(sys.argv[-4]) scene.render.resolution_percentage = 100 scene.render.use_border = False for i, name in enumerate(['bottom', 'top', 'left',...
Change the way we pass resolution to blender
Change the way we pass resolution to blender
Python
agpl-3.0
Xyene/cube2sphere
8ddbd0b39687f46637041848ab7190bcefd57b68
pyramid_mongodb/__init__.py
pyramid_mongodb/__init__.py
""" simplified mongodb integration 1. Add two lines to app/__init__.py ( the import and the call to initialize_mongo_db ) import python_mongodb def main(global_config, **settings): ## ... # Initialize mongodb , which is a subscriber python_mongodb.initialize_mongo_db( config , settin...
""" simplified mongodb integration 1. Add two lines to app/__init__.py ( the import and the call to initialize_mongo_db ) import python_mongodb def main(global_config, **settings): ## ... # Initialize mongodb , which is a subscriber python_mongodb.initialize_mongo_db( config , settin...
Use set_request_property instead of subscriber to improve performance
Use set_request_property instead of subscriber to improve performance
Python
mit
niallo/pyramid_mongodb
92c024c2112573e4c4b2d1288b1ec3c7a40bc670
test/test_uploader.py
test/test_uploader.py
import boto3 from os import path from lambda_uploader import uploader, config from moto import mock_s3 EX_CONFIG = path.normpath(path.join(path.dirname(__file__), '../test/configs')) @mock_s3 def test_s3_upload(): mock_bucket = 'mybucket' conn = boto3.resource('s3') conn.create...
import boto3 from os import path from lambda_uploader import uploader, config from moto import mock_s3 EX_CONFIG = path.normpath(path.join(path.dirname(__file__), '../test/configs')) @mock_s3 def test_s3_upload(): mock_bucket = 'mybucket' conn = boto3.resource('s3') conn.create...
Add additional assertion that the file we uploaded is correct
Add additional assertion that the file we uploaded is correct We should pull back down the S3 bucket file and be sure it's the same, proving we used the boto3 API correctly. We should probably, at some point, also upload a _real_ zip file and not just a plaintext file.
Python
apache-2.0
rackerlabs/lambda-uploader,dsouzajude/lambda-uploader
cc4b68c7eccf05ca32802022b2abfd31b51bce32
chef/exceptions.py
chef/exceptions.py
# Exception hierarchy for chef # Copyright (c) 2010 Noah Kantrowitz <noah@coderanger.net> class ChefError(Exception): """Top-level Chef error.""" class ChefServerError(ChefError): """An error from a Chef server. May include a HTTP response code.""" def __init__(self, message, code=None): ChefError...
# Exception hierarchy for chef # Copyright (c) 2010 Noah Kantrowitz <noah@coderanger.net> class ChefError(Exception): """Top-level Chef error.""" class ChefServerError(ChefError): """An error from a Chef server. May include a HTTP response code.""" def __init__(self, message, code=None): super(Ch...
Use super() for great justice.
Use super() for great justice.
Python
apache-2.0
Scalr/pychef,Scalr/pychef,cread/pychef,dipakvwarade/pychef,dipakvwarade/pychef,cread/pychef,coderanger/pychef,coderanger/pychef,jarosser06/pychef,jarosser06/pychef
f11d7232486a92bf5e9dba28432ee2ed97e02da4
print_web_django/api/views.py
print_web_django/api/views.py
from rest_framework import viewsets from . import serializers, models class PrintJobViewSet(viewsets.ModelViewSet): serializer_class = serializers.PrintJobSerializer def get_queryset(self): return self.request.user.printjobs.all() def perform_create(self, serializer): # need to also pass...
from rest_framework import viewsets from . import serializers, models class PrintJobViewSet(viewsets.ModelViewSet): serializer_class = serializers.PrintJobSerializer def get_queryset(self): return self.request.user.printjobs.all().order_by('-created') def perform_create(self, serializer): ...
Sort by descending date created (new first)
Sort by descending date created (new first)
Python
mit
aabmass/print-web,aabmass/print-web,aabmass/print-web
97d6f5e7b346944ac6757fd4570bfbc7dcf52425
survey/admin.py
survey/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from survey.models import Answer, Category, Question, Response, Survey from .actions import make_published class QuestionInline(admin.TabularInline): model = Question ordering = ("order", "category") extra = 1 class CategoryInline(admin.Tabular...
# -*- coding: utf-8 -*- from django.contrib import admin from survey.actions import make_published from survey.models import Answer, Category, Question, Response, Survey class QuestionInline(admin.TabularInline): model = Question ordering = ("order", "category") extra = 1 class CategoryInline(admin.Ta...
Fix Attempted relative import beyond top-level package
Fix Attempted relative import beyond top-level package
Python
agpl-3.0
Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey
a03eb91088943a4b3ed0ae5fc87b104562a4a645
location_field/urls.py
location_field/urls.py
try: from django.conf.urls import patterns # Django>=1.6 except ImportError: from django.conf.urls.defaults import patterns # Django<1.6 import os app_dir = os.path.dirname(__file__) urlpatterns = patterns( '', (r'^media/(.*)$', 'django.views.static.serve', { 'document_root': '%s/media' % a...
from django.conf.urls import patterns import os app_dir = os.path.dirname(__file__) urlpatterns = patterns( '', (r'^media/(.*)$', 'django.views.static.serve', { 'document_root': '%s/media' % app_dir}), )
Drop support for Django 1.6
Drop support for Django 1.6
Python
mit
Mixser/django-location-field,recklessromeo/django-location-field,Mixser/django-location-field,voodmania/django-location-field,recklessromeo/django-location-field,undernewmanagement/django-location-field,voodmania/django-location-field,caioariede/django-location-field,caioariede/django-location-field,undernewmanagement/...
f292cfa783bcc30c2625b340ad763db2723ce056
test/test_db.py
test/test_db.py
from piper.db import DbCLI import mock class DbCLIBase(object): def setup_method(self, method): self.cli = DbCLI(mock.Mock()) self.ns = mock.Mock() self.config = mock.Mock() class TestDbCLIRun(DbCLIBase): def test_plain_run(self): self.cli.cls.init = mock.Mock() ret ...
from piper.db import DbCLI from piper.db import DatabaseBase import mock import pytest class DbCLIBase(object): def setup_method(self, method): self.cli = DbCLI(mock.Mock()) self.ns = mock.Mock() self.config = mock.Mock() class TestDbCLIRun(DbCLIBase): def test_plain_run(self): ...
Add tests for DatabaseBase abstraction
Add tests for DatabaseBase abstraction
Python
mit
thiderman/piper
63c2cc935d3c97ecb8b297ae387bfdf719cf1350
apps/admin/forms.py
apps/admin/forms.py
from django.contrib.auth.models import User from django import forms from apps.categories.models import * from apps.books.models import * class LoginForm(forms.ModelForm): """docstring for LoginForm""" class Meta: model = User fields = ['username', 'password'] class CategoryForm(forms.ModelFo...
from django.contrib.auth.models import User from django import forms from apps.categories.models import * from apps.books.models import * class CategoryForm(forms.ModelForm): """docstring for CategoryForm""" class Meta: model = Category fields = '__all__' class BookForm(forms...
Remove unused FormLogin in admin app
[REMOVE] Remove unused FormLogin in admin app
Python
mit
vuonghv/brs,vuonghv/brs,vuonghv/brs,vuonghv/brs
6f464e422befe22e56bb759a7ac7ff52a353c6d9
accountant/functional_tests/test_layout_and_styling.py
accountant/functional_tests/test_layout_and_styling.py
# -*- coding: utf-8 -*- import unittest from .base import FunctionalTestCase from .pages import game class StylesheetTests(FunctionalTestCase): def test_color_css_loaded(self): self.story('Create a game') self.browser.get(self.live_server_url) page = game.Homepage(self.browser) page...
# -*- coding: utf-8 -*- import unittest from .base import FunctionalTestCase from .pages import game class StylesheetTests(FunctionalTestCase): def test_color_css_loaded(self): self.story('Create a game') self.browser.get(self.live_server_url) page = game.Homepage(self.browser) page...
Test is loaded CSS is applied
Test is loaded CSS is applied
Python
mit
XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant
517f53dc91164f4249de9dbaf31be65df02ffde7
numpy/fft/setup.py
numpy/fft/setup.py
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('fft', parent_package, top_path) config.add_data_dir('tests') # Configure pocketfft_internal config.add_extension('_pocketfft_internal', sources=...
import sys def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('fft', parent_package, top_path) config.add_data_dir('tests') # AIX needs to be told to use large file support - at all times defs = [('_LARGE_FILES', None)] i...
Add _LARGE_FILES to def_macros[] when platform is AIX (gh-15938)
BUG: Add _LARGE_FILES to def_macros[] when platform is AIX (gh-15938) AIX needs to be told to use large file support at all times. Fixes parts of gh-15801.
Python
bsd-3-clause
mhvk/numpy,pbrod/numpy,mattip/numpy,anntzer/numpy,numpy/numpy,numpy/numpy,pbrod/numpy,rgommers/numpy,numpy/numpy,endolith/numpy,abalkin/numpy,pdebuyl/numpy,grlee77/numpy,mattip/numpy,grlee77/numpy,pdebuyl/numpy,charris/numpy,charris/numpy,seberg/numpy,pbrod/numpy,grlee77/numpy,anntzer/numpy,jakirkham/numpy,seberg/numpy...
8a522bc92bbf5bee8bc32a0cc332dc77fa86fcd6
drcontroller/http_server.py
drcontroller/http_server.py
import eventlet import os import commands from eventlet import wsgi from paste.deploy import loadapp def main(): conf = "conf/api-paste.ini" appname = "main" commands.getoutput('mkdir -p ../logs') app = loadapp("config:%s" % os.path.abspath(conf), appname) wsgi.server(eventlet.listen(('', 80)), a...
import eventlet import os import commands from eventlet import wsgi from paste.deploy import loadapp # Monkey patch socket, time, select, threads eventlet.patcher.monkey_patch(all=False, socket=True, time=True, select=True, thread=True, os=True) def main(): conf = "conf/api-paste.i...
Update http server to un-blocking
Update http server to un-blocking
Python
apache-2.0
fs714/drcontroller
620bf504292583b2547cf7489eeeaaa582ddad77
indra/tests/test_ctd.py
indra/tests/test_ctd.py
import os from indra.statements import * from indra.sources import ctd from indra.sources.ctd.processor import CTDChemicalGeneProcessor HERE = os.path.dirname(os.path.abspath(__file__)) def test_statement_type_mapping(): st = CTDChemicalGeneProcessor.get_statement_types( 'decreases^phosphorylation', 'X',...
import os from indra.statements import * from indra.sources import ctd from indra.sources.ctd.processor import CTDChemicalGeneProcessor HERE = os.path.dirname(os.path.abspath(__file__)) def test_statement_type_mapping(): st = CTDChemicalGeneProcessor.get_statement_types( 'decreases^phosphorylation', 'X',...
Fix and extend test conditions
Fix and extend test conditions
Python
bsd-2-clause
sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,bgyori/indra,bgyori/indra,sorgerlab/belpy
0e2270415b287cb643cff5023dcaacbcb2d5e3fc
translators/google.py
translators/google.py
#!/usr/bin/python # -*- coding: utf-8 -*- import time import requests def save_google_translation(queue, source_text, client_id, client_secret, translate_from='et', translate_to='en'): translation = '' try: begin = time.time() translation = google_translation(source_text, ...
#!/usr/bin/python # -*- coding: utf-8 -*- import time import requests import json def save_google_translation(queue, source_text, translate_from='et', translate_to='en'): translation = '' try: begin = time.time() translation = google_translation(source_text, ...
Fix Google Translator request & processing
Fix Google Translator request & processing
Python
mit
ChameleonTartu/neurotolge,ChameleonTartu/neurotolge,ChameleonTartu/neurotolge
0f018ec9bfd0c93d980b232af325be453c065632
qsimcirq/_version.py
qsimcirq/_version.py
"""The version number defined here is read automatically in setup.py.""" __version__ = "0.14.0"
"""The version number defined here is read automatically in setup.py.""" __version__ = "0.14.1.dev20220804"
Update to dev version 0.14.1+dev20220804
Update to dev version 0.14.1+dev20220804
Python
apache-2.0
quantumlib/qsim,quantumlib/qsim,quantumlib/qsim,quantumlib/qsim
4e8dc0ca41ee1e21a75a3e803c3b2b223d9f14cb
users/managers.py
users/managers.py
from django.utils import timezone from django.contrib.auth.models import BaseUserManager from model_utils.managers import InheritanceQuerySet from .conf import settings class UserManager(BaseUserManager): def _create_user(self, email, password, is_staff, is_superuser, **extra_fields): ...
from django.utils import timezone from django.contrib.auth.models import BaseUserManager from model_utils.managers import InheritanceQuerySet from .conf import settings class UserManager(BaseUserManager): def _create_user(self, email, password, is_staff, is_superuser, **extra_fields): ...
Fix issue with create_superuser method on UserManager
Fix issue with create_superuser method on UserManager
Python
bsd-3-clause
mishbahr/django-users2,mishbahr/django-users2
818e15028c4dd158fa93fe4bcd351255585c2f4f
src/model/predict_rf_model.py
src/model/predict_rf_model.py
import numpy as np import pandas as pd import sys import os from sklearn.externals import joblib from sklearn.ensemble import RandomForestClassifier scriptpath = os.path.dirname(os.path.realpath(sys.argv[0])) + '/../' sys.path.append(os.path.abspath(scriptpath)) import utils parameter_str = '_'.join(['top', str(utils...
import numpy as np import pandas as pd import sys import os from sklearn.externals import joblib from sklearn.ensemble import RandomForestClassifier scriptpath = os.path.dirname(os.path.realpath(sys.argv[0])) + '/../' sys.path.append(os.path.abspath(scriptpath)) import utils parameter_str = '_'.join(['top', str(utils...
Handle missing value in predit rf
Handle missing value in predit rf
Python
bsd-3-clause
parkerzf/kaggle-expedia,parkerzf/kaggle-expedia,parkerzf/kaggle-expedia
8cc8f9a1535a2361c27e9411f9163ecd2a9958d5
utils/__init__.py
utils/__init__.py
import pymongo connection = pymongo.MongoClient("mongodb://localhost") db = connection.vcf_explorer import database import parse_vcf import filter_vcf import query
import pymongo import config #config.py connection = pymongo.MongoClient(host=config.MONGODB_HOST, port=config.MONGODB_PORT) db = connection[config.MONGODB_NAME] import database import parse_vcf import filter_vcf import query
Set mongodb settings using config.py
Set mongodb settings using config.py
Python
mit
CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer
2206681a89346970b71ca8d0ed1ff60a861b2ff9
doc/examples/plot_pyramid.py
doc/examples/plot_pyramid.py
""" ==================== Build image pyramids ==================== This example shows how to build image pyramids. """ import numpy as np import matplotlib.pyplot as plt from skimage import data from skimage import img_as_float from skimage.transform import build_gaussian_pyramid image = data.lena() rows, cols, di...
""" ==================== Build image pyramids ==================== The `build_gauassian_pyramid` function takes an image and yields successive images shrunk by a constant scale factor. Image pyramids are often used, e.g., to implement algorithms for denoising, texture discrimination, and scale- invariant detection. ""...
Update pyramid example with longer description
Update pyramid example with longer description
Python
bsd-3-clause
chintak/scikit-image,paalge/scikit-image,keflavich/scikit-image,SamHames/scikit-image,jwiggins/scikit-image,bsipocz/scikit-image,keflavich/scikit-image,rjeli/scikit-image,vighneshbirodkar/scikit-image,SamHames/scikit-image,youprofit/scikit-image,chintak/scikit-image,dpshelio/scikit-image,Midafi/scikit-image,WarrenWecke...
1454b42049e94db896aab99e2dd1b286ca2d04e3
convert-bookmarks.py
convert-bookmarks.py
#!/usr/bin/env python # # Convert browser bookmark export (NETSCAPE-Bookmark-file-1 format) to json # from argparse import ArgumentParser from bs4 import BeautifulSoup from datetime import datetime, timezone import json parser = ArgumentParser(description='Convert Netscape bookmarks to JSON') parser.add_argument(dest...
#!/usr/bin/env python # # Convert browser bookmark export (NETSCAPE-Bookmark-file-1 format) to json # from argparse import ArgumentParser from bs4 import BeautifulSoup from datetime import datetime, timezone import json parser = ArgumentParser(description='Convert Netscape bookmarks to JSON') parser.add_argument(dest...
Add options for add date and tags.
Add options for add date and tags.
Python
mit
jhh/netscape-bookmark-converter
6cd7e79fc32ebf75776ab0bcf367854d76dd5e03
src/redditsubscraper/items.py
src/redditsubscraper/items.py
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- import scrapy class Post(scrapy.Item): """ A model representing a single Reddit post. """ id = scrapy.Field() class Comment(scrapy.Item): """ A model representing a single Reddit comment """ id = scrapy.Field() parent_id = scrapy....
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- import scrapy class Post(scrapy.Item): """ A model representing a single Reddit post. """ """An id encoded in base-36 without any prefixes.""" id = scrapy.Field() class Comment(scrapy.Item): """ A model representing a single Reddit comme...
Add comments to item fields.
Add comments to item fields.
Python
mit
rfkrocktk/subreddit-scraper
b590ddd735131faa3fd1bdc91b1866e1bd7b0738
us_ignite/snippets/management/commands/snippets_load_fixtures.py
us_ignite/snippets/management/commands/snippets_load_fixtures.py
from django.core.management.base import BaseCommand from us_ignite.snippets.models import Snippet FIXTURES = [ { 'slug': 'home-box', 'name': 'Up next:', 'body': '', 'url_text': 'Get involved', 'url': '', }, ] class Command(BaseCommand): def handle(self, *args, *...
from django.core.management.base import BaseCommand from us_ignite.snippets.models import Snippet FIXTURES = [ { 'slug': 'home-box', 'name': 'UP NEXT: LOREM IPSUM', 'body': '', 'url_text': 'GET INVOLVED', 'url': '', }, { 'slug': 'featured', 'name': ...
Add featured homepage initial fixture.
Add featured homepage initial fixture.
Python
bsd-3-clause
us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite
d37f91f50dd6c0c3202258daca95ee6ee111688f
pyjswidgets/pyjamas/ui/Focus.oldmoz.py
pyjswidgets/pyjamas/ui/Focus.oldmoz.py
def ensureFocusHandler(): JS(""" return (focusHandler !== null) ? focusHandler : (focusHandler = @{{createFocusHandler}}()); """) def createFocusHandler(): JS(""" return function(evt) { // This function is called directly as an event handler, so 'this' is // set up by the b...
def ensureFocusHandler(): JS(""" return (focusHandler !== null) ? focusHandler : (focusHandler = @{{createFocusHandler}}()); """) def createFocusHandler(): JS(""" return function(evt) { // This function is called directly as an event handler, so 'this' is // set up by the b...
Fix for IE 11 (Focus)
Fix for IE 11 (Focus) IE presents itself as mozilla, so it trips on the bug.
Python
apache-2.0
gpitel/pyjs,spaceone/pyjs,lancezlin/pyjs,spaceone/pyjs,lancezlin/pyjs,pombredanne/pyjs,pyjs/pyjs,Hasimir/pyjs,gpitel/pyjs,pyjs/pyjs,spaceone/pyjs,pyjs/pyjs,Hasimir/pyjs,lancezlin/pyjs,pyjs/pyjs,pombredanne/pyjs,gpitel/pyjs,Hasimir/pyjs,gpitel/pyjs,spaceone/pyjs,pombredanne/pyjs,lancezlin/pyjs,pombredanne/pyjs,Hasimir/p...
3d5fd3233ecaf2bae5fbd5a1ae349c55d2f4cdc7
scistack/scistack.py
scistack/scistack.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ SciStack: the web app to build docker containers for reproducable science """ import os import flask app = flask.Flask(__name__) @app.route("/") def hello(): return "Choose a domain!" if __name__ == "__main__": app.run()
#!/usr/bin/env python # -*- coding: utf-8 -*- """ SciStack: the web app to build docker containers for reproducable science """ import os import flask import inspect app = flask.Flask(__name__, static_url_path='') # Home of any pre-build docker files docker_file_path = os.path.join(os.path.dirname(os.path.abspath( ...
Return pre-built dockerfile to user
Return pre-built dockerfile to user
Python
mit
callaghanmt/research-stacks,callaghanmt/research-stacks,callaghanmt/research-stacks
834d02d65b0d71bd044b18b0be031751a8c1a7de
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python NODE_VERSION = 'v0.11.10' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '607907aed2c1dcdd3b5968a756a990ba3f47bca7'
#!/usr/bin/env python NODE_VERSION = 'v0.11.10' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '276722e68bb643e3ae3b468b701c276aeb884838'
Upgrade libchromiumcontent: Add support for acceptsFirstMouse.
Upgrade libchromiumcontent: Add support for acceptsFirstMouse.
Python
mit
bbondy/electron,greyhwndz/electron,Neron-X5/electron,jacksondc/electron,baiwyc119/electron,brave/electron,tinydew4/electron,trigrass2/electron,pirafrank/electron,arturts/electron,RobertJGabriel/electron,takashi/electron,wan-qy/electron,hokein/atom-shell,digideskio/electron,tincan24/electron,jonatasfreitasv/electron,ben...
099eb53d3c7a4be19fd79f11c9ccf52faff300d4
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python import platform import sys BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'e4b283c22236560fd289fe59c03e50adf39e7c4b' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[0], 'win32': '32bit', ...
#!/usr/bin/env python import platform import sys BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'aa87035cc012ce0d533bb56b947bca81a6e71b82' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[0], 'win32': '32bit', ...
Upgrade libchromiumcontent to fix generating node.lib
Upgrade libchromiumcontent to fix generating node.lib
Python
mit
setzer777/electron,dkfiresky/electron,carsonmcdonald/electron,davazp/electron,michaelchiche/electron,gerhardberger/electron,systembugtj/electron,renaesop/electron,mirrh/electron,bbondy/electron,subblue/electron,Andrey-Pavlov/electron,joaomoreno/atom-shell,bpasero/electron,hokein/atom-shell,bpasero/electron,benweissmann...
3a78496f350c904ce64d30f422dfae8b6bc879c3
flask_api/tests/runtests.py
flask_api/tests/runtests.py
import unittest import sys import subprocess if __name__ == '__main__': if len(sys.argv) > 1: unittest.main(module='flask_api.tests') else: subprocess.call([sys.executable, '-m', 'unittest', 'discover'])
import unittest if __name__ == '__main__': unittest.main(module='flask_api.tests')
Simplify test execution to restore coverage measurement
Simplify test execution to restore coverage measurement
Python
bsd-2-clause
theskumar-archive/flask-api,theskumar-archive/flask-api,theskumar-archive/flask-api,theskumar-archive/flask-api
dcb8add6685dfb7dff626742b17ce03e013e72a1
src/enrich/kucera_francis_enricher.py
src/enrich/kucera_francis_enricher.py
__author__ = 's7a' # All imports from extras import KuceraFrancis from resource import Resource from os import path # The Kucera Francis enrichment class class KuceraFrancisEnricher: # Constructor for the Kucera Francis Enricher def __init__(self): self.kf = KuceraFrancis(path.join('data', 'kucera_f...
__author__ = 's7a' # All imports from extras import StemmedKuceraFrancis from resource import Resource from os import path # The Kucera Francis enrichment class class KuceraFrancisEnricher: # Constructor for the Kucera Francis Enricher def __init__(self): self.kf = StemmedKuceraFrancis(path.join('da...
Use stemmed Kucera Francis for Enrichment
Use stemmed Kucera Francis for Enrichment
Python
mit
Somsubhra/Simplify,Somsubhra/Simplify,Somsubhra/Simplify
d57844d1d6b2172fe196db4945517a5b3a68d343
satchless/process/__init__.py
satchless/process/__init__.py
class InvalidData(Exception): """ Raised for by step validation process """ pass class Step(object): """ A single step in a multistep process """ def validate(self): raise NotImplementedError() # pragma: no cover class ProcessManager(object): """ A multistep process ...
class InvalidData(Exception): """ Raised for by step validation process """ pass class Step(object): """ A single step in a multistep process """ def validate(self): raise NotImplementedError() # pragma: no cover class ProcessManager(object): """ A multistep process ...
Check explicit that next step is None
Check explicit that next step is None
Python
bsd-3-clause
taedori81/satchless
221a84d52e5165013a5c7eb0b00c3ebcae294c8a
dashboard_app/extension.py
dashboard_app/extension.py
from lava_server.extension import LavaServerExtension class DashboardExtension(LavaServerExtension): @property def app_name(self): return "dashboard_app" @property def name(self): return "Dashboard" @property def main_view_name(self): return "dashboard_app.views.bund...
from lava_server.extension import LavaServerExtension class DashboardExtension(LavaServerExtension): @property def app_name(self): return "dashboard_app" @property def name(self): return "Dashboard" @property def main_view_name(self): return "dashboard_app.views.bund...
Add support for configuring data views and reports
Add support for configuring data views and reports
Python
agpl-3.0
Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server
0003ee31f78d7861713a2bb7daacb9701b26a1b9
cinder/wsgi/wsgi.py
cinder/wsgi/wsgi.py
# 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, software # di...
# 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, software # di...
Initialize osprofiler in WSGI application
Initialize osprofiler in WSGI application This patch adds missing initialization of OSProfiler when Cinder API is running as WSGI application. Change-Id: Ifaffa2d58eeadf5d47fafbdde5538d26bcd346a6
Python
apache-2.0
Datera/cinder,phenoxim/cinder,mahak/cinder,openstack/cinder,j-griffith/cinder,Datera/cinder,j-griffith/cinder,mahak/cinder,openstack/cinder,phenoxim/cinder
ef50e82c3c1f49d63d013ac538d932d40c430a46
pyradiator/endpoint.py
pyradiator/endpoint.py
import queue import threading class Producer(object): def __init__(self, period_in_seconds, queue, function): self._period_in_seconds = period_in_seconds self._queue = queue self._function = function self._event = threading.Event() self._thread = threading.Thread(target=se...
try: import queue except ImportError: import Queue import threading class Producer(object): def __init__(self, period_in_seconds, queue, function): self._period_in_seconds = period_in_seconds self._queue = queue self._function = function self._event = threading.Event() ...
Handle import error on older python versions
Handle import error on older python versions
Python
mit
crashmaster/pyradiator
511a133599b86deae83d9ad8a3f7a7c5c45e07bf
core/views.py
core/views.py
from django.shortcuts import render from django.http import Http404 from django.contrib.messages import success from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailcore.models import Page from .models import HomePage, StaticPage from category.models import Category from .forms import ContactFo...
from django.shortcuts import render from django.http import Http404 from django.contrib.messages import success from django.utils.translation import ugettext_lazy as _ from wagtail.wagtailcore.models import Page from .models import HomePage, StaticPage from category.models import Category from .forms import ContactFo...
Clear the contact form after it has been successfully posted.
Clear the contact form after it has been successfully posted.
Python
bsd-3-clause
PARINetwork/pari,PARINetwork/pari,PARINetwork/pari,PARINetwork/pari
7cb68f6a749a38fef9820004a857e301c12a3044
morenines/util.py
morenines/util.py
import os import hashlib from fnmatch import fnmatchcase def get_files(index): paths = [] for dirpath, dirnames, filenames in os.walk(index.headers['root_path']): # Remove ignored directories dirnames = [d for d in dirnames if not index.ignores.match(d)] for filename in (f for f in ...
import os import hashlib def get_files(index): paths = [] for dirpath, dirnames, filenames in os.walk(index.headers['root_path']): # Remove ignored directories dirnames[:] = [d for d in dirnames if not index.ignores.match(d)] for filename in (f for f in filenames if not index.ignores...
Fix in-place os.walk() dirs modification
Fix in-place os.walk() dirs modification
Python
mit
mcgid/morenines,mcgid/morenines
c157ddeae7131e4141bca43857730103617b42c4
froide/upload/serializers.py
froide/upload/serializers.py
from rest_framework import serializers from .models import Upload class UploadSerializer(serializers.ModelSerializer): class Meta: model = Upload fields = '__all__'
from rest_framework import serializers from .models import Upload class UploadSerializer(serializers.ModelSerializer): class Meta: model = Upload fields = '__all__' def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['guid'].required = True
Make guid required in upload API
Make guid required in upload API
Python
mit
stefanw/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide
1d32debc1ea2ce8d11c8bc1abad048d6e4937520
froide_campaign/listeners.py
froide_campaign/listeners.py
from asgiref.sync import async_to_sync from channels.layers import get_channel_layer from .consumers import PRESENCE_ROOM from .models import Campaign def connect_info_object(sender, **kwargs): reference = kwargs.get('reference') if not reference: return if not reference.startswith('campaign:'): ...
from asgiref.sync import async_to_sync from channels.layers import get_channel_layer from .consumers import PRESENCE_ROOM from .models import Campaign def connect_info_object(sender, **kwargs): reference = kwargs.get('reference') if not reference: return if not reference.startswith('campaign:'): ...
Fix non-iobj campaign request connection
Fix non-iobj campaign request connection
Python
mit
okfde/froide-campaign,okfde/froide-campaign,okfde/froide-campaign
de1ff8a480cc6d6e86bb179e6820ab9f21145679
byceps/services/user/event_service.py
byceps/services/user/event_service.py
""" byceps.services.user.event_service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from datetime import datetime from typing import Sequence from ...database import db from ...typing import UserID from .models.event import UserEv...
""" byceps.services.user.event_service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2018 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from datetime import datetime from typing import Optional, Sequence from ...database import db from ...typing import UserID from .models.event imp...
Allow to provide a custom `occurred_at` value when building a user event
Allow to provide a custom `occurred_at` value when building a user event
Python
bsd-3-clause
homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps
e4b2d60af93fd84407eb7107497b2b500d79f9d7
calexicon/dates/tests/test_distant.py
calexicon/dates/tests/test_distant.py
import unittest from datetime import date as vanilla_date, timedelta from calexicon.dates import DistantDate class TestDistantDate(unittest.TestCase): def test_subtraction(self): dd = DistantDate(10000, 1, 1) self.assertIsInstance(dd - vanilla_date(9999, 1, 1), timedelta) self.assertIsIn...
import unittest from datetime import date as vanilla_date, timedelta from calexicon.calendars import ProlepticJulianCalendar from calexicon.dates import DateWithCalendar, DistantDate class TestDistantDate(unittest.TestCase): def test_subtraction(self): dd = DistantDate(10000, 1, 1) self.assertIs...
Add a passing test for equality.
Add a passing test for equality. Narrow down problems with constructing a date far in the future.
Python
apache-2.0
jwg4/qual,jwg4/calexicon
1f2d8fadd114106cefbc23060f742163be415376
cherrypy/process/__init__.py
cherrypy/process/__init__.py
"""Site container for an HTTP server. A Web Site Process Bus object is used to connect applications, servers, and frameworks with site-wide services such as daemonization, process reload, signal handling, drop privileges, PID file management, logging for all of these, and many more. The 'plugins' module defines a few...
"""Site container for an HTTP server. A Web Site Process Bus object is used to connect applications, servers, and frameworks with site-wide services such as daemonization, process reload, signal handling, drop privileges, PID file management, logging for all of these, and many more. The 'plugins' module defines a few...
Use __all__ to avoid linter errors
Use __all__ to avoid linter errors
Python
bsd-3-clause
Safihre/cherrypy,Safihre/cherrypy,cherrypy/cherrypy,cherrypy/cherrypy
6dc4314f1c5510a6e5f857d739956654909d97b2
pronto/__init__.py
pronto/__init__.py
# coding: utf-8 """a Python frontend to ontologies """ from __future__ import absolute_import from __future__ import unicode_literals __version__ = 'dev' __author__ = 'Martin Larralde' __author_email__ = 'martin.larralde@ens-paris-saclay.fr' __license__ = "MIT" from .ontology import Ontology from .term import Term, T...
# coding: utf-8 """a Python frontend to ontologies """ from __future__ import absolute_import from __future__ import unicode_literals __version__ = 'dev' __author__ = 'Martin Larralde' __author_email__ = 'martin.larralde@ens-paris-saclay.fr' __license__ = "MIT" from .ontology import Ontology from .term import Term, T...
Add `Description` to top-level imports
Add `Description` to top-level imports
Python
mit
althonos/pronto
1e47f79647baffd62d2a434710fe98b3c2247f28
tests/pgcomplex_app/models.py
tests/pgcomplex_app/models.py
# -*- coding: utf-8 -*- from django.db import models from django_orm.postgresql.fields.arrays import ArrayField from django_orm.postgresql.fields.interval import IntervalField from django_orm.postgresql.fields.bytea import ByteaField from django_orm.postgresql.manager import PgManager class IntModel(models.Model): ...
# -*- coding: utf-8 -*- from django.db import models from django_orm.postgresql.fields.arrays import ArrayField from django_orm.postgresql.fields.interval import IntervalField from django_orm.postgresql.fields.bytea import ByteaField from django_orm.manager import Manager class IntModel(models.Model): lista = Arr...
Fix tests with last changes on api.
Fix tests with last changes on api.
Python
bsd-3-clause
EnTeQuAk/django-orm,EnTeQuAk/django-orm
7665e2b0af042948dfc7a1814275cd3309f5f6cf
pages/tests/__init__.py
pages/tests/__init__.py
"""Django page CMS test suite module""" from djangox.test.depth import alltests def suite(): return alltests(__file__, __name__)
"""Django page CMS test suite module""" import unittest def suite(): suite = unittest.TestSuite() from pages.tests.test_functionnal import FunctionnalTestCase from pages.tests.test_unit import UnitTestCase from pages.tests.test_regression import RegressionTestCase from pages.tests.test_pages_link i...
Remove the dependency to django-unittest-depth
Remove the dependency to django-unittest-depth
Python
bsd-3-clause
remik/django-page-cms,oliciv/django-page-cms,remik/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,batiste/django-page-cms,batiste/django-page-cms,akaihola/django-page-cms,oliciv/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,akaihola/django-page-cms,akaihola/django-page-cms,bat...
8dccce77f6c08a7c20f38b9f1bacc27b71ab56a1
examples/web/wiki/macros/utils.py
examples/web/wiki/macros/utils.py
"""Utils macros Utility macros """ def macros(macro, environ, *args, **kwargs): """Return a list of available macros""" s = "\n".join(["* %s" % k for k in environ["macros"].keys()]) return environ["parser"].generate(s, environ=environ)
"""Utils macros Utility macros """ from inspect import getdoc def macros(macro, environ, *args, **kwargs): """Return a list of available macros""" macros = environ["macros"].items() s = "\n".join(["== %s ==\n%s\n" % (k, getdoc(v)) for k, v in macros]) return environ["parser"].generate(s, environ=en...
Change the output of <<macros>>
examples/web/wiki: Change the output of <<macros>>
Python
mit
treemo/circuits,eriol/circuits,treemo/circuits,eriol/circuits,nizox/circuits,treemo/circuits,eriol/circuits
38833f68daabe845650250e3edf9cb4b3cc9cb62
events/templatetags/humantime.py
events/templatetags/humantime.py
# -*- encoding:utf-8 -*- # Template tag from django.template.defaultfilters import stringfilter from datetime import datetime, timedelta from django import template register = template.Library() @register.filter def event_time(start, end): today = datetime.today () result = "" if start == today: ...
# -*- encoding:utf-8 -*- # Template tag from django.template.defaultfilters import stringfilter from datetime import datetime, timedelta from django import template import locale register = template.Library() @register.filter def event_time(start, end): today = datetime.today () result = "" # Hack! get t...
Print date in fr_CA locale
hack: Print date in fr_CA locale
Python
agpl-3.0
mlhamel/agendadulibre,mlhamel/agendadulibre,vcorreze/agendaEteAccoord,mlhamel/agendadulibre,vcorreze/agendaEteAccoord,vcorreze/agendaEteAccoord
e715dd65d3adf74624bc2102afd6a6d8f8706da6
dlm/models/components/linear.py
dlm/models/components/linear.py
import numpy import theano import theano.tensor as T class Linear(): def __init__(self, rng, input, n_in, n_out, W=None, b=None): self.input = input if W is None: W_values = numpy.asarray( rng.uniform( low = -0.01, #low=-numpy.sqrt(6. / (n_in + n_out)), high = 0.01, #high=numpy.sqrt(6. / (n_in...
import numpy import theano import theano.tensor as T class Linear(): def __init__(self, rng, input, n_in, n_out, W_values=None, b_values=None): self.input = input if W_values is None: W_values = numpy.asarray( rng.uniform( low = -0.01, #low=-numpy.sqrt(6. / (n_in + n_out)), high = 0.01, #high=...
Initialize from argument or using a uniform distribution
Initialize from argument or using a uniform distribution
Python
mit
nusnlp/corelm
e0091310ffdb39127f7138966026445b0bac53fc
salt/states/rdp.py
salt/states/rdp.py
# -*- coding: utf-8 -*- ''' Manage RDP Service on Windows servers ''' def __virtual__(): ''' Load only if network_win is loaded ''' return 'rdp' if 'rdp.enable' in __salt__ else False def enabled(name): ''' Enable RDP the service on the server ''' ret = {'name': name, 'res...
# -*- coding: utf-8 -*- ''' Manage RDP Service on Windows servers ''' def __virtual__(): ''' Load only if network_win is loaded ''' return 'rdp' if 'rdp.enable' in __salt__ else False def enabled(name): ''' Enable RDP the service on the server ''' ret = {'name': name, 'res...
Return proper results for 'test=True'
Return proper results for 'test=True'
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
1a3c251abe2e8ebf3020a21a3449abae6b04c2b1
perf/tests/test_system.py
perf/tests/test_system.py
import os.path import sys from perf.tests import get_output from perf.tests import unittest class SystemTests(unittest.TestCase): def test_show(self): args = [sys.executable, '-m', 'perf', 'system', 'show'] proc = get_output(args) regex = ('(Run "%s -m perf system tune" to tune the syste...
import os.path import sys from perf.tests import get_output from perf.tests import unittest class SystemTests(unittest.TestCase): def test_show(self): args = [sys.executable, '-m', 'perf', 'system', 'show'] proc = get_output(args) regex = ('(Run "%s -m perf system tune" to tune the syste...
Fix test_show test to support tuned systems
Fix test_show test to support tuned systems
Python
mit
vstinner/pyperf,haypo/perf
141eb2a647490142adf017d3a755d03ab89ed687
jrnl/plugins/tag_exporter.py
jrnl/plugins/tag_exporter.py
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, unicode_literals from .text_exporter import TextExporter from .util import get_tags_count class TagExporter(TextExporter): """This Exporter can convert entries and journals into json.""" names = ["tags"] extension = "tags" ...
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, unicode_literals from .text_exporter import TextExporter from .util import get_tags_count class TagExporter(TextExporter): """This Exporter can lists the tags for entries and journals, exported as a plain text file.""" names = ["...
Update `Tag` exporter code documentation.
Update `Tag` exporter code documentation.
Python
mit
maebert/jrnl,notbalanced/jrnl,philipsd6/jrnl,MinchinWeb/jrnl