commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
3cb6abf9c079cf17a9c4c0def102338945fabfa1 | Fix fasttext loading | tomekkorbak/treehopper,tomekkorbak/treehopper | utils.py | utils.py | import os
import torch
from gensim.models import KeyedVectors
from gensim.models.wrappers import FastText
from vocab import Vocab
def load_word_vectors(embeddings_path):
if os.path.isfile(embeddings_path+ '.pth') and os.path.isfile(embeddings_path+ '.vocab'):
print('==> File found, loading to memory')
... | import os
import torch
from gensim.models import KeyedVectors
from gensim.models.wrappers import FastText
from vocab import Vocab
def load_word_vectors(embeddings_path):
if os.path.isfile(embeddings_path+ '.pth') and os.path.isfile(embeddings_path+ '.vocab'):
print('==> File found, loading to memory')
... | apache-2.0 | Python |
fe01a92cac476fef87f4a1fc9a862f21eb9aaa4b | Add support for geography option in geodjango | theatlantic/django-south,theatlantic/django-south | south/introspection_plugins/geodjango.py | south/introspection_plugins/geodjango.py | """
GeoDjango introspection rules
"""
import django
from django.conf import settings
from south.modelsinspector import add_introspection_rules
has_gis = "django.contrib.gis" in settings.INSTALLED_APPS
if has_gis:
# Alright,import the field
from django.contrib.gis.db.models.fields import GeometryField
... | """
GeoDjango introspection rules
"""
import django
from django.conf import settings
from south.modelsinspector import add_introspection_rules
has_gis = "django.contrib.gis" in settings.INSTALLED_APPS
if has_gis:
# Alright,import the field
from django.contrib.gis.db.models.fields import GeometryField
... | apache-2.0 | Python |
037fd3abf2c9a0942b70b83c0504a082cfeadabb | FIX integer division to double slash | pdebuyl/pyh5md | examples/random_walk_1d_analysis.py | examples/random_walk_1d_analysis.py | # -*- coding: utf-8 -*-
# Copyright 2012, 2013, 2016 Pierre de Buyl
# Copyright 2013 Felix Hoëfling
#
# This file is part of pyh5md
#
# pyh5md is free software and is licensed under the modified BSD license (see
# LICENSE file).
import numpy as np
import matplotlib.pyplot as plt
from pyh5md import File, element
# Ope... | # -*- coding: utf-8 -*-
# Copyright 2012, 2013, 2016 Pierre de Buyl
# Copyright 2013 Felix Hoëfling
#
# This file is part of pyh5md
#
# pyh5md is free software and is licensed under the modified BSD license (see
# LICENSE file).
import numpy as np
import matplotlib.pyplot as plt
from pyh5md import File, element
# Ope... | bsd-3-clause | Python |
7c2b1dbed09fe08b44fdbbd50ac59af8e5357ea6 | add published to admin | MichalMaM/ella,WhiskeyMedia/ella,petrlosa/ella,petrlosa/ella,whalerock/ella,ella/ella,whalerock/ella,MichalMaM/ella,whalerock/ella,WhiskeyMedia/ella | ella/articles/admin.py | ella/articles/admin.py | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from ella.core.admin import PublishableAdmin, ListingInlineAdmin
from ella.articles.models import Article
class ArticleAdmin(PublishableAdmin):
ordering = ('-created',)
fieldsets = (
(_("Article heading"), {'fiel... | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from ella.core.admin import PublishableAdmin, ListingInlineAdmin
from ella.articles.models import Article
class ArticleAdmin(PublishableAdmin):
ordering = ('-created',)
fieldsets = (
(_("Article heading"), {'fiel... | bsd-3-clause | Python |
5b011488b5fcfd17f2029e833b757d24d437908e | Revert to Beta as document_page is Beta | OCA/knowledge,OCA/knowledge,OCA/knowledge | document_page_project/__manifest__.py | document_page_project/__manifest__.py | # Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com) - Lois Rilo
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Document Page Project",
"summary": "This module links document pages to projects",
"version": "13.0.1.0.1",
"development_status": "Beta",
"categor... | # Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com) - Lois Rilo
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Document Page Project",
"summary": "This module links document pages to projects",
"version": "13.0.1.0.1",
"development_status": "Production/Stable",... | agpl-3.0 | Python |
3277c486d337c87b8c7c0d0fea1e8a5be4c48deb | Add function to print planet as roman numeral. | StephenSwat/eve_lunar_mining_organiser,StephenSwat/eve_lunar_mining_organiser | elmo/eve_sde/models.py | elmo/eve_sde/models.py | from django.db import models
import roman
class Region(models.Model):
id = models.IntegerField(primary_key=True)
name = models.CharField(
db_index=True,
unique=True,
max_length=64
)
def __str__(self):
return self.name
class Constellation(models.Model):
id = mod... | from django.db import models
class Region(models.Model):
id = models.IntegerField(primary_key=True)
name = models.CharField(
db_index=True,
unique=True,
max_length=64
)
def __str__(self):
return self.name
class Constellation(models.Model):
id = models.IntegerFie... | mit | Python |
f40bf1441121c138877e27bd23bcef73cf5c2cef | Move ok response creation to pytest fixture | Vnet-as/cisco-olt-http-client,beezz/cisco-olt-http-client | cisco_olt_http/tests/test_operations.py | cisco_olt_http/tests/test_operations.py |
import os
import pytest
import requests
from cisco_olt_http import operations
from cisco_olt_http.client import Client
@pytest.fixture
def data_dir():
return os.path.abspath(
os.path.join(os.path.dirname(__file__), 'data'))
@pytest.fixture
def ok_response(data_dir, mocker):
response = mocker.Mock(a... |
import os
import pytest
import requests
from cisco_olt_http import operations
from cisco_olt_http.client import Client
@pytest.fixture
def data_dir():
return os.path.abspath(
os.path.join(os.path.dirname(__file__), 'data'))
def test_get_data():
client = Client('http://base-url')
show_equipment_... | mit | Python |
9f07865d3a57ec4683d4d7e47e6d1f1568d8dd29 | Fix test_get_replay_file_name for windows | pjbull/cookiecutter,Springerle/cookiecutter,cguardia/cookiecutter,venumech/cookiecutter,hackebrot/cookiecutter,takeflight/cookiecutter,audreyr/cookiecutter,ramiroluz/cookiecutter,michaeljoseph/cookiecutter,terryjbates/cookiecutter,Springerle/cookiecutter,stevepiercy/cookiecutter,takeflight/cookiecutter,terryjbates/cook... | tests/replay/test_replay.py | tests/replay/test_replay.py | # -*- coding: utf-8 -*-
"""
test_replay
-----------
"""
import os
import pytest
from cookiecutter import replay, main, exceptions
def test_get_replay_file_name():
"""Make sure that replay.get_file_name generates a valid json file path."""
exp_replay_file_name = os.path.join('foo', 'bar.json')
assert re... | # -*- coding: utf-8 -*-
"""
test_replay
-----------
"""
import pytest
from cookiecutter import replay, main, exceptions
def test_get_replay_file_name():
"""Make sure that replay.get_file_name generates a valid json file path."""
assert replay.get_file_name('foo', 'bar') == 'foo/bar.json'
@pytest.fixture(... | bsd-3-clause | Python |
19af4b5c8c849750dd0885ea4fcfb651545b7985 | Remove disallowed fields before resaving on migrations. | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | migrations/002_add_month_start.py | migrations/002_add_month_start.py | """
Add _week_start_at field to all documents in all collections
"""
from backdrop.core.bucket import utc
from backdrop.core.records import Record
import logging
log = logging.getLogger(__name__)
def up(db):
for name in db.collection_names():
log.info("Migrating collection: {0}".format(name))
col... | """
Add _week_start_at field to all documents in all collections
"""
from backdrop.core.bucket import utc
from backdrop.core.records import Record
import logging
log = logging.getLogger(__name__)
def up(db):
for name in db.collection_names():
log.info("Migrating collection: {0}".format(name))
col... | mit | Python |
39c6b5b14153fe3c7fb03f0e4f7c96fb90e0e91c | Fix openssl dependant recipe: scrypt (and grants python3 compatibility) | PKRoma/python-for-android,rnixx/python-for-android,PKRoma/python-for-android,rnixx/python-for-android,rnixx/python-for-android,PKRoma/python-for-android,germn/python-for-android,kronenpj/python-for-android,kronenpj/python-for-android,rnixx/python-for-android,germn/python-for-android,PKRoma/python-for-android,rnixx/pyth... | pythonforandroid/recipes/scrypt/__init__.py | pythonforandroid/recipes/scrypt/__init__.py | from pythonforandroid.recipe import CythonRecipe
class ScryptRecipe(CythonRecipe):
version = '0.8.6'
url = 'https://bitbucket.org/mhallin/py-scrypt/get/v{version}.zip'
depends = ['setuptools', 'openssl']
call_hostpython_via_targetpython = False
patches = ["remove_librt.patch"]
def get_recipe... | import os
from pythonforandroid.recipe import CythonRecipe
class ScryptRecipe(CythonRecipe):
version = '0.8.6'
url = 'https://bitbucket.org/mhallin/py-scrypt/get/v{version}.zip'
depends = [('python2', 'python3crystax'), 'setuptools', 'openssl']
call_hostpython_via_targetpython = False
patches = [... | mit | Python |
1bc2fe0ca44d6906bb0044a4d880bd606c2f44d6 | Update postgresql.py | sch3m4/intelmq,pkug/intelmq,robcza/intelmq,pkug/intelmq,aaronkaplan/intelmq,sch3m4/intelmq,certtools/intelmq,robcza/intelmq,sch3m4/intelmq,pkug/intelmq,robcza/intelmq,pkug/intelmq,sch3m4/intelmq,aaronkaplan/intelmq,robcza/intelmq,certtools/intelmq,certtools/intelmq,aaronkaplan/intelmq | src/bots/outputs/postgresql/postgresql.py | src/bots/outputs/postgresql/postgresql.py | import sys
import psycopg2
from lib.bot import *
from lib.utils import *
from lib.event import *
class PostgreSQLBot(Bot):
def init(self):
con = None
try:
self.con = psycopg2.connect(
database=self.parameters.database,
... | import sys
import psycopg2
import time
from lib.bot import *
from lib.utils import *
from lib.event import *
from lib.cache import *
class PostgreSQLBot(Bot):
def init(self):
con = None
try:
self.con = psycopg2.connect(
database=self.parameters.... | agpl-3.0 | Python |
099855fa4e56d6fe54c7260cb149bb41640f0e43 | Add test for populateQueryMetrics | Azure/azure-sdk-for-python,Azure/azure-documentdb-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python | test/query_tests.py | test/query_tests.py | import unittest
import pydocumentdb.document_client as document_client
import pydocumentdb.documents as documents
import test.test_config as test_config
class QueryTest(unittest.TestCase):
"""Test to ensure escaping of non-ascii characters from partition key"""
host = test_config._test_config.host
masterK... | import unittest
import pydocumentdb.document_client as document_client
import pydocumentdb.documents as documents
import test.test_config as test_config
class QueryTest(unittest.TestCase):
"""Test to ensure escaping of non-ascii characters from partition key"""
host = test_config._test_config.host
masterK... | mit | Python |
b615bce7bb9fcdab8d3c364e459d7ce516665feb | fix on messages type | messagebird/python-rest-api | messagebird/verify.py | messagebird/verify.py | from messagebird.base import Base
from messagebird.recipient import Recipient
from messagebird.message import Message
class Verify(Base):
def __init__(self):
self.id = None
self.href = None
self.type = None
self.originator = None
self.ref... | from messagebird.base import Base
from messagebird.recipient import Recipient
from messagebird.message import Message
class Verify(Base):
def __init__(self):
self.id = None
self.href = None
self.type = None
self.originator = None
self.ref... | bsd-2-clause | Python |
d9237f7546efa0552d8af255aa6247ba250db5e8 | fix environ test for mac/win | ponty/easyprocess,ponty/easyprocess,ponty/EasyProcess,ponty/EasyProcess | tests/test_fast/test_env.py | tests/test_fast/test_env.py | from easyprocess import EasyProcess
from nose.tools import eq_, ok_
import sys
import json
python = sys.executable
def pass_env(e):
prog = 'import os,json;print(json.dumps(dict(os.environ)))'
s = EasyProcess([python, '-c', prog], env=e).call().stdout
return json.loads(s)
def test_env():
ok_(len(pas... | from easyprocess import EasyProcess
from nose.tools import eq_, ok_
import sys
python = sys.executable
def pass_env(e):
# py37 creates "LC_CTYPE" automatically
prog = 'import os;d=dict(os.environ);d.pop("LC_CTYPE",None);print(d)'
return EasyProcess([python, '-c', prog], env=e).call().stdout
def test_en... | bsd-2-clause | Python |
a31c3ca18473cfa65bdf8538e611606049e145c3 | Remove test_sparse_scipy for now | tum-pbs/PhiFlow,tum-pbs/PhiFlow | tests/test_poisson_solve.py | tests/test_poisson_solve.py | from unittest import TestCase
import numpy as np
from phi import math
from phi.flow import CLOSED, PERIODIC, OPEN, Domain, poisson_solve
from phi.physics.pressuresolver.sparse import SparseCG, SparseSciPy
def _test_solve_no_obstacles(domain, solver):
print('Testing domain with boundaries: %s' % (domain.boundari... | from unittest import TestCase
import numpy as np
from phi import math
from phi.flow import CLOSED, PERIODIC, OPEN, Domain, poisson_solve
from phi.physics.pressuresolver.sparse import SparseCG, SparseSciPy
def _test_solve_no_obstacles(domain, solver):
print('Testing domain with boundaries: %s' % (domain.boundari... | mit | Python |
a8a6f23ac4519acdfe744a4ad3d994cbc1c3ef36 | Update deprecated usage of django-guardian "assign" | michaelwisely/django-competition,michaelwisely/django-competition,michaelwisely/django-competition | src/competition/models/organizer_model.py | src/competition/models/organizer_model.py | from django.db import models
from django.dispatch import receiver
from django.db.models.signals import post_save, pre_delete
from django.contrib.auth.models import User
from guardian.shortcuts import assign_perm, remove_perm
from competition.validators import validate_name
from competition.models.competition_model im... | from django.db import models
from django.dispatch import receiver
from django.db.models.signals import post_save, pre_delete
from django.contrib.auth.models import User
from guardian.shortcuts import assign, remove_perm
from competition.validators import validate_name
from competition.models.competition_model import ... | bsd-3-clause | Python |
87b1bed2c23fa992f16fcd6c4a32a33c6bf8ceb3 | Use `pwndbg.lib.stdio.stdio` to refactor the code | pwndbg/pwndbg,pwndbg/pwndbg,pwndbg/pwndbg,pwndbg/pwndbg | pwndbg/commands/ipython_interactive.py | pwndbg/commands/ipython_interactive.py | """
Command to start an interactive IPython prompt.
"""
import sys
from contextlib import contextmanager
import gdb
import pwndbg.color.message as M
import pwndbg.commands
import pwndbg.lib.stdio
@contextmanager
def switch_to_ipython_env():
"""We need to change stdout/stderr to the default ones, otherwise we ca... | """
Command to start an interactive IPython prompt.
"""
import sys
from contextlib import contextmanager
import gdb
import pwndbg.color.message as M
import pwndbg.commands
@contextmanager
def switch_to_ipython_env():
"""We need to change stdout/stderr to the default ones, otherwise we can't use tab or autocompl... | mit | Python |
b2fed60512b17b19850f06f4b0cdb7114dc3e27b | fix super method | LilliJane/psychic-waffle,LilliJane/psychic-waffle,LilliJane/psychic-waffle | statues/models.py | statues/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.db import models
from django.utils import timezone
from django.template.defaultfilters import slugify
# Create your models here.
class Statue(models.Model):
""" Default values for latitude and longitude are the ones from... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.db import models
from django.utils import timezone
from django.template.defaultfilters import slugify
# Create your models here.
class Statue(models.Model):
""" Default values for latitude and longitude are the ones from... | apache-2.0 | Python |
ec22975ebfad85e0c7be92acfd326aa9b4f34214 | Remove unused variable from private_torrents | Danfocus/Flexget,xfouloux/Flexget,malkavi/Flexget,ibrahimkarahan/Flexget,ratoaq2/Flexget,dsemi/Flexget,spencerjanssen/Flexget,ianstalk/Flexget,X-dark/Flexget,Pretagonist/Flexget,OmgOhnoes/Flexget,patsissons/Flexget,ianstalk/Flexget,xfouloux/Flexget,tarzasai/Flexget,sean797/Flexget,asm0dey/Flexget,drwyrm/Flexget,Danfocu... | flexget/plugins/filter/private_torrents.py | flexget/plugins/filter/private_torrents.py | import logging
from flexget.plugin import register_plugin, priority
log = logging.getLogger('priv_torrents')
class FilterPrivateTorrents(object):
"""How to handle private torrents.
private_torrents: yes|no
Example::
private_torrents: no
This would reject all torrent entries with private fla... | import logging
from flexget.plugin import register_plugin, priority
log = logging.getLogger('priv_torrents')
class FilterPrivateTorrents(object):
"""How to handle private torrents.
private_torrents: yes|no
Example::
private_torrents: no
This would reject all torrent entries with private fla... | mit | Python |
79c7f2c7294235cf14e4e6652b348f5eda9079df | bump v1.0.1 | ValvePython/steam | steam/__init__.py | steam/__init__.py | __version__ = "1.0.1"
__author__ = "Rossen Georgiev"
version_info = (1, 0, 1)
| __version__ = "1.0.0"
__author__ = "Rossen Georgiev"
version_info = (1, 0, 0)
| mit | Python |
33fcf7909421104844a952805d043e8de9e5dbcc | Test merge worker with no merges, but with commits | bussiere/gitfs,PressLabs/gitfs,rowhit/gitfs,PressLabs/gitfs,ksmaheshkumar/gitfs | tests/workers/test_merge.py | tests/workers/test_merge.py | import pytest
from mock import patch, MagicMock
from gitfs.worker.merge import MergeWorker
class TestMergeWorker(object):
def test_run(self):
mocked_queue = MagicMock()
mocked_idle = MagicMock(side_effect=ValueError)
mocked_queue.get.side_effect = ValueError()
worker = MergeWork... | import pytest
from mock import patch, MagicMock
from gitfs.worker.merge import MergeWorker
class TestMergeWorker(object):
def test_run(self):
mocked_queue = MagicMock()
mocked_idle = MagicMock(side_effect=ValueError)
mocked_queue.get.side_effect = ValueError()
worker = MergeWork... | apache-2.0 | Python |
6a00d7272a29afd21ad40768f87859e7d20526a6 | Whitelist <br> tag | emre/steemrocks,emre/steemrocks | steemrocks/app.py | steemrocks/app.py | from flask import Flask, render_template, request, redirect, abort, g, url_for
from .tx_listener import listen
from .models import Account
from .utils import get_steem_conn, Pagination
from .settings import SITE_URL
import bleach
app = Flask(__name__)
PER_PAGE = 40
@app.cli.command()
def listen_transactions():
... | from flask import Flask, render_template, request, redirect, abort, g, url_for
from .tx_listener import listen
from .models import Account
from .utils import get_steem_conn, Pagination
from .settings import SITE_URL
import bleach
app = Flask(__name__)
PER_PAGE = 40
@app.cli.command()
def listen_transactions():
... | mit | Python |
de5c0c9107156a073670d68fcb04e575e08f9b80 | Hide ctypes import error until Plot() is called. | kmacinnis/sympy,Curious72/sympy,meghana1995/sympy,MechCoder/sympy,saurabhjn76/sympy,VaibhavAgarwalVA/sympy,Designist/sympy,lidavidm/sympy,skidzo/sympy,beni55/sympy,Davidjohnwilson/sympy,jaimahajan1997/sympy,kmacinnis/sympy,MridulS/sympy,mcdaniel67/sympy,jbbskinny/sympy,pandeyadarsh/sympy,jaimahajan1997/sympy,mattpap/sy... | sympy/__init__.py | sympy/__init__.py |
__version__ = "0.5.0"
from sympy.core import *
from series import *
from simplify import *
from solvers import *
from matrices import *
from geometry import *
from polynomials import *
from utilities import *
#from specfun import *
from integrals import *
try:
from plotting import Plot
except ImportError, e:
... |
__version__ = "0.5.0"
from sympy.core import *
from series import *
from simplify import *
from solvers import *
from matrices import *
from geometry import *
from polynomials import *
from utilities import *
#from specfun import *
from integrals import *
try:
from plotting import Plot
except ImportError, e:
... | bsd-3-clause | Python |
03d63ee7819719379d8289921c7bcf30fde1aea1 | Use str.encode('hex'). | probcomp/bayeslite,probcomp/bayeslite | tests/stochastic.py | tests/stochastic.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | apache-2.0 | Python |
019c23eea2cdf486b5ebfddcc38b07d855ac19a8 | Add tests | click-contrib/click-log | tests/test_basic.py | tests/test_basic.py | # -*- coding: utf-8 -*-
import logging
import click
from click.testing import CliRunner
import click_log
import pytest
test_logger = logging.getLogger(__name__)
@pytest.fixture
def runner():
return CliRunner()
def test_basic(runner):
@click.command()
@click_log.init()
def cli():
test_l... | # -*- coding: utf-8 -*-
import logging
import click
from click.testing import CliRunner
import click_log
import pytest
test_logger = logging.getLogger(__name__)
@pytest.fixture
def runner():
return CliRunner()
def test_basic(runner):
@click.command()
@click_log.init()
def cli():
test_l... | mit | Python |
f951b38c96b87a4ea14ff0ff0e5aadb71d4357cb | Modify the MNIST testing script | Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid | tests/test_mnist.py | tests/test_mnist.py | #!/usr/bin/python2
# -*- coding: utf-8 -*-
import os
import cPickle
from reid.datasets import Datasets
from reid.optimization import sgd
from reid.models import cost_functions as costfuncs
from reid.models import active_functions as actfuncs
from reid.models.layers import FullConnLayer, ConvPoolLayer
from reid.models.... | #!/usr/bin/python2
# -*- coding: utf-8 -*-
import os
import cPickle
from reid.datasets import Datasets
from reid.optimization import sgd
from reid.models import cost_functions as costfuncs
from reid.models import active_functions as actfuncs
from reid.models.layers import FullConnLayer, ConvPoolLayer
from reid.models.... | mit | Python |
1300848ed2deb253a4423a7b5826af95c91cb31a | Add application blacklist to run tests | percyfal/snakemakelib-rules,percyfal/snakemake-rules,percyfal/snakemake-rules,percyfal/snakemakelib-rules,percyfal/snakemakelib-rules | tests/test_rules.py | tests/test_rules.py | # Copyright (C) 2016 by Per Unneberg
from os.path import abspath, dirname, join, basename
import logging
import shutil
import subprocess as sp
import pytest
logger = logging.getLogger(__name__)
stderr = None if pytest.config.getoption("--show-workflow-output") else sp.STDOUT
applications = [pytest.config.getoption("-... | # Copyright (C) 2016 by Per Unneberg
from os.path import abspath, dirname, join, basename
import logging
import shutil
import subprocess as sp
import pytest
logger = logging.getLogger(__name__)
stderr = None if pytest.config.getoption("--show-workflow-output") else sp.STDOUT
applications = [pytest.config.getoption("-... | mit | Python |
c1472d16e1d0a7c9240cdff87dc27a769e14479a | Rename variable for flake8 | geographika/mappyfile,geographika/mappyfile | tests/test_utils.py | tests/test_utils.py | import logging
import tempfile
import mappyfile
import pytest
def test_open():
fn = './tests/sample_maps/256_overlay_res.map'
d = mappyfile.open(fn)
assert d["name"] == "TEST"
d = mappyfile.open(fn, expand_includes=False)
assert d["name"] == "TEST"
d = mappyfile.open(fn, include_position=Tr... | import logging
import tempfile
import mappyfile
import pytest
def test_open():
fn = './tests/sample_maps/256_overlay_res.map'
d = mappyfile.open(fn)
assert d["name"] == "TEST"
d = mappyfile.open(fn, expand_includes=False)
assert d["name"] == "TEST"
d = mappyfile.open(fn, include_position=Tr... | mit | Python |
167787e36f282229b687fd10a03e9fbbb4b7d313 | Test utils unicode fix | alexgarciac/scrapi,fabianvf/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,jeffreyliu3230/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,fabianvf/scrapi,felliott/scrapi,erinspace/scrapi,ostwald/scrapi,mehanig/scrapi | tests/test_utils.py | tests/test_utils.py | import datetime
from dateutil.parser import parse
import six
from scrapi import util
class TestScrapiUtils(object):
def test_copy_to_unicode(self):
converted = util.copy_to_unicode('test')
assert converted == u'test'
assert isinstance(converted, six.text_type)
def test_timestamp(se... | import datetime
from dateutil.parser import parse
from scrapi import util
class TestScrapiUtils(object):
def test_copy_to_unicode(self):
converted = util.copy_to_unicode('test')
assert converted == u'test'
assert isinstance(converted, unicode)
def test_timestamp(self):
time... | apache-2.0 | Python |
c3700f51e1de4d8a4f18286a7a134b3d490dc08b | Add tests for new utils | davesque/django-rest-framework-simplejwt,davesque/django-rest-framework-simplejwt | tests/test_utils.py | tests/test_utils.py | from __future__ import unicode_literals
from datetime import datetime
from django.utils import six, timezone
from django.test import TestCase
from mock import patch
from rest_framework_simplejwt.utils import (
aware_utcnow, datetime_from_timestamp, datetime_to_epoch, format_lazy,
make_utc
)
class TestMakeUt... | from __future__ import unicode_literals
from datetime import datetime
from unittest import TestCase
from django.utils import six
from rest_framework_simplejwt.utils import datetime_to_epoch, format_lazy
class TestDatetimeToEpoch(TestCase):
def test_it_should_return_the_correct_values(self):
self.assertE... | mit | Python |
b82dbd63aedf8a6a6af494b6d6be697a9f4230d5 | Add unit test for expand_axis_label | dwf/fuel,ejls/fuel,udibr/fuel,rizar/fuel,capybaralet/fuel,rizar/fuel,EderSantana/fuel,EderSantana/fuel,orhanf/fuel,aalmah/fuel,mila-udem/fuel,mjwillson/fuel,glewis17/fuel,orhanf/fuel,dhruvparamhans/fuel,hantek/fuel,lamblin/fuel,jbornschein/fuel,dribnet/fuel,markusnagel/fuel,udibr/fuel,harmdevries89/fuel,dribnet/fuel,gl... | tests/test_utils.py | tests/test_utils.py | import pickle
from six.moves import range
from fuel.utils import do_not_pickle_attributes, expand_axis_label
@do_not_pickle_attributes("non_pickable", "bulky_attr")
class TestClass(object):
def __init__(self):
self.load()
def load(self):
self.bulky_attr = list(range(100))
self.non_pi... | import pickle
from six.moves import range
from fuel.utils import do_not_pickle_attributes
@do_not_pickle_attributes("non_pickable", "bulky_attr")
class TestClass(object):
def __init__(self):
self.load()
def load(self):
self.bulky_attr = list(range(100))
self.non_pickable = lambda x: ... | mit | Python |
3e6f835a88183182b6ebba25c61666735a69fc81 | Add more tests for the vault commandhelper | bdastur/vault-shell | tests/vaultshell.py | tests/vaultshell.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import vault_shell.vault_commandhelper as VaultHelper
class VaultShellTests(unittest.TestCase):
def test_basic(self):
print "test basic. Pass"
vaulthelper = VaultHelper.VaultCommandHelper()
self.failUnless(vaulthelper is not Non... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
class VaultShellTests(unittest.TestCase):
def test_basic(self):
print "test basic. Pass"
| apache-2.0 | Python |
fd3babd8c1b2817c7b4873529f98de02cdb63096 | Bump to 4.9.1 | figarocms/thumbor,scorphus/thumbor,davduran/thumbor,gselva/thumbor,abaldwin1/thumbor,abaldwin1/thumbor,grevutiu-gabriel/thumbor,thumbor/thumbor,davduran/thumbor,marcelometal/thumbor,food52/thumbor,thumbor/thumbor,kkopachev/thumbor,raphaelfruneaux/thumbor,camargoanderso/thumbor,figarocms/thumbor,kkopachev/thumbor,suwaji... | thumbor/__init__.py | thumbor/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
'''This is the main module in thumbor'''
__version__ = "4.9.1"
| #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
'''This is the main module in thumbor'''
__version__ = "4.9.0"
| mit | Python |
4d54261dbc751b1cbacc984a9b449da89c5a9205 | Update api | wallstreetweb/django-time-metrics,wallstreetweb/django-time-metrics | time_metrics/api.py | time_metrics/api.py | from .models import Metric, MetricItem
def put_metric(slug, object=None, count=1, **kwargs):
from django.conf import settings
from django.contrib.sites.models import Site
try:
metric = Metric.objects.get(slug=slug)
except Metric.DoesNotExist:
metric = Metric.objects.create(slug=slug, ... | from wsw_stats.utils import get_backend
def put_metric(slug, object=None, count=1, **kwargs):
backend = get_backend()
backend.put_metric(slug, object=object, count=count, **kwargs) | mit | Python |
cc309ec0061b10c2bf0fb4114dd4ed9bfdc8078f | Allow dash in name of junit_tests rule | GerritCodeReview/gerrit,GerritCodeReview/gerrit,WANdisco/gerrit,GerritCodeReview/gerrit,WANdisco/gerrit,WANdisco/gerrit,qtproject/qtqa-gerrit,WANdisco/gerrit,WANdisco/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,qtproject/qtqa-gerrit,GerritCodeReview/gerrit,WANdisco/gerrit,WANdisco/ger... | tools/bzl/junit.bzl | tools/bzl/junit.bzl | # Copyright (C) 2016 The Android Open Source Project
#
# 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 ag... | # Copyright (C) 2016 The Android Open Source Project
#
# 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 ag... | apache-2.0 | Python |
f08692645d2fe8895016acfe000e8d461dff66b7 | Change CHROME_34_REVISION to one that is available in the continuous archive (251854); the previous revision (251904) was only available in the snapshots archive, but this is not where we download from for testing. | Just-D/chromium-1,Jonekee/chromium.src,Fireblend/chromium-crosswalk,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,dednal/chromium.src,ltilve/chromium,jaruba/chromium.src,jaruba/chromium.src,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,hgl888/chromium-cr... | chrome/test/chromedriver/archive.py | chrome/test/chromedriver/archive.py | # Copyright (c) 2013 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.
"""Downloads items from the Chromium continuous archive."""
import os
import platform
import urllib
import util
CHROME_32_REVISION = '232870'
CHROME_3... | # Copyright (c) 2013 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.
"""Downloads items from the Chromium continuous archive."""
import os
import platform
import urllib
import util
CHROME_32_REVISION = '232870'
CHROME_3... | bsd-3-clause | Python |
44348bafa8f084fe1cf9b22c7d3b9add1d08e912 | Update common.py | NeblioTeam/neblio,NeblioTeam/neblio,NeblioTeam/neblio,NeblioTeam/neblio,NeblioTeam/neblio | ci_scripts/neblio_ci_libs/common.py | ci_scripts/neblio_ci_libs/common.py | import os
from subprocess import call
import sys
import errno
import urllib
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def call_with_err_code(cmd):
... | import os
from subprocess import call
import sys
import errno
import urllib
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def call_with_err_code(cmd):
... | mit | Python |
5c58bdf408122c5809880bbd93cdfccff6ca19f9 | rearrange test cases | texastribune/armstrong.apps.related_content,texastribune/armstrong.apps.related_content,armstrong/armstrong.apps.related_content,armstrong/armstrong.apps.related_content | armstrong/apps/related_content/tests/fields.py | armstrong/apps/related_content/tests/fields.py | from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericForeignKey
from django.db import models
from ._utils import *
from ..models import RelatedContent
from ..models import RelatedType
from .models import generate_model
class RelatedContentFieldTestCase(Tes... | from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericForeignKey
from django.db import models
from ._utils import *
from ..models import RelatedContent
from ..models import RelatedType
from .models import generate_model
class RelatedContentFieldTestCase(Tes... | apache-2.0 | Python |
22e8a7cb8f8412c4bb79f46e8e7ca2a540bf317c | Add stdOut and stdError to Django app data model. | artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history | src/dashboard/src/dashboard/models.py | src/dashboard/src/dashboard/models.py | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to ... | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to ... | agpl-3.0 | Python |
60ac05bbda83191a0e794322299969a3fef2f9cd | Update distancia.py | Alan-Jairo/topgeo | topgeo/distancia.py | topgeo/distancia.py | # Calculo de distancias entre puntos
## Profesor Revisor:
### Dr Ramon Solano Barajas
## Elaborado por:
### Jairo Avalos Velazquez
### Alan Mauricio Cruz Otero
def caldist(csv):
"""
Esta funcion sirve para realizar el calculo de distancias entre dos puntos.
"""
# Importamos los modulos numpy y ... | # Calculo de distancias entre puntos
## Profesor Revisor:
### Dr Ramon Solano Barajas
## Elaborado por:
### Jairo Avalos Velazquez
### Alan Mauricio Cruz Otero
def caldist(csv):
"""
Esta funcion sirve para realizar el calculo de distancias entre dos puntos.
"""
# Importamos los modulos numpy y ... | mit | Python |
e4a7eaa570964fbc2489bbce20913857b1c5c0aa | bump minor version | hammerlab/topiary,hammerlab/topiary | topiary/__init__.py | topiary/__init__.py |
from .lazy_ligandome_dict import LazyLigandomeDict, AlleleNotFound
from .converters import (
epitopes_to_dataframe,
epitopes_to_csv
)
from .predict_epitopes import (
predict_epitopes_from_args,
predict_epitopes_from_variants,
predict_epitopes_from_mutation_effects,
)
from .epitope_prediction import... |
from .lazy_ligandome_dict import LazyLigandomeDict, AlleleNotFound
from .converters import (
epitopes_to_dataframe,
epitopes_to_csv
)
from .predict_epitopes import (
predict_epitopes_from_args,
predict_epitopes_from_variants,
predict_epitopes_from_mutation_effects,
)
from .epitope_prediction import... | apache-2.0 | Python |
9d6a2862c536ef83bee085a01ea70900ec116c8c | add europarl.2019-05-23 to Broxtowe | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_broxtowe.py | polling_stations/apps/data_collection/management/commands/import_broxtowe.py | import os
from data_collection.github_importer import BaseGitHubImporter
class Command(BaseGitHubImporter):
council_id = "E07000172"
elections = ["local.2019-05-02", "europarl.2019-05-23"]
# This one is a bit of a mish-mash
# The stations are on GitHub
srid = 4326
scraper_name = "wdiv-scraper... | import os
from data_collection.github_importer import BaseGitHubImporter
class Command(BaseGitHubImporter):
council_id = "E07000172"
elections = ["local.2019-05-02"]
# This one is a bit of a mish-mash
# The stations are on GitHub
srid = 4326
scraper_name = "wdiv-scrapers/DC-PollingStations-Br... | bsd-3-clause | Python |
91004a866474c12031055a9d6ee3ee72262b2877 | Allow custom response from update_from_dict | wichert/rest_toolkit | src/rest_toolkit/views.py | src/rest_toolkit/views.py | from pyramid.httpexceptions import HTTPMethodNotAllowed
from pyramid.httpexceptions import HTTPNoContent
from .state import RestState
def unsupported_method_view(resource, request):
request.response.status_int = 405
return {'message': 'Unsupported HTTP method'}
def default_options_view(resource, request, me... | from pyramid.httpexceptions import HTTPMethodNotAllowed
from pyramid.httpexceptions import HTTPNoContent
from .state import RestState
def unsupported_method_view(resource, request):
request.response.status_int = 405
return {'message': 'Unsupported HTTP method'}
def default_options_view(resource, request, me... | bsd-2-clause | Python |
cc5f5e3c15c20d27f71afadf7a993ca7001c3f48 | Set version to 0.11-dev. | glorpen/webassets,heynemann/webassets,wijerasa/webassets,JDeuce/webassets,aconrad/webassets,glorpen/webassets,heynemann/webassets,scorphus/webassets,heynemann/webassets,scorphus/webassets,aconrad/webassets,john2x/webassets,JDeuce/webassets,aconrad/webassets,florianjacob/webassets,wijerasa/webassets,john2x/webassets,flo... | src/webassets/__init__.py | src/webassets/__init__.py | __version__ = (0, 11, 'dev')
# Make a couple frequently used things available right here.
from .bundle import Bundle
from .env import Environment
| __version__ = (0, 10)
# Make a couple frequently used things available right here.
from .bundle import Bundle
from .env import Environment
| bsd-2-clause | Python |
779359f87698a421ae0102b58d214232921a3dfc | add python 2.4 requirement | guziy/basemap,matplotlib/basemap,guziy/basemap,matplotlib/basemap | setup-data.py | setup-data.py | import sys, glob, os
major, minor1, minor2, s, tmp = sys.version_info
if major==2 and minor1<=3:
# setuptools monkeypatches distutils.core.Distribution to support
# package_data
#try: import setuptools
#except ImportError:
# raise SystemExit("""
#matplotlib requires setuptools for installation. ... | import sys, glob, os
packages = ['matplotlib.toolkits.basemap.data']
package_dirs = {'':'lib'}
boundaryfiles = glob.glob("lib/matplotlib/toolkits/basemap/data/*_f.dat")
basemap_datafiles = [os.path.basename(bfile) for bfile in boundaryfiles]
package_data = {'matplotlib.toolkits.basemap.data':basemap_data... | mit | Python |
be1faa2f8fda8b7c8ed8e6f3fd61abd16b7c7509 | update read repo example | fullstackpython/blog-code-examples,fullstackpython/blog-code-examples,fullstackpython/blog-code-examples | first-steps-gitpython/read_repo.py | first-steps-gitpython/read_repo.py | import os
from git import Repo
COMMITS_TO_PRINT = 5
def print_commit(commit):
print('----')
print(str(commit.hexsha))
print("\"{}\" by {} ({})".format(commit.summary,
commit.author.name,
commit.author.email))
print(str(commit.... | import os
from git import Repo
COMMITS_TO_PRINT = 5
def print_commit(commit):
print('----')
print(str(commit.hexsha))
print("\"{}\" by {} ({})".format(commit.summary,
commit.author.name,
commit.author.email))
print(str(commit.... | mit | Python |
20dce56f93b35ae492c8c3b57c4b75265b0002a0 | add robustness to init | KatiRG/flyingpigeon,KatiRG/flyingpigeon,KatiRG/flyingpigeon,KatiRG/flyingpigeon,bird-house/flyingpigeon,KatiRG/flyingpigeon | flyingpigeon/processes/__init__.py | flyingpigeon/processes/__init__.py | __all__ = [
"wps_subset_continents",
"wps_subset_countries",
"wps_subset_regionseurope",
"wps_subset_points",
"wps_indices_simple",
"wps_indices_percentile",
"wps_weatherregimes_ra",
"wps_weatherregimes_model",
"wps_weatherregimes_projection",
... | __all__ = [
"wps_subset_continents",
"wps_subset_countries",
"wps_subset_regionseurope",
"wps_subset_points",
"wps_indices_simple",
"wps_indices_percentile",
"wps_weatherregimes_ra",
"wps_weatherregimes_model",
"wps_weatherregimes_projection",
... | apache-2.0 | Python |
87e093f7e5309fa7ad0e96d70bb2f04ec0e29479 | bump version | eyaler/tensorpack,haamoon/tensorpack,eyaler/tensorpack,haamoon/tensorpack,ppwwyyxx/tensorpack,ppwwyyxx/tensorpack,haamoon/tensorpack | tensorpack/libinfo.py | tensorpack/libinfo.py |
# issue#1924 may happen on old systems
import cv2 # noqa
import os
# issue#7378 may happen with custom opencv. It doesn't hurt to disable opencl
os.environ['OPENCV_OPENCL_RUNTIME'] = ''
os.environ['TF_ENABLE_WINOGRAD_NONFUSED'] = '1' # issue#9339
os.environ['TF_AUTOTUNE_THRESHOLD'] = '3' # use more warm-up
os.en... |
# issue#1924 may happen on old systems
import cv2 # noqa
import os
# issue#7378 may happen with custom opencv. It doesn't hurt to disable opencl
os.environ['OPENCV_OPENCL_RUNTIME'] = ''
os.environ['TF_ENABLE_WINOGRAD_NONFUSED'] = '1' # issue#9339
os.environ['TF_AUTOTUNE_THRESHOLD'] = '3' # use more warm-up
os.en... | apache-2.0 | Python |
db6304c6bc897b18c6e71b57c22e9bda6464a13a | Add post function. | lohayon5/slacknotif | slacknotif.py | slacknotif.py | import socket
import io
import shutil
import requests
import json
key = input("Be sure to run this as root/sudo. Press enter to continue.")
webhook = input("Paste your slack webhook url: ")
filename = "slacknotif"
def post_to_slack():
slack_username = print(socket.gethostname())
slack_message = print("Test."... | import io
import shutil
print("Be sure to run this as sudo/root. Press enter to continue...")
url = input("Paste your slack webhook url: ")
filename = "slacknotif"
script = """#!/bin/bash
function post_to_slack () {
SLACK_USERNAME="$(hostname)"
SLACK_MESSAGE="$1"
SLACK_URL=$SLACK_URL
... | mit | Python |
7f1745f3967cc9c07eb2b06b9dbcbdfa6aa13251 | Update cybergis-script-geoserver-import-styles.py | state-hiu/cybergis-scripts,state-hiu/cybergis-scripts | bin/cybergis-script-geoserver-import-styles.py | bin/cybergis-script-geoserver-import-styles.py | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
import time
import os
import subprocess
#==#
import _geoserver_import_styles
#==#
parser = argparse.ArgumentParser(description='')
parser.add_argument("--path", help="The location in the filesystem of ... | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
import time
import os
import subprocess
#==#
import _geoserver_import_styles
#==#
parser = argparse.ArgumentParser(description='')
parser.add_argument("--path", help="The location in the filesystem of ... | mit | Python |
231d3cadcbdcdd15dd7bfe4c97e46e12e0d5444b | Fix the CloudFormation ValidationError message (#788) | gjtempleton/moto,kefo/moto,ZuluPro/moto,okomestudio/moto,botify-labs/moto,whummer/moto,okomestudio/moto,okomestudio/moto,william-richard/moto,rocky4570/moto,ZuluPro/moto,whummer/moto,dbfr3qs/moto,spulec/moto,gjtempleton/moto,spulec/moto,Brett55/moto,heddle317/moto,william-richard/moto,heddle317/moto,spulec/moto,heddle3... | moto/cloudformation/exceptions.py | moto/cloudformation/exceptions.py | from __future__ import unicode_literals
from werkzeug.exceptions import BadRequest
from jinja2 import Template
class UnformattedGetAttTemplateException(Exception):
description = 'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt'
status_code = 400
class ValidationError(BadReques... | from __future__ import unicode_literals
from werkzeug.exceptions import BadRequest
from jinja2 import Template
class UnformattedGetAttTemplateException(Exception):
description = 'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt'
status_code = 400
class ValidationError(BadReques... | apache-2.0 | Python |
540af49f11ae8162f73faae320da99689332dc11 | Bump to 3.8.1 | vimalloc/flask-jwt-extended | flask_jwt_extended/__init__.py | flask_jwt_extended/__init__.py | from .jwt_manager import JWTManager
from .view_decorators import (
jwt_required, fresh_jwt_required, jwt_refresh_token_required, jwt_optional
)
from .utils import (
create_refresh_token, create_access_token, get_jwt_identity,
get_jwt_claims, set_access_cookies, set_refresh_cookies,
unset_jwt_cookies, ge... | from .jwt_manager import JWTManager
from .view_decorators import (
jwt_required, fresh_jwt_required, jwt_refresh_token_required, jwt_optional
)
from .utils import (
create_refresh_token, create_access_token, get_jwt_identity,
get_jwt_claims, set_access_cookies, set_refresh_cookies,
unset_jwt_cookies, ge... | mit | Python |
cbac03ff028c84cf9b7e3a092108144fb399b49c | add test | uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw | myuw/test/api/test_affiliation.py | myuw/test/api/test_affiliation.py | import json
from myuw.test.api import MyuwApiTest, require_url
class TestApiAffiliation(MyuwApiTest):
@require_url('myuw_affiliation')
def test_javerage(self):
self.set_user('fffjjj')
response = self.get_response_by_reverse('myuw_affiliation')
self.assertEquals(response.status_code, 4... | import json
from myuw.test.api import MyuwApiTest, require_url
class TestApiAffiliation(MyuwApiTest):
@require_url('myuw_affiliation')
def test_javerage(self):
self.set_user('fffjjj')
response = self.get_response_by_reverse('myuw_affiliation')
self.assertEquals(response.status_code, 4... | apache-2.0 | Python |
7b50c9290a8c8d3481d9147ebb66d3b7868ad7fc | Write to bouncer config file | m-lab/ooni-support,hellais/ooni-support,m-lab/ooni-support,hellais/ooni-support | bouncer-plumbing/mlab-to-bouncer/makeconfig.py | bouncer-plumbing/mlab-to-bouncer/makeconfig.py | #!/usr/bin/env python
import sys
import yaml
def read_parts_from_stdin():
data = sys.stdin.read()
parts_string = data.split("----")
parts_parsed = []
for part in parts_string:
part_parsed = yaml.safe_load(part)
parts_parsed.append(part_parsed)
return parts_parsed
def assemble_boun... | #!/usr/bin/env python
import sys
import yaml
def read_parts_from_stdin():
data = sys.stdin.read()
parts_string = data.split("----")
parts_parsed = []
for part in parts_string:
part_parsed = yaml.safe_load(part)
parts_parsed.append(part_parsed)
return parts_parsed
def assemble_boun... | apache-2.0 | Python |
8170ad6cdfd2346bc24a3d743663b4866416ca83 | Add functions to add shapes and iterate over each shape to render. | thebillington/pyPhys3D | Engine.py | Engine.py | #Imports
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from shapes import Shape, Cube
#Create a game class
class Game(object):
#Constructor
def __init__(self, title, width, height, bgcolour):
#Initialise pygame
pygame.init()
#Set the size of the window
sel... | #Imports
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from shapes import Shape, Cube
#Create a game class
class Game(object):
#Constructor
def __init__(self, title, width, height, bgcolour):
#Initialise pygame
pygame.init()
#Set the size of the window
sel... | mit | Python |
c95b2dd92bb0b7e7b6bd9b57b3a5031310fdd591 | add warning message about large downloads | bthirion/nipy,nipy/nireg,alexis-roche/nipy,nipy/nipy-labs,alexis-roche/nipy,arokem/nipy,bthirion/nipy,bthirion/nipy,arokem/nipy,alexis-roche/nipy,alexis-roche/niseg,alexis-roche/nireg,alexis-roche/nireg,nipy/nipy-labs,nipy/nireg,alexis-roche/register,arokem/nipy,alexis-roche/register,bthirion/nipy,alexis-roche/register... | examples/FIAC/batch.py | examples/FIAC/batch.py | import os, time
print "WARNING: Running this program will involve downloading up to 3 gigs of data and takes a number of hours to run."
ttoc = time.time()
for subj in range(16):
os.system('python2.4 ./subject.py %d' % subj)
ttic = time.time()
print 'total time for %d subjects (minutes): %02f' % ((subj+1... | import os, time
ttoc = time.time()
for subj in range(16):
os.system('python2.4 ./subject.py %d' % subj)
ttic = time.time()
print 'total time for %d subjects (minutes): %02f' % ((subj+1), ((ttic-ttoc)/60))
ttoc = time.time()
for design in ['block', 'event']:
for which in ['delays', 'contrasts']:
... | bsd-3-clause | Python |
e9278a2e229953accb8ab9a3d44eae8e455bcb6a | fix linting | CamDavidsonPilon/lifelines | examples/cure_model.py | examples/cure_model.py | # -*- coding: utf-8 -*-
from lifelines.fitters import ParametricRegressionFitter
import autograd.numpy as np
from autograd.scipy.special import expit
import matplotlib.pyplot as plt
from scipy.stats import weibull_min
class CureModel(ParametricRegressionFitter):
_fitted_parameter_names = ["lambda_", "beta_", "rh... | # -*- coding: utf-8 -*-
from lifelines.fitters import ParametricRegressionFitter
import autograd.numpy as np
from autograd.scipy.special import expit
import matplotlib.pyplot as plt
from scipy.stats import weibull_min
class CureModel(ParametricRegressionFitter):
_fitted_parameter_names = ["lambda_", "beta_", "rh... | mit | Python |
4d270e3a0b9ab144fab26a1add81048dd4a3e3c9 | Test `back_current_density` return unit | jrsmith3/tec,jrsmith3/tec | test/test_Langmuir.py | test/test_Langmuir.py | # -*- coding: utf-8 -*-
import numpy as np
from astropy import units
import unittest
from tec.electrode import Metal
from tec.models import Langmuir
em = Metal(temp=1000., barrier=2., richardson=10.)
co = Metal(temp=300., barrier=1., richardson=10., position=10.)
class Base(unittest.TestCase):
"""
Base class... | # -*- coding: utf-8 -*-
import numpy as np
from astropy import units
import unittest
from tec.electrode import Metal
from tec.models import Langmuir
em = Metal(temp=1000., barrier=2., richardson=10.)
co = Metal(temp=300., barrier=1., richardson=10., position=10.)
class Base(unittest.TestCase):
"""
Base class... | mit | Python |
597b0505ff47de8447c7f7318f9bf0a56c890caa | Store access data as well as last event info | lshift/scrutiny,lshift/scrutiny | list-repos.py | list-repos.py | import github
import yaml
import os.path as path
from datetime import datetime, timedelta
import collections
config = yaml.load(open("backup.yaml"))
g = github.Github(login_or_token=config["admin-token"])
repos = {}
oldest_when = datetime.now() - timedelta(days=90) # Github doesn't return events more than 90 days ag... | import github
import yaml
import os.path as path
from datetime import datetime, timedelta
config = yaml.load(open("backup.yaml"))
g = github.Github(login_or_token=config["admin-token"])
repos = {}
oldest_when = datetime.now() - timedelta(days=90) # Github doesn't return events more than 90 days ago, so assume repos ... | agpl-3.0 | Python |
2d359a318ed1fa835ca986a336fc5c26ea7e326e | Fix #225, Add author in builds API | frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq | frigg/builds/serializers.py | frigg/builds/serializers.py | from rest_framework import serializers
from frigg.projects.models import Project
from .models import Build, BuildResult
class ProjectInlineSerializer(serializers.ModelSerializer):
class Meta:
model = Project
fields = (
'id',
'owner',
'name',
'priv... | from rest_framework import serializers
from frigg.projects.models import Project
from .models import Build, BuildResult
class ProjectInlineSerializer(serializers.ModelSerializer):
class Meta:
model = Project
fields = (
'id',
'owner',
'name',
'priv... | mit | Python |
53e1ff21bb219495f1b99f84dbb31624fdd35231 | Fix that crazy error that would cause enless looping... | jaredmanning/learning,jaredmanning/learning | lpthw/ex33.py | lpthw/ex33.py | #i = 0
#numbers = []
#while i < 6:
# print "At the top i is %d" % i
# numbers.append(i)
#
# i += 1
# print "Numbers now: ", numbers
# print "At the bottom i is %d" % i
#
#
#print "The numbers: "
#
#for num in numbers:
# print num
#Study Drills
print "What's the limit of the list?"
a = int(raw_input(... | #i = 0
#numbers = []
#while i < 6:
# print "At the top i is %d" % i
# numbers.append(i)
#
# i += 1
# print "Numbers now: ", numbers
# print "At the bottom i is %d" % i
#
#
#print "The numbers: "
#
#for num in numbers:
# print num
#Study Drills
print "What's the limit of the list?"
a = raw_input("> "... | mit | Python |
5df45d88d7547dafe459ef211f0ef284b18ffacc | update bash_command | bichocj/slack-deploy-github,bichocj/slack-deploy-github | lu/plugins.py | lu/plugins.py | import re
import subprocess
from slackbot.bot import listen_to
from slackbot.bot import respond_to
@respond_to('hi', re.IGNORECASE)
def hi(message):
message.reply('hi-me -> jaime XD')
message.react('+1')
@respond_to('help', re.IGNORECASE)
def help(message):
message.reply('I going to do: ')
with ope... | import re
import subprocess
from slackbot.bot import listen_to
from slackbot.bot import respond_to
@respond_to('hi', re.IGNORECASE)
def hi(message):
message.reply('hi-me -> jaime XD')
message.react('+1')
@respond_to('help', re.IGNORECASE)
def help(message):
message.reply('I going to do: ')
with ope... | apache-2.0 | Python |
f51bae0d0787e879fd7dafe5d460568c2bc8ef31 | fix e2e test fixtures to post list of jobs | kapy2010/treeherder,tojonmz/treeherder,edmorley/treeherder,wlach/treeherder,wlach/treeherder,adusca/treeherder,deathping1994/treeherder,glenn124f/treeherder,gbrmachado/treeherder,tojon/treeherder,jgraham/treeherder,moijes12/treeherder,edmorley/treeherder,avih/treeherder,akhileshpillai/treeherder,gbrmachado/treeherder,m... | tests/e2e/conftest.py | tests/e2e/conftest.py | from django.core.urlresolvers import reverse
from django.template import Context, Template
import pytest
from webtest.app import TestApp
import simplejson as json
from treeherder.webapp.wsgi import application
import os
@pytest.fixture
def pending_jobs():
"""returns a list of buildapi pending jobs"""
return j... | from django.core.urlresolvers import reverse
from django.template import Context, Template
import pytest
from webtest.app import TestApp
import simplejson as json
from treeherder.webapp.wsgi import application
import os
@pytest.fixture
def pending_jobs():
"""returns a list of buildapi pending jobs"""
return j... | mpl-2.0 | Python |
2401e8c11fb88b2da6ea1c2c376023150e2f97d6 | clean up | zujko/manage-vm,zujko/manage-vm,zujko/manage-vm | main/views.py | main/views.py | from django.shortcuts import render
from .forms import *
from proxmoxer import ProxmoxAPI
from managevm import secrets
def index(request):
return render(request, 'index.html')
def manage(request):
return render(request,'manage.html')
def create_vm(request):
if request.method == 'POST':
vm_form = VM_Form(da... | from django.shortcuts import render
from .forms import *
from proxmoxer import ProxmoxAPI
from managevm import secrets
def index(request):
return render(request, 'index.html')
def manage(request):
return render(request,'manage.html')
def create_vm(request):
if request.method == 'POST':
vm_form = VM_Form(da... | mit | Python |
2342adc6339c0cb2ae794185800286dd6d2d17f6 | introduce a new kind of exception: RedirectWarning (warning with an additional redirection button) | MarkusTeufelberger/openobject-server,MarkusTeufelberger/openobject-server,MarkusTeufelberger/openobject-server | openerp/exceptions.py | openerp/exceptions.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | agpl-3.0 | Python |
218587b68756be4f7393324fdaf04ed04d8baf3c | add offsets to tseries.api | pandas-dev/pandas,rs2/pandas,cython-testbed/pandas,GuessWhoSamFoo/pandas,louispotok/pandas,nmartensen/pandas,Winand/pandas,harisbal/pandas,toobaz/pandas,amolkahat/pandas,GuessWhoSamFoo/pandas,jreback/pandas,datapythonista/pandas,linebp/pandas,louispotok/pandas,zfrenchee/pandas,cbertinato/pandas,GuessWhoSamFoo/pandas,ha... | pandas/tseries/api.py | pandas/tseries/api.py | """
"""
from pandas.tseries.index import DatetimeIndex, date_range, bdate_range
from pandas.tseries.offsets import *
from pandas.tseries.period import PeriodIndex, period_range, pnow
from pandas.tseries.resample import TimeGrouper
| """
"""
from pandas.tseries.index import DatetimeIndex, date_range, bdate_range
from pandas.tseries.period import PeriodIndex, period_range, pnow
from pandas.tseries.resample import TimeGrouper
| bsd-3-clause | Python |
97f608ee5e2b73108de6af69db8764c9d009a873 | reorder failing presets | NervanaSystems/coach,NervanaSystems/coach,NervanaSystems/coach | rl_coach/tests/presets/test_presets.py | rl_coach/tests/presets/test_presets.py | # nasty hack to deal with issue #46
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import pytest
import os
import time
import shutil
from subprocess import Popen, DEVNULL
from rl_coach.logger import screen
FAILING_PRESETS = [
'Fetch_DDPG_HER_baselines',
'Mon... | # nasty hack to deal with issue #46
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import pytest
import os
import time
import shutil
from subprocess import Popen, DEVNULL
from rl_coach.logger import screen
FAILING_PRESETS = [
'Fetch_DDPG_HER_baselines',
'Mon... | apache-2.0 | Python |
3dd4ab569931cda3015600364a29611b0b060701 | implement FireModule | AlexandruBurlacu/keras_squeezenet,AlexandruBurlacu/keras_squeezenet | squezeenet.py | squezeenet.py | from keras.models import Model
from keras.layers import (Input, Dense, Convolution2D, MaxPooling2D,
Dropout, BatchNormalization, Flatten, merge)
from keras.optimizers import RMSProp
from keras.utils import np_utils
import numpy as np
import theano as tn
import multiprocessing as mp
tn.confi... | from keras.models import Model
from keras.layers import (Input, Dense, Convolution2D, MaxPooling2D,
Dropout, BatchNormalization, Flatten, Merge)
from keras.optimizers import RMSProp
from keras.utils import np_utils
import numpy as np
import theano as tn
import multiprocessing as mp
tn.confi... | mit | Python |
b77cc71a96d3cd9aa9475189428378b34f5f590c | fix typo in run_regression_tests.py | archos-sa/libtorrent-avp,archos-sa/libtorrent-avp,archos-sa/libtorrent-avp,archos-sa/libtorrent-avp,archos-sa/libtorrent-avp,archos-sa/libtorrent-avp | tools/run_regression_tests.py | tools/run_regression_tests.py | #!/bin/python
import run_tests
import os
import time
import subprocess
import sys
# returns a list of new revisions
def svn_fetch():
current_version = run_tests.svn_info()[0]
p = subprocess.Popen(['svn', 'up'], stdout=subprocess.PIPE)
revision = -1
output = ''
for l in p.stdout:
if 'At revision ' in l:
... | #!/bin/python
import run_tests
import os
import time
import subprocess
import sys
# returns a list of new revisions
def svn_fetch():
current_version = run_tests.svn_info()[0]
p = subprocess.Popen(['svn', 'up'], stdout=subprocess.PIPE)
revision = -1
output = ''
for l in p.stdout:
if 'At revision ' in l:
... | bsd-3-clause | Python |
32e9fb1549365be7405ba7c8c575b2dd381eeb4b | remove useless EsxTemplatePool class | OpenTouch/vsphere-client | src/template.py | src/template.py | from pyVmomi import vim
from tabulate import tabulate
from vm import vm_guess_folder
from misc import esx_name, esx_objects
###########
# HELPERS #
###########
def template_get_all(service):
l = []
vms = esx_objects(service, vim.VirtualMachine)
for v in vms:
if not v.summary.config.template:
... | from pyVmomi import vim
from tabulate import tabulate
from vm import vm_guess_folder
from misc import esx_name, esx_objects
###########
# HELPERS #
###########
def template_get_all(service):
l = []
vms = esx_objects(service, vim.VirtualMachine)
for v in vms:
if not v.summary.config.template:
... | apache-2.0 | Python |
04b8abde8e44dd6f1ccd9bbec55d0c03e89dfd49 | Update librispeech_test.py | tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets | tensorflow_datasets/audio/librispeech_test.py | tensorflow_datasets/audio/librispeech_test.py | # coding=utf-8
# Copyright 2019 The TensorFlow Datasets Authors.
#
# 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 appl... | # coding=utf-8
# Copyright 2019 The TensorFlow Datasets Authors.
#
# 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 appl... | apache-2.0 | Python |
4f88836f604bd5dbd7e38b55428f3b30d814c88a | add glsar comparison to example_gls.py | matthew-brett/draft-statsmodels,matthew-brett/draft-statsmodels | scikits/statsmodels/examples/example_gls.py | scikits/statsmodels/examples/example_gls.py | """
Example: scikis.statsmodels.GLS
"""
import scikits.statsmodels as sm
import numpy as np
data = sm.datasets.longley.Load()
data.exog = sm.add_constant(data.exog)
# The Longley dataset is a time series dataset
# Let's assume that the data is heteroskedastic and that we know
# the nature of the heteroskedasticity. ... | """
Example: scikis.statsmodels.GLS
"""
import scikits.statsmodels as sm
import numpy as np
data = sm.datasets.longley.Load()
data.exog = sm.add_constant(data.exog)
# The Longley dataset is a time series dataset
# Let's assume that the data is heteroskedastic and that we know
# the nature of the heteroskedasticity. ... | bsd-3-clause | Python |
c0d02e1f9eccf7c4aa6d28da9a3fa7f027885a11 | Remove unused import | Eric89GXL/vispy,Eric89GXL/vispy,Eric89GXL/vispy | vispy/visuals/tests/test_axis.py | vispy/visuals/tests/test_axis.py | # -*- coding: utf-8 -*-
"""
Tests for AxisVisual
"""
from vispy.scene import visuals
from vispy.testing import (requires_application, TestingCanvas,
run_tests_if_main)
@requires_application()
def test_axis():
with TestingCanvas() as c:
axis = visuals.Axis(pos=[[-1.0, 0], [1.0,... | # -*- coding: utf-8 -*-
"""
Tests for AxisVisual
"""
from vispy import scene
from vispy.scene import visuals
from vispy.testing import (requires_application, TestingCanvas,
run_tests_if_main)
@requires_application()
def test_axis():
with TestingCanvas() as c:
axis = visuals.Ax... | bsd-3-clause | Python |
4368ea7128fd850d3ee2b67243db47d92e75836f | fix test_context to use get_current_context | swenger/glitter,swenger/glitter,swenger/glitter | tests/test_context.py | tests/test_context.py | import numpy
from glitter import EnumConstant
from glitter.contexts import get_current_context
def check_property(context, name):
value = getattr(context, name)
try:
if isinstance(value, EnumConstant):
if name in ("draw_buffer", "read_buffer"):
return # avoid problems with ... | import numpy
from glitter import EnumConstant
from glitter.contexts import Context
def check_property(context, name):
value = getattr(context, name)
try:
if isinstance(value, EnumConstant):
if name in ("draw_buffer", "read_buffer"):
return # avoid problems with unavailable ... | mit | Python |
dec0bbfa4ab4c824ef93cdded281c8dd954f0c77 | Add conditional user switching only if user is not sdkman_user | Comcast/ansible-sdkman | tests/test_default.py | tests/test_default.py | sdkman_user = 'jenkins'
sdkman_group = 'jenkins'
def script_wrap(host, cmds):
# run as interactive shell to ensure .bashrc is sourced
wrapped_cmd = "/bin/bash -i -c '{0}'".format('; '.join(cmds))
if host.user.name == sdkman_user:
return wrapped_cmd
else:
return "sudo -H -u {0} {1}".fo... | sdkman_user = 'jenkins'
sdkman_group = 'jenkins'
def script_wrap(cmds):
# run as interactive shell under user to ensure .bashrc is sourced
return "sudo -H -u {0} /bin/bash -i -c '{1}'".format(
sdkman_user,
'; '.join(cmds)
)
def check_run_for_rc_and_result(cmds, expected, host, check_stde... | apache-2.0 | Python |
043b2f26f836567f3d8d755d0756522559063a0d | Fix last commit | branall1/cli53,ftahmed/cli53,branall1/cli53,jefflaplante/cli53,Collaborne/cli53,branall1/cli53,jefflaplante/cli53,Collaborne/cli53,ftahmed/cli53 | tests/test_domains.py | tests/test_domains.py | import sys
import unittest
import subprocess
import random
# copied from python 2.7 for python 2.6
def check_output(*popenargs, **kwargs):
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.')
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwar... | import unittest
import subprocess
import random
# copied from python 2.7 for python 2.6
def check_output(*popenargs, **kwargs):
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.')
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
out... | mit | Python |
80efd0cd3b050fe75fe4a96b26b35000b1d0a90b | Update test_elo_bot.py | kevswanberg/mnl_elo_bot,jdrager/mnl_elo_bot | tests/test_elo_bot.py | tests/test_elo_bot.py | import unittest
import sys
from mnl_elo_bot import elo_bot
sys.path.append(".")
class IntegrationTest(unittest.TestCase):
# Just see if it initializes and runs...
def test_process(self):
teams = elo_bot.main(False, None, '')
for team in teams.values():
self.assertIsNotNone(team.na... | import unittest
import sys
from mnl_elo_bot import elo_bot
sys.path.append(".")
class IntegrationTest(unittest.TestCase):
# Just see if it initializes and runs...
def test_process(self):
teams = elo_bot.main(False, None, '')
for team in teams.values():
self.assertIsNotNone(team... | mit | Python |
de69b8cce482edc7877d2b203accbc846656ae04 | fix test_factory attribute lookup | tyarkoni/transitions,pytransitions/transitions,pytransitions/transitions | tests/test_factory.py | tests/test_factory.py | try:
from builtins import object
except ImportError:
pass
from unittest import TestCase
from transitions.extensions import MachineFactory
class TestFactory(TestCase):
def setUp(self):
self.factory = MachineFactory()
def test_mixins(self):
machine_cls = self.factory.get_predefined()
... | try:
from builtins import object
except ImportError:
pass
from unittest import TestCase
from transitions.extensions import MachineFactory
class TestFactory(TestCase):
def setUp(self):
self.factory = MachineFactory()
def test_mixins(self):
machine_cls = self.factory.get_predefined()
... | mit | Python |
d10826960d5bafc6616dc408e0d47faf1b305269 | Fix the tests | amolenaar/gaphor,amolenaar/gaphor | gaphor/ui/tests/test_elementeditor.py | gaphor/ui/tests/test_elementeditor.py | import pytest
from gaphor.ui.elementeditor import ElementEditor
class DiagramsStub:
def get_current_view(self):
return None
@pytest.fixture
def diagrams():
return DiagramsStub()
class DummyProperties(dict):
def set(self, key, val):
self[key] = val
def test_reopen_of_window(event_man... | import pytest
from gaphor.ui.elementeditor import ElementEditor
class DiagramsStub:
def get_current_view(self):
return None
@pytest.fixture
def diagrams():
return DiagramsStub()
def test_reopen_of_window(event_manager, element_factory, diagrams):
editor = ElementEditor(event_manager, element_... | lgpl-2.1 | Python |
203425afc4a65c9ff41e86bf09da01931612b005 | Add repr test for recipe | chrisgilmerproj/brewday,chrisgilmerproj/brewday | tests/test_recipes.py | tests/test_recipes.py | import unittest
from brew.constants import IMPERIAL_UNITS
from brew.constants import SI_UNITS
from brew.recipes import Recipe
from fixtures import grain_additions
from fixtures import hop_additions
from fixtures import recipe
from fixtures import yeast
class TestRecipe(unittest.TestCase):
def setUp(self):
... | import unittest
from brew.constants import IMPERIAL_UNITS
from brew.constants import SI_UNITS
from brew.recipes import Recipe
from fixtures import grain_additions
from fixtures import hop_additions
from fixtures import recipe
from fixtures import yeast
class TestRecipe(unittest.TestCase):
def setUp(self):
... | mit | Python |
f5cf4944ee092301b0e6ddf31b14906cba2e198c | Improve documentation | pwdyson/inflect.py,hugovk/inflect.py,jazzband/inflect | tests/test_unicode.py | tests/test_unicode.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import inflect
class TestUnicode(unittest.TestCase):
""" Unicode compatibility test cases """
def test_unicode_plural(self):
""" Unicode compatibility test cases for plural """
engine = inflect... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import inflect
class TestUnicode(unittest.TestCase):
def test_unicode(self):
engine = inflect.engine()
# Unicode compatability test
unicode_test_cases = {
'cliché': 'clichés',
... | mit | Python |
07034e25419b0bca9cd07828acf14a03bdd0726b | Clarify broken line | Kitware/tangelo,Kitware/tangelo,Kitware/tangelo | tests/web/settings.py | tests/web/settings.py | import cherrypy
import tangelo
# This service reports the value of cherrypy's thread pool setting
def run(**kwargs):
if kwargs.get('pool'):
tangelo.util.set_server_setting('server.thread_pool', int(kwargs['pool']))
response = 'pool="%r"' % cherrypy.config.get('server.thread_pool')
return response
| import cherrypy
import tangelo
# This service reports the value of cherrypy's thread pool setting
def run(**kwargs):
if kwargs.get('pool'):
tangelo.util.set_server_setting('server.thread_pool',
int(kwargs['pool']))
response = 'pool="%r"' % cherrypy.config.get('server.t... | apache-2.0 | Python |
d0089aea33e773ec844964c1751157d04e27ea33 | fix implicit relative import | InFoCusp/tf_cnnvis | tf_cnnvis/__init__.py | tf_cnnvis/__init__.py | from .tf_cnnvis import get_visualization
from .tf_cnnvis import image_normalization
from .tf_cnnvis import convert_into_grid
__all__ = ["get_visualization", "image_normalization", "convert_into_grid"]
| from tf_cnnvis import *
| mit | Python |
cb934c9570eefa0aa7616f486395f1bfbc8c08cd | Update Bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
3d74a8cab311acefb499c3b1c5969b2ff9cdcd07 | Update Bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
80bf936ad8068a32313411291b5be5675decf235 | Update Bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
92adc02daae13f6ef24ae1ec2eafac77ce528a74 | Update script to start, stop and status by name. | EricSchles/veyepar,CarlFK/veyepar,yoe/veyepar,yoe/veyepar,xfxf/veyepar,EricSchles/veyepar,yoe/veyepar,xfxf/veyepar,CarlFK/veyepar,xfxf/veyepar,CarlFK/veyepar,EricSchles/veyepar,CarlFK/veyepar,xfxf/veyepar,xfxf/veyepar,CarlFK/veyepar,yoe/veyepar,yoe/veyepar,EricSchles/veyepar,EricSchles/veyepar | setup/timvideos/streaming/list_aws_hosts.py | setup/timvideos/streaming/list_aws_hosts.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# list_aws_hosts.py
# list all active ec2 hosts
"""
Start / stop by name.
Start mission "list_aws_hosts.py start mission"
Stop mission "list_aws_hosts.py stop mission"
Status mission "list_aws_hosts.py status mission"
mission i-b59966c7 **OFF** stopped
"""
from boto imp... | # list_aws_hosts.py
# list all active ec2 hosts
from boto import ec2
import pw
creds = pw.stream['aws']
ec2conn = ec2.connection.EC2Connection(creds['id'], creds['key'] )
reservations = ec2conn.get_all_instances()
instances = [i for r in reservations for i in r.instances]
for i in instances:
if not i.dns_name:
... | mit | Python |
d2a7d772826773941ad11fd92e823ec81080635d | Add SF package registry for PIO Plus | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/pioplus.py | platformio/pioplus.py | # Copyright 2014-present PlatformIO <contact@platformio.org>
#
# 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 applicabl... | # Copyright 2014-present PlatformIO <contact@platformio.org>
#
# 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 applicabl... | apache-2.0 | Python |
58a9f7ad0da5b405d5925ed45bf425e37f978fdd | increase version to 1.4.1 | SCIP-Interfaces/PySCIPOpt,SCIP-Interfaces/PySCIPOpt,mattmilten/PySCIPOpt,mattmilten/PySCIPOpt | src/pyscipopt/__init__.py | src/pyscipopt/__init__.py | __version__ = '1.4.1'
# export user-relevant objects:
from pyscipopt.Multidict import multidict
from pyscipopt.scip import Model
from pyscipopt.scip import Branchrule
from pyscipopt.scip import Conshdlr
from pyscipopt.scip import Eventhdlr
from pyscipopt.scip import Heur
from pyscipopt.scip ... | __version__ = '1.4.0'
# export user-relevant objects:
from pyscipopt.Multidict import multidict
from pyscipopt.scip import Model
from pyscipopt.scip import Branchrule
from pyscipopt.scip import Conshdlr
from pyscipopt.scip import Eventhdlr
from pyscipopt.scip import Heur
from pyscipopt.scip ... | mit | Python |
d2e8afc2abf2ded55b0c05b0eb01f9bd1fb1992b | Fix importing style | wkentaro/fcn | fcn/models/__init__.py | fcn/models/__init__.py | from fcn.models.fcn8s import FCN8s
from fcn.models.vgg16 import VGG16
| from apc2015or.models.fcn8s import *
from apc2015or.models.vgg16 import *
| mit | Python |
d267f9a8a9383a97884bbe8109aa6a1a6e478b8f | Remove f-string | beetbox/beets,beetbox/beets,beetbox/beets,beetbox/beets | beetsplug/mbsubmit.py | beetsplug/mbsubmit.py | # This file is part of beets.
# Copyright 2016, Adrian Sampson and Diego Moreda.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the righ... | # This file is part of beets.
# Copyright 2016, Adrian Sampson and Diego Moreda.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the righ... | mit | Python |
fa1b8059b03f7a4210dff7dccb44f24c41772c55 | fix smarttags message | mnot/redbot,mnot/redbot,mnot/redbot | redbot/message/headers/x_meta_mssmarttagspreventparsing.py | redbot/message/headers/x_meta_mssmarttagspreventparsing.py | #!/usr/bin/env python
from redbot.message import headers
from redbot.speak import Note, categories, levels
from redbot.type import AddNoteMethodType
class x_meta_mssmarttagspreventparsing(headers.HttpHeader):
canonical_name = "X-Meta-MSSmartTagsPreventParsing"
list_header = False
deprecated = False
v... | #!/usr/bin/env python
from redbot.message import headers
from redbot.speak import Note, categories, levels
from redbot.type import AddNoteMethodType
class x_meta_mssmarttagspreventparsing(headers.HttpHeader):
canonical_name = "X-Meta-MSSmartTagsPreventParsing"
list_header = False
deprecated = False
v... | mit | Python |
6da69eb8f13dc56cc19d06a09d74005395de8989 | Add missing attributes in TPSProcessor. | release-engineering/fedmsg_meta_umb | fedmsg_meta_umb/tps.py | fedmsg_meta_umb/tps.py | # Copyright (C) 2017 Red Hat, Inc.
#
# fedmsg_meta_umb is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# fedmsg_meta_umb is ... | # Copyright (C) 2017 Red Hat, Inc.
#
# fedmsg_meta_umb is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# fedmsg_meta_umb is ... | lgpl-2.1 | Python |
733720bf1b4ce6b559e0ef62074762e29df11ba7 | bump version to 3.0 | kanarelo/reportlab,kanarelo/reportlab,Distrotech/reportlab,Distrotech/reportlab,Distrotech/reportlab,Distrotech/reportlab,kanarelo/reportlab,kanarelo/reportlab,Distrotech/reportlab,kanarelo/reportlab | src/reportlab/__init__.py | src/reportlab/__init__.py | #Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py
__version__=''' $Id$ '''
__doc__="""The Reportlab PDF generation library."""
Version = "3.0"
import sys
if sys.version_info[0:2]!=(2, 7) ... | #Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py
__version__=''' $Id$ '''
__doc__="""The Reportlab PDF generation library."""
Version = "3.0b2"
import sys
if sys.version_info[0:2]!=(2, 7... | bsd-3-clause | Python |
35e95fc3fe2d11b5db9ea676fdac272069e18c18 | bump version number | Distrotech/reportlab,Distrotech/reportlab,kanarelo/reportlab,kanarelo/reportlab,Distrotech/reportlab,kanarelo/reportlab,kanarelo/reportlab,kanarelo/reportlab,Distrotech/reportlab,Distrotech/reportlab | src/reportlab/__init__.py | src/reportlab/__init__.py | #Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py
__version__=''' $Id$ '''
__doc__="""The Reportlab PDF generation library."""
Version = "3.0a1"
import sys
if sys.version_info[0:2]!=(2, 7... | #Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py
__version__=''' $Id$ '''
__doc__="""The Reportlab PDF generation library."""
Version = "2.7"
import sys
if sys.version_info[0:2]!=(2, 7) ... | bsd-3-clause | Python |
2ab74ea127c1e1c82a6f3df81c35aa0aec73c494 | Update cachequery.py | Nik0l/UTemPro,Nik0l/UTemPro | utils/cachequery.py | utils/cachequery.py | import shelve
import sqlite3
# a part of the code is taken from: http://www.cs.berkeley.edu/~bjoern/projects/stackoverflow/
shelvefile = '../../db/querycache.shelve'
def query(cursor,query,parameters=()):
shlv = shelve.open(shelvefile)
key = makekey(query,parameters)
if(shlv.has_key(key)):
print("f... | mit | Python | |
00d91e5b8911a8f1519281cf152b5f79cb8a15fe | correct default settings | allink/woodstock | woodstock/default_settings.py | woodstock/default_settings.py | from django.conf import settings
LANGUAGES = getattr(settings, 'LANGUAGES')
LANGUAGE_CODE = getattr(settings, 'LANGUAGE_CODE')
INVITEE_GENERATES_PASSWORD = getattr(settings, 'WOODSTOCK_INVITEE_GENERATES_PASSWORD', False)
SUBSCRIPTION_NEEDS_INVITATION = getattr(settings, 'WOODSTOCK_SUBSCRIPTION_NEEDS_INVITATION', Fal... | from django.conf import settings
LANGUAGES = getattr(settings, 'LANGUAGES')
LANGUAGE_CODE = getattr(settings, 'LANGUAGE_CODE')
INVITEE_GENERATES_PASSWORD = getattr(settings, 'WOODSTOCK_INVITEE_GENERATES_PASSWORD', False)
SUBSCRIPTION_NEEDS_INVITATION = getattr(settings, 'WOODSTOCK_SUBSCRIPTION_NEEDS_INVITATION', Fal... | bsd-3-clause | Python |
153ed6a519d6836adb02b934cff44974a7132b6d | Fix doc test failure parsing | softwaredoug/flake8_doctest | flake8/parseDocTest.py | flake8/parseDocTest.py | def parseFailDetails(failDetails):
""" Parse the line number of the doctest failure
>>> parseFailDetails("blah")
-1
"""
import re
failDetails = failDetails.split(',')
lineNo = -1
if len(failDetails) == 3:
match = re.search("line.*?(\d+)", failDetails[1])
if match is None:... | def parseFailDetails(failDetails):
""" Parse the line number of the doctest failure"""
import re
failDetails = failDetails.split(',')
lineNo = -1
if len(failDetails) == 3:
match = re.search("line.*?(\d+)", failDetails[1])
if match is None:
return lineNo
lineNo = i... | mit | Python |
e048948d5758c6bcc7ca3d5e45f20a654022de7f | Update app version | lingthio/Flask-User,lingthio/Flask-User | flask_user/__init__.py | flask_user/__init__.py | __title__ = 'Flask-User'
__description__ = 'Customizable User Authentication, User Management, and more.'
__version__ = '1.0.2.2'
__url__ = 'https://github.com/lingthio/Flask-User'
__author__ = 'Ling Thio'
__author_email__= 'ling.thio@gmail.com'
__maintainer__ = 'Ling Thio'
__license__ = 'MI... | __title__ = 'Flask-User'
__description__ = 'Customizable User Authentication, User Management, and more.'
__version__ = '1.0.2.0'
__url__ = 'https://github.com/lingthio/Flask-User'
__author__ = 'Ling Thio'
__author_email__= 'ling.thio@gmail.com'
__maintainer__ = 'Ling Thio'
__license__ = 'MI... | mit | Python |
0c87ace4f8fed068b961269e74bd1b64fae59c5f | Fix little typo | lingthio/Flask-User,lingthio/Flask-User | flask_user/__init__.py | flask_user/__init__.py | __title__ = 'Flask-User'
__description__ = 'Customizable User Authentication, User Management, and more.'
__version__ = '1.0.2.0'
__url__ = 'https://github.com/lingthio/Flask-User'
__author__ = 'Ling Thio'
__author_email__= 'ling.thio@gmail.com'
__maintainer__ = 'Ling Thio'
__license__ = 'MI... | __title__ = 'Flask-User'
__description__ = 'Customizable User Authentication, User Management, and more.'
__version__ = '1.0.2.0'
__url__ = 'https://github.com/lingthio/Flask-User'
__author__ = 'Ling Thio'
__author_email__= 'ling.thio@gmail.com'
__maintainer__ = 'Ling Thio'
__license__ = 'MI... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.