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
093c9065de9e0e08f248bbb84696bf30309bd536
examples/parallel/timer.py
examples/parallel/timer.py
import rx import concurrent.futures import time seconds = [5, 1, 2, 4, 3] def sleep(t): time.sleep(t) return t def output(result): print '%d seconds' % result with concurrent.futures.ProcessPoolExecutor(5) as executor: rx.Observable.from_(seconds).flat_map( lambda s: executor.submit(sleep,...
from __future__ import print_function import rx import concurrent.futures import time seconds = [5, 1, 2, 4, 3] def sleep(t): time.sleep(t) return t def output(result): print('%d seconds' % result) with concurrent.futures.ProcessPoolExecutor(5) as executor: rx.Observable.from_(seconds).flat_map( ...
Fix parallel example for Python 3
Fix parallel example for Python 3
Python
mit
dbrattli/RxPY,ReactiveX/RxPY,ReactiveX/RxPY
351dd3d0540b6169a58897f9cb2ec6b1c20d57a5
core/forms/games.py
core/forms/games.py
from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset from django.forms import ModelForm, Textarea from core.models import Game class GameForm(ModelForm): class Meta: model = Game exclude = [...
from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset from django.forms import ModelForm, Textarea from core.models import Game class GameForm(ModelForm): class Meta: model = Game exclude = [...
Remove unused field from game form
Remove unused field from game form
Python
mit
joshsamara/game-website,joshsamara/game-website,joshsamara/game-website
51f6272870e4e72d2364b2c2f660457b5c9286ef
doc/sample_code/search_forking_pro.py
doc/sample_code/search_forking_pro.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys sys.path.append('./../../') from pyogi.ki2converter import * from pyogi.kifu import * if __name__ == '__main__': for n in range(0, 50000): n1 = (n // 10000) n2 = int(n < 10000) relpath = '~/data/shogi/2chkifu/{...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import pandas as pd sys.path.append('./../../') from pyogi.ki2converter import * from pyogi.kifu import * if __name__ == '__main__': res_table = [] for n in range(0, 50000): n1 = (n // 10000) n2 = int(n < 10000) ...
Add sum up part using pd.crosstab
Add sum up part using pd.crosstab
Python
mit
tosh1ki/pyogi,tosh1ki/pyogi
4db93f27d6d4f9b05b33af96bff15108272df6ce
src/webapp/public.py
src/webapp/public.py
import json from flask import Blueprint, render_template import database as db from database.model import Team bp = Blueprint('public', __name__) @bp.route("/map") def map_page(): return render_template("public/map.html") @bp.route("/map_teams") def map_teams(): qry = db.session.query(Team).filter_by(conf...
import json from flask import Blueprint, render_template import database as db from database.model import Team bp = Blueprint('public', __name__) @bp.route("/map") def map_page(): return render_template("public/map.html") @bp.route("/map_teams") def map_teams(): qry = db.session.query(Team).filter_by(conf...
Add multi team output in markers
Add multi team output in markers Signed-off-by: Dominik Pataky <46f1a0bd5592a2f9244ca321b129902a06b53e03@netdecorator.org>
Python
bsd-3-clause
eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system
3885e8fd36f419976d0b002c391dc246588929c7
admin/metrics/views.py
admin/metrics/views.py
from django.views.generic import TemplateView from admin.base.settings import KEEN_CREDENTIALS from admin.base.utils import OSFAdmin class MetricsView(OSFAdmin, TemplateView): template_name = 'metrics/osf_metrics.html' def get_context_data(self, **kwargs): kwargs.update(KEEN_CREDENTIALS.copy()) ...
from django.views.generic import TemplateView from django.contrib.auth.mixins import PermissionRequiredMixin from admin.base.settings import KEEN_CREDENTIALS from admin.base.utils import OSFAdmin class MetricsView(OSFAdmin, TemplateView, PermissionRequiredMixin): template_name = 'metrics/osf_metrics.html' ...
Add view metrics permission to metrics view
Add view metrics permission to metrics view
Python
apache-2.0
sloria/osf.io,monikagrabowska/osf.io,brianjgeiger/osf.io,sloria/osf.io,erinspace/osf.io,TomBaxter/osf.io,mfraezz/osf.io,chrisseto/osf.io,crcresearch/osf.io,adlius/osf.io,laurenrevere/osf.io,monikagrabowska/osf.io,acshi/osf.io,crcresearch/osf.io,cwisecarver/osf.io,icereval/osf.io,cwisecarver/osf.io,aaxelb/osf.io,adlius/...
d10720d1dd7997b5e1543cb27f2cd3e1088f30f5
server/fulltext.py
server/fulltext.py
#!/usr/bin/env python # encoding: utf-8 """ """ from bottle import route, run, template, request import urllib2 import urllib import sys import os from whoosh.index import create_in, open_dir from whoosh.fields import * from whoosh.qparser import QueryParser, MultifieldParser from whoosh.query import * @route('/') ...
#!/usr/bin/env python # encoding: utf-8 """ """ from bottle import route, run, template, request import urllib2 import urllib import sys import os from whoosh.index import create_in, open_dir from whoosh.fields import * from whoosh.qparser import QueryParser, MultifieldParser from whoosh.query import * @route('/') ...
Add advanced search by select type or status
Add advanced search by select type or status
Python
bsd-2-clause
klokantech/epsg.io,dudaerich/epsg.io,dudaerich/epsg.io,klokantech/epsg.io,klokantech/epsg.io,dudaerich/epsg.io,dudaerich/epsg.io,klokantech/epsg.io
a01a3f9c07e0e5d93fc664df118c6085668410c1
test/test_url_subcommand.py
test/test_url_subcommand.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import print_function import responses import simplesqlite from click.testing import CliRunner from sqlitebiter._enum import ExitCode from sqlitebiter.sqlitebiter import cmd from .common import print_traceback ...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import print_function import responses import simplesqlite from click.testing import CliRunner from sqlitebiter._enum import ExitCode from sqlitebiter.sqlitebiter import cmd from .common import print_traceback ...
Fix a test class name
Fix a test class name
Python
mit
thombashi/sqlitebiter,thombashi/sqlitebiter
4c9e18f39908e9b1a36989b3e4097ca458d94af4
docs/conf.py
docs/conf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys import os sys.path.insert(0, os.path.dirname(os.path.abspath('.'))) import youtube_dl_server as ydl_server # -- General configuration ----------------------------------------------------- # Add any Sphinx extension modu...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath('.'))) import youtube_dl_server as ydl_server # -- General configuration ----------------------------------------------------- # Add any Sphin...
Use the current year in the copyright
docs: Use the current year in the copyright
Python
unlicense
jaimeMF/youtube-dl-api-server,apllicationCOM/youtube-dl-api-server,apllicationCOM/youtube-dl-api-server,jaimeMF/youtube-dl-api-server,apllicationCOM/youtube-dl-api-server,jaimeMF/youtube-dl-api-server
eaf74f092e73dcb832d624d9f19e9eaee5fbc244
pyfakefs/pytest_plugin.py
pyfakefs/pytest_plugin.py
"""A pytest plugin for using pyfakefs as a fixture When pyfakefs is installed, the "fs" fixture becomes available. :Usage: def my_fakefs_test(fs): fs.create_file('/var/data/xx1.txt') assert os.path.exists('/var/data/xx1.txt') """ import py import pytest from pyfakefs.fake_filesystem_unittest import Patcher ...
"""A pytest plugin for using pyfakefs as a fixture When pyfakefs is installed, the "fs" fixture becomes available. :Usage: def my_fakefs_test(fs): fs.create_file('/var/data/xx1.txt') assert os.path.exists('/var/data/xx1.txt') """ import linecache import py import pytest from pyfakefs.fake_filesystem_unittes...
Add linecache module to skipped modules for pytest plugin
Add linecache module to skipped modules for pytest plugin - see #381 - fixes the problem under Python 3, but not under Python 2
Python
apache-2.0
mrbean-bremen/pyfakefs,pytest-dev/pyfakefs,mrbean-bremen/pyfakefs,jmcgeheeiv/pyfakefs
0770a8e77463ee70851404a37138da050aead5bb
pymatgen/core/__init__.py
pymatgen/core/__init__.py
""" This package contains core modules and classes for representing structures and operations on them. """ __author__ = "Shyue Ping Ong" __date__ = "Dec 15, 2010 7:21:29 PM" from .periodic_table import * from .composition import * from .structure import * from .structure_modifier import * from .bonds import * from .l...
""" This package contains core modules and classes for representing structures and operations on them. """ __author__ = "Shyue Ping Ong" __date__ = "Dec 15, 2010 7:21:29 PM" from .periodic_table import * from .composition import * from .structure import * from .structure_modifier import * from .bonds import * from .l...
Add units to Core import.
Add units to Core import. Former-commit-id: 0f1c678c7da36ebc85827601645f6729a11e5f41 [formerly 80676409b706f3927b463afef6aa844d00aeb107] Former-commit-id: f99f3956f55a26845ce5ce583545a0413e4f36ce
Python
mit
tallakahath/pymatgen,matk86/pymatgen,aykol/pymatgen,matk86/pymatgen,gpetretto/pymatgen,setten/pymatgen,tschaume/pymatgen,ndardenne/pymatgen,gVallverdu/pymatgen,dongsenfo/pymatgen,johnson1228/pymatgen,montoyjh/pymatgen,johnson1228/pymatgen,nisse3000/pymatgen,ndardenne/pymatgen,tschaume/pymatgen,davidwaroquiers/pymatgen,...
7255033298cad9a4a7c51bdceafe84c0536e78ba
pytopkapi/infiltration.py
pytopkapi/infiltration.py
"""Infiltration module. """ import numpy as np from scipy.optimize import fsolve def green_ampt_cum_infiltration(F, psi, dtheta, K, t): """The Green-Ampt cumulative infiltration equation. """ tmp = psi*dtheta # np.log(x) computes ln(x) return F - tmp*np.log(1 + F/tmp) - K*t if __name__ == '...
"""Infiltration module. """ import numpy as np from scipy.optimize import fsolve def _green_ampt_cum_eq(F, psi, dtheta, K, t): """The Green-Ampt cumulative infiltration equation """ tmp = psi*dtheta # np.log(x) computes ln(x) return F - tmp*np.log(1 + F/tmp) - K*t def green_ampt_cum_infiltratio...
Change the API and add a test and documentation
ENH: Change the API and add a test and documentation
Python
bsd-3-clause
scottza/PyTOPKAPI,sahg/PyTOPKAPI
1223c77fb3ada03d32e6c9da0a08dd43bfc5ad7b
docs/test.py
docs/test.py
import sys, os if sys.version_info >= (2, 4): import doctest else: raise ImportError("Python 2.4 doctest required") sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) def test(): for doc in ['SQLObject.txt']: doctest.testfile(doc, optionflags=doctest.ELLIPSIS) if __name...
import sys, os if sys.version_info >= (2, 4): import doctest else: raise ImportError("Python 2.4 doctest required") sys.path.insert( 0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) def test(): for doc in ['SQLObject.txt']: doctest.testfile(doc, optionflags=doctest.ELLIPSIS) i...
Make sure checkout is first on sys.path
Make sure checkout is first on sys.path git-svn-id: fe2f45b2405132b4a9af5caedfc153c2e6f542f4@894 95a46c32-92d2-0310-94a5-8d71aeb3d4b3
Python
lgpl-2.1
sqlobject/sqlobject,drnlm/sqlobject,sqlobject/sqlobject,drnlm/sqlobject
bb3ec131261f0619a86f21f549d6b1cb47f2c9ad
graph/serializers.py
graph/serializers.py
from rest_framework import serializers from measurement.models import Measurement from threshold_value.models import ThresholdValue from calendar import timegm from alarm.models import Alarm class GraphSeriesSerializer(serializers.ModelSerializer): x = serializers.SerializerMethodField('get_time') y = seriali...
from rest_framework import serializers from measurement.models import Measurement from threshold_value.models import ThresholdValue from calendar import timegm from alarm.models import Alarm class GraphSeriesSerializer(serializers.ModelSerializer): x = serializers.SerializerMethodField('get_time') y = seriali...
Simplify SimpleAlarmSerializer to improve the performance of the graph_data endpoint
Simplify SimpleAlarmSerializer to improve the performance of the graph_data endpoint
Python
mit
sigurdsa/angelika-api
dc82d59b739934d093ed0d704583e7edf1278fc3
core/management/commands/delete_old_sessions.py
core/management/commands/delete_old_sessions.py
from datetime import datetime from django.core.management.base import BaseCommand from django.contrib.sessions.models import Session class Command(BaseCommand): args = '<count count ...>' help = "Delete old sessions" def handle(self, *args, **options): old_sessions = Session.objects.filter(expi...
from datetime import datetime from django.core.management.base import NoArgsCommand from django.contrib.sessions.models import Session class Command(NoArgsCommand): help = "Delete old sessions" def handle_noargs(self, **options): old_sessions = Session.objects.filter(expire_date__lt=datetime.now())...
Add delete old sessions command
Add delete old sessions command
Python
mit
QLGu/djangopackages,nanuxbe/djangopackages,pydanny/djangopackages,QLGu/djangopackages,pydanny/djangopackages,pydanny/djangopackages,nanuxbe/djangopackages,QLGu/djangopackages,nanuxbe/djangopackages
591a40b6e1f4ac8b1d21050ccfa10779dc9dbf7c
analytic_code.py
analytic_code.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2013 XCG Consulting (www.xcg-consulting.fr) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pub...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2013 XCG Consulting (www.xcg-consulting.fr) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pub...
Add string to display the name of the field Dimension during the import
Add string to display the name of the field Dimension during the import
Python
agpl-3.0
xcgd/analytic_structure
6782ad40a405f79f07fa1527131634f96944ffd6
apps/innovate/views.py
apps/innovate/views.py
import random import jingo from users.models import Profile from projects.models import Project from events.models import Event from feeds.models import Entry def splash(request): """Display splash page. With featured project, event, person, blog post.""" def get_random(cls, **kwargs): choices = cls...
import random import jingo from users.models import Profile from projects.models import Project from events.models import Event from feeds.models import Entry def splash(request): """Display splash page. With featured project, event, person, blog post.""" def get_random(cls, **kwargs): choices = cls...
Add status codes to the 404/500 error handlers.
Add status codes to the 404/500 error handlers.
Python
bsd-3-clause
mozilla/mozilla-ignite,mozilla/mozilla-ignite,mozilla/mozilla-ignite,mozilla/mozilla-ignite
8d651ed493d2787da478f0c7c120917d3335b4d5
email_from_template/utils.py
email_from_template/utils.py
from . import app_settings _render_method = None def get_render_method(): global _render_method if _render_method is None: _render_method = from_dotted_path(app_settings.EMAIL_RENDER_METHOD) return _render_method _context_processors = None def get_context_processors(): global _context_proces...
from django.utils.functional import memoize from . import app_settings def get_render_method(): return from_dotted_path(app_settings.EMAIL_RENDER_METHOD) get_render_method = memoize(get_render_method, {}, 0) def get_context_processors(): return [from_dotted_path(x) for x in app_settings.EMAIL_CONTEXT_PROCESS...
Use Django's memoize over a custom one.
Use Django's memoize over a custom one. Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@playfire.com>
Python
bsd-3-clause
playfire/django-email-from-template,lamby/django-email-from-template
07d7eddac89d5ac54af62e185801cdbe71720b7c
hybridJaccardTest.py
hybridJaccardTest.py
import argparse import sys import hybridJaccard as hj def main(): "Command line testinterface." parser = argparse.ArgumentParser() parser.add_argument('-c','--configFile', help="Configuration file (JSON).", required=False) parser.add_argument('-i','--input', help="Input file of phrases to test.", requ...
import argparse import sys import hybridJaccard as hj def main(): "Command line testinterface." parser = argparse.ArgumentParser() parser.add_argument('-c','--configFile', help="Configuration file (JSON).", required=False) parser.add_argument('-i','--input', help="Input file of phrases to test.", requ...
Read the intput file specified on the command line.
Read the intput file specified on the command line.
Python
apache-2.0
usc-isi-i2/hybrid-jaccard
fcbb2ec6ebceebea0012971a831f2941d1943708
src/knesset/links/managers.py
src/knesset/links/managers.py
from django.db import models from django.contrib.contenttypes.models import ContentType from django.utils.encoding import force_unicode class LinksManager(models.Manager): def for_model(self, model): """ QuerySet for all links for a particular model (either an instance or a class). ...
from django.db import models from django.contrib.contenttypes.models import ContentType from django.utils.encoding import force_unicode class LinksManager(models.Manager): def for_model(self, model): """ QuerySet for all links for a particular model (either an instance or a class). ...
Use select related for link_type
Use select related for link_type
Python
bsd-3-clause
habeanf/Open-Knesset,jspan/Open-Knesset,noamelf/Open-Knesset,navotsil/Open-Knesset,OriHoch/Open-Knesset,noamelf/Open-Knesset,habeanf/Open-Knesset,noamelf/Open-Knesset,daonb/Open-Knesset,Shrulik/Open-Knesset,ofri/Open-Knesset,OriHoch/Open-Knesset,ofri/Open-Knesset,noamelf/Open-Knesset,MeirKriheli/Open-Knesset,DanaOshri/...
79dd629be9b858fd7bc73e7d16aecbb25de0d5db
fireplace/cards/wog/rogue.py
fireplace/cards/wog/rogue.py
from ..utils import * ## # Minions ## # Spells class OG_073: "Thistle Tea" play = Draw(CONTROLLER).then(Give(CONTROLLER, Copy(Draw.CARD)) * 2)
from ..utils import * ## # Minions class OG_070: "Bladed Cultist" combo = Buff(SELF, "OG_070e") OG_070e = buff(+1, +1) class OG_267: "Southsea Squidface" deathrattle = Buff(FRIENDLY_WEAPON, "OG_267e") OG_267e = buff(atk=2) ## # Spells class OG_073: "Thistle Tea" play = Draw(CONTROLLER).then(Give(CONTROL...
Implement Bladed Cultist, Southsea Squidface, and Shadow Strike
Implement Bladed Cultist, Southsea Squidface, and Shadow Strike
Python
agpl-3.0
NightKev/fireplace,jleclanche/fireplace,beheh/fireplace
b8ad378a796ee867acfa3198e04d47a500dd90d3
mla/neuralnet/activations.py
mla/neuralnet/activations.py
import autograd.numpy as np """ References: https://en.wikipedia.org/wiki/Activation_function """ def sigmoid(z): return 1.0 / (1.0 + np.exp(-z)) def softmax(z): # Avoid numerical overflow by removing max e = np.exp(z - np.amax(z, axis=1, keepdims=True)) return e / np.sum(e, axis=1, keepdims=True) ...
import autograd.numpy as np """ References: https://en.wikipedia.org/wiki/Activation_function """ def sigmoid(z): return 1.0 / (1.0 + np.exp(-z)) def softmax(z): # Avoid numerical overflow by removing max e = np.exp(z - np.amax(z, axis=1, keepdims=True)) return e / np.sum(e, axis=1, keepdims=True) ...
Add Leaky ReLU activation. Differentiation with autograd package confirmed to work correctly.
Add Leaky ReLU activation. Differentiation with autograd package confirmed to work correctly.
Python
mit
rushter/MLAlgorithms
f6cad3a2bfeb4238da359c882fe7cbbaedb5d8b7
setuptools/extension.py
setuptools/extension.py
from distutils.core import Extension as _Extension from dist import _get_unpatched _Extension = _get_unpatched(_Extension) try: from Pyrex.Distutils.build_ext import build_ext except ImportError: have_pyrex = False else: have_pyrex = True class Extension(_Extension): """Extension that uses '.c' files...
from distutils.core import Extension as _Extension from setuptools.dist import _get_unpatched _Extension = _get_unpatched(_Extension) try: from Pyrex.Distutils.build_ext import build_ext except ImportError: have_pyrex = False else: have_pyrex = True class Extension(_Extension): """Extension that uses...
Fix import that was breaking py3k
Fix import that was breaking py3k --HG-- branch : distribute extra : rebase_source : 76bf8f9213536189bce76a41e798c44c5f468cbd
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
bd78b8c1bab94b5f048f8bc4895657f1fd36ddfc
project_generator/commands/clean.py
project_generator/commands/clean.py
# Copyright 2014-2015 0xc0170 # # 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,...
# Copyright 2014-2015 0xc0170 # # 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,...
Clean - tool is not required, as tool_supported are there
Clean - tool is not required, as tool_supported are there
Python
apache-2.0
0xc0170/project_generator,sarahmarshy/project_generator,hwfwgrp/project_generator,molejar/project_generator,project-generator/project_generator,ohagendorf/project_generator
2bf883741ce763bde729f2930af913c44a807cb5
jiraconfig-sample.py
jiraconfig-sample.py
JIRA = { "server": "https://example.com/jira/", "user": "user", "password": "password" }
import keyring JIRA = { "server": "https://example.com/jira/", "user": "user", "password": keyring.get_password("system", "user") }
Add keyring to example config
Add keyring to example config
Python
mit
mrts/ask-jira
235f8061caa667f7c9bc1f424e14326c22932547
Examples/Infovis/Python/cone_layout.py
Examples/Infovis/Python/cone_layout.py
from vtk import * reader = vtkXMLTreeReader() reader.SetFileName("vtkclasses.xml") reader.Update() print reader.GetOutput() view = vtkGraphLayoutView() view.AddRepresentationFromInputConnection(reader.GetOutputPort()) view.SetVertexLabelArrayName("id") view.SetVertexLabelVisibility(True) view.SetVertexColorArrayName...
from vtk import * reader = vtkXMLTreeReader() reader.SetFileName("vtkclasses.xml") view = vtkGraphLayoutView() view.AddRepresentationFromInputConnection(reader.GetOutputPort()) view.SetVertexLabelArrayName("id") view.SetVertexLabelVisibility(True) view.SetVertexColorArrayName("vertex id") view.SetColorVertices(True)...
Remove errant printout in python cone layout example.
ENH: Remove errant printout in python cone layout example.
Python
bsd-3-clause
daviddoria/PointGraphsPhase1,jmerkow/VTK,mspark93/VTK,hendradarwin/VTK,aashish24/VTK-old,Wuteyan/VTK,jmerkow/VTK,berendkleinhaneveld/VTK,msmolens/VTK,ashray/VTK-EVM,msmolens/VTK,hendradarwin/VTK,sumedhasingla/VTK,ashray/VTK-EVM,johnkit/vtk-dev,sumedhasingla/VTK,SimVascular/VTK,sankhesh/VTK,candy7393/VTK,jmerkow/VTK,spt...
72d0ca4e2f4be7969498b226af4243315f2dff0c
tests/test_colors.py
tests/test_colors.py
"""Test imagemagick functions.""" import unittest from pywal import colors class TestGenColors(unittest.TestCase): """Test the gen_colors functions.""" def test_gen_colors(self): """> Generate a colorscheme.""" result = colors.get("tests/test_files/test.jpg") self.assertEqual(result[...
"""Test imagemagick functions.""" import unittest from pywal import colors class TestGenColors(unittest.TestCase): """Test the gen_colors functions.""" def test_gen_colors(self): """> Generate a colorscheme.""" result = colors.get("tests/test_files/test.jpg") self.assertEqual(len(res...
Check color length instead of value since the tests will fail on other versions of imageamgick
tests: Check color length instead of value since the tests will fail on other versions of imageamgick
Python
mit
dylanaraps/pywal,dylanaraps/pywal,dylanaraps/pywal
323cc3f50fa0bbd072bfe243443adf12e1b25220
bluebottle/projects/migrations/0019_auto_20170118_1537.py
bluebottle/projects/migrations/0019_auto_20170118_1537.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-01-18 14:37 from __future__ import unicode_literals import binascii import os from django.db import migrations def generate_key(): return binascii.hexlify(os.urandom(20)).decode() def create_auth_token(apps, schema_editor): Member = apps.get_mode...
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-01-18 14:37 from __future__ import unicode_literals import binascii import os from django.db import migrations def generate_key(): return binascii.hexlify(os.urandom(20)).decode() def create_auth_token(apps, schema_editor): Member = apps.get_mode...
Add dependency on different migrations
Add dependency on different migrations
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
23e1766731dbd08d3d6c55d9d1fe2bbf1be42614
sncosmo/tests/test_builtins.py
sncosmo/tests/test_builtins.py
import pytest import sncosmo @pytest.mark.might_download def test_hst_bands(): """ check that the HST and JWST bands are accessible """ for bandname in ['f606w', 'uvf606w', 'f125w', 'f127m', 'f115w']: # jwst nircam sncosmo.get_bandpass(bandname) @pytest.mark.might_download de...
import pytest import sncosmo @pytest.mark.might_download def test_hst_bands(): """ check that the HST and JWST bands are accessible """ for bandname in ['f606w', 'uvf606w', 'f125w', 'f127m', 'f115w']: # jwst nircam sncosmo.get_bandpass(bandname) @pytest.mark.might_download de...
Update tests to cover every Roman WFI filter
Update tests to cover every Roman WFI filter
Python
bsd-3-clause
sncosmo/sncosmo,sncosmo/sncosmo,sncosmo/sncosmo
d4033694f7686fe1ad48a185ae740c4d966d40d8
classes/dnsresolver.py
classes/dnsresolver.py
import dns import dns.resolver import dns.rdatatype from typing import Union, List class DNSResolver(dns.resolver.Resolver): def __init__(self, filename='/etc/resolv.conf', configure=False, nameservers: Union[str, List[str]] = None): # Run the dns.resolver.Resolver superclass init call t...
import dns import dns.resolver import dns.rdatatype from typing import Union, List class DNSResolver(dns.resolver.Resolver): def __init__(self, filename='/etc/resolv.conf', configure=False, nameservers: Union[str, List[str]] = None): # Run the dns.resolver.Resolver superclass init call t...
Implement rdatatype-aware and NoAnswer-aware DNS handling
Implement rdatatype-aware and NoAnswer-aware DNS handling This will work for CNAME entries because CNAMEs hit by A or AAAA lookups behave like `dig` does - they will trigger a second resultset for the CNAME entry in order to return the IP address. This also is amended to handle a "NoAnswer" response - i.e. if there a...
Python
apache-2.0
Charcoal-SE/SmokeDetector,Charcoal-SE/SmokeDetector
c81fff4ff4cccc51faf47c7ca9a63cd9eb6a2699
projects/tests/factories.py
projects/tests/factories.py
import factory from django.contrib.auth.models import User from accounts.tests.factories import UserFactory from .. import models class OrganizationFactory(factory.DjangoModelFactory): """Organization factory""" FACTORY_FOR = models.Organization name = factory.Sequence(lambda n: 'organization {}'.format(...
import factory from django.contrib.auth.models import User from accounts.tests.factories import UserFactory from .. import models class OrganizationFactory(factory.DjangoModelFactory): """Organization factory""" FACTORY_FOR = models.Organization name = factory.Sequence(lambda n: 'organization {}'.format(...
Change project factory default values
Change project factory default values
Python
mit
nvbn/coviolations_web,nvbn/coviolations_web
1c6fcd2e1ab02fef60e3507ba57cb9224b19d616
elephantblog/context_processors.py
elephantblog/context_processors.py
from django.utils import translation from feincms.module.page.models import Page def blog_page(request): """ Used to get the feincms page navigation within the blog app. """ from feincms.module.page.models import Page try: return {'blog_page' : Page.objects.get(slug='blog', language=translation.get...
from feincms.module.page.models import Page from feincms.translations import short_language_code def blog_page(request): """ Used to get the feincms page navigation within the blog app. """ from feincms.module.page.models import Page return {'blog_page': Page.objects.get(slug='blog', language=short_la...
Handle page module without translations extension too
blog_page: Handle page module without translations extension too
Python
bsd-3-clause
matthiask/feincms-elephantblog,feincms/feincms-elephantblog,joshuajonah/feincms-elephantblog,matthiask/feincms-elephantblog,feincms/feincms-elephantblog,michaelkuty/feincms-elephantblog,matthiask/feincms-elephantblog,sbaechler/feincms-elephantblog,joshuajonah/feincms-elephantblog,sbaechler/feincms-elephantblog,sbaechle...
c9aa7b60e3e985883854e7aba38838c7a45aa6fa
matches/models.py
matches/models.py
from django.db import models from wrestlers.models import WrestlingEntity class Card(models.Model): date = models.DateField() def __unicode__(self): return unicode(self.date) class Match(models.Model): card = models.ForeignKey(Card) participants = models.ManyToManyField(WrestlingEntity) ...
from django.contrib.auth.models import User from django.db import models from wrestlers.models import WrestlingEntity class Review(models.Model): reviewed_by = models.ForeignKey(User) reviewed_at = models.DateTimeField() class Meta: abstract = True class Card(models.Model): date = models...
Add basic Review model and use it for matches.
Add basic Review model and use it for matches.
Python
agpl-3.0
OddBloke/moore
11238c63240fa19b87fc478916bac3a4bdd86df5
django_project/realtime/tasks/test/test_celery_tasks.py
django_project/realtime/tasks/test/test_celery_tasks.py
# coding=utf-8 import logging import unittest from django import test from timeout_decorator import timeout_decorator from realtime.app_settings import LOGGER_NAME from realtime.tasks import check_realtime_broker from realtime.tasks.realtime.celery_app import app as realtime_app from realtime.utils import celery_work...
# coding=utf-8 import logging import unittest from django import test from timeout_decorator import timeout_decorator from realtime.app_settings import LOGGER_NAME from realtime.tasks import check_realtime_broker, \ retrieve_felt_earthquake_list from realtime.tasks.realtime.celery_app import app as realtime_app f...
Add unittests for BMKG EQ List Scrapper
Add unittests for BMKG EQ List Scrapper
Python
bsd-2-clause
AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django
38ce0d6b0433a68787c18691407c815d4eb1fdb2
txscrypt/__init__.py
txscrypt/__init__.py
""" A Twisted-friendly wrapper for scrypt. """ from txscrypt.wrapper import computeKey, verifyPassword from txscrypt._version import __version__ __all__ = ["computeKey", "verifyPassword"]
""" A Twisted-friendly wrapper for scrypt. """ from txscrypt.wrapper import checkPassword, computeKey from txscrypt._version import __version__ __all__ = ["verifyPassword", "computeKey"]
Make checkPassword the only public API, remove verifyPassword
Make checkPassword the only public API, remove verifyPassword
Python
isc
lvh/txscrypt
f360c61cbe0a895ca3d8efe5be97f08ea7ff5682
packages/vic/git/__init__.py
packages/vic/git/__init__.py
from mykde import Action class Action(Action): name = 'git' description = "Git with helper programs and custom settings" packages = ['git', 'gitk', 'giggle'] def proceed(self): # useful aliases self.call('git config --global alias.ci "commit -a"') self.call('git config --glo...
from mykde import Action class Action(Action): name = 'git' description = "Git with helper programs and custom settings" packages = ['git', 'gitk', 'giggle'] def proceed(self): # useful aliases self.call('git config --global alias.ci "commit -a"') self.call('git config --glo...
Add one more default option for git.
Add one more default option for git.
Python
bsd-3-clause
warvariuc/mykde,warvariuc/mykde
b2f1f97000c8d3479e1df6778f0cc85ec0680571
garden-watering01/mybuddy.py
garden-watering01/mybuddy.py
import machine def setntptime(maxretries=10): # ntptime is a helper module which gets packaged into the firmware # Check https://raw.githubusercontent.com/micropython/micropython/master/esp8266/scripts/ntptime.py import ntptime for i in range (maxretries): try: ntptime.settime() break excep...
import machine def have_internet(): import urequests try: resp = urequests.request("HEAD", "http://jsonip.com/") return True except: return False def setntptime(maxretries=10): # ntptime is a helper module which gets packaged into the firmware # Check https://raw.githubusercontent.com/micropytho...
Add a function to check status of internet connectivity
Add a function to check status of internet connectivity
Python
mit
fuzzyhandle/esp8266hangout,fuzzyhandle/esp8266hangout,fuzzyhandle/esp8266hangout
8db3ee0d6b73b864a91cd3617342138f05175d9d
accounts/models.py
accounts/models.py
# coding: utf-8 from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from registration.signals import user_activated from django.dispatch import receiver class UserAccount(models.Model): """ A user account. Used to store any information related...
# coding: utf-8 from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from registration.signals import user_activated from django.dispatch import receiver class UserAccount(models.Model): """ A user account. Used to store any information related...
Add __unicode__ method to UserAccount model
Add __unicode__ method to UserAccount model
Python
agpl-3.0
coders4help/volunteer_planner,alper/volunteer_planner,klinger/volunteer_planner,pitpalme/volunteer_planner,volunteer-planner/volunteer_planner,pitpalme/volunteer_planner,christophmeissner/volunteer_planner,pitpalme/volunteer_planner,christophmeissner/volunteer_planner,alper/volunteer_planner,flindenberg/volunteer_plann...
ec1a25c541770a82953c743f13d525a447f3bd2d
syntacticframes_project/syntacticframes/management/commands/update_members_and_translations.py
syntacticframes_project/syntacticframes/management/commands/update_members_and_translations.py
""" Updates members and translations for all classes When LVF and LADL mappings change, everything under this change could change. When a frameset is hidden or shown, everything in that class could change. When the algorithm changes, everything in VerbeNet could change. This command ensures that after an algorithmic ...
""" Updates members and translations for all classes When LVF and LADL mappings change, everything under this change could change. When a frameset is hidden or shown, everything in that class could change. When the algorithm changes, everything in VerbeNet could change. This command ensures that after an algorithmic ...
Include time of update start/end
Include time of update start/end
Python
mit
aymara/verbenet-editor,aymara/verbenet-editor,aymara/verbenet-editor
743f4affcd89aa3d9fd37774e2e5f8e05525cb04
api/sync_wallet.py
api/sync_wallet.py
import urlparse import os, sys import json tools_dir = os.environ.get('TOOLSDIR') lib_path = os.path.abspath(tools_dir) sys.path.append(lib_path) from msc_apps import * data_dir_root = os.environ.get('DATADIR') def sync_wallet_response(request_dict): if not request_dict.has_key('type'): return (None, 'No field ...
import urlparse import os, sys import json tools_dir = os.environ.get('TOOLSDIR') lib_path = os.path.abspath(tools_dir) sys.path.append(lib_path) from msc_apps import * data_dir_root = os.environ.get('DATADIR') def sync_wallet_response(request_dict): if not request_dict.has_key('type'): return (None, 'No field ...
Clean up return value for API
Clean up return value for API
Python
agpl-3.0
ripper234/omniwallet,maran/omniwallet,maran/omniwallet,Nevtep/omniwallet,FuzzyBearBTC/omniwallet,FuzzyBearBTC/omniwallet,achamely/omniwallet,curtislacy/omniwallet,habibmasuro/omniwallet,OmniLayer/omniwallet,ripper234/omniwallet,habibmasuro/omniwallet,ripper234/omniwallet,Nevtep/omniwallet,habibmasuro/omniwallet,curtisl...
d81fe16eda36d3a5fa23d163de27bd46f84c4815
app.py
app.py
from flask import Flask, render_template import os app = Flask(__name__) @app.route('/') def webprint(): return(render_template('index.html')) if __name__ == "__main__": port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)
from flask import Flask, render_template import os app = Flask(__name__) @app.route('/') def webprint(): return 'Hello world!' if __name__ == "__main__": port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)
Return text message on /
Return text message on /
Python
mit
fablabjoinville/groselha,fablabjoinville/groselha,fablabjoinville/groselha,fablabjoinville/groselha
cfcee83354f4917e719c3ef4236a2644dc98e153
ophyd/__init__.py
ophyd/__init__.py
import logging logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) from . import * # Signals from .signal import (Signal, EpicsSignal, EpicsSignalRO) # Positioners from .positioner import Positioner from .epics_motor import EpicsMotor from .pv_positioner import (PVPositioner, PVPositioner...
import logging logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) from . import * # Signals from .signal import (Signal, EpicsSignal, EpicsSignalRO) # Positioners from .positioner import Positioner from .epics_motor import EpicsMotor from .pv_positioner import (PVPositioner, PVPositioner...
Add StatusBase to top-level API.
MNT: Add StatusBase to top-level API.
Python
bsd-3-clause
dchabot/ophyd,dchabot/ophyd
17c90fd954441c2623495e50a2f89790e1ff5489
projects/tests/test_tools.py
projects/tests/test_tools.py
from mock import MagicMock from django.core.exceptions import PermissionDenied from django.test import TestCase from accounts.tests.factories import UserFactory from ..utils import ProjectAccessMixin from ..models import Project from . import factories class ProjectAccessMixinCase(TestCase): """Project access mix...
import sure from mock import MagicMock from django.core.exceptions import PermissionDenied from django.test import TestCase from accounts.tests.factories import UserFactory from ..utils import ProjectAccessMixin from ..models import Project from . import factories class ProjectAccessMixinCase(TestCase): """Projec...
Use sure in project tools cases
Use sure in project tools cases
Python
mit
nvbn/coviolations_web,nvbn/coviolations_web
db08c5ae962c2e66c8ad2e668f530d08934200af
geometry.py
geometry.py
from geom2d import * l1 = [] for i in range(-5, 6): l1.append(Point(i, i*i)) l2 = [] for el in l1: l2.append(Point(el.x, -el.y)) print(l1) print(l2) # List comprehension l1c = [Point(i, i*i) for i in range(-5, 6)] l2c = [Point(el.x, -el.y) for el in l1c] print("List comprehension") print(l1c) print(l2c)
from geom2d import * l1 = list(map(lambda i: Point(i, i*i), range(-5, 6))) # l2 = list(map(lambda p: Point(p.x, -p.y), l1)) # l2 = list(filter(lambda p: p.x > 0, l1)) l2 = list(filter(lambda p: p.x % 2 == 0, l1)) print(l1) print(l2)
Work with lists in functional way (map, filter)
Work with lists in functional way (map, filter)
Python
apache-2.0
maciekp85/python-for-testers
2812f11bdc86495dd9ef62b4b45d90335bcbda7d
runtests.py
runtests.py
#!/usr/bin/env python import os import sys from django.conf import settings try: from django import setup except ImportError: def setup(): pass if not settings.configured: settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', ...
#!/usr/bin/env python import os import sys from django.conf import settings try: from django import setup except ImportError: def setup(): pass if not settings.configured: settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', ...
Set middleware classes to suppress warning on 1.7+
Set middleware classes to suppress warning on 1.7+
Python
bsd-2-clause
mlavin/django-selectable,affan2/django-selectable,affan2/django-selectable,mlavin/django-selectable,mlavin/django-selectable,affan2/django-selectable
aa89bed3502e4a94ab41005dd9265bfee58fd784
runtests.py
runtests.py
#!/usr/bin/env python import os from django.core.management import call_command if __name__ == '__main__': os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' import django if hasattr(django, 'setup'): django.setup() call_command('test', nomigrations=True)
#!/usr/bin/env python import os from django.core.management import execute_from_command_line if __name__ == '__main__': os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' execute_from_command_line(['manage.py', 'test', '--nomigrations'])
Use a higher level command line api
Use a higher level command line api
Python
mit
henriquebastos/django-test-without-migrations,henriquebastos/django-test-without-migrations
e98201ae47f3af4fe8756c69464986dc524206e5
corehq/apps/hqwebapp/management/commands/list_waf_allow_patterns.py
corehq/apps/hqwebapp/management/commands/list_waf_allow_patterns.py
import re from django.core.management import BaseCommand from django.urls import get_resolver from corehq.apps.hqwebapp.decorators import waf_allow class Command(BaseCommand): def handle(self, *args, **options): resolver = get_resolver() for kind, views in waf_allow.views.items(): p...
import re from django.core.management import BaseCommand from django.urls import get_resolver from corehq.apps.hqwebapp.decorators import waf_allow class Command(BaseCommand): def handle(self, *args, **options): resolver = get_resolver() for kind, views in waf_allow.views.items(): p...
Fix issue: 'URLResolver' object has no attribute 'regex'
Fix issue: 'URLResolver' object has no attribute 'regex'
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
04d85784eeeb619e0e273aa0ffb41f12ffeada43
ureport/polls/migrations/0051_auto_20180316_0912.py
ureport/polls/migrations/0051_auto_20180316_0912.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-03-16 09:12 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('polls', '0050_auto_20170615_1455'), ] def populate_default_backend(apps, schema_ed...
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-03-16 09:12 from __future__ import unicode_literals from django.db import migrations, models from ureport.utils import chunk_list class Migration(migrations.Migration): dependencies = [ ('polls', '0050_auto_20170615_1455'), ] def pop...
Update pull results default value in batches
Update pull results default value in batches
Python
agpl-3.0
rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport
606feda80b4631f9079021214c7b6078beb9a3f4
api/v2/views/maintenance_record.py
api/v2/views/maintenance_record.py
import django_filters from rest_framework import filters from rest_framework.serializers import ValidationError from core.models import AtmosphereUser, MaintenanceRecord from core.query import only_current from api.permissions import CanEditOrReadOnly from api.v2.serializers.details import MaintenanceRecordSerialize...
import django_filters from rest_framework import filters from rest_framework.serializers import ValidationError from core.models import AtmosphereUser, MaintenanceRecord from core.query import only_current from api.permissions import CanEditOrReadOnly from api.v2.serializers.details import MaintenanceRecordSerialize...
Add 'DELETE' operation to Maintenance Record
[ATMO-1201] Add 'DELETE' operation to Maintenance Record
Python
apache-2.0
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
65abd52d1bfd54097ca6bd01b1924e6ffcad8840
pytablewriter/_csv_writer.py
pytablewriter/_csv_writer.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import dataproperty from ._text_writer import TextTableWriter class CsvTableWriter(TextTableWriter): """ Concrete class of a table writer for CSV format. :Examples: :ref:`...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import dataproperty from ._text_writer import TextTableWriter class CsvTableWriter(TextTableWriter): """ Concrete class of a table writer for CSV format. :Examples: :ref:`...
Delete redundant lines of code
Delete redundant lines of code
Python
mit
thombashi/pytablewriter
cdb55b385074d50a98f87027fd46021d663f9df8
bin/commands/utils/messages.py
bin/commands/utils/messages.py
from __future__ import print_function import sys def error(message, exit=True): """Print an error message and optionally exit.""" assert isinstance(message, str), "message must be a str" assert isinstance(exit, bool), "exit must be a bool" print("error:", message, file=sys.stderr) if exit: ...
from __future__ import print_function import sys def error(message, exit=True): """Print an error message and optionally exit.""" assert isinstance(message, str), "message must be a str" assert isinstance(exit, bool), "exit must be a bool" print("error:", message, file=sys.stderr) if exit: ...
Add warn and usage message options
Add warn and usage message options
Python
mit
Brickstertwo/git-commands
3cc1cb9894fdb1b88a84ad8315669ad2f0858fdb
cloud_logging.py
cloud_logging.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Change some errors to go to stderr.
Change some errors to go to stderr. These non-fatal errors violated GTP protocol.
Python
apache-2.0
tensorflow/minigo,tensorflow/minigo,tensorflow/minigo,tensorflow/minigo,tensorflow/minigo,tensorflow/minigo
6d13b3b041e3e6cd6089814ad3276a905aa10bc3
troposphere/fms.py
troposphere/fms.py
# Copyright (c) 2012-2020, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSProperty, AWSObject, Tags from .validators import json_checker, boolean class IEMap(AWSProperty): props = { 'ACCOUNT': ([basestring], False), } class Policy(AWSObject...
# Copyright (c) 2012-2020, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSProperty, AWSObject, Tags from .validators import json_checker, boolean class IEMap(AWSProperty): props = { 'ACCOUNT': ([basestring], False), 'ORGUNIT': ([basestrin...
Update AWS::FMS::Policy per 2020-06-18 changes
Update AWS::FMS::Policy per 2020-06-18 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
fe4cc596e65f6dc5ec7f99d40f7346143b695633
slackbot.py
slackbot.py
#! /usr/bin/env python2.7 import requests class Slackbot(object): def __init__(self, slack_name, token): self.slack_name = slack_name self.token = token assert self.token, "Token should not be blank" self.url = self.sb_url() def sb_url(self): url = "https://{}.slack....
#! /usr/bin/env python2.7 import requests class Slackbot(object): def __init__(self, slack_name, token): self.slack_name = slack_name self.token = token assert self.token, "Token should not be blank" self.url = self.sb_url() def sb_url(self): url = "https://{}.slack....
Fix unicode encoding of Slack message posts
Fix unicode encoding of Slack message posts
Python
apache-2.0
TheConnMan/destalinator,royrapoport/destalinator,randsleadershipslack/destalinator,royrapoport/destalinator,TheConnMan/destalinator,randsleadershipslack/destalinator,underarmour/destalinator
29c977a7f7293f1ce45f393a4c8464bbb9691f9e
linkedevents/urls.py
linkedevents/urls.py
from django.conf.urls import url, include from django.views.generic import RedirectView from .api import LinkedEventsAPIRouter from django.contrib import admin admin.autodiscover() api_router = LinkedEventsAPIRouter() urlpatterns = [ url(r'^(?P<version>(v0.1|v1))/', include(api_router.urls)), url(r'^admin...
from django.core.urlresolvers import reverse from django.conf.urls import url, include from django.views.generic import RedirectView from .api import LinkedEventsAPIRouter from django.contrib import admin admin.autodiscover() api_router = LinkedEventsAPIRouter() class RedirectToAPIRootView(RedirectView): perma...
Make redirect-to-API work even with URL prefix
Make redirect-to-API work even with URL prefix
Python
mit
aapris/linkedevents,aapris/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,tuomas777/linkedevents,tuomas777/linkedevents,tuomas777/linkedevents,aapris/linkedevents,City-of-Helsinki/linkedevents
63ee144892ed0e740b87cb87895cf07d78b87d1f
lib/slack.py
lib/slack.py
from lib.config import Config from slackclient import SlackClient class Tubey(): def __init__(self, **kwargs): ### Cache the client in memory ### self._client = None def get_client(self): ### Fetch a cached slack client or create one and return it ### if self._client is not No...
from lib.config import Config from slackclient import SlackClient class Tubey(): def __init__(self, **kwargs): # cache the client in memory self._client = None def send_message(self, message): raise NotImplemented def get_client(self): ### Fetch a cached slack client or c...
Revert "Implement send message functionality"
Revert "Implement send message functionality"
Python
mit
ImShady/Tubey
4eab1fb42f58d6203a0862aa9caf304193d3442b
libcloud/common/maxihost.py
libcloud/common/maxihost.py
from libcloud.utils.py3 import httplib from libcloud.common.types import InvalidCredsError from libcloud.common.base import JsonResponse from libcloud.common.base import ConnectionKey class MaxihostResponse(JsonResponse): valid_response_codes = [httplib.OK, httplib.ACCEPTED, httplib.CREATED, ...
from libcloud.utils.py3 import httplib from libcloud.common.types import InvalidCredsError from libcloud.common.base import JsonResponse from libcloud.common.base import ConnectionKey class MaxihostResponse(JsonResponse): valid_response_codes = [httplib.OK, httplib.ACCEPTED, httplib.CREATED, ...
Add Accept header to use version 1.1
Add Accept header to use version 1.1
Python
apache-2.0
ByteInternet/libcloud,andrewsomething/libcloud,ByteInternet/libcloud,Kami/libcloud,apache/libcloud,andrewsomething/libcloud,mistio/libcloud,Kami/libcloud,mistio/libcloud,andrewsomething/libcloud,apache/libcloud,apache/libcloud,ByteInternet/libcloud,Kami/libcloud,mistio/libcloud
f576004e7d1352c7e8c1e203ae0a8b6769ce1b08
cla_backend/apps/core/views.py
cla_backend/apps/core/views.py
from django.views import defaults from sentry_sdk import capture_message def page_not_found(*args, **kwargs): capture_message("Page not found", level="error") return defaults.page_not_found(*args, **kwargs)
from django.views import defaults from sentry_sdk import capture_message, push_scope def page_not_found(request, *args, **kwargs): with push_scope() as scope: scope.set_tag("type", "404") scope.set_extra("path", request.path) capture_message("Page not found", level="error") return de...
Set some event data on 404 logging
Set some event data on 404 logging
Python
mit
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
55c7681304d66ad076372be7aa8f319baef153eb
polyaxon/runner/management/commands/clean_project_jobs.py
polyaxon/runner/management/commands/clean_project_jobs.py
from django.core.management import BaseCommand from django.db import ProgrammingError from django.db.models import Q from projects.models import Project from runner.schedulers import notebook_scheduler, tensorboard_scheduler class Command(BaseCommand): @staticmethod def _clean(): for project in Proje...
from django.core.management import BaseCommand from django.db import ProgrammingError from django.db.models import Q from projects.models import Project from runner.schedulers import notebook_scheduler, tensorboard_scheduler class Command(BaseCommand): @staticmethod def _clean(): filters = Q(tensorbo...
Update clean project jobs command
Update clean project jobs command
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
1aa121daa3c99849173d5cd4c6a80d6bf94f5186
saleor/attribute/__init__.py
saleor/attribute/__init__.py
class AttributeInputType: """The type that we expect to render the attribute's values as.""" DROPDOWN = "dropdown" MULTISELECT = "multiselect" FILE = "file" REFERENCE = "reference" CHOICES = [ (DROPDOWN, "Dropdown"), (MULTISELECT, "Multi Select"), (FILE, "File"), ...
class AttributeInputType: """The type that we expect to render the attribute's values as.""" DROPDOWN = "dropdown" MULTISELECT = "multiselect" FILE = "file" REFERENCE = "reference" CHOICES = [ (DROPDOWN, "Dropdown"), (MULTISELECT, "Multi Select"), (FILE, "File"), ...
Add info about required updates in AttributeEntityType
Add info about required updates in AttributeEntityType
Python
bsd-3-clause
mociepka/saleor,mociepka/saleor,mociepka/saleor
ceb848021d5323b5bad8518ac7ed850a51fc89ca
raco/myrial/myrial_test.py
raco/myrial/myrial_test.py
import collections import math import unittest import raco.fakedb import raco.myrial.interpreter as interpreter import raco.myrial.parser as parser class MyrialTestCase(unittest.TestCase): def setUp(self): self.db = raco.fakedb.FakeDatabase() self.parser = parser.Parser() self.processor ...
import collections import math import unittest import raco.fakedb import raco.myrial.interpreter as interpreter import raco.myrial.parser as parser from raco.myrialang import compile_to_json class MyrialTestCase(unittest.TestCase): def setUp(self): self.db = raco.fakedb.FakeDatabase() self.parse...
Add compile_to_json invocation in Myrial test fixture
Add compile_to_json invocation in Myrial test fixture
Python
bsd-3-clause
uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco
3f5a6dcd622d7b1c890ced67468ecebd02b1806f
mastertickets/db_default.py
mastertickets/db_default.py
# Created by Noah Kantrowitz on 2007-07-04. # Copyright (c) 2007 Noah Kantrowitz. All rights reserved. from trac.db import Table, Column name = 'mastertickets' version = 2 tables = [ Table('mastertickets', key=('source','dest'))[ Column('source', type='integer'), Column('dest', type='integer'), ...
# Created by Noah Kantrowitz on 2007-07-04. # Copyright (c) 2007 Noah Kantrowitz. All rights reserved. from trac.db import Table, Column name = 'mastertickets' version = 2 tables = [ Table('mastertickets', key=('source','dest'))[ Column('source', type='integer'), Column('dest', type='integer'), ...
Fix the migration to actual work.
Fix the migration to actual work.
Python
bsd-3-clause
SpamExperts/trac-masterticketsplugin,SpamExperts/trac-masterticketsplugin,SpamExperts/trac-masterticketsplugin
a662eded2841b87ccbccdd6dfb21315725d0a0c5
python/pyspark_llap/__init__.py
python/pyspark_llap/__init__.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
Add aliases for HIVE_WAREHOUSE_CONNECTOR, DATAFRAME_TO_STREAM and STREAM_TO_STREAM
Add aliases for HIVE_WAREHOUSE_CONNECTOR, DATAFRAME_TO_STREAM and STREAM_TO_STREAM
Python
apache-2.0
hortonworks-spark/spark-llap,hortonworks-spark/spark-llap,hortonworks-spark/spark-llap
5a7291b9c305445aebe77ef020017ac9cffd35e2
pythonparser/test/test_utils.py
pythonparser/test/test_utils.py
# coding:utf-8 from __future__ import absolute_import, division, print_function, unicode_literals import sys unicode = type("") class BytesOnly(bytes): def __new__(cls, s): if isinstance(s, unicode): s = s.encode() return bytes.__new__(BytesOnly, s) def __eq__(self, o): r...
# coding:utf-8 from __future__ import absolute_import, division, print_function, unicode_literals unicode = type("") class BytesOnly(bytes): def __new__(cls, s): if isinstance(s, unicode): s = s.encode() return bytes.__new__(BytesOnly, s) def __eq__(self, o): return isin...
Fix indentation error in LongOnly.__ne__()
Fix indentation error in LongOnly.__ne__() Also follow Python porting best practice [__use feature detection instead of version detection__](https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection).
Python
mit
m-labs/pythonparser
57c34cae582764b69bb32faa712110a46df69dde
chaser/__init__.py
chaser/__init__.py
__version__ = "0.1"
__version__ = "0.1" import requests import io import tarfile import ccr def get_source_files(pkgname, workingdir): """Download the source tarball and extract it""" r = requests.get(ccr.getpkgurl(pkgname)) tar = tarfile.open(mode='r', fileobj=io.BytesIO(r.content)) tar.extractall(workingdir)
Add initial function for get_source_files
Add initial function for get_source_files
Python
bsd-3-clause
rshipp/chaser,rshipp/chaser
19e84f0c528fd1c19dba709972f31343284c0a40
pymatgen/__init__.py
pymatgen/__init__.py
__author__ = "Shyue Ping Ong, Anubhav Jain, Michael Kocher, Geoffroy Hautier, Will Richards, Dan Gunter, Shreyas Cholia, Vincent L Chevrier, Rickard Armiento" __date__ = "Jun 28, 2012" __version__ = "2.0.0" """ Useful aliases for commonly used objects and modules. """ from pymatgen.core.periodic_table import Element, ...
__author__ = "Shyue Ping Ong, Anubhav Jain, Michael Kocher, Geoffroy Hautier, Will Richards, Dan Gunter, Shreyas Cholia, Vincent L Chevrier, Rickard Armiento" __date__ = "Jun 28, 2012" __version__ = "2.0.0" """ Useful aliases for commonly used objects and modules. """ from pymatgen.core.periodic_table import Element, ...
Add an alias to file_open_zip_aware as openz.
Add an alias to file_open_zip_aware as openz. Former-commit-id: 97796b7a5593858b2fc15c8009658926afa3eda0 [formerly 1ce26a0b0cbddb49047da0f8bac8214fb298c646] Former-commit-id: 7bdb412108a247f3ebc9d3d9906f03c222178449
Python
mit
gVallverdu/pymatgen,richardtran415/pymatgen,Bismarrck/pymatgen,fraricci/pymatgen,aykol/pymatgen,gpetretto/pymatgen,johnson1228/pymatgen,mbkumar/pymatgen,dongsenfo/pymatgen,gVallverdu/pymatgen,blondegeek/pymatgen,aykol/pymatgen,vorwerkc/pymatgen,dongsenfo/pymatgen,nisse3000/pymatgen,czhengsci/pymatgen,setten/pymatgen,gV...
b8f67c96febd1f7bc2ce1e87f1df0a468faddb87
src/taskmaster/util.py
src/taskmaster/util.py
""" taskmaster.util ~~~~~~~~~~~~~~~ :copyright: (c) 2010 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ def import_target(target, default=None): """ >>> import_target('foo.bar:blah', 'get_jobs') <function foo.bar.blah> >>> import_target('foo.bar', 'get_jobs') <function f...
""" taskmaster.util ~~~~~~~~~~~~~~~ :copyright: (c) 2010 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ import imp import sys from os.path import exists def import_target(target, default=None): """ >>> import_target('foo.bar:blah', 'get_jobs') <function foo.bar.blah> >>> imp...
Allow targets to be specified as files
Allow targets to be specified as files
Python
apache-2.0
alex/taskmaster,dcramer/taskmaster
b5cb4fe7abaa9fe1a4c387148af6ee494f69bd07
astropy/nddata/convolution/tests/test_make_kernel.py
astropy/nddata/convolution/tests/test_make_kernel.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from numpy.testing import assert_allclose from ....tests.helper import pytest from ..make_kernel import make_kernel try: import scipy HAS_SCIPY = True except ImportError: HAS_SCIPY = False @pytest.mark.skipif('not HAS_SCI...
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from ....tests.compat import assert_allclose from ....tests.helper import pytest from ..make_kernel import make_kernel try: import scipy HAS_SCIPY = True except ImportError: HAS_SCIPY = False @pytest.mark.skipif('not HAS_...
Fix compatibility with Numpy 1.4.1
Fix compatibility with Numpy 1.4.1
Python
bsd-3-clause
AustereCuriosity/astropy,MSeifert04/astropy,pllim/astropy,DougBurke/astropy,mhvk/astropy,larrybradley/astropy,kelle/astropy,pllim/astropy,funbaker/astropy,stargaser/astropy,aleksandr-bakanov/astropy,StuartLittlefair/astropy,saimn/astropy,lpsinger/astropy,aleksandr-bakanov/astropy,joergdietrich/astropy,AustereCuriosity/...
38b236c9fb0f944b41b6300963fbf5e67d0f3fe7
mwstools/requesters/utils.py
mwstools/requesters/utils.py
import os from mws.mws import DictWrapper requesters_dir = os.path.dirname(os.path.abspath(__file__)) responses_dir = os.path.join(requesters_dir, 'responses') def write_response(response, fname): with open(os.path.join(responses_dir, fname), 'wb') as f: if isinstance(response, DictWrapper): ...
import os from mws.mws import DictWrapper requesters_dir = os.path.dirname(os.path.abspath(__file__)) responses_dir = os.path.join(requesters_dir, 'responses') def write_response(response, fname): return with open(os.path.join(responses_dir, fname), 'wb') as f: if isinstance(response, DictWrapper): ...
Write response now returns None since after packaging, the code becomes unusable
Write response now returns None since after packaging, the code becomes unusable
Python
unlicense
ziplokk1/python-amazon-mws-tools
0a3eb4b966dff69cbe582c60bf4444facb4b683d
tcconfig/_tc_command_helper.py
tcconfig/_tc_command_helper.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import, unicode_literals import subprocrunner as spr from ._common import find_bin_path from ._const import TcSubCommand from ._error import NetworkInterfaceNotFoundError def get_tc_base_comma...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import, unicode_literals import subprocrunner as spr from ._common import find_bin_path from ._const import TcSubCommand from ._error import NetworkInterfaceNotFoundError def get_tc_base_comma...
Change to avoid a DeprecationWarning
Change to avoid a DeprecationWarning
Python
mit
thombashi/tcconfig,thombashi/tcconfig
5a3a91fe075aa6d0c29cccb3b9bdfc5b40e3dba9
leapp/libraries/stdlib/__init__.py
leapp/libraries/stdlib/__init__.py
""" :py:mod:`leapp.libraries.stdlib` represents a location for functions that otherwise would be defined multiple times across leapp actors and at the same time, they are really useful for other actors. """ import six import subprocess import os def call(args, split=True): """ Call an external program, captur...
""" :py:mod:`leapp.libraries.stdlib` represents a location for functions that otherwise would be defined multiple times across leapp actors and at the same time, they are really useful for other actors. """ import six import subprocess import os from leapp.libraries.stdlib import api def call(args, split=True): ...
Make api directly available in stdlib
stdlib: Make api directly available in stdlib
Python
lgpl-2.1
leapp-to/prototype,leapp-to/prototype,leapp-to/prototype,leapp-to/prototype
e582ef07d4b9f537e31d31c1546df870a2bd361c
tests/plugins/async_plugin/asyncplugin.py
tests/plugins/async_plugin/asyncplugin.py
from senpy.plugins import AnalysisPlugin import multiprocessing class AsyncPlugin(AnalysisPlugin): def _train(self, process_number): return process_number def _do_async(self, num_processes): with multiprocessing.Pool(processes=num_processes) as pool: values = pool.map(self._train...
from senpy.plugins import AnalysisPlugin import multiprocessing def _train(process_number): return process_number class AsyncPlugin(AnalysisPlugin): def _do_async(self, num_processes): pool = multiprocessing.Pool(processes=num_processes) values = pool.map(_train, range(num_processes)) ...
Fix multiprocessing tests in python2.7
Fix multiprocessing tests in python2.7 Closes #28 for python 2. Apparently, process pools are not contexts in python 2.7. On the other hand, in py2 you cannot pickle instance methods, so you have to implement Pool tasks as independent functions.
Python
apache-2.0
gsi-upm/senpy,gsi-upm/senpy,gsi-upm/senpy
1a534a3ac6ab1617e9d48e84ce34c0b482730e4d
pritunl_node/call_buffer.py
pritunl_node/call_buffer.py
from constants import * import collections import uuid class CallBuffer(): def __init__(self): self.waiter = None self.queue = collections.deque(maxlen=CALL_QUEUE_MAX) self.call_waiters = {} def wait_for_calls(self, callback): self.stop_waiter() calls = [] while...
from constants import * import collections import uuid class CallBuffer(): def __init__(self): self.waiter = None self.queue = collections.deque(maxlen=CALL_QUEUE_MAX) self.call_waiters = {} def wait_for_calls(self, callback): self.stop_waiter() calls = [] while...
Add cancel call to call buffer
Add cancel call to call buffer
Python
agpl-3.0
pritunl/pritunl-node,pritunl/pritunl-node
716f953069b4fceebe4fec1a1ea2402e77cbb629
docs/src/conf.py
docs/src/conf.py
# -*- coding: utf-8 -*- import os import stat from os.path import join, abspath from subprocess import call def prepare(globs, locs): # RTD defaults the current working directory to where conf.py resides. # In our case, that means <root>/docs/src/. cwd = os.getcwd() root = abspath(join(cwd, '..', '..'...
# -*- coding: utf-8 -*- import os import stat from os.path import join, abspath from subprocess import call def prepare(globs, locs): # RTD defaults the current working directory to where conf.py resides. # In our case, that means <root>/docs/src/. cwd = os.getcwd() root = abspath(join(cwd, '..', '..'...
Replace execfile with py3 equivalent
Replace execfile with py3 equivalent
Python
mit
Erebot/Plop
a02739cc7b1384e51f44d86a05af5a9845469fca
pygame/__init__.py
pygame/__init__.py
""" XXX: fish """ from pygame.color import Color from pygame.rect import Rect from pygame.surface import Surface from pygame.constants import * from pygame import ( display, color, surface, time, event, constants, sprite, mouse, locals, image, transform, pkgdata, font, mixer, cursors, key, draw ) from pyga...
""" XXX: fish """ from pygame.color import Color from pygame.rect import Rect from pygame.surface import Surface from pygame.constants import * from pygame import ( display, color, surface, time, event, constants, sprite, mouse, locals, image, transform, pkgdata, font, mixer, cursors, key, draw ) from pyga...
Add Mask to toplevel pygame namespace
Add Mask to toplevel pygame namespace
Python
lgpl-2.1
CTPUG/pygame_cffi,caseyc37/pygame_cffi,CTPUG/pygame_cffi,caseyc37/pygame_cffi,caseyc37/pygame_cffi,CTPUG/pygame_cffi
409182019048a5cb84499258f6f8daaffb62aeae
tests/test_simulation_forward.py
tests/test_simulation_forward.py
import os import pytest import pandas as pd from glob import glob import numpy as np from gypsy import DATA_DIR from gypsy.forward_simulation import simulate_forwards_df TEST_FILES = glob(os.path.join(DATA_DIR, 'forward_simulation_files', '*.csv')) TEST_FILES = [(item) for item in TEST_FILES] CHART_FILES = glob(os.p...
import os import pytest import pandas as pd from glob import glob import numpy as np from gypsy import DATA_DIR from gypsy.forward_simulation import simulate_forwards_df TEST_FILES = glob(os.path.join(DATA_DIR, 'forward_simulation_files', '*.csv')) TEST_FILES = [(item) for item in TEST_FILES] CHART_FILES = glob(os.p...
Revise tests to use np.testing.assert_allclose
Revise tests to use np.testing.assert_allclose this is better - if na values mismatch (e,g, na in result where expected has a value) this errors and gives a message to that effect. the previous one just errored and it was very hard to tell why
Python
mit
tesera/pygypsy,tesera/pygypsy
0f9cb6eb32ce014cb6ae8d24aefed2347efe68d9
src/python/cargo/condor/host.py
src/python/cargo/condor/host.py
""" cargo/condor/host.py Host individual condor jobs. @author: Bryan Silverthorn <bcs@cargo-cult.org> """ import os import sys import cPickle as pickle def main(): """ Application entry point. """ # make the job identifier obvious process_number = int(os.environ["CONDOR_PROCESS"]) cluster_...
""" cargo/condor/host.py Host individual condor jobs. @author: Bryan Silverthorn <bcs@cargo-cult.org> """ import os import sys import cPickle as pickle def main(): """ Application entry point. """ # make the job identifier obvious process_number = int(os.environ["CONDOR_PROCESS"]) cluster_...
Load job from a job file instead of stdin.
Load job from a job file instead of stdin.
Python
mit
borg-project/cargo,borg-project/cargo
354fb43cc95d68b06b85e8d1fa2426ca663ef8b9
common/__init__.py
common/__init__.py
VERSION = (0, 0, 0) __version__ = '.'.join(map(str, VERSION)) from django import template template.add_to_builtins('common.templatetags.common') template.add_to_builtins('common.templatetags.development')
VERSION = (0, 1, 0) __version__ = '.'.join(map(str, VERSION)) from django import template template.add_to_builtins('common.templatetags.common') template.add_to_builtins('common.templatetags.development') # Add db_name to options for use in model.Meta class import django.db.models.options as options options.DEFAULT_N...
Add db_name to options for use in model.Meta class
Add db_name to options for use in model.Meta class
Python
bsd-3-clause
baskoopmans/djcommon,baskoopmans/djcommon,baskoopmans/djcommon
02d184f94e2e5a0521e2ec06e2c10ca644ba2cef
python/balcaza/t2wrapper.py
python/balcaza/t2wrapper.py
from t2activity import NestedWorkflow from t2types import ListType, String from t2flow import Workflow class WrapperWorkflow(Workflow): def __init__(self, flow): self.flow = flow Workflow.__init__(self, flow.title, flow.author, flow.description) setattr(self.task, flow.name, NestedWorkflow(flow)) nested = ge...
from t2activity import NestedWorkflow from t2types import ListType, String from t2flow import Workflow class WrapperWorkflow(Workflow): def __init__(self, flow): self.flow = flow Workflow.__init__(self, flow.title, flow.author, flow.description) self.task[flow.name] = NestedWorkflow(flow) nested = self.task[...
Use [] notation in wrapper module for task management
Use [] notation in wrapper module for task management
Python
lgpl-2.1
jongiddy/balcazapy,jongiddy/balcazapy,jongiddy/balcazapy
3048bf667ec24c93d1c60f08124d68b6d1fc458d
src/python/borg/defaults.py
src/python/borg/defaults.py
"""@author: Bryan Silverthorn <bcs@cargo-cult.org>""" import os machine_speed = 1.0 minimum_fake_run_budget = 1800.0 # XXX proc_poll_period = 1.0 root_log_level = os.environ.get("BORG_LOG_ROOT_LEVEL", "NOTSET") try: from borg_site_defaults import * except ImportError: pass
"""@author: Bryan Silverthorn <bcs@cargo-cult.org>""" import os machine_speed = 1.0 proc_poll_period = 1.0 root_log_level = os.environ.get("BORG_LOG_ROOT_LEVEL", "NOTSET") try: from borg_site_defaults import * except ImportError: pass
Remove an ancient configuration setting.
Remove an ancient configuration setting.
Python
mit
borg-project/borg
525f7fff89e02e54ad2a731533e6b817424594f1
tomviz/python/RotationAlign.py
tomviz/python/RotationAlign.py
# Perform alignment to the estimated rotation axis # # Developed as part of the tomviz project (www.tomviz.com). def transform_scalars(dataset, SHIFT=None, rotation_angle=90.0): from tomviz import utils from scipy import ndimage import numpy as np data_py = utils.get_array(dataset) # Get data as nump...
# Perform alignment to the estimated rotation axis # # Developed as part of the tomviz project (www.tomviz.com). def transform_scalars(dataset, SHIFT=None, rotation_angle=90.0): from tomviz import utils from scipy import ndimage import numpy as np data_py = utils.get_array(dataset) # Get data as nump...
Fix ndimage complaining about shift being of NoneType
Fix ndimage complaining about shift being of NoneType
Python
bsd-3-clause
OpenChemistry/tomviz,OpenChemistry/tomviz,mathturtle/tomviz,mathturtle/tomviz,mathturtle/tomviz,OpenChemistry/tomviz,OpenChemistry/tomviz
669b95d2092f67bcc220b5fa106064d6c3df6a63
rolca_core/urls.py
rolca_core/urls.py
from __future__ import absolute_import, unicode_literals from django.conf.urls import patterns, url from django.views.generic import TemplateView urlpatterns = patterns( # pylint: disable=invalid-name '', url(r'^$', 'uploader.views.upload_app', name="upload_app"), url(r'^potrditev$', TemplateVie...
from __future__ import absolute_import, unicode_literals from django.conf.urls import url from django.views.generic import TemplateView from . import views as core_views urlpatterns = [ # pylint: disable=invalid-name url(r'^$', core_views.upload_app, name="upload_app"), url(r'^potrditev$', TemplateV...
Rewrite urlpatterns to new format
Rewrite urlpatterns to new format
Python
apache-2.0
dblenkus/rolca,dblenkus/rolca,dblenkus/rolca
54046bfb8834f5fc2a93841ae56e2790ae82eecf
shared/api.py
shared/api.py
from __future__ import print_function import boto3 import json import os import btr3baseball jobTable = os.environ['JOB_TABLE'] jobQueue = os.environ['JOB_QUEUE'] queue = boto3.resource('sqs').get_queue_by_name(QueueName=jobQueue) jobRepo = btr3baseball.JobRepository(jobTable) dsRepo = btr3baseball.DatasourceReposito...
from __future__ import print_function import boto3 import json import os import btr3baseball jobTable = os.environ['JOB_TABLE'] jobQueue = os.environ['JOB_QUEUE'] queue = boto3.resource('sqs').get_queue_by_name(QueueName=jobQueue) jobRepo = btr3baseball.JobRepository(jobTable) dsRepo = btr3baseball.DatasourceReposito...
Add debug print of data
Add debug print of data
Python
apache-2.0
bryantrobbins/baseball,bryantrobbins/baseball,bryantrobbins/baseball,bryantrobbins/baseball,bryantrobbins/baseball
b44d34f8bc5264d495dc4c2176654b0bd53bfb8a
mistral/api/wsgi.py
mistral/api/wsgi.py
# Copyright 2015 - StackStorm, 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 ...
# Copyright 2015 - StackStorm, 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 ...
Remove transport from WSGI script
Remove transport from WSGI script The setup_app method no longer requires transport as input. Change-Id: I4caf397a48e30822d423c8cf7d40f2773f9aa951 Closes-Bug: 1443654
Python
apache-2.0
dennybaa/mistral,openstack/mistral,StackStorm/mistral,dennybaa/mistral,openstack/mistral,StackStorm/mistral
a16b51bb26761f8c4a30c06da4c711dac24ac3e0
mr/preprocessing.py
mr/preprocessing.py
import numpy as np from scipy.ndimage.filters import uniform_filter from scipy.ndimage.fourier import fourier_gaussian def bandpass(image, lshort, llong, threshold=1): """Convolve with a Gaussian to remove short-wavelength noise, and subtract out long-wavelength variations, retaining features of intermedi...
import numpy as np from scipy.ndimage.filters import uniform_filter from scipy.ndimage.fourier import fourier_gaussian import warnings first_run = True try: import pyfftw except ImportError: fftn = np.fft.fftn ifftn = np.fft.ifftn else: def _maybe_align(a): global planned if first_run:...
Add optional dependence on FFTW for faster bandpass
ENH: Add optional dependence on FFTW for faster bandpass
Python
bsd-3-clause
daniorerio/trackpy,daniorerio/trackpy
47b031db83f5cb90f786029a6ffbdb7a599145db
timepiece/context_processors.py
timepiece/context_processors.py
from django.conf import settings from timepiece import models as timepiece from timepiece.forms import QuickSearchForm def timepiece_settings(request): default_famfamfam_url = settings.STATIC_URL + 'images/icons/' famfamfam_url = getattr(settings, 'FAMFAMFAM_URL', default_famfamfam_url) context = { ...
from django.conf import settings from timepiece import models as timepiece from timepiece.forms import QuickSearchForm def timepiece_settings(request): default_famfamfam_url = settings.STATIC_URL + 'images/icons/' famfamfam_url = getattr(settings, 'FAMFAMFAM_URL', default_famfamfam_url) context = { ...
Apply active_entries fix from payroll-reports branch
Apply active_entries fix from payroll-reports branch
Python
mit
gaga3966/django-timepiece,josesanch/django-timepiece,BocuStudio/django-timepiece,dannybrowne86/django-timepiece,josesanch/django-timepiece,BocuStudio/django-timepiece,gaga3966/django-timepiece,BocuStudio/django-timepiece,arbitrahj/django-timepiece,caktus/django-timepiece,arbitrahj/django-timepiece,gaga3966/django-timep...
943e920603d5507a37c1b0c835c598972f0f2cff
github/models.py
github/models.py
import json, requests from wagtail.wagtailadmin.edit_handlers import FieldPanel from wagtail.wagtailcore.models import Page, Orderable import django.utils.dateparse as dateparse from django.db import models from django.core.cache import cache class GithubOrgIndexPage(Page): github_org_name = models.CharField(defa...
import json, requests from wagtail.wagtailadmin.edit_handlers import FieldPanel from wagtail.wagtailcore.models import Page, Orderable import django.utils.dateparse as dateparse from django.db import models from django.core.cache import cache class GithubOrgIndexPage(Page): github_org_name = models.CharField(defa...
Check github response before parsing
Check github response before parsing
Python
agpl-3.0
City-of-Helsinki/devheldev,City-of-Helsinki/devheldev,terotic/devheldev,terotic/devheldev,City-of-Helsinki/devheldev,terotic/devheldev
fba4fdf426b0a29ca06deb67587c2bd804adb017
tbgxmlutils/xmlutils.py
tbgxmlutils/xmlutils.py
#!/usr/bin/env python from xml.dom import minidom import xml.etree.ElementTree as ET import xmltodict def add(k, parent=None, txt=None, attrs=None): if parent is None: handle = ET.Element(k) else: handle = ET.SubElement(parent, k) if txt: handle.text = unicode(txt) try: for k, v in attrs.iteritems...
#!/usr/bin/env python from xml.dom import minidom import lxml.etree as ET import xmltodict def add(k, parent=None, txt=None, attrs=None): if parent is None: handle = ET.Element(k) else: handle = ET.SubElement(parent, k) if txt: handle.text = unicode(txt) try: for k, v in attrs.iteritems(): handle....
Use lxml instead of elementtree.
Use lxml instead of elementtree.
Python
mit
Schwarzschild/TBGXMLUtils
ac3f56f4ed0826600b9adbbf8dfe3b99ce508ac6
migrations/versions/0334_broadcast_message_number.py
migrations/versions/0334_broadcast_message_number.py
""" Revision ID: 0334_broadcast_message_number Revises: 0333_service_broadcast_provider Create Date: 2020-12-04 15:06:22.544803 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql revision = '0334_broadcast_message_number' down_revision = '0333_service_broadcast_provider' ...
""" Revision ID: 0334_broadcast_message_number Revises: 0333_service_broadcast_provider Create Date: 2020-12-04 15:06:22.544803 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql revision = '0334_broadcast_message_number' down_revision = '0333_service_broadcast_provider' ...
Delete unneeded code form migration
Delete unneeded code form migration
Python
mit
alphagov/notifications-api,alphagov/notifications-api
6f3b0c997f7207279bf836edc94db1ac19d2ce1d
src/rabird/core/logging.py
src/rabird/core/logging.py
''' @date 2013-5-9 @author Hong-She Liang <starofrainnight@gmail.com> ''' import sys import os # Import the global logging unit, not our logging . global_logging = __import__('logging') def load_default_config(): arguments = { 'level': None, 'filename': None, 'filemode'...
''' @date 2013-5-9 @author Hong-She Liang <starofrainnight@gmail.com> ''' import sys import os # Import the global logging unit, not our logging . global_logging = __import__('logging') def load_default_config(): arguments = { 'level': None, 'filename': None, 'filemode'...
Use old style string format method to avoid formatting warning
Use old style string format method to avoid formatting warning
Python
apache-2.0
starofrainnight/rabird.core
2de7427d06ff33bf8bdfe0424e07b3fb34621b07
shop/user/views.py
shop/user/views.py
# -*- coding: utf-8 -*- """User views.""" from flask import Blueprint, render_template from flask_login import login_required blueprint = Blueprint('user', __name__, url_prefix='/users', static_folder='../static') @blueprint.route('/') @login_required def members(): """List members.""" return render_template...
# -*- coding: utf-8 -*- """User views.""" from flask import Blueprint, render_template from flask_login import login_required blueprint = Blueprint( 'user', __name__, url_prefix='/users', static_folder='../static' ) @blueprint.route('/') @login_required def members(): """List members.""" return rende...
Clean up code a bit
Clean up code a bit
Python
bsd-3-clause
joeirimpan/shop,joeirimpan/shop,joeirimpan/shop
ff59a35d5ea90169e34d65bd9ec3a6177e1faebd
thinglang/execution/stack.py
thinglang/execution/stack.py
class StackFrame(object): def __init__(self, instance): self.instance = instance self.data = {} self.idx = 0 self.return_value = None def __setitem__(self, key, value): print('\tSET<{}> {}: {}'.format(self.idx, key, value)) self.data[key] = (self.idx, value) ...
class StackFrame(object): def __init__(self, instance): self.instance = instance self.data = {} self.idx = 0 self.return_value = None def __setitem__(self, key, value): print('\tSET<{}> {}: {}'.format(self.idx, key, value)) self.data[key] = (self.idx, value) ...
Add index assertion during segment exit and fix segment cleanup logic
Add index assertion during segment exit and fix segment cleanup logic
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
f024e340a6a443bb765b67bbdb811fa44fd3d19b
tests/test_resources.py
tests/test_resources.py
from flask import json from helper import TestCase from models import db, Major class StudentsTestCase(TestCase): def setUp(self): super(StudentsTestCase, self).setUp() with self.appx.app_context(): db.session.add(Major(id=1, university_id=1, name='Major1')) db.session.ad...
from flask import json from helper import TestCase from models import db, Major, Student class StudentsTestCase(TestCase): def setUp(self): super(StudentsTestCase, self).setUp() with self.appx.app_context(): db.session.add(Major(id=1, university_id=1, name='Major1')) db.s...
Improve testing of student patching
Improve testing of student patching
Python
agpl-3.0
SCUEvals/scuevals-api,SCUEvals/scuevals-api
938043259eefdec21994489d68b1cf737618ba34
test/test_conversion.py
test/test_conversion.py
import unittest from src import conversion class TestNotationConverter(unittest.TestCase): """Tests for NotationConverter class""" def test_alg_search_good_input_a5(self): """Input with 'a5'""" actual_result = main.TileLine('w').line expected_result = ' ' self.assertEqual(...
"""Tests for conversion module""" import unittest from src import conversion class TestNotationConverter(unittest.TestCase): """Tests for NotationConverter class""" def test_alg_search_good_input_a5(self): """Input with 'a5'""" n_con = conversion.NotationConverter() actual_result = n_c...
Add tests for NotationConverter methods
Add tests for NotationConverter methods
Python
mit
blairck/chess_notation
b6cfa50e127d3f74247ab148219ef6336e445cca
InvenTree/InvenTree/ready.py
InvenTree/InvenTree/ready.py
import sys def canAppAccessDatabase(): """ Returns True if the apps.py file can access database records. There are some circumstances where we don't want the ready function in apps.py to touch the database """ # If any of the following management commands are being executed, # prevent cu...
import sys def canAppAccessDatabase(): """ Returns True if the apps.py file can access database records. There are some circumstances where we don't want the ready function in apps.py to touch the database """ # If any of the following management commands are being executed, # prevent cu...
Allow data operations to run for 'test'
Allow data operations to run for 'test'
Python
mit
inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree
fef28556bc4d105feb44345782c632b8d3befa3f
server/acre/settings/dev.py
server/acre/settings/dev.py
from .base import * import os DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['RDS_DB_NAME'], 'HOST': os.environ['RDS_HOSTNAME'], 'PORT': os.environ['RDS_PORT'], 'USER': os.environ['RDS_USERNAME'], 'PASSWORD': os.envi...
from .base import * import os DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['RDS_DB_NAME'], 'HOST': os.environ['RDS_HOSTNAME'], 'PORT': os.environ['RDS_PORT'], 'USER': os.environ['RDS_USERNAME'], 'PASSWORD': os.envi...
Add acre.one to allowed host
Add acre.one to allowed host
Python
mit
yizhang7210/Acre,yizhang7210/Acre,yizhang7210/Acre,yizhang7210/Acre
1636fe834830ebb6644d17f908f893a3c2a41e33
tests/test_sentences.py
tests/test_sentences.py
# import pytest from sdsc import sentencesegmenter @pytest.mark.parametrize("sentence,expected", ( # 1 ("This is a simple ##@command-2## sentence. This one too.", ["This is a simple ##@command-2## sentence", "This one too"]), # 2 ("This is not a test in one go. openSUSE is not written with a capital ...
# import pytest from sdsc import sentencesegmenter @pytest.mark.parametrize("sentence,expected", ( # 0 - a single simple sentence ("This is a simple sentence.", ["This is a simple sentence"]), # 1 - two simple sentences ("This is a simple ##@command-2## sentence. This one is too.", ["This is a si...
Expand the sentence segmentation tests a little()
Expand the sentence segmentation tests a little()
Python
lgpl-2.1
sknorr/suse-doc-style-checker,sknorr/suse-doc-style-checker,sknorr/suse-doc-style-checker
dd7513f4146679d11aff6d528f11927131dc692f
feder/monitorings/factories.py
feder/monitorings/factories.py
from .models import Monitoring from feder.users.factories import UserFactory import factory class MonitoringFactory(factory.django.DjangoModelFactory): name = factory.Sequence(lambda n: 'monitoring-%04d' % n) user = factory.SubFactory(UserFactory) class Meta: model = Monitoring django_get...
from .models import Monitoring from feder.users.factories import UserFactory import factory class MonitoringFactory(factory.django.DjangoModelFactory): name = factory.Sequence(lambda n: 'monitoring-%04d' % n) user = factory.SubFactory(UserFactory) description = factory.Sequence(lambda n: 'description no.%...
Add description and template to MonitoringFactory
Add description and template to MonitoringFactory
Python
mit
watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder
b17e39436bde57558c1a9d6e70330a51dd1d0d19
website/addons/osffiles/utils.py
website/addons/osffiles/utils.py
from website.addons.osffiles.exceptions import FileNotFoundError def get_versions(filename, node): """Return file versions for a :class:`NodeFile`. :raises: FileNotFoundError if file does not exists for the node. """ try: return node.files_versions[filename.replace('.', '_')] except KeyEr...
from website.addons.osffiles.exceptions import FileNotFoundError def get_versions(filename, node): """Return IDs for a file's version records. :param str filename: The name of the file. :param Node node: The node which has the requested file. :return: List of ids (strings) for :class:`NodeFile` recor...
Clarify documentation for get_versions and get_latest_version_number.
Clarify documentation for get_versions and get_latest_version_number.
Python
apache-2.0
bdyetton/prettychart,Johnetordoff/osf.io,caneruguz/osf.io,ZobairAlijan/osf.io,brandonPurvis/osf.io,arpitar/osf.io,GageGaskins/osf.io,DanielSBrown/osf.io,brianjgeiger/osf.io,fabianvf/osf.io,caseyrygt/osf.io,dplorimer/osf,MerlinZhang/osf.io,zkraime/osf.io,zkraime/osf.io,hmoco/osf.io,lamdnhan/osf.io,cosenal/osf.io,lyndsys...
0f9418eed089938e0094f40cc15682ef59e041a1
__init__.py
__init__.py
# -*- coding: utf8 -*- import default_settings from flask.ext.plugins import Plugin from flask import current_app as app from pybossa_gravatar.gravatar import Gravatar from pybossa.model.user import User from sqlalchemy import event __plugin__ = "PyBossaGravatar" __version__ = "0.1.0" gravatar = Gravatar() class P...
# -*- coding: utf8 -*- import default_settings from flask.ext.plugins import Plugin from flask import current_app as app from flask import redirect from pybossa_gravatar.gravatar import Gravatar from pybossa.model.user import User from sqlalchemy import event from flask.ext.login import current_user __plugin__ = "PyB...
Add URL rule to set Gravatar for current user
Add URL rule to set Gravatar for current user
Python
bsd-3-clause
alexandermendes/pybossa-gravatar
8d8863fe178b085c6ce7500996f9c2d2c8f159f6
umibukela/csv_export.py
umibukela/csv_export.py
from collections import OrderedDict def form_questions(form): d = OrderedDict() children = form['children'] for child in children: if 'pathstr' in child and 'control' not in child: d.update({child['pathstr']: ''}) elif 'children' in child: for minor in child['childr...
from collections import OrderedDict def form_questions(form): d = OrderedDict() children = form['children'] for child in children: if 'pathstr' in child and 'control' not in child and child['type'] != 'group': d.update({child['pathstr']: ''}) elif 'children' in child: ...
Make sure correct type is excluded
Make sure correct type is excluded
Python
mit
Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela