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 |
|---|---|---|---|---|---|---|---|---|
dfa291d70cb86d1d8ab0b17cc3273fcc942a2751 | Add some resilience to create_dict.py, resisting crashing on ZeroDivisionExceptions | shellphish/driller | bin/create_dict.py | bin/create_dict.py | #!/usr/bin/env pypy
import angr
import string
import sys
'''
create AFL dictionary of string references found in the binary. should allow AFL to explore more paths
without having to request symbolic execution.
'''
def hexescape(s):
out = [ ]
acceptable = string.letters + string.digits + " ."
for c in s:... | #!/usr/bin/env pypy
import angr
import string
import sys
'''
create AFL dictionary of string references found in the binary. should allow AFL to explore more paths
without having to request symbolic execution.
'''
def hexescape(s):
out = [ ]
acceptable = string.letters + string.digits + " ."
for c in s:... | bsd-2-clause | Python |
5ae9153a196a2d6a445364bdc40ea6e428bf35ff | Switch to matplotlib agg backend before importing pyplot | brendan-ward/rasterio,brendan-ward/rasterio,brendan-ward/rasterio | tests/__init__.py | tests/__init__.py | #
import matplotlib as mpl
mpl.use('agg') | #
| bsd-3-clause | Python |
3c28250fdda760f1997e6cf198657b3a7dc11bab | Remove #TODO for CLI test - done | PyThaiNLP/pythainlp | tests/__init__.py | tests/__init__.py | # -*- coding: utf-8 -*-
"""
Unit test.
Each file in tests/ is for each main package.
"""
import sys
import unittest
sys.path.append("../pythainlp")
loader = unittest.TestLoader()
testSuite = loader.discover("tests")
testRunner = unittest.TextTestRunner(verbosity=2)
testRunner.run(testSuite)
| # -*- coding: utf-8 -*-
"""
Unit test.
Each file in tests/ is for each main package.
#TODO Test for CLI
"""
import sys
import unittest
sys.path.append("../pythainlp")
loader = unittest.TestLoader()
testSuite = loader.discover("tests")
testRunner = unittest.TextTestRunner(verbosity=2)
testRunner.run(testSuite)
| apache-2.0 | Python |
056ca70c96390af73954b86c1143160a94f030a9 | Test fix | acrispin/python-react,abdelouahabb/python-react,arceduardvincent/python-react,abdelouahabb/python-react,acrispin/python-react,markfinger/python-react,arceduardvincent/python-react,markfinger/python-react | tests/__init__.py | tests/__init__.py | import os
import atexit
import subprocess
process = subprocess.Popen(
args=('node', os.path.join(os.path.dirname(__file__), 'test_server.js'),),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
# Ensure the process is killed on exit
atexit.register(lambda _process: _process.kill(), process)
output = pr... | import os
import atexit
import subprocess
process = subprocess.Popen(
args=('node', os.path.join(os.path.dirname(__file__), '..', 'example', 'server.js'),),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
# Ensure the process is killed on exit
atexit.register(lambda _process: _process.kill(), process)
... | mit | Python |
545dbf5f702ff6857d5c8ace98524a875559e408 | fix another import | biokit/biokit,biokit/biokit | biokit/__init__.py | biokit/__init__.py | """Main entry point to biokit
::
import biokit as bk
from bk import bioservices
from bk import sequence
from bioservices.apps import get_fasta
fasta = get_fasta("P43403")
seq = sequence.FASTA(fasta)
seq.plot()
"""
__version__ = "0.1"
import pkg_resources
try:
version = pkg_resource... | """Main entry point to biokit
::
import biokit as bk
from bk import bioservices
from bk import sequence
from bioservices.apps import get_fasta
fasta = get_fasta("P43403")
seq = sequence.FASTA(fasta)
seq.plot()
"""
__version__ = "0.1"
import pkg_resources
try:
version = pkg_resource... | bsd-2-clause | Python |
106b4166c9eb84ff068466444506a3bafa192a52 | Increase the maximum waylength | janLo/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,eXma/meet-and-eat-distribution-tool,janLo/meet-and-eat-distribution-tool,janLo/meet-and-eat-distribution-tool | mue/integration_test.py | mue/integration_test.py | from random import choice
import json
import sys
import pymue
from collections import defaultdict
MAX_WAY = 9.3
def way_cost(way_length):
if way_length <= 1:
return way_length * 100
elif way_length < MAX_WAY:
return (way_length * 100) ** 2
return sys.float_info.max
print("read data...."... | from random import choice
import json
import sys
import pymue
from collections import defaultdict
MAX_WAY = 7.8
def way_cost(way_length):
if way_length <= 1:
return way_length * 100
elif way_length < MAX_WAY:
return (way_length * 100) ** 2
return sys.float_info.max
print("read data...."... | bsd-3-clause | Python |
700c64f1c238cdd80e46649ab8c989bf290cde68 | fix imports | RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu | rasa_nlu/evaluate.py | rasa_nlu/evaluate.py | import logging
from rasa_nlu.test import main
logger = logging.getLogger(__name__)
if __name__ == '__main__': # pragma: no cover
logger.warning("Calling `rasa_nlu.evaluate` is deprecated. "
"Please use `rasa_nlu.test` instead.")
main()
| import logging
import rasa_nlu.test as test
logger = logging.getLogger(__name__)
if __name__ == '__main__': # pragma: no cover
logger.warning("Calling `rasa_nlu.evaluate` is deprecated. "
"Please use `rasa_nlu.test` instead.")
test.main()
| apache-2.0 | Python |
6e921cd2f1f6954a51ba7861a3d58fe21bd91017 | Reduce penalties for high difficulty | vkramskikh/cgminer-pool-chooser | rating_calculator.py | rating_calculator.py | from math import exp
import logging
logger = logging.getLogger(__name__)
class RatingCalculator(object):
@staticmethod
def analyze_exchange_volume(currency):
# price of coins with low exchange volume is usually not stable, reduce rating
exchange_ratio = currency['exchange_ratio'] = currency['... | from math import exp
import logging
logger = logging.getLogger(__name__)
class RatingCalculator(object):
@staticmethod
def analyze_exchange_volume(currency):
# price of coins with low exchange volume is usually not stable, reduce rating
exchange_ratio = currency['exchange_ratio'] = currency['... | mit | Python |
28ccd5b5dec0ac6e8724af3c61d167771b4d9c77 | bump version 0.1.8 | sripathikrishnan/redis-rdb-tools | rdbtools/__init__.py | rdbtools/__init__.py | from rdbtools.parser import RdbCallback, RdbParser, DebugCallback
from rdbtools.callbacks import JSONCallback, DiffCallback, ProtocolCallback
from rdbtools.memprofiler import MemoryCallback, PrintAllKeys, StatsAggregator
__version__ = '0.1.8'
VERSION = tuple(map(int, __version__.split('.')))
__all__ = [
'RdbParse... | from rdbtools.parser import RdbCallback, RdbParser, DebugCallback
from rdbtools.callbacks import JSONCallback, DiffCallback, ProtocolCallback
from rdbtools.memprofiler import MemoryCallback, PrintAllKeys, StatsAggregator
__version__ = '0.1.7'
VERSION = tuple(map(int, __version__.split('.')))
__all__ = [
'RdbParse... | mit | Python |
f5e2a65abbfb956ee6837763dc289d0f5bb68453 | Update prices.py | architecture-building-systems/CEAforArcGIS,architecture-building-systems/CEAforArcGIS | cea/optimization/prices.py | cea/optimization/prices.py | # -*- coding: utf-8 -*-
"""
This file imports the price details from the cost database as a class. This helps in preventing multiple importing
of the corresponding values in individual files.
"""
from __future__ import division
import numpy as np
__author__ = "Jimeno A. Fonseca"
__copyright__ = "Copyright 2019, Archit... | # -*- coding: utf-8 -*-
"""
This file imports the price details from the cost database as a class. This helps in preventing multiple importing
of the corresponding values in individual files.
"""
from __future__ import division
__author__ = "Jimeno A. Fonseca"
__copyright__ = "Copyright 2019, Architecture and Building... | mit | Python |
81f4f4b1318ff800e3febbc1bd7bbd9ff8e868b1 | Add some exception handling for dict | muddyfish/PYKE,muddyfish/PYKE | node/dictionary.py | node/dictionary.py | #!/usr/bin/env python
from nodes import Node
import json
class Dictionary(Node):
char = ".d"
args = 0
results = 1
def __init__(self, word_ids:Node.IntList):
if not hasattr(Dictionary, "word_list"):
Dictionary.word_list = init_words()
self.words = " ".join(Dictionary.wo... | #!/usr/bin/env python
from nodes import Node
import json
class Dictionary(Node):
char = ".d"
args = 0
results = 1
def __init__(self, word_ids:Node.IntList):
if not hasattr(Dictionary, "word_list"):
Dictionary.word_list = init_words()
self.words = " ".join(Dictionary.wo... | mit | Python |
bb3605bd99892bed37ecb2b6371d2bc88d599e1a | Include "OpenStack" string in the user agent | alvarolopez/caso,IFCA/caso,IFCA/caso | caso/__init__.py | caso/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2014 Spanish National Research Council (CSIC)
#
# 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
#
# Unle... | # -*- coding: utf-8 -*-
# Copyright 2014 Spanish National Research Council (CSIC)
#
# 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
#
# Unle... | apache-2.0 | Python |
9bc822e4e602682ae4ee8cf782436898e54c1761 | fix typo | cloudfleet/marina-registry-web | marina_web.py | marina_web.py | from flask import Flask, jsonify, request
import settings, traceback, getopt, sys, os
import repositories
import github
app = Flask(__name__)
api_base = "/api/v1"
@app.route(api_base + '/repos/', methods=['GET'])
def list_repositories():
repository_list = repositories.load_repository_list()
return jsonify(... | from flask import Flask, jsonify, request
import settings, traceback, getopt, sys, os
import repositories
import github
app = Flask(__name__)
api_base = "/api/v1"
@app.route(api_base + '/repos/', methods=['GET'])
def list_repositories():
repository_list = repositories.load_repository_list()
return jsonify(... | agpl-3.0 | Python |
20e4ef8b4f717a4dae43c6eff16a88ec48ec0066 | Remove unused code | lamyj/redmill,lamyj/redmill,lamyj/redmill | src/redmill/models/item.py | src/redmill/models/item.py | # This file is part of Redmill.
#
# Redmill is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Redmill is distributed in the ho... | # This file is part of Redmill.
#
# Redmill is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Redmill is distributed in the ho... | agpl-3.0 | Python |
fa48bf16d975b5149871901a567dd6ec5c1bc56f | Fix inspector.get_config | csomh/atomic-reactor-inspect-plugins | inspectors.py | inspectors.py | """
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
from __future__ import print_function
def get_config(self, module):
self.log.info('get_config o... | """
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
from __future__ import print_function
def get_config(self, module):
self.log.info('get_config o... | bsd-3-clause | Python |
45968d8075ac419f0651a41981e75f58d70411cf | add random_subset() | rlowrance/mlpack,rlowrance/mlpack | numpy_utilities.py | numpy_utilities.py | '''utility functions that take numpy array's as arguments'''
import numpy as np
import unittest
def random_subset(matrix, n):
'''pick a random subset without replacement of size n form the matrix'''
selected = np.random.choice(matrix.shape[0], size=n, replace=False)
return matrix[selected]
class TestRan... | import numpy as np
import unittest
def almost_equal(a, b, tolerance, verbose=False):
return almostEqual(a, b, tolerance, verbose)
def almostEqual(a, b, tolerance, verbose=False):
'''Check if |a - b| < tolerance.'''
diff = np.linalg.norm(a - b, 2)
ok = diff < tolerance
if verbose and not ok:
... | mit | Python |
b988a19583d7153f71a15d34f83f63ba7004fe68 | Improve my_menu.py. It's not looking terrible. | codypiersall/platformer | lib/my_menu.py | lib/my_menu.py | import pygame
pygame.init()
if not pygame.display.get_init():
pygame.display.init()
if not pygame.font.get_init():
pygame.font.init()
class Menu(object):
FONT = pygame.font.Font('../coders_crux.ttf', 32)
SPACE = 10
UP = pygame.K_UP
DOWN = pygame.K_DOWN
def __init__... | import pygame
pygame.init()
if not pygame.display.get_init():
pygame.display.init()
if not pygame.font.get_init():
pygame.font.init()
class Menu(object):
FONT = pygame.font.Font('../coders_crux.ttf', 32)
def __init__(self, screen, items, font=FONT):
self.items = it... | bsd-3-clause | Python |
aba6fadf2ac4064a3ec7fdac05ea1b00a9591627 | add defensive unicode | cds-amal/addressparser,cds-amal/addressparser,cds-amal/addressparser,cds-amal/addressparser | nyctext/adparse.py | nyctext/adparse.py | """
Usage:
adparse --file=<infile> [--trace]
adparse [--trace] [--geo] <text>
Options:
-h --help Show this screen.
--version Show version.
--file=<infile> Input file.
--trace Print trace statement
--geo Return Geolocation attributes [default: False]
"""
from do... | """
Usage:
adparse --file=<infile> [--trace]
adparse [--trace] [--geo] <text>
Options:
-h --help Show this screen.
--version Show version.
--file=<infile> Input file.
--trace Print trace statement
--geo Return Geolocation attributes [default: False]
"""
from do... | mit | Python |
707bbb0667edfc9df15863286a02f64adfb5544d | leverage os.path.relpath if available | Martix/Eonos,libo/openembedded,thebohemian/openembedded,JamesAng/goe,hulifox008/openembedded,sutajiokousagi/openembedded,JamesAng/goe,John-NY/overo-oe,xifengchuo/openembedded,scottellis/overo-oe,sampov2/audio-openembedded,buglabs/oe-buglabs,yyli/overo-oe,scottellis/overo-oe,SIFTeam/openembedded,thebohemian/openembedded... | lib/oe/path.py | lib/oe/path.py | def join(*paths):
"""Like os.path.join but doesn't treat absolute RHS specially"""
import os.path
return os.path.normpath("/".join(paths))
def relative(src, dest):
""" Return a relative path from src to dest.
>>> relative("/usr/bin", "/tmp/foo/bar")
../../tmp/foo/bar
>>> relative("/usr/bi... | def join(*paths):
"""Like os.path.join but doesn't treat absolute RHS specially"""
import os.path
return os.path.normpath("/".join(paths))
def relative(src, dest):
""" Return a relative path from src to dest.
>>> relative("/usr/bin", "/tmp/foo/bar")
../../tmp/foo/bar
>>> relative("/usr/bi... | mit | Python |
ffa31e55c8444b5203a0308910cf315765add708 | add working methods, except remove | palindromed/data-structures | linked_list.py | linked_list.py | class LinkedList(object):
def __init__(self, iterable=None):
self.head_node = Node(None, None)
if iterable is not None:
for n in range(0, len(iterable)):
self.insert(iterable[n])
def insert(self, val):
"""Insert a new value at the head of the list."""
... | class LinkedList(object):
def __init__(self, iterable=None):
if iterable is None:
self.head_node = Node(None, None)
else:
pass
def insert(self, val):
"""Insert a new value at the head of the list."""
self.head_node = Node(val, self.head_node)
def pop... | mit | Python |
1acf3ac3a90764899a616e44baf0fa5b7dac44c2 | Fix batch test | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/cli/batch.py | tests/integration/cli/batch.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>`
'''
# Import Salt Libs
import integration
# Import Salt Testing Libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
class BatchTest(integration.ShellCase):
'''
Integration tests for the... | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>`
'''
# Import Salt Libs
import integration
# Import Salt Testing Libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
class BatchTest(integration.ShellCase):
'''
Integration tests for the... | apache-2.0 | Python |
ebf5e05acfb7f1edce0c0987576ee712f3fdea54 | Fix tests to use pytest | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | test/scripts/test_sequana_coverage.py | test/scripts/test_sequana_coverage.py | from sequana.scripts import coverage
from sequana import sequana_data
import pytest
prog = "sequana_coverage"
@pytest.fixture
def coveragefix():
import os
# local nosetests execution
try:os.remove('README')
except:pass
try:os.remove('quality.rules')
except:pass
try:os.remove('config.yaml')... | from sequana.scripts import coverage
from nose.plugins.attrib import attr
from sequana import sequana_data
#@attr("skip")
class TestPipeline(object):
@classmethod
def setup_class(klass):
"""This method is run once for each class before any tests are run"""
klass.prog = "sequana_coverage"
... | bsd-3-clause | Python |
1984ed2b1bf91137280582558437d8a507d88b14 | Fix in TBTestSuite to call TBTestCase | S41nz/TBTAF,S41nz/TBTAF | tbtaf/executor/TBTestSuite.py | tbtaf/executor/TBTestSuite.py | from TBTAFTrace import *
from TBTestCase import *
class TBTestSuite:
''' getSuiteResult() --- addTestCase(TBTestCase) --- getTestCases():TBTestCase[] --- getSuiteTrace():TBTAFTrace[] '''
def getSuiteResult(self):
return "This is a result"
def addTestCase(self,TBTestCase):
return "T... | from TBTAFTrace import *
from TBTestCase import *
class TBTestSuite:
''' getSuiteResult() --- addTestCase(TBTestCase) --- getTestCases():TBTestCase[] --- getSuiteTrace():TBTAFTrace[] '''
def getSuiteResult(self):
return "This is a result"
def addTestCase(self,TBTestCase):
return "T... | apache-2.0 | Python |
26d1d6de4e75766fe1e543ee3af2d6016c087e5b | Update tests | guillermooo/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle | tests/test_dartlint.py | tests/test_dartlint.py | import sublime
import unittest
from Dart.lib.path import is_dart_script
from Dart.lib.path import is_view_dart_script
from Dart.lib.path import extension_equals
from Dart.lib.path import view_extension_equals
class Test_is_dart_script(unittest.TestCase):
def testSucceedsIfDartScript(self):
self.assertTr... | import unittest
import sublime
from Dart.dartlint import is_dart_script
from Dart.dartlint import is_view_dart_script
from Dart.dartlint import extension_equals
from Dart.dartlint import view_extension_equals
class Test_is_dart_script(unittest.TestCase):
def testSucceedsIfDartScript(self):
self.assertTr... | bsd-3-clause | Python |
2b5c186337bcb396f630c0b86938e43eb06d3e5b | Add test checking only for imports | dls-controls/i10switching,dls-controls/i10switching | tests/test_i10knobs.py | tests/test_i10knobs.py | from pkg_resources import require
require("cothread")
require("mock")
import unittest
import mock
import sys
# Mock out catools as it requires EPICS binaries at import
sys.modules['cothread.catools'] = mock.MagicMock()
import cothread
import sys
import os
from PyQt4 import QtGui
sys.path.append(os.path.join(os.path.d... | from pkg_resources import require
require("cothread")
require("mock")
import unittest
import mock
import sys
# Mock out catools as it requires EPICS binaries at import
sys.modules['cothread.catools'] = mock.MagicMock()
import cothread
import sys
import os
from PyQt4 import QtGui
sys.path.append(os.path.join(os.path.d... | apache-2.0 | Python |
a55dd124d54955476411ee8ae830c9fd3c4f00dc | Test get_errors() method of LatexBuildError. | mbr/latex | tests/test_pdfbuild.py | tests/test_pdfbuild.py | from latex import build_pdf, LatexBuildError
from latex.errors import parse_log
import pytest
def test_generates_something():
min_latex = r"""
\documentclass{article}
\begin{document}
Hello, world!
\end{document}
"""
pdf = build_pdf(min_latex)
assert pdf
def test_raises_correct_exception_on_fail():
... | from latex import build_pdf
from latex.exc import LatexBuildError
import pytest
def test_generates_something():
min_latex = r"""
\documentclass{article}
\begin{document}
Hello, world!
\end{document}
"""
pdf = build_pdf(min_latex)
assert pdf
def test_raises_correct_exception_on_fail():
broken_late... | bsd-3-clause | Python |
8535c59c26e2c5badfd3637d41901f1bc987e200 | Add a test for the __call__ method of the APIRequest class. | openspending/gobble | tests/test_requests.py | tests/test_requests.py | """Test the api_requests module."""
from pytest import mark
from gobble.api_requests import APIRequest
SIMPLE = ('foo.bar', dict(), ['https://foo.bar'])
LOCAL = ('0.0.0.0', dict(port=5000, schema='http'), ['http://0.0.0.0:5000'])
LONG = (
'foo.bar',
dict(
path=['spam', 'eggs'],
query={'foo': ... | """Test the api_requests module."""
from pytest import mark
from gobble.api_requests import APIRequest
SIMPLE = ('foo.bar', dict(), ['https://foo.bar'])
LOCAL = ('0.0.0.0', dict(port=5000, schema='http'), ['http://0.0.0.0:5000'])
LONG = (
'foo.bar',
dict(
path=['spam', 'eggs'],
query={'foo': ... | mit | Python |
acc64adea162a6920143c0b2416e05095859814b | Disable Shell for subprocess.call. | inetprocess/docker-lamp,inetprocess/docker-lamp,edyan/stakkr,edyan/stakkr,inetprocess/docker-lamp,edyan/stakkr | lib/docker.py | lib/docker.py | from json import loads as json_loads
import subprocess
def get_vms():
cmd = ['python', 'bin/compose', 'ps', '-q']
vms_id = subprocess.check_output(cmd).splitlines()
vms_info = dict()
for vm_id in vms_id:
vm_id = vm_id.decode('utf-8', 'strict')
vms_info[vm_id] = extract_vm_info(vm_id)
... | from json import loads as json_loads
import subprocess
def get_vms():
cmd = ['python', 'bin/compose', 'ps', '-q']
vms_id = subprocess.check_output(cmd, shell=True).splitlines()
vms_info = dict()
for vm_id in vms_id:
vm_id = vm_id.decode('utf-8', 'strict')
vms_info[vm_id] = extract_vm_i... | apache-2.0 | Python |
443373703ae321c66076644c4c97abde3e693133 | Add fix for broken test post submission | ollien/Timpani,ollien/Timpani,ollien/Timpani | tests/tests/addpost.py | tests/tests/addpost.py | import sqlalchemy
import selenium
from selenium.webdriver.common import keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from timpani import database
LOGIN_TITLE = "Login - Timpani"
ADD_POST_TITLE = "Add ... | import sqlalchemy
import selenium
from selenium.webdriver.common import keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from timpani import database
LOGIN_TITLE = "Login - Timpani"
ADD_POST_TITLE = "Add ... | mit | Python |
b8ac8ad15bf0fa8687527b2a180355211c2955b3 | Update refraction_test_input.py | DQE-Polytech-University/Beamplex | tests/refraction_test_input.py | tests/refraction_test_input.py | import unittest
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from src.refraction import *
class TestRefractionInput(unittest.TestCase):
def testInputCorrect(self):
try:
self.calc = RefractionCalc(0.85, [0.1, 0.1, 0.1, 0.1, 0.1])
... | mit | Python | |
0bee13a823ec41fcb4a899bcd96cd05e511c8abc | Fix the data resizer test. | berendkleinhaneveld/Registrationshop,berendkleinhaneveld/Registrationshop | tests/test_ImageDataResizer.py | tests/test_ImageDataResizer.py | import unittest
from core.data.DataResizer import DataResizer
from vtk import vtkImageData
class DataResizerTest(unittest.TestCase):
def setUp(self):
self.imageResizer = DataResizer()
def tearDown(self):
del self.imageResizer
def testDataResizer(self):
self.assertTrue(True)
def testDataResizerDimensions(... | import unittest
from core.data.DataResizer import DataResizer
from vtk import vtkImageData
class DataResizerTest(unittest.TestCase):
def setUp(self):
self.imageResizer = DataResizer()
def tearDown(self):
del self.imageResizer
def testDataResizer(self):
self.assertTrue(True)
def testDataResizerDimensions(... | mit | Python |
03a4f552088ee6a0ab44e199035bd8fc70fbb9d5 | fix broken test | Jeff-Wang93/vent,cglewis/vent,CyberReboot/vent,CyberReboot/vent,cglewis/vent,CyberReboot/vent,cglewis/vent,Jeff-Wang93/vent,Jeff-Wang93/vent | tests/test_api_menu_helpers.py | tests/test_api_menu_helpers.py | from vent.api.menu_helpers import MenuHelper
from vent.api.plugins import Plugin
def test_cores():
""" Test the cores function """
instance = MenuHelper()
cores = instance.cores('install')
assert cores[0] == True
cores = instance.cores('build')
assert cores[0] == True
cores = instance.core... | from vent.api.menu_helpers import MenuHelper
def test_cores():
""" Test the cores function """
instance = MenuHelper()
cores = instance.cores('install')
assert cores[0] == True
cores = instance.cores('build')
assert cores[0] == True
cores = instance.cores('start')
assert cores[0] == Tr... | apache-2.0 | Python |
c81655b2853ec4e072bff79e2600b4ec5d1063d5 | Fix test_observers_winapi.py::test___init__() on Windows | gorakhargosh/watchdog,gorakhargosh/watchdog | tests/test_observers_winapi.py | tests/test_observers_winapi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 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
#
# ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 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
#
# ... | apache-2.0 | Python |
4c993698a334eac29bd8b64fd199a2caa869657b | Put the libc loading in the test. | IDSIA/sacred,IDSIA/sacred | tests/test_stdout_capturing.py | tests/test_stdout_capturing.py | #!/usr/bin/env python
# coding=utf-8
import os
import sys
import pytest
from sacred.stdout_capturing import get_stdcapturer
from sacred.optional import libc
def test_python_tee_output(capsys):
expected_lines = {
"captured stdout",
"captured stderr"}
capture_mode, capture_stdout = get_stdcapt... | #!/usr/bin/env python
# coding=utf-8
import os
import sys
import pytest
from sacred.stdout_capturing import get_stdcapturer
from sacred.optional import libc
def test_python_tee_output(capsys):
expected_lines = {
"captured stdout",
"captured stderr"}
capture_mode, capture_stdout = get_stdcapt... | mit | Python |
b9af71959bca5ccd6536994d8f56715bc70b0a57 | Fix loading config | P1X-in/Tanks-of-Freedom-Server | tof_server/__init__.py | tof_server/__init__.py | """Module init."""
from flask import Flask
from flask.ext.mysqldb import MySQL
app = Flask(__name__)
mysql = MySQL()
app.config.from_pyfile('config.py')
mysql.init_app(app)
from tof_server import views
| """Module init."""
from flask import Flask
from flask.ext.mysqldb import MySQL
app = Flask(__name__)
mysql = MySQL()
app.config.from_object('config')
mysql.init_app(app)
from tof_server import views
| mit | Python |
ca7403462588f374cf1af39d537765c02fc7726c | Fix status codes of handled responses | h2020-endeavour/endeavour,h2020-endeavour/endeavour | mctrl/rest.py | mctrl/rest.py | from flask import Flask, url_for, Response, json, request
class MonitorApp(object):
def __init__(self, monitor):
self.app = Flask(__name__)
self.app.monitor = monitor
self.setup()
def setup(self):
@self.app.route('/anomaly', methods = ['POST'])
def api_anomaly():
... | from flask import Flask, url_for, Response, json, request
class MonitorApp(object):
def __init__(self, monitor):
self.app = Flask(__name__)
self.app.monitor = monitor
self.setup()
def setup(self):
@self.app.route('/anomaly', methods = ['POST'])
def api_anomaly():
... | apache-2.0 | Python |
2717d0eec58fcce31740aa7eed863d59ca53344c | Change error | MKFMIKU/RAISR,MKFMIKU/RAISR | code/hashTable.py | code/hashTable.py | # -*- coding: utf-8 -*-
import numpy as np
def hashTable(patch,Qangle,Qstrenth,Qcoherence):
[gx,gy] = np.gradient(patch)
G = np.matrix((gx.ravel(),gy.ravel())).T
x = G.T*G
[eigenvalues,eigenvectors] = np.linalg.eig(x)
#For angle
angle = np.math.atan2(eigenvectors[0,1],eigenvectors[0,0])
... | # -*- coding: utf-8 -*-
import numpy as np
def hashTable(patch,Qangle,Qstrenth,Qcoherence):
[gx,gy] = np.gradient(patch)
G = np.matrix((gx.ravel(),gy.ravel())).T
x = G.T*G
[eigenvalues,eigenvectors] = np.linalg.eig(x)
#For angle
angle = np.math.atan2(eigenvectors[0,1],eigenvectors[0,0])
... | mit | Python |
0d7d5746ccff0e933a5bdfa22f3fd63914593ded | Use correct class to avoid side effects | mardiros/aioxmlrpc | tests/unittests/test_client.py | tests/unittests/test_client.py | import pytest
from httpx import Request, Response
from aioxmlrpc.client import Fault, ProtocolError, ServerProxy
RESPONSES = {
"http://localhost/test_xmlrpc_ok": {
"status": 200,
"body": """<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><int>1</int></value>
<... | import httpx
import pytest
from aioxmlrpc.client import Fault, ProtocolError, ServerProxy
RESPONSES = {
"http://localhost/test_xmlrpc_ok": {
"status": 200,
"body": """<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><int>1</int></value>
</param>
</params>
<... | bsd-3-clause | Python |
87bf261345919e90cb88853165fb1556046c80ef | Fix typo in mock usage | hkariti/mopidy,bencevans/mopidy,diandiankan/mopidy,dbrgn/mopidy,kingosticks/mopidy,mopidy/mopidy,ali/mopidy,jmarsik/mopidy,quartz55/mopidy,mopidy/mopidy,vrs01/mopidy,diandiankan/mopidy,ali/mopidy,adamcik/mopidy,pacificIT/mopidy,tkem/mopidy,pacificIT/mopidy,dbrgn/mopidy,adamcik/mopidy,hkariti/mopidy,jmarsik/mopidy,vrs01... | tests/mpd/protocol/test_connection.py | tests/mpd/protocol/test_connection.py | from __future__ import absolute_import, unicode_literals
from mock import patch
from tests.mpd import protocol
class ConnectionHandlerTest(protocol.BaseTestCase):
def test_close_closes_the_client_connection(self):
with patch.object(self.session, 'close') as close_mock:
self.send_request('cl... | from __future__ import absolute_import, unicode_literals
from mock import patch
from tests.mpd import protocol
class ConnectionHandlerTest(protocol.BaseTestCase):
def test_close_closes_the_client_connection(self):
with patch.object(self.session, 'close') as close_mock:
self.send_request('cl... | apache-2.0 | Python |
7c79ce6083f5ce93d9c64b458da243fe87a484f7 | Fix argument parsing default setup | abele/jinja-graph | src/jg/__main__.py | src/jg/__main__.py | import re
import sys
from itertools import chain
import argparse
import py
from graphviz import Digraph
EXTENDS_RE = re.compile(r'{%\s*extends\s*[\'"](.*)[\'"]\s*%}')
INCLUDE_RE = re.compile(r'{%\s*include\s*[\'"](.*)[\'"]\s*%}')
TEMPLATE_PATTERN = '*.html'
def main(argv=()):
"""
Args:
argv (list):... | import re
import sys
from itertools import chain
import argparse
import py
from graphviz import Digraph
EXTENDS_RE = re.compile(r'{%\s*extends\s*[\'"](.*)[\'"]\s*%}')
INCLUDE_RE = re.compile(r'{%\s*include\s*[\'"](.*)[\'"]\s*%}')
TEMPLATE_PATTERN = '*.html'
def main(argv=()):
"""
Args:
argv (list):... | bsd-2-clause | Python |
ce6426376f1a0d4b463b3a4b83aa34157896397d | add meetings list to committee api v2 | daonb/Open-Knesset,otadmor/Open-Knesset,habeanf/Open-Knesset,Shrulik/Open-Knesset,navotsil/Open-Knesset,Shrulik/Open-Knesset,MeirKriheli/Open-Knesset,DanaOshri/Open-Knesset,jspan/Open-Knesset,navotsil/Open-Knesset,DanaOshri/Open-Knesset,Shrulik/Open-Knesset,noamelf/Open-Knesset,OriHoch/Open-Knesset,MeirKriheli/Open-Kne... | committees/api.py | committees/api.py | '''
Api for the committees app
'''
from tastypie.api import Api
from tastypie.constants import ALL
from tastypie.bundle import Bundle
import tastypie.fields as fields
from apis.resources.base import BaseResource
from models import Committee, CommitteeMeeting, ProtocolPart
from mks.api import MemberResource
class Com... | '''
Api for the committees app
'''
from tastypie.api import Api
from tastypie.constants import ALL
from tastypie.bundle import Bundle
import tastypie.fields as fields
from apis.resources.base import BaseResource
from models import Committee, CommitteeMeeting, ProtocolPart
from mks.api import MemberResource
class Com... | bsd-3-clause | Python |
9f5953577ea8c37674003d3d1bff8788b92379e4 | Integrate LLVM at llvm/llvm-project@8e5f3d04f269 | Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,frreiss/tensorflow-fred,sarvex/tensorflow,yongtang/tensorflow,karllessard/tensorflow,paolodedios/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "8e5f3d04f269dbe791076e775f1d1a098cbada01"
LLVM_SHA256 = "51f4950108027260a6dfeac4781fdad85dfde1d8594f8d26faea504e923ebcf2"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "17800f900dca8243773dec5f90578cce03069b8f"
LLVM_SHA256 = "779e3e2a575e2630571f03518782009de9ed075c9b18ce3139715d34a328a66a"
tf_http_archive(
... | apache-2.0 | Python |
adcf84d66af103636e9c6715892652e8643796bc | Integrate LLVM at llvm/llvm-project@69a909b9fefe | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "69a909b9fefeec5d4ece6f3162f8332f125ea202"
LLVM_SHA256 = "0ffd99b2775505b9a9efc2efb9ad7251d4403844ca13777f8f8ef6caad460acb"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "6f85d9e104ca5f785718b25dccb5817b0c6c208d"
LLVM_SHA256 = "d92d32307cb050c2a2a1d4fa2d7ceddea26207ad39ab87f47e389fab830fa0c6"
tfrt_http_archive(
... | apache-2.0 | Python |
cbf7fb49dc8d0714e29fccb28bf2108ba45951aa | Integrate LLVM at llvm/llvm-project@09f43c107fc7 | tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "09f43c107fc7688639346d3beead72472cdadbdb"
LLVM_SHA256 = "03eaf8e80cdbd0e998c16ab5d5215e346ed7688777344940ad8c1492064674f4"
tfrt_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tfrt_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "505d57486e57eb61e29bed6517de5152d208fede"
LLVM_SHA256 = "d94ac445e026e6cc29387a8345eedc77c428b0c0ac81eb9b843c0295515df494"
tfrt_http_archive(
... | apache-2.0 | Python |
ae32af2969f7444b6cb6d4a4b4aea366409c507a | Integrate LLVM at llvm/llvm-project@5dbc7cf7cac4 | yongtang/tensorflow,karllessard/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_librar... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "5dbc7cf7cac4428e0876a94a4fca10fe60af7328"
LLVM_SHA256 = "389c14f6cc12103828f319df9161468d3403c3b70224e3a7a39a87bb99f1ff0c"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "42836e283fc58d5cebbcbb2e8eb7619d92fb9c2d"
LLVM_SHA256 = "c44be2c5da50431b370fe9dc1762399c27522ec2c5daeda5d618dddf502f4608"
tf_http_archive(
... | apache-2.0 | Python |
69887d843fef19802765a3f484f95b88e51628a8 | Integrate LLVM at llvm/llvm-project@f962dafbbdf6 | google/tsl,google/tsl,google/tsl | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "f962dafbbdf61234bfa51bde95e2e5c52a02e9b9"
LLVM_SHA256 = "9ae9cae1c72a35630499345bffa72ab45e2fcec2442acba6cbf88f5dee575919"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "a429773b3ec6978e2cfd27d2ff6a6585b6e88198"
LLVM_SHA256 = "3beb955cfc9b981a35e4bd712db0fe2d4bc8ff03d3c2acc36b30036d7c2bf429"
tf_http_archive(
... | apache-2.0 | Python |
6db82f5c41c88792a877865b8606f4490acd29e4 | Update get_absolute_url of Project model | bjoernricks/trex,bjoernricks/trex | trex/models/project.py | trex/models/project.py | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.db import models
class Project(models.Model):
name = models.CharField(max_len... | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.db import models
class Project(models.Model):
name = models.CharField(max_len... | mit | Python |
c8af134a0852eabb1b196a1087cb4f5c176a4818 | Modify module import syntax to avoid confusion with test method | andreas-h/pelican-plugins,talha131/pelican-plugins,talha131/pelican-plugins,rlaboiss/pelican-plugins,UHBiocomputation/pelican-plugins,andreas-h/pelican-plugins,xsteadfastx/pelican-plugins,mikitex70/pelican-plugins,mortada/pelican-plugins,talha131/pelican-plugins,ingwinlu/pelican-plugins,danmackinlay/pelican-plugins,ing... | thumbnailer/test_thumbnails.py | thumbnailer/test_thumbnails.py | from thumbnailer import _resizer
from unittest import TestCase, main
import os
from PIL import Image
class ThumbnailerTests(TestCase):
def path(self, filename):
return os.path.join(self.img_path, filename)
def setUp(self):
self.img_path = os.path.join(os.path.dirname(__file__), "test_data")
... | from thumbnailer import _resizer
from unittest import TestCase, main
import os.path as path
from PIL import Image
class ThumbnailerTests(TestCase):
def path(self, filename):
return path.join(self.img_path, filename)
def setUp(self):
self.img_path = path.join(path.dirname(__file__), "test_data... | agpl-3.0 | Python |
538089f7055b90926adea159bdac03da1d5318d4 | Fix Zika build to include all JSONs | nextstrain/augur,nextstrain/augur,blab/nextstrain-augur,nextstrain/augur | builds/zika/zika.process.py | builds/zika/zika.process.py | from __future__ import print_function
import os, sys
# we assume (and assert) that this script is running from the virus directory, i.e. inside H7N9 or zika
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
import base.process
from base.process import process
def collect_args():
"""Returns a Zika-... | from __future__ import print_function
import os, sys
# we assume (and assert) that this script is running from the virus directory, i.e. inside H7N9 or zika
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
import base.process
from base.process import process
def collect_args():
"""Returns a Zika-... | agpl-3.0 | Python |
fda1cbb413f8647c2ab5be858ec0aaa32a0fbfac | add SEND_MAIL_USER setting | lxdiyun/mail_sender,lxdiyun/mail_sender,lxdiyun/mail_sender,lxdiyun/mail_sender | mail/models.py | mail/models.py | """mail models"""
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from django.db import models
from django.core.urlresolvers import reverse
from django.conf import settings
from jinja2 import Template
from tinymce.models import HTMLField
class Receiver(models.Model):
"""mail... | """mail models"""
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from django.db import models
from django.core.urlresolvers import reverse
from django.conf import settings
from jinja2 import Template
from tinymce.models import HTMLField
class Receiver(models.Model):
"""mail... | bsd-3-clause | Python |
6873a477890c08f51b54b616555fe88bb3a9704e | Add the Plivo outgoing number | Razvy000/cabot_alert_plivo | cabot_alert_plivo/models.py | cabot_alert_plivo/models.py | from os import environ as env
from django.conf import settings
from django.template import Context, Template
from django.db import models
from cabot.cabotapp.alert import AlertPlugin, AlertPluginUserData
import requests
import logging
import plivo
# get the environment variables (see cabot/conf/development.env)
au... | from os import environ as env
from django.conf import settings
from django.template import Context, Template
from django.db import models
from cabot.cabotapp.alert import AlertPlugin, AlertPluginUserData
import requests
import logging
import plivo
# get the environment variables (see cabot/conf/development.env)
au... | mit | Python |
b55c8a33887a9e2932113ed279b9292b7b547a5d | update : change cmmedia/view.py resvers images to images_url | quxiaolong1504/cloudmusic | cmmedia/views.py | cmmedia/views.py | # encoding=utf-8
from django.utils.translation import ugettext_lazy as _
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIView
from rest_framework import generics
from rest_framework.viewsets import ModelViewSet
from cmmedia.models import Image
... | # encoding=utf-8
from django.utils.translation import ugettext_lazy as _
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIView
from rest_framework import generics
from rest_framework.viewsets import ModelViewSet
from cmmedia.models import Image
... | mpl-2.0 | Python |
36110646c5c5abead8c2a3a7d98d36bb6d49db59 | Remove pointless models include | praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control | subsend/models.py | subsend/models.py | # Create your models here.
| from django.db import models
# Create your models here.
models
| bsd-3-clause | Python |
a4062588d1eae0883dd8d56f198e84a8875eabb5 | make self_test not import if pytest is not installed | dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy | sunpy/__init__.py | sunpy/__init__.py | """
SunPy
=====
An open-source Python library for Solar Physics data analysis.
Web Links
---------
Homepage: http://www.sunpy.org
Documentation: http://sunpy.readthedocs.org/en/latest/index.html
"""
from __future__ import absolute_import
import warnings
__version__ = '0.3.3'
try:
from sunpy.version import vers... | """
SunPy
=====
An open-source Python library for Solar Physics data analysis.
Web Links
---------
Homepage: http://www.sunpy.org
Documentation: http://sunpy.readthedocs.org/en/latest/index.html
"""
from __future__ import absolute_import
import warnings
__version__ = '0.3.3'
try:
from sunpy.version import vers... | bsd-2-clause | Python |
336093ee08fdc46c3f95656ca44a43a0dd045c4d | update last_login when authing with token | jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle | bluebottle/auth/views.py | bluebottle/auth/views.py | from rest_framework.views import APIView
from rest_framework.authtoken.models import Token
from rest_framework.response import Response
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.authentication import get_authorization_header
from rest_framework import parsers, renderers
fr... | from rest_framework.views import APIView
from rest_framework.authtoken.models import Token
from rest_framework.response import Response
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.authentication import get_authorization_header
from rest_framework import parsers, renderers
fr... | bsd-3-clause | Python |
2a8e45575657da57bd21c832ccdd221b5044fc40 | Update bottlespin.py | kallerdaller/Cogs-Yorkfield | bottlespin/bottlespin.py | bottlespin/bottlespin.py | import discord
from discord.ext import commands
from random import choice
class Bottlespin:
"""Spins a bottle and lands on a random user."""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True, alias=["bottlespin"])
async def spin(self, ctx, role):
... | import discord
from discord.ext import commands
from random import choice
class Bottlespin:
"""Spins a bottle and lands on a random user."""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True, alias=["bottlespin"])
async def spin(self, ctx, role):
... | mit | Python |
5cf4e1181dd3146b6070e144d720406bb7fb13d5 | Add qiutil to logging. | ohsu-qin/qiutil | test/helpers/logging.py | test/helpers/logging.py | """
This test logging module configures test case logging to print
debug messages to stdout.
"""
from qiutil.logging import (configure, logger)
configure('test', 'qiutil', level='DEBUG')
| """
This test logging module configures test case logging to print
debug messages to stdout.
"""
from qiutil.logging import (configure, logger)
configure('test', level='DEBUG')
| bsd-2-clause | Python |
67659e8da1a6479dac0eae2b0219962a4eb4eae9 | fix arg bug | heatery/strava-api-experiment,heatery/strava-api-experiment,anthonywu/strava-api-experiment,anthonywu/strava-api-experiment,heatery/strava-api-experiment,anthonywu/strava-api-experiment,heatery/strava-api-experiment,anthonywu/strava-api-experiment | src/strava_local_client.py | src/strava_local_client.py | #!/usr/bin/env python
"""
Strava Development Sandbox.
Get your *Client ID* and *Client Secret* from https://www.strava.com/settings/api
Usage:
strava_local_client.py get_write_token <client_id> <client_secret> [options]
Options:
-h --help Show this screen.
--port=<port> Local port for OAuth client [defa... | #!/usr/bin/env python
"""
Strava Development Sandbox.
Get your *Client ID* and *Client Secret* from https://www.strava.com/settings/api
Usage:
strava_local_client.py get_write_token <client_id> <client_secret> [options]
Options:
-h --help Show this screen.
--port=<port> Local port for OAuth client [defa... | mit | Python |
854eb3b6cf92dc7c54c931f9f128a4577bca5b2a | Bump version number | nabla-c0d3/sslyze | sslyze/__init__.py | sslyze/__init__.py |
__author__ = 'Alban Diquet'
__version__ = '2.0.0'
__email__ = 'nabla.c0d3@gmail.com'
PROJECT_URL = 'https://github.com/nabla-c0d3/sslyze'
|
__author__ = 'Alban Diquet'
__version__ = '1.4.3'
__email__ = 'nabla.c0d3@gmail.com'
PROJECT_URL = 'https://github.com/nabla-c0d3/sslyze'
| agpl-3.0 | Python |
c2ae2d3a35ee9dc6faf956c90604459fac96473c | Update st2client description and classifiers. | Plexxi/st2,lakshmi-kannan/st2,StackStorm/st2,nzlosh/st2,lakshmi-kannan/st2,nzlosh/st2,StackStorm/st2,peak6/st2,punalpatel/st2,peak6/st2,peak6/st2,punalpatel/st2,dennybaa/st2,pixelrebel/st2,Plexxi/st2,punalpatel/st2,lakshmi-kannan/st2,dennybaa/st2,armab/st2,Plexxi/st2,emedvedev/st2,emedvedev/st2,tonybaloney/st2,tonybalo... | st2client/setup.py | st2client/setup.py | #!/usr/bin/env python2.7
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lice... | #!/usr/bin/env python2.7
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lice... | apache-2.0 | Python |
e34bcec834bf4d84168d04a1ea0a98613ad0df4e | Update migration to fetch domains with applications using old location fixture | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/locations/management/commands/migrate_new_location_fixture.py | corehq/apps/locations/management/commands/migrate_new_location_fixture.py | import json
from django.core.management.base import BaseCommand
from toggle.models import Toggle
from corehq.apps.locations.models import SQLLocation
from corehq.apps.domain.models import Domain
from corehq.toggles import HIERARCHICAL_LOCATION_FIXTURE, NAMESPACE_DOMAIN
class Command(BaseCommand):
help = """
... | from django.core.management.base import BaseCommand
from toggle.models import Toggle
from corehq.apps.locations.models import LocationFixtureConfiguration, SQLLocation
from corehq.toggles import FLAT_LOCATION_FIXTURE
class Command(BaseCommand):
help = """
To migrate to new flat fixture for locations. Update ... | bsd-3-clause | Python |
a17ed4f65b7fa5a035efb7c6ff19fcf477a65429 | Remove remaining django-mptt 0.7 compatibility code | edoburu/django-categories-i18n,edoburu/django-categories-i18n | categories_i18n/managers.py | categories_i18n/managers.py | """
The manager classes.
"""
import django
from django.db.models.query import QuerySet
from mptt.managers import TreeManager
from mptt.querysets import TreeQuerySet
from parler.managers import TranslatableManager, TranslatableQuerySet
class CategoryQuerySet(TranslatableQuerySet, TreeQuerySet):
"""
The Querys... | """
The manager classes.
"""
import django
from django.db.models.query import QuerySet
from mptt.managers import TreeManager
from mptt.querysets import TreeQuerySet
from parler.managers import TranslatableManager, TranslatableQuerySet
class CategoryQuerySet(TranslatableQuerySet, TreeQuerySet):
"""
The Querys... | apache-2.0 | Python |
07df11f81cf050d88218f5fb6348b1193bfb4e20 | use the right user to chown | ceph/ceph-installer,ceph/ceph-installer,ceph/mariner-installer,ceph/ceph-installer | ceph_installer/templates.py | ceph_installer/templates.py |
setup_script = """#!/bin/bash -x -e
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user or execute this script with sudo" 2>&1
exit 1
fi
echo "--> creating new user with disabled password: ansible"
useradd -m ceph-installer
passwd -d ceph-installer
echo "--> adding provisioning key to the ansible authorized... |
setup_script = """#!/bin/bash -x -e
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user or execute this script with sudo" 2>&1
exit 1
fi
echo "--> creating new user with disabled password: ansible"
useradd -m ceph-installer
passwd -d ceph-installer
echo "--> adding provisioning key to the ansible authorized... | mit | Python |
a8d6abd869fc30d395ffafec9eea566f58fb840c | add new code tables to admin console | bcgov/gwells,bcgov/gwells,bcgov/gwells,bcgov/gwells | app/backend/wells/admin.py | app/backend/wells/admin.py | """
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | """
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | apache-2.0 | Python |
b9b41ea38de0b54cf85829c10a764aaf70d3e4bf | remove a useless local variable | timmyomahony/django-charsleft-widget,timmyomahony/django-charsleft-widget | charsleft_widget/widgets.py | charsleft_widget/widgets.py | from django import forms
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
try:
# py2.x
from django.utils.encoding import force_unicode as force_str
except ImportError:
# py3.x
from django.utils.encoding import force_text as force_str
try:
# Djang... | from django import forms
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
try:
# py2.x
from django.utils.encoding import force_unicode as force_str
except ImportError:
# py3.x
from django.utils.encoding import force_text as force_str
try:
# Djang... | mit | Python |
41df2db2fcc3a03c00feaccbd40ccac9f7195ec9 | bump to 0.2.4: version was outdated | FundedByMe/django-mangopay | mangopay/__init__.py | mangopay/__init__.py | __version__ = (0, 2, 4)
| __version__ = (0, 2, 3)
| mit | Python |
2992eede5ba829bb03a85689246775e37f9f69dd | modify version | sosuke-k/cornel-movie-dialogs-corpus-storm,sosuke-k/cornel-movie-dialogs-corpus-storm | mdcorpus/__init__.py | mdcorpus/__init__.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "0.0.1"
__all__ = ["mdcorpus", "parser"]
from storm.locals import *
from mdcorpus import *
# initializing the relationships
MovieTitlesMetadata.genres = ReferenceSet(MovieTitlesMetadata.id,
MovieGenreLine.movie_id,... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "0.1.0"
__all__ = ["mdcorpus", "parser"]
from storm.locals import *
from mdcorpus import *
# initializing the relationships
MovieTitlesMetadata.genres = ReferenceSet(MovieTitlesMetadata.id,
MovieGenreLine.movie_id,... | mit | Python |
e975b27484a3d1a6cc96df604f99a4a3efab92b8 | Add better title to job page. | kernelci/kernelci-frontend,kernelci/kernelci-frontend,kernelci/kernelci-frontend,kernelci/kernelci-frontend | app/dashboard/views/job.py | app/dashboard/views/job.py | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | lgpl-2.1 | Python |
e1da4e0047449939086a7e36ac3c85bbcd62e713 | add __all__ | anselmobd/fo2,anselmobd/fo2,anselmobd/fo2,anselmobd/fo2 | src/utils/functions/sql.py | src/utils/functions/sql.py | from itertools import takewhile
from pprint import pprint
__all__ = [
'sql_formato_fo2',
]
def sql_formato_fo2(sql):
"""Recebe um SQL como executado no RDBMS
Retira a identação de todas as linhas não comentário e elimina
linhas vazias do início e do final.
Retorna SQL 'formatado'
"""
lin... | from itertools import takewhile
from pprint import pprint
def sql_formato_fo2(sql):
"""Recebe um SQL como executado no RDBMS
Retira a identação de todas as linhas não comentário e elimina
linhas vazias do início e do final.
Retorna SQL 'formatado'
"""
linhas = sql.split('\n')
min_spaces =... | mit | Python |
16ecb86d28c3587fabf4268c27a6db255af6de7d | fix tests | fata1ex/django-statsy,fata1ex/django-statsy,zhebrak/django-statsy,zhebrak/django-statsy,fata1ex/django-statsy,zhebrak/django-statsy | statsy/__init__.py | statsy/__init__.py | # coding: utf-8
from django.utils.module_loading import autodiscover_modules
from statsy.log import logger
from statsy.sites import site
__all__ = [
'send', 'watch', 'get_send_params'
'objects', 'groups', 'events',
'site', 'autodiscover', 'logger'
]
def autodiscover():
autodiscover_modules('stats'... | # coding: utf-8
from django.utils.module_loading import autodiscover_modules
from statsy.log import logger
from statsy.sites import site
__all__ = [
'send', 'watch', 'get_send_params'
'objects', 'groups', 'events',
'site', 'autodiscover', 'logger'
]
def autodiscover():
autodiscover_modules('stats'... | mit | Python |
9617c68ee1beca10c5cc1ce820f50bcdf1355bc8 | Fix python test determinism without infomap library | mapequation/infomap,mapequation/infomap,mapequation/infomap,mapequation/infomap | test/testDeterminism.py | test/testDeterminism.py | import sys
import argparse
import subprocess
import re
def run(input, count, infomapArgs):
firstCodelength = 0.0
for i in range(1, count + 1):
print("\nStarting run {}...".format(i))
res = subprocess.run(['./Infomap', input, infomapArgs], stdout=subprocess.PIPE)
stdout = re... | from infomap import infomap
import sys
import argparse
import subprocess
import re
def run(input, count, infomapArgs):
firstCodelength = 0.0
for i in range(1, count + 1):
print("\nStarting run {}...".format(i))
res = subprocess.run(['./Infomap', input, infomapArgs], stdout=subproces... | agpl-3.0 | Python |
e775613d43dac702565cf266d9995c9cd706d7c8 | Add documentation for the CPSR command | 0xddaa/pwndbg,pwndbg/pwndbg,anthraxx/pwndbg,pwndbg/pwndbg,disconnect3d/pwndbg,zachriggle/pwndbg,anthraxx/pwndbg,pwndbg/pwndbg,disconnect3d/pwndbg,anthraxx/pwndbg,cebrusfs/217gdb,pwndbg/pwndbg,chubbymaggie/pwndbg,chubbymaggie/pwndbg,disconnect3d/pwndbg,zachriggle/pwndbg,0xddaa/pwndbg,cebrusfs/217gdb,cebrusfs/217gdb,0xdd... | pwndbg/commands/cpsr.py | pwndbg/commands/cpsr.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import gdb
import pwndbg.arch
import pwndbg.color
import pwndbg.commands
import pwndbg.regs
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def cpsr():
'Print out the ARM CPSR register'
if pwndbg.arch.current != 'arm'... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import gdb
import pwndbg.arch
import pwndbg.color
import pwndbg.commands
import pwndbg.regs
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def cpsr():
if pwndbg.arch.current != 'arm':
print("This is only availabl... | mit | Python |
c174b06ec79070f5e3f7820f59a1133ddf13d1dd | update version prior to tag | timahutchinson/desispec,timahutchinson/desispec,desihub/desispec,gdhungana/desispec,desihub/desispec,gdhungana/desispec | py/desispec/_version.py | py/desispec/_version.py | __version__ = '0.7.0'
| __version__ = '0.5.0.dev858'
| bsd-3-clause | Python |
58e91fc46e75f084ad05459590fcf34b03ab0f36 | improve modularization | marcorosa/wos-cli | src/search.py | src/search.py | import re
import suds
import texttable as tt
import xml.etree.ElementTree as ET
from .config import user_id, password
from datetime import date
from operator import itemgetter
from six import print_
from wos import WosClient
def _draw_table(data):
# Generate table
tab = tt.Texttable()
tab.set_cols_align(... | import re
import suds
import texttable as tt
import xml.etree.ElementTree as ET
from .config import user_id, password
from datetime import date
from operator import itemgetter
from six import print_
from wos import WosClient
def _draw_table(data):
# Generate table
tab = tt.Texttable()
tab.set_cols_align(... | mit | Python |
3eb3c5ffc0e346103d60c121598e170c3a816818 | Add command handler to flask route | hackerspace-ntnu/coap-iot,hackerspace-ntnu/coap-iot | src/server.py | src/server.py | import logging
import asyncio
import flask
import threading
import aiocoap.resource as resource
import aiocoap
app = flask.Flask(__name__,static_folder="../static",static_url_path="/static",template_folder="../templates")
@app.route("/")
def index():
return flask.render_template("index.html", name="index")
@app.... | import logging
import asyncio
import flask
import threading
import aiocoap.resource as resource
import aiocoap
app = flask.Flask(__name__,static_folder="../static",static_url_path="/static",template_folder="../templates")
@app.route("/")
def hello():
return flask.render_template("index.html", name="index")
class... | mit | Python |
8c0d6a6dc75b0f1ec7f39ceb97e8b1d76f4246b8 | Bump version for impending release | bitprophet/releases | releases/_version.py | releases/_version.py | __version_info__ = (1, 2, 0)
__version__ = '.'.join(map(str, __version_info__))
| __version_info__ = (1, 1, 0)
__version__ = '.'.join(map(str, __version_info__))
| bsd-2-clause | Python |
91eca37144d0c378761e47c143e66a79af37c226 | Fix IntegrityError and DoesNotExist 500s | vault/bugit,vault/bugit,vault/bugit | repo_manage/forms.py | repo_manage/forms.py |
from django import forms
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
from common.models import Repository, Collaboration, User
slug_errors = {
'invalid' : "Use only letters, numbers, underscores, and hyphens",
}
class NewRepositoryForm(forms.Form):
repo_name ... |
from django import forms
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
from common.models import Repository, Collaboration, User
slug_errors = {
'invalid' : "Use only letters, numbers, underscores, and hyphens",
}
class NewRepositoryForm(forms.Form):
repo_name ... | mit | Python |
9963da42589fbc8f3c886c8482c45e514c731285 | Fix a URL bug. | sunlightlabs/tcamp,sunlightlabs/tcamp,sunlightlabs/tcamp,sunlightlabs/tcamp | tcamp/reg/urls.py | tcamp/reg/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import TemplateView
from reg.views import *
from reg.badges import *
urlpatterns = patterns('',
url(r'^$', register),
url(r'^override/$', register_override),
url(r'^price/$', price_check),
... | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import TemplateView
from reg.views import *
from reg.badges import *
urlpatterns = patterns('',
url(r'^$', register),
url(r'^override/$', register_override),
url(r'^price/$', price_check),
... | bsd-3-clause | Python |
fe6c8937a1c26acc736f218b73b3eb2968e8b6c7 | Increment version | sendpulse/sendpulse-rest-api-python | pysendpulse/__init__.py | pysendpulse/__init__.py | __author__ = 'Maksym Ustymenko'
__author_email__ = 'tech@sendpulse.com'
__copyright__ = 'Copyright 2017, SendPulse'
__credits__ = ['Maksym Ustymenko', ]
__version__ = '0.0.8'
| __author__ = 'Maksym Ustymenko'
__author_email__ = 'tech@sendpulse.com'
__copyright__ = 'Copyright 2017, SendPulse'
__credits__ = ['Maksym Ustymenko', ]
__version__ = '0.0.7'
| apache-2.0 | Python |
419bb26ddc3017fb87cd9ce1853bc4f64f052394 | Use exception which prints the same regardless of config. | chrisdearman/micropython,oopy/micropython,praemdonck/micropython,torwag/micropython,alex-robbins/micropython,tobbad/micropython,lowRISC/micropython,praemdonck/micropython,praemdonck/micropython,mhoffma/micropython,cwyark/micropython,TDAbboud/micropython,puuu/micropython,AriZuu/micropython,pozetroninc/micropython,jmarce... | tests/misc/print_exception.py | tests/misc/print_exception.py | import _io as io # uPy does not have io module builtin
import sys
if hasattr(sys, 'print_exception'):
print_exception = sys.print_exception
else:
import traceback
print_exception = lambda e, f: traceback.print_exception(None, e, sys.exc_info()[2], file=f)
def print_exc(e):
buf = io.StringIO()
print... | import _io as io # uPy does not have io module builtin
import sys
if hasattr(sys, 'print_exception'):
print_exception = sys.print_exception
else:
import traceback
print_exception = lambda e, f: traceback.print_exception(None, e, sys.exc_info()[2], file=f)
def print_exc(e):
buf = io.StringIO()
print... | mit | Python |
8144f9c6b8812e33a6a6bd6777502fd95db1c4ea | Implement ``TEST_DISABLED_APPS`` settings, update ``INSTALLED_APPS`` list. | playpauseandstop/tddspry,playpauseandstop/tddspry | testproject/settings.py | testproject/settings.py | import os
import sys
# Calculate current directory path and add it to ``sys.path``
DIRNAME = os.path.abspath(os.path.dirname(__file__))
sys.path.append(DIRNAME)
# Debug settings
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Authentication settings
AUTH_PROFILE_MODULE = 'testapp.UserProfile'
LOGIN_URL = '/login/'
LOGIN_REDI... | import os
import sys
# Calculate current directory path and add it to ``sys.path``
DIRNAME = os.path.abspath(os.path.dirname(__file__))
sys.path.append(DIRNAME)
# Debug settings
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Test settings
TDDSPRY_TEST_CASE = 'django.test.TestCase'
# Authentication settings
AUTH_PROFILE_MOD... | bsd-3-clause | Python |
26fc49f1a29d60bf175094be5bb77abff56844ba | test that crosses are vibrant red | IanDCarroll/xox | tests/test_announcer_chair.py | tests/test_announcer_chair.py | import unittest
from source.announcer_chair import *
class AnnouncerTestCase(unittest.TestCase):
def setUp(self):
self.announcer = Announcer()
self.start = "Welcome to XOX, a Noughts and Crosses Game"
self.select = "Type 1 to go first, or 2 to go second."
self.tie = "The game is a ... | import unittest
from source.announcer_chair import *
class AnnouncerTestCase(unittest.TestCase):
def setUp(self):
self.announcer = Announcer()
self.start = "Welcome to XOX, a Noughts and Crosses Game"
self.select = "Type 1 to go first, or 2 to go second."
self.tie = "The game is a ... | mit | Python |
3e4600a42c8f3153840c875ac17709f8d3d58e6f | save received values to csv | Syralist/LaundryMeasure,Syralist/LaundryMeasure,Syralist/LaundryMeasure | python/recvBroadcast.py | python/recvBroadcast.py | import socket
import csv
import time
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
UDP_PORT = 42042
sock.bind(('', UDP_PORT))
timestamp = str(int(time.time()))
with open(timestamp+'.csv', 'wb') as csvfile:
spamwriter = csv.writer(csvfile)
... | import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
UDP_PORT = 42042
# using the '' address works
sock.bind(('', UDP_PORT))
# using the address of eth1 doesn't
#sock.bind(('192.168.2.123', UDP_PORT))
# and neither does using the local loo... | mit | Python |
f6ddd5c4d79ada59d9db4b467849d9b52c5fef75 | Add GraphFields to package import. | cmshobe/landlab,cmshobe/landlab,cmshobe/landlab,RondaStrauch/landlab,amandersillinois/landlab,RondaStrauch/landlab,landlab/landlab,Carralex/landlab,RondaStrauch/landlab,landlab/landlab,amandersillinois/landlab,csherwood-usgs/landlab,Carralex/landlab,Carralex/landlab,csherwood-usgs/landlab,landlab/landlab | landlab/field/__init__.py | landlab/field/__init__.py | from landlab.field.scalar_data_fields import ScalarDataFields, FieldError
from landlab.field.grouped import ModelDataFields, GroupError, GroupSizeError
from landlab.field.field_mixin import ModelDataFieldsMixIn
from .graph_field import GraphFields
__all__ = ['ScalarDataFields', 'ModelDataFields', 'ModelDataFieldsMixIn... | from landlab.field.scalar_data_fields import ScalarDataFields, FieldError
from landlab.field.grouped import ModelDataFields, GroupError, GroupSizeError
from landlab.field.field_mixin import ModelDataFieldsMixIn
__all__ = ['ScalarDataFields', 'ModelDataFields', 'ModelDataFieldsMixIn',
'FieldError', 'GroupErr... | mit | Python |
28303a94401ed8eec3658dd3a1b1b09d8ba700f7 | complete test coverage for demo_signal | rgommers/pywt,grlee77/pywt,PyWavelets/pywt,PyWavelets/pywt,rgommers/pywt,rgommers/pywt,grlee77/pywt,rgommers/pywt | pywt/tests/test_data.py | pywt/tests/test_data.py | import os
import numpy as np
from numpy.testing import (assert_allclose, assert_raises, assert_,
run_module_suite)
import pywt.data
data_dir = os.path.join(os.path.dirname(__file__), 'data')
wavelab_data_file = os.path.join(data_dir, 'wavelab_test_signals.npz')
wavelab_result_dict = np.load... | import os
import numpy as np
from numpy.testing import assert_allclose, assert_raises, run_module_suite
import pywt.data
data_dir = os.path.join(os.path.dirname(__file__), 'data')
wavelab_data_file = os.path.join(data_dir, 'wavelab_test_signals2.npz')
wavelab_result_dict = np.load(wavelab_data_file)
def test_data_a... | mit | Python |
4be36c723788bed029c0ed2c0818672f14e1d801 | Use branches | e-koch/FilFinder,dcolombo/FilFinder,keflavich/fil_finder | examples/paper_figures/ks_plots.py | examples/paper_figures/ks_plots.py | # Licensed under an MIT open source license - see LICENSE
'''
KS p-values for different properties.
'''
import numpy as np
from pandas import read_csv
import matplotlib.pyplot as p
import numpy as np
import seaborn as sn
sn.set_context('talk')
sn.set_style('ticks')
sn.mpl.rc("figure", figsize=(7, 9))
# Widths
width... | # Licensed under an MIT open source license - see LICENSE
'''
KS p-values for different properties.
'''
import numpy as np
from pandas import read_csv
import matplotlib.pyplot as p
import numpy as np
import seaborn as sn
sn.set_context('talk')
sn.set_style('ticks')
sn.mpl.rc("figure", figsize=(7, 9))
# Widths
width... | mit | Python |
41d93b76fc2dd3602b8e7e90959685fad5797a65 | remove pdb ref | closeair/sundowners-fc,closeair/sundowners-fc | commons/tests.py | commons/tests.py | from django.test import TestCase
from django.urls import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from django.contrib.auth.models import User
from .forms import DocumentForm
from .models import Document
import os
class CommonsUploadFormTests(TestCase):
def test_init_invalid_without_en... | from django.test import TestCase
from django.urls import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from django.contrib.auth.models import User
from .forms import DocumentForm
from .models import Document
import os
class CommonsUploadFormTests(TestCase):
def test_init_invalid_without_en... | mit | Python |
f9004902b0edcfef6cbea0cca3c7ed680ad4f873 | Make icon path more portable for image test | kfdm/gntp | test/test_mini.py | test/test_mini.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test most basic GNTP functions using our mini growl function
"""
import unittest
import logging
import os
logging.basicConfig(level=logging.WARNING)
import gntp.config
import gntp.notifier
APPLICATION_NAME = "GNTP unittest"
ICON_URL = "https://www.google.com/intl/en_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test most basic GNTP functions using our mini growl function
"""
import unittest
import logging
logging.basicConfig(level=logging.WARNING)
import gntp.config
import gntp.notifier
APPLICATION_NAME = "GNTP unittest"
ICON_URL = "https://www.google.com/intl/en_com/images... | mit | Python |
fce8e150b3842449fe25a34eb6afc0b9d871c4fa | Fix Django Debug toolbar | kdeloach/nyc-trees,maurizi/nyc-trees,maurizi/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,RickMohr/nyc-trees,RickMohr/nyc-trees,maurizi/nyc-trees,RickMohr/nyc-trees,kdeloach/nyc-trees,kdeloach/nyc-trees,RickMohr/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,maurizi/ny... | src/nyc_trees/nyc_trees/settings/development.py | src/nyc_trees/nyc_trees/settings/development.py | """Development settings and globals."""
from base import * # NOQA
# DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
# END DEBUG CONFIGURATION
# EMAIL CONFIGURATION
# ... | """Development settings and globals."""
from base import * # NOQA
# DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
# END DEBUG CONFIGURATION
# EMAIL CONFIGURATION
# ... | agpl-3.0 | Python |
4b0841e0a1b654546925500a4823148513d5644b | Hide SV at startup | EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes | lg_sv/scripts/launcher.py | lg_sv/scripts/launcher.py | #! /usr/bin/env python
import rospy
from lg_common import ManagedWindow, ManagedBrowser, ManagedAdhocBrowser
from lg_common.msg import ApplicationState
from lg_common.helpers import add_url_params
DEFAULT_URL = 'http://localhost:8008/lg_sv/webapps/client/index.html'
#FOV for zoom level 3
DEFAULT_FOV = 28.125
def m... | #! /usr/bin/env python
import rospy
from lg_common import ManagedWindow, ManagedBrowser, ManagedAdhocBrowser
from lg_common.msg import ApplicationState
from lg_common.helpers import add_url_params
DEFAULT_URL = 'http://localhost:8008/lg_sv/webapps/client/index.html'
#FOV for zoom level 3
DEFAULT_FOV = 28.125
def m... | apache-2.0 | Python |
e6bfb9d9783f7aedc0f1819e1ced0306984e0e0a | Improve normalization method | trein/quora-classifier | ml_helpers.py | ml_helpers.py | import numpy as np
import re
def extract_train():
return extract('dataset/train.txt')
def extract_test():
return extract('dataset/test.txt')
def extract(file):
input_file = open(file)
traindata = input_file.readlines()
features = []
targets = []
for line in traindata:
formatted_l... | import numpy as np
import re
def extract_train():
return extract('dataset/train.txt')
def extract_test():
return extract('dataset/test.txt')
def extract(file):
input_file = open(file)
traindata = input_file.readlines()
features = []
targets = []
for line in traindata:
formatted_l... | mit | Python |
9fae5b50815b0ea597ee6d13181f96284d07d1ab | Simplify import_optionset | rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug | rdmo/options/imports.py | rdmo/options/imports.py | import logging
from rdmo.conditions.models import Condition
from rdmo.core.imports import (fetch_parents, get_foreign_field,
get_m2m_instances, set_common_fields,
set_lang_field, validate_instance)
from .models import Option, OptionSet
logger = logging.ge... | import logging
from rdmo.conditions.models import Condition
from rdmo.core.imports import (fetch_parents, get_foreign_field,
get_m2m_instances, set_common_fields,
set_lang_field, validate_instance)
from .models import Option, OptionSet
logger = logging.ge... | apache-2.0 | Python |
e360b4e2a19a526e1541a7833648619bb5fac8e2 | Fix read of wrong dictionnary | Vauxoo/stock-logistics-warehouse,Vauxoo/stock-logistics-warehouse,Vauxoo/stock-logistics-warehouse | stock_orderpoint_move_link/models/procurement_rule.py | stock_orderpoint_move_link/models/procurement_rule.py | # Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
def _get_stock_move_values(self, product_id, product_qty, product_uom,
... | # Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
def _get_stock_move_values(self, product_id, product_qty, product_uom,
... | agpl-3.0 | Python |
9d284a64e3ece19ae3d52ea419a537a8b6f9c1ab | add missing quotation | e-koch/mpld3,void32/mpld3,jakevdp/mpld3,keflavich/mpld3,mpld3/mpld3,jakirkham/mpld3,linearregression/mpld3,giserh/mpld3,void32/mpld3,kdheepak89/mpld3,etgalloway/mpld3,huongttlan/mpld3,aflaxman/mpld3,fdeheeger/mpld3,jayhetee/mpld3,Jiangshangmin/mpld3,e-koch/mpld3,jayhetee/mpld3,mlovci/mpld3,aflaxman/mpld3,jrkerns/mpld3,... | mpld3/urls.py | mpld3/urls.py | import os
from . import __path__
import warnings
#warnings.warn("using temporary MPLD3_URL: switch to ghpages ASAP!")
__all__ = ["D3_URL", "MPLD3_URL", "D3_LOCAL", "MPLD3_LOCAL"]
D3_URL = "http://d3js.org/d3.v3.min.js"
MPLD3_URL = "http://mpld3.github.io/js/mpld3.v0.1.js"
D3_LOCAL = os.path.join(__path__[0], "js", ... | import os
from . import __path__
import warnings
#warnings.warn("using temporary MPLD3_URL: switch to ghpages ASAP!")
__all__ = ["D3_URL", "MPLD3_URL", "D3_LOCAL", "MPLD3_LOCAL"]
D3_URL = "http://d3js.org/d3.v3.min.js"
MPLD3_URL = "http://mpld3.github.io/js/mpld3.v0.1.js
D3_LOCAL = os.path.join(__path__[0], "js", "... | bsd-3-clause | Python |
509fb695072cc9a2e602ab80d44e615aecd7b1b0 | Fix a bug that broke Python 2.5 support. | ryanpetrello/cleaver | cleaver/backend/db/model.py | cleaver/backend/db/model.py | import sqlalchemy as sa
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
ModelBase = declarative_base()
class Experiment(ModelBase):
__tablename__ = 'cleaver_experiment'
name = sa.Column(sa.UnicodeText, primary_key=True)
started_on = sa.Column(sa.DateTime, ... | import sqlalchemy as sa
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
ModelBase = declarative_base()
class Experiment(ModelBase):
__tablename__ = 'cleaver_experiment'
name = sa.Column(sa.UnicodeText, primary_key=True)
started_on = sa.Column(sa.DateTime, ... | bsd-3-clause | Python |
ece87040e75bc5add21d2904444ef8e5edb6761e | Use ranged comparison | jaraco/jaraco.functools | test_functools.py | test_functools.py | import itertools
import time
import copy
import sys
import pytest
from jaraco.functools import Throttler, method_cache
class TestThrottler(object):
def test_function_throttled(self):
"""
Ensure the throttler actually throttles calls.
"""
# set up a function to be called
counter = itertools.count()
# se... | import itertools
import time
import copy
import sys
import pytest
from jaraco.functools import Throttler, method_cache
class TestThrottler(object):
def test_function_throttled(self):
"""
Ensure the throttler actually throttles calls.
"""
# set up a function to be called
counter = itertools.count()
# se... | mit | Python |
f549d13773eb6c45791af7b734be098b2f90a71e | Remove mention of old test_compare.py | pwyf/foxpath-tools | tests/__init__.py | tests/__init__.py | from .test_list import *
from .test_simple import *
| from .test_compare import *
from .test_list import *
from .test_simple import *
| mit | Python |
376fb5860c573416ac71a0dfe5437011858398b6 | Update __init__.py | luigi-riefolo/network_crawler,luigi-riefolo/network_crawler | tests/__init__.py | tests/__init__.py | """Unit tests init."""
import json
import os
import time
import unittest
try:
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
except ImportError as imp_err:
raise ImportError('Failed to import \'selenium\':\n' + str(imp_err))
from network_crawler.api.operator_web_... | """Unit tests init."""
import json
import os
import time
import unittest
try:
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
except ImportError as imp_err:
raise ImportError('Failed to import \'selenium\':\n' + imp_err)
from network_crawler.api.operator_web_site ... | mit | Python |
5c77d1203e7f6f985cb7a470324dafba648bbdcd | remove imports | justinwp/croplands,justinwp/croplands | tests/__init__.py | tests/__init__.py | # import unittest
#
#
# from test_auth_views import TestAuthViews
# from test_email import TestEmail
# from test_api import TestApi
# from test_utils_s3 import TestUtilsS3
# from test_db_models import TestDatabase
# from test_countries import TestCountries
# from test_tasks import TestTasks
#
# if __name__ == '__main__... | import unittest
from test_auth_views import TestAuthViews
from test_email import TestEmail
from test_api import TestApi
from test_utils_s3 import TestUtilsS3
from test_db_models import TestDatabase
from test_countries import TestCountries
from test_tasks import TestTasks
if __name__ == '__main__':
unittest.main(... | mit | Python |
ac746d0afcd0a3a3267ee701dc868d584e3f5d94 | Remove unused imports | avanov/Rhetoric,avanov/Rhetoric | tests/__init__.py | tests/__init__.py | import unittest
import os
class BaseTestCase(unittest.TestCase):
def setUp(self):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.testapp.settings")
from django.test.client import Client
from tests.testapp.testapp.wsgi import application
import rhetoric
D... | import unittest
import os
import re
class BaseTestCase(unittest.TestCase):
def setUp(self):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.testapp.settings")
from django.test.client import Client
from tests.testapp.testapp.wsgi import application
import rhetoric
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.