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
4065f8edc61ae9078238219dad674ae114c78003
moocng/wsgi.py
moocng/wsgi.py
""" WSGI config for moocng project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` s...
""" WSGI config for moocng project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` s...
Allow to configure the virtualenv path from the Apache configuration
Allow to configure the virtualenv path from the Apache configuration
Python
apache-2.0
OpenMOOC/moocng,GeographicaGS/moocng,GeographicaGS/moocng,GeographicaGS/moocng,OpenMOOC/moocng,GeographicaGS/moocng
bd1a244aa3d9126a12365611372e6449e47e5693
pelicanconf.py
pelicanconf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = u'Mappy' SITENAME = u'Mappy Labs' SITEURL = '' TIMEZONE = 'Europe/Paris' DEFAULT_LANG = u'en' THEME = 'theme/mappy' # Feed generation is usually not desired when developing FEED_ALL_ATOM = 'feeds/rss.xml' CATEGORY_FEED...
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = u'Mappy' SITENAME = u'Mappy Labs' SITEURL = '' TIMEZONE = 'Europe/Paris' DEFAULT_LANG = u'en' THEME = 'theme/mappy' # Feed generation is usually not desired when developing FEED_ALL_ATOM = 'feeds/rss.xml' CATEGORY_FEED...
Add links to Android/iOS apps
Add links to Android/iOS apps
Python
mit
paulgreg/mappy.github.io-source,paulgreg/mappy.github.io-source,Mappy/mappy.github.io-source,Mappy/mappy.github.io-source,paulgreg/mappy.github.io-source,Mappy/mappy.github.io-source,paulgreg/mappy.github.io-source,Mappy/mappy.github.io-source
321b627c3c7d241d6e6cc4e319911cfbcd1533fb
src/temp_functions.py
src/temp_functions.py
def k_to_c(temp): return temp - 273.15
def k_to_c(temp): return temp - 273.15 def f_to_k(temp): return ((temp - 32) * (5 / 9)) + 273.15
Write a function to covert far to kelvin
Write a function to covert far to kelvin
Python
mit
xykang/2015-05-12-BUSM-git,xykang/2015-05-12-BUSM-git
d676a1b1e7e3efbbfc72f1d7e522865b623783df
utils/etc.py
utils/etc.py
def reverse_insort(seq, val): lo = 0 hi = len(seq) while lo < hi: mid = (lo + hi) // 2 if val > seq[mid]: hi = mid else: lo = mid + 1 seq.insert(lo, val)
def reverse_insort(seq, val, lo=0, hi=None): if hi is None: hi = len(seq) while lo < hi: mid = (lo + hi) // 2 if val > seq[mid]: hi = mid else: lo = mid + 1 seq.insert(lo, val)
Add optional hi and lo params to reverse_insort
Add optional hi and lo params to reverse_insort
Python
mit
BeatButton/beattie,BeatButton/beattie-bot
b13efa6234c2748515a9c3f5a8fbb3ad43093083
test/test_device.py
test/test_device.py
from pml.exceptions import PvException import pml.device import pytest import mock @pytest.fixture def create_device(readback, setpoint): _rb = readback _sp = setpoint device = pml.device.Device(rb_pv=_rb, sp_pv=_sp, cs=mock.MagicMock()) return device def test_set_device_value(): rb_pv = 'SR01A-...
from pml.exceptions import PvException import pml.device import pytest import mock @pytest.fixture def create_device(readback, setpoint): _rb = readback _sp = setpoint device = pml.device.Device(rb_pv=_rb, sp_pv=_sp, cs=mock.MagicMock()) return device def test_set_device_value(): rb_pv = 'SR01A-...
Raise assertion error when creating a device with no pv
Raise assertion error when creating a device with no pv
Python
apache-2.0
willrogers/pml,willrogers/pml
b77622311c69cd74c9c3c3b7c66747c79ea41bec
troposphere/qldb.py
troposphere/qldb.py
# Copyright (c) 2012-2019, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 16.1.0 from troposphere import Tags from . import AWSObject, AWSProperty from .validators import boolean class ...
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 39.7.0 from troposphere import Tags from . import AWSObject, AWSProperty from .validators import boolean class ...
Update QLDB per 2021-07-22 changes
Update QLDB per 2021-07-22 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
315e6da0dc3d7424a14c65ac243af1faef36b710
test/parse_dive.py
test/parse_dive.py
#! /bin/python import argparse from xml.dom import minidom parser = argparse.ArgumentParser(description='Parse a dive in xml formt.') parser.add_argument('-f', '--file', required=True, dest='path', help='path to xml file') args = parser.parse_args() path = args.path doc = minidom.parse(path) nodes = doc.getElem...
#! /bin/python import argparse from xml.dom import minidom parser = argparse.ArgumentParser(description='Parse a dive in xml formt.') parser.add_argument('-f', '--file', required=True, dest='path', help='path to xml file') args = parser.parse_args() path = args.path doc = minidom.parse(path) nodes = doc.getElem...
Add a correct parsing of the file
Add a correct parsing of the file
Python
isc
AquaBSD/libbuhlmann,AquaBSD/libbuhlmann,AquaBSD/libbuhlmann
5a4a71aaed65bb2ea676a0ec1fa75a8a801f1013
django_enumfield/contrib/drf.py
django_enumfield/contrib/drf.py
from django.utils import six from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers class EnumField(serializers.ChoiceField): default_error_messages = {"invalid_choice": _('"{input}" is not a valid choice.')} def __init__(self, enum, **kwargs): self.enum = enum...
from django.utils import six from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers class EnumField(serializers.ChoiceField): default_error_messages = {"invalid_choice": _('"{input}" is not a valid choice.')} def __init__(self, enum, **kwargs): self.enum = enum...
Document the type of NamedEnumField properly
Document the type of NamedEnumField properly
Python
mit
5monkeys/django-enumfield
fbea1cdd96ef259e8affc87ee72d8bbaef40c00d
salt/config.py
salt/config.py
''' All salt configuration loading and defaults should be in this module ''' # Import python modules import os import sys import socket # Import third party libs import yaml def minion_config(path): ''' Reads in the minion configuration file and sets up special options ''' opts = {'master': 'mcp', ...
''' All salt configuration loading and defaults should be in this module ''' # Import python modules import os import sys import socket # Import third party libs import yaml def minion_config(path): ''' Reads in the minion configuration file and sets up special options ''' opts = {'master': 'mcp', ...
Add the default options for the salt master
Add the default options for the salt master
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
baf08cb5aedd7a75dad8f79601ce31244544a3dd
elections/uk_general_election_2015/views/parties.py
elections/uk_general_election_2015/views/parties.py
from candidates.views import PartyDetailView class UKPartyDetailView(PartyDetailView): def get_context_data(self, **kwargs): context = super(UKPartyDetailView, self).get_context_data(**kwargs) party_ec_id = context['party'].identifiers.get(scheme='electoral-commission') context['ec_url'] ...
from candidates.views import PartyDetailView from popolo.models import Identifier class UKPartyDetailView(PartyDetailView): def get_context_data(self, **kwargs): context = super(UKPartyDetailView, self).get_context_data(**kwargs) context['ec_url'] = '' context['register'] = '' try...
Fix the 'Independent' party pages for UK elections
Fix the 'Independent' party pages for UK elections There's no Electoral Commission identifier for the 'Independent' pseudo-party, so the party page for independents was failing.
Python
agpl-3.0
mysociety/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,datamade/yournextmp-popit,neavouli/yournextrepresentative,neavouli/yournextrepresentative,neavouli/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentativ...
e0f296e776e2aaed2536eeebfb4900a23973aaf5
tests/test_json.py
tests/test_json.py
from __future__ import absolute_import import fnmatch import os import unittest from . import validate_json_format class TestSettings(unittest.TestCase): def _get_json_files(self, file_pattern, folder='.'): for root, dirnames, filenames in os.walk(folder): for filename in fnmatch.filter(file...
from __future__ import absolute_import import fnmatch import os import unittest from . import validate_json_format class TestSettings(unittest.TestCase): def _get_json_files(self, file_pattern, folder='.'): for root, dirnames, filenames in os.walk(folder): for filename in fnmatch.filter(file...
Add '*.json' file extensions to test pattern list.
Add '*.json' file extensions to test pattern list.
Python
mit
jonlabelle/SublimeJsPrettier,jonlabelle/SublimeJsPrettier
ff0bae24be1dfc800dd76940f95cc4580cdc7421
rest-api/metrics_api.py
rest-api/metrics_api.py
"""The API definition for the metrics API. This defines the APIs and the handlers for the APIs. """ import api_util import metrics from protorpc import protojson from flask import request from flask.ext.restful import Resource class MetricsApi(Resource): @api_util.auth_required def post(self): resource = re...
"""The API definition for the metrics API. This defines the APIs and the handlers for the APIs. """ import api_util import metrics import json from protorpc import protojson from flask import request from flask.ext.restful import Resource class MetricsApi(Resource): @api_util.auth_required def post(self): r...
Return a JSON payload, rather than stringified JSON
Return a JSON payload, rather than stringified JSON
Python
bsd-3-clause
all-of-us/raw-data-repository,all-of-us/raw-data-repository,all-of-us/raw-data-repository
066d776041b2cae4e0435935d7f9a05173e34563
script/echo.py
script/echo.py
#!/usr/bin/env python3 # -*- coding: ascii -*- import sys import instabot NICKNAME = 'Echo' def post_cb(self, msg, meta): if msg['text'].startswith('!echo '): return msg['text'][6:] def main(): parser = instabot.argparse(sys.argv[1:]) url, nickname = None, NICKNAME for arg in parser: ...
#!/usr/bin/env python3 # -*- coding: ascii -*- import sys import instabot NICKNAME = 'Echo' def post_cb(self, msg, meta): if msg['text'].startswith('!echo '): return msg['text'][6:] def main(): parser = instabot.argparse(sys.argv[1:]) url, nickname = None, NICKNAME for arg in parser: ...
Make example bot react to SIGINT better
[Instabot] Make example bot react to SIGINT better
Python
mit
CylonicRaider/Instant,CylonicRaider/Instant,CylonicRaider/Instant,CylonicRaider/Instant,CylonicRaider/Instant
dbba9e403538fb3bfd29763b8741e07dad3db1b1
src/main/python/cfn_sphere/resolver/file.py
src/main/python/cfn_sphere/resolver/file.py
class FileResolver(object): def read(self, path): with open(path, 'r') as file: return file.read()
class FileResolver(object): def read(self, path): try: with open(path, 'r') as f: return f.read() except IOError as e: raise CfnSphereException("Cannot read file " + path, e)
Throw CfnSphereException on IOErrors. Fix landmark issue.
Throw CfnSphereException on IOErrors. Fix landmark issue.
Python
apache-2.0
cfn-sphere/cfn-sphere,cfn-sphere/cfn-sphere,ImmobilienScout24/cfn-sphere,cfn-sphere/cfn-sphere,marco-hoyer/cfn-sphere
9c3d24083be5969ca84c1625dbc0d368acdc51f8
tg/tests/test_util.py
tg/tests/test_util.py
import tg from tg.util import * from nose.tools import eq_ import os path = None def setup(): global path path = os.curdir os.chdir(os.path.abspath(os.path.dirname(os.path.dirname(tg.__file__)))) def teardown(): global path os.chdir(path) # These tests aren't reliable if the package in question h...
import tg from tg.util import * from nose.tools import eq_ import os path = None def setup(): global path path = os.curdir os.chdir(os.path.abspath(os.path.dirname(os.path.dirname(tg.__file__)))) def teardown(): global path os.chdir(path) def test_get_partial_dict(): eq_(get_partial_dict('pre...
Add a test_get_partial_dict unit test, which currently fails
Add a test_get_partial_dict unit test, which currently fails
Python
mit
lucius-feng/tg2,lucius-feng/tg2
4ad06836e009309c7b5c00f0f932f9db38dff15c
examples/weather/gensvcbind.py
examples/weather/gensvcbind.py
import pyxb.Namespace import pyxb.xmlschema as xs import sys import pyxb.standard.bindings.wsdl as wsdl import pyxb.standard.bindings.soaphttp as soaphttp from xml.dom import Node from xml.dom import minidom import pyxb.binding.generate import pyxb.utils.domutils as domutils doc = minidom.parse('weather.wsdl') root =...
import pyxb.Namespace import pyxb.xmlschema as xs import sys import pyxb.standard.bindings.wsdl as wsdl from xml.dom import Node from xml.dom import minidom import pyxb.binding.generate import pyxb.utils.domutils as domutils doc = minidom.parse('weather.wsdl') root = doc.documentElement attribute_map = domutils.Attr...
Update how schema is built
Update how schema is built
Python
apache-2.0
balanced/PyXB,CantemoInternal/pyxb,pabigot/pyxb,jonfoster/pyxb-upstream-mirror,jonfoster/pyxb1,CantemoInternal/pyxb,jonfoster/pyxb1,jonfoster/pyxb2,jonfoster/pyxb2,balanced/PyXB,CantemoInternal/pyxb,balanced/PyXB,jonfoster/pyxb-upstream-mirror,jonfoster/pyxb-upstream-mirror,pabigot/pyxb,jonfoster/pyxb2
52a4a10d54374b08c5835d02077fd1edcdc547ac
tests/test_union_energy_grids/results.py
tests/test_union_energy_grids/results.py
#!/usr/bin/env python import sys # import statepoint sys.path.insert(0, '../../src/utils') import statepoint # read in statepoint file if len(sys.argv) > 1: sp = statepoint.StatePoint(sys.argv[1]) else: sp = statepoint.StatePoint('statepoint.10.binary') sp.read_results() # set up output string outstr = '' ...
#!/usr/bin/env python import sys sys.path.insert(0, '../../src/utils') from openmc.statepoint import StatePoint # read in statepoint file if len(sys.argv) > 1: print(sys.argv) sp = StatePoint(sys.argv[1]) else: sp = StatePoint('statepoint.10.binary') sp.read_results() # set up output string outstr = '' ...
Fix import for statepoint for test_union_energy_grids
Fix import for statepoint for test_union_energy_grids
Python
mit
smharper/openmc,paulromano/openmc,mit-crpg/openmc,bhermanmit/openmc,wbinventor/openmc,paulromano/openmc,samuelshaner/openmc,mit-crpg/openmc,smharper/openmc,samuelshaner/openmc,johnnyliu27/openmc,mit-crpg/openmc,lilulu/openmc,walshjon/openmc,shikhar413/openmc,liangjg/openmc,shikhar413/openmc,walshjon/openmc,paulromano/o...
b544361b2e3f7942a82a911a8d6d314a2044be97
almostfunded/wsgi.py
almostfunded/wsgi.py
""" WSGI config for untitled1 project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SET...
""" WSGI config for untitled1 project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from whitenoise.django import Djan...
Add missing import statement for whitenoise
Add missing import statement for whitenoise
Python
mit
lorenanicole/almost_funded,lorenanicole/almost_funded,lorenanicole/almost_funded
b18aa2f4400deab98cc0e27c798ee6d7893232cd
utils/text.py
utils/text.py
def restrict_len(content): if len(content) > 320: content = content[:310].strip() + '...' return content def detect_language(config, langs, word): from yandex_translate import YandexTranslate translator = YandexTranslate(config['yandex_translate_key']) russian = 'абвгдеёжзийклмнопрстуфхцчш...
def restrict_len(content): if len(content) > 320: content = content[:310].strip() + '...' return content def detect_language(config, langs, word): from yandex_translate import YandexTranslate, YandexTranslateException translator = YandexTranslate(config['yandex_translate_key']) russian = '...
Add unknown language error catching
Add unknown language error catching
Python
mit
Elishanto/HarryBotter
41fe44e99361d9006a8b196e9b886ffdb3e8e460
functional_tests/test_evexml.py
functional_tests/test_evexml.py
"""Functional tests for the xml api part of aniauth project. This is a temporary app as EVE Online's xml api is deprecated and will be disabled March 2018. """ from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.test import tag from django.shortcuts import reverse from selenium import ...
"""Functional tests for the xml api part of aniauth project. This is a temporary app as EVE Online's xml api is deprecated and will be disabled March 2018. """ from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.test import tag from django.shortcuts import reverse from selenium import ...
Make test get correct url
Make test get correct url
Python
mit
randomic/aniauth-tdd,randomic/aniauth-tdd
f468ea8123768a3f66621bfecae20814fa83017b
website_sale_clear_line/controllers/main.py
website_sale_clear_line/controllers/main.py
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp.http import request from openerp impo...
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp.http import request from openerp impo...
FIX website sale clear line
FIX website sale clear line
Python
agpl-3.0
ingadhoc/website
8efab7ddd356a9b2e2209b668d3ed83a5ac9faf2
tests/test_logic.py
tests/test_logic.py
from context import core from context import models from models import model from core import logic import unittest class test_logic(unittest.TestCase): def test_create_room_office(self): new_office = logic.create_room('office', 'orange') self.assertIsInstance(new_office, model.Office) def test_create_room_li...
from context import core from context import models from models import model from core import logic import unittest class test_logic(unittest.TestCase): def setUp(self): self.white_char_in_name = logic.create_room('office', "name ") self.white_char_in_typr = logic.create_room('livingspace ...
Add test case to test non-standard input
Add test case to test non-standard input
Python
mit
georgreen/Geoogreen-Mamboleo-Dojo-Project
87881f594836b7cf92ffce69dbb643ee05df88d1
utils/config_utils.py
utils/config_utils.py
import sys import yaml def job_config(args): try: config_file = './config/{0}.yml'.format(args[0]) except IndexError: sys.exit("Job name is a required argument. Example: chicago_cta") try: with open(config_file, 'r') as file: config = yaml.safe_load(file) except IOError: sys.exit("Missing config file ...
import sys import yaml def main_config(): config_file = './config/.main.yml' try: with open(config_file, 'r') as file: config = yaml.safe_load(file) except IOError: sys.exit("Missing main config file: '{0}'".format(config_file)) return config, config_file def job_config(args): try: config_file = './...
Add util for loading main config
Add util for loading main config
Python
mit
projectweekend/Transit-Stop-Collector
a8da08a6cf3bff12ce1668c5f4f99710317e42f0
tests/unit/test_place.py
tests/unit/test_place.py
"""Tests for the isort import placement module""" from functools import partial from isort import place, sections from isort.settings import Config def test_module(src_path): place_tester = partial(place.module, config=Config(src_paths=[src_path])) assert place_tester("isort") == sections.FIRSTPARTY asse...
"""Tests for the isort import placement module""" from functools import partial from isort import place, sections from isort.settings import Config def test_module(src_path): place_tester = partial(place.module, config=Config(src_paths=[src_path])) assert place_tester("isort") == sections.FIRSTPARTY asse...
Add unit test case for desired placement behavior
Add unit test case for desired placement behavior
Python
mit
PyCQA/isort,PyCQA/isort
ad278fdc71140dfb4be27895e747356e668e3b6c
teuthology/lockstatus.py
teuthology/lockstatus.py
import requests import os from .config import config def get_status(name): uri = os.path.join(config.lock_server, 'nodes', name, '') response = requests.get(uri) success = response.ok if success: return response.json() return None
import requests import os from .config import config from .misc import canonicalize_hostname def get_status(name): name = canonicalize_hostname(name, user=None) uri = os.path.join(config.lock_server, 'nodes', name, '') response = requests.get(uri) success = response.ok if success: return r...
Remove the 'user@' prefix before checking status
Remove the 'user@' prefix before checking status Signed-off-by: Zack Cerza <f801c831581d4150a2793939287636221d62131e@inktank.com>
Python
mit
ceph/teuthology,t-miyamae/teuthology,zhouyuan/teuthology,caibo2014/teuthology,tchaikov/teuthology,dmick/teuthology,robbat2/teuthology,dreamhost/teuthology,ivotron/teuthology,ivotron/teuthology,SUSE/teuthology,robbat2/teuthology,michaelsevilla/teuthology,tchaikov/teuthology,michaelsevilla/teuthology,ceph/teuthology,drea...
e1acfc8a05f1a131dc4b146837e007efa58a2ebf
theano/learning_rates.py
theano/learning_rates.py
""" Classes that simplify learning rate modification. """ import theano import theano.tensor as TT class _LearningRate(object): """ Suplerclass for learning rates. """ def __init__(self, initial_rate): """ Args: initial_rate: Initial value of the learning rate. """ self._rate = initial_rate ...
""" Classes that simplify learning rate modification. """ import theano import theano.tensor as TT class _LearningRate(object): """ Suplerclass for learning rates. """ def __init__(self, initial_rate): """ Args: initial_rate: Initial value of the learning rate. """ self._rate = initial_rate ...
Make fixed learning rates not crash.
Make fixed learning rates not crash. There was a slight bug in this code before, which I fixed.
Python
mit
djpetti/rpinets,djpetti/rpinets
e469ae00a815b25ab7d0e45c7f8076c56ae834b4
test/__init__.py
test/__init__.py
import unittest class TestCase(unittest.TestCase): """ Parent TestCase to use for all tests. """ pass
import unittest class TestCase(unittest.TestCase): """ Parent TestCase to use for all tests. """ pass def assertGreaterEqual(self, first, second, msg=None): """ Test that first is respectively >= than second depending on the method name. If not, the test will fail. ...
Implement unittest.TestCase.assertGreaterEqual for pythons less than 2.7
Implement unittest.TestCase.assertGreaterEqual for pythons less than 2.7
Python
mit
pombredanne/jsonstats,pombredanne/jsonstats,RHInception/jsonstats,RHInception/jsonstats
5fa20295eadf01e4567d89713e406ce82b738cf5
ephemeral-cluster.py
ephemeral-cluster.py
#!/usr/bin/env python import subprocess import sys import uuid usage = """\ Run a command using a temporary docker-compose cluster, removing all containers \ and associated volumes after command completion (regardless of success or \ failure.) Generally, this would be used with the ``run`` command to provide a clean...
#!/usr/bin/env python import itertools import subprocess import sys import uuid def get_images_for_project(project): """ Returns a set of image names associated with a project label. """ p = subprocess.Popen(['docker', 'images'], stdout=subprocess.PIPE) images = set() while p.returncode is Non...
Clean up built images for ephemeral cluster.
Clean up built images for ephemeral cluster. Reviewers: tail, pi, jeff Reviewed By: jeff Differential Revision: http://phabricator.local.disqus.net/D19797
Python
apache-2.0
fuziontech/pgshovel,fuziontech/pgshovel,disqus/pgshovel,disqus/pgshovel,fuziontech/pgshovel
3e2baaed603ef9d904926049414bf51b48898776
trex/serializers.py
trex/serializers.py
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from rest_framework.serializers import ( HyperlinkedModelSerializer, HyperlinkedIdentityField, ) from trex.models.project import Project, Entry, Tag class ProjectSerializer...
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from rest_framework.serializers import ( HyperlinkedModelSerializer, HyperlinkedIdentityField, ) from trex.models.project import Project, Entry, Tag class ProjectSerializer...
Add a TagDetailSerializer for returning more details of a Tag then id and name
Add a TagDetailSerializer for returning more details of a Tag then id and name
Python
mit
bjoernricks/trex,bjoernricks/trex
1c16c8e98845550b19f6c75db5253805f656c636
http_requests.py
http_requests.py
import sublime, sublime_plugin import requests from requests import delete, get, head, options, patch, post, put class RequestCommand(sublime_plugin.TextCommand): def run(self, edit): self.import_variables() request = self.view.substr(self.view.line(self.view.sel()[0])) response = eval(r...
import sublime, sublime_plugin import requests from requests import delete, get, head, options, patch, post, put class RequestCommand(sublime_plugin.TextCommand): def run(self, edit): self.import_variables() selections = self.get_selections() for s in selections: response = e...
Allow multiple requests to be made at once by iterating over selections
Allow multiple requests to be made at once by iterating over selections
Python
mit
kylebebak/Requester,kylebebak/Requester
8d99b27125af58aacbb9556c68774bdaf27fdda5
tests/helpers.py
tests/helpers.py
import asana import requests import responses import unittest import json from six import next from responses import GET, PUT, POST, DELETE # Define JSON primitives so we can just copy in JSON: false = False true = True null = None # From https://github.com/dropbox/responses/issues/31#issuecomment-63165210 from ins...
import json import unittest import asana import requests import responses from six import add_metaclass, next from responses import GET, PUT, POST, DELETE # Define JSON primitives so we can just copy in JSON: false = False true = True null = None def create_decorating_metaclass(decorators, prefix='test_'): clas...
Fix broken unittests in Python 2.7.
Fix broken unittests in Python 2.7. Originally all test classes were decorated by going over the class via inspection - however, this doesn't work in Python 2.7 because the methods that are returned from getmembers are all unbound (in Python 3+, this is fixed as all methods are just function objects). Now this uses a...
Python
mit
asana/python-asana,Asana/python-asana,asana/python-asana
53234eb1ab0bafe49b8e198336d7958fed3e3f61
awx/main/managers.py
awx/main/managers.py
# Copyright (c) 2014 Ansible, Inc. # All Rights Reserved. from django.conf import settings from django.db import models from django.utils.functional import cached_property class InstanceManager(models.Manager): """A custom manager class for the Instance model. Provides "table-level" methods including gettin...
# Copyright (c) 2014 Ansible, Inc. # All Rights Reserved. import sys from django.conf import settings from django.db import models from django.utils.functional import cached_property class InstanceManager(models.Manager): """A custom manager class for the Instance model. Provides "table-level" methods incl...
Return stub records in testing.
Return stub records in testing.
Python
apache-2.0
snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx
b860372a9e874e8bc06efc9711f7b58591300e81
tohu/__init__.py
tohu/__init__.py
from distutils.version import StrictVersion from platform import python_version min_supported_python_version = '3.6' if StrictVersion(python_version()) < StrictVersion(min_supported_python_version): error_msg = ( "Tohu requires Python {min_supported_python_version} or greater to run " "(currently ...
from distutils.version import LooseVersion from platform import python_version min_supported_python_version = '3.6' if LooseVersion(python_version()) < LooseVersion(min_supported_python_version): error_msg = ( "Tohu requires Python {min_supported_python_version} or greater to run " "(currently run...
Use LooseVersion in version check (to avoid errors for e.g. '3.7.2+')
Use LooseVersion in version check (to avoid errors for e.g. '3.7.2+')
Python
mit
maxalbert/tohu
715dcb62966b5c80544ed9eee79a6c69d3b9d927
blog/posts/models.py
blog/posts/models.py
from django.db import models class Post(models.Model): body = models.TextField() title = models.CharField(max_length=50) display_title = models.CharField(max_length=50) publication_date = models.DateTimeField(auto_now_add=True) def __unicode__(self): return self.title class Comment(models...
from django.db import models class Post(models.Model): body = models.TextField() title = models.CharField(max_length=50) publication_date = models.DateTimeField(auto_now_add=True) def __unicode__(self): return self.title class Comment(models.Model): text = models.TextField() author = ...
Remove display_title field from Post model.
Remove display_title field from Post model. It wasn't being used anyway.
Python
mit
Lukasa/minimalog
d8b4acd0617dc93646e177ac56b0205be1b7ff88
seaweb_project/seaweb_project/urls.py
seaweb_project/seaweb_project/urls.py
from django.conf.urls import patterns, url, include from django.views.generic.base import TemplateView from django.contrib.auth.decorators import login_required from django.contrib.auth import views as auth_views from django.contrib import admin admin.autodiscover() from rest_framework.routers import DefaultRouter fro...
from django.conf.urls import patterns, url, include from django.views.generic.base import TemplateView from django.contrib.auth.decorators import login_required from django.contrib.auth import views as auth_views from django.contrib import admin admin.autodiscover() from rest_framework.routers import DefaultRouter fro...
Disable indexing via robots.txt url.
Disable indexing via robots.txt url.
Python
mit
grollins/sea-web-django
88a83ebcfe5a3841db4cf75985a2365df87395f8
tests/test_create_elb.py
tests/test_create_elb.py
"""Test ELB creation functions.""" from foremast.elb.create_elb import SpinnakerELB def test_splay(): """Splay should split Health Checks properly.""" health = SpinnakerELB.splay_health('HTTP:80/test') assert health.path == '/test' assert health.port == '80' assert health.proto == 'HTTP' asser...
"""Test ELB creation functions.""" from foremast.elb.splay_health import splay_health def test_splay(): """Splay should split Health Checks properly.""" health = splay_health('HTTP:80/test') assert health.path == '/test' assert health.port == '80' assert health.proto == 'HTTP' assert health.ta...
Update splay_health() test to new module
tests: Update splay_health() test to new module
Python
apache-2.0
gogoair/foremast,gogoair/foremast
c9e11c04bd5981f810b47a659f0777d1976cb01f
vaux/storage/metadata.py
vaux/storage/metadata.py
import rethinkdb as r class MetaEngine(object): def __init__(self, hostname, port, db, table): self.rdb = r.connect(host=hostname, port=port, db=db, timeout=20) self.table = table def get_all(self): for item in r.table(self.table).run(self.rdb): yield item def put(sel...
import rethinkdb as r class MetaEngine(object): def __init__(self, hostname, port, db, table): self.rdb = r.connect(host=hostname, port=port, timeout=20) try: self.rdb.db_create(db).run() except Exception, e: pass self.rdb.close() self.rdb = r....
Create the database and table if they don't exist
Create the database and table if they don't exist I think... :/
Python
mit
VauxIo/core
82aca6b352de3133f1fba454d82e1a20f3da2436
src/auditlog_tests/test_settings.py
src/auditlog_tests/test_settings.py
""" Settings file for the Auditlog test suite. """ SECRET_KEY = 'test' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'auditlog', 'auditlog_tests', ] MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'auditlog.middleware.AuditlogMiddleware', ) DATA...
""" Settings file for the Auditlog test suite. """ SECRET_KEY = 'test' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'auditlog', 'auditlog_tests', ] MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'auditlog.middleware.AuditlogMiddleware', ) DATA...
Make Django 1.9+ accept the settings file
Make Django 1.9+ accept the settings file
Python
mit
Zmeylol/auditlog,jjkester/django-auditlog,kbussell/django-auditlog,chris-griffin/django-auditlog
3d2a67ab4b46bf389376544fb21341163b57e8fa
mptt/signals.py
mptt/signals.py
import django.dispatch # Behaves like Djangos normal pre-/post_save signals signals with the # added arguments ``target`` and ``position`` that matches those of # ``move_to``. # If the signal is called from ``save`` it'll not be pass position. node_moved = django.dispatch.Signal(providing_args=[ 'instance', 't...
from django.db.models.signals import ModelSignal as Signal # Behaves like Djangos normal pre-/post_save signals signals with the # added arguments ``target`` and ``position`` that matches those of # ``move_to``. # If the signal is called from ``save`` it'll not be pass position. node_moved = Signal(providing_args=[ ...
Use ModelSignal over plain Signal
Use ModelSignal over plain Signal
Python
mit
matthiask/django-mptt,matthiask/django-mptt,matthiask/django-mptt,matthiask/django-mptt
d054180fe1ff5ff7f4a0bc5b62f8dfcbb15a9c09
winthrop/people/admin.py
winthrop/people/admin.py
from django.contrib import admin from .models import Person, Residence, RelationshipType, Relationship admin.site.register(Person) admin.site.register(Residence) admin.site.register(RelationshipType) admin.site.register(Relationship)
from django.contrib import admin from .models import Person, Residence, RelationshipType, Relationship class ResidenceInline(admin.TabularInline): '''Inline class for Residence''' model = Residence class PersonAdmin(admin.ModelAdmin): inlines = [ ResidenceInline ] admin.site.register(Pers...
Add residence as an inline to person/people
Add residence as an inline to person/people
Python
apache-2.0
Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django
fc6202425e0c855dc29980904949b60c0ac48bbf
preparation/tools/build_assets.py
preparation/tools/build_assets.py
from copy import copy from preparation.resources.Resource import names_registered, resource_by_name from hb_res.storage import get_storage def rebuild_from_resource(resource_name: str): resource = resource_by_name(resource_name)() with get_storage(resource_name.replace('Resource', '')) as out_storage: ...
from copy import copy from preparation.resources.Resource import names_registered, resource_by_name from hb_res.storage import get_storage def rebuild_from_resource(resource_name: str): resource = resource_by_name(resource_name)() trunk = resource_name.replace('Resource', '') with get_storage(trunk) as o...
Add start/finish debug info while generating
Add start/finish debug info while generating
Python
mit
hatbot-team/hatbot_resources
52fa13e103b77365acc9769f205d6b92af94b738
lambda/lambda.py
lambda/lambda.py
from __future__ import print_function from ses import email_message_from_s3_bucket, event_msg_is_to_command, recipient_destination_overlap from cnc import handle_command import boto3 ses = boto3.client('ses') from config import email_bucket from listcfg import ListConfiguration def lambda_handler(event, context):...
from __future__ import print_function from ses import email_message_from_s3_bucket, event_msg_is_to_command, msg_get_header, recipient_destination_overlap from cnc import handle_command import boto3 ses = boto3.client('ses') from config import email_bucket from listcfg import ListConfiguration def lambda_handler(...
Remove any existing DKIM signature and set the Sender: header before sending.
Remove any existing DKIM signature and set the Sender: header before sending.
Python
mit
ilg/LambdaMLM
40688413e59aaabd4a92dba4d2f402fb42fee143
1-multiples-of-3-and-5.py
1-multiples-of-3-and-5.py
from itertools import chain def threes_and_fives_gen(num=1000): for i in range(num): if i % 3 == 0 or i % 5 == 0: yield i def threes_and_fives_fun(n): return set(chain(range(3, n+1, 3), range(5, n+1, 5))) def solve(n): return sum( filter(lambda x: x%3==0 or x%5==0, ...
from itertools import chain def threes_and_fives_gen(num=1000): for i in range(num): if i % 3 == 0 or i % 5 == 0: yield i def threes_and_fives_fun(n): return set(chain(range(3, n+1, 3), range(5, n+1, 5))) def solve(n): return sum( filter(lambda x: x%3==0 or x%5==0, ...
Add gen exp solution to 1
Add gen exp solution to 1
Python
mit
dawran6/project-euler
ac8e58e1430ca7418f64bb547e3513032d5b49e8
tests/lexer_test.py
tests/lexer_test.py
from whitepy.lexerconstants import * import whitepy.lexer as lexer import unittest class TestLexer(unittest.TestCase): def _get_lexer(self, line): return lexer.Lexer(line=line) def _valid_ws(self): return self._get_lexer(" \t\n") def test_get_int(self): lexer = self._valid_ws(...
from nose.tools import * from whitepy.lexerconstants import * import unittest import whitepy.lexer as lexer class TestLexer(unittest.TestCase): def _get_lexer(self, line): return lexer.Lexer(line=line) def _sample_ws(self, ws_type): ws_samples = { 'valid': " \t\n", ...
Add test for invalid integer
Add test for invalid integer A valid integer in Whitesapce ends with '\n', if an invalid integer is found the code should raise a IntError exception. As part of this, I have renamed `_valid_ws()` to `_sample_ws()`, which now takes a argument for the type of whitespace needed.
Python
apache-2.0
yasn77/whitepy
53878700a4da22e80114ef67a4aee340846abf91
us_ignite/search/urls.py
us_ignite/search/urls.py
from django.conf.urls import patterns, url urlpatterns = patterns( 'us_ignite.search.views', url(r'apps/', 'search_apps', name='search_apps'), url(r'events/', 'search_events', name='search_events'), url(r'hubs/', 'search_hubs', name='search_hubs'), url(r'orgs/', 'search_organizations', name='searc...
from django.conf.urls import patterns, url urlpatterns = patterns( 'us_ignite.search.views', url(r'^apps/$', 'search_apps', name='search_apps'), url(r'^events/$', 'search_events', name='search_events'), url(r'^hubs/$', 'search_hubs', name='search_hubs'), url(r'^orgs/$', 'search_organizations', nam...
Fix broad regex for the ``search`` URLs.
Fix broad regex for the ``search`` URLs.
Python
bsd-3-clause
us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite
1d8fc0e63e5527b6f65da4899b432dcdfa243557
ava/text_to_speech/__init__.py
ava/text_to_speech/__init__.py
import time import os from tempfile import NamedTemporaryFile from sys import platform as _platform from gtts import gTTS from .playsound import playsound from ..queues import QueueTtS from ..components import _BaseComponent class TextToSpeech(_BaseComponent): def __init__(self): super().__init__() ...
import time import os from tempfile import NamedTemporaryFile from sys import platform as _platform from gtts import gTTS from .playsound import playsound from ..queues import QueueTtS from ..components import _BaseComponent class TextToSpeech(_BaseComponent): def __init__(self): super().__init__() ...
Allow user to use ava without TTS on Linux
Allow user to use ava without TTS on Linux
Python
mit
ava-project/AVA
f6194866a98dccdb8e1c1a1dfee40b11034461ba
src/nyct-json.py
src/nyct-json.py
#!/usr/bin/env python import json import settings import os import urllib2 from proto import gtfs_realtime_pb2 message = gtfs_realtime_pb2.FeedMessage() url = urllib2.urlopen('http://datamine.mta.info/mta_esi.php?key={0}&feed_id={1}'.format(settings.MTA_API_KEY, settings.MTA_FEED_ID)) message.ParseFromString(url.read...
#!/usr/bin/env python import json import settings import os import urllib2 from proto import gtfs_realtime_pb2 message = gtfs_realtime_pb2.FeedMessage() url = urllib2.urlopen('http://datamine.mta.info/mta_esi.php?key={0}&feed_id={1}'.format(settings.MTA_API_KEY, settings.MTA_FEED_ID)) message.ParseFromString(url.read...
Use a function to write.
Use a function to write.
Python
isc
natestedman/nyct-json,natestedman/nyct-json
e31192cf4989c1cef481eb92d6a91ae99dd8e5f5
src/pip/_internal/distributions/__init__.py
src/pip/_internal/distributions/__init__.py
from pip._internal.distributions.source import SourceDistribution from pip._internal.distributions.wheel import WheelDistribution from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from pip._internal.distributions.base import AbstractDistribution from pip._internal.req.req_instal...
from pip._internal.distributions.source import SourceDistribution from pip._internal.distributions.wheel import WheelDistribution from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from pip._internal.distributions.base import AbstractDistribution from pip._internal.req.req_instal...
Simplify conditional for choosing WheelDistribution
Simplify conditional for choosing WheelDistribution
Python
mit
xavfernandez/pip,pradyunsg/pip,rouge8/pip,rouge8/pip,sbidoul/pip,sbidoul/pip,pypa/pip,pfmoore/pip,pradyunsg/pip,xavfernandez/pip,pfmoore/pip,xavfernandez/pip,pypa/pip,rouge8/pip
26579d307d44f00fe71853fa6c13957018fe5c0f
capnp/__init__.py
capnp/__init__.py
"""A python library wrapping the Cap'n Proto C++ library Example Usage:: import capnp addressbook = capnp.load('addressbook.capnp') # Building addresses = addressbook.AddressBook.newMessage() people = addresses.init('people', 1) alice = people[0] alice.id = 123 alice.name = 'Ali...
"""A python library wrapping the Cap'n Proto C++ library Example Usage:: import capnp addressbook = capnp.load('addressbook.capnp') # Building addresses = addressbook.AddressBook.newMessage() people = addresses.init('people', 1) alice = people[0] alice.id = 123 alice.name = 'Ali...
Enable import hook by default
Enable import hook by default
Python
bsd-2-clause
rcrowder/pycapnp,SymbiFlow/pycapnp,jparyani/pycapnp,SymbiFlow/pycapnp,SymbiFlow/pycapnp,tempbottle/pycapnp,tempbottle/pycapnp,jparyani/pycapnp,rcrowder/pycapnp,SymbiFlow/pycapnp,jparyani/pycapnp,jparyani/pycapnp,tempbottle/pycapnp,rcrowder/pycapnp,rcrowder/pycapnp,tempbottle/pycapnp
003c7f9b7c6d35e176a9a4d5c56b61b0b4f96281
webapp/tests/__init__.py
webapp/tests/__init__.py
# -*- coding: utf-8 -*- from unittest import TestCase from byceps.application import create_app from byceps.blueprints.brand.models import Brand from byceps.blueprints.party.models import Party from byceps.database import db class AbstractAppTestCase(TestCase): def setUp(self): self.app = create_app('t...
# -*- coding: utf-8 -*- from unittest import TestCase from byceps.application import create_app from byceps.blueprints.brand.models import Brand from byceps.blueprints.party.models import Party from byceps.database import db class AbstractAppTestCase(TestCase): def setUp(self, env='test'): self.app = c...
Allow use of a custom environment for tests.
Allow use of a custom environment for tests.
Python
bsd-3-clause
m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps
685365af5126c6e83db468eef24b008fc1526462
tools/game_utils.py
tools/game_utils.py
import scipy.misc import scipy.special def get_num_hole_card_combinations(game): num_players = game.get_num_players() num_hole_cards = game.get_num_hole_cards() num_cards = game.get_num_suits() * game.get_num_ranks() num_total_hole_cards = num_players * num_hole_cards return scipy.misc.comb(num_ca...
import numpy as np import scipy.misc import scipy.special from tools.walk_tree import walk_tree from tools.game_tree.nodes import ActionNode def get_num_hole_card_combinations(game): num_players = game.get_num_players() num_hole_cards = game.get_num_hole_cards() num_cards = game.get_num_suits() * game.ge...
Add method to verify that all strategy probabilities add to 1
Add method to verify that all strategy probabilities add to 1
Python
mit
JakubPetriska/poker-cfr,JakubPetriska/poker-cfr
4368567e44c144e85fa9fcdb72f2648c13eb8158
rest_framework_jsonp/renderers.py
rest_framework_jsonp/renderers.py
""" Provides JSONP rendering support. """ from __future__ import unicode_literals from rest_framework.renderers import JSONRenderer class JSONPRenderer(JSONRenderer): """ Renderer which serializes to json, wrapping the json output in a callback function. """ media_type = 'application/javascript'...
""" Provides JSONP rendering support. """ from __future__ import unicode_literals from rest_framework.renderers import JSONRenderer class JSONPRenderer(JSONRenderer): """ Renderer which serializes to json, wrapping the json output in a callback function. """ media_type = 'application/javascript'...
Update for compat w/ djangorestframework 3.2
Update for compat w/ djangorestframework 3.2 Change request.QUERY_PARAMS to request.query_params
Python
isc
baxrob/django-rest-framework-jsonp
e9c32014093af49edc6a12b6db37b44a04d12892
test/integration/ggrc_workflows/__init__.py
test/integration/ggrc_workflows/__init__.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com from integration.ggrc import TestCase from integration.ggrc_workflows.generator i...
Add WorkflowTestCase to integration tests
Add WorkflowTestCase to integration tests
Python
apache-2.0
josthkko/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,selahs...
606cb3475e2e4220822f924d13881dfaefb51aa4
teryt_tree/rest_framework_ext/viewsets.py
teryt_tree/rest_framework_ext/viewsets.py
import django_filters from django.shortcuts import get_object_or_404 try: from django_filters import rest_framework as filters except ImportError: # Back-ward compatible for django-rest-framework<3.7 from rest_framework import filters from rest_framework import viewsets from teryt_tree.models import JednostkaA...
import django_filters from django.shortcuts import get_object_or_404 from django.utils.translation import ugettext_lazy as _ try: from django_filters import rest_framework as filters except ImportError: # Back-ward compatible for django-rest-framework<3.7 from rest_framework import filters from rest_framework...
Update JednostkaAdministracyjnaFilter for new django-filters
Update JednostkaAdministracyjnaFilter for new django-filters
Python
bsd-3-clause
ad-m/django-teryt-tree
1090acb35ea4ce5c8d17db716539d3354feabc12
nodeconductor/iaas/migrations/0038_securitygroup_state.py
nodeconductor/iaas/migrations/0038_securitygroup_state.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django_fsm class Migration(migrations.Migration): dependencies = [ ('iaas', '0037_init_security_groups_quotas'), ] operations = [ migrations.AddField( model_name='...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django_fsm def mark_security_groups_as_synced(apps, schema_editor): SecurityGroup = apps.get_model('iaas', 'SecurityGroup') SecurityGroup.objects.all().update(state=3) class Migration(migrations....
Mark all exist security groups as synced
Mark all exist security groups as synced - itacloud-4843
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
3e6e485443a901660a461dbbc8b324bfe4c19c8f
tests/v5/conftest.py
tests/v5/conftest.py
import pytest from .context import tohu from tohu.v5.primitive_generators import * EXEMPLAR_GENERATORS = [ Constant("quux"), Boolean(p=0.3), ] @pytest.fixture def exemplar_generators(): """ Return a list of generators which contains an example for each type of generator supported by tohu. "...
import pytest from .context import tohu from tohu.v5.primitive_generators import * EXEMPLAR_PRIMITIVE_GENERATORS = [ Constant("quux"), Boolean(p=0.3), ] @pytest.fixture def exemplar_generators(): """ Return a list of generators which contains an example for each type of generator supported by t...
Add fixture for exemplar primitive generators
Add fixture for exemplar primitive generators
Python
mit
maxalbert/tohu
0d302a13475b4e8ae073cad8c667019419a6a7e8
vdb/zika_download.py
vdb/zika_download.py
import os,datetime from download import download from download import get_parser class zika_download(download): def __init__(self, **kwargs): download.__init__(self, **kwargs) if __name__=="__main__": parser = get_parser() args = parser.parse_args() fasta_fields = ['strain', 'virus', 'accessio...
import os,datetime from download import download from download import get_parser class zika_download(download): def __init__(self, **kwargs): download.__init__(self, **kwargs) if __name__=="__main__": parser = get_parser() args = parser.parse_args() fasta_fields = ['strain', 'virus', 'accessio...
Remove lat/long from zika download
Remove lat/long from zika download
Python
agpl-3.0
nextstrain/fauna,blab/nextstrain-db,blab/nextstrain-db,nextstrain/fauna
f946ca92b74bb945c3884fcfa3e515132ec56b06
virtool/processes.py
virtool/processes.py
STEP_COUNTS = { "import_reference": 0, "setup_remote_reference": 0, "update_remote_reference": 0, "update_software": 0, "install_hmms": 0 } FIRST_STEPS = { "import_reference": "load_file", "setup_remote_reference": "", "update_remote_reference": "", "update_software": "", "insta...
STEP_COUNTS = { "import_reference": 0, "setup_remote_reference": 0, "update_remote_reference": 0, "update_software": 0, "install_hmms": 0 } FIRST_STEPS = { "import_reference": "load_file", "setup_remote_reference": "", "update_remote_reference": "", "update_software": "", "insta...
Add ProgressTracker class for tracking progress in long operations
Add ProgressTracker class for tracking progress in long operations
Python
mit
virtool/virtool,igboyes/virtool,igboyes/virtool,virtool/virtool
63c0cd90ff9e9a721b175cdd4af8dc52ed6412ad
flatkeys/__init__.py
flatkeys/__init__.py
# -*- coding: UTF-8 -*- __version__ = '0.1.0' def flatkeys(d, sep="."): """ Flatten a dictionary: build a new dictionary from a given one where all non-dict values are left untouched but nested ``dict``s are recursively merged in the new one with their keys prefixed by their parent key. >>> flat...
# -*- coding: UTF-8 -*- import collections __version__ = '0.1.0' def flatkeys(d, sep="."): """ Flatten a dictionary: build a new dictionary from a given one where all non-dict values are left untouched but nested ``dict``s are recursively merged in the new one with their keys prefixed by their parent...
Use isinstance check so library can be used for more types
Use isinstance check so library can be used for more types
Python
mit
bfontaine/flatkeys
df04444b3932f7481562dde62c7ae1f8ffb8bd7e
webapp/controllers/contact.py
webapp/controllers/contact.py
# -*- coding: utf-8 -*- ### required - do no delete def user(): return dict(form=auth()) def download(): return response.download(request,db) def call(): return service() ### end requires def index(): return dict()
# -*- coding: utf-8 -*- from opentreewebapputil import (get_opentree_services_method_urls, fetch_current_TNRS_context_names) ### required - do no delete def user(): return dict(form=auth()) def download(): return response.download(request,db) def call(): return service() ### end requir...
Fix missing search-context list on Contact page.
Fix missing search-context list on Contact page.
Python
bsd-2-clause
OpenTreeOfLife/opentree,OpenTreeOfLife/opentree,OpenTreeOfLife/opentree,OpenTreeOfLife/opentree,OpenTreeOfLife/opentree,OpenTreeOfLife/opentree
d4607cec7bc4fb4bcfc601fc8f1c35ea93131d3d
generate_c_arrays.py
generate_c_arrays.py
"""Generates color arrays for use in a C project. This scipt generates a dump of array/color data for use in a A project. This simplifies the need to hand-create and edit the data in many projects. This is useful, for instance, with Arduino projects. """ # Module imports import glowcolors.encode import glowcolors.mes...
"""Generates color arrays for use in a C project. This scipt generates a dump of array/color data for use in a A project. This simplifies the need to hand-create and edit the data in many projects. This is useful, for instance, with Arduino projects. """ # Module imports import glowcolors.encode import glowcolors.mes...
Fix for generate colors py
Fix for generate colors py
Python
mit
evilsoapbox/GlowColors
ac1f9ab2cb06be4060100fd8c0714e26a9e5c970
openacademy/model/openacademy_course.py
openacademy/model/openacademy_course.py
from openerp import fields, models ''' ...
from openerp import api,fields, models ''' ...
Modify copy method into inherit
[REF] openacademy: Modify copy method into inherit
Python
apache-2.0
hellomoto6/openacademy
2548ecd64d6a26b09fe79f5a369f731c66410aa0
dadd/master/admin.py
dadd/master/admin.py
from flask.ext.admin import Admin from flask.ext.admin.contrib.sqla import ModelView from dadd.master import models def admin(app): admin = Admin(app) session = models.db.session admin.add_view(ModelView(models.Process, session)) admin.add_view(ModelView(models.Host, session)) admin.add_view(Mode...
from flask.ext.admin import Admin from flask.ext.admin.contrib.sqla import ModelView from dadd.master import models class ProcessModelView(ModelView): # Make the latest first column_default_sort = ('start_time', True) def __init__(self, session): super(ProcessModelView, self).__init__(models.Pro...
Sort the processes by start time by default in the Admin.
Sort the processes by start time by default in the Admin.
Python
bsd-3-clause
ionrock/dadd,ionrock/dadd,ionrock/dadd,ionrock/dadd
f5c5c9297bb5c7dfa0ee6c3077329c8e7fa00b06
talon_one/exceptions.py
talon_one/exceptions.py
import json import requests class TalonOneAPIError(Exception): """ TalonOne API Exceptions """ def __init__(self, message, *args): self.message = message # try to enhance with detailed error from API if len(args) > 0 and isinstance(args[0], requests.exceptions.HTTPError): ...
import json import requests class TalonOneAPIError(Exception): """ TalonOne API Exceptions """ def __init__(self, message, *args): self.message = message # try to enhance with detailed error from API if len(args) > 0 and isinstance(args[0], requests.exceptions.HTTPError): ...
Include API validation response into `TalonOneAPIError` details
Include API validation response into `TalonOneAPIError` details
Python
mit
talon-one/talon_one.py,talon-one/talon_one.py
6fecc53b63023e6d25722aa66038285be3b4d46b
arcutils/response.py
arcutils/response.py
from django.contrib.auth import REDIRECT_FIELD_NAME from django.utils.http import is_safe_url def get_redirect_location(request, redirect_field_name=REDIRECT_FIELD_NAME, default='/'): """Attempt to choose an optimal redirect location. If a location is specified via a request parameter, that location will...
from urllib.parse import urlparse, urlunparse from django.contrib.auth import REDIRECT_FIELD_NAME from django.utils.http import is_safe_url def get_redirect_location(request, redirect_field_name=REDIRECT_FIELD_NAME, default='/'): """Attempt to choose an optimal redirect location. If a location is specified ...
Return just path when getting redirect location from REFERER
Return just path when getting redirect location from REFERER In response.get_redirect_location(). There's no need to include the scheme and host in a redirect back to the same site. Removing them makes redirect URLs more concise.
Python
mit
PSU-OIT-ARC/django-arcutils,wylee/django-arcutils,PSU-OIT-ARC/django-arcutils,wylee/django-arcutils
9d8b648163ede522eed6d9b742e8e7393dc2f6dc
vispy/testing/__init__.py
vispy/testing/__init__.py
# -*- coding: utf-8 -*- # Copyright (c) 2014, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. from ._testing import (SkipTest, requires_application, requires_img_lib, # noqa has_backend, requires_pyopengl, # noqa requires_s...
# -*- coding: utf-8 -*- # Copyright (c) 2014, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ Testing ======= This module provides functions useful for running tests in vispy. Tests can be run in a few ways: * From Python, you can import ``vispy`` and do ``vis...
Document test system a bit
DOC: Document test system a bit
Python
bsd-3-clause
Eric89GXL/vispy,michaelaye/vispy,Eric89GXL/vispy,drufat/vispy,dchilds7/Deysha-Star-Formation,bollu/vispy,jdreaver/vispy,jdreaver/vispy,bollu/vispy,sbtlaarzc/vispy,jay3sh/vispy,inclement/vispy,sh4wn/vispy,drufat/vispy,hronoses/vispy,bollu/vispy,julienr/vispy,ghisvail/vispy,sbtlaarzc/vispy,kkuunnddaannkk/vispy,sh4wn/visp...
e4297f0f7149763f6e93536746e3c87f9d1fa699
tests/test_watchmedo.py
tests/test_watchmedo.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from watchdog import watchmedo import pytest import yaml import os def test_load_config_valid(tmpdir): """Verifies the load of a valid yaml file""" yaml_file = os.path.join(tmpdir, 'config_file.yaml') with open(yaml_file, 'w') as f: ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from watchdog import watchmedo import pytest from yaml.constructor import ConstructorError from yaml.scanner import ScannerError import os def test_load_config_valid(tmpdir): """Verifies the load of a valid yaml file""" yaml_file = os.path.join...
Fix watchmedo tests in Windows
Fix watchmedo tests in Windows Unexpectedly, but on test_load_config_invalid running, PyYAML get_single_data() raises different execptions for Linux and Windows. This PR adds ScannerError for passing tests under Windows.
Python
apache-2.0
gorakhargosh/watchdog,gorakhargosh/watchdog
5076055b54d18ea2441abaf604a4ea4dd79353c5
cybox/test/objects/__init__.py
cybox/test/objects/__init__.py
import cybox.utils class ObjectTestCase(object): """A base class for testing all subclasses of ObjectProperties. Each subclass of ObjectTestCase should subclass both unittest.TestCase and ObjectTestCase, and defined two class-level fields: - klass: the ObjectProperties subclass being tested - obj...
import cybox.utils class ObjectTestCase(object): """A base class for testing all subclasses of ObjectProperties. Each subclass of ObjectTestCase should subclass both unittest.TestCase and ObjectTestCase, and defined two class-level fields: - klass: the ObjectProperties subclass being tested - obj...
Expand default testing on new object types
Expand default testing on new object types
Python
bsd-3-clause
CybOXProject/python-cybox
7aff5878747c000c5868e3a5ddd8b205d74770b0
thinc/extra/load_nlp.py
thinc/extra/load_nlp.py
import numpy try: import spacy except ImportError: spacy = None SPACY_MODELS = {} VECTORS = {} def get_spacy(lang, **kwargs): global SPACY_MODELS if spacy is None: raise ImportError("Could not import spacy. Is it installed?") if lang not in SPACY_MODELS: SPACY_MODELS[lang] = spacy...
import numpy SPACY_MODELS = {} VECTORS = {} def get_spacy(lang, **kwargs): global SPACY_MODELS import spacy if lang not in SPACY_MODELS: SPACY_MODELS[lang] = spacy.load(lang, **kwargs) return SPACY_MODELS[lang] def get_vectors(ops, lang): global VECTORS key = (ops.device, lang) ...
Improve import of spaCy, to prevent cycles
Improve import of spaCy, to prevent cycles
Python
mit
explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc
0cf18a615ef671e6bee44da386016d8ab1b8b012
Generator.py
Generator.py
import random def generateWord(meaning, form, categories, settings, formrules=None): '''Takes an English string, desired form, generation categories, settings, and optional form-specific rules. Returns a generated word. ''' word = "" minS = settings["minS"] maxS = settings["maxS"] def...
import random import re def generateWord(meaning, form, categories, settings, phonotactics, formrules=None): '''Takes an English string, desired form, generation categories, settings, and optional form-specific rules. Returns a generated word. ''' word = "" minS = settings["m...
Add applyPhonotactics() and use it in generation
Add applyPhonotactics() and use it in generation
Python
mit
kdelwat/Lexeme
f97b5ec83601430ae63ac6c0a6e651cc7a0cf90d
project/encode.py
project/encode.py
from msgpack import packb, Unpacker from snappy import compress, decompress # noqa from btree import Tree, Node, Leaf, LazyNode def encode_btree(obj): if isinstance(obj, (Tree, Node, Leaf)): return {'__class__': obj.__class__.__name__, 'data': obj.to_json()} elif isinstance(obj, LazyN...
from msgpack import packb, unpackb, Unpacker from snappy import compress, decompress # noqa from btree import Tree, Node, Leaf, LazyNode from checksum import add_integrity, check_integrity def encode_btree(obj): if isinstance(obj, (Tree, Node, Leaf)): return {'__class__': obj.__class__.__name__, ...
Add compression and integrity checks
Add compression and integrity checks
Python
mit
Snuggert/moda
7cc968f90407745b84bd2f663e5f64b9c0923605
project/manage.py
project/manage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import environ if __name__ == "__main__": if os.path.isfile('.env'): environ.Env.read_env('.env') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") from django.core.management import execute_from_command_lin...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import environ ROOT_DIR = environ.Path(__file__) - 1 if __name__ == "__main__": if os.path.isfile(str(ROOT_DIR + '.env')): environ.Env.read_env(str(ROOT_DIR + '.env')) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.lo...
Use full path in case the working dir is not the same
Use full path in case the working dir is not the same
Python
mit
hacklab-fi/asylum,hacklab-fi/asylum,HelsinkiHacklab/asylum,jautero/asylum,hacklab-fi/asylum,HelsinkiHacklab/asylum,jautero/asylum,hacklab-fi/asylum,rambo/asylum,jautero/asylum,rambo/asylum,rambo/asylum,rambo/asylum,jautero/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum
d33d791a5e90ab1a389d85b5e93df7f07167eb5b
tests/integration/test_home_page.py
tests/integration/test_home_page.py
from flask import url_for import pytest from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions from selenium.webdriver.support.wait import WebDriverWait from tests.helpers import slow @pytest.mark.usefixtures('live_server') @slow def test_home_page_accessible(selenium)...
from flask import url_for import pytest from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions from selenium.webdriver.support.wait import WebDriverWait from tests.helpers import slow @pytest.mark.usefixtures('live_server') @slow def test_home_page_accessible(selenium)...
Update tests to reflect title change
Update tests to reflect title change
Python
isc
textbook/flash,textbook/flash,textbook/flash
24d148e33218a3f08a56a95052b0cfe8ecb0cecd
pykka/__init__.py
pykka/__init__.py
""" Pykka is a concurrency abstraction which makes actors look like regular objects. See http://jodal.github.com/pykka/ for more information. """ from pykka.actor import Actor from pykka.future import Future, get_all, wait_all from pykka.proxy import ActorProxy, CallableProxy from pykka.registry import ActorRegistry ...
from pykka.actor import Actor from pykka.future import Future, get_all, wait_all from pykka.proxy import ActorProxy, CallableProxy from pykka.registry import ActorRegistry __all__ = ['Actor', 'ActorProxy', 'ActorRegistry', 'CallableProxy', 'Future', 'get_all', 'wait_all'] VERSION = (0, 4) def get_version(): ...
Remove docstring which only repeats the readme
Remove docstring which only repeats the readme
Python
apache-2.0
jodal/pykka,tamland/pykka,tempbottle/pykka
b74971eaf180c14fef68142bffc689b1bc7340f4
approvaltests/Namer.py
approvaltests/Namer.py
import inspect import os class Namer(object): ClassName = '' MethodName = '' Directory = '' def setForStack(self, caller): stackFrame = caller[self.frame] self.MethodName = stackFrame[3] self.ClassName = stackFrame[0].f_globals["__name__"] self.Directory = os.path.dirn...
import inspect import os class Namer(object): ClassName = '' MethodName = '' Directory = '' def setForStack(self, caller): stackFrame = caller[self.frame] self.MethodName = stackFrame[3] self.ClassName = stackFrame[0].f_globals["__name__"] self.Directory = os.path.dirn...
Create approval file path that works on Linux and Windows.
Create approval file path that works on Linux and Windows.
Python
apache-2.0
approvals/ApprovalTests.Python,approvals/ApprovalTests.Python,approvals/ApprovalTests.Python,tdpreece/ApprovalTests.Python
9ea35a99c30f2ec7ed3946e71a286e689d2a50a3
api/tests/test_signup.py
api/tests/test_signup.py
from django.test import TestCase from api.views.signup import signup from rest_framework.test import APIRequestFactory from api import factories, serializers from api.models import User from api.serializers import UserSerializer class SignupTest(TestCase): PASSWORD = 'test' def setUp(self): self.fac...
from django.test import TestCase from api.views.signup import signup from rest_framework.test import APIRequestFactory from api import factories from api.serializers import UserSerializer class SignupTest(TestCase): PASSWORD = 'test' REQUIRED_FIELD_ERROR = 'This field is required.' def setUp(self): ...
Add test for errors, but User fields need to become required first
Add test for errors, but User fields need to become required first
Python
mit
frostblooded/kanq,frostblooded/kanq,frostblooded/kanq,frostblooded/kanq,frostblooded/kanq
de9e8ab1a91e2a0e69971f9c23377f97e717b048
app/__init__.py
app/__init__.py
from app.main import bundle_app # noqa # NOTE: uncomment out while genrating migration # app = bundle_app({'MIGRATION': True})
import os from app.main import bundle_app # noqa # NOTE: uncomment out while genrating migration # app = bundle_app({'MIGRATION': True}) application = bundle_app({ 'CLI_OR_DEPLOY': True, 'GUNICORN': 'gunicorn' in os.environ.get('SERVER_SOFTWARE', '')}) # noqa
Add additional application for gunicorn.
Add additional application for gunicorn.
Python
mpl-2.0
mrf345/FQM,mrf345/FQM,mrf345/FQM,mrf345/FQM
60f666a7d3aac09b5fa8e3df29d0ff08b67eac3c
tools/gyp/find_mac_gcc_version.py
tools/gyp/find_mac_gcc_version.py
#!/usr/bin/env python # Copyright (c) 2013, 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. import re import subprocess import sys def main(): job = subprocess.Popen(['xcode...
#!/usr/bin/env python # Copyright (c) 2013, 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. import re import subprocess import sys def main(): job = subprocess.Popen(['xcode...
Revert "Revert "Use clang on mac if XCode >= 4.5""
Revert "Revert "Use clang on mac if XCode >= 4.5"" The V8 dependency has been removed, so we should be able to enable clang on mac again. R=ricow@google.com Review URL: https://codereview.chromium.org//14751012 git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@22304 260f80e4-7a28-3924-810f-c04153c831b5
Python
bsd-3-clause
dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk...
2206b4b96805e35a612f471fb8f843b35fe45021
code/dstruct/Word.py
code/dstruct/Word.py
#! /usr/bin/env python3 """ A Word class Originally obtained from the 'pharm' repository, but modified. """ class Word(object): doc_id = None sent_id = None insent_idx = None word = None pos = None ner = None lemma = None dep_path = None dep_parent = None sent_id = None ...
#! /usr/bin/env python3 """ A Word class Originally obtained from the 'pharm' repository, but modified. """ class Word(object): doc_id = None sent_id = None in_sent_idx = None word = None pos = None ner = None lemma = None dep_path = None dep_parent = None sent_id = None ...
Fix name of an attribute and PEP8-ify
Fix name of an attribute and PEP8-ify
Python
apache-2.0
HazyResearch/dd-genomics,HazyResearch/dd-genomics,HazyResearch/dd-genomics,amwenger/dd-genomics,HazyResearch/dd-genomics,rionda/dd-genomics,rionda/dd-genomics,amwenger/dd-genomics,amwenger/dd-genomics,HazyResearch/dd-genomics
2d1c8a62295ed5150f31e11cdbbf98d4d74498d8
bin/cgroup-limits.py
bin/cgroup-limits.py
#!/usr/bin/python env_vars = {} def read_file(path): try: with open(path, 'r') as f: return f.read().strip() except IOError: return None def get_memory_limit(): limit = read_file('/sys/fs/cgroup/memory/memory.limit_in_bytes') if limit: env_vars['MEMORY_LIMIT_IN_B...
#!/usr/bin/python env_vars = {} def read_file(path): try: with open(path, 'r') as f: return f.read().strip() except IOError: return None def get_memory_limit(): limit = read_file('/sys/fs/cgroup/memory/memory.limit_in_bytes') if limit: env_vars['MEMORY_LIMIT_IN_B...
Set MAX_MEMORY_LIMIT_IN_BYTES to number returned by cgroups where there is no limit
Set MAX_MEMORY_LIMIT_IN_BYTES to number returned by cgroups where there is no limit
Python
apache-2.0
openshift/sti-base,hhorak/sti-base,soltysh/sti-base,openshift/sti-base,bparees/sti-base,sclorg/s2i-base-container,mfojtik/sti-base,mfojtik/sti-base,bparees/sti-base
25dfc009b380b2a63619651dbcba2c7d7ade929c
deep_parse.py
deep_parse.py
#!/usr/bin/env python """Simple library for parsing deeply nested structure (dict, json) into regular object. You can specify fields to extract, and argument names in created object. Example content = { 'name': 'Bob', 'details': { 'email': 'bob@email.com', } } fields = ...
#!/usr/bin/env python """Simple library for parsing deeply nested structure (dict, json) into regular object. You can specify fields to extract, and argument names in created object. Example content = { 'name': 'Bob', 'details': { 'email': 'bob@email.com', } } fields = ...
Add __repr__ and __str__ methods to dummy object.
Add __repr__ and __str__ methods to dummy object.
Python
mit
bradojevic/deep-parse
905b7849d319e5147653754ceaead333873bd401
packager/rpm/test/test_build.py
packager/rpm/test/test_build.py
#! /usr/bin/python from build_rpm import BuildModelRPM from nose.tools import * @raises(TypeError) def test_fail_with_no_parameters(): BuildModelRPM(None) @raises(TypeError) def test_fail_with_one_parameter(): BuildModelRPM("hydrotrend") def test_hydrotrend_version_none(): BuildModelRPM("hydrotrend", No...
#! /usr/bin/python from packager.rpm.build import BuildRPM from nose.tools import * @raises(TypeError) def test_fail_with_no_parameters(): BuildRPM(None) @raises(TypeError) def test_fail_with_one_parameter(): BuildRPM("hydrotrend") def test_hydrotrend_version_none(): BuildRPM("hydrotrend", None) def te...
Update unit tests for packager.rpm.build.py
Update unit tests for packager.rpm.build.py
Python
mit
csdms/packagebuilder
cbcd4ebcc01646382595ce9ee10d278120ce00ce
pets/common/views.py
pets/common/views.py
from django.db.models import Count from django.shortcuts import render from django.views.generic import TemplateView from django.views.generic.base import ContextMixin from meupet import models def get_adoption_kinds(): return get_kind_list([models.Pet.FOR_ADOPTION, models.Pet.ADOPTED]) def get_lost_kinds(): ...
from django.db.models import Count from django.shortcuts import render from django.views.generic import TemplateView from django.views.generic.base import ContextMixin from meupet import models def get_adoption_kinds(): return get_kind_list([models.Pet.FOR_ADOPTION, models.Pet.ADOPTED]) def get_lost_kinds(): ...
Remove useless code from the home view
Remove useless code from the home view
Python
mit
dirtycoder/pets,dirtycoder/pets,dirtycoder/pets
736d4b8207cb63bda86f4338c08cc8719416fbe7
gauge/__init__.py
gauge/__init__.py
# -*- coding: utf-8 -*- """ gauge ~~~~~ Deterministic linear gauge library. :copyright: (c) 2013-2017 by What! Studio :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from gauge.__about__ import __version__ # noqa from gauge.constants import CLAMP, ERROR, OK, O...
# -*- coding: utf-8 -*- """ gauge ~~~~~ Deterministic linear gauge library. :copyright: (c) 2013-2017 by What! Studio :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from gauge.__about__ import __version__ # noqa from gauge.constants import CLAMP, ERROR, OK, O...
Fix pickle failure in PyPy
Fix pickle failure in PyPy
Python
bsd-3-clause
what-studio/gauge
cfcd3aa71001f74915a938aa0ec1ae58c4db3e06
src/oscar_accounts/__init__.py
src/oscar_accounts/__init__.py
# Setting for template directory not found by app_directories.Loader. This # allows templates to be identified by two paths which enables a template to be # extended by a template with the same identifier. TEMPLATE_DIR = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'templates/accounts') default_...
import os # Setting for template directory not found by app_directories.Loader. This # allows templates to be identified by two paths which enables a template to be # extended by a template with the same identifier. TEMPLATE_DIR = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'templates/accounts'...
Undo removing `import os` statement
Undo removing `import os` statement
Python
bsd-3-clause
django-oscar/django-oscar-accounts,django-oscar/django-oscar-accounts
9a239c993502e3f317edd478a5d8b5f225c24b18
globus_cli/run.py
globus_cli/run.py
from globus_cli.parsing import globus_main_func from globus_cli.login import login_command from globus_cli.list_commands import list_commands from globus_cli.config_command import config_command from globus_cli.helpers import common_options from globus_cli.services.auth import auth_command from globus_cli.services.tr...
from globus_cli.parsing import globus_main_func from globus_cli.login import login_command from globus_cli.list_commands import list_commands from globus_cli.config_command import config_command from globus_cli.services.auth import auth_command from globus_cli.services.transfer import transfer_command @globus_main_...
Fix doubled-help on main command
Fix doubled-help on main command Main command was being doubly decorated with the common options. As a result, it had funky looking helptext.
Python
apache-2.0
globus/globus-cli,globus/globus-cli
d406aa60f31f5e318a46e84539546a4452574ce6
src/rtruffle/source_section.py
src/rtruffle/source_section.py
class SourceCoordinate(object): _immutable_fields_ = ['_start_line', '_start_column', '_char_idx'] def __init__(self, start_line, start_column, char_idx): self._start_line = start_line self._start_column = start_column self._char_idx = char_idx def get_start_line(self): ...
class SourceCoordinate(object): _immutable_fields_ = ['_start_line', '_start_column', '_char_idx'] def __init__(self, start_line, start_column, char_idx): self._start_line = start_line self._start_column = start_column self._char_idx = char_idx def get_start_line(self): ...
Initialize char_length with a number
Initialize char_length with a number And make var name `file` less ambiguous by using `file_name` instead. Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>
Python
mit
SOM-st/RPySOM,smarr/RTruffleSOM,SOM-st/RTruffleSOM,smarr/PySOM,SOM-st/PySOM,SOM-st/RPySOM,smarr/RTruffleSOM,SOM-st/RTruffleSOM,smarr/PySOM,SOM-st/PySOM
321a0cea6a71e29a3f00116c52c1056d7dcfef7e
daskfunk/__init__.py
daskfunk/__init__.py
from __future__ import absolute_import, division, print_function from .core import compile from ._info import __version__
from __future__ import absolute_import, division, print_function from .core import compile
Remove import of deleted file
Remove import of deleted file
Python
mit
Savvysherpa/dask-funk
aff8945aef3f10fa9d1243b25301e84611c27422
aleph/views/status_api.py
aleph/views/status_api.py
import logging from flask import Blueprint, request from aleph.model import Collection from aleph.queues import get_active_collection_status from aleph.views.util import jsonify from aleph.logic import resolver from aleph.views.util import require log = logging.getLogger(__name__) blueprint = Blueprint('status_api',...
import logging from flask import Blueprint, request from aleph.model import Collection from aleph.queues import get_active_collection_status from aleph.views.util import jsonify from aleph.views.util import require log = logging.getLogger(__name__) blueprint = Blueprint('status_api', __name__) @blueprint.route('/a...
Load only the active collections instead of all accessible collections
Load only the active collections instead of all accessible collections
Python
mit
alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph
3082fb50c028979643d479c0e65cb92ef12de586
hunter/udacity.py
hunter/udacity.py
import requests import os class UnauthorizedToken(Exception): pass class UdacityConnection: def __init__(self): self.certifications_url = 'https://review-api.udacity.com/api/v1/me/certifications.json' token = os.environ.get('UDACITY_AUTH_TOKEN') self.headers = {'Authorization': toke...
import requests import os class UnauthorizedToken(Exception): pass class UdacityConnection: def __init__(self): self.certifications_url = 'https://review-api.udacity.com/api/v1/me/certifications.json' token = os.environ.get('UDACITY_AUTH_TOKEN') self.headers = {'Authorization': toke...
Add request to inside of try
Add request to inside of try
Python
mit
anapaulagomes/reviews-assigner
3e37885f7241b985740bf753ca237c31497ac57e
courriers/management/commands/mailjet_sync_unsubscribed.py
courriers/management/commands/mailjet_sync_unsubscribed.py
from django.core.management.base import BaseCommand from django.db import DEFAULT_DB_ALIAS from optparse import make_option class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--connection', action='store', dest='connection', ...
from django.core.management.base import BaseCommand from django.db import DEFAULT_DB_ALIAS from optparse import make_option class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--connection', action='store', dest='connection', ...
Use list comprehension for mailjet_users list
Use list comprehension for mailjet_users list
Python
mit
ulule/django-courriers,ulule/django-courriers
ce3028f29e40ce72693394798ca0a8daa98c1a4a
data/make_hash_dict.py
data/make_hash_dict.py
import data, json, os, sys def make_hash_dict(top): """ Returns a dictionary with file paths and corresponding hashes. Parameters ---------- data : str The path to the directory containing files needing hashes. Returns ------- hash_dict : dict Dictionary with file ...
import data, json, os, sys def make_hash_dict(top): """ Returns a dictionary with file paths and corresponding hashes. Parameters ---------- data : str The path to the directory containing files needing hashes. Returns ------- hash_dict : dict Dictionary with file ...
Make JSON containing paths and hashs
WIP: Make JSON containing paths and hashs
Python
bsd-3-clause
berkeley-stat159/project-delta
8660d5570144894cf4e6e07b3a30526b35575dce
test/Analysis/analyzer_test.py
test/Analysis/analyzer_test.py
import lit.formats import lit.TestRunner # Custom format class for static analyzer tests class AnalyzerTest(lit.formats.ShTest): def execute(self, test, litConfig): result = self.executeWithAnalyzeSubstitution( test, litConfig, '-analyzer-constraints=range') if result.code == lit.Test...
import lit.formats import lit.TestRunner # Custom format class for static analyzer tests class AnalyzerTest(lit.formats.ShTest): def execute(self, test, litConfig): results = [] # Parse any test requirements ('REQUIRES: ') saved_test = test lit.TestRunner.parseIntegratedTestScript...
Improve test handling with multiple constraint managers
[analyzer]: Improve test handling with multiple constraint managers Summary: Modify the test infrastructure to properly handle tests that require z3, and merge together the output of all tests on success. This is required for D28954. Reviewers: dcoughlin, zaks.anna, NoQ, xazax.hun Subscribers: cfe-commits Different...
Python
apache-2.0
llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-cl...
53025df032e1b9296713f3d8f7866e9936ed1af7
qsimcirq/_version.py
qsimcirq/_version.py
"""The version number defined here is read automatically in setup.py.""" __version__ = "0.12.1"
"""The version number defined here is read automatically in setup.py.""" __version__ = "0.12.2.dev20220422"
Update to dev version 2022-04-22
Update to dev version 2022-04-22
Python
apache-2.0
quantumlib/qsim,quantumlib/qsim,quantumlib/qsim,quantumlib/qsim
3f65b43bce12739af8bb3dfc451a7f58a6af12b1
dbaas/api/environment.py
dbaas/api/environment.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from rest_framework import viewsets, serializers from physical import models class EnvironmentSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = models.Environment fields = ('url', 'id', 'name',)...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from rest_framework import viewsets, serializers from physical.models import Environment class EnvironmentSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Environment fields = ('url', 'id', 'na...
Add povisioner and stage on env API
Add povisioner and stage on env API
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
c897942c8b1c3d9283ea6453bcc6616ca3d5108e
builds/python3.6_ci/src/lint_turtle_files.py
builds/python3.6_ci/src/lint_turtle_files.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ This script takes the path to a directory, and looks for any Turtle files (https://www.w3.org/TeamSubmission/turtle/), then uses RDFLib to check if they're valid TTL. It exits with code 0 if all files are valid, 1 if not. """ print("Hello, I am turtle linter")
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ This script takes the path to a directory, and looks for any Turtle files (https://www.w3.org/TeamSubmission/turtle/), then uses RDFLib to check if they're valid TTL. It exits with code 0 if all files are valid, 1 if not. """ import logging import os import daiquir...
Write a proper Turtle linter
Write a proper Turtle linter
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
62f028d61b9d5669bc05c2bbe5ce5f4e0d4401cc
src/vimapt/library/vimapt/RemoteRepo.py
src/vimapt/library/vimapt/RemoteRepo.py
#!/usr/bin/env python import os from .data_format import dumps class RemoteRepo(object): def __init__(self, repo_dir): self.repo_dir = repo_dir # initial setup pool_relative_dir = "pool" package_relative_path = "index/package" self.pool_absolute_dir = os.path.join(self.r...
#!/usr/bin/env python import os from .data_format import dumps class RemoteRepo(object): def __init__(self, repo_dir): self.repo_dir = repo_dir # initial setup pool_relative_dir = "pool" package_relative_path = "index/package" self.pool_absolute_dir = os.path.join(self.r...
Fix bug when parse version info
Fix bug when parse version info
Python
mit
howl-anderson/vimapt,howl-anderson/vimapt
726c4f14fd5ddd49024163182917aeb9f4af504d
src/wirecloud/core/catalogue_manager.py
src/wirecloud/core/catalogue_manager.py
# -*- coding: utf-8 -*- # Copyright 2012 Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
# -*- coding: utf-8 -*- # Copyright 2012 Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
Make published mashups visibles to all users
Make published mashups visibles to all users
Python
agpl-3.0
jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud
32cd8227260f5c2fedc50b9b817ee27df2398a82
Server/Code/database/model.py
Server/Code/database/model.py
from config import PASSWORD_LENGTH from sqlalchemy import BigInteger, Column, ForeignKey, String from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class User(Base): __tablename__ = 'user' id = Column(BigInteger, primary_key=True, autoincrement=True) password = Column(Stri...
from config import PASSWORD_LENGTH from sqlalchemy import BigInteger, Column, ForeignKey, String from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class User(Base): __tablename__ = 'user' id = Column(BigInteger, primary_key=True, autoincrement=True) password = Column(Stri...
Update user, fight foreign key dependency
Update user, fight foreign key dependency
Python
mit
HueyPark/Unreal-Knights,HueyPark/Unreal-Knights,HueyPark/Unreal-Knights,HueyPark/Unreal-Knights
6854f889e38f565acb80c52a74df09730e0f7e45
uitools/notifications/linux.py
uitools/notifications/linux.py
from gi.repository import GLib, Notify as LibNotify class Notification(object): def __init__(self, title, message, subtitle=None, sticky=False): self.title = title self.subtitle = subtitle self.message = message self.sticky = sticky self._sent = False def send(self):...
from gi.repository import GLib, Notify as LibNotify DEV = False class Notification(object): def __init__(self, title, message, subtitle=None, sticky=False): self.title = title self.subtitle = subtitle self.message = message self.sticky = sticky self._sent = False de...
Clean up for production Linux use
Clean up for production Linux use
Python
bsd-3-clause
westernx/uitools