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
f26c2059ff6e2a595097ef7a03efe149f9e253eb
iterator.py
iterator.py
import os, re, requests rootdir = '_posts' for subdir, dirs, files in os.walk(rootdir): for file in files: filename = os.path.join(subdir, file) f = open(filename, "r") contents = f.readlines() f.close() # Find first image for key, line in enumerate(contents): src = re.sear...
import os, re, requests rootdir = '_posts' for subdir, dirs, files in os.walk(rootdir): for file in files: filename = os.path.join(subdir, file) f = open(filename, "r") contents = f.readlines() f.close() # Find first image if re.search('podcast', filename): if re.s...
Add default images for podcasts if necessary
Add default images for podcasts if necessary
Python
mit
up1/blog-1,up1/blog-1,up1/blog-1
3f70ead379b7f586313d01d5ab617fd5368f8ce3
cthulhubot/management/commands/restart_masters.py
cthulhubot/management/commands/restart_masters.py
from django.core.management.base import BaseCommand from cthulhubot.models import Buildmaster class Command(BaseCommand): help = 'Restart all Buildmaster processes' args = "" def handle(self, *fixture_labels, **options): verbosity = int(options.get('verbosity', 1)) commit = int(options.ge...
from traceback import print_exc from django.core.management.base import BaseCommand from cthulhubot.models import Buildmaster class Command(BaseCommand): help = 'Restart all Buildmaster processes' args = "" def handle(self, *fixture_labels, **options): verbosity = int(options.get('verbosity', 1))...
Print traceback if startup fails
Print traceback if startup fails
Python
bsd-3-clause
centrumholdings/cthulhubot
355040c346ee26f763561529422b951e312e3db2
profile/files/openstack/horizon/overrides.py
profile/files/openstack/horizon/overrides.py
# Disable Floating IPs from openstack_dashboard.dashboards.project.access_and_security import tabs from openstack_dashboard.dashboards.project.instances import tables import horizon NO = lambda *x: False tabs.FloatingIPsTab.allowed = NO tabs.APIAccessTab.allowed = NO tables.AssociateIP.allowed = NO tables.SimpleAssoc...
# Disable Floating IPs from openstack_dashboard.dashboards.project.access_and_security import tabs from openstack_dashboard.dashboards.project.instances import tables import horizon NO = lambda *x: False tabs.FloatingIPsTab.allowed = NO tabs.APIAccessTab.allowed = NO tables.AssociateIP.allowed = NO tables.SimpleAssoc...
Remove non-working network topology panel
Remove non-working network topology panel
Python
apache-2.0
eckhart/himlar,tanzr/himlar,TorLdre/himlar,mikaeld66/himlar,norcams/himlar,raykrist/himlar,eckhart/himlar,norcams/himlar,TorLdre/himlar,norcams/himlar,norcams/himlar,raykrist/himlar,mikaeld66/himlar,eckhart/himlar,TorLdre/himlar,tanzr/himlar,mikaeld66/himlar,tanzr/himlar,TorLdre/himlar,mikaeld66/himlar,eckhart/himlar,n...
dc229325a7a527c2d2143b105b47899140018e32
darkoob/social/admin.py
darkoob/social/admin.py
from django.contrib import admin from models import UserProfile class UserProfileAdmin(admin.ModelAdmin): list_display = ('user',) # list_display = ('user','sex') # search_fields = ('user',) # list_filter = ('sex',ist_display = ('user','sex') # search_fields = ('user',) # list_filter = ('sex','birthplace')...
from django.contrib import admin from models import UserProfile class UserProfileAdmin(admin.ModelAdmin): list_display = ('user', 'sex') search_fields = ('user',) admin.site.register(UserProfile,UserProfileAdmin)
Add UserProfile Model To Django Admin Website
Add UserProfile Model To Django Admin Website
Python
mit
s1na/darkoob,s1na/darkoob,s1na/darkoob
76709e594bd863476c4111185d98ca2551c460d3
ds_graph.py
ds_graph.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function class Graph(object): """Graph class.""" pass def main(): pass if __name__ == '__main__': main()
from __future__ import absolute_import from __future__ import division from __future__ import print_function class Vertex(object): """Vertex class. It uses a dict to keep track of the vertices which it's connected. """ class Graph(object): """Graph class. It contains a dict to map vertex name to ver...
Add Vertex class and doc strings for 2 classes
Add Vertex class and doc strings for 2 classes
Python
bsd-2-clause
bowen0701/algorithms_data_structures
01c571a3767339caf81dca61c6525f9c9bcf66fd
formlibrary/migrations/0005_auto_20171204_0203.py
formlibrary/migrations/0005_auto_20171204_0203.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-12-04 10:03 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): dependencies = [ ('workflow', '0007_auto_20171204_0203'), ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-12-04 10:03 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): dependencies = [ ('workflow', '0007_auto_20171204_0203'), ...
Fix the CustomForm migration script
Fix the CustomForm migration script
Python
apache-2.0
toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity
ec441eb63a785ad1ab15356f60f812a57a726788
lib/Subcommands/Pull.py
lib/Subcommands/Pull.py
from lib.Wrappers.ArgumentParser import ArgumentParser from lib.DockerManagerFactory import DockerManagerFactory class Pull: def __init__(self, manager_factory=None): self.manager_factory = manager_factory or DockerManagerFactory() def execute(self, *args): arguments = self._parse_arguments(*...
import os from lib.DockerComposeExecutor import DockerComposeExecutor from lib.Tools import paths class Pull: def __init__(self, manager_factory=None): pass def execute(self, *args): file_path = os.getcwd() + '/environments/compose_files/latest/docker-compose-all.yml' docker_compose ...
Refactor the 'pull' subcommand to use DockerComposeExecutor
Refactor the 'pull' subcommand to use DockerComposeExecutor The pull subcommand was not working because it depended on an unimplemented class DockerManagerFactory.
Python
agpl-3.0
Open365/Open365,Open365/Open365
9db16e16db9131806d76a1f6875dfba33a7d452b
smile_model_graph/__openerp__.py
smile_model_graph/__openerp__.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2013 Smile (<http://www.smile.fr>). All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under th...
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2013 Smile (<http://www.smile.fr>). All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under th...
Rename Objects to Models in module description
[IMP] Rename Objects to Models in module description
Python
agpl-3.0
tiexinliu/odoo_addons,chadyred/odoo_addons,chadyred/odoo_addons,ovnicraft/odoo_addons,bmya/odoo_addons,odoocn/odoo_addons,odoocn/odoo_addons,tiexinliu/odoo_addons,chadyred/odoo_addons,odoocn/odoo_addons,ovnicraft/odoo_addons,bmya/odoo_addons,ovnicraft/odoo_addons,bmya/odoo_addons,tiexinliu/odoo_addons
7a14c03e0864ca51993d2f05eabd2319c495ba90
recipyGui/views.py
recipyGui/views.py
from flask import Blueprint, request, redirect, render_template, url_for from flask.views import MethodView from recipyGui import recipyGui, mongo from forms import SearchForm runs = Blueprint('runs', __name__, template_folder='templates') @recipyGui.route('/') def index(): form = SearchForm() query = reques...
from flask import Blueprint, request, redirect, render_template, url_for from flask.views import MethodView from recipyGui import recipyGui, mongo from forms import SearchForm runs = Blueprint('runs', __name__, template_folder='templates') @recipyGui.route('/') def index(): form = SearchForm() query = reques...
Sort runs by text score
Sort runs by text score Search results for runs are sorted by text score.
Python
apache-2.0
recipy/recipy-gui,musically-ut/recipy,github4ry/recipy,github4ry/recipy,recipy/recipy,MichielCottaar/recipy,recipy/recipy-gui,MBARIMike/recipy,recipy/recipy,MBARIMike/recipy,bsipocz/recipy,bsipocz/recipy,MichielCottaar/recipy,musically-ut/recipy
4e94612f7fad4b231de9c1a4044259be6079a982
fabtasks.py
fabtasks.py
# -*- coding: utf-8 -*- from fabric.api import task, run def _generate_password(): import string from random import sample chars = string.letters + string.digits return ''.join(sample(chars, 8)) def create_mysql_instance(mysql_user, mysql_password, instance_code): user = instance_code passwo...
# -*- coding: utf-8 -*- from fabric.api import run def _generate_password(): import string from random import sample chars = string.letters + string.digits return ''.join(sample(chars, 8)) def create_mysql_instance(mysql_user, mysql_password, instance_code): user = instance_code password = _...
Split create database and create user into to individual commands
Split create database and create user into to individual commands
Python
mit
goncha/fablib
25777afb24441f54edab1f9daa1bfc7a25c6d0ad
tests/test_regex_parser.py
tests/test_regex_parser.py
import unittest # Ensuring that the proper path is found; there must be a better way import os import sys sys.path.insert(0, os.path.normpath(os.path.join(os.getcwd(), ".."))) # other imports proceed from parsers.regex_parser import BaseParser from src import svg class TestBaseParser(unittest.TestCase): ''' descr...
import unittest # Ensuring that the proper path is found; there must be a better way import os import sys sys.path.insert(0, os.path.normpath(os.path.join(os.getcwd(), ".."))) # other imports proceed from parsers.regex_parser import BaseParser from src import svg class TestBaseParser(unittest.TestCase): ''' descr...
Work on unit test for regex_parser (preparing to refactor).
Work on unit test for regex_parser (preparing to refactor).
Python
bsd-3-clause
aroberge/docpicture,aroberge/docpicture
e10743d9973f479a4d9816f4aafeaacaffa1bd4d
tests/test_spam_filters.py
tests/test_spam_filters.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Unit tests for spam filters. """ import unittest from django.conf import settings from django.test import TestCase try: import honeypot except ImportError: honeypot = None from envelope.spam_filters import check_honeypot # mocking form ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Unit tests for spam filters. """ import unittest from django.conf import settings try: import honeypot except ImportError: honeypot = None from envelope.spam_filters import check_honeypot # mocking form and request, no need to use the r...
Use simple TestCase in spam filter tests.
Use simple TestCase in spam filter tests.
Python
mit
zsiciarz/django-envelope,r4ts0n/django-envelope,zsiciarz/django-envelope,r4ts0n/django-envelope
b37e9d1cc315e04d763b646bb028612b86768d37
migrations/versions/360_add_pass_fail_returned.py
migrations/versions/360_add_pass_fail_returned.py
""" Add columns to supplier_frameworks to indicate Pass/Fail and whether a Framework Agreement has been returned. Revision ID: 360_add_pass_fail_returned Revises: 340 Create Date: 2015-10-23 16:25:02.068155 """ # revision identifiers, used by Alembic. revision = '360_add_pass_fail_returned' down_revision = '...
""" Add columns to supplier_frameworks to indicate Pass/Fail and whether a Framework Agreement has been returned. Revision ID: 360_add_pass_fail_returned Revises: 350_migrate_interested_suppliers Create Date: 2015-10-23 16:25:02.068155 """ # revision identifiers, used by Alembic. revision = '360_add_pass_fai...
Update migration sequence after rebase
Update migration sequence after rebase
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
7187dbb7ca378726e2b58dc052dbc150582f9a24
src/summon.py
src/summon.py
#! /usr/bin/env python2 from __future__ import print_function ''' summon.py A simple wrapper for OS-dependent file launchers. Copyright 2013 Julian Gonggrijp Licensed under the Red Spider Project License. See the License.txt that shipped with your copy of this software for details. ''' import sys import subprocess ...
#! /usr/bin/env python2 from __future__ import print_function ''' summon.py A simple wrapper for OS-dependent file launchers. Copyright 2013 Julian Gonggrijp Licensed under the Red Spider Project License. See the License.txt that shipped with your copy of this software for details. ''' import sys import subprocess ...
Use shell in subprocess.call for Windows.
Use shell in subprocess.call for Windows.
Python
mit
the-xkcd-community/the-red-spider-project,the-xkcd-community/the-red-spider-project,the-xkcd-community/the-red-spider-project,the-xkcd-community/the-red-spider-project,the-xkcd-community/the-red-spider-project,the-xkcd-community/the-red-spider-project,the-xkcd-community/the-red-spider-project,the-xkcd-community/the-red...
d6a817949c51462af7d95d542ece667547b23cce
cbagent/collectors/ps.py
cbagent/collectors/ps.py
from cbagent.collectors import Collector from cbagent.collectors.libstats.psstats import PSStats class PS(Collector): COLLECTOR = "atop" # Legacy KNOWN_PROCESSES = ("beam.smp", "memcached", "indexer", "projector", "cbq-engine") def __init__(self, settings): super(PS, sel...
from cbagent.collectors import Collector from cbagent.collectors.libstats.psstats import PSStats class PS(Collector): COLLECTOR = "atop" # Legacy KNOWN_PROCESSES = ("beam.smp", "memcached", "indexer", "projector", "cbq-engine") def __init__(self, settings): super(PS, sel...
Fix condition for FTS stats collection
CBPS-186: Fix condition for FTS stats collection Currently, stats collection for processes such as indexer and cbq-engine is disabled due to a wrong "if" statement. The "settings object" always has "fts_server" attribute. We should check its boolean value instead. Change-Id: I017f4758f3603e674f094af27b6293716796418a...
Python
apache-2.0
pavel-paulau/perfrunner,couchbase/perfrunner,couchbase/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner
ac7fefd3a2058e2e9773d7e458f8fad6112fc33c
dev/lint.py
dev/lint.py
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import os import flake8 if flake8.__version_info__ < (3,): from flake8.engine import get_style_guide else: from flake8.api.legacy import get_style_guide cur_dir = os.path.dirname(__file__) config_file = os.pat...
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import os import flake8 if not hasattr(flake8, '__version_info__') or flake8.__version_info__ < (3,): from flake8.engine import get_style_guide else: from flake8.api.legacy import get_style_guide cur_dir = os....
Fix support for flake8 v2
Fix support for flake8 v2
Python
mit
wbond/asn1crypto
49999de7ac753f57e3c25d9d36c1806f3ec3a0ee
omnirose/curve/forms.py
omnirose/curve/forms.py
from django import forms from django.forms.models import formset_factory, BaseModelFormSet from django.forms.widgets import NumberInput from .models import Reading class ReadingForm(forms.Form): ships_head = forms.FloatField(required=False, widget=NumberInput(attrs={'style': "width: 5em;"})) deviation = form...
from django import forms from django.forms.models import formset_factory, BaseModelFormSet from django.forms.widgets import NumberInput from .models import Reading class DegreeInput(NumberInput): """Set the default style""" def __init__(self, attrs=None): if attrs is None: attrs = {} ...
Customize degree widget so that if formats floats more elegantly
Customize degree widget so that if formats floats more elegantly
Python
agpl-3.0
OmniRose/omnirose-website,OmniRose/omnirose-website,OmniRose/omnirose-website
2b464c9be11ad8aa0de62bca4424fed7d4d3e2b3
configurator/__init__.py
configurator/__init__.py
"""Adaptive configuration dialogs. Attributes: __version__: The current version string. """ import os import subprocess def _get_version(version=None): # overwritten by setup.py if version is None: pkg_dir = os.path.dirname(__file__) src_dir = os.path.abspath(os.path.join(pkg_dir, os.pardir...
"""Adaptive configuration dialogs. Attributes: __version__: The current version string. """ import os import subprocess def _get_version(version=None): # overwritten by setup.py if version is None: pkg_dir = os.path.dirname(__file__) src_dir = os.path.abspath(os.path.join(pkg_dir, os.pardir...
Enable back git output redirection in _get_version
Enable back git output redirection in _get_version
Python
apache-2.0
yasserglez/configurator,yasserglez/configurator
3dc9e45448211a5bd36c1f4e495eddef6e0e485e
scaffolder/commands/list.py
scaffolder/commands/list.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from optparse import make_option from optparse import OptionParser from scaffolder.core.commands import BaseCommand from scaffolder.core.template import TemplateManager class TemplateCommand(BaseCommand): option_list = BaseCommand.option_list + ( make_option( ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from optparse import make_option from optparse import OptionParser from scaffolder.core.commands import BaseCommand from scaffolder.core.template import TemplateManager class ListCommand(BaseCommand): def __init__(self, name, help='', aliases=(), stdout=None, stderr=...
Remove options, the command does not take options.
ListCommand: Remove options, the command does not take options.
Python
mit
goliatone/minions
6d5ebbebd558a716afeda1933f45f0dfbef41bb4
tests/smolder_tests.py
tests/smolder_tests.py
#!/usr/bin/env python2 import smolder import nose import json import os from nose.tools import assert_raises from imp import reload THIS_DIR = os.path.dirname(os.path.realpath(__file__)) def test_noop_test(): assert smolder.noop_test() def test_github_status(): myfile = open(THIS_DIR + '/github_status.json') t...
#!/usr/bin/env python2 import smolder import json import os from nose.tools import assert_raises from imp import reload THIS_DIR = os.path.dirname(os.path.realpath(__file__)) def test_noop_test(): assert smolder.noop_test() def test_github_status(): myfile = open(THIS_DIR + '/github_status.json') test_json = j...
Clean up imports in smolder tests
Clean up imports in smolder tests
Python
bsd-3-clause
sky-shiny/smolder,sky-shiny/smolder
a6eeda7ed6037285627ca6e468a7ef8ab467034f
data/build_dictionary.py
data/build_dictionary.py
#!/usr/bin/python import numpy import json import sys import fileinput from collections import OrderedDict def main(): for filename in sys.argv[1:]: print 'Processing', filename word_freqs = OrderedDict() with open(filename, 'r') as f: for line in f: words_in ...
#!/usr/bin/python import numpy import json import sys import fileinput from collections import OrderedDict def main(): for filename in sys.argv[1:]: print 'Processing', filename word_freqs = OrderedDict() with open(filename, 'r') as f: for line in f: words_in ...
Revert "eos and UNK will be overwritten if they occur in the corpus, should always be 0 and 1"
Revert "eos and UNK will be overwritten if they occur in the corpus, should always be 0 and 1" Actually fine if there are weird values, as Nematus does not really use them. This reverts commit 09eb3594fb395d43dd3f6c2a4dec85af683cbb30.
Python
bsd-3-clause
rsennrich/nematus,shuoyangd/nematus,EdinburghNLP/nematus,Proyag/nematus,shuoyangd/nematus,EdinburghNLP/nematus,EdinburghNLP/nematus,Proyag/nematus,rsennrich/nematus,yang1fan2/nematus,Proyag/nematus,Proyag/nematus,yang1fan2/nematus,yang1fan2/nematus,cshanbo/nematus,rsennrich/nematus,rsennrich/nematus,shuoyangd/nematus,P...
d15b996dc4a741390507a96d6facf113f8da0869
test/test_play.py
test/test_play.py
# -*- coding: utf-8 -*- """Tests for the play plugin""" from __future__ import (division, absolute_import, print_function, unicode_literals) from mock import patch, Mock from test._common import unittest from test.helper import TestHelper class PlayPluginTest(unittest.TestCase, TestHelper)...
# -*- coding: utf-8 -*- """Tests for the play plugin""" from __future__ import (division, absolute_import, print_function, unicode_literals) from mock import patch, ANY from test._common import unittest from test.helper import TestHelper class PlayPluginTest(unittest.TestCase, TestHelper):...
Verify that the generated playlist contains the path to the item
Verify that the generated playlist contains the path to the item
Python
mit
lengtche/beets,SusannaMaria/beets,jcoady9/beets,xsteadfastx/beets,diego-plan9/beets,shamangeorge/beets,jackwilsdon/beets,jcoady9/beets,LordSputnik/beets,sampsyo/beets,LordSputnik/beets,lengtche/beets,madmouser1/beets,mosesfistos1/beetbox,mried/beets,LordSputnik/beets,jcoady9/beets,SusannaMaria/beets,ibmibmibm/beets,swt...
6b36639cc7ff17f4d74aa0239311867b3937da87
py/longest-increasing-path-in-a-matrix.py
py/longest-increasing-path-in-a-matrix.py
from collections import defaultdict, Counter class Solution(object): def longestIncreasingPath(self, matrix): """ :type matrix: List[List[int]] :rtype: int """ if not matrix: return 0 h = len(matrix) w = len(matrix[0]) neighbors = defaultdi...
from collections import Counter class Solution(object): def dfs(self, dp, matrix, x, y, w, h): v = matrix[x][y] if dp[x, y] == 0: dp[x, y] = 1 + max( 0 if x == 0 or matrix[x - 1][y] <= v else self.dfs(dp, matrix, x - 1, y, w, h), 0 if y == 0 or matrix[x][y...
Add py solution for 329. Longest Increasing Path in a Matrix
Add py solution for 329. Longest Increasing Path in a Matrix 329. Longest Increasing Path in a Matrix: https://leetcode.com/problems/longest-increasing-path-in-a-matrix/ Approach 2: Top down search
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
4e68ee7d361bc34e77002cbdcfe077e89fcb3bd8
gala/__init__.py
gala/__init__.py
""" Gala === Gala is a Python package for nD image segmentation. """ from __future__ import absolute_import import sys, logging if sys.version_info[:2] < (2,6): logging.warning('Gala has not been tested on Python versions prior to 2.6'+ ' (%d.%d detected).'%sys.version_info[:2]) __author__ = 'Juan N...
""" Gala === Gala is a Python package for nD image segmentation. """ from __future__ import absolute_import import sys, logging if sys.version_info[:2] < (2,6): logging.warning('Gala has not been tested on Python versions prior to 2.6'+ ' (%d.%d detected).'%sys.version_info[:2]) __author__ = 'Juan N...
Add __version__ attribute to gala package
Add __version__ attribute to gala package
Python
bsd-3-clause
jni/gala,janelia-flyem/gala
d3670f4c8a07cc9e29c417a0f0ffa6499a3f53e2
session_csrf/templatetags/session_csrf.py
session_csrf/templatetags/session_csrf.py
from copy import copy from django.template.defaulttags import CsrfTokenNode from django import template from ..models import Token register = template.Library() @register.simple_tag(takes_context=True) def per_view_csrf(context, view_name): """Register per view csrf token. Not pure!""" _context = copy(conte...
from contextlib import contextmanager from django.template.defaulttags import CsrfTokenNode from django import template from ..models import Token register = template.Library() @contextmanager def save_token(context): is_exists = 'csrf_token' in context token = context.get('csrf_token') yield if is_...
Fix error with per-view and not per-view csrf on one page
Fix error with per-view and not per-view csrf on one page
Python
bsd-3-clause
nvbn/django-session-csrf,nvbn/django-session-csrf
07b7a666bc1c538580b5e7f528e528e4cc4bc25d
testing/client.py
testing/client.py
import gevent from kvclient import KeyValueClient class TestClient(KeyValueClient): yield_loop = gevent.sleep
import gevent from kvclient import KeyValueClient class TestClient(KeyValueClient): yield_loop = lambda: gevent.sleep(0)
Fix gevent.sleep not having a parameter.
Fix gevent.sleep not having a parameter.
Python
unlicense
squirly/eece411-kvclient
b5593bbfb8fda3bbdb9c5408f17078949ab91481
tests/conftest.py
tests/conftest.py
# -*- coding: utf-8 -*- def pytest_funcarg__api_factory(request): class APIFactory: def create(self, token='dummy_token'): from annict.api import API return API(token) return APIFactory()
# -*- coding: utf-8 -*- import pytest @pytest.fixture def api_factory(): class APIFactory: def create(self, token='dummy_token'): from annict.api import API return API(token) return APIFactory()
Fix old-style `pytest_funcarg__`, instead @pytest.fixture.
Fix old-style `pytest_funcarg__`, instead @pytest.fixture.
Python
mit
kk6/python-annict
ad4c1014184f8a7c4b72a4620262bf5fda3264d2
sympy/physics/gaussopt.py
sympy/physics/gaussopt.py
from sympy.physics.optics.gaussopt import RayTransferMatrix, FreeSpace,\ FlatRefraction, CurvedRefraction, FlatMirror, CurvedMirror, ThinLens,\ GeometricRay, BeamParameter, waist2rayleigh, rayleigh2waist, geometric_conj_ab,\ geometric_conj_af, geometric_conj_bf, gaussian_conj, conjugate_gauss_beams from sy...
from sympy.physics.optics.gaussopt import RayTransferMatrix, FreeSpace,\ FlatRefraction, CurvedRefraction, FlatMirror, CurvedMirror, ThinLens,\ GeometricRay, BeamParameter, waist2rayleigh, rayleigh2waist, geometric_conj_ab,\ geometric_conj_af, geometric_conj_bf, gaussian_conj, conjugate_gauss_beams from sy...
Add issue number(7659) in the deprecation warning
Add issue number(7659) in the deprecation warning
Python
bsd-3-clause
rahuldan/sympy,debugger22/sympy,pbrady/sympy,farhaanbukhsh/sympy,kevalds51/sympy,yashsharan/sympy,toolforger/sympy,Sumith1896/sympy,Vishluck/sympy,kaushik94/sympy,asm666/sympy,pandeyadarsh/sympy,rahuldan/sympy,madan96/sympy,sampadsaha5/sympy,sunny94/temp,skirpichev/omg,Curious72/sympy,sahmed95/sympy,jbbskinny/sympy,Mri...
745b0b2d83cdbd28fcb4f565b77b31ef6f888350
openmc/capi/__init__.py
openmc/capi/__init__.py
""" This module provides bindings to C functions defined by OpenMC shared library. When the :mod:`openmc` package is imported, the OpenMC shared library is automatically loaded. Calls to the OpenMC library can then be via functions or objects in the :mod:`openmc.capi` subpackage, for example: .. code-block:: python ...
""" This module provides bindings to C functions defined by OpenMC shared library. When the :mod:`openmc` package is imported, the OpenMC shared library is automatically loaded. Calls to the OpenMC library can then be via functions or objects in the :mod:`openmc.capi` subpackage, for example: .. code-block:: python ...
Remove try/except block around CDLL
Remove try/except block around CDLL
Python
mit
walshjon/openmc,johnnyliu27/openmc,liangjg/openmc,shikhar413/openmc,amandalund/openmc,liangjg/openmc,liangjg/openmc,shikhar413/openmc,wbinventor/openmc,liangjg/openmc,mit-crpg/openmc,amandalund/openmc,smharper/openmc,walshjon/openmc,smharper/openmc,johnnyliu27/openmc,smharper/openmc,shikhar413/openmc,wbinventor/openmc,...
3f0a3cd5540680be07e25afe282ed7df7381e802
tests/testVpns.py
tests/testVpns.py
import json import os import sys sys.path.append('..') from skytap.Vpns import Vpns # noqa vpns = Vpns() def test_vpn_count(): """Test VPN count.""" assert len(vpns) > 0, 'Vpn list is empty.' def test_vpn_id(): """Ensure each VPN has an ID.""" for v in vpns: assert len(v.id) > 0 def tes...
import json import os import sys sys.path.append('..') from skytap.Vpns import Vpns # noqa vpns = Vpns() def test_vpn_id(): """Ensure each VPN has an ID.""" for v in vpns: assert len(v.id) > 0 def test_vpn_json(): """Ensure vpn json conversion seems to be working.""" for l in list(vpns.dat...
Remove check for existance of VPNs. Not having them may be correct
Remove check for existance of VPNs. Not having them may be correct
Python
mit
FulcrumIT/skytap,mapledyne/skytap
9c84e5d4c1ef0670b3b6622fb7946486f78ff7fe
capstone/util/c4uci.py
capstone/util/c4uci.py
from __future__ import division, print_function, unicode_literals from capstone.game import Connect4 as C4 def load_instance(instance): ''' Loads a position from the UCI Connect 4 database: https://archive.ics.uci.edu/ml/machine-learning-databases/connect-4/connect-4.names Returns a tuple with an in...
from __future__ import division, print_function, unicode_literals from capstone.game import Connect4 as C4 def load_instance(instance): ''' Loads a position from the UCI Connect 4 database: https://archive.ics.uci.edu/ml/machine-learning-databases/connect-4/connect-4.names Returns a tuple with an in...
Remove trailing line break from C4 UCI instance
Remove trailing line break from C4 UCI instance
Python
mit
davidrobles/mlnd-capstone-code
3489cc9f6ab593cd3664f2086577a6fde5e4ab94
dimod/compatibility23.py
dimod/compatibility23.py
import sys import itertools import inspect from collections import namedtuple _PY2 = sys.version_info.major == 2 if _PY2: range_ = xrange zip_ = itertools.izip def iteritems(d): return d.iteritems() def itervalues(d): return d.itervalues() def iterkeys(d): return d.it...
import sys import itertools import inspect from collections import namedtuple _PY2 = sys.version_info.major == 2 if _PY2: range_ = xrange zip_ = itertools.izip def iteritems(d): return d.iteritems() def itervalues(d): return d.itervalues() def iterkeys(d): return d.it...
Move namedtuple definition outside of argspec function
Move namedtuple definition outside of argspec function
Python
apache-2.0
oneklc/dimod,oneklc/dimod
3c319e21ea026651ee568d3c2a74786d33257a93
paystackapi/paystack.py
paystackapi/paystack.py
"""Entry point defined here.""" from paystackapi.cpanel import ControlPanel from paystackapi.customer import Customer from paystackapi.invoice import Invoice from paystackapi.misc import Misc from paystackapi.page import Page from paystackapi.plan import Plan from paystackapi.product import Product from paystackapi.ref...
"""Entry point defined here.""" from paystackapi.charge import Charge from paystackapi.cpanel import ControlPanel from paystackapi.customer import Customer from paystackapi.invoice import Invoice from paystackapi.misc import Misc from paystackapi.page import Page from paystackapi.plan import Plan from paystackapi.produ...
Add charge to Paystack class
Add charge to Paystack class
Python
mit
andela-sjames/paystack-python
19857719f3a68d14c1221bb04193a69379a8bf89
examples/g/modulegen.py
examples/g/modulegen.py
#! /usr/bin/env python import sys import pybindgen from pybindgen import ReturnValue, Parameter, Module, Function, FileCodeSink def my_module_gen(out_file): mod = Module('g') mod.add_include('"g.h"') mod.add_function('GDoA', None, []) G = mod.add_cpp_namespace("G") G.add_function('GDoB', None, [...
#! /usr/bin/env python import sys import pybindgen from pybindgen import ReturnValue, Parameter, Module, Function, FileCodeSink def my_module_gen(out_file): mod = Module('g') mod.add_include('"g.h"') mod.add_function('GDoA', None, []) G = mod.add_cpp_namespace("G") G.add_function('GDoB', None, [...
Add wrapping of std::ofstream to the example
Add wrapping of std::ofstream to the example
Python
lgpl-2.1
cawka/pybindgen,caramucho/pybindgen,cawka/pybindgen,cawka/pybindgen,caramucho/pybindgen,cawka/pybindgen,caramucho/pybindgen,caramucho/pybindgen
d5819e689ee5284b5c6aae28d20a6ef88051b4ef
vscode_manual/install_extensions.py
vscode_manual/install_extensions.py
#!/usr/bin/env python # Install VSCode Extensions from file. from __future__ import print_function import subprocess EXTENSIONS_FILE = "extensions.txt" def extensions(filename): """ Yield each of the extensions in the given file. """ with open(filename) as extension_file: for extension in extensio...
#!/usr/bin/env python # Install VSCode Extensions from file. # # Instead of writing this, could have just written: # cat extensions.txt | xargs -L 1 code --install-extension from __future__ import print_function import subprocess EXTENSIONS_FILE = "extensions.txt" def extensions(filename): """ Yield each ...
Add snarky comment in VSCode Extension Installer.
Add snarky comment in VSCode Extension Installer.
Python
mit
kashev/dotfiles,kashev/dotfiles
92b90cbdd41905d69863b7cd329d8280a3662db8
chrome/common/extensions/docs/server2/url_constants.py
chrome/common/extensions/docs/server2/url_constants.py
# Copyright (c) 2012 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. GITHUB_URL = 'https://api.github.com/repos/GoogleChrome/chrome-app-samples' NEW_GITHUB_URL = 'https://api.github.com/repos' GITHUB_BASE = 'https://github...
# Copyright (c) 2012 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. GITHUB_URL = 'https://api.github.com/repos/GoogleChrome/chrome-app-samples' NEW_GITHUB_URL = 'https://api.github.com/repos' GITHUB_BASE = 'https://github...
Use codereview.chromium.org instead of chromiumcodereview.appspot.com in extensions doc script.
Use codereview.chromium.org instead of chromiumcodereview.appspot.com in extensions doc script. BUG=273810 R=kalman@chromium.org, kalman Review URL: https://codereview.chromium.org/24980005 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@225762 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
anirudhSK/chromium,Pluto-tv/chromium-crosswalk,Chilledheart/chromium,anirudhSK/chromium,M4sse/chromium.src,dednal/chromium.src,PeterWangIntel/chromium-crosswalk,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,bright-sparks/chromium-spacewalk,Just-D/chromium-1,fuj...
5012ff1dfbcd8e7d0d9b0691f45c7b3efd811a08
adventure/__init__.py
adventure/__init__.py
"""The Adventure game.""" def load_advent_dat(data): import os from .data import parse datapath = os.path.join(os.path.dirname(__file__), 'advent.dat') with open(datapath, 'r', encoding='ascii') as datafile: parse(data, datafile) def play(seed=None): """Turn the Python prompt into an Adve...
"""The Adventure game.""" def load_advent_dat(data): import os from .data import parse datapath = os.path.join(os.path.dirname(__file__), 'advent.dat') with open(datapath, 'r', encoding='ascii') as datafile: parse(data, datafile) def play(seed=None): """Turn the Python prompt into an Adve...
Remove outdated parameter from docstring
Remove outdated parameter from docstring
Python
apache-2.0
devinmcgloin/advent,devinmcgloin/advent
d1d668139be98283dc9582c32fadf7de2b30914d
src/identfilter.py
src/identfilter.py
import sys import re NUMBER_REGEX = re.compile(r'([0-9])([a-z])') def to_camel_case(text): # We only care about Graphene types if not text.startswith('graphene_') and not text.endswith('_t'): return text res = [] for token in text[:-2].split('_'): uc_token = token.title() # We need ...
# Copyright 2014 Emmanuele Bassi # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distri...
Add licensing to the introspection filter
Add licensing to the introspection filter It's a small utility script, but it's better to have a license for it anyway.
Python
mit
ebassi/graphene,ebassi/graphene
1a48f85e04f9192ccf9ba675ff8ddd5719752950
infrastructure/control/simple/src/start-opensim.py
infrastructure/control/simple/src/start-opensim.py
#!/usr/bin/python import os.path import sys ### CONFIGURE THESE PATHS ### binaryPath = "/home/opensim/opensim/opensim-current/bin" pidPath = "/tmp/OpenSim.pid" ### END OF CONFIG ### if not os.path.exists(pidPath): print >> sys.stderr, "ERROR: OpenSim PID file %s still present. Assuming OpenSim has been started al...
#!/usr/bin/python import os.path import re import subprocess import sys ### CONFIGURE THESE PATHS ### binaryPath = "/home/opensim/opensim/opensim-current/bin" pidPath = "/tmp/OpenSim.pid" ### END OF CONFIG ### if os.path.exists(pidPath): print >> sys.stderr, "ERROR: OpenSim PID file %s still present. Assuming Ope...
Add screen -list check, fix initial pid check
Add screen -list check, fix initial pid check
Python
bsd-3-clause
justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools
ffe9bba2e4045236a3f3731e39876b6220f8f9a1
jarviscli/plugins/joke_of_day.py
jarviscli/plugins/joke_of_day.py
from plugin import plugin, require import requests from colorama import Fore from plugins.animations import SpinnerThread @require(network=True) @plugin('joke daily') class joke_of_day: """ Provides you with a joke of day to help you laugh amidst the daily boring schedule Enter 'joke daily' to use ...
from plugin import plugin, require import requests from colorama import Fore @require(network=True) @plugin('joke daily') class joke_of_day: """ Provides you with a joke of day to help you laugh amidst the daily boring schedule Enter 'joke daily' to use """ def __call__(self, jarvis, s): ...
Update joke of day: Fix for moved SpinnerThread
Update joke of day: Fix for moved SpinnerThread
Python
mit
sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis
b0e558b70613871097361ee3c1f016aa60e4c2f1
processors/yui.py
processors/yui.py
from collections import OrderedDict import os import StringIO from django.conf import settings from django.utils.encoding import smart_str from ..base import Processor ERROR_STRING = ("Failed to execute Java VM or yuicompressor. " "Please make sure that you have installed Java " "and ...
from collections import OrderedDict import os import StringIO from django.conf import settings from django.utils.encoding import smart_str from ..base import Processor ERROR_STRING = ("Failed to execute Java VM or yuicompressor. " "Please make sure that you have installed Java " "and ...
Update YUI error handling logic
Update YUI error handling logic
Python
bsd-2-clause
potatolondon/assetpipe
34186d908af01aa05d255e91aba085d1ca4f1837
wger/manager/migrations/0011_remove_set_exercises.py
wger/manager/migrations/0011_remove_set_exercises.py
# Generated by Django 3.1.5 on 2021-02-28 14:10 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('manager', '0010_auto_20210102_1446'), ] operations = [ migrations.RemoveField( model_name='set', name='exercises', )...
# Generated by Django 3.1.5 on 2021-02-28 14:10 from django.db import migrations def increment_order(apps, schema_editor): """ Increment the oder in settings so ensure the order is preserved Otherwise, and depending on the database, when a set has supersets, the exercises could be ordered alphabetic...
Increment the oder in settings so ensure the order is preserved
Increment the oder in settings so ensure the order is preserved Otherwise, and depending on the database, when a set has supersets, the exercises could be ordered alphabetically.
Python
agpl-3.0
wger-project/wger,petervanderdoes/wger,petervanderdoes/wger,petervanderdoes/wger,petervanderdoes/wger,wger-project/wger,wger-project/wger,wger-project/wger
420b9a4e2b52de7234734b9c457e0711bb0f1a70
utils/lit/lit/__init__.py
utils/lit/lit/__init__.py
"""'lit' Testing Tool""" __author__ = 'Daniel Dunbar' __email__ = 'daniel@minormatter.com' __versioninfo__ = (0, 6, 0) __version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev' __all__ = []
"""'lit' Testing Tool""" __author__ = 'Daniel Dunbar' __email__ = 'daniel@minormatter.com' __versioninfo__ = (0, 6, 0) __version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev' __all__ = [] from .main import main
Fix issue which cases lit installed with setup.py to not resolve main
Fix issue which cases lit installed with setup.py to not resolve main git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@283818 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llv...
f604de4794c87c155cdda758a43aa7261662dcff
examples/pystray_icon.py
examples/pystray_icon.py
from PIL import Image from pystray import Icon, Menu, MenuItem import webview import sys if sys.platform == 'darwin': raise NotImplementedError('This example does not work on macOS.') from threading import Thread from queue import Queue """ This example demonstrates running pywebview alongside with pystray ...
from PIL import Image from pystray import Icon, Menu, MenuItem import webview import sys import multiprocessing if sys.platform == 'darwin': ctx = multiprocessing.get_context('spawn') Process = ctx.Process Queue = ctx.Queue else: Process = multiprocessing.Process Queue = multiprocessing.Queue """...
Improve example, start pystray in main thread and webview in new process
Improve example, start pystray in main thread and webview in new process
Python
bsd-3-clause
r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview
7ef053749f4bfbcf7c2007a57d16139cfea09588
jsonapi_requests/configuration.py
jsonapi_requests/configuration.py
from collections import namedtuple Configuration = namedtuple( 'Configuration', ['API_ROOT', 'AUTH', 'VALIDATE_SSL', 'TIMEOUT', 'APPEND_SLASH'] ) class Factory: def __init__(self, config_dict): self._config_dict = config_dict def create(self) -> Configuration: return Configuration( ...
from collections import namedtuple Configuration = namedtuple( 'Configuration', ['API_ROOT', 'AUTH', 'VALIDATE_SSL', 'TIMEOUT', 'APPEND_SLASH'] ) class Factory: def __init__(self, config_dict): self._config_dict = config_dict def create(self) -> Configuration: return Configuration( ...
Append slash to API root if needed.
Append slash to API root if needed.
Python
bsd-3-clause
socialwifi/jsonapi-requests
4dd13a8b031a57f6290fb43dc6daa5082041658a
dashboard/consumers.py
dashboard/consumers.py
from channels import Group from channels.auth import channel_session_user, channel_session_user_from_http @channel_session_user_from_http def ws_connect(message): Group('btc-price').add(message.reply_channel) message.reply_channel.send({ 'accept': True }) @channel_session_user def ws_disconnec...
import json from channels import Group from channels.auth import channel_session_user @channel_session_user def ws_connect(message): Group('btc-price').add(message.reply_channel) message.channel_session['coin-group'] = 'btc-price' message.reply_channel.send({ 'accept': True }) @channel_se...
Add ws_receive consumer with channel_session_user decorator
Add ws_receive consumer with channel_session_user decorator
Python
mit
alessandroHenrique/coinpricemonitor,alessandroHenrique/coinpricemonitor,alessandroHenrique/coinpricemonitor
495a33c0dbb2bd9174b15ea934b8282ca3b78929
pytask/profile/utils.py
pytask/profile/utils.py
from django.http import Http404 from django.contrib.auth.models import User from pytask.profile.models import Notification def get_notification(nid, user): """ if notification exists, and belongs to the current user, return it. else return None. """ user_notifications = user.notification_sent_to.filte...
from django import shortcuts from django.http import Http404 from django.contrib.auth.models import User from pytask.profile.models import Notification def get_notification(nid, user): """ if notification exists, and belongs to the current user, return it. else return None. """ user_notifications = us...
Use django shortcut for raising 404s.
Use django shortcut for raising 404s.
Python
agpl-3.0
madhusudancs/pytask,madhusudancs/pytask,madhusudancs/pytask
3c145a47a20a55787b8ce8a4f00ff3449306ccbc
blazar/cmd/manager.py
blazar/cmd/manager.py
# Copyright (c) 2013 Mirantis 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 writ...
# Copyright (c) 2013 Mirantis 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 writ...
Enable mutable config in blazar
Enable mutable config in blazar New releases of oslo.config support a 'mutable' parameter in Opts. oslo.service provides an option [1] which allows services to tell it they want mutate_config_files to be called by passing a parameter. This commit is to use the same approach. This allows Blazar to benefit from [2], wh...
Python
apache-2.0
stackforge/blazar,stackforge/blazar,openstack/blazar,ChameleonCloud/blazar,ChameleonCloud/blazar,openstack/blazar
e812791b42c16a809e9913d682562804f5335be6
pytx/pytx/__init__.py
pytx/pytx/__init__.py
# import vocabulary # from init import init # from malware import Malware # from threat_exchange_member import ThreatExchangeMember # from threat_indicator import ThreatIndicator
from init import init from malware import Malware from threat_exchange_member import ThreatExchangeMember from threat_indicator import ThreatIndicator __all__ = ['init', 'Malware', 'ThreatExchangeMember', 'ThreatIndicator']
Add an `__all__` array to expose the public objects of the pytx module
Add an `__all__` array to expose the public objects of the pytx module
Python
bsd-3-clause
theCatWisel/ThreatExchange,theCatWisel/ThreatExchange,mgoffin/ThreatExchange,theCatWisel/ThreatExchange,RyPeck/ThreatExchange,mgoffin/ThreatExchange,tiegz/ThreatExchange,mgoffin/ThreatExchange,tiegz/ThreatExchange,tiegz/ThreatExchange,wxsBSD/ThreatExchange,RyPeck/ThreatExchange,RyPeck/ThreatExchange,theCatWisel/ThreatE...
6848b3ad8709a16a520ba1db1aa6eb94c201728f
tests/ExperimentTest.py
tests/ExperimentTest.py
import sys sys.path.insert(0,".") import unittest import neuroml import neuroml.writers as writers import PyOpenWorm from PyOpenWorm import * import networkx import rdflib import rdflib as R import pint as Q import os import subprocess as SP import subprocess import tempfile import doctest from glob import glob from ...
import sys sys.path.insert(0,".") import unittest import neuroml import neuroml.writers as writers import PyOpenWorm from PyOpenWorm import * import networkx import rdflib import rdflib as R import pint as Q import os import subprocess as SP import subprocess import tempfile import doctest from glob import glob from ...
Add test checking that unimplemented attribute raises error
Add test checking that unimplemented attribute raises error
Python
mit
gsarma/PyOpenWorm,openworm/PyOpenWorm,openworm/PyOpenWorm,gsarma/PyOpenWorm
122f38717170766473df4dffd79632f90b3d41ad
axes/apps.py
axes/apps.py
from logging import getLogger from pkg_resources import get_distribution from django import apps log = getLogger(__name__) class AppConfig(apps.AppConfig): name = "axes" initialized = False @classmethod def initialize(cls): """ Initialize Axes logging and show version information. ...
from logging import getLogger from pkg_resources import get_distribution from django import apps log = getLogger(__name__) class AppConfig(apps.AppConfig): name = "axes" initialized = False @classmethod def initialize(cls): """ Initialize Axes logging and show version information. ...
Adjust init verbose and enabled mode handling
Adjust init verbose and enabled mode handling Reduce complexity and leave the enabled mode to be used with the toggleable decorator that disables functionality when AXES_ENABLED is set to False for testing etc. This conforms with the previous behaviour and logic flow.
Python
mit
jazzband/django-axes
3d281a3524a4cd1bf9e2f60767ec8d89d3b589e2
tools/wcloud/wcloud/deploymentsettings.py
tools/wcloud/wcloud/deploymentsettings.py
from weblab.admin.script import Creation APACHE_CONF_NAME = 'apache.conf' MIN_PORT = 10000 DEFAULT_DEPLOYMENT_SETTINGS = { Creation.COORD_ENGINE: 'redis', Creation.COORD_REDIS_DB: 0, Creation.COORD_REDIS_PORT: 6379, Creation.DB_ENGINE: 'mysql', Creation.ADMIN_USER: 'CHANGE_ME', # --admin-user=admi...
from weblab.admin.script import Creation APACHE_CONF_NAME = 'apache.conf' MIN_PORT = 10000 DEFAULT_DEPLOYMENT_SETTINGS = { Creation.COORD_ENGINE: 'redis', Creation.COORD_REDIS_DB: 0, Creation.COORD_REDIS_PORT: 6379, Creation.DB_ENGINE: 'mysql', Creation.ADMIN_USER: 'CHANGE_ME', # --admin-user=admi...
Add logic, visir and submarine to wcloud
Add logic, visir and submarine to wcloud
Python
bsd-2-clause
morelab/weblabdeusto,weblabdeusto/weblabdeusto,zstars/weblabdeusto,morelab/weblabdeusto,weblabdeusto/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,weblabdeusto/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,zstars/weblabdeusto,weblabdeusto/weblabdeusto,zstars/weblabdeusto,zstars/weblabdeusto,...
6dc73aa3f4acd40ffbf6057c8765e2c693495657
bookmarkd/cli.py
bookmarkd/cli.py
""" Author: Ryan Brown <sb@ryansb.com> License: AGPL3 """ import click @click.group() def cli(): pass @cli.command() def version(): click.echo("You are using ofcourse version {}".format(__version__)) click.echo("Get more information at " "https://github.com/ryansb/ofCourse") @cli.comman...
# -*- coding: utf8 -*- """ Copyright 2014 Ryan Brown <sb@ryansb.com> This file is part of bookmarkd. bookmarkd is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your ...
Make convert command work with files or stdin/out
Make convert command work with files or stdin/out
Python
agpl-3.0
ryansb/bookmarkd
f269b7b5c7b0bb0973f504db1c3605c9ff3ac6da
tutorials/2017/thursday/graphColouring.py
tutorials/2017/thursday/graphColouring.py
from boolean import * def graphColouring2SAT(G, k): conj = [] for i in range(len(G)): conj.append(Or(*((i, j) for j in range(k)))) for j in range(k): for jj in range(j+1, k): conj.append(Or(Not((i, j)), Not((i, jj)))) for ii in G[i]: for j in rang...
from boolean import * def graphColouring2SAT(G, k): conj = [] for i in range(len(G)): conj.append(Or(*((i, j) for j in range(k)))) for j in range(k): for jj in range(j+1, k): conj.append(Or(Not((i, j)), Not((i, jj)))) for ii in G[i]: for j in rang...
Add function to extract solution from valuation
Add function to extract solution from valuation
Python
mit
jaanos/LVR-2016,jaanos/LVR-2016
b18c0f6b732b5adc42f123d83886d260c8278ad5
tests/test_slackelot.py
tests/test_slackelot.py
import pytest import mock from slackelot.slackelot import SlackNotificationError, send_message def test_send_message_success(): """Returns True if response.status_code == 200""" with mock.patch('slackelot.slackelot.requests.post', return_value=mock.Mock(**{'status_code': 200})) as mock_response: webh...
import pytest try: from unittest import mock except ImportError: import mock from slackelot import SlackNotificationError, send_message def test_send_message_success(): """Returns True if response.status_code == 200""" with mock.patch('slackelot.slackelot.requests.post', return_value=mock.Mock(**{'s...
Refactor imports to be less verbose
Refactor imports to be less verbose
Python
mit
Chris-Graffagnino/slackelot
5d1bc24d585c6a51367d322cfaf52a84be05a132
myuw_mobile/urls.py
myuw_mobile/urls.py
from django.conf.urls import patterns, include, url from myuw_mobile.views.page import index, myuw_login from myuw_mobile.views.api import StudClasScheCurQuar, TextbookCurQuar, InstructorContact urlpatterns = patterns('myuw_mobile.views.page', url(r'login', 'myuw_login'), url(r'support', 'support'), url(r'...
from django.conf.urls import patterns, include, url from myuw_mobile.views.page import index, myuw_login from myuw_mobile.views.api import StudClasScheCurQuar, TextbookCurQuar, InstructorContact urlpatterns = patterns('myuw_mobile.views.page', url(r'login', 'myuw_login'), url(r'support', 'support'), url(r'...
Use a separate set of urlpatterns for each file in views.
Use a separate set of urlpatterns for each file in views.
Python
apache-2.0
fanglinfang/myuw,uw-it-aca/myuw,fanglinfang/myuw,fanglinfang/myuw,uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw
6f540821e891f49e0f2059757b58d2aa0efdf267
src/panda_test.py
src/panda_test.py
from direct.showbase.ShowBase import ShowBase class MyApp(ShowBase): def __init__(self): ShowBase.__init__(self) app = MyApp() app.run()
from math import pi, sin, cos from direct.showbase.ShowBase import ShowBase from direct.task import Task from direct.actor.Actor import Actor from direct.interval.IntervalGlobal import Sequence from panda3d.core import Point3 class MyApp(ShowBase): def __init__(self): ShowBase.__init__(self) s...
Add the rest of Panda3D test program.
Add the rest of Panda3D test program.
Python
mit
CheeseLord/warts,CheeseLord/warts
bb27d997c728542dd3ec883ba44a3fefb126c42e
scraperwiki/__init__.py
scraperwiki/__init__.py
#!/usr/bin/env python2 # Thomas Levine, ScraperWiki Limited ''' Local version of ScraperWiki Utils, documentation here: https://scraperwiki.com/docs/python/python_help_documentation/ ''' from .utils import scrape, pdftoxml, status import utils import sql # Compatibility sqlite = sql
#!/usr/bin/env python2 # Thomas Levine, ScraperWiki Limited ''' Local version of ScraperWiki Utils, documentation here: https://scraperwiki.com/docs/python/python_help_documentation/ ''' from .utils import scrape, pdftoxml, status import utils import sql # Compatibility sqlite = sql class Error(Exception): """A...
Add exceptions scraperwiki.CPUTimeExceededError and scraperwiki.Error. This bring the library closer to the classic API, which provided both these exceptions.
Add exceptions scraperwiki.CPUTimeExceededError and scraperwiki.Error. This bring the library closer to the classic API, which provided both these exceptions.
Python
bsd-2-clause
hudsonkeithl/scraperwiki-python,tlevine/scraperwiki-python,scraperwiki/scraperwiki-python,tlevine/scraperwiki-python,scraperwiki/scraperwiki-python,hudsonkeithl/scraperwiki-python
2092467a123c380edfadb52aa42ac9f063524f90
scripts/release_conf.py
scripts/release_conf.py
import os with open("src/conf.lua.bak") as f: conf = f.read() conf = conf.replace("t.release = false", "t.release = true") conf = conf.replace("ac1c2db50f1332444fd0cafffd7a5543", os.environ["MIXPANEL_TOKEN"]) with open("src/conf.lua"...
import os with open("src/conf.lua.bak") as f: conf = f.read() conf = conf.replace("t.release = false", "t.release = true") if "MIXPANEL_TOKEN" in os.environ: conf = conf.replace("ac1c2db50f1332444fd0cafffd7a5543", os.environ[...
Build releases even without MIXPANEL_TOKEN
Build releases even without MIXPANEL_TOKEN
Python
mit
hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua
ff6ee622204500101ad5721dccea69a1c62de65f
smbackend/urls.py
smbackend/urls.py
from django.conf.urls import patterns, include, url from services.api import all_views as services_views from services.api import AccessibilityRuleView from observations.api import views as observations_views from rest_framework import routers from observations.views import obtain_auth_token from munigeo.api import all...
from django.conf.urls import patterns, include, url from services.api import all_views as services_views from services.api import AccessibilityRuleView from observations.api import views as observations_views from rest_framework import routers from observations.views import obtain_auth_token from munigeo.api import all...
Add name to api-token-auth url endpoint.
Add name to api-token-auth url endpoint.
Python
agpl-3.0
City-of-Helsinki/smbackend,City-of-Helsinki/smbackend
7c6238e51640794b2812eaf6ca22d3c15dfb90fb
troposphere/finspace.py
troposphere/finspace.py
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 39.1.0 from . import AWSObject, AWSProperty class FederationParameters(AWSProperty): props = { "Appl...
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 49.0.0 from . import AWSObject, AWSProperty class FederationParameters(AWSProperty): props = { "Appl...
Update FinSpace per 2021-11-18 changes
Update FinSpace per 2021-11-18 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
17266889388c6ae45ac5235a8e22900bf169eba3
typhon/__init__.py
typhon/__init__.py
# -*- coding: utf-8 -*- from .version import __version__ try: __TYPHON_SETUP__ except: __TYPHON_SETUP__ = False if not __TYPHON_SETUP__: from . import arts from . import atmosphere from . import config from . import constants from . import files from . import geodesy from . import...
# -*- coding: utf-8 -*- from .version import __version__ try: __TYPHON_SETUP__ except: __TYPHON_SETUP__ = False if not __TYPHON_SETUP__: from . import arts from . import atmosphere from . import config from . import constants from . import files from . import geodesy from . import...
Revert "Import spareice per default."
Revert "Import spareice per default." This reverts commit d54042d41b981b3479adb140f2534f76c967fa1c.
Python
mit
atmtools/typhon,atmtools/typhon
1cb052fc829f286ecc6f7ea5b230e2b5f37d2062
core/apps.py
core/apps.py
from django.apps import AppConfig from django.db.models.signals import post_delete, post_save from wagtail.wagtailsearch.backends import get_search_backends from wagtail.wagtailsearch.index import get_indexed_models from wagtail.wagtailsearch.signal_handlers import (get_indexed_instance, ...
from django.apps import AppConfig from django.db.models.signals import post_delete, post_save from wagtail.wagtailsearch.backends import get_search_backends from wagtail.wagtailsearch.index import get_indexed_models from wagtail.wagtailsearch.signal_handlers import (get_indexed_instance, ...
Fix the comparison to work more robustly.
Fix the comparison to work more robustly.
Python
mit
OpenCanada/website,OpenCanada/website,OpenCanada/website,OpenCanada/website
b72af894539ca50d08fa1fa78a5c394fa246323d
cfgov/transition_utilities/test_middleware.py
cfgov/transition_utilities/test_middleware.py
from django.test import TestCase from mock import Mock from .middleware import RewriteNemoURLsMiddleware class CartMiddlewareTest(TestCase): def setUp(self): self.middleware = RewriteNemoURLsMiddleware() self.request = Mock() self.response = Mock() def test_text_transform(self): ...
from django.test import TestCase from mock import Mock from .middleware import RewriteNemoURLsMiddleware class RewriteNemoURLSMiddlewareTest(TestCase): def setUp(self): self.middleware = RewriteNemoURLsMiddleware() self.request = Mock() self.response = Mock() def test_text_transform(s...
Fix a harmless (but silly) cut-and-paste artifact
Fix a harmless (but silly) cut-and-paste artifact
Python
cc0-1.0
kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh
d4d76ae28ae8aa028c5a06f7499a20644b45b986
examples/on_startup.py
examples/on_startup.py
"""Provides an example of attaching an action on hug server startup""" import hug data = [] @hug.startup() def add_data(api): """Adds initial data to the api on startup""" data.append("It's working") @hug.startup() def add_more_data(api): """Adds initial data to the api on startup""" data.append("E...
"""Provides an example of attaching an action on hug server startup""" import hug data = [] @hug.startup() def add_data(api): """Adds initial data to the api on startup""" data.append("It's working") @hug.startup() def add_more_data(api): """Adds initial data to the api on startup""" data.append("E...
Update example to demonstrate desired use case
Update example to demonstrate desired use case
Python
mit
MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug
27f4499dc11628b2520de65c5f8db6b397d19b69
src/bulksms/settings.py
src/bulksms/settings.py
# BULKSMS Configuration. # BULKSMS base url. BULKSMS_BASE_API_URL = 'https://bulksms.2way.co.za' # Credentials required to use bulksms.com API. BULKSMS_AUTH_USERNAME = '' BULKSMS_AUTH_PASSWORD = '' # URL for sending single and batch sms. BULKSMS_API_URL = { 'batch': '/{}eapi/submission/send_batch/1/1.0'.format(B...
# BULKSMS Configuration. # BULKSMS base url. BULKSMS_BASE_API_URL = 'https://bulksms.2way.co.za' # Credentials required to use bulksms.com API. BULKSMS_AUTH_USERNAME = '' BULKSMS_AUTH_PASSWORD = '' # URL for sending single and batch sms. BULKSMS_API_URL = { 'batch': '/{}eapi/submission/send_batch/1/1.0'.format(B...
Add url to check for incoming sms's.
Add url to check for incoming sms's.
Python
mit
tsotetsi/django-bulksms
b92e7c281f18dc0a3c9c65a995e132c89d9f82f1
areaScraper.py
areaScraper.py
# Craigslist City Scraper # By Marshall Ehlinger # For sp2015 Systems Analysis and Design from bs4 import BeautifulSoup import requests import re soup = BeautifulSoup(requests.get("http://www.craigslist.org/about/sites").text, "html.parser") for columnDiv in soup.h1.next_sibling.next_sibling: for state in columnD...
# Craigslist City Scraper # By Marshall Ehlinger # For sp2015 Systems Analysis and Design from bs4 import BeautifulSoup import requests import re soup = BeautifulSoup(requests.get("http://www.craigslist.org/about/sites").text, "html.parser") for columnDiv in soup.h1.next_sibling.next_sibling: for state in columnDiv...
Fix city scraper, doesn't throw type error
Fix city scraper, doesn't throw type error City scraper now prints out html for every city and territory in the us without throwing any error.
Python
mit
MuSystemsAnalysis/craigslist_area_search,MuSystemsAnalysis/craigslist_area_search
ac1b0b59482027cf79755519cb39ba2eed01a29e
avatar/urls.py
avatar/urls.py
from django.conf.urls.defaults import patterns, url urlpatterns = patterns('avatar.views', url('^add/$', 'add', name='avatar_add'), url('^change/$', 'change', name='avatar_change'), url('^delete/$', 'delete', name='avatar_delete'), url('^render_primary/(?P<user>[\+\w]+)/(?P<size>[\d]+)/$', 'render_prim...
from django.conf.urls.defaults import patterns, url urlpatterns = patterns('avatar.views', url('^add/$', 'add', name='avatar_add'), url('^change/$', 'change', name='avatar_change'), url('^delete/$', 'delete', name='avatar_delete'), url('^render_primary/(?P<user>[\w\d\.\-_]{3,30})/(?P<size>[\d]+)/$', 'r...
Support for username with extra chars.
Support for username with extra chars.
Python
bsd-3-clause
alexlovelltroy/django-avatar
97f1d671966917d29d20c0afb554aaed69c4f9af
wysihtml5/tests/__init__.py
wysihtml5/tests/__init__.py
#-*- coding: utf-8 -*- import os import sys import unittest def setup_django_settings(): os.chdir(os.path.join(os.path.dirname(__file__), "..")) sys.path.insert(0, os.getcwd()) os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings" def run_tests(): if not os.environ.get("DJANGO_SETTINGS_MODULE", Fa...
#-*- coding: utf-8 -*- import os import sys import unittest def setup_django_settings(): os.chdir(os.path.join(os.path.dirname(__file__), "..")) sys.path.insert(0, os.getcwd()) os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings" def run_tests(): if not os.environ.get("DJANGO_SETTINGS_MODULE", Fa...
Convert INSTALLED_APPS to list before concat
Convert INSTALLED_APPS to list before concat
Python
bsd-2-clause
danirus/django-wysihtml5,danirus/django-wysihtml5,danirus/django-wysihtml5
91db70d1fc266e3e3925e84fcaf83410e0504e37
Lib/tkinter/test/test_tkinter/test_font.py
Lib/tkinter/test/test_tkinter/test_font.py
import unittest import tkinter from tkinter import font from test.support import requires, run_unittest import tkinter.test.support as support requires('gui') class FontTest(unittest.TestCase): def setUp(self): support.root_deiconify() def tearDown(self): support.root_withdraw() def tes...
import unittest import tkinter from tkinter import font from test.support import requires, run_unittest import tkinter.test.support as support requires('gui') class FontTest(unittest.TestCase): def setUp(self): support.root_deiconify() def tearDown(self): support.root_withdraw() def tes...
Fix test_tk under OS X with Tk 8.4. Patch by Ned Deily. This should fix some buildbot failures.
Fix test_tk under OS X with Tk 8.4. Patch by Ned Deily. This should fix some buildbot failures.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
e01e5cca84c3eeb04d20b3a91bbb44d688418bf3
pypaas/sshkey.py
pypaas/sshkey.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os.path import sys from . import util class SSHKey(object): @staticmethod def rebuild_authorized_keys(): lines = [] ssh_dir = os.path.expanduser('~/.ssh') util.mkdir_p(os.path.join(ssh_dir, 'authorized_keys.d')) for name i...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os.path import sys from . import util class SSHKey(object): @staticmethod def rebuild_authorized_keys(): lines = [] ssh_dir = os.path.expanduser('~/.ssh') util.mkdir_p(os.path.join(ssh_dir, 'authorized_keys.d')) for name i...
Allow multiple SSH keys per file
Allow multiple SSH keys per file
Python
mit
fintura/pyPaaS,fintura/pyPaaS
f37d26541d6baf3da47a8f373a8c7a65177067db
push/modules/push_notification.py
push/modules/push_notification.py
# coding=utf-8 import time, os, json from apns import APNs, Frame, Payload from push.models import DevelopFileModel, ProductFileModel from django.conf import settings PEM_FILE_DIR = settings.BASE_DIR + '/push/files/' def execute(device_token_lists, notification): if notification.is_production: pem_file_n...
# coding=utf-8 import time, os, json from apns import APNs, Frame, Payload from push.models import DevelopFileModel, ProductFileModel from django.conf import settings PEM_FILE_DIR = settings.BASE_DIR + '/push/files/' def execute(device_token_lists, notification): if notification.is_production: pem_file_n...
Send flag when success push notifications
Send flag when success push notifications
Python
apache-2.0
nnsnodnb/django-mbaas,nnsnodnb/django-mbaas,nnsnodnb/django-mbaas
73660b238067279287f764d001549bf5e940b607
tests/test_api.py
tests/test_api.py
import os import sys import json import responses import unittest CWD = os.path.dirname(os.path.abspath(__file__)) MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Allow import of api.py if os.path.join(MS_WD, 'utils') not in sys.path: sys.path.insert(0, os.path.join(MS_WD, 'utils')) # Use mu...
import os import sys import json import responses import unittest CWD = os.path.dirname(os.path.abspath(__file__)) MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Allow import of api.py if os.path.join(MS_WD, 'utils') not in sys.path: sys.path.insert(0, os.path.join(MS_WD, 'utils')) if os.pa...
Add unit test for newly initialized db
Add unit test for newly initialized db
Python
mpl-2.0
jmlong1027/multiscanner,awest1339/multiscanner,mitre/multiscanner,awest1339/multiscanner,MITRECND/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,MITRECND/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner
bb5c0711880f43dd8c726a9749152246eecccc84
waterfall_wall/models.py
waterfall_wall/models.py
# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table # Feel free ...
# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table # Feel free ...
Use feed as the foreign key of image
Use feed as the foreign key of image
Python
mit
carlcarl/rcard,carlcarl/rcard
3aa327ad470d772c0c487a11e8dce7e256e9f14d
alembic/versions/1c398722878_git_branch.py
alembic/versions/1c398722878_git_branch.py
"""git_branch Revision ID: 1c398722878 Revises: f8d315a31e Create Date: 2015-10-18 00:38:22.737519 """ # revision identifiers, used by Alembic. revision = '1c398722878' down_revision = 'f8d315a31e' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade(): ### command...
"""git_branch Revision ID: 1c398722878 Revises: 224302e491d Create Date: 2015-10-18 00:38:22.737519 """ # revision identifiers, used by Alembic. revision = '1c398722878' down_revision = '224302e491d' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade(): ### comma...
Fix migration for squashed init
Fix migration for squashed init
Python
isc
RickyCook/DockCI,RickyCook/DockCI,sprucedev/DockCI,sprucedev/DockCI,RickyCook/DockCI,sprucedev/DockCI,sprucedev/DockCI-Agent,RickyCook/DockCI,sprucedev/DockCI-Agent,sprucedev/DockCI
dd0ceaaadbdb401e2423fbc3b7c395a117a2ef79
Command_Line_Interface/__init__.py
Command_Line_Interface/__init__.py
__author__ = "Jarrod N. Bakker" __status__ = "development"
# Copyright 2015 Jarrod N. Bakker # # 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 writ...
Revert "Added to allow local imports."
Revert "Added to allow local imports." This reverts commit b1f8344f1525b97a73619fbd84ec26c72829eb7d.
Python
apache-2.0
bakkerjarr/ACLSwitch,bakkerjarr/ACLSwitch
9b968e8cf4c5fd8e4bd120255b8eb3c7bc4e6943
mygpoauth/authorization/admin.py
mygpoauth/authorization/admin.py
from django.contrib import admin from .models import Authorization @admin.register(Authorization) class ApplicationAdmin(admin.ModelAdmin): pass
from django.contrib import admin from .models import Authorization @admin.register(Authorization) class ApplicationAdmin(admin.ModelAdmin): def scope_list(self, app): return ', '.join(app.scopes) list_display = ['user', 'application', 'scope_list'] list_select_related = ['user', 'application'] ...
Improve Admin for Authorization objects
Improve Admin for Authorization objects
Python
agpl-3.0
gpodder/mygpo-auth,gpodder/mygpo-auth
b178b2622aff7da7e7d4b6730f5d1c98680b1266
txircd/modbase.py
txircd/modbase.py
# The purpose of this file is to provide base classes with the needed functions # already defined; this allows us to guarantee that any exceptions raised # during function calls are a problem with the module and not just that the # particular function isn't defined. from txircd.utils import now class Module(object): ...
# The purpose of this file is to provide base classes with the needed functions # already defined; this allows us to guarantee that any exceptions raised # during function calls are a problem with the module and not just that the # particular function isn't defined. from txircd.utils import now class Module(object): ...
Remove unused functions from the Mode base object
Remove unused functions from the Mode base object
Python
bsd-3-clause
Heufneutje/txircd,ElementalAlchemist/txircd,DesertBus/txircd
f6b76e77d4b3a3dae3420296811891585700f220
nodewatcher/web/sanitize-dump.py
nodewatcher/web/sanitize-dump.py
#!/usr/bin/python # Setup import paths, since we are using Django models import sys, os sys.path.append('/var/www/django') os.environ['DJANGO_SETTINGS_MODULE'] = 'wlanlj.settings_production' # Imports from django.core import serializers if len(sys.argv) != 4: print "Usage: %s format input-file output-file" % sys.a...
#!/usr/bin/python # Setup import paths, since we are using Django models import sys, os sys.path.append('/var/www/django') os.environ['DJANGO_SETTINGS_MODULE'] = 'wlanlj.settings_production' # Imports from django.core import serializers if len(sys.argv) != 4: print "Usage: %s format input-file output-file" % sys.a...
Set user password for all sanitized users to '123'.
Set user password for all sanitized users to '123'.
Python
agpl-3.0
galaxor/Nodewatcher,galaxor/Nodewatcher,galaxor/Nodewatcher,galaxor/Nodewatcher
211665a4163801b68d90cbefd5d896f28f374f6f
settings.py
settings.py
# Put your device token here. To get a device token, register at http://stage.cloud4rpi.io DeviceToken = ""
# Put your device token here. To get a device token, register at http://stage.cloud4rpi.io DeviceToken = "YOUR_DEVICE_TOKEN"
Add a placeholder to device token
Add a placeholder to device token
Python
mit
cloud4rpi/cloud4rpi
9787fb3a78d681aff25c6cbaac2c1ba842c4c7db
manila_ui/api/network.py
manila_ui/api/network.py
# Copyright (c) 2015 Mirantis, Inc. # All Rights Reserved. # # 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 requir...
# Copyright (c) 2015 Mirantis, Inc. # All Rights Reserved. # # 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 requir...
Fix compatibility with latest horizon
Fix compatibility with latest horizon Class "NetworkClient" from "openstack_dashboards.api.network" module was removed from horizon repo. So, remove its usage and use neutron directly. Change-Id: Idcf51553f64fae2254c224d4c6ef4fbb94e6f279 Closes-Bug: #1691466
Python
apache-2.0
openstack/manila-ui,openstack/manila-ui,openstack/manila-ui
8a6725554451e8df61c60184d41f618a8cd5c7aa
tests/appservice_integrations_tests.py
tests/appservice_integrations_tests.py
import os from arteria.web.app import AppService from unittest import TestCase class AppServiceTest(TestCase): this_file_path = os.path.dirname(os.path.realpath(__file__)) def test_can_load_configuration(self): app_svc = AppService.create( product_name="arteria-test", ...
import os from arteria.web.app import AppService from unittest import TestCase class AppServiceTest(TestCase): this_file_path = os.path.dirname(os.path.realpath(__file__)) def test_can_load_configuration(self): app_svc = AppService.create( product_name="arteria-test", ...
Test extra args are used
Test extra args are used
Python
mit
arteria-project/arteria-core
a9307e1ac7778f6073d275a4822bc5f1df9c45fb
termedit.py
termedit.py
#!/usr/bin/env python3 import os import sys import neovim files = {os.path.abspath(arg) for arg in sys.argv[1:]} if not files: sys.exit(1) addr = os.environ.get('NVIM_LISTEN_ADDRESS', None) if not addr: os.execvp('nvim', files) nvim = neovim.attach('socket', path=addr) tbuf = nvim.current.buffer for fname ...
#!/usr/bin/env python3 import os import sys import neovim files = [os.path.abspath(arg) for arg in sys.argv[1:]] if not files: sys.exit(1) addr = os.environ.get('NVIM_LISTEN_ADDRESS', None) if not addr: os.execvp('nvim', files) nvim = neovim.attach('socket', path=addr) tbuf = nvim.current.buffer for fname ...
Fix not opening paths with spaces.
Fix not opening paths with spaces.
Python
apache-2.0
rliang/termedit.nvim
c7b7e62cb2585f6109d70b27564617b0be4c8c33
tests/test_daterange.py
tests/test_daterange.py
import os import time try: import unittest2 as unittest except ImportError: import unittest class DateRangeTest(unittest.TestCase): def setUp(self): self.openlicensefile = os.path.join(os.path.dirname(__file__), '../LICENSE.txt') self.pattern = 'Copyright (c) 2012 - %s SendGrid, Inc.' % (t...
import os import time try: import unittest2 as unittest except ImportError: import unittest class DateRangeTest(unittest.TestCase): def setUp(self): self.openlicensefile = os.path.join( os.path.dirname(__file__), '../LICENSE.txt') ...
Update code for PEP8 compliance
Update code for PEP8 compliance
Python
mit
sendgrid/python-http-client,sendgrid/python-http-client
f01921e6e2fbac76dc41e354b84f970b1591193d
nsone/rest/monitoring.py
nsone/rest/monitoring.py
# # Copyright (c) 2014 NSONE, Inc. # # License under The MIT License (MIT). See LICENSE in project root. # from . import resource class Monitors(resource.BaseResource): ROOT = 'monitoring/jobs' PASSTHRU_FIELDS = ['name', 'config'] def list(self, callback=None, errback=None): return self._make_re...
# # Copyright (c) 2014 NSONE, Inc. # # License under The MIT License (MIT). See LICENSE in project root. # from . import resource class Monitors(resource.BaseResource): ROOT = 'monitoring/jobs' PASSTHRU_FIELDS = ['name', 'config'] def list(self, callback=None, errback=None): return self._make_re...
Add support for monitor deletion
Add support for monitor deletion
Python
mit
nsone/nsone-python,ns1/nsone-python
5cbee0f9fb7ba360e00fbcf94c2c2a7a331dd1b6
bayesian_jobs/handlers/sync_to_graph.py
bayesian_jobs/handlers/sync_to_graph.py
import datetime from cucoslib.models import Analysis, Package, Version, Ecosystem from cucoslib.workers import GraphImporterTask from .base import BaseHandler class SyncToGraph(BaseHandler): """ Sync all finished analyses to Graph DB """ def execute(self): start = 0 while True: re...
import datetime from cucoslib.models import Analysis, Package, Version, Ecosystem from cucoslib.workers import GraphImporterTask from .base import BaseHandler class SyncToGraph(BaseHandler): """ Sync all finished analyses to Graph DB """ def execute(self): start = 0 while True: re...
Handle errors in sync job
Handle errors in sync job
Python
apache-2.0
fabric8-analytics/fabric8-analytics-jobs,fabric8-analytics/fabric8-analytics-jobs
bc70f78ef90f1758581dd7f3a8f8b5b2801375a6
buildserver/config.buildserver.py
buildserver/config.buildserver.py
sdk_path = "/home/vagrant/android-sdk" ndk_paths = { 'r9b': "/home/vagrant/android-ndk/r9b", 'r10e': "/home/vagrant/android-ndk/r10e", } build_tools = "22.0.1" ant = "ant" mvn3 = "mvn" gradle = "gradle"
sdk_path = "/home/vagrant/android-sdk" ndk_paths = { 'r9b': "/home/vagrant/android-ndk/r9b", 'r10e': "/home/vagrant/android-ndk/r10e", }
Remove default config settings from the BS
Remove default config settings from the BS
Python
agpl-3.0
fdroidtravis/fdroidserver,fdroidtravis/fdroidserver,f-droid/fdroid-server,fdroidtravis/fdroidserver,f-droid/fdroidserver,matlink/fdroidserver,f-droid/fdroid-server,f-droid/fdroidserver,fdroidtravis/fdroidserver,f-droid/fdroid-server,f-droid/fdroidserver,f-droid/fdroid-server,f-droid/fdroidserver,matlink/fdroidserver,f-...
6ef5a1a91e78c877a099b8c55df2f3f4d84686bb
bluesky/tests/test_vertical_integration.py
bluesky/tests/test_vertical_integration.py
from collections import defaultdict from bluesky.examples import stepscan, det, motor from bluesky.callbacks.broker import post_run, verify_files_saved from functools import partial def test_scan_and_get_data(fresh_RE, db): RE = fresh_RE RE.subscribe(db.mds.insert) uid, = RE(stepscan(det, motor), group='f...
from collections import defaultdict from bluesky.examples import stepscan, det, motor from bluesky.callbacks.broker import post_run, verify_files_saved from functools import partial def test_scan_and_get_data(fresh_RE, db): RE = fresh_RE RE.subscribe(db.insert) uid, = RE(stepscan(det, motor), group='foo',...
Update to new databroker API.
TST: Update to new databroker API.
Python
bsd-3-clause
ericdill/bluesky,ericdill/bluesky
b68576d307474eaf6bd8a8853bee767c391d28b9
conjure/connection.py
conjure/connection.py
from .exceptions import ConnectionError from pymongo import MongoClient from pymongo.uri_parser import parse_uri _connections = {} try: import gevent except ImportError: gevent = None def _get_connection(uri): global _connections parsed_uri = parse_uri(uri) hosts = parsed_uri['nodelist'] ...
from .exceptions import ConnectionError from pymongo import MongoClient from pymongo.uri_parser import parse_uri _connections = {} try: import gevent except ImportError: gevent = None def _get_connection(uri): global _connections parsed_uri = parse_uri(uri) hosts = parsed_uri['nodelist'] ...
Remove authenticate call to fix issues with pymongo 3.7
Remove authenticate call to fix issues with pymongo 3.7
Python
mit
GGOutfitters/conjure
0ae6b19f69976d2bcff4a0206ec97c6f9198eaa1
whip/web.py
whip/web.py
""" Whip's REST API """ # pylint: disable=missing-docstring import socket from flask import Flask, abort, make_response, request from .db import Database app = Flask(__name__) app.config.from_envvar('WHIP_SETTINGS', silent=True) db = None @app.before_first_request def _open_db(): global db # pylint: disab...
""" Whip's REST API """ # pylint: disable=missing-docstring import socket from flask import Flask, abort, make_response, request from .db import Database app = Flask(__name__) app.config.from_envvar('WHIP_SETTINGS', silent=True) db = None @app.before_first_request def _open_db(): global db # pylint: disab...
Fix time-based lookups in REST API
Fix time-based lookups in REST API Don't encode the datetime argument to bytes; the underlying function expects a string argument.
Python
bsd-3-clause
wbolster/whip
fb8fbdedd28eddf55a4846c4af5f0137cad9adfb
seleniumbase/config/proxy_list.py
seleniumbase/config/proxy_list.py
""" Proxy Server "Phone Book". Simplify running browser tests through a proxy server by adding your frequently-used proxies here. Now you can do something like this on the command line: "pytest SOME_TEST.py --proxy=proxy1" Format of PROXY_LIST server entries: * "ip_address:port" Example proxies in PROXY_LIST below ...
""" Proxy Server "Phone Book". Simplify running browser tests through a proxy server by adding your frequently-used proxies here. Now you can do something like this on the command line: "pytest SOME_TEST.py --proxy=proxy1" Format of PROXY_LIST server entries: * "ip_address:port" Example proxies in PROXY_LIST below ...
Remove an example proxy server definition
Remove an example proxy server definition
Python
mit
mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,mdmintz/seleniumspot
881a133d30ab750368343d964f6b7110373cd9c5
bazaar/goods/views.py
bazaar/goods/views.py
from django.views import generic from ..mixins import BazaarPrefixMixin from .models import Product class ProductListView(BazaarPrefixMixin, generic.ListView): model = Product class ProductCreateView(BazaarPrefixMixin, generic.CreateView): model = Product
from django.views import generic from ..mixins import BazaarPrefixMixin from .models import Product class ProductListView(BazaarPrefixMixin, generic.ListView): model = Product paginate_by = 20 class ProductCreateView(BazaarPrefixMixin, generic.CreateView): model = Product
Add pagination to product list view
Add pagination to product list view
Python
bsd-2-clause
meghabhoj/NEWBAZAAR,meghabhoj/NEWBAZAAR,evonove/django-bazaar,meghabhoj/NEWBAZAAR,evonove/django-bazaar,evonove/django-bazaar
c6ab73a718d7f8c948ba79071993cd7a8f484ab5
rm/userprofiles/views.py
rm/userprofiles/views.py
""" Views that allow us to edit user profile data """ from django.core.urlresolvers import reverse_lazy from django.views.generic.edit import UpdateView from rm.userprofiles.forms import ProfileForm from rm.userprofiles.models import RMUser class RMUserUpdate(UpdateView): model = RMUser form_class = Pro...
""" Views that allow us to edit user profile data """ from django.core.urlresolvers import reverse_lazy from django.views.generic.edit import UpdateView from rm.http import LoginRequiredMixin from rm.userprofiles.forms import ProfileForm from rm.userprofiles.models import RMUser class RMUserUpdate(LoginRequiredMixin...
Make our account pages require a logged in user.
Make our account pages require a logged in user. closes #221
Python
agpl-3.0
openhealthcare/randomise.me,openhealthcare/randomise.me,openhealthcare/randomise.me,openhealthcare/randomise.me
d02e021a68333c52adff38cc869bf217deebfc5c
run.py
run.py
#!/usr/bin/env python3 import pygame from constants import * from music_maker import * from tkinter import Tk def main(): # initialize game engine pygame.init() # set screen width/height and caption screen = pygame.display.set_mode(SCREEN_DIM, pygame.RESIZABLE) pygame.display.set_caption('So...
#!/usr/bin/env python3 import pygame from constants import * from music_maker import * from tkinter import Tk def main(): # initialize game engine pygame.init() # We only use pygame for drawing, and mixer will hog cpu otherwise # https://github.com/pygame/pygame/issues/331 pygame.mixer.quit...
Fix pygame mixer init hogging cpu
Fix pygame mixer init hogging cpu
Python
mit
kenanbit/loopsichord
844a165267e50d92b59c7c8fea97edcb1c8acf79
judge/views/status.py
judge/views/status.py
from django.shortcuts import render_to_response from django.template import RequestContext from judge.models import Judge __all__ = ['status', 'status_table'] def status(request): return render_to_response('judge_status.jade', { 'judges': Judge.objects.all(), 'title': 'Status', }, context_in...
from django.shortcuts import render_to_response from django.template import RequestContext from judge.models import Judge __all__ = ['status', 'status_table'] def status(request): return render_to_response('judge_status.jade', { 'judges': Judge.objects.all(), 'title': 'Status', }, context_in...
Order judge list by load
Order judge list by load
Python
agpl-3.0
Phoenix1369/site,Phoenix1369/site,DMOJ/site,Minkov/site,DMOJ/site,Phoenix1369/site,monouno/site,monouno/site,DMOJ/site,Minkov/site,monouno/site,Minkov/site,Minkov/site,monouno/site,Phoenix1369/site,DMOJ/site,monouno/site
3fbb013e8446af0be5013abec86c5503b9343d8e
kaf2html.py
kaf2html.py
"""Script to generate an HTML page from a KAF file that shows the text contents including line numbers. """ from bs4 import BeautifulSoup with open('data/minnenijd.kaf') as f: xml_doc = BeautifulSoup(f) output_html = ['<html><head>', '<meta http-equiv="Content-Type" content="text/html; ' \ ...
"""Script to generate an HTML page from a KAF file that shows the text contents including line numbers. """ from bs4 import BeautifulSoup with open('data/minnenijd.kaf') as f: xml_doc = BeautifulSoup(f) output_html = ['<html><head>', '<meta http-equiv="Content-Type" content="text/html; ' ...
Change script to accept non-number versions of sent and para attributes
Change script to accept non-number versions of sent and para attributes The script relied on numeric sent and para attributes. The code was changed to also accept non-numeric sent and para attributes. In some cases, the sent and para attributes returned by tools are not numeric.
Python
apache-2.0
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
220f0199c97494e7b8a8ec913cf5251206f15550
project/scripts/dates.py
project/scripts/dates.py
# For now I am assuming the investment date will be returned from the db # as a string yyyy-mm-dd, representing the day the trend was purchased in UTC time #!/usr/bin/env python3 from datetime import datetime, timedelta import pytz def get_start_times(date): """ date: an epoch integer representing the date...
# For now I am assuming the investment date will be returned from the db # as a string yyyy-mm-dd, representing the day the trend was purchased in UTC time #!/usr/bin/env python3 from datetime import datetime, timezone, timedelta import pytz def get_start_times(date): """ date: an epoch integer representin...
Fix date to epoch converter to timestamp at exactly midnight
Fix date to epoch converter to timestamp at exactly midnight
Python
apache-2.0
googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks
fae7cd0a40d338f82404522a282b71a1cb4d84b1
runtests.py
runtests.py
#!/usr/bin/env python import sys from os.path import abspath, dirname from django.conf import settings sys.path.insert(0, abspath(dirname(__file__))) if not settings.configured: settings.configure( ROOT_URLCONF='simple_history.tests.urls', INSTALLED_APPS=( 'django.contrib.contenttyp...
#!/usr/bin/env python import sys from os.path import abspath, dirname from django.conf import settings sys.path.insert(0, abspath(dirname(__file__))) if not settings.configured: settings.configure( ROOT_URLCONF='simple_history.tests.urls', STATIC_URL='/static/', INSTALLED_APPS=( ...
Fix STATIC_URL (for Django 1.5 admin tests)
Fix STATIC_URL (for Django 1.5 admin tests)
Python
bsd-3-clause
luzfcb/django-simple-history,luzfcb/django-simple-history,pombredanne/django-simple-history,emergence/django-simple-history,treyhunner/django-simple-history,pombredanne/django-simple-history,treyhunner/django-simple-history,emergence/django-simple-history
b4120ec570624ae4c66269ae2a8f916ec55734e9
ipywidgets/widgets/valuewidget.py
ipywidgets/widgets/valuewidget.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Contains the ValueWidget class""" from .widget import Widget class ValueWidget(Widget): """Widget that can be used for the input of an interactive function""" def get_interact_value(self): """Ret...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Contains the ValueWidget class""" from .widget import Widget from traitlets import Any class ValueWidget(Widget): """Widget that can be used for the input of an interactive function""" value = Any(help="...
Add a value trait to Value widgets.
Add a value trait to Value widgets.
Python
bsd-3-clause
ipython/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets
7dbe03fcbbbf57ec9380eb9a1c24b5fd9f6594e2
zinnia/tests/utils.py
zinnia/tests/utils.py
"""Utils for Zinnia's tests""" import cStringIO from xmlrpclib import Transport from django.test.client import Client class TestTransport(Transport): """Handles connections to XML-RPC server through Django test client.""" def __init__(self, *args, **kwargs): Transport.__init__(self, *args, **kwa...
"""Utils for Zinnia's tests""" import StringIO from xmlrpclib import Transport from django.test.client import Client class TestTransport(Transport): """Handles connections to XML-RPC server through Django test client.""" def __init__(self, *args, **kwargs): Transport.__init__(self, *args, **kwar...
Fix tests on Python2.7 xmlrpclib.Transport.parse_response calls 'getheader' on its response input
Fix tests on Python2.7 xmlrpclib.Transport.parse_response calls 'getheader' on its response input
Python
bsd-3-clause
1844144/django-blog-zinnia,petecummings/django-blog-zinnia,jfdsmit/django-blog-zinnia,Maplecroft/django-blog-zinnia,marctc/django-blog-zinnia,Zopieux/django-blog-zinnia,1844144/django-blog-zinnia,petecummings/django-blog-zinnia,bywbilly/django-blog-zinnia,Zopieux/django-blog-zinnia,bywbilly/django-blog-zinnia,extertion...