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
e291ae29926a3cd05c9268c625e14d205638dfe8
jarn/mkrelease/scp.py
jarn/mkrelease/scp.py
import tempfile import tee from process import Process from exit import err_exit class SCP(object): """Secure copy and FTP abstraction.""" def __init__(self, process=None): self.process = process or Process() def run_scp(self, distfile, location): if not self.process.quiet: ...
import tempfile import tee from os.path import split from process import Process from chdir import ChdirStack from exit import err_exit class SCP(object): """Secure copy and FTP abstraction.""" def __init__(self, process=None): self.process = process or Process() self.dirstack = ChdirStack(...
Change to dist dir before uploading to lose the absolute path.
Change to dist dir before uploading to lose the absolute path.
Python
bsd-2-clause
Jarn/jarn.mkrelease
6b9ccae880e9582f38e2a8aa3c451bc6f6a88d37
thing/tasks/tablecleaner.py
thing/tasks/tablecleaner.py
import datetime from celery import task from celery.utils.log import get_task_logger logger = get_task_logger(__name__) from django.db.models import Q from thing.models import APIKey, TaskState # --------------------------------------------------------------------------- # Periodic task to perform database table cl...
import datetime from celery import task from celery.utils.log import get_task_logger logger = get_task_logger(__name__) from django.db.models import Q from thing.models import APIKey, TaskState # --------------------------------------------------------------------------- # Periodic task to perform database table cl...
Change thing.tasks.table_cleaner to delete TaskState objects for any invalid APIKeys
Change thing.tasks.table_cleaner to delete TaskState objects for any invalid APIKeys
Python
bsd-2-clause
madcowfred/evething,madcowfred/evething,Gillingham/evething,Gillingham/evething,cmptrgeekken/evething,madcowfred/evething,Gillingham/evething,cmptrgeekken/evething,cmptrgeekken/evething,Gillingham/evething,madcowfred/evething,cmptrgeekken/evething,cmptrgeekken/evething
e1c970d76dbd0eb631e726e101b09c0f5e5599ec
doc/api_changes/2015-04-27-core.py
doc/api_changes/2015-04-27-core.py
Grid-building functions ----------------------- :func:`pixels_to_radius` and :func:`pixels_to_phi` were renamed to :func:`radial_grid` and :func:`angle_grid` respectively. The name and order of their arguments was also changed: see their docstring or API docs for details.
Grid-building functions ----------------------- :func:`pixels_to_radius` and :func:`pixels_to_phi` were renamed to :func:`radial_grid` and :func:`angle_grid` respectively. The name and order of their arguments was also changed: see their docstring or API docs for details. Importantly, the orientation of the output of ...
Add change in angle_grid orientation to API changes.
DOC: Add change in angle_grid orientation to API changes.
Python
bsd-3-clause
licode/scikit-xray,Nikea/scikit-xray,hainm/scikit-xray,celiafish/scikit-xray,licode/scikit-beam,CJ-Wright/scikit-beam,CJ-Wright/scikit-beam,tacaswell/scikit-xray,giltis/scikit-xray,ericdill/scikit-xray,scikit-xray/scikit-xray,yugangzhang/scikit-beam,scikit-xray/scikit-xray,giltis/scikit-xray,danielballan/scikit-xray,ta...
6974cba56413527c8b7cef9e4b6ad6ca9fe5049e
tests/test_memory.py
tests/test_memory.py
# coding: utf-8 from unittest import TestCase from chipy8 import Memory class TestMemory(TestCase): def setUp(self): self.memory = Memory() def test_write(self): 'Write a byte to memory then read it.' address = 0x200 self.memory.write_byte(0x200, 0x01) self.assertEqual...
# coding: utf-8 from unittest import TestCase from chipy8 import Memory class TestMemory(TestCase): def setUp(self): self.memory = Memory() def test_write(self): 'Write a byte to memory then read it.' address = 0x200 self.memory.write_byte(address, 0x01) self.assertEqu...
Clarify values used in tests.
Clarify values used in tests.
Python
bsd-3-clause
gutomaia/chipy8
ff489b1541f896025a0c630be6abe2d23843ec36
examples/05_alternative_language.py
examples/05_alternative_language.py
#!/usr/bin/env python from pyhmsa.datafile import DataFile from pyhmsa.type.language import langstr datafile = DataFile() author = langstr('Fyodor Dostoyevsky', {'ru': u'Фёдор Миха́йлович Достое́вский'}) datafile.header.author = author print(datafile.header.author.alternatives['ru']) # Returns ...
#!/usr/bin/env python from pyhmsa.datafile import DataFile from pyhmsa.type.language import langstr datafile = DataFile() author = langstr('Wilhelm Conrad Roentgen', {'de': u'Wilhelm Conrad Röntgen'}) datafile.header.author = author print(datafile.header.author.alternatives['de']) # Returns ...
Replace name in alternative language to prevent compilation problems with LaTeX
Replace name in alternative language to prevent compilation problems with LaTeX
Python
mit
pyhmsa/pyhmsa
61fecbed71129228e7020a9e95dbcd2487bbdbb3
turbustat/tests/test_scf.py
turbustat/tests/test_scf.py
# Licensed under an MIT open source license - see LICENSE ''' Test functions for SCF ''' from unittest import TestCase import numpy as np import numpy.testing as npt from ..statistics import SCF, SCF_Distance from ._testing_data import \ dataset1, dataset2, computed_data, computed_distances class testSCF(Tes...
# Licensed under an MIT open source license - see LICENSE ''' Test functions for SCF ''' from unittest import TestCase import numpy as np import numpy.testing as npt from scipy.ndimage import zoom from ..statistics import SCF, SCF_Distance from ._testing_data import \ dataset1, dataset2, computed_data, compute...
Add simple SCF test for unequal grids
Add simple SCF test for unequal grids
Python
mit
e-koch/TurbuStat,Astroua/TurbuStat
698677a623722b63ec4cceb7690b62fa7e4ede37
django_prices_openexchangerates/templatetags/prices_multicurrency_i18n.py
django_prices_openexchangerates/templatetags/prices_multicurrency_i18n.py
from django.template import Library from django_prices.templatetags import prices_i18n from .. import exchange_currency register = Library() @register.simple_tag # noqa def gross_in_currency(price, currency): # noqa converted_price = exchange_currency(price, currency) return prices_i18n.gross(converted_pr...
from django.template import Library from django_prices.templatetags import prices_i18n from .. import exchange_currency register = Library() @register.simple_tag # noqa def gross_in_currency(price, currency): # noqa converted_price = exchange_currency(price, currency) return prices_i18n.gross(converted_pr...
Add templatetag for converting discounts between currencies
Add templatetag for converting discounts between currencies
Python
bsd-3-clause
mirumee/django-prices-openexchangerates,artursmet/django-prices-openexchangerates
32a54ff0588930efc5e0ee3c61f2efbf57e450e0
inviter/tests.py
inviter/tests.py
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.contrib.auth.models import User from django.core.mail import get_connection from django.test import TestCase from inviter.uti...
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.contrib.auth.models import User from django.core.mail import outbox from django.test import TestCase from inviter.utils impor...
Test fix to check django.core.mail.outbox
Test fix to check django.core.mail.outbox
Python
mit
caffeinehit/django-inviter
9d6c8eaa491d0988bf16633bbba9847350f57778
spacy/lang/norm_exceptions.py
spacy/lang/norm_exceptions.py
# coding: utf8 from __future__ import unicode_literals # These exceptions are used to add NORM values based on a token's ORTH value. # Individual languages can also add their own exceptions and overwrite them - # for example, British vs. American spelling in English. # Norms are only set if no alternative is provide...
# coding: utf8 from __future__ import unicode_literals # These exceptions are used to add NORM values based on a token's ORTH value. # Individual languages can also add their own exceptions and overwrite them - # for example, British vs. American spelling in English. # Norms are only set if no alternative is provide...
Update base norm exceptions with more unicode characters
Update base norm exceptions with more unicode characters e.g. unicode variations of punctuation used in Chinese
Python
mit
aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/s...
7394ba6eba50282bd7252e504a80e5d595dd12bc
ci/fix_paths.py
ci/fix_paths.py
import distutils.sysconfig from glob import glob import os from os.path import join as pjoin, basename from shutil import copy from sys import platform def main(): """ Copy HDF5 DLLs into installed h5py package """ # This is the function Tox also uses to locate site-packages (Apr 2019) sitepackages...
import distutils.sysconfig from glob import glob import os from os.path import join as pjoin, basename from shutil import copy from sys import platform def main(): """ Copy HDF5 DLLs into installed h5py package """ # This is the function Tox also uses to locate site-packages (Apr 2019) sitepackages...
Copy zlib.dll into Windows h5py installed from source
Copy zlib.dll into Windows h5py installed from source
Python
bsd-3-clause
h5py/h5py,h5py/h5py,h5py/h5py
6db2bb9b1634a7b37790207e5b8d420de643a9cb
turbasen/__init__.py
turbasen/__init__.py
VERSION = '1.0.0' def configure(**settings): from .settings import Settings for key, value in settings.items(): Settings.setattr(key, value)
VERSION = '1.0.0' from .models import \ Omrade, \ Sted def configure(**settings): from .settings import Settings for key, value in settings.items(): Settings.setattr(key, value)
Add relevant models to turbasen module
Add relevant models to turbasen module
Python
mit
Turbasen/turbasen.py
e8b1cee54f679cbd6a2d158b3c2789f3f6a3d9c0
uppercase.py
uppercase.py
from twisted.internet import protocol, reactor factory = protocol.ServerFactory() factory.protocol = protocol.Protocol reactor.listenTCP(8000, factory) reactor.run()
from twisted.internet import endpoints, protocol, reactor class UpperProtocol(protocol.Protocol): pass factory = protocol.ServerFactory() factory.protocol = UpperProtocol endpoints.serverFromString(reactor, 'tcp:8000').listen(factory) reactor.run()
Convert to endpoints API and use custom protocol class
Convert to endpoints API and use custom protocol class
Python
mit
cataliniacob/ep2012-tutorial-twisted
6b179dc4fb95f4db380b9156381b6210adeef2e5
conftest.py
conftest.py
# Copyright 2016 Google 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 required by applicable law or ...
# Copyright 2016 Google 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 required by applicable law or ...
Set the Project in code
Set the Project in code
Python
apache-2.0
GoogleCloudPlatform/getting-started-python,GoogleCloudPlatform/getting-started-python,GoogleCloudPlatform/getting-started-python
378f3bf0bb2e05260b7cbeeb4a4637d7d3a7ca7c
workflows/consumers.py
workflows/consumers.py
from urllib.parse import parse_qs from channels import Group from channels.sessions import channel_session @channel_session def ws_add(message): message.reply_channel.send({"accept": True}) qs = parse_qs(message['query_string']) workflow_pk = qs['workflow_pk'][0] message.channel_session['workflow_pk']...
from urllib.parse import parse_qs from channels import Group from channels.sessions import channel_session @channel_session def ws_add(message): message.reply_channel.send({"accept": True}) qs = parse_qs(message['query_string']) workflow_pk = qs[b'workflow_pk'][0].decode('utf-8') message.channel_sessi...
Fix query string problem of comparing byte strings and unicode strings in py3
Fix query string problem of comparing byte strings and unicode strings in py3
Python
mit
xflows/clowdflows-backend,xflows/clowdflows-backend,xflows/clowdflows-backend,xflows/clowdflows-backend
9a7c80744bc1e57fe0ec5fc7cf149dada2d05121
neuroimaging/utils/tests/data/__init__.py
neuroimaging/utils/tests/data/__init__.py
"""Information used for locating nipy test data. Nipy uses a set of test data that is installed separately. The test data should be located in the directory ``~/.nipy/tests/data``. Install the data in your home directory from the data repository:: $ mkdir -p .nipy/tests/data $ svn co http://neuroimaging.scipy.or...
""" Nipy uses a set of test data that is installed separately. The test data should be located in the directory ``~/.nipy/tests/data``. Install the data in your home directory from the data repository:: $ mkdir -p .nipy/tests/data $ svn co http://neuroimaging.scipy.org/svn/ni/data/trunk/fmri .nipy/tests/data """...
Extend error message regarding missing test data.
Extend error message regarding missing test data.
Python
bsd-3-clause
alexis-roche/register,bthirion/nipy,bthirion/nipy,nipy/nipy-labs,alexis-roche/nipy,bthirion/nipy,alexis-roche/register,alexis-roche/nireg,bthirion/nipy,arokem/nipy,alexis-roche/register,alexis-roche/niseg,alexis-roche/nipy,arokem/nipy,nipy/nipy-labs,alexis-roche/nipy,alexis-roche/nipy,alexis-roche/nireg,arokem/nipy,aro...
446400fa4e40ca7e47e48dd00209d80858094552
buffer/managers/profiles.py
buffer/managers/profiles.py
import json from buffer.models.profile import PATHS, Profile class Profiles(list): def __init__(self, api, *args, **kwargs): super(Profiles, self).__init__(*args, **kwargs) self.api = api def all(self): response = self.api.get(url=PATHS['GET_PROFILES'], parser=json.loads) for raw_profile in re...
import json from buffer.models.profile import PATHS, Profile class Profiles(list): ''' Manage profiles + all -> get all the profiles from buffer + filter -> wrapper for list filtering ''' def __init__(self, api, *args, **kwargs): super(Profiles, self).__init__(*args, **kwargs) sel...
Write documentation for profile mananger
Write documentation for profile mananger
Python
mit
bufferapp/buffer-python,vtemian/buffpy
1c7bbeabe1c1f3eea053c8fd8b6649ba388c1d2e
waliki/slides/views.py
waliki/slides/views.py
from os import path import shutil import tempfile from sh import hovercraft from django.shortcuts import get_object_or_404 from django.http import HttpResponse from waliki.models import Page def slides(request, slug): page = get_object_or_404(Page, slug=slug) outpath = tempfile.mkdtemp() try: infi...
from os import path import shutil import tempfile from sh import hovercraft from django.shortcuts import get_object_or_404 from django.http import HttpResponse from waliki.models import Page from waliki.acl import permission_required @permission_required('view_page') def slides(request, slug): page = get_object_o...
Add permission check to slide urls.
Add permission check to slide urls.
Python
bsd-3-clause
RobertoMaurizzi/waliki,aszepieniec/waliki,aszepieniec/waliki,OlegGirko/waliki,RobertoMaurizzi/waliki,rizotas/waliki,beres/waliki,beres/waliki,santiavenda2/waliki,mgaitan/waliki,fpytloun/waliki,OlegGirko/waliki,OlegGirko/waliki,santiavenda2/waliki,santiavenda2/waliki,beres/waliki,mgaitan/waliki,RobertoMaurizzi/waliki,as...
ceac9c401f80a279e7291e7ba2a9e06757d4dd1d
buildtools/wrapper/cmake.py
buildtools/wrapper/cmake.py
import os from buildtools.bt_logging import log from buildtools.os_utils import cmd, ENV class CMake(object): def __init__(self): self.flags = {} self.generator = None def setFlag(self, key, val): log.info('CMake: {} = {}'.format(key, val)) self.flags[key] = val ...
import os from buildtools.bt_logging import log from buildtools.os_utils import cmd, ENV class CMake(object): def __init__(self): self.flags = {} self.generator = None def setFlag(self, key, val): log.info('CMake: {} = {}'.format(key, val)) self.flags[key] = val ...
Fix mismatched args in CMake.build
Fix mismatched args in CMake.build
Python
mit
N3X15/python-build-tools,N3X15/python-build-tools,N3X15/python-build-tools
1b0428aaf77f1c6eadfb6b20611a2e2e6f30fbce
poller.py
poller.py
#!/usr/bin/env python import urllib2 import ssl def poll(sites, timeout): for site in sites: print 'polling ' + site try: response = urllib2.urlopen(site, timeout=timeout) response.read() except urllib2.URLError as e: print e.code except ssl.SSL...
#!/usr/bin/env python import urllib2 import ssl try: import gntp.notifier as notify except ImportError: notify = None def poll(sites, timeout, ok, error): for site in sites: ok('polling ' + site) try: response = urllib2.urlopen(site, timeout=timeout) response.read(...
Add initial support for growl
Add initial support for growl If growl lib isn't available, prints to console instead.
Python
mit
koodilehto/website-poller,koodilehto/website-poller
90012f9fb9a256e6086a0b421661fd74cd8ef880
sedlex/AddCocoricoVoteVisitor.py
sedlex/AddCocoricoVoteVisitor.py
# -*- coding: utf-8 -*- from AbstractVisitor import AbstractVisitor from duralex.alinea_parser import * import requests class AddCocoricoVoteVisitor(AbstractVisitor): def __init__(self, args): self.url = 'https://local.cocorico.cc' r = requests.post( self.url + '/api/oauth/token', ...
# -*- coding: utf-8 -*- from AbstractVisitor import AbstractVisitor from duralex.alinea_parser import * import requests class AddCocoricoVoteVisitor(AbstractVisitor): def __init__(self, args): self.url = args.cocorico_url if not self.url: self.url = 'https://cocorico.cc' r =...
Handle the --cocorico-url command line option.
Handle the --cocorico-url command line option.
Python
agpl-3.0
Legilibre/SedLex
4c5cf98be65ee2564062cce2a43b7833eef1a6c9
AFQ/utils/volume.py
AFQ/utils/volume.py
import scipy.ndimage as ndim from skimage.filters import gaussian def patch_up_roi(roi, sigma=0.5, truncate=2): """ After being non-linearly transformed, ROIs tend to have holes in them. We perform a couple of computational geometry operations on the ROI to fix that up. Parameters ---------- ...
import scipy.ndimage as ndim from skimage.filters import gaussian from skimage.morphology import convex_hull_image def patch_up_roi(roi, sigma=0.5, truncate=2): """ After being non-linearly transformed, ROIs tend to have holes in them. We perform a couple of computational geometry operations on the ROI to ...
Add a convex hull operation to really close this up.
Add a convex hull operation to really close this up.
Python
bsd-2-clause
yeatmanlab/pyAFQ,arokem/pyAFQ,arokem/pyAFQ,yeatmanlab/pyAFQ
788229f43eab992d6f4d79681604336e4d721b0c
gameserver/api/endpoints/players.py
gameserver/api/endpoints/players.py
import logging from flask import request from flask_restplus import Resource from gameserver.game import Game from gameserver.models import Player from gameserver.api.restplus import api from gameserver.api.serializers import player_get, player_post from gameserver.database import db db_session = db.session log =...
import logging from flask import request from flask_restplus import Resource from gameserver.game import Game from gameserver.models import Player from gameserver.api.restplus import api from gameserver.api.serializers import player_get, player_post from gameserver.database import db db_session = db.session log =...
Return json, not just a string id
Return json, not just a string id
Python
apache-2.0
hammertoe/didactic-spork,hammertoe/didactic-spork,hammertoe/didactic-spork,hammertoe/didactic-spork
0dc84650b2929d31c054882ad67570fda6f1ffb9
incuna_test_utils/testcases/urls.py
incuna_test_utils/testcases/urls.py
from django.core.urlresolvers import resolve, reverse from django.test import TestCase class URLsTestCase(TestCase): """A TestCase with a check_url helper method for testing urls""" def check_url(self, view_class, url, url_name, url_args=None, url_kwargs=None): """ Assert a view's url is corr...
from django.core.urlresolvers import resolve, reverse from django.test import TestCase class URLsMixin(object): """A TestCase Mixin with a check_url helper method for testing urls""" def check_url(self, view_class, expected_url, url_name, url_args=None, url_kwargs=None): """ ...
Rename url -> expected_url; Add URLsMixin
Rename url -> expected_url; Add URLsMixin
Python
bsd-2-clause
incuna/incuna-test-utils,incuna/incuna-test-utils
a0348f21ce7abb577b93913c6f1c805cc6ccc75f
knowit2019/13.py
knowit2019/13.py
import json def navigate_maze_struct(strategy, f='input/MAZE.txt'): rooms = json.load(open(f)) for row in rooms: for room in row: room['visited'] = False queue = [(0, 0)] while queue: y, x = queue.pop() room = rooms[y][x] if room['visited']: ...
import json def navigate_maze_struct(strategy, f='input/MAZE.txt'): rooms = json.load(open(f)) for row in rooms: for room in row: room['visited'] = False queue = [(0, 0)] while queue: y, x = queue.pop() room = rooms[y][x] if room['visited']: ...
Update strategy (was wrong way around before)
Update strategy (was wrong way around before)
Python
mit
matslindh/codingchallenges,matslindh/codingchallenges
a6a95afca2964756a7777ea43839da1709187a27
planetstack/openstack_observer/backend.py
planetstack/openstack_observer/backend.py
import threading import time from observer.event_loop import PlanetStackObserver from observer.event_manager import EventListener from util.logger import Logger, logging logger = Logger(level=logging.INFO) class Backend: def run(self): try: # start the openstack observer obser...
import threading import time from observer.event_loop import PlanetStackObserver from observer.event_manager import EventListener from util.logger import Logger, logging logger = Logger(level=logging.INFO) class Backend: def run(self): # start the openstack observer observer = PlanetS...
Drop try/catch that causes uncaught errors in the Observer to be silently ignored
Drop try/catch that causes uncaught errors in the Observer to be silently ignored
Python
apache-2.0
opencord/xos,opencord/xos,zdw/xos,open-cloud/xos,cboling/xos,zdw/xos,cboling/xos,opencord/xos,open-cloud/xos,zdw/xos,cboling/xos,cboling/xos,cboling/xos,open-cloud/xos,zdw/xos
131a6d6a60b975b45cd551c1b52c059c857cf1e5
user/views.py
user/views.py
# -*- coding: utf-8 -*- from django.contrib.auth.decorators import login_required from django.shortcuts import render_to_response from django.template import RequestContext from django.contrib.auth.models import User from cronos.announcements.models import Id if request.user.email[-21:] == 'notapplicablemail.com': ...
# -*- coding: utf-8 -*- from django.contrib.auth.decorators import login_required from django.shortcuts import render_to_response from django.template import RequestContext from django.contrib.auth.models import User from cronos.announcements.models import Id def getmail(request): if request.user.email[-21:] == 'not...
Create functions getmail and getschool so they can be used in both sites user and settings
Create functions getmail and getschool so they can be used in both sites user and settings
Python
agpl-3.0
LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr
283ba7e4a08aeac07b030700b58e672f3f54ed12
utils/migrate.py
utils/migrate.py
import settings import os import yoyo import yoyo.connections def path(): return os.path.join(os.path.dirname(__file__), 'migrations') if __name__ == '__main__': conn, paramstyle = yoyo.connections.connect(settings.DATABASE_PATH) migrations = yoyo.read_migrations(conn, paramstyle, path()) migrations...
import os import psycopg2 import yoyo import yoyo.connections import settings def path(): return os.path.join(os.path.dirname(__file__), '..', 'migrations') def run_migrations(dbconn=None, names=[]): if dbconn is None: dbconn, paramstyle = yoyo.connections.connect(settings.DATABASE_PATH) else: ...
Make migrations runnable from external modules
Make migrations runnable from external modules These will be used in tests to setup the database.
Python
mit
Storj/accounts
6520fde5be81eb3d1a91662edeef8bd2a1f6389c
stonemason/service/tileserver/helper.py
stonemason/service/tileserver/helper.py
# -*- encoding: utf-8 -*- __author__ = 'ray' __date__ = '4/4/15' from stonemason.mason import Portrayal from stonemason.mason.theme import Theme def jsonify_portrayal(portrayal): assert isinstance(portrayal, Portrayal) template = { 'name': portrayal.name, 'metadata': { 'version':...
# -*- encoding: utf-8 -*- __author__ = 'ray' __date__ = '4/4/15' from stonemason.mason import Portrayal from stonemason.mason.theme import Theme def jsonify_portrayal(portrayal): assert isinstance(portrayal, Portrayal) template = { 'name': portrayal.name, 'metadata': { 'title': p...
Add metadata title in portrayal view
FEATURE: Add metadata title in portrayal view
Python
mit
Kotaimen/stonemason,Kotaimen/stonemason
d0c775dd7f7964db608dd56d1899aa4e3697cd1e
life/__main__.py
life/__main__.py
import pyglet from life import WIDTH, HEIGHT, CELL_SIZE, DISPLAY_FPS, FULLSCREEN from life.creator import Creator from life.view import Field creator = Creator(width=WIDTH, height=HEIGHT) if FULLSCREEN: window = pyglet.window.Window(fullscreen=True) cell_size = min(window.width // WIDTH, window.height // HE...
import pyglet from life import WIDTH, HEIGHT, CELL_SIZE, DISPLAY_FPS, FULLSCREEN from life.creator import Creator from life.view import Field creator = Creator(width=WIDTH, height=HEIGHT) if FULLSCREEN: window = pyglet.window.Window(fullscreen=True) cell_size = min(window.width // WIDTH, window.height // HE...
Use correct FPS display implementation.
Use correct FPS display implementation.
Python
bsd-2-clause
lig/life
69d22e9e7ff574d4f510269e589dafa45132047f
stdnum/br/__init__.py
stdnum/br/__init__.py
# __init__.py - collection of Brazilian numbers # coding: utf-8 # # Copyright (C) 2012 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License...
# __init__.py - collection of Brazilian numbers # coding: utf-8 # # Copyright (C) 2012 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License...
Add missing vat alias for Brazil
Add missing vat alias for Brazil
Python
lgpl-2.1
arthurdejong/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum
ba499556cf3a1f09c55ba2631c1dbb988e95fb82
web/test/test_web.py
web/test/test_web.py
def test_web(app): client = app.test_client() response = client.post( '/user/sign-in?next=/', follow_redirects=True, data=dict( username='test@test.com', password='Password1' ) ) response = client.get('/') assert response.status_code == 200 ...
def login(client): response = client.post( '/user/sign-in?next=/', follow_redirects=True, data=dict( username='test@test.com', password='Password1' ) ) return response def test_navigating_to_startpage(app): client = app.test_client() login(cli...
Refactor test to be more clear
Refactor test to be more clear
Python
apache-2.0
vinntreus/training_stats,vinntreus/training_stats
d8168185aa0153fac55e3c59761a5e561a5b0137
src/ocspdash/__init__.py
src/ocspdash/__init__.py
"""A dashboard for the status of the top certificate authorities' OCSP responders.""" # metadata __version__ = '0.1.0-dev' __title__ = 'OCSPdash' # keep the __description__ synchronized with the package docstring __description__ = "A dashboard for the status of the top certificate authorities' OCSP responders." __url_...
"""A dashboard for the status of the top certificate authorities' OCSP responders.""" # metadata __version__ = '0.1.0-dev' __title__ = 'OCSPdash' # keep the __description__ synchronized with the package docstring __description__ = "A dashboard for the status of the top certificate authorities' OCSP responders." __url_...
Add @cthoyt to package __copyright__
Add @cthoyt to package __copyright__
Python
mit
scolby33/OCSPdash,scolby33/OCSPdash,scolby33/OCSPdash
00d835c3b4512b407033af280600d9428a155b22
noah/noah.py
noah/noah.py
import json import random import pprint class Noah(object): def __init__(self, dictionary_file): self.dictionary = json.load(dictionary_file) def list(self): return '\n'.join([entry['word'] for entry in self.dictionary]) def define(self, word): return self.output(filter(lambda x: ...
import json import random import pprint class Noah(object): def __init__(self, dictionary_file): self.dictionary = json.load(dictionary_file) def list(self): return '\n'.join([entry['word'] for entry in self.dictionary]) def define(self, word): return self.output(filter(lambda x: ...
Remove unneeded block in define.
Remove unneeded block in define.
Python
mit
maxdeviant/noah
4bcf7f83351bc64ed47c5531cb66ccb20f762dd0
pyMKL/__init__.py
pyMKL/__init__.py
from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function from __future__ import division from future import standard_library standard_library.install_aliases() import numpy as np import scipy.sparse as sp from ctypes import CDLL, cdll, RTLD_GLOBAL from ctypes...
from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function from __future__ import division from future import standard_library standard_library.install_aliases() import platform import numpy as np import scipy.sparse as sp from ctypes import CDLL, cdll, RTLD_GL...
Add experimental support for other OS versions.
Add experimental support for other OS versions.
Python
mit
dwfmarchant/pyMKL
6f1dc606b4c4f2702e0a5b48338488ac2eec197c
scripts/utils.py
scripts/utils.py
#!/usr/bin/env python3 # Touhou Community Reliant Automatic Patcher # Scripts # # ---- # """Utility functions shared among all the scripts.""" from collections import OrderedDict import json import os json_load_params = { 'object_pairs_hook': OrderedDict } def patch_files_filter(files): """Filters all file ...
#!/usr/bin/env python3 # Touhou Community Reliant Automatic Patcher # Scripts # # ---- # """Utility functions shared among all the scripts.""" from collections import OrderedDict import json import os json_load_params = { 'object_pairs_hook': OrderedDict } def patch_files_filter(files): """Filters all file ...
Enforce Unix newlines when writing JSON files.
scripts: Enforce Unix newlines when writing JSON files.
Python
unlicense
VBChunguk/thcrap,thpatch/thcrap,thpatch/thcrap,thpatch/thcrap,VBChunguk/thcrap,VBChunguk/thcrap,thpatch/thcrap,thpatch/thcrap
89929acbb2ee3c5617758966d8916139726d7b74
app/state.py
app/state.py
import multiprocessing import unicornhathd as unicornhat import importlib import sys import os import app.programs.hd class State: ''' Handles the Unicorn HAT state''' def __init__(self): self._process = None def start_program(self, name, params={}): try: program = getattr(a...
import multiprocessing import unicornhathd as unicornhat import importlib import sys import os import app.programs.hd class State: ''' Handles the Unicorn HAT state''' def __init__(self): self._process = None def start_program(self, name, params={}): try: program = getattr(a...
Fix setting rotation to 0
Fix setting rotation to 0
Python
mit
njbbaer/unicorn-remote,njbbaer/unicorn-remote,njbbaer/unicorn-remote
013ed651c3e8e7cfa4b8babefc2664644b928852
pybtex/bibtex/exceptions.py
pybtex/bibtex/exceptions.py
# Copyright (C) 2006, 2007, 2008 Andrey Golovizin # # This file is part of pybtex. # # pybtex is free software; you can redistribute it and/or modify # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later vers...
# Copyright (C) 2006, 2007, 2008 Andrey Golovizin # # This file is part of pybtex. # # pybtex is free software; you can redistribute it and/or modify # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later vers...
Make BibTeXError a subclass of PybtexError.
Make BibTeXError a subclass of PybtexError.
Python
mit
andreas-h/pybtex,chbrown/pybtex,andreas-h/pybtex,chbrown/pybtex
e75e6ec300e1127f7010d36ef63343e522318f90
sunpy/instr/iris/iris.py
sunpy/instr/iris/iris.py
""" Some very beta tools for IRIS """ import sunpy.io import sunpy.time import sunpy.map __all__ = ['SJI_to_cube'] def SJI_to_cube(filename, start=0, stop=None): """ Read a SJI file and return a MapCube ..warning:: This function is a very early beta and is not stable. Further work is ...
""" Some very beta tools for IRIS """ import sunpy.io import sunpy.time import sunpy.map __all__ = ['SJI_to_cube'] def SJI_to_cube(filename, start=0, stop=None, hdu=0): """ Read a SJI file and return a MapCube ..warning:: This function is a very early beta and is not stable. Further work is ...
Change hdu[0] to hdu for optional indexing
Change hdu[0] to hdu for optional indexing
Python
bsd-2-clause
Alex-Ian-Hamilton/sunpy,dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,Alex-Ian-Hamilton/sunpy
230bb0a09146cd0b696b528b3ad6dd9ccf057113
tests/test_checker.py
tests/test_checker.py
import pytest import os, stat from botbot import checker, problems def test_fastq_checker(): assert checker.is_fastq("bad.fastq") == problems.PROB_FILE_IS_FASTQ assert checker.is_fastq("good.py") == problems.PROB_NO_PROBLEM assert checker.is_fastq("fastq.actually_ok_too") == problems.PROB_NO_PROBLEM def ...
import pytest import os, stat from botbot import checker, problems def test_fastq_checker_path_names(): assert checker.is_fastq("bad.fastq") == problems.PROB_FILE_IS_FASTQ assert checker.is_fastq("good.py") == problems.PROB_NO_PROBLEM assert checker.is_fastq("fastq.actually_ok_too") == problems.PROB_NO_PR...
Add test for symlink detection
Add test for symlink detection
Python
mit
jackstanek/BotBot,jackstanek/BotBot
faed82947209b34ccb4063e8244a9da019fa52a2
bills/urls.py
bills/urls.py
from . import views from django.conf.urls import url urlpatterns = [ url(r'^by_topic/', views.bill_list_by_topic), url(r'^by_location', views.bill_list_by_location), url(r'^latest_activity/', views.latest_bill_activity), url(r'^latest/', views.latest_bill_actions), url(r'^detail/(?P<bill_session>(...
from . import views from django.conf.urls import url urlpatterns = [ url(r'^by_topic/', views.bill_list_by_topic), url(r'^by_location', views.bill_list_by_location), url(r'^current_session/', views.bill_list_current_session), url(r'^latest_activity/', views.bill_list_latest), url(r'^detail/(?P<bil...
Update bills added by current session
Update bills added by current session
Python
mit
jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot
b631dadb54f90e4abb251f7680f883f2e3e0e914
radar/radar/validation/patient_numbers.py
radar/radar/validation/patient_numbers.py
from radar.groups import is_radar_group from radar.validation.core import Validation, pass_call, ValidationError, Field from radar.validation.sources import RadarSourceValidationMixin from radar.validation.meta import MetaValidationMixin from radar.validation.patients import PatientValidationMixin from radar.validation...
from radar.groups import is_radar_group, get_radar_group from radar.validation.core import Validation, pass_call, ValidationError, Field from radar.validation.sources import RadarSourceValidationMixin from radar.validation.meta import MetaValidationMixin from radar.validation.patients import PatientValidationMixin from...
Check for duplicate patient numbers
Check for duplicate patient numbers Fixes #286
Python
agpl-3.0
renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar
6a01e99585db3ea38a8d8325dd4f826e78fc0f1d
test_project/settings.py
test_project/settings.py
import os import sys PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(PROJECT_ROOT, '..')) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', } } INSTALLED_APPS = ( 'djcelery_email', 'appconf', 'tester', ) SECRET_KEY = 'unique sno...
import os import sys PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(PROJECT_ROOT, '..')) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', } } INSTALLED_APPS = ( 'djcelery_email', 'appconf', 'tester', ) SECRET_KEY = 'unique sno...
Set MIDDLEWARE_CLASSES to stop Django 1.7 warnings.
Set MIDDLEWARE_CLASSES to stop Django 1.7 warnings.
Python
bsd-3-clause
pmclanahan/django-celery-email,pmclanahan/django-celery-email
f59b249cf2b149f96833d9e1025a98819bf5f62a
sharepa/search.py
sharepa/search.py
import json import requests from elasticsearch_dsl import Search from elasticsearch_dsl.result import Response class ShareSearch(Search): BASE_URL = 'https://osf.io/api/v1/share/search/' HEADERS = {'content-type': 'application/json'} PARAMS = dict(raw=True) def execute(self): return Response...
import json import requests from elasticsearch_dsl import Search from elasticsearch_dsl.result import Response class ShareSearch(Search): BASE_URL = 'http://localhost:8000/api/search/abstractcreativework/_search' HEADERS = {'content-type': 'application/json'} PARAMS = dict(raw=True) def execute(self...
Fix count param, use local es for now
Fix count param, use local es for now
Python
mit
CenterForOpenScience/sharepa,fabianvf/sharepa
7e883fcfc539f18cd29c2babaf083583495f46d3
migrations/versions/1f9c61031fa_.py
migrations/versions/1f9c61031fa_.py
"""empty message Revision ID: 1f9c61031fa Revises: 1f872d11bbf Create Date: 2016-01-24 17:46:54.879784 """ # revision identifiers, used by Alembic. revision = '1f9c61031fa' down_revision = '1f872d11bbf' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - plea...
"""empty message Revision ID: 1f9c61031fa Revises: 1f872d11bbf Create Date: 2016-01-24 17:46:54.879784 """ # revision identifiers, used by Alembic. revision = '1f9c61031fa' down_revision = '1f872d11bbf' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - plea...
Fix NOT NULL constraint on Setting name not being removed
Fix NOT NULL constraint on Setting name not being removed
Python
mit
Encrylize/flask-blogger,Encrylize/flask-blogger,Encrylize/flask-blogger
26c1daab6095c6110995104b94ad5b6260557c70
aiortp/sdp.py
aiortp/sdp.py
class SDP: def __init__(self, local_addr, ptime): self.local_addr = local_addr self.ptime = ptime local_addr_desc = f'IN IP4 {self.local_addr[0]}' self.payload = '\r\n'.join([ 'v=0', f'o=user1 53655765 2353687637 {local_addr_desc}', 's=-', ...
class SDP: def __init__(self, local_addr, ptime): self.local_addr = local_addr self.ptime = ptime local_addr_desc = 'IN IP4 {}'.format(self.local_addr[0]) self.payload = '\r\n'.join([ 'v=0', 'o=user1 53655765 2353687637 {local_addr_desc}', 's=-', ...
Remove python 3.6 only format strings
Remove python 3.6 only format strings
Python
apache-2.0
vodik/aiortp
e2ee9045c59e3f03c5342ee41d23e4adece43535
weather/admin.py
weather/admin.py
from django.contrib.admin import ModelAdmin, register from django.contrib.gis.admin import GeoModelAdmin from weather.models import WeatherStation, Location @register(Location) class LocationAdmin(GeoModelAdmin): pass @register(WeatherStation) class WeatherStationAdmin(ModelAdmin): list_display = ( ...
from django.contrib.admin import ModelAdmin, register from django.contrib.gis.admin import GeoModelAdmin from weather.models import WeatherStation, Location @register(Location) class LocationAdmin(GeoModelAdmin): openlayers_url = '//static.dpaw.wa.gov.au/static/libs/openlayers/2.13.1/OpenLayers.js' @register(We...
Define URL for OpenLayers.js to DPaW CDN.
Define URL for OpenLayers.js to DPaW CDN.
Python
bsd-3-clause
parksandwildlife/resource_tracking,parksandwildlife/resource_tracking,ropable/resource_tracking,ropable/resource_tracking,ropable/resource_tracking,parksandwildlife/resource_tracking
a6bd1cfc5f87d6f9a7ac846665fcab5b02c33c1d
tubular/scripts/hipchat/submit_hipchat_msg.py
tubular/scripts/hipchat/submit_hipchat_msg.py
import os import sys import requests import click HIPCHAT_API_URL = "http://api.hipchat.com" NOTIFICATION_POST = "/v2/room/{}/notification" AUTH_HEADER = "Authorization: Bearer {}" @click.command() @click.option('--auth_token_env_var', '-a', help="Environment variable containing authentication token t...
import os import sys import requests import click HIPCHAT_API_URL = "http://api.hipchat.com" NOTIFICATION_POST = "/v2/room/{}/notification" AUTH_HEADER = "Authorization: Bearer {}" @click.command() @click.option('--auth_token_env_var', '-a', help="Environment variable containing authentication token t...
Add ability to set HipChat message contents.
Add ability to set HipChat message contents.
Python
agpl-3.0
eltoncarr/tubular,eltoncarr/tubular
283f4d0dc1896b35e1c6be3458a99c87b9296659
amaascore/asset_managers/enums.py
amaascore/asset_managers/enums.py
from __future__ import absolute_import, division, print_function, unicode_literals ASSET_MANAGER_TYPES = {'Accredited Investor', 'Bank', 'Broker', 'Corporate Treasury', 'Family Office', 'Fund Administrator', 'Fund Manager', 'Hedge Fund', 'Private Equity', 'Retail', 'Ventu...
from __future__ import absolute_import, division, print_function, unicode_literals ASSET_MANAGER_TYPES = {'Accredited Investor', 'Bank', 'Broker', 'Corporate Treasury', 'Family Office', 'Fund Administrator', 'Fund Manager', 'Hedge Fund', 'Individual', 'Private Equity', 'V...
Migrate “Retail” to “Individual” for clarity. AMAAS-764.
Migrate “Retail” to “Individual” for clarity. AMAAS-764.
Python
apache-2.0
paul-rs/amaas-core-sdk-python,amaas-fintech/amaas-core-sdk-python,nedlowe/amaas-core-sdk-python,nedlowe/amaas-core-sdk-python,amaas-fintech/amaas-core-sdk-python,paul-rs/amaas-core-sdk-python
b17104be53389604b4b7f5f109895bdaa6389e43
hic/flow.py
hic/flow.py
# -*- coding: utf-8 -*- from __future__ import division import numpy as np import numexpr as ne __all__ = 'qn', 'FlowCumulant' def qn(n, phi): return ne.evaluate('sum(exp(1j*n*phi))') class FlowCumulant(object): def __init__(self, multiplicities, qn): self.multiplicities = np.asarray(multipliciti...
# -*- coding: utf-8 -*- from __future__ import division import numpy as np import numexpr as ne __all__ = 'qn', 'FlowCumulant' # If a variable is only ever used by numexpr, flake8 will flag it as unused. # The comment 'noqa' prevents this warning. def qn(n, phi): return ne.evaluate('sum(exp(1j*n*phi))') cl...
Add note about flake8 ignore flag.
Add note about flake8 ignore flag.
Python
mit
jbernhard/hic,Duke-QCD/hic
bbd3190b31a3751d9173b81d6f53c937208969a7
tests/main_test.py
tests/main_test.py
#!/usr/bin/env python3 from libpals.util import xor_find_singlechar_key, hamming_distance, fixed_xor def test_xor_find_singlechar_key(): input = '1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736' ciphertext = bytes.fromhex(input) result = xor_find_singlechar_key(ciphertext) assert ...
#!/usr/bin/env python3 from libpals.util import ( xor_find_singlechar_key, hamming_distance, fixed_xor ) def test_xor_find_singlechar_key(): input = '1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736' ciphertext = bytes.fromhex(input) result = xor_find_singlechar_key(ciphert...
Change to multi-line imports in the test suite
Change to multi-line imports in the test suite
Python
bsd-2-clause
cpach/cryptopals-python3
e44eb0bd99b4dec1b78707c7343fc6d9b647c7bb
scripts/write_antenna_location_file.py
scripts/write_antenna_location_file.py
#! /usr/bin/env python # -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD license. """ Script to write out antenna locations for use in cal files. """ import pandas as pd from hera_mc import mc, geo_handling import datetime parser = mc.get_mc_argument_parse...
#! /usr/bin/env python # -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD license. """ Script to write out antenna locations for use in cal files. """ import pandas as pd from hera_mc import mc, geo_handling import datetime parser = mc.get_mc_argument_parse...
Add cofa information to antenna location files
Add cofa information to antenna location files
Python
bsd-2-clause
HERA-Team/hera_mc,HERA-Team/Monitor_and_Control,HERA-Team/hera_mc
e3cba925ea106baa99951ac7b3ee72599ee7277d
demos/fs-demo/main.py
demos/fs-demo/main.py
import random import os from microbit import * if 'messages.txt' in os.listdir(): with open('messages.txt') as message_file: messages = message_file.read().split('\n') while True: if button_a.was_pressed(): display.scroll(random.choice(messages))
import random import os import speech from microbit import * if 'messages.txt' in os.listdir(): with open('messages.txt') as message_file: messages = message_file.read().split('\n') while True: if button_a.was_pressed(): speech.say(random.choice(messages))
Change output in fs-demo to voice.
Change output in fs-demo to voice.
Python
mit
mathisgerdes/microbit-macau
4545d11c2462ccb6d7848d185f5fe358a51af5f6
Trimmer.py
Trimmer.py
import sublime import sublime_plugin class TrimmerCommand(sublime_plugin.TextCommand): def run(self, edit): view = self.view trailing_white_space = view.find_all("[\t ]+$") trailing_white_space.reverse() edit = view.begin_edit() for r in trailing_white_space: ...
import sublime import sublime_plugin class TrimmerCommand(sublime_plugin.TextCommand): def run(self, edit): view = self.view trailing_white_space = view.find_all("[\t ]+$") trailing_white_space.reverse() for r in trailing_white_space: view.erase(edit, r) subl...
Remove calls to begin, end edit object.
Remove calls to begin, end edit object.
Python
mit
jonlabelle/Trimmer,jonlabelle/Trimmer
ca6891f3b867fd691c0b682566ffec1fd7f0ac2a
pryvate/blueprints/simple/simple.py
pryvate/blueprints/simple/simple.py
"""Simple blueprint.""" import os from flask import Blueprint, current_app, make_response, render_template blueprint = Blueprint('simple', __name__, url_prefix='/simple', template_folder='templates') @blueprint.route('', methods=['POST']) def search_simple(): """Handling pip search.""" re...
"""Simple blueprint.""" import os from flask import Blueprint, current_app, make_response, render_template blueprint = Blueprint('simple', __name__, url_prefix='/simple', template_folder='templates') @blueprint.route('', methods=['POST']) def search_simple(): """Handling pip search.""" re...
Return 404 if package was not found instead of raising an exception
Return 404 if package was not found instead of raising an exception
Python
mit
Dinoshauer/pryvate,Dinoshauer/pryvate
52e675ec6789d8ecaddae98a6b36bc8b0c3f6e1e
socketio/sdjango.py
socketio/sdjango.py
import logging from socketio import socketio_manage from django.conf.urls import patterns, url, include from django.http import HttpResponse SOCKETIO_NS = {} class namespace(object): def __init__(self, name=''): self.name = name def __call__(self, handler): SOCKETIO_NS[self.name] = handler ...
import logging from socketio import socketio_manage from django.conf.urls import patterns, url, include from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt SOCKETIO_NS = {} class namespace(object): def __init__(self, name=''): self.name = name def __call__(self...
Remove django CSRF protection for socket.io view
Remove django CSRF protection for socket.io view
Python
bsd-3-clause
abourget/gevent-socketio,yacneyac/gevent-socketio,kazmiruk/gevent-socketio,kazmiruk/gevent-socketio,yacneyac/gevent-socketio,arnuschky/gevent-socketio,gutomaia/gevent-socketio,smurfix/gevent-socketio,arnuschky/gevent-socketio,hzruandd/gevent-socketio,theskumar-archive/gevent-socketio,abourget/gevent-socketio,gutomaia/g...
8ff8b9400adf24e082908befed7788099b01f328
bench/pact-suite/scripts/opcount_merge.py
bench/pact-suite/scripts/opcount_merge.py
#!/usr/bin/env python2.7 import sys files = sys.argv[1:] keys = set() fileVals = [] for file in files: vals = {} fileVals.append(vals) try: for line in open(file).readlines(): k, v = line.split() vals[k] = v keys.add(k) except Exception, e: print "Error in line \"%s\" of file %s" % (...
#!/usr/bin/env python2.7 import sys files = sys.argv[1:] keys = set() fileVals = [] for file in files: vals = {} fileVals.append(vals) try: for line in open(file).readlines(): toks = line.split() if len(toks) != 2: print >> sys.stderr, "Bad line: %s" % repr(toks) else: k, v...
Add initial data for operations counts
Add initial data for operations counts git-svn-id: 0c5512015aa96f7d3f5c3ad598bd98edc52008b1@12204 dc4e9af1-7f46-4ead-bba6-71afc04862de
Python
apache-2.0
basheersubei/swift-t,blue42u/swift-t,swift-lang/swift-t,JohnPJenkins/swift-t,swift-lang/swift-t,blue42u/swift-t,swift-lang/swift-t,swift-lang/swift-t,JohnPJenkins/swift-t,basheersubei/swift-t,JohnPJenkins/swift-t,JohnPJenkins/swift-t,JohnPJenkins/swift-t,basheersubei/swift-t,basheersubei/swift-t,basheersubei/swift-t,Jo...
24e780dd0f30e4bf9696a6fd185d20fb297f0bd0
rsk_mind/transformer/transformer.py
rsk_mind/transformer/transformer.py
class Transformer(object): class Feats(): exclude = None def __init__(self): for field in self.get_feats(): getattr(self.Feats, field).bind(field, self) def get_feats(self): return [x for x in dir(self.Feats) if not (x.startswith('__') or x in ['exclude'])] def get...
class Transformer(object): """ Base class for all transformer """ class Feats: """ Define feats on dataset """ exclude = None def __init__(self): for field in self.get_feats(): getattr(self.Feats, field).bind(field, self) def get_fea...
Add documentation and some methods
Add documentation and some methods
Python
mit
rsk-mind/rsk-mind-framework
a6ae4171de33dd77e9109523380c1330d4037f9f
gengine/app/tests/runner.py
gengine/app/tests/runner.py
from gengine.app.tests import db as db from gengine.metadata import init_declarative_base, init_session import unittest import os import pkgutil import testing.redis import logging log = logging.getLogger(__name__) init_session() init_declarative_base() __path__ = [x[0] for x in os.walk(os.path.dirname(__file__))] ...
from gengine.app.tests import db as db from gengine.metadata import init_declarative_base, init_session import unittest import os import pkgutil import testing.redis import logging import sys log = logging.getLogger(__name__) init_session() init_declarative_base() __path__ = [x[0] for x in os.walk(os.path.dirname(__...
Add missing import for sys
Add missing import for sys
Python
mit
ActiDoo/gamification-engine,ActiDoo/gamification-engine,ActiDoo/gamification-engine,ActiDoo/gamification-engine
2ebb667b38b3d74003948347f411f177ca584834
boardinghouse/contrib/template/models.py
boardinghouse/contrib/template/models.py
from django.db import models from django.utils import six from boardinghouse.base import SharedSchemaMixin from boardinghouse.schema import activate_schema, deactivate_schema @six.python_2_unicode_compatible class SchemaTemplate(SharedSchemaMixin, models.Model): """ A ``boardinghouse.contrib.template.models....
from django.db import models from django.utils import six from django.utils.functional import lazy from boardinghouse.base import SharedSchemaMixin from boardinghouse.schema import activate_schema, deactivate_schema, get_schema_model def verbose_name_plural(): return u'template {}'.format(get_schema_model()._met...
Use 'template ...' for the SchemaTemplate verbose_name*
Use 'template ...' for the SchemaTemplate verbose_name*
Python
bsd-3-clause
schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse
0ea4abe8b2e44bdd02308ad590ffb1e846201300
terms/sitemaps.py
terms/sitemaps.py
from django.contrib.sitemaps import Sitemap from .models import Term class TermsSitemap(Sitemap): changefreq = 'yearly' priority = 0.1 def items(self): return Term.objects.all()
from django.contrib.sitemaps import Sitemap from django.db.models import Q from .models import Term class TermsSitemap(Sitemap): changefreq = 'yearly' priority = 0.1 def items(self): return Term.objects.filter(Q(url__startswith='/') | Q(url=''))
Exclude external urls from the sitemap.
Exclude external urls from the sitemap.
Python
bsd-3-clause
philippeowagner/django-terms,BertrandBordage/django-terms,philippeowagner/django-terms,BertrandBordage/django-terms
ddf2075228a8c250cf75ec85914801262cb73177
zerver/migrations/0032_verify_all_medium_avatar_images.py
zerver/migrations/0032_verify_all_medium_avatar_images.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor from django.db.migrations.state import StateApps from zerver.lib.upload import upload_backend def verify_medium_avatar_image(apps, schema_ed...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.db import migrations from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor from django.db.migrations.state import StateApps from mock import patch from zerver.lib.utils import make_saf...
Make migration 0032 use an old version of user_avatar_path.
Make migration 0032 use an old version of user_avatar_path. This fixes upgrading from very old Zulip servers (e.g. 1.4.3) all the way to current. Fixes: #6516.
Python
apache-2.0
hackerkid/zulip,kou/zulip,amanharitsh123/zulip,brockwhittaker/zulip,showell/zulip,hackerkid/zulip,rishig/zulip,verma-varsha/zulip,synicalsyntax/zulip,zulip/zulip,amanharitsh123/zulip,showell/zulip,punchagan/zulip,amanharitsh123/zulip,punchagan/zulip,timabbott/zulip,rht/zulip,tommyip/zulip,eeshangarg/zulip,Galexrt/zulip...
674dfb000cca79998674cd0b490ae6f3f992b313
blazarclient/tests/__init__.py
blazarclient/tests/__init__.py
# Copyright (c) 2014 Mirantis. # # 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 (c) 2014 Mirantis. # # 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...
Use fixtures instead of deprecated mockpatch module
Use fixtures instead of deprecated mockpatch module The mockpatch module of oslotest is deprecated since version 1.13 and may be removed in version 2.0. Use fixtures.Mock* classes instead. Change-Id: I0ea834d41664efe84aa28ef2362467e2ad8b1928
Python
apache-2.0
openstack/python-blazarclient,ChameleonCloud/python-blazarclient,stackforge/python-blazarclient
191d73fb6d30b691da8d9c55bfd36f055aea19d5
backend/pokehelper.py
backend/pokehelper.py
import json import os class Pokehelper(object): def __init__(self): basepath = os.path.dirname(__file__) filepath = os.path.abspath(os.path.join(basepath, 'data/pokemon.json' )) with open(filepath) as pokejson: self.pokelist = json.load(pokejson) ### ### LIST STARTS AT 0, EVE...
import json import os emptymon = {'moves1': [], 'family': 1, 'name': 'not-in-database', 'moves2': [], 'type2': 'nil', 'id': -1, 'candy': -1, 'type1': 'nil', 'stats': {'stamina': -1, 'attack': -1, 'defense': -1}} class Pokehelper(object): def __init__(self): basepath = os.path.dirname(__file__) ...
Add fallback if pokemon_id > 151
Add fallback if pokemon_id > 151
Python
mit
Phaetec/pogo-cruncher,Phaetec/pogo-cruncher,Phaetec/pogo-cruncher
4b3e2289dbf20c0e2a7e0f83c7bd5963f2aa311f
longshot.py
longshot.py
HOME_URL = 'https://github.com/ftobia/longshot/blob/master/longshot.py' def upgrade(): backup_self() download_and_overwrite() restart() def backup_self(): import shutil new_name = __file__ + '.bak' shutil.copy(__file__, new_name) def download_and_overwrite(): import urllib2 respo...
HOME_URL = 'https://raw.githubusercontent.com/ftobia/longshot/develop/longshot.py' def upgrade(): backup_self() download_and_overwrite() restart() def backup_self(): import shutil new_name = __file__ + '.bak' shutil.copy(__file__, new_name) def download_and_overwrite(): import urllib...
Use the right download URL.
Use the right download URL.
Python
bsd-3-clause
ftobia/longshot
7574528d839dc627ea53032b547e0e1c23a51f6b
rdioexport/_client/__init__.py
rdioexport/_client/__init__.py
import json from ._base import get_base_rdio_client class _RdioExportClient(object): def __init__(self, base_client): self.base_client = base_client def get_current_user_key(self): return self.base_client.call('currentUser')['key'] def get_collection_by_album(self, batch_size=100): ...
import json from ._base import get_base_rdio_client class _RdioExportClient(object): def __init__(self, base_client): self.base_client = base_client def get_current_user_key(self): return self.base_client.call('currentUser')['key'] def get_collection_by_album(self, batch_size=100): ...
Remove unused field from request.
Remove unused field from request.
Python
isc
alexhanson/rdio-export
e5d78dcfca7afffda7126e4e71944f40cdd9c272
tests/__init__.py
tests/__init__.py
# # For the license of this file, please consult the LICENSE file in the # root directory of this distribution. # # All tests in the test suite. __all__ = ( "bitfield_tests", "zscii_tests" )
# # For the license of this file, please consult the LICENSE file in the # root directory of this distribution. # # All tests in the test suite. __all__ = ( "bitfield_tests", "zscii_tests", "lexer_tests", "glk_tests" )
Make run_tests run all tests if no arguments are provided.
Make run_tests run all tests if no arguments are provided.
Python
bsd-3-clause
sussman/zvm,sussman/zvm
65cd819b73c4a28b67a30b46b264b330d9967582
flicks/users/forms.py
flicks/users/forms.py
from django import forms from tower import ugettext_lazy as _lazy from flicks.base.util import country_choices from flicks.users.models import UserProfile class UserProfileForm(forms.ModelForm): # L10n: Used in a choice field where users can choose between receiving # L10n: HTML-based or Text-only newslette...
from django import forms from tower import ugettext_lazy as _lazy from flicks.base.util import country_choices from flicks.users.models import UserProfile class UserProfileForm(forms.ModelForm): # L10n: Used in a choice field where users can choose between receiving # L10n: HTML-based or Text-only newslette...
Make privacy checkbox on user form required via required attribute.
Make privacy checkbox on user form required via required attribute.
Python
bsd-3-clause
mozilla/firefox-flicks,mozilla/firefox-flicks,mozilla/firefox-flicks,mozilla/firefox-flicks
1e6ccfe615ee5d3e873e341a3d38553c3b07a3a0
athumb/validators.py
athumb/validators.py
from django.conf import settings from django.core.validators import ValidationError # A list of allowable thumbnail file extensions. ALLOWABLE_THUMBNAIL_EXTENSIONS = getattr( settings, 'ALLOWABLE_THUMBNAIL_EXTENSIONS', ['png', 'jpg', 'jpeg', 'gif']) class ImageUploadExtensionValidator(object): """ Perform...
from django.conf import settings from django.core.validators import ValidationError # A list of allowable thumbnail file extensions. ALLOWABLE_THUMBNAIL_EXTENSIONS = getattr( settings, 'ALLOWABLE_THUMBNAIL_EXTENSIONS', ['png', 'jpg', 'jpeg', 'gif']) class ImageUploadExtensionValidator(object): """ Perform...
Make ImageUploadExtensionValidator work with django 1.7 migrations
Make ImageUploadExtensionValidator work with django 1.7 migrations
Python
bsd-3-clause
ligonier/django-athumb
bb575cfdf4a6781c878a12f80987fb3e62fe56d4
chandl/model/posts.py
chandl/model/posts.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals class Posts(list): """ Represents a list of posts in a thread. """ def __init__(self, *args): """ Initialise a new posts list. :param args: The list of posts. """ super(Posts, self).__init__(*arg...
# -*- coding: utf-8 -*- from __future__ import unicode_literals class Posts(list): """ Represents a list of posts in a thread. """ def __init__(self, *args): """ Initialise a new posts list. :param args: The list of posts. """ super(Posts, self).__init__(*arg...
Make post filtering and mapping more pythonic
Make post filtering and mapping more pythonic
Python
mit
gebn/chandl,gebn/chandl
1fa7fed7d63fc7819ae5378f9a9addf7439e9b92
messages.py
messages.py
class Dispatched(object): def __init__(self, w=None, cb=None): self.w = w self.cb = cb self.retval = None self.output = None class DispatchInquiry(object): def __init__(self, msg=None, payload=None, resp=None): self.msg = msg self.resp = resp self.payload = payload
class Dispatched(object): def __init__(self, w=None, _id=None): self.w = w self.id = _id if _id != None else id(self) class DispatchedState(object): def __init__(self, retval=None, output=None, exc=None, _id=None): self.retval = retval self.output = output self.exc = exc self.id = _id if ...
Add DispatchedState, add target, add id
Add DispatchedState, add target, add id
Python
mit
joushou/dispatch,joushou/dispatch
074dcf9c822827c6609dc11c0047aa79dd8c1ad8
tests/test_cli.py
tests/test_cli.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `pyutrack` package.""" import unittest from click.testing import CliRunner from pyutrack import cli class TestYoutrack_cli(unittest.TestCase): def test_improt(self): import pyutrack def test_command_line_interface(self): runner =...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `pyutrack` package.""" import unittest from click.testing import CliRunner from pyutrack import cli from tests import PyutrackTest class TestYoutrack_cli(PyutrackTest): def test_improt(self): import pyutrack def test_command_line_interface(...
Set cli tests to base test class
Set cli tests to base test class
Python
mit
alisaifee/pyutrack,alisaifee/pyutrack
c9c0aace029dd07a96ceed4f14303d5f0eadee13
blackjax/__init__.py
blackjax/__init__.py
from .mcmc import hmc, nuts, rmh from .mcmc_adaptation import window_adaptation __version__ = "0.3.0" __all__ = [ "hmc", "nuts", "rmh", "window_adaptation", "adaptive_tempered_smc", "tempered_smc", "inference", "adaptation", "diagnostics", ]
from .diagnostics import effective_sample_size as ess from .diagnostics import potential_scale_reduction as rhat from .mcmc import hmc, nuts, rmh from .mcmc_adaptation import window_adaptation __version__ = "0.3.0" __all__ = [ "hmc", "nuts", "rmh", "window_adaptation", "adaptive_tempered_smc", ...
Add diagnostics to blackjax namespace
Add diagnostics to blackjax namespace
Python
apache-2.0
blackjax-devs/blackjax
d3992b1677a5186b8b4072c9fdf50e4cb44dc5ef
base_accounts/models.py
base_accounts/models.py
from django.db import models from django.contrib.auth.models import AbstractUser from django.utils.translation import ugettext_lazy as _ from django.template.defaultfilters import slugify class BaseUser(AbstractUser): slug = models.SlugField(_('slug'), max_length=255) name = models.CharField(_('name'), max_le...
from django.db import models from django.contrib.auth.models import AbstractUser from django.utils.translation import ugettext_lazy as _ from django.template.defaultfilters import slugify class BaseUser(AbstractUser): slug = models.SlugField(_('slug'), max_length=255) name = models.CharField(_('name'), max_le...
Fix name field for empty values
Fix name field for empty values
Python
bsd-3-clause
Nomadblue/django-nomad-base-accounts,Nomadblue/django-nomad-base-accounts
e1bfa7170d4cf6a78cd0f2ca9c3d5302e04323f5
utensils/forms.py
utensils/forms.py
# encoding: utf-8 from django import forms class SearchForm(forms.Form): search = forms.CharField( label='', required=False, widget=forms.widgets.TextInput())
# encoding: utf-8 from django import forms from django.utils.functional import curry class SearchForm(forms.Form): search = forms.CharField( label='', required=False, widget=forms.widgets.TextInput()) class UniqueModelFieldsMixin(object): """ Mixin that enforces unique fields on ModelFor...
Add unique model fields form mixin.
Add unique model fields form mixin.
Python
mit
code-kitchen/django-utensils,code-kitchen/django-utensils,code-kitchen/django-utensils
3d84e8e871b1049102815136ef23e3e630461918
connman_dispatcher/utils.py
connman_dispatcher/utils.py
import os import subprocess import logbook logger = logbook.Logger('connman-dispatcher') def execute_scripts_in_dirs(paths, state): for path in sorted(paths): if os.path.exists(path) and os.path.isdir(path): execute_scripts_in_dir(path, state) def execute_scripts_in_dir(path, state): for ...
import os import subprocess import logbook logger = logbook.Logger('connman-dispatcher') def is_executable(path): return all([os.path.isfile(path), os.access(path, os.X_OK)]) def execute_scripts_in_dirs(paths, state): for path in sorted(paths): if os.path.exists(path) and os.path.isdir(path): ...
Check if file is executable, before executing it
Check if file is executable, before executing it
Python
isc
a-sk/connman-dispatcher
7a901a8edd850dc5e2e75c89362444768722592c
svs_interface.py
svs_interface.py
#!/usr/bin/env python import subprocess from Tkinter import * from tkFileDialog import * import os class GpgApp(object): def __init__(self, master): frame = Frame(master) frame.pack() self.text = Text() self.text.pack() menu = Menu(master) root.config(menu=menu) ...
#!/usr/bin/env python import subprocess from Tkinter import * from tkFileDialog import * import os GPG = 'gpg2' SERVER_KEY = '' # replace with gpg key ID of server key class GpgApp(object): def __init__(self, master): frame = Frame(master) frame.pack() self.text = Text() self.tex...
Add method to encrypt files
Add method to encrypt files
Python
agpl-3.0
jeann2013/securedrop,pwplus/securedrop,chadmiller/securedrop,jrosco/securedrop,GabeIsman/securedrop,GabeIsman/securedrop,jaseg/securedrop,chadmiller/securedrop,jrosco/securedrop,micahflee/securedrop,jaseg/securedrop,conorsch/securedrop,kelcecil/securedrop,chadmiller/securedrop,pwplus/securedrop,jaseg/securedrop,ehartsu...
f3cbe52e0d65e8d6647815b25c79a836db93fb41
gitcd/Cli/Command.py
gitcd/Cli/Command.py
import subprocess import string class Command(object): def execute(self, command: str): cliArgs = self.parseCliArgs(command) process = subprocess.Popen(cliArgs, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, err = process.communicate() if process.returncode != 0: ...
import subprocess import string from pprint import pprint class Command(object): def execute(self, command: str): cliArgs = self.parseCliArgs(command) pprint(cliArgs) process = subprocess.Popen(cliArgs, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, err = process.c...
Add some debug for debian box
Add some debug for debian box
Python
apache-2.0
claudio-walser/gitcd,claudio-walser/gitcd
c72b712cf84e63dd2d72fdc6d64c50a65b8a88a0
courant/core/search/urls.py
courant/core/search/urls.py
from django.conf.urls.defaults import * from courant.core.search.views import * from haystack.forms import ModelSearchForm from haystack.query import SearchQuerySet from haystack.views import SearchView urlpatterns = patterns('', url(r'', CourantSearchView(template='search/results_page.html', ...
from django.conf.urls.defaults import * from courant.core.search.views import * from haystack.forms import ModelSearchForm from haystack.query import SearchQuerySet from haystack.views import SearchView urlpatterns = patterns('', url(r'', SearchView(template='search/results_page.html', ...
Remove all Haystack customization of search view pending further investigations.
Remove all Haystack customization of search view pending further investigations.
Python
bsd-3-clause
maxcutler/Courant-News,maxcutler/Courant-News
d413345197abe9092979e324498c766f7410d34b
bazaar/goods/utils.py
bazaar/goods/utils.py
from __future__ import unicode_literals from .models import Product, PriceList def create_product_for_good(good, price, quantity=1): """ Creates a product for the specified `good` with `quantity`. `price` is set to the default price list. Returns the new product instance """ product = Product.ob...
from __future__ import unicode_literals from .models import Product, PriceList def create_product_for_good(good, price, quantity=1, name=None): """ Creates a product for the specified `good` with `quantity`. `price` is set to the default price list. Returns the new product instance """ product_na...
Add name parameter to create_product_for_good which defaults to good.name
Add name parameter to create_product_for_good which defaults to good.name
Python
bsd-2-clause
evonove/django-bazaar,evonove/django-bazaar,meghabhoj/NEWBAZAAR,evonove/django-bazaar,meghabhoj/NEWBAZAAR,meghabhoj/NEWBAZAAR
f21da23d45c328acffaba69a6f2fbf2056ca326b
datapipe/denoising/__init__.py
datapipe/denoising/__init__.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org) # This script is provided under the terms and conditions of the MIT license: # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (th...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org) # This script is provided under the terms and conditions of the MIT license: # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (th...
Add a module to the __all__ list.
Add a module to the __all__ list.
Python
mit
jdhp-sap/sap-cta-data-pipeline,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/data-pipeline-standalone-scripts
c9b38972486b588790371ab41c961e68609e0b4b
fabfile.py
fabfile.py
from fabric.api import sudo, cd, env, run, local env.hosts = ['ibadaw@sableamd2.cs.mcgill.ca'] DEPLOY_DIR = '/var/www/mcbench/mcbench' def deploy(): with cd(DEPLOY_DIR): run('git pull origin master') restart() def restart(): sudo('service httpd restart') def test(): local('nosetests') ...
from fabric.api import sudo, cd, env, run, local env.hosts = ['ibadaw@sableamd2.cs.mcgill.ca'] DEPLOY_DIR = '/var/www/mcbench/mcbench' def deploy(): with cd(DEPLOY_DIR): run('git pull origin master') restart() def restart(): sudo('service httpd restart') def test(): local('nosetests') ...
Add command to bring up dev server.
Add command to bring up dev server.
Python
mit
isbadawi/mcbench,isbadawi/mcbench
0257d01e53a314b176f3a3b97259b46a271a08be
tests/test_tx.py
tests/test_tx.py
from __future__ import absolute_import, division, print_function import pytest pytest.importorskip("twisted") from twisted.internet.defer import Deferred, succeed, fail from prometheus_async import tx class TestTime(object): @pytest.inlineCallbacks def test_decorator(self, fo, patch_timer): """ ...
from __future__ import absolute_import, division, print_function import pytest pytest.importorskip("twisted") from twisted.internet.defer import Deferred, succeed, fail from prometheus_async import tx class TestTime(object): @pytest.inlineCallbacks def test_decorator_sync(self, fo, patch_timer): "...
Test sync return for Twisted too
Test sync return for Twisted too
Python
apache-2.0
hynek/prometheus_async
7ef23761c64c1e1b1ac47c72a78d5109c36761d0
tests/testing.py
tests/testing.py
import os import os.path import subprocess class HelloWorld(object): BUILD = r"""#!/bin/sh set -e cd $1 cat > hello << EOF #!/bin/sh echo Hello world! EOF chmod +x hello """ EXPECTED_OUTPUT = "Hello world!\n" def write_package_source(package_dir, scripts): whack_dir = os.path.join(package_dir, "wh...
import os import os.path import subprocess from whack.files import write_file class HelloWorld(object): BUILD = r"""#!/bin/sh set -e cd $1 cat > hello << EOF #!/bin/sh echo Hello world! EOF chmod +x hello """ EXPECTED_OUTPUT = "Hello world!\n" def write_package_source(package_dir, scripts): whack...
Remove duplicate definition of write_file
Remove duplicate definition of write_file
Python
bsd-2-clause
mwilliamson/whack
f5728e24ba6dec2d2d7c2eff7888137e91469094
overlay/Data.py
overlay/Data.py
import time class Data: def __init__(self, secs_since_epoch, depth_chart, temperature_chart, frame_path): # general settings self.width = 1296 self.height = 972 self.padding = 5 self.frame_path = frame_path # date/time settings self.time = time.localtime(se...
import time class Data: def __init__(self, secs_since_epoch, depth_chart, temperature_chart, frame_path): # general settings self.width = 1296 self.height = 972 self.padding = 5 self.frame_path = frame_path # date/time settings local_time = time.localtime(s...
Remove unneeded properties from main data object
Remove unneeded properties from main data object
Python
mit
thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x
29f3bb4fc549f78771294f90f5168b20f9ea7b5e
sdi/corestick.py
sdi/corestick.py
def read(filename): """ Reads in a corestick file and returns a dictionary keyed by core_id. Layer interface depths are positive and are relative to the lake bottom. depths are returned in meters. Northing and Easting are typically in the coordinate system used in the rest of the lake survey. We ign...
def read(filename): """ Reads in a corestick file and returns a dictionary keyed by core_id. Layer interface depths are positive and are relative to the lake bottom. depths are returned in meters. Northing and Easting are typically in the coordinate system used in the rest of the lake survey. We ign...
Modify to read layer colors.
Modify to read layer colors.
Python
bsd-3-clause
twdb/sdi
9f5ed14f24aecdd46699e84e13e9fa1f90cbf793
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python import platform import sys BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '17a0e24666d0198810752284690bc2d0d87094d7' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[0], 'win32': '32bit', }...
#!/usr/bin/env python import platform import sys BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '6300862b4b16bd171f00ae566b697098c29743f7' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[0], 'win32': '32bit', }...
Upgrade libchromiumcontent to fix linking error
mac: Upgrade libchromiumcontent to fix linking error
Python
mit
brave/muon,chriskdon/electron,Gerhut/electron,twolfson/electron,icattlecoder/electron,the-ress/electron,bruce/electron,soulteary/electron,nekuz0r/electron,tylergibson/electron,Zagorakiss/electron,tomashanacek/electron,chrisswk/electron,destan/electron,roadev/electron,simongregory/electron,gbn972/electron,jiaz/electron,...
4146be648f04ed409eb82e43528bc700751ef03c
src/qtlayoutbuilder/builderror_test.py
src/qtlayoutbuilder/builderror_test.py
from unittest import TestCase class TestBuildError(TestCase): def test_push_message(self): self.fail() def test_format_as_single_string(self): self.faildoo()
from unittest import TestCase from builderror import BuildError class TestBuildError(TestCase): def test_that_multiple_pushed_messages_are_formatted_properly_when_asked_for(self): err = BuildError() err.push_message('message about error details') err.push_message('message about error cont...
Put in first proper tiny package class and unit test.
Put in first proper tiny package class and unit test.
Python
mit
peterhoward42/qt-layout-gen
adf747998641b1aeb75feada25470aa2a072bd37
examples/test-mh/policies/participant_3.py
examples/test-mh/policies/participant_3.py
{ "inbound": [ { "cookie": 1, "match": { "tcp_dst": 4321 }, "action": { "fwd": 0 } }, { "cookie": 2, "match": { "tcp_dst"...
{ "inbound": [ { "cookie": 1, "match": { "tcp_dst": 4321 }, "action": { "fwd": 0 } }, { "cookie": 2, "match": { "tcp_dst"...
Add inbound drop policy for participant 3 based on eth_src of participant 1
Add inbound drop policy for participant 3 based on eth_src of participant 1
Python
apache-2.0
h2020-endeavour/endeavour,h2020-endeavour/endeavour
c27010a3d5265d9eb783f627adca7cb0c25dcb9a
ctypeslib/test/stdio.py
ctypeslib/test/stdio.py
import os from ctypeslib.dynamic_module import include from ctypes import * import logging logging.basicConfig(level=logging.INFO) if os.name == "nt": _libc = CDLL("msvcrt") else: _libc = CDLL(None) include("""\ #include <stdio.h> #ifdef _MSC_VER # include <fcntl.h> #else # include <sys/fcntl.h> #endif """...
import os from ctypeslib.dynamic_module import include from ctypes import * if os.name == "nt": _libc = CDLL("msvcrt") else: _libc = CDLL(None) include("""\ #include <stdio.h> #ifdef _MSC_VER # include <fcntl.h> #else # include <sys/fcntl.h> #endif """, persist=False)
Remove the logging setup call.
Remove the logging setup call.
Python
mit
sugarmanz/ctypeslib
5d0541f5b5b8cc18b2e3f86b237c01ed915d5c0a
dhcp2nest/util.py
dhcp2nest/util.py
""" Utility functions for dhcp2nest """ from queue import Queue from subprocess import Popen, PIPE from threading import Thread def follow_file(fn, max_lines=100): """ Return a Queue that is fed lines (up to max_lines) from the given file (fn) continuously The implementation given here was inspired b...
""" Utility functions for dhcp2nest """ from queue import Queue from subprocess import Popen, PIPE from threading import Thread def follow_file(fn, max_lines=100): """ Return a Queue that is fed lines (up to max_lines) from the given file (fn) continuously The implementation given here was inspired b...
Make sure that follow-file decodes utf-8 from its input
Make sure that follow-file decodes utf-8 from its input Signed-off-by: Jason Bernardino Alonso <f71c42a1353bbcdbe07e24c2a1c893f8ea1d05ee@hackorp.com>
Python
mit
jbalonso/dhcp2nest
cb75a7ad69b273a57d2b10378712388f179abca3
pande_gas/features/tests/test_fingerprints.py
pande_gas/features/tests/test_fingerprints.py
""" Test topological fingerprints. """ import unittest from rdkit import Chem from pande_gas.features import fingerprints as fp class TestCircularFingerprint(unittest.TestCase): """ Tests for CircularFingerprint. """ def setUp(self): """ Set up tests. """ smiles = 'CC...
""" Test topological fingerprints. """ import unittest from rdkit import Chem from pande_gas.features import fingerprints as fp class TestCircularFingerprint(unittest.TestCase): """ Tests for CircularFingerprint. """ def setUp(self): """ Set up tests. """ smiles = 'CC...
Add test for fragment SMILES
Add test for fragment SMILES
Python
bsd-3-clause
rbharath/pande-gas,rbharath/pande-gas
891e9e05f8c3fde75bb217d8d8132cdf6003e827
locust/shape.py
locust/shape.py
from __future__ import annotations import time from typing import Optional, Tuple, List, Type from . import User from .runners import Runner class LoadTestShape: """ A simple load test shape class used to control the shape of load generated during a load test. """ runner: Optional[Runner] = None...
from __future__ import annotations import time from typing import Optional, Tuple, List, Type from abc import ABC, abstractmethod from . import User from .runners import Runner class LoadTestShape(ABC): """ Base class for custom load shapes. """ runner: Optional[Runner] = None """Reference to th...
Make LoadTestShape a proper abstract class.
Make LoadTestShape a proper abstract class.
Python
mit
locustio/locust,locustio/locust,locustio/locust,locustio/locust
1f0e5b7e65914ec5c3fb0a6617f72ea2f466bbdc
server/admin.py
server/admin.py
from django.contrib import admin from server.models import * class MachineGroupAdmin(admin.ModelAdmin): readonly_fields = ('key',) class MachineAdmin(admin.ModelAdmin): list_display = ('hostname', 'serial') admin.site.register(UserProfile) admin.site.register(BusinessUnit) admin.site.register(MachineGroup...
from django.contrib import admin from server.models import * class ApiKeyAdmin(admin.ModelAdmin): list_display = ('name', 'public_key', 'private_key') class MachineAdmin(admin.ModelAdmin): list_display = ('hostname', 'serial') class MachineGroupAdmin(admin.ModelAdmin): readonly_fields = ('key',) ad...
Sort registrations. Separate classes of imports. Add API key display.
Sort registrations. Separate classes of imports. Add API key display.
Python
apache-2.0
salopensource/sal,salopensource/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal
51076b9d21679b1198931e2517afbf7c6d2e573a
src/competition/forms/team_forms.py
src/competition/forms/team_forms.py
from django import forms from django.template.defaultfilters import slugify from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Fieldset, Submit from crispy_forms.bootstrap import FormActions from competition.models.team_model import Team class TeamForm(forms.ModelForm): class Met...
from django import forms from django.template.defaultfilters import slugify from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Fieldset, Submit from crispy_forms.bootstrap import FormActions from competition.models.team_model import Team class TeamForm(forms.ModelForm): class Met...
Update forms to bootstrap 3
Update forms to bootstrap 3 form-horizontal needs additional helper classes in BS3
Python
bsd-3-clause
michaelwisely/django-competition,michaelwisely/django-competition,michaelwisely/django-competition
07e780a27253c4108c96e232ffbb975e88d23f8d
src/pygrapes/serializer/__init__.py
src/pygrapes/serializer/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from abstract import Abstract __all__ = ['Abstract']
#!/usr/bin/env python # -*- coding: utf-8 -*- from abstract import Abstract from json import Json __all__ = ['Abstract', 'Json']
Load pygrapes.serializer.json.Json right inside pygrapes.serializer
Load pygrapes.serializer.json.Json right inside pygrapes.serializer
Python
bsd-3-clause
michalbachowski/pygrapes,michalbachowski/pygrapes,michalbachowski/pygrapes
0aa5741ce05dcd4926be9c74af18f6fe46f4aded
etl_framework/utilities/DatetimeConverter.py
etl_framework/utilities/DatetimeConverter.py
"""class to convert datetime values""" import datetime class DatetimeConverter(object): """stuff""" _EPOCH_0 = datetime.datetime(1970, 1, 1) def __init__(self): """stuff""" pass @staticmethod def get_tomorrow(): """stuff""" return datetime.datetime.today() + da...
"""class to convert datetime values""" import datetime class DatetimeConverter(object): """stuff""" _EPOCH_0 = datetime.datetime(1970, 1, 1) def __init__(self): """stuff""" pass @staticmethod def get_tomorrow(): """stuff""" return datetime.datetime.today() + da...
Add utility methods for yesterday's date
Add utility methods for yesterday's date
Python
mit
pantheon-systems/etl-framework
26bb374b00d667de00a080c4b32e102ac69a0e23
asn1crypto/version.py
asn1crypto/version.py
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function __version__ = '0.24.0' __version_info__ = (0, 24, 0)
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function __version__ = '0.25.0-alpha' __version_info__ = (0, 25, 0, 'alpha')
Mark master as working towards 0.25.0
Mark master as working towards 0.25.0
Python
mit
wbond/asn1crypto
cbd913af9013926ca7f08ab56023d7242e783698
ad-hoc-scripts/latex-adjust.py
ad-hoc-scripts/latex-adjust.py
#! /usr/bin/env python3 import sys import json for arg in sys.argv[1:]: with open(arg) as f: equajson = json.load(f) try: latex = equajson["markup-languages"]["LaTeX"][0]["markup"] except KeyError: continue if 'documentclass' not in latex: with_boilerplate = "\\docume...
#! /usr/bin/env python3 import sys import json for arg in sys.argv[1:]: with open(arg) as f: equajson = json.load(f) try: latex = equajson["markup-languages"]["LaTeX"][0]["markup"] except KeyError: continue if 'documentclass' not in latex: with_boilerplate = "\\docume...
Add trailing newline to make round-tripping without diffs possible.
Add trailing newline to make round-tripping without diffs possible.
Python
mit
nbeaver/equajson
ace54e86e9462b25acd1636e0e9905ba6decfe9b
admin_tools/dashboard/views.py
admin_tools/dashboard/views.py
from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.template import RequestContext from django.shortcuts import render_to_response from django.contrib import messages try: from django.views.decorators.csrf import csrf_exempt except ImportError: from django...
from django.contrib.admin.views.decorators import staff_member_required from django.http import HttpResponse from django.template import RequestContext from django.shortcuts import render_to_response from django.contrib import messages try: from django.views.decorators.csrf import csrf_exempt except ImportError: ...
Use @staff_member_required decorator for the dashboard view as well
Use @staff_member_required decorator for the dashboard view as well
Python
mit
django-admin-tools/django-admin-tools,django-admin-tools/django-admin-tools,django-admin-tools/django-admin-tools
badcdcc03517aaf705975676a5d37488b38c9738
foomodules/link_harvester/common_handlers.py
foomodules/link_harvester/common_handlers.py
import logging import re import socket import urllib from bs4 import BeautifulSoup logger = logging.getLogger(__name__) WURSTBALL_RE = re.compile(r"^https?://(www\.)?wurstball\.de/[0-9]+/") def default_handler(metadata): return {key: getattr(metadata, key) for key in ["original_url", "url", "title", ...
import logging import re import socket import urllib import http.client from bs4 import BeautifulSoup logger = logging.getLogger(__name__) WURSTBALL_RE = re.compile(r"^https?://(www\.)?wurstball\.de/[0-9]+/") def default_handler(metadata): return {key: getattr(metadata, key) for key in ["original_url...
Add image_handler for link harvester
Add image_handler for link harvester
Python
mit
horazont/xmpp-crowd