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
f8d43af9b2772f642fddc21f941e1c8da635bcaa
sudoku.py
sudoku.py
import os import pickle as pck import numpy as np from pprint import pprint import sys from scripts.sudokuExtractor import Extractor from scripts.train import NeuralNetwork from scripts.sudoku_str import SudokuStr class Sudoku(object): def __init__(self, name): image_path = self.getImagePath(name) ...
import os import pickle as pck import numpy as np from pprint import pprint import sys from scripts.sudokuExtractor import Extractor from scripts.train import NeuralNetwork from scripts.sudoku_str import SudokuStr class Sudoku(object): def __init__(self, name): image_path = self.getImagePath(name) ...
Test the puzzle before solving
Test the puzzle before solving Norvig's code makes this easier than I thought!
Python
mit
prajwalkr/SnapSudoku,ymittal/SnapSudoku,ymittal/SnapSudoku
d4dc22be443fb73157d542f86dbee5d89ac5a713
imagersite/imager_images/tests.py
imagersite/imager_images/tests.py
from django.test import TestCase # Create your tests here.
from __future__ import unicode_literals from django.contrib.auth.models import User from django.test import TestCase import factory from faker import Faker from imager_profile.models import ImagerProfile from .models import Album, Photo # Create your tests here.
Add imports to imager_images test
Add imports to imager_images test
Python
mit
jesseklein406/django-imager,jesseklein406/django-imager,jesseklein406/django-imager
3289027d2cc5b07a83dca422bfc14114854618f8
kazoo/__init__.py
kazoo/__init__.py
import os from kazoo.zkclient import ZooKeeperClient __all__ = ['ZooKeeperClient'] # ZK C client likes to spew log info to STDERR. disable that unless an # env is present. def disable_zookeeper_log(): import zookeeper zookeeper.set_log_stream(open('/dev/null')) if not "KAZOO_LOG_ENABLED" in os.environ: ...
import os from kazoo.zkclient import ZooKeeperClient from kazoo.client import KazooClient __all__ = ['ZooKeeperClient', 'KazooClient'] # ZK C client likes to spew log info to STDERR. disable that unless an # env is present. def disable_zookeeper_log(): import zookeeper zookeeper.set_log_stream(open('/dev/n...
Add KazooClient to top-level module
Add KazooClient to top-level module
Python
apache-2.0
nimbusproject/kazoo
f55cc84fa738d5fe2c7d9d75d05c6a74a1e0571c
calibre_books/calibre/search_indexes.py
calibre_books/calibre/search_indexes.py
from haystack import indexes from unidecode import unidecode from .models import Book class BookIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=False) genres = indexes.MultiValueField(null=True) def get_model(self): return Book def index_q...
from haystack import indexes from unidecode import unidecode from .models import Book class BookIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=False) genres = indexes.MultiValueField(null=True) def get_model(self): return Book def index_q...
Add ability to explicitly search by publisher
Add ability to explicitly search by publisher
Python
bsd-2-clause
bogdal/calibre-books,bogdal/calibre-books
b8666e3a2e2c4ee17bfbfa8d17e4625b84c79040
app/PRESUBMIT.py
app/PRESUBMIT.py
#!/usr/bin/python # Copyright (c) 2009 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. """Makes sure that the app/ code is cpplint clean.""" INCLUDE_CPP_FILES_ONLY = ( r'.*\.cc$', r'.*\.h$' ) EXCLUDE = ( # Autogener...
#!/usr/bin/python # Copyright (c) 2009 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. """Makes sure that the app/ code is cpplint clean.""" INCLUDE_CPP_FILES_ONLY = ( r'.*\.cc$', r'.*\.h$' ) EXCLUDE = ( # Autogener...
Make all changes to app/ run on all trybot platforms, not just the big three. Anyone who's changing a header here may break the chromeos build.
Make all changes to app/ run on all trybot platforms, not just the big three. Anyone who's changing a header here may break the chromeos build. BUG=none TEST=none Review URL: http://codereview.chromium.org/2838027 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@51000 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
gavinp/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,ropik/chromium,adobe/chromium,ropik/chromium,adobe/chromium,adobe/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,yitian134/chrom...
c5b01a233ae2dc52b2acedb7e1648a892a2be021
project4/step_1.py
project4/step_1.py
#!/usr/bin/env python # `json` is a module that helps us use the JSON data format. import json # `requests` is a module for interacting with the Internet import requests def main(): url = 'https://www.govtrack.us/api/v2/bill?congress=112&order_by=-current_status_date' # Read the `requests` documentation for...
#!/usr/bin/env python # `json` is a module that helps us use the JSON data format. import json # `requests` is a module for interacting with the Internet import requests def main(): url = 'https://www.govtrack.us/api/v2/bill?congress=112&order_by=-current_status_date' # Read the `requests` documentation for...
Add backup code in case network is down
Add backup code in case network is down
Python
mit
tommeagher/pycar14,rnagle/pycar,ireapps/pycar,tommeagher/pycar14
069f0024a7de3399333dac2d6b5e4cdab28e81b6
cryptography/bindings/openssl/bignum.py
cryptography/bindings/openssl/bignum.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
Remove this, it properly belongs to ASN1, and that's for a seperate PR
Remove this, it properly belongs to ASN1, and that's for a seperate PR
Python
bsd-3-clause
glyph/cryptography,dstufft/cryptography,Ayrx/cryptography,sholsapp/cryptography,skeuomorf/cryptography,kimvais/cryptography,Ayrx/cryptography,sholsapp/cryptography,skeuomorf/cryptography,sholsapp/cryptography,Lukasa/cryptography,dstufft/cryptography,Lukasa/cryptography,kimvais/cryptography,Lukasa/cryptography,Hasimir/c...
f3001e7e72f366fde962bbdd52f38a983d9f7026
routes/__init__.py
routes/__init__.py
from routes.index import index from routes.project_page import project from routes.user_overview import user_overview from routes.project_overview import group_overview, series_overview from routes.login import login def setup_routes(app): """ Sets up all the routes for the webapp. :param app: :retur...
from routes.index import index from routes.project_page import project from routes.user_overview import user_overview from routes.project_overview import group_overview, series_overview from routes.login import login def setup_routes(app): """ Sets up all the routes for the webapp. :param app: :retur...
Rename route '/users/{user_name}/{project_name}' to '/projects/{project_name}'
Rename route '/users/{user_name}/{project_name}' to '/projects/{project_name}'
Python
agpl-3.0
wtsi-hgi/CoGS-Webapp,wtsi-hgi/CoGS-Webapp,wtsi-hgi/CoGS-Webapp
bbf48a79539493fcade9b5cdb4b1c637b64961ee
tests/test_optimistic_strategy.py
tests/test_optimistic_strategy.py
from nose.tools import assert_true, assert_false from imagekit.cachefiles import ImageCacheFile from mock import Mock from .utils import create_image from django.core.files.storage import FileSystemStorage from imagekit.cachefiles.backends import Simple as SimpleCFBackend from imagekit.cachefiles.strategies import Opti...
from nose.tools import assert_true, assert_false from imagekit.cachefiles import ImageCacheFile from mock import Mock from .utils import create_image from django.core.files.storage import FileSystemStorage from imagekit.cachefiles.backends import Simple as SimpleCFBackend from imagekit.cachefiles.strategies import Opti...
Test that there isn't IO done when you get a URL
Test that there isn't IO done when you get a URL
Python
bsd-3-clause
FundedByMe/django-imagekit,tawanda/django-imagekit,FundedByMe/django-imagekit,tawanda/django-imagekit
ef8f869c5a254d2e3d84c3fa8829215da88681b4
djangocms_export_objects/tests/docs.py
djangocms_export_objects/tests/docs.py
# -*- coding: utf-8 -*- from __future__ import with_statement import os import socket from sphinx.application import Sphinx from six import StringIO from .base import unittest from .tmpdir import temp_dir from unittest import skipIf ROOT_DIR = os.path.dirname(__file__) DOCS_DIR = os.path.abspath(os.path.join(ROOT_DI...
# -*- coding: utf-8 -*- from __future__ import with_statement import os import socket from sphinx.application import Sphinx from six import StringIO from .base import unittest from .tmpdir import temp_dir ROOT_DIR = os.path.dirname(__file__) DOCS_DIR = os.path.abspath(os.path.join(ROOT_DIR, u'..', u'..', u'docs')) ...
Fix build on python 2.6
Fix build on python 2.6
Python
bsd-3-clause
nephila/djangocms-export-objects,nephila/djangocms-export-objects
34d94f771b61a73ee484fc576f8e5dd2d0b14a0f
softwareindex/handlers/coreapi.py
softwareindex/handlers/coreapi.py
import requests, json, urllib SEARCH_URL = 'http://core.ac.uk:80/api-v2/articles/search/' API_KEY = 'FILL THIS IN' def getCOREMentions(identifier, **kwargs): """Return the number of mentions in CORE and a descriptor, as a tuple. Needs an API key, which can be obtained here: http://core.ac.uk/api-keys/reg...
import requests, json, urllib SEARCH_URL = 'http://core.kmi.open.ac.uk/api/search/' API_KEY = 'FILL THIS IN' def getCOREMentions(identifier, **kwargs): """Return the number of mentions in CORE and a descriptor, as a tuple. Needs an API key, which can be obtained here: http://core.ac.uk/api-keys/register"...
Switch to using the v1 API to get total hits.
Switch to using the v1 API to get total hits.
Python
bsd-3-clause
softwaresaved/softwareindex,softwaresaved/softwareindex
4c04979de66cf5d0858ff00002ef40df196ccd05
serfnode/build/handler/handler.py
serfnode/build/handler/handler.py
#!/usr/bin/env python import os from serf_master import SerfHandlerProxy from base_handler import BaseHandler try: from my_handler import MyHandler except ImportError: print "Could not import user's handler." print "Defaulting to dummy handler." MyHandler = BaseHandler if __name__ == '__main__': ...
#!/usr/bin/env python import os from serf_master import SerfHandlerProxy from base_handler import BaseHandler try: from my_handler import MyHandler except ImportError: MyHandler = BaseHandler if __name__ == '__main__': handler = SerfHandlerProxy() role = os.environ.get('ROLE') or 'no_role' handle...
Remove prints that interfere with json output
Remove prints that interfere with json output
Python
mit
waltermoreira/serfnode,waltermoreira/serfnode,waltermoreira/serfnode
ef4f85808c061f81f123fb91b52fd4c8eb3e32b6
peel/api.py
peel/api.py
from tastypie.resources import ModelResource from tastypie.authorization import Authorization from peel.models import Article class ArticleResource(ModelResource): def dehydrate_tags(self, bundle): # Needed to properly serialize tags into a valid JSON list of strings. return bundle.obj.tags ...
from tastypie.resources import ModelResource from tastypie.authorization import Authorization from peel.models import Article class ArticleResource(ModelResource): def dehydrate_tags(self, bundle): # Needed to properly serialize tags into a valid JSON list of strings. return bundle.obj.tags ...
Remove exclude filtering support from API
Remove exclude filtering support from API I'll just use 'in' instead... Reverts fa099b12f8a4c4d4aa2eb2954c6c315f3a79ea84.
Python
mit
imiric/peel,imiric/peel,imiric/peel
be88549f5a2f95090018b2f44bdebb8b270f9997
bash_kernel/bash_kernel.py
bash_kernel/bash_kernel.py
from __future__ import print_function from jupyter_kernel import MagicKernel class BashKernel(MagicKernel): implementation = 'Bash' implementation_version = '1.0' language = 'bash' language_version = '0.1' banner = "Bash kernel - interact with a bash prompt" def get_usage(self): retu...
from __future__ import print_function from jupyter_kernel import MagicKernel class BashKernel(MagicKernel): implementation = 'Bash' implementation_version = '1.0' language = 'bash' language_version = '0.1' banner = "Bash kernel - interact with a bash prompt" def get_usage(self): retu...
Update bash kernel to use new shell api and shell help.
Update bash kernel to use new shell api and shell help.
Python
bsd-3-clause
Calysto/metakernel
54d5a984aeecd9bad501ec484c173f2dc504dfa5
dict.py
dict.py
#! /usr/bin/env python2 # -*- coding: utf-8 -*- import os import sys import json import urllib import datetime import subprocess # api key, 1000 times per hour APIKEY = 'WGCxN9fzvCxPo0nqlzGLCPUc' PATH = '~/vocabulary' # make sure the path exist FILENAME = os.path.join(os.path.expanduser(PATH), str(datetime.date.today...
#! /usr/bin/env python2 # -*- coding: utf-8 -*- import os import sys import json import urllib import datetime import subprocess import random import md5 # api key, six million per month APPID = 'You baidu translate appid' APIKEY = 'You baidu translate apikey' PATH = '~/vocabulary' # make sure the path exist FILENAME...
Migrate to new translate api
Migrate to new translate api
Python
mit
pidofme/T4LE
d2c552b8996ce1ef8a2d5ef64f6a2b60ce306cf3
setmagic/models.py
setmagic/models.py
from django.db import models class Setting(models.Model): name = models.CharField(max_length=40, unique=True) label = models.CharField(max_length=60) help_text = models.TextField() current_value = models.TextField(blank=True, null=True) class Meta: app_label = 'setmagic' def __str__(...
from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Setting(models.Model): name = models.CharField(max_length=40, unique=True) label = models.CharField(max_length=60) help_text = models.TextField() current_value = models.TextFie...
Add model unicode support for Python 2
Add model unicode support for Python 2
Python
mit
7ws/django-setmagic
196162fe0782cb0e5934dd51f96b4f1d05a108ed
tools/bots/functional_testing.py
tools/bots/functional_testing.py
#!/usr/bin/python # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. """ Buildbot steps for functional testing master and slaves """ if __name__ == '__main...
#!/usr/bin/python # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. """ Buildbot steps for functional testing master and slaves """ import os import re im...
Add build steps to functional testing annotated steps script
Add build steps to functional testing annotated steps script R=messick@google.com Review URL: https://codereview.chromium.org//312503005 git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@36878 260f80e4-7a28-3924-810f-c04153c831b5
Python
bsd-3-clause
dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dart...
7e080edea2139c5cce907f4d752320943b044ac7
game.py
game.py
people = '123456' room = 'abcdef' # murder configuration # who was where # who is the murderer # current configuration # who was where # player location
import random people = '123456' room = 'abcdef' # murder configuration # who was where # who is the murderer # current configuration # who was where # player location murder_config_people = list(people) random.shuffle(murder_config_people) murder_location = random.choice(room) murderer = people[room.find(murder...
Add random people and rooms
Add random people and rooms
Python
mit
tomviner/dojo-adventure-game
582c0e432db918237d1dcbcc4034983408766b4f
thinc/layers/featureextractor.py
thinc/layers/featureextractor.py
from typing import List, Union, Callable, Tuple from ..types import Ints2d, Doc from ..model import Model from ..config import registry InT = List[Doc] OutT = List[Ints2d] @registry.layers("FeatureExtractor.v1") def FeatureExtractor(columns: List[Union[int, str]]) -> Model[InT, OutT]: return Model("extract_fea...
from typing import List, Union, Callable, Tuple from ..types import Ints2d, Doc from ..model import Model from ..config import registry InT = List[Doc] OutT = List[Ints2d] @registry.layers("FeatureExtractor.v1") def FeatureExtractor(columns: List[Union[int, str]]) -> Model[InT, OutT]: return Model("extract_fea...
Make sure FeatureExtractor returns array2i
Make sure FeatureExtractor returns array2i
Python
mit
spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc
09ae901f6def59a2d44aa994cb545afb559f9eb1
dodo_commands/system_commands/activate.py
dodo_commands/system_commands/activate.py
# noqa from dodo_commands.system_commands import DodoCommand from dodo_commands.dodo_activate import Activator class Command(DodoCommand): # noqa help = "" decorators = [] def add_arguments_imp(self, parser): # noqa parser.add_argument('project', nargs='?') group = parser.add_mutually_...
# noqa from dodo_commands.system_commands import DodoCommand, CommandError from dodo_commands.dodo_activate import Activator class Command(DodoCommand): # noqa help = "" decorators = [] def add_arguments_imp(self, parser): # noqa parser.add_argument('project', nargs='?') group = parser...
Fix crash when no project is specified
Fix crash when no project is specified
Python
mit
mnieber/dodo_commands
01a86c09b768f6cc4e5bf9b389d09512f9e56ceb
sample_agent.py
sample_agent.py
import numpy as np import matplotlib.pyplot as plt class Agent(object): def __init__(self, dim_action): self.dim_action = dim_action def act(self, ob, reward, done, vision): #print("ACT!") # Get an Observation from the environment. # Each observation vectors are numpy array. ...
import numpy as np import matplotlib.pyplot as plt class Agent(object): def __init__(self, dim_action): self.dim_action = dim_action def act(self, ob, reward, done, vision_on): #print("ACT!") # Get an Observation from the environment. # Each observation vectors are numpy array...
Update to follow the new observation format (follow the vision input of OpenAI ATARI environment)
Update to follow the new observation format (follow the vision input of OpenAI ATARI environment)
Python
mit
travistang/late_fyt,travistang/late_fyt,ugo-nama-kun/gym_torcs,travistang/late_fyt,ugo-nama-kun/gym_torcs,ugo-nama-kun/gym_torcs,travistang/late_fyt,travistang/late_fyt,ugo-nama-kun/gym_torcs,ugo-nama-kun/gym_torcs,travistang/late_fyt,ugo-nama-kun/gym_torcs,travistang/late_fyt,ugo-nama-kun/gym_torcs
d5697d6176dd9a3d54abc13d38f94f1a326eac84
dog/core/botcollection.py
dog/core/botcollection.py
import discord def user_to_bot_ratio(guild: discord.Guild): """ Calculates the user to bot ratio for a guild. """ bots = len(list(filter(lambda u: u.bot, guild.members))) users = len(list(filter(lambda u: not u.bot, guild.members))) ratio = bots / users return ratio async def is_blacklisted(bot,...
import discord def user_to_bot_ratio(guild: discord.Guild): bots, users = 0, 0 for member in guild.bots: if member.bot: bots += 1 else: users += 1 return bots / users async def is_blacklisted(bot, guild_id: int) -> bool: """ Returns a bool indicating whether ...
Use Fuyu's VeryCool™ UTBR impl
Use Fuyu's VeryCool™ UTBR impl
Python
mit
slice/dogbot,sliceofcode/dogbot,slice/dogbot,sliceofcode/dogbot,slice/dogbot
c1b797b74098fd6f7ea480f7f1bf496d5f52bdc7
signac/__init__.py
signac/__init__.py
# Copyright (c) 2016 The Regents of the University of Michigan # All rights reserved. # This software is licensed under the BSD 3-Clause License. """The signac framework aids in the management of large and heterogeneous data spaces. It provides a simple and robust data model to create a well-defined indexable storage ...
# Copyright (c) 2016 The Regents of the University of Michigan # All rights reserved. # This software is licensed under the BSD 3-Clause License. """The signac framework aids in the management of large and heterogeneous data spaces. It provides a simple and robust data model to create a well-defined indexable storage ...
Remove common and errors from root namespace.
Remove common and errors from root namespace.
Python
bsd-3-clause
csadorf/signac,csadorf/signac
e99c230f2bf7bdc010552c03ca657adddebaf818
chessfellows/chess/urls.py
chessfellows/chess/urls.py
from django.conf.urls import patterns, url from django.contrib import admin from chess import views admin.autodiscover() urlpatterns = patterns('', url(r'^accounts/home/', views.home_page, name='home'), url(r'^accounts/history/$', views.history_page, name='history'), url(r'^accounts/profile/$', views.prof...
from django.conf.urls import patterns, url from django.contrib import admin from chess import views admin.autodiscover() urlpatterns = patterns('', url(r'^accounts/home/', views.home_page, name='home'), url(r'^accounts/history/$', views.history_page, name='history'), url(r'^accounts/profile/$', views.prof...
Add url for landing page (/) that links to the base view
Add url for landing page (/) that links to the base view
Python
mit
EyuelAbebe/gamer,EyuelAbebe/gamer
a43634b3c9ec4d47d8ec032e34a197210a6dddb7
gesture_recognition/gesture_recognizer.py
gesture_recognition/gesture_recognizer.py
""" Main script to execute the gesture recognition software. """ # Import native python libraries import inspect import os import sys from listener import MyListener from face_detection import face_detector_gui import time # Setup environment variables src_dir = os.path.dirname(inspect.getfile(inspect.currentframe())...
""" Main script to execute the gesture recognition software. """ # Import native python libraries import inspect import os import sys from listener import MyListener from face_detection import face_detector_gui import time # Setup environment variables src_dir = os.path.dirname(inspect.getfile(inspect.currentframe())...
Add some prints to improve verbosity
Add some prints to improve verbosity
Python
mit
oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition,oscarorti/pae-gesture-recognition
b98dcfbff114b26475c327492e8fcd8fff17c902
alg_prim_minimum_spanning_tree.py
alg_prim_minimum_spanning_tree.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function def prim(): """Prim's Minimum Spanning Tree in weighted graph.""" pass def main(): pass if __name__ == '__main__': main()
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from ds_min_priority_queue_tuple import MinPriorityQueue def prim(): """Prim's algorithm for minimum spanning tree in weighted graph. Time complexity for graph G(V, E): (|V|+|E|)log(|V|...
Add weighted undirected graph in main()
Add weighted undirected graph in main()
Python
bsd-2-clause
bowen0701/algorithms_data_structures
44d6af63406e2f825c44238fd5bde0c49dde0620
nexus/conf.py
nexus/conf.py
from django.conf import settings MEDIA_PREFIX = getattr(settings, 'NEXUS_MEDIA_PREFIX', '/nexus/media/')
from django.conf import settings MEDIA_PREFIX = getattr(settings, 'NEXUS_MEDIA_PREFIX', '/nexus/media/') if getattr(settings, 'NEXUS_USE_DJANGO_MEDIA_URL', False): MEDIA_PREFIX = getattr(settings, 'MEDIA_URL', MEDIA_PREFIX)
Add a setting NEXUS_USE_DJANGO_MEDIA_URL to easily use Django's MEDIA_URL for the nexus MEDIA_PREFIX.
Add a setting NEXUS_USE_DJANGO_MEDIA_URL to easily use Django's MEDIA_URL for the nexus MEDIA_PREFIX. If you want to make custom modifications to the nexus media it makes sense to have it under your own app's media folder and the NEXUS_USE_DJANGO_MEDIA_URL allows the MEDIA_URL to be DRY. This repetition would be a has...
Python
apache-2.0
Raekkeri/nexus,graingert/nexus,graingert/nexus,disqus/nexus,YPlan/nexus,disqus/nexus,graingert/nexus,YPlan/nexus,brilliant-org/nexus,YPlan/nexus,roverdotcom/nexus,roverdotcom/nexus,disqus/nexus,brilliant-org/nexus,Raekkeri/nexus,blueprinthealth/nexus,roverdotcom/nexus,blueprinthealth/nexus,blueprinthealth/nexus,brillia...
c5f9b9bc76f797156b73a2bb26b80ebf23d62fe4
polyaxon/pipelines/celery_task.py
polyaxon/pipelines/celery_task.py
from pipelines.models import Operation from polyaxon.celery_api import CeleryTask class OperationTask(CeleryTask): """Base operation celery task with basic logging.""" _operation = None def run(self, *args, **kwargs): self._operation = Operation.objects.get(id=kwargs['query_id']) super(Op...
from pipelines.models import Operation from polyaxon.celery_api import CeleryTask class OperationTask(CeleryTask): """Base operation celery task with basic logging.""" _operation = None def __call__(self, *args, **kwargs): self._operation = Operation.objects.get(id=kwargs['query_id']) sel...
Update OperationCelery with max_retries and countdown logic
Update OperationCelery with max_retries and countdown logic
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
0476093e01784c86138794261ca2e49a9b2e0cb5
armstrong/core/arm_wells/admin.py
armstrong/core/arm_wells/admin.py
from django.conf import settings from django.contrib import admin from django.contrib.contenttypes import generic from reversion.admin import VersionAdmin from . import models class NodeAdmin(VersionAdmin): pass class NodeInline(admin.TabularInline): model = models.Node extra = 1 # This is for Gra...
from django.conf import settings from django.contrib import admin from django.contrib.contenttypes import generic from reversion.admin import VersionAdmin from armstrong.hatband.options import GenericKeyInline from . import models class NodeAdmin(VersionAdmin): pass class NodeInline(GenericKeyInline): mod...
Switch out to use the new GenericKeyInline
Switch out to use the new GenericKeyInline
Python
apache-2.0
dmclain/armstrong.core.arm_wells,armstrong/armstrong.core.arm_wells,armstrong/armstrong.core.arm_wells,dmclain/armstrong.core.arm_wells,texastribune/armstrong.core.arm_wells,armstrong/armstrong.core.arm_wells,texastribune/armstrong.core.arm_wells
6fa8603d0abc69539c2c4f8d1205f2ebb47fc017
tests/core/tools/test_runner/test_yaml_runner.py
tests/core/tools/test_runner/test_yaml_runner.py
from openfisca_core.tools.test_runner import _run_test, _get_tax_benefit_system from openfisca_core.errors import VariableNotFound import pytest class TaxBenefitSystem: def __init__(self): self.variables = {} def get_package_metadata(self): return {"name": "Test", "version": "Test"} de...
from openfisca_core.tools.test_runner import _run_test, _get_tax_benefit_system from openfisca_core.errors import VariableNotFound import pytest class TaxBenefitSystem: def __init__(self): self.variables = {} def get_package_metadata(self): return {"name": "Test", "version": "Test"} de...
Remove unused code in test
Remove unused code in test
Python
agpl-3.0
openfisca/openfisca-core,openfisca/openfisca-core
8fa346532068aadf510ebcc1ef795527f7b68597
frigg_worker/api.py
frigg_worker/api.py
# -*- coding: utf-8 -*- import logging import socket import requests logger = logging.getLogger(__name__) class APIWrapper(object): def __init__(self, options): self.token = options['hq_token'] self.url = options['hq_url'] @property def headers(self): return { 'cont...
# -*- coding: utf-8 -*- import logging import socket import requests logger = logging.getLogger(__name__) class APIWrapper(object): def __init__(self, options): self.token = options['hq_token'] self.url = options['hq_url'] @property def headers(self): return { 'cont...
Add x-frigg-worker-token header to hq requests
fix: Add x-frigg-worker-token header to hq requests This will in time be to remove the FRIGG_WORKER_TOKEN header.
Python
mit
frigg/frigg-worker
fce3dd3b08f2ff8500be4d694e9d384bd61b82ab
quickly/families/models.py
quickly/families/models.py
from django.db import models from quickly.buttons.models import EmergencyButtonClient class FamilyMember(models.Model): """ Model which defines families of the platform with authentication possibilities and a phone number which can be sent to emergency services. """ phone_number = models.Char...
from django.db import models from quickly.buttons.models import EmergencyButtonClient class FamilyMember(models.Model): """ Model which defines families of the platform with authentication possibilities and a phone number which can be sent to emergency services. """ phone_number = models.Char...
Add name to family member
Add name to family member
Python
mit
wearespindle/quickly.press,wearespindle/quickly.press,wearespindle/quickly.press
250e720550a514457e5f698e80ed89e50abee482
tbmodels/_kdotp.py
tbmodels/_kdotp.py
import numpy as np import scipy.linalg as la from fsc.export import export from fsc.hdf5_io import subscribe_hdf5, SimpleHDF5Mapping @export @subscribe_hdf5('tbmodels.model', check_on_load=False) class KdotpModel(SimpleHDF5Mapping): HDF5_ATTRIBUTES = ['taylor_coefficients'] def __init__(self, taylor_coeffic...
import numpy as np import scipy.linalg as la from fsc.export import export from fsc.hdf5_io import subscribe_hdf5, SimpleHDF5Mapping @export @subscribe_hdf5('tbmodels.kdotp_model', check_on_load=False) class KdotpModel(SimpleHDF5Mapping): HDF5_ATTRIBUTES = ['taylor_coefficients'] def __init__(self, taylor_c...
Fix computation of Hamiltonian for k.p models.
Fix computation of Hamiltonian for k.p models.
Python
apache-2.0
Z2PackDev/TBmodels,Z2PackDev/TBmodels
c0e68d9e4fe18154deb412d5897702603883cc06
statsd/__init__.py
statsd/__init__.py
try: from django.conf import settings except ImportError: settings = None from client import StatsClient __all__ = ['StatsClient', 'statsd', 'VERSION'] VERSION = (0, 1) if settings: host = getattr(settings, 'STATSD_HOST', 'localhost') port = getattr(settings, 'STATSD_PORT', 8125) statsd = Stat...
try: from django.conf import settings except ImportError: settings = None from client import StatsClient __all__ = ['StatsClient', 'statsd', 'VERSION'] VERSION = (0, 1) if settings: try: host = getattr(settings, 'STATSD_HOST', 'localhost') port = getattr(settings, 'STATSD_PORT', 8125) ...
Support Django being on the path but unused.
Support Django being on the path but unused.
Python
mit
Khan/pystatsd,wujuguang/pystatsd,deathowl/pystatsd,lyft/pystatsd,lyft/pystatsd,smarkets/pystatsd,jsocol/pystatsd,Khan/pystatsd
427f02c7f6c93e15d219d975d337a97d74a88b42
convergence-tests/runall.py
convergence-tests/runall.py
import os import time import multiprocessing threads = 4 dev_null = "/dev/null" input_dir = "./convergence_inputs/" log_file = dev_null call = "nice -n 19 ionice -c2 -n7 ../build/main.x " call_end = " >> " + log_file syscall_arr = [] input_files = os.listdir(input_dir) if __name__ == "__main__": pool = multip...
import os import time import multiprocessing threads = 4 os.environ["OMP_NUM_THREADS"] = "1" dev_null = "/dev/null" input_dir = "./convergence_inputs/" log_file = "log.log" call = "nice -n 19 ionice -c2 -n7 ../build/main.x " call_end = " >> " + log_file syscall_arr = [] input_files = os.listdir(input_dir) if __...
Update parallel convergence test runs to not spawn OMP threads
Update parallel convergence test runs to not spawn OMP threads
Python
mit
kramer314/1d-vd-test,kramer314/1d-vd-test
01e4b6c3cbd11058e3d60a635048998c24138ddb
instana/__init__.py
instana/__init__.py
from __future__ import absolute_import import opentracing from .sensor import Sensor from .tracer import InstanaTracer from .options import Options # Import & initialize instrumentation from .instrumentation import urllib3 """ The Instana package has two core components: the sensor and the tracer. The sensor is indi...
from __future__ import absolute_import import os import opentracing from .sensor import Sensor from .tracer import InstanaTracer from .options import Options if "INSTANA_DISABLE_AUTO_INSTR" not in os.environ: # Import & initialize instrumentation from .instrumentation import urllib3 """ The Instana package ha...
Add environment variable to disable automatic instrumentation
Add environment variable to disable automatic instrumentation
Python
mit
instana/python-sensor,instana/python-sensor
d5b5421c95b1e2feb4646a42b5aca71a2280e30c
tests/dojo_test.py
tests/dojo_test.py
import unittest from src.dojo import Dojo class TestCreateRoom (unittest.TestCase): def test_create_room_successfully(self): my_class_instance = Dojo() initial_room_count = len(my_class_instance.all_rooms) blue_office = my_class_instance.create_room("office", "Blue") self.assertTru...
import unittest from src.dojo import Dojo class TestCreateRoom (unittest.TestCase): def test_create_room_successfully(self): my_class_instance = Dojo() initial_room_count = len(my_class_instance.all_rooms) blue_office = my_class_instance.create_room("office", "Blue") self.assertTru...
Create test to check that a person has been added
Create test to check that a person has been added
Python
mit
EdwinKato/Space-Allocator,EdwinKato/Space-Allocator
65c5474936dca27023e45c1644fa2a9492e9a420
tests/convergence_tests/run_convergence_tests_lspr.py
tests/convergence_tests/run_convergence_tests_lspr.py
import os import time import subprocess import datetime from check_for_meshes import check_mesh # tests to run tests = ['sphere_lspr.py', 'sphere_multiple_lspr.py'] # specify CUDA device to use CUDA_DEVICE = '0' ENV = os.environ.copy() ENV['CUDA_DEVICE'] = CUDA_DEVICE mesh_file = '' folder_name = 'lspr_convergence...
import os import time import subprocess import datetime from check_for_meshes import check_mesh # tests to run tests = ['sphere_lspr.py', 'sphere_multiple_lspr.py'] # specify CUDA device to use CUDA_DEVICE = '0' ENV = os.environ.copy() ENV['CUDA_DEVICE'] = CUDA_DEVICE mesh_file = 'https://zenodo.org/record/580786/...
Add path to convergence test lspr zip file
Add path to convergence test lspr zip file
Python
bsd-3-clause
barbagroup/pygbe,barbagroup/pygbe,barbagroup/pygbe
c614d5e636ad22c470ac730ceb292a10c9537c6b
ibmcnx/doc/DataSources.py
ibmcnx/doc/DataSources.py
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
Create documentation of DataSource Settings
: Create documentation of DataSource Settings Task-Url:
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
591aaa938c22b797fc6bbeb5050ec489cc966a47
tests/run_tests.py
tests/run_tests.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from unittest import main from test_core import * from test_lazy import * if __name__ == '__main__': main()
#!/usr/bin/env python # -*- coding: utf-8 -*- # Hack to allow us to run tests before installing. import sys, os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))) from unittest import main from test_core import * from test_lazy import * if __name__ == '__main__': main()
Make running unit tests more friendly
Make running unit tests more friendly
Python
mit
CovenantEyes/py_stringlike
80b148f31b616ee85e63ddc524a6dd2910b5a467
tests/test_auth.py
tests/test_auth.py
import random import unittest from six.moves import input from .config import * from tweepy import API, OAuthHandler class TweepyAuthTests(unittest.TestCase): def testoauth(self): auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret) # test getting access token auth_url = auth...
import random import unittest from .config import * from tweepy import API, OAuthHandler class TweepyAuthTests(unittest.TestCase): def testoauth(self): auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret) # test getting access token auth_url = auth.get_authorization_url() ...
Remove input import from six.moves
Remove input import from six.moves
Python
mit
svven/tweepy,tweepy/tweepy
b7a0653cdb2c20def38a687963763b75455ebbcb
conftest.py
conftest.py
from __future__ import absolute_import, division, print_function from dials.conftest import regression_data, run_in_tmpdir
from __future__ import absolute_import, division, print_function from dials.conftest import pytest_addoption, regression_data, run_in_tmpdir
Add --regression command line option
Add --regression command line option
Python
bsd-3-clause
xia2/i19
33fa3d886742b440945fa80eaa5a8da9950f1181
runtests.py
runtests.py
#!/usr/bin/env python import os import sys import django from django.conf import settings DEFAULT_SETTINGS = dict( INSTALLED_APPS=[ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sites", "badgekit_webhooks", "badgekit_webhooks.tests" ], DATA...
#!/usr/bin/env python import os import sys import django from django.conf import settings DEFAULT_SETTINGS = dict( INSTALLED_APPS=[ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sites", "badgekit_webhooks", "badgekit_webhooks.tests" ], DATA...
Fix test runner for development Django
Fix test runner for development Django
Python
mit
tgs/django-badgekit-webhooks
2d908f812a0cfeab18e36733ec3380e507865c20
tests/test_auth.py
tests/test_auth.py
# -*- coding: utf-8 -*- from unittest import TestCase class TestOneAll(TestCase): def test_whether_test_runs(self): self.assertTrue(True)
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals from unittest import TestCase, main from pyoneall import OneAll from pyoneall.classes import BadOneAllCredentials, Connections class TestOneAll(TestCase): VALID_CREDENTIALS = { 'site_name': 'python'...
Test suite is taking shape. :)
Test suite is taking shape. :)
Python
mit
leandigo/pyoneall
6dfbbba5abf380e3f47f9190a864faa13cf1599d
data_preparation.py
data_preparation.py
# importing modules/ libraries import pandas as pd import numpy as np orders_prior_df = pd.read_csv('Data/orders_prior_sample.csv') order_products_prior_df = pd.read_csv('Data/order_products_prior_sample.csv') grouped = order_products_prior_df.groupby('order_id', as_index = False) grouped_data = pd.DataFrame() gro...
# importing modules/ libraries import pandas as pd import numpy as np orders_prior_df = pd.read_csv('Data/orders_prior_sample.csv') order_products_prior_df = pd.read_csv('Data/order_products_prior_sample.csv') grouped = order_products_prior_df.groupby('order_id', as_index = False) grouped_data = pd.DataFrame() gro...
Merge product reordered column with order ids
feat: Merge product reordered column with order ids
Python
mit
rjegankumar/instacart_prediction_model
7873996d49ad32984465086623a3f6537eae11af
nbgrader/preprocessors/headerfooter.py
nbgrader/preprocessors/headerfooter.py
from IPython.nbconvert.preprocessors import Preprocessor from IPython.nbformat.current import read as read_nb from IPython.utils.traitlets import Unicode class IncludeHeaderFooter(Preprocessor): """A preprocessor for adding header and/or footer cells to a notebook.""" header = Unicode("", config=True, help="...
from IPython.nbconvert.preprocessors import Preprocessor from IPython.nbformat.current import read as read_nb from IPython.utils.traitlets import Unicode class IncludeHeaderFooter(Preprocessor): """A preprocessor for adding header and/or footer cells to a notebook.""" header = Unicode("", config=True, help="...
Fix if statements checking if header/footer exist
Fix if statements checking if header/footer exist
Python
bsd-3-clause
jhamrick/nbgrader,jupyter/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,EdwardJKim/nbgrader,ellisonbg/nbgrader,EdwardJKim/nbgrader,jupyter/nbgrader,jupyter/nbgrader,EdwardJKim/nbgrader,ellisonbg/nbgrader,MatKallada/nbgrader,ellisonbg/nbgrader,modulexcite/nbgrader,jhamrick/nbgrader,EdwardJKim/nbgrader,jdfreder/nbgrader,jd...
a9cc67b9defeffc76091bd204f230a431db80196
traftrack/image.py
traftrack/image.py
import PIL.Image import PIL.ImageMath import urllib.request from io import BytesIO def load_img_url(url): req = urllib.request.urlopen(url) data = BytesIO(req.read()) return PIL.Image.open(data) def load_img_file(fname): return PIL.Image.open(fname) def compute_histo_RYG(img, mask): img = img....
import PIL.Image import PIL.ImageMath import urllib.request from io import BytesIO def load_img_url(url): req = urllib.request.urlopen(url) data = BytesIO(req.read()) return PIL.Image.open(data) def load_img_file(fname): return PIL.Image.open(fname) def compute_histo_RYG(img, mask): img = img....
Fix issue with non-existing color in compute_histo_RYG
Fix issue with non-existing color in compute_histo_RYG
Python
mit
asavonic/traftrack
61c4b0952e198fd5335f110349b4cc3fe840a02f
bynamodb/patcher.py
bynamodb/patcher.py
from boto.dynamodb2.layer1 import DynamoDBConnection from .model import Model def patch_dynamodb_connection(**kwargs): """:class:`boto.dynamodb2.layer1.DynamoDBConnection` patcher. It partially applies the keyword arguments to the :class:`boto.dynamodb2.layer1.DynamoDBConnection` initializer method. ...
from boto.dynamodb2.layer1 import DynamoDBConnection from .model import Model def patch_from_config(config): if 'DYNAMODB_CONNECTION' in config: patch_dynamodb_connection(**config['DYNAMODB_CONNECTION']) if 'DYNAMODB_PREFIX' in config: patch_table_name_prefix(config['DYNAMODB_PREFIX']) def ...
Add support for the patching connection and the prefix through config dict
Add support for the patching connection and the prefix through config dict
Python
mit
teddychoi/BynamoDB
ad8a68744c9c844af6e093954b9f50cfc355920a
scripts/update_comments.py
scripts/update_comments.py
""" Update User.comments_viewed_timestamp field & comments model. Accompanies https://github.com/CenterForOpenScience/osf.io/pull/1762 """ from modularodm import Q from framework.auth.core import User from website.models import Comment from website.app import init_app import logging from scripts import utils as script_...
""" Update User.comments_viewed_timestamp field & comments model. Accompanies https://github.com/CenterForOpenScience/osf.io/pull/1762 """ from modularodm import Q from framework.auth.core import User from website.models import Comment from website.app import init_app import logging from scripts import utils as script_...
Remove mfr parameter from init_app
Remove mfr parameter from init_app
Python
apache-2.0
chennan47/osf.io,RomanZWang/osf.io,kch8qx/osf.io,amyshi188/osf.io,billyhunt/osf.io,zamattiac/osf.io,abought/osf.io,GageGaskins/osf.io,brandonPurvis/osf.io,zamattiac/osf.io,zachjanicki/osf.io,acshi/osf.io,brianjgeiger/osf.io,DanielSBrown/osf.io,TomHeatwole/osf.io,KAsante95/osf.io,chrisseto/osf.io,billyhunt/osf.io,crcres...
811a94b477abae045fb8b840c33481ed8b1d8266
app/upload.py
app/upload.py
#!/usr/bin/env python import tornado.web import os import uuid class UploadHandler(tornado.web.RequestHandler): def post(self): fileinfo = self.request.files['filearg'][0] print 'hi' print "fileinfo is", fileinfo.keys() fname = fileinfo['filename'] extn = os.path.splitext(f...
#!/usr/bin/env python import tornado.web import os import uuid class UploadHandler(tornado.web.RequestHandler): def post(self): fileinfo = self.request.files['filearg'][0] print 'hi' print "fileinfo is", fileinfo.keys() fname = fileinfo['filename'] extn = os.path.splitext(f...
Create folder if it doesn't exist
Create folder if it doesn't exist
Python
mit
santosfamilyfoundation/SantosCloud,santosfamilyfoundation/TrafficCloud,santosfamilyfoundation/TrafficCloud,santosfamilyfoundation/SantosCloud,santosfamilyfoundation/TrafficCloud,santosfamilyfoundation/SantosCloud,santosfamilyfoundation/SantosCloud
7698d7256f7a88b02b3dd02b411532cb4a6a46aa
cmi/modify_uri.py
cmi/modify_uri.py
#! /usr/bin/env python # # Replaces the extension ".la" with ".so" in the library URI in all # ".cca" files in %{buildroot}%{_datadir}/cca. # # Mark Piper (mark.piper@colorado.edu) import os import sys import glob from subprocess import check_call try: install_share_dir = sys.argv[1] cca_dir = os.path.join(i...
#! /usr/bin/env python # # Replaces the extension ".la" with ".so" in the library URI in all # ".cca" files in %{buildroot}%{_datadir}/cca. # # Mark Piper (mark.piper@colorado.edu) import os import sys import glob from subprocess import check_call try: install_share_dir = sys.argv[1] cca_dir = os.path.join(i...
Change wording in error message
Change wording in error message
Python
mit
csdms/rpm_tools,csdms/rpm_tools
fd09975379338d47ec1bea8709c4a3c803aaa40d
slackbot.py
slackbot.py
#! /usr/bin/env python2.7 import requests class Slackbot(object): def __init__(self, slack_name, token): self.slack_name = slack_name self.token = token assert self.token, "Token should not be blank" self.url = self.sb_url() def sb_url(self): url = "https://{}.slack....
#! /usr/bin/env python2.7 import requests class Slackbot(object): def __init__(self, slack_name, token): self.slack_name = slack_name self.token = token assert self.token, "Token should not be blank" self.url = self.sb_url() def sb_url(self): url = "https://{}.slack....
Fix unicode encoding of Slack message posts
Fix unicode encoding of Slack message posts
Python
apache-2.0
rossrader/destalinator
860629358dd7651b1f35a70f65dfabb1010daa77
tests/QueryableListTests/tutils.py
tests/QueryableListTests/tutils.py
def filterDictToStr(filterDict): return ', '.join(['%s=%s' %(key, repr(value)) for key, value in filterDict.items()]) class DataObject(object): def __init__(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) def __str__(self): return 'DataObject( %s ...
def filterDictToStr(filterDict): return ', '.join(['%s=%s' %(key, repr(value)) for key, value in filterDict.items()]) class DataObject(object): def __init__(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) def __str__(self): return 'DataObject( %s ...
Add a hashable-dict type for testing
Add a hashable-dict type for testing
Python
lgpl-2.1
kata198/QueryableList,kata198/QueryableList
1eedac5229e5a9128c4fbc09f7d7b97a3859e9b9
django_sse/views.py
django_sse/views.py
# -*- coding: utf-8 -*- from django.views.generic import View from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse try: from django.http import StreamingHttpResponse as HttpResponse except ImportError: from django.http import HttpResponse from django.utils.decorators impo...
# -*- coding: utf-8 -*- from django.views.generic import View from django.views.decorators.csrf import csrf_exempt try: from django.http import StreamingHttpResponse as HttpResponse except ImportError: from django.http import HttpResponse from django.utils.decorators import method_decorator from sse import S...
Remove duplicate import. (Thanks to MechanisM)
Remove duplicate import. (Thanks to MechanisM)
Python
bsd-3-clause
chadmiller/django-sse,niwinz/django-sse,chadmiller/django-sse
63c72bab549ae2c5aaa6370aebe10cce1e14effe
sorted_nearest/__init__.py
sorted_nearest/__init__.py
from sorted_nearest.src.sorted_nearest import (nearest_previous_nonoverlapping, nearest_next_nonoverlapping, nearest_nonoverlapping, find_clusters)
from sorted_nearest.src.sorted_nearest import (nearest_previous_nonoverlapping, nearest_next_nonoverlapping, nearest_nonoverlapping, find_clusters) from sorted_nearest.version i...
Add version flag to sorted nearest
Add version flag to sorted nearest
Python
bsd-3-clause
pyranges/sorted_nearest,pyranges/sorted_nearest,pyranges/sorted_nearest
8c5386209fb859a30ea160fd5a1ac1303b9574ea
batch_related.py
batch_related.py
#!/usr/bin/env python import datetime import logging import api def get_now_str(): format = '%d.%h-%H:%M:%S' now = datetime.datetime.now() now_str = datetime.datetime.strftime(now, format) return now_str if __name__ == '__main__': collections = api.SEARCHABLE_COLLECTIONS api.logger.setLeve...
#!/usr/bin/env python import datetime import logging import api def get_now_str(): format = '%d.%h-%H:%M:%S' now = datetime.datetime.now() now_str = datetime.datetime.strftime(now, format) return now_str if __name__ == '__main__': collections = api.SEARCHABLE_COLLECTIONS api.logger.setLeve...
Use the updated pymongo syntax for mongo snapshot cursor
Use the updated pymongo syntax for mongo snapshot cursor
Python
agpl-3.0
Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back,Beit-Hatfutsot/dbs-back
30b4003b22ab12bcc83013c63903dad7e36a5374
webserver/codemanagement/urls.py
webserver/codemanagement/urls.py
from django.conf.urls.defaults import patterns, url, include from piston.resource import Resource from .views import (CreateRepoView, UpdatePasswordView, ListSubmissionView, SubmitView) from .api_handlers import RepoAuthHandler, RepoPathHandler, RepoTagListHandler urlpatterns = patterns( "", ...
from django.conf.urls.defaults import patterns, url, include from piston.resource import Resource from .views import (CreateRepoView, UpdatePasswordView, ListSubmissionView, SubmitView) from .api_handlers import RepoAuthHandler, RepoPathHandler, RepoTagListHandler urlpatterns = patterns( "", ...
Fix URL name for submission page
Fix URL name for submission page
Python
bsd-3-clause
siggame/webserver,siggame/webserver,siggame/webserver
44b709f57dfaa12f158caf32c2032f1455443298
serializer.py
serializer.py
# -*- coding: utf-8 -*- # This file is part of the pymfony package. # # (c) Alexandre Quercia <alquerci@email.com> # # For the full copyright and license information, please view the LICENSE # file that was distributed with this source code. from __future__ import absolute_import; from pickle import dumps; from pickl...
# -*- coding: utf-8 -*- # This file is part of the pymfony package. # # (c) Alexandre Quercia <alquerci@email.com> # # For the full copyright and license information, please view the LICENSE # file that was distributed with this source code. from __future__ import absolute_import; from pickle import dumps; from pickl...
Use pickle protocole 2 to BC for Python2*
[System][Serializer] Use pickle protocole 2 to BC for Python2*
Python
mit
pymfony/system
fa66f44cf9783e790a2758b255ad740e712dc667
heufybot/output.py
heufybot/output.py
class OutputHandler(object): def __init__(self, connection): self.connection = connection def cmdNICK(self, nick): self.connection.sendMessage("NICK", nick) def cmdUSER(self, ident, gecos): # RFC2812 allows usermodes to be set, but this isn't implemented much in IRCds at all. ...
class OutputHandler(object): def __init__(self, connection): self.connection = connection def cmdNICK(self, nick): self.connection.sendMessage("NICK", nick) def cmdQUIT(self, reason): self.connection.sendMessage("QUIT", ":{}".format(reason)) def cmdUSER(self, ident, gecos): ...
Put commands in alphabetical order for my own sanity
Put commands in alphabetical order for my own sanity
Python
mit
Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot
7106317db23165220754f1cf45e7a8d30a9a76db
dyfunconn/fc/cos.py
dyfunconn/fc/cos.py
# """ """ from ..analytic_signal import analytic_signal import numpy as np def cos(data, fb=None, fs=None, pairs=None): """ """ n_samples, n_rois = np.shape(data) X = None if fb is not None and fs is not None: _, uphases, _ = analytic_signal(data, fb, fs) X = uphases else...
# """ """ from ..analytic_signal import analytic_signal import numpy as np def cos(data, fb=None, fs=None, pairs=None): """ """ n_rois, n_samples = np.shape(data) X = None if fb is not None and fs is not None: _, uphases, _ = analytic_signal(data, fb, fs) X = uphases else...
Change the order of shape.
Change the order of shape.
Python
bsd-3-clause
makism/dyfunconn
85814828d2caedd8612db6ce0ecec92025a34330
tests/test_main.py
tests/test_main.py
from cookiecutter.main import is_repo_url def test_is_repo_url(): """Verify is_repo_url works.""" assert is_repo_url('gitolite@server:team/repo') is True assert is_repo_url('git@github.com:audreyr/cookiecutter.git') is True assert is_repo_url('https://github.com/audreyr/cookiecutter.git') is True ...
from cookiecutter.main import is_repo_url def test_is_repo_url(): """Verify is_repo_url works.""" assert is_repo_url('gitolite@server:team/repo') is True assert is_repo_url('git@github.com:audreyr/cookiecutter.git') is True assert is_repo_url('https://github.com/audreyr/cookiecutter.git') is True ...
Add test for bitbucket domain
Add test for bitbucket domain
Python
bsd-3-clause
michaeljoseph/cookiecutter,Springerle/cookiecutter,Springerle/cookiecutter,venumech/cookiecutter,cguardia/cookiecutter,luzfcb/cookiecutter,pjbull/cookiecutter,agconti/cookiecutter,willingc/cookiecutter,audreyr/cookiecutter,audreyr/cookiecutter,venumech/cookiecutter,takeflight/cookiecutter,dajose/cookiecutter,takeflight...
0de3f3380eda3ed541fbf37243e13243a5ad6e1e
tests/test_open.py
tests/test_open.py
#!/usr/bin/env python import unittest import yv_suggest.open as yvs import inspect class OpenTestCase(unittest.TestCase): '''test the handling of Bible reference URLs''' def test_url(self): '''should build correct URL to Bible reference''' url = yvs.get_ref_url('esv/jhn.3.16') self.ass...
#!/usr/bin/env python import unittest import yv_suggest.open as yvs import inspect class WebbrowserMock(object): '''mock the builtin webbrowser module''' def open(self, url): '''mock the webbrowser.open() function''' self.url = url class OpenTestCase(unittest.TestCase): '''test the handli...
Add unit test for opening bible reference urls
Add unit test for opening bible reference urls
Python
mit
caleb531/youversion-suggest,caleb531/youversion-suggest
006f957d8b6d747ad701d7b39a411df8f562f17f
modules/karmamod.py
modules/karmamod.py
"""Keeps track of karma counts. @package ppbot @syntax .karma <item> """ import re from modules import * class Karmamod(Module): def __init__(self, *args, **kwargs): """Constructor""" Module.__init__(self, kwargs=kwargs) def _register_events(self): self.add_command('karma', 'get_ka...
"""Keeps track of karma counts. @package ppbot @syntax .karma <item> """ import re from modules import * class Karmamod(Module): def __init__(self, *args, **kwargs): """Constructor""" Module.__init__(self, kwargs=kwargs) def _register_events(self): self.add_command('karma', 'get_ka...
Change to reply only if target has karma
Change to reply only if target has karma
Python
mit
billyvg/piebot
a4d1659197c0c3da706065d5362fd3b060223c87
newaccount/views.py
newaccount/views.py
from django.shortcuts import render from django.http import JsonResponse import common.render from common.settings import get_page_config def form(request): ''' The signup form webpage ''' context = get_page_config(title='New User Sign Up') context['form'] = [ {'label': 'User Name', 'name': 'usern...
from django.http import JsonResponse from django.contrib.auth.models import User from django.core.validators import validate_email from django.core.exceptions import ValidationError from django.shortcuts import render import urllib import common.render from common.settings import get_page_config def form(request): ...
Implement backend newaccount form verification
Implement backend newaccount form verification
Python
mit
NicolasKiely/Robit-Tracker,NicolasKiely/Robit-Tracker,NicolasKiely/Robit-Tracker
1e562decdc03295dec4cb37d26162e5d9aa31079
neutron/tests/common/agents/l3_agent.py
neutron/tests/common/agents/l3_agent.py
# Copyright 2014 Red Hat, 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 agre...
# Copyright 2014 Red Hat, 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 agre...
Update L3 agent drivers singletons to look at new agent
Update L3 agent drivers singletons to look at new agent L3 agent drivers are singletons. They're created once, and hold self.l3_agent. During testing, the agent is tossed away and re-built, but the drivers singletons are pointing at the old agent, and its old configuration. Change-Id: Ie8a15318e71ea47cccad3b788751d91...
Python
apache-2.0
JianyuWang/neutron,SmartInfrastructures/neutron,eayunstack/neutron,skyddv/neutron,MaximNevrov/neutron,watonyweng/neutron,gkotton/neutron,openstack/neutron,mandeepdhami/neutron,glove747/liberty-neutron,projectcalico/calico-neutron,SamYaple/neutron,takeshineshiro/neutron,dims/neutron,watonyweng/neutron,miyakz1192/neutron...
a2826203584c6f42b8e48a9eb9285d3a90983b98
rts/urls.py
rts/urls.py
from django.conf.urls import patterns, include, url from django.core.urlresolvers import reverse from django.views.generic.base import RedirectView from django.contrib import admin admin.autodiscover() urlpatterns = patterns( '', url(r'^$', RedirectView.as_view(url=reverse('admin:index')), name='home'), u...
from django.conf.urls import patterns, include, url from django.core.urlresolvers import reverse_lazy from django.views.generic.base import RedirectView from django.contrib import admin admin.autodiscover() urlpatterns = patterns( '', url(r'^$', RedirectView.as_view(url=reverse_lazy('admin:index')), n...
Use reverse_lazy to avoid weird url setup circularity.
Use reverse_lazy to avoid weird url setup circularity.
Python
bsd-3-clause
praekelt/go-rts-zambia
b4a2214d84884148760623eb655ac9e538b27370
planterbox/tests/test_hooks/__init__.py
planterbox/tests/test_hooks/__init__.py
from planterbox import ( step, hook, ) hooks_run = set() @hook('before', 'feature') def before_feature_hook(feature_suite): global hooks_run hooks_run.add(('before', 'feature')) @hook('before', 'scenario') def before_scenario_hook(scenario_test): global hooks_run hooks_run.add(('before', '...
from planterbox import ( step, hook, ) hooks_run = set() @hook('before', 'feature') def before_feature_hook(feature_suite): global hooks_run hooks_run.add(('before', 'feature')) @hook('before', 'scenario') def before_scenario_hook(test): global hooks_run hooks_run.add(('before', 'scenario'...
Clarify arguments in tests slightly
Clarify arguments in tests slightly
Python
mit
npilon/planterbox
229d1f1611f7372e43ae5f638b9fcb15fe395432
notebooks/demo/services/common/tools.py
notebooks/demo/services/common/tools.py
import csv import os HERE = os.path.dirname(os.path.abspath(__file__)) def load_db(): with open(os.path.join(HERE, 'The_Haiti_Earthquake_Database.csv')) as f: reader = csv.DictReader(f) for elt in reader: del elt[''] yield elt HAITI_DB = list(load_db())
# -*- coding: utf-8 -*- import csv import os import re HERE = os.path.dirname(os.path.abspath(__file__)) def sexa_to_dec(dh, min, secs, sign): return sign*(dh + float(min)/60 + float(secs)/60**2) def string_to_dec(s, neg): parsed = filter( None, re.split('[\'" °]', unicode(s, 'utf-8'))) sign ...
Return geo coordinates in decimal
Return geo coordinates in decimal
Python
mit
DesignSafe-CI/adama_example
70aa7af1a5da51813a09da4f9671e293c4a01d91
util/connection.py
util/connection.py
import os from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from sqlalchemy.orm.scoping import scoped_session from sqlalchemy.pool import NullPool DB_URL = os.environ.get('DB_URL') if not DB_URL: raise ValueError("DB_URL not present in th...
import os from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from sqlalchemy.orm.scoping import scoped_session from sqlalchemy.pool import NullPool AIRFLOW_CONN_MYSQL_TRACKER = os.environ.get('AIRFLOW_CONN_MYSQL_TRACKER') if not AIRFLOW_CONN_M...
Add Mysql Tracker database to store our data
Add Mysql Tracker database to store our data
Python
apache-2.0
LREN-CHUV/data-factory-airflow-dags,LREN-CHUV/airflow-mri-preprocessing-dags,LREN-CHUV/data-factory-airflow-dags,LREN-CHUV/airflow-mri-preprocessing-dags
07ef73f98e85919863af43f9c50bde85a143660d
conf_site/reviews/admin.py
conf_site/reviews/admin.py
from django.contrib import admin from conf_site.reviews.models import ( ProposalFeedback, ProposalNotification, ProposalResult, ProposalVote, ) class ProposalInline(admin.StackedInline): model = ProposalNotification.proposals.through @admin.register(ProposalFeedback) class ProposalFeedbackAdmin...
from django.contrib import admin from conf_site.reviews.models import ( ProposalFeedback, ProposalNotification, ProposalResult, ProposalVote, ) class ProposalInline(admin.StackedInline): model = ProposalNotification.proposals.through @admin.register(ProposalFeedback) class ProposalFeedbackAdmin...
Enable filtering ProposalVotes by reviewer.
Enable filtering ProposalVotes by reviewer.
Python
mit
pydata/conf_site,pydata/conf_site,pydata/conf_site
ff65853def5bf1044fe457362f85b8aecca66152
tests/laser/transaction/create.py
tests/laser/transaction/create.py
import mythril.laser.ethereum.transaction as transaction from mythril.ether import util import mythril.laser.ethereum.svm as svm from mythril.disassembler.disassembly import Disassembly from datetime import datetime from mythril.ether.soliditycontract import SolidityContract import tests from mythril.analysis.security ...
from mythril.laser.ethereum.transaction import execute_contract_creation from mythril.ether import util import mythril.laser.ethereum.svm as svm from mythril.disassembler.disassembly import Disassembly from datetime import datetime from mythril.ether.soliditycontract import SolidityContract import tests from mythril.an...
Update test to reflect the refactor
Update test to reflect the refactor
Python
mit
b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril
77e4fb7ef74bcfd58b548cca8ec9898eb936e7ef
conanfile.py
conanfile.py
from conans import ConanFile, CMake class EsappConan(ConanFile): name = 'esapp' version = '0.4.1' url = 'https://github.com/jason2506/esapp' license = 'BSD 3-Clause' author = 'Chi-En Wu' requires = 'desa/0.1.0@jason2506/testing' settings = 'os', 'compiler', 'build_type', 'arch' gene...
from conans import ConanFile, CMake class EsappConan(ConanFile): name = 'esapp' version = '0.4.1' url = 'https://github.com/jason2506/esapp' license = 'BSD 3-Clause' author = 'Chi-En Wu' requires = 'desa/0.1.0@jason2506/testing' settings = 'os', 'compiler', 'build_type', 'arch' gene...
Remove default option for `desa`
Remove default option for `desa`
Python
bsd-3-clause
jason2506/esapp,jason2506/esapp
5b5f891b6ee714966eefed1adfbd366eb078210f
webpack_resolve.py
webpack_resolve.py
import json import os import wiki PROJECT_ROOT_DIRECTORY = os.path.dirname(globals()['__file__']) DJANGO_WIKI_STATIC = os.path.join(os.path.dirname(wiki.__file__), 'static') # This whole file is essentially just a big ugly hack. # For webpack to properly build wiki static files it needs the absolute path to the wiki ...
import json import os import wiki DJANGO_WIKI_STATIC = os.path.join(os.path.dirname(wiki.__file__), 'static') WEBPACK_RESOLVE_FILE = 'webpack-extra-resolve.json' # This whole file is essentially just a big ugly hack. # For webpack to properly build wiki static files it needs the absolute path to the wiki # static fol...
Remove unnecessary project root variable from webpack resolve script
Remove unnecessary project root variable from webpack resolve script
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
fdf05b0fa93c350d2cd030e451b0e26ed7393209
tests/clientlib/validate_manifest_test.py
tests/clientlib/validate_manifest_test.py
import pytest from pre_commit.clientlib.validate_manifest import additional_manifest_check from pre_commit.clientlib.validate_manifest import InvalidManifestError from pre_commit.clientlib.validate_manifest import run def test_returns_0_for_valid_manifest(): assert run(['example_manifest.yaml']) == 0 def test...
import jsonschema import jsonschema.exceptions import pytest from pre_commit.clientlib.validate_manifest import additional_manifest_check from pre_commit.clientlib.validate_manifest import InvalidManifestError from pre_commit.clientlib.validate_manifest import MANIFEST_JSON_SCHEMA from pre_commit.clientlib.validate_m...
Add better tests for manifest json schema
Add better tests for manifest json schema
Python
mit
chriskuehl/pre-commit,pre-commit/pre-commit,philipgian/pre-commit,beni55/pre-commit,Lucas-C/pre-commit,barrysteyn/pre-commit,Lucas-C/pre-commit,Lucas-C/pre-commit,dnephin/pre-commit,philipgian/pre-commit,dnephin/pre-commit,Teino1978-Corp/pre-commit,philipgian/pre-commit,chriskuehl/pre-commit,chriskuehl/pre-commit-1,dne...
ba93ea71b87c95f4d52c85ae652496ebfb012e1f
pupa/importers/memberships.py
pupa/importers/memberships.py
from .base import BaseImporter class MembershipImporter(BaseImporter): _type = 'membership' def __init__(self, jurisdiction_id, person_importer, org_importer): super(MembershipImporter, self).__init__(jurisdiction_id) self.person_importer = person_importer self.org_importer = org_impo...
from .base import BaseImporter class MembershipImporter(BaseImporter): _type = 'membership' def __init__(self, jurisdiction_id, person_importer, org_importer): super(MembershipImporter, self).__init__(jurisdiction_id) self.person_importer = person_importer self.org_importer = org_impo...
Add unmatched_legislator to the spec
Add unmatched_legislator to the spec
Python
bsd-3-clause
datamade/pupa,datamade/pupa,rshorey/pupa,mileswwatkins/pupa,rshorey/pupa,mileswwatkins/pupa,opencivicdata/pupa,influence-usa/pupa,influence-usa/pupa,opencivicdata/pupa
8a534a9927ac0050b3182243c2b8bbf59127549e
test/multiple_invocations_test.py
test/multiple_invocations_test.py
# Copyright (c) 2012 - 2014 Lars Hupfeldt Nielsen, Hupfeldt IT # All rights reserved. This work is under a BSD license, see LICENSE.TXT. from jenkinsflow.flow import serial from .framework import mock_api def test_multiple_invocations_immediate(): with mock_api.api(__file__) as api: api.flow_job() ...
# Copyright (c) 2012 - 2014 Lars Hupfeldt Nielsen, Hupfeldt IT # All rights reserved. This work is under a BSD license, see LICENSE.TXT. from jenkinsflow.flow import serial from .framework import mock_api def test_multiple_invocations_same_flow(): with mock_api.api(__file__) as api: api.flow_job() ...
Test two flow invocations after each other
Test two flow invocations after each other
Python
bsd-3-clause
lechat/jenkinsflow,lhupfeldt/jenkinsflow,lhupfeldt/jenkinsflow,lechat/jenkinsflow,lechat/jenkinsflow,lhupfeldt/jenkinsflow,lhupfeldt/jenkinsflow,lechat/jenkinsflow
fc7db2a55ad3f612ac6ef01cfa57ce03040708a5
evelink/__init__.py
evelink/__init__.py
"""EVELink - Python bindings for the EVE API.""" import logging from evelink import account from evelink import api from evelink import char from evelink import constants from evelink import corp from evelink import eve from evelink import map from evelink import parsing from evelink import server # Implement NullHa...
"""EVELink - Python bindings for the EVE API.""" import logging from evelink import account from evelink import api from evelink import char from evelink import constants from evelink import corp from evelink import eve from evelink import map from evelink import server # Implement NullHandler because it was only ad...
Remove parsing from public interface
Remove parsing from public interface
Python
mit
zigdon/evelink,FashtimeDotCom/evelink,bastianh/evelink,ayust/evelink,Morloth1274/EVE-Online-POCO-manager
46df020f5f349ac02c509e334ffd7e1f5970915b
detectem/exceptions.py
detectem/exceptions.py
class DockerStartError(Exception): pass class NotNamedParameterFound(Exception): pass class SplashError(Exception): def __init__(self, msg): self.msg = 'Splash error: {}'.format(msg) super().__init__(msg) class NoPluginsError(Exception): def __init__(self, msg): self.msg = ...
class DockerStartError(Exception): pass class NotNamedParameterFound(Exception): pass class SplashError(Exception): def __init__(self, msg): self.msg = 'Splash error: {}'.format(msg) super().__init__(self.msg) class NoPluginsError(Exception): def __init__(self, msg): self.m...
Fix in tests for exception messages
Fix in tests for exception messages
Python
mit
spectresearch/detectem
0aaa546435a261a03e27fee53a3c5f334cca6b66
spacy/tests/regression/test_issue768.py
spacy/tests/regression/test_issue768.py
# coding: utf-8 from __future__ import unicode_literals from ...language import Language from ...attrs import LANG from ...fr.language_data import TOKENIZER_EXCEPTIONS, STOP_WORDS from ...language_data.punctuation import TOKENIZER_INFIXES, ALPHA import pytest @pytest.fixture def fr_tokenizer_w_infix(): SPLIT_IN...
# coding: utf-8 from __future__ import unicode_literals from ...language import Language from ...attrs import LANG from ...fr.language_data import get_tokenizer_exceptions, STOP_WORDS from ...language_data.punctuation import TOKENIZER_INFIXES, ALPHA import pytest @pytest.fixture def fr_tokenizer_w_infix(): SPLI...
Fix test after updating the French tokenizer stuff
Fix test after updating the French tokenizer stuff
Python
mit
raphael0202/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,banglakit/spaCy,banglakit/spaCy,raphael0202/spaCy,recognai/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,oroszgy/spaCy.hu,explosion/spaCy,Gregory-Howard/spaCy,spacy-io/spaCy,banglakit/spaCy,banglakit/spaCy,explosion/sp...
6f2db6743f431019a46a2b977cb17dd6f0622fbd
yolodex/urls.py
yolodex/urls.py
from django.conf.urls import patterns, url, include from django.utils.translation import ugettext as _ from .views import ( RealmView, EntityDetailView, EntityNetworkView, ) entity_urls = [ url(r'^$', RealmView.as_view(), name='overview'), url(r'^(?P<type>[\w-]+)/(?P<slug>[\w-]+)/$', Entit...
from django.conf.urls import patterns, url, include from django.utils.translation import ugettext as _ from .views import ( RealmView, EntityDetailView, EntityNetworkView, ) entity_urls = [ url(r'^$', RealmView.as_view(), name='overview'), url(r'^(?P<type>[\w-]+)/(?P<slug>[\w-]+)/$', Entit...
Fix name of entity graph url
Fix name of entity graph url
Python
mit
correctiv/django-yolodex,correctiv/django-yolodex,correctiv/django-yolodex
9af4f3bc2ddc07e47f311ae51e20e3f99733ea35
Orange/tests/test_regression.py
Orange/tests/test_regression.py
import unittest import inspect import pkgutil import Orange from Orange.data import Table from Orange.regression import Learner class RegressionLearnersTest(unittest.TestCase): def all_learners(self): regression_modules = pkgutil.walk_packages( path=Orange.regression.__path__, pre...
import unittest import inspect import pkgutil import traceback import Orange from Orange.data import Table from Orange.regression import Learner class RegressionLearnersTest(unittest.TestCase): def all_learners(self): regression_modules = pkgutil.walk_packages( path=Orange.regression.__path__...
Handle TypeError while testing all regression learners
Handle TypeError while testing all regression learners
Python
bsd-2-clause
qPCR4vir/orange3,marinkaz/orange3,cheral/orange3,kwikadi/orange3,kwikadi/orange3,kwikadi/orange3,marinkaz/orange3,qPCR4vir/orange3,cheral/orange3,marinkaz/orange3,cheral/orange3,marinkaz/orange3,marinkaz/orange3,qPCR4vir/orange3,cheral/orange3,qPCR4vir/orange3,kwikadi/orange3,kwikadi/orange3,qPCR4vir/orange3,cheral/ora...
441da7a34058733c298c81dbd97a35fca6e538e0
pgpdump/__main__.py
pgpdump/__main__.py
import sys import cProfile from . import AsciiData, BinaryData def parsefile(name): with open(name) as infile: if name.endswith('.asc'): data = AsciiData(infile.read()) else: data = BinaryData(infile.read()) counter = 0 for packet in data.packets(): counter ...
import sys from . import AsciiData, BinaryData def parsefile(name): with open(name, 'rb') as infile: if name.endswith('.asc'): data = AsciiData(infile.read()) else: data = BinaryData(infile.read()) counter = 0 for packet in data.packets(): counter += 1 ...
Remove cProfile inclusion, always read file as binary
Remove cProfile inclusion, always read file as binary Signed-off-by: Dan McGee <2591e5f46f28d303f9dc027d475a5c60d8dea17a@archlinux.org>
Python
bsd-3-clause
toofishes/python-pgpdump
8b87a55a03422cc499b2f7cc168bcc0c15c0ae42
mycli/clibuffer.py
mycli/clibuffer.py
from prompt_toolkit.buffer import Buffer from prompt_toolkit.filters import Condition class CLIBuffer(Buffer): def __init__(self, always_multiline, *args, **kwargs): self.always_multiline = always_multiline @Condition def is_multiline(): doc = self.document return s...
from prompt_toolkit.buffer import Buffer from prompt_toolkit.filters import Condition class CLIBuffer(Buffer): def __init__(self, always_multiline, *args, **kwargs): self.always_multiline = always_multiline @Condition def is_multiline(): doc = self.document return s...
Make \G or \g to end a query.
Make \G or \g to end a query.
Python
bsd-3-clause
j-bennet/mycli,jinstrive/mycli,mdsrosa/mycli,evook/mycli,shoma/mycli,chenpingzhao/mycli,mdsrosa/mycli,D-e-e-m-o/mycli,evook/mycli,jinstrive/mycli,martijnengler/mycli,webwlsong/mycli,webwlsong/mycli,oguzy/mycli,suzukaze/mycli,oguzy/mycli,danieljwest/mycli,MnO2/rediscli,danieljwest/mycli,martijnengler/mycli,D-e-e-m-o/myc...
b02d7e1e288eeaf38cfc299765f4c940bad5ea36
examples/add_misc_features.py
examples/add_misc_features.py
#!/usr/bin/env python # # Add a singleton feature to the misc column of all tokens of a certain form. # # Format # add_misc_features.py filename > transform.conll # import argparse import pyconll parser = argparse.ArgumentParser() parser.add_argument('filename', help='The name of the file to transform') args = pa...
#!/usr/bin/env python # # Add a singleton feature to the misc column of all tokens of a certain form. # # Format # add_misc_features.py filename > transform.conll # import argparse import pyconll parser = argparse.ArgumentParser() parser.add_argument('filename', help='The name of the file to transform') args = pa...
Update example with correct form, and with comment.
Update example with correct form, and with comment.
Python
mit
pyconll/pyconll,pyconll/pyconll
94e822e67f3550710347f563ae1d32e301d2e08b
raven/processors.py
raven/processors.py
""" raven.core.processors ~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ class Processor(object): def __init__(self, client): self.client = client def process(self, data, **kwargs): resp = self.get_...
""" raven.core.processors ~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ class Processor(object): def __init__(self, client): self.client = client def process(self, data, **kwargs): resp = self.get...
Handle var names that are uppercase
Handle var names that are uppercase
Python
bsd-3-clause
smarkets/raven-python,patrys/opbeat_python,ronaldevers/raven-python,ronaldevers/raven-python,recht/raven-python,danriti/raven-python,lepture/raven-python,Goldmund-Wyldebeast-Wunderliebe/raven-python,nikolas/raven-python,akalipetis/raven-python,johansteffner/raven-python,beniwohli/apm-agent-python,dbravender/raven-pytho...
26a53141e844c11e7ff904af2620b7ee125b011d
diana/tracking.py
diana/tracking.py
from . import packet as p class Tracker: def __init__(self): self.objects = {} def update_object(self, record): try: oid = record['object'] except KeyError: return else: self.objects.setdefault(oid, {}).update(record) def remove_object(s...
from . import packet as p class Tracker: def __init__(self): self.objects = {} @property def player_ship(self): for _obj in self.objects.values(): if _obj['type'] == p.ObjectType.player_vessel: return _obj return {} def update_object(self, record): ...
Add a convenience method to get the player ship
Add a convenience method to get the player ship
Python
mit
prophile/libdiana
7ca4b1652dc5fa35bbacc2d587addacc9ce9da83
fuzzinator/call_job.py
fuzzinator/call_job.py
# Copyright (c) 2016 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. import hashlib class CallJob(object): """ Base class for jobs...
# Copyright (c) 2016-2018 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. import hashlib class CallJob(object): """ Base class for...
Prepare test hashing for complex types.
Prepare test hashing for complex types.
Python
bsd-3-clause
renatahodovan/fuzzinator,renatahodovan/fuzzinator,renatahodovan/fuzzinator,renatahodovan/fuzzinator,akosthekiss/fuzzinator,akosthekiss/fuzzinator,akosthekiss/fuzzinator,akosthekiss/fuzzinator
73a4aca6e9c0c4c9ef53e498319bf754c6bb8edb
rippl/rippl/urls.py
rippl/rippl/urls.py
"""rippl URL Configuration""" from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView from .registration.forms import RecaptchaRegView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^accounts/register/$', RecaptchaRegView.as_view()), ...
"""rippl URL Configuration""" from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView from .registration.forms import RecaptchaRegView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^accounts/register/$', RecaptchaRegView.as_view()), ...
Fix line length to pass CI
Fix line length to pass CI
Python
mit
gnmerritt/dailyrippl,gnmerritt/dailyrippl,gnmerritt/dailyrippl,gnmerritt/dailyrippl
1b9d453f6fe0d2128849f98922f082d6ccfbee69
channelfilter.py
channelfilter.py
#!/usr/bin/env python import os import yaml class ChannelFilter(object): def __init__(self, path=None): if path is None: path = os.path.join(os.path.dirname(__file__), 'channels.yaml') with open(path) as f: self.config = yaml.load(f) print(self.config) @prope...
#!/usr/bin/env python import os import yaml class ChannelFilter(object): def __init__(self, path=None): if path is None: path = os.path.join(os.path.dirname(__file__), 'channels.yaml') with open(path) as f: self.config = yaml.load(f) print(self.config) @prope...
Fix channel filtering to work properly
Fix channel filtering to work properly
Python
mit
wikimedia/labs-tools-wikibugs2,wikimedia/labs-tools-wikibugs2
8ddc1e40dd505aeb1b28d05238fa198eb3260f94
fireplace/cards/tgt/hunter.py
fireplace/cards/tgt/hunter.py
from ..utils import * ## # Minions # Ram Wrangler class AT_010: play = Find(FRIENDLY_MINIONS + BEAST) & Summon(CONTROLLER, RandomBeast()) ## # Spells # Lock and Load class AT_061: play = Buff(FRIENDLY_HERO, "AT_061e") class AT_061e: events = OWN_SPELL_PLAY.on( Give(CONTROLLER, RandomCollectible(card_class=C...
from ..utils import * ## # Minions # Ram Wrangler class AT_010: play = Find(FRIENDLY_MINIONS + BEAST) & Summon(CONTROLLER, RandomBeast()) # Stablemaster class AT_057: play = Buff(TARGET, "AT_057o") # Brave Archer class AT_059: inspire = Find(CONTROLLER_HAND) | Hit(ENEMY_HERO, 2) ## # Spells # Powershot cla...
Implement more TGT Hunter cards
Implement more TGT Hunter cards
Python
agpl-3.0
smallnamespace/fireplace,Ragowit/fireplace,Ragowit/fireplace,amw2104/fireplace,NightKev/fireplace,liujimj/fireplace,jleclanche/fireplace,Meerkov/fireplace,oftc-ftw/fireplace,liujimj/fireplace,amw2104/fireplace,Meerkov/fireplace,oftc-ftw/fireplace,beheh/fireplace,smallnamespace/fireplace
26e0d89e5178fb05b95f56cbef58ac37bfa6f1d9
camera_opencv.py
camera_opencv.py
import cv2 from base_camera import BaseCamera class Camera(BaseCamera): video_source = 0 @staticmethod def set_video_source(source): Camera.video_source = source @staticmethod def frames(): camera = cv2.VideoCapture(Camera.video_source) if not camera.isOpened(): ...
import os import cv2 from base_camera import BaseCamera class Camera(BaseCamera): video_source = 0 def __init__(self): if os.environ.get('OPENCV_CAMERA_SOURCE'): Camera.set_video_source(int(os.environ['OPENCV_CAMERA_SOURCE'])) super(Camera, self).__init__() @staticmethod ...
Use OPENCV_CAMERA_SOURCE environment variable to set source
Use OPENCV_CAMERA_SOURCE environment variable to set source
Python
mit
miguelgrinberg/flask-video-streaming,miguelgrinberg/flask-video-streaming
b41ac0e6a5f4518b261b9106c2fbce7c55b3b9a5
python/test/test_survey_submit.py
python/test/test_survey_submit.py
#!/usr/bin/env python import sys sys.path += ['../'] from epidb.client import EpiDBClient data = 'data' client = EpiDBClient() res = client.survey_submit(data) print res
#!/usr/bin/env python import sys sys.path += ['../'] from epidb.client import EpiDBClient key = '0123456789abcdef0123456789abcdef01234567' data = 'data' client = EpiDBClient(key) res = client.survey_submit(data) print res
Update example to use api-key.
[python] Update example to use api-key.
Python
agpl-3.0
ISIFoundation/influenzanet-epidb-client
f034f69a24cd2a4048e23c54c73badd0674eb1aa
views/base.py
views/base.py
from datetime import datetime, timedelta from flask import Blueprint, render_template from sqlalchemy import and_ from models import Event blueprint = Blueprint("base", __name__) @blueprint.route("/") def index(): upcoming = Event.query.filter_by(published=True).order_by(Event.start_time).first() return re...
from datetime import datetime, timedelta from flask import Blueprint, render_template from sqlalchemy import and_ from models import Event blueprint = Blueprint("base", __name__) @blueprint.route("/") def index(): upcoming = Event.query.filter_by(published=True).order_by(Event.start_time).first() return re...
Fix the events page, so that upcoming event shows up.
Fix the events page, so that upcoming event shows up.
Python
mit
saseumn/website,saseumn/website
3f48d0fb0e44d35f29990c0d32c032ecee8fbe65
conftest.py
conftest.py
import os from django import get_version from django.conf import settings def pytest_report_header(config): return 'django: ' + get_version() def pytest_configure(): if not settings.configured: os.environ['DJANGO_SETTINGS_MODULE'] = 'base.settings' os.environ['DJANGO_CONFIGURATION'] = 'Test...
import os from django import get_version from django.conf import settings def pytest_report_header(config): return 'django: ' + get_version() def pytest_configure(): import dotenv dotenv.read_dotenv() if not settings.configured: os.environ['DJANGO_SETTINGS_MODULE'] = 'base.settings' ...
Read our .env when we test.
Read our .env when we test.
Python
apache-2.0
hello-base/web,hello-base/web,hello-base/web,hello-base/web
8a663ecc384a1b0d43f554b894571103348ad7ab
responsive_design_helper/views.py
responsive_design_helper/views.py
from django.views.generic import TemplateView class ResponsiveTestView(TemplateView): template_name = "responsive_design_helper/%s.html" def get_template_names(self, **kwargs): t = self.kwargs.get('type', 'all') or 'all' return self.template_name % t def get_context_data(self, **kwargs):...
from django.views.generic import TemplateView class ResponsiveTestView(TemplateView): template_name = "responsive_design_helper/%s.html" def get_template_names(self, **kwargs): t = self.kwargs.get('type', 'all') or 'all' return self.template_name % t def get_context_data(self, **kwargs):...
Adjust so it works properly with types
Adjust so it works properly with types
Python
apache-2.0
tswicegood/django-responsive-design-helper,tswicegood/django-responsive-design-helper
005ac5832a4992c2d1091505c2be10ae6ad34ef5
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" OR "username:password@ip_address:po...
""" 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" OR "username:password@ip_address:po...
Update the example proxy list
Update the example proxy list
Python
mit
mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase
eda35123356edd20b361aa2f1d1f20cc7b922e39
settings_example.py
settings_example.py
import os import re from imap import EmailCheckError, EmailServer from postgresql import DatabaseServer CSV_FOLDER = os.getcwd() # Restrict emails by sender. EMAIL_FROM = 'sender@example.com' # Restrict emails by subject. EMAIL_SUBJECT_RE = re.compile(''.join([ r'(?P<year>\d{4})', r'(?P<month>\d{2})', r'(?P<day...
import os import re from imap import EmailCheckError, EmailServer from postgresql import DatabaseServer CSV_FOLDER = os.getcwd() CSV_NAME_FORMAT = '{year}-{month}-{day}T{hour}{minute}.csv' # Restrict emails by sender. EMAIL_FROM = 'sender@example.com' # Restrict emails by subject. EMAIL_SUBJECT_RE = re.compile(''...
Add CSV file name format setting example
Add CSV file name format setting example
Python
mit
AustralianAntarcticDataCentre/save_emails_to_files,AustralianAntarcticDataCentre/save_emails_to_files
020d6e2bff5975aad79833bdf28c6a791e7953d1
instabrade/__init__.py
instabrade/__init__.py
from __future__ import absolute_import from collections import namedtuple import pbr.version __version__ = pbr.version.VersionInfo('instabrade').version_string() PageID = namedtuple("PageID", "name css_path attr attr_value") LOG_IN_IDENTIFIER = PageID(name='Log In Page Identifier', css_...
from __future__ import absolute_import from collections import namedtuple from pbr.version import VersionInfo __version__ = VersionInfo('instabrade').semantic_version().release_string() PageID = namedtuple("PageID", "name css_path attr attr_value") LOG_IN_IDENTIFIER = PageID(name='Log In Page Identifier', ...
Update how version is determined
Update how version is determined
Python
mit
levi-rs/instabrade
438d78058951179f947480b0340752fa9b372a9d
sqs.py
sqs.py
from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient from tornado.httputil import url_concat import datetime import hashlib import hmac class SQSRequest(HTTPRequest): """SQS AWS Adapter for Tornado HTTP request""" def __init__(self, *args, **kwargs): super(SQSRequest, self).__init__...
from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient from tornado.httputil import url_concat import datetime import hashlib import hmac class SQSRequest(HTTPRequest): """SQS AWS Adapter for Tornado HTTP request""" def __init__(self, *args, **kwargs): t = datetime.datetime.utcnow() ...
Add init code to deal with AWS HTTP API
Add init code to deal with AWS HTTP API
Python
mit
MA3STR0/AsyncAWS
d5c65f6ac2cdae3310f41efb9ab0a6d5cae63357
kopytka/managers.py
kopytka/managers.py
from django.db import models class PageQuerySet(models.QuerySet): def published(self): return self.filter(is_published=True)
from django.db import models from .transforms import SKeys class PageQuerySet(models.QuerySet): def published(self): return self.filter(is_published=True) def fragment_keys(self): return self.annotate(keys=SKeys('fragments')).values_list('keys', flat=True)
Add fragment_keys method to PageQuerySet
Add fragment_keys method to PageQuerySet
Python
mit
funkybob/kopytka,funkybob/kopytka,funkybob/kopytka